@angular/core 17.0.6 → 17.0.8

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 (71) hide show
  1. package/esm2022/primitives/signals/src/signal.mjs +2 -9
  2. package/esm2022/src/application/application_config.mjs +21 -0
  3. package/esm2022/src/application/application_init.mjs +188 -0
  4. package/esm2022/src/application/application_module.mjs +29 -0
  5. package/esm2022/src/application/application_ref.mjs +505 -0
  6. package/esm2022/src/application/application_tokens.mjs +121 -0
  7. package/esm2022/src/application/create_application.mjs +102 -0
  8. package/esm2022/src/change_detection/flags.mjs +16 -0
  9. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +164 -0
  10. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +13 -0
  11. package/esm2022/src/core.mjs +10 -7
  12. package/esm2022/src/core_private_export.mjs +8 -4
  13. package/esm2022/src/core_reactivity_export_internal.mjs +2 -2
  14. package/esm2022/src/core_render3_private_export.mjs +2 -2
  15. package/esm2022/src/error_handler.mjs +15 -1
  16. package/esm2022/src/event_emitter.mjs +1 -2
  17. package/esm2022/src/hydration/annotate.mjs +1 -1
  18. package/esm2022/src/hydration/api.mjs +2 -2
  19. package/esm2022/src/hydration/cleanup.mjs +1 -1
  20. package/esm2022/src/image_performance_warning.mjs +2 -2
  21. package/esm2022/src/linker/query_list.mjs +8 -6
  22. package/esm2022/src/metadata/do_bootstrap.mjs +1 -1
  23. package/esm2022/src/pending_tasks.mjs +57 -0
  24. package/esm2022/src/platform/platform.mjs +135 -0
  25. package/esm2022/src/platform/platform_core_providers.mjs +15 -0
  26. package/esm2022/src/platform/platform_ref.mjs +179 -0
  27. package/esm2022/src/render3/after_render_hooks.mjs +2 -2
  28. package/esm2022/src/render3/component_ref.mjs +13 -9
  29. package/esm2022/src/render3/instructions/change_detection.mjs +2 -4
  30. package/esm2022/src/render3/instructions/mark_view_dirty.mjs +3 -2
  31. package/esm2022/src/render3/instructions/shared.mjs +3 -2
  32. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  33. package/esm2022/src/render3/list_reconciliation.mjs +58 -24
  34. package/esm2022/src/render3/util/change_detection_utils.mjs +3 -1
  35. package/esm2022/src/render3/util/misc_utils.mjs +2 -2
  36. package/esm2022/src/render3/util/view_utils.mjs +18 -5
  37. package/esm2022/src/render3/view_ref.mjs +8 -1
  38. package/esm2022/src/transfer_state.mjs +2 -2
  39. package/esm2022/src/util/performance.mjs +2 -2
  40. package/esm2022/src/version.mjs +6 -5
  41. package/esm2022/src/zone/ng_zone.mjs +10 -61
  42. package/esm2022/testing/src/component_fixture.mjs +20 -36
  43. package/esm2022/testing/src/logger.mjs +3 -3
  44. package/esm2022/testing/src/test_bed.mjs +5 -6
  45. package/fesm2022/core.mjs +1409 -1340
  46. package/fesm2022/core.mjs.map +1 -1
  47. package/fesm2022/primitives/signals.mjs +2 -9
  48. package/fesm2022/primitives/signals.mjs.map +1 -1
  49. package/fesm2022/rxjs-interop.mjs +1 -1
  50. package/fesm2022/testing.mjs +46 -64
  51. package/fesm2022/testing.mjs.map +1 -1
  52. package/index.d.ts +50 -35
  53. package/package.json +1 -1
  54. package/primitives/signals/index.d.ts +1 -1
  55. package/rxjs-interop/index.d.ts +1 -1
  56. package/schematics/migrations/block-template-entities/bundle.js +863 -673
  57. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  58. package/schematics/migrations/compiler-options/bundle.js +13 -13
  59. package/schematics/migrations/transfer-state/bundle.js +13 -13
  60. package/schematics/ng-generate/control-flow-migration/bundle.js +1175 -782
  61. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  62. package/schematics/ng-generate/standalone-migration/bundle.js +1168 -933
  63. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  64. package/testing/index.d.ts +6 -10
  65. package/esm2022/src/application_config.mjs +0 -21
  66. package/esm2022/src/application_init.mjs +0 -188
  67. package/esm2022/src/application_module.mjs +0 -29
  68. package/esm2022/src/application_ref.mjs +0 -997
  69. package/esm2022/src/application_tokens.mjs +0 -121
  70. package/esm2022/src/initial_render_pending_tasks.mjs +0 -49
  71. package/esm2022/src/platform_core_providers.mjs +0 -15
@@ -63,7 +63,7 @@ var __async = (__this, __arguments, generator) => {
63
63
  });
64
64
  };
65
65
 
66
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/index.mjs
66
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/index.mjs
67
67
  var control_flow_migration_exports = {};
68
68
  __export(control_flow_migration_exports, {
69
69
  default: () => control_flow_migration_default
@@ -72,22 +72,22 @@ module.exports = __toCommonJS(control_flow_migration_exports);
72
72
  var import_schematics = require("@angular-devkit/schematics");
73
73
  var import_path3 = require("path");
74
74
 
75
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
75
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
76
76
  var import_typescript2 = __toESM(require("typescript"), 1);
77
77
 
78
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
78
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
79
79
  var import_typescript = __toESM(require("typescript"), 1);
80
80
 
81
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
81
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
82
82
  function normalizePath(path2) {
83
83
  return path2.replace(/\\/g, "/");
84
84
  }
85
85
 
86
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
86
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
87
87
  var import_path = require("path");
88
88
  var import_typescript4 = __toESM(require("typescript"), 1);
89
89
 
90
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
90
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
91
91
  var path = __toESM(require("path"), 1);
92
92
  var import_typescript3 = __toESM(require("typescript"), 1);
93
93
  function parseTsconfigFile(tsconfigPath, basePath) {
@@ -104,7 +104,7 @@ function parseTsconfigFile(tsconfigPath, basePath) {
104
104
  return import_typescript3.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
105
105
  }
106
106
 
107
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
107
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
108
108
  function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
109
109
  const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles);
110
110
  return import_typescript4.default.createProgram(rootNames, options, host);
@@ -137,7 +137,7 @@ function canMigrateFile(basePath, sourceFile, program) {
137
137
  return !(0, import_path.relative)(basePath, sourceFile.fileName).startsWith("..");
138
138
  }
139
139
 
140
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/selector.mjs
140
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/selector.mjs
141
141
  var _SELECTOR_REGEXP = new RegExp(
142
142
  `(\\:not\\()|(([\\.\\#]?)[-\\w]+)|(?:\\[([-.\\w*\\\\$]+)(?:=(["']?)([^\\]"']*)\\5)?\\])|(\\))|(\\s*,\\s*)`,
143
143
  "g"
@@ -445,7 +445,7 @@ var SelectorContext = class {
445
445
  }
446
446
  };
447
447
 
448
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/core.mjs
448
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/core.mjs
449
449
  var ViewEncapsulation;
450
450
  (function(ViewEncapsulation2) {
451
451
  ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated";
@@ -507,7 +507,7 @@ function parseSelectorToR3Selector(selector) {
507
507
  return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : [];
508
508
  }
509
509
 
510
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/digest.mjs
510
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/digest.mjs
511
511
  var textEncoder;
512
512
  function computeDigest(message) {
513
513
  return sha1(serializeNodes(message.nodes).join("") + `[${message.meaning}]`);
@@ -747,7 +747,7 @@ function wordAt(bytes, index, endian) {
747
747
  return word;
748
748
  }
749
749
 
750
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_ast.mjs
750
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/output_ast.mjs
751
751
  var TypeModifier;
752
752
  (function(TypeModifier2) {
753
753
  TypeModifier2[TypeModifier2["None"] = 0] = "None";
@@ -1702,7 +1702,7 @@ function serializeTags(tags) {
1702
1702
  return out;
1703
1703
  }
1704
1704
 
1705
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/constant_pool.mjs
1705
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/constant_pool.mjs
1706
1706
  var CONSTANT_PREFIX = "_c";
1707
1707
  var UNKNOWN_VALUE_KEY = variable("<unknown>");
1708
1708
  var KEY_CONTEXT = {};
@@ -1805,7 +1805,7 @@ var ConstantPool = class {
1805
1805
  }))));
1806
1806
  }
1807
1807
  }
1808
- getSharedFunctionReference(fn2, prefix) {
1808
+ getSharedFunctionReference(fn2, prefix, useUniqueName = true) {
1809
1809
  var _a2;
1810
1810
  const isArrow = fn2 instanceof ArrowFunctionExpr;
1811
1811
  for (const current of this.statements) {
@@ -1816,7 +1816,7 @@ var ConstantPool = class {
1816
1816
  return variable(current.name);
1817
1817
  }
1818
1818
  }
1819
- const name = this.uniqueName(prefix);
1819
+ const name = useUniqueName ? this.uniqueName(prefix) : prefix;
1820
1820
  this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
1821
1821
  return variable(name);
1822
1822
  }
@@ -1885,7 +1885,7 @@ function isLongStringLiteral(expr) {
1885
1885
  return expr instanceof LiteralExpr && typeof expr.value === "string" && expr.value.length >= POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS;
1886
1886
  }
1887
1887
 
1888
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_identifiers.mjs
1888
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_identifiers.mjs
1889
1889
  var CORE = "@angular/core";
1890
1890
  var _Identifiers = class {
1891
1891
  };
@@ -2518,7 +2518,7 @@ var Identifiers = _Identifiers;
2518
2518
  _Identifiers.validateIframeAttribute = { name: "\u0275\u0275validateIframeAttribute", moduleName: CORE };
2519
2519
  })();
2520
2520
 
2521
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/util.mjs
2521
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/util.mjs
2522
2522
  var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
2523
2523
  function dashCaseToCamelCase(input) {
2524
2524
  return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
@@ -2606,7 +2606,7 @@ function partitionArray(arr, conditionFn) {
2606
2606
  return [truthy, falsy];
2607
2607
  }
2608
2608
 
2609
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/source_map.mjs
2609
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/source_map.mjs
2610
2610
  var VERSION = 3;
2611
2611
  var JS_B64_PREFIX = "# sourceMappingURL=data:application/json;base64,";
2612
2612
  var SourceMapGenerator = class {
@@ -2735,7 +2735,7 @@ function toBase64Digit(value) {
2735
2735
  return B64_DIGITS[value];
2736
2736
  }
2737
2737
 
2738
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/abstract_emitter.mjs
2738
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/abstract_emitter.mjs
2739
2739
  var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
2740
2740
  var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
2741
2741
  var _INDENT_WITH = " ";
@@ -3220,7 +3220,7 @@ function _createIndent(count) {
3220
3220
  return res;
3221
3221
  }
3222
3222
 
3223
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/util.mjs
3223
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/util.mjs
3224
3224
  function typeWithParameters(type, numParams) {
3225
3225
  if (numParams === 0) {
3226
3226
  return expressionType(type);
@@ -3285,7 +3285,7 @@ function generateForwardRef(expr) {
3285
3285
  return importExpr(Identifiers.forwardRef).callFn([arrowFn([], expr)]);
3286
3286
  }
3287
3287
 
3288
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_factory.mjs
3288
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_factory.mjs
3289
3289
  var R3FactoryDelegateType;
3290
3290
  (function(R3FactoryDelegateType2) {
3291
3291
  R3FactoryDelegateType2[R3FactoryDelegateType2["Class"] = 0] = "Class";
@@ -3430,20 +3430,24 @@ function getInjectFn(target) {
3430
3430
  }
3431
3431
  }
3432
3432
 
3433
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
3433
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
3434
3434
  var TagContentType;
3435
3435
  (function(TagContentType2) {
3436
3436
  TagContentType2[TagContentType2["RAW_TEXT"] = 0] = "RAW_TEXT";
3437
3437
  TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
3438
3438
  TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
3439
3439
  })(TagContentType || (TagContentType = {}));
3440
- function splitNsName(elementName) {
3440
+ function splitNsName(elementName, fatal = true) {
3441
3441
  if (elementName[0] != ":") {
3442
3442
  return [null, elementName];
3443
3443
  }
3444
3444
  const colonIndex = elementName.indexOf(":", 1);
3445
3445
  if (colonIndex === -1) {
3446
- throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
3446
+ if (fatal) {
3447
+ throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
3448
+ } else {
3449
+ return [null, elementName];
3450
+ }
3447
3451
  }
3448
3452
  return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
3449
3453
  }
@@ -3463,7 +3467,7 @@ function mergeNsAndName(prefix, localName) {
3463
3467
  return prefix ? `:${prefix}:${localName}` : localName;
3464
3468
  }
3465
3469
 
3466
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_ast.mjs
3470
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_ast.mjs
3467
3471
  var Comment = class {
3468
3472
  constructor(value, sourceSpan) {
3469
3473
  this.value = value;
@@ -3844,7 +3848,7 @@ function visitAll(visitor, nodes) {
3844
3848
  return result;
3845
3849
  }
3846
3850
 
3847
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/i18n_ast.mjs
3851
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/i18n_ast.mjs
3848
3852
  var Message = class {
3849
3853
  constructor(nodes, placeholders, placeholderToMessage, meaning, description, customId) {
3850
3854
  this.nodes = nodes;
@@ -3950,28 +3954,6 @@ var BlockPlaceholder = class {
3950
3954
  return visitor.visitBlockPlaceholder(this, context);
3951
3955
  }
3952
3956
  };
3953
- var RecurseVisitor = class {
3954
- visitText(text2, context) {
3955
- }
3956
- visitContainer(container, context) {
3957
- container.children.forEach((child) => child.visit(this));
3958
- }
3959
- visitIcu(icu, context) {
3960
- Object.keys(icu.cases).forEach((k) => {
3961
- icu.cases[k].visit(this);
3962
- });
3963
- }
3964
- visitTagPlaceholder(ph, context) {
3965
- ph.children.forEach((child) => child.visit(this));
3966
- }
3967
- visitPlaceholder(ph, context) {
3968
- }
3969
- visitIcuPlaceholder(ph, context) {
3970
- }
3971
- visitBlockPlaceholder(ph, context) {
3972
- ph.children.forEach((child) => child.visit(this));
3973
- }
3974
- };
3975
3957
  function serializeMessage(messageNodes) {
3976
3958
  const visitor = new LocalizeMessageStringVisitor();
3977
3959
  const str = messageNodes.map((n) => n.visit(visitor)).join("");
@@ -4004,7 +3986,7 @@ var LocalizeMessageStringVisitor = class {
4004
3986
  }
4005
3987
  };
4006
3988
 
4007
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
3989
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
4008
3990
  var _Visitor = class {
4009
3991
  visitTag(tag) {
4010
3992
  const strAttrs = this._serializeAttributes(tag.attrs);
@@ -4032,12 +4014,12 @@ ${doctype.dtd}
4032
4014
  };
4033
4015
  var _visitor = new _Visitor();
4034
4016
 
4035
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/xmb.mjs
4017
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/serializers/xmb.mjs
4036
4018
  function toPublicName(internalName) {
4037
4019
  return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, "_");
4038
4020
  }
4039
4021
 
4040
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/util.mjs
4022
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/util.mjs
4041
4023
  var CLOSURE_TRANSLATION_VAR_PREFIX = "MSG_";
4042
4024
  var TRANSLATION_VAR_PREFIX = "i18n_";
4043
4025
  var I18N_ATTR = "i18n";
@@ -4139,7 +4121,7 @@ function declareI18nVariable(variable2) {
4139
4121
  return new DeclareVarStmt(variable2.name, void 0, INFERRED_TYPE, void 0, variable2.sourceSpan);
4140
4122
  }
4141
4123
 
4142
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/util.mjs
4124
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/util.mjs
4143
4125
  var UNSAFE_OBJECT_KEY_NAME_REGEXP = /[-.]/;
4144
4126
  var TEMPORARY_NAME = "_t";
4145
4127
  var CONTEXT_NAME = "ctx";
@@ -4379,7 +4361,7 @@ function getInstructionStatements(instructions) {
4379
4361
  return statements;
4380
4362
  }
4381
4363
 
4382
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/injectable_compiler_2.mjs
4364
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/injectable_compiler_2.mjs
4383
4365
  function compileInjectable(meta, resolveForwardRefs) {
4384
4366
  let result = null;
4385
4367
  const factoryMeta = {
@@ -4464,7 +4446,7 @@ function createFactoryFunction(type) {
4464
4446
  return arrowFn([new FnParam("t", DYNAMIC_TYPE)], type.prop("\u0275fac").callFn([variable("t")]));
4465
4447
  }
4466
4448
 
4467
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/assertions.mjs
4449
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/assertions.mjs
4468
4450
  var UNUSABLE_INTERPOLATION_REGEXPS = [
4469
4451
  /^\s*$/,
4470
4452
  /[<>]/,
@@ -4486,7 +4468,7 @@ function assertInterpolationSymbols(identifier, value) {
4486
4468
  }
4487
4469
  }
4488
4470
 
4489
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
4471
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
4490
4472
  var InterpolationConfig = class {
4491
4473
  static fromArray(markers) {
4492
4474
  if (!markers) {
@@ -4503,7 +4485,7 @@ var InterpolationConfig = class {
4503
4485
  var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig("{{", "}}");
4504
4486
  var DEFAULT_CONTAINER_BLOCKS = /* @__PURE__ */ new Set(["switch"]);
4505
4487
 
4506
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/chars.mjs
4488
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/chars.mjs
4507
4489
  var $EOF = 0;
4508
4490
  var $BSPACE = 8;
4509
4491
  var $TAB = 9;
@@ -4585,7 +4567,7 @@ function isQuote(code) {
4585
4567
  return code === $SQ || code === $DQ || code === $BT;
4586
4568
  }
4587
4569
 
4588
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/parse_util.mjs
4570
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/parse_util.mjs
4589
4571
  var ParseLocation = class {
4590
4572
  constructor(file, offset, line, col) {
4591
4573
  this.file = file;
@@ -4732,7 +4714,7 @@ function sanitizeIdentifier(name) {
4732
4714
  return name.replace(/\W/g, "_");
4733
4715
  }
4734
4716
 
4735
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/abstract_js_emitter.mjs
4717
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/abstract_js_emitter.mjs
4736
4718
  var makeTemplateObjectPolyfill = '(this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e})';
4737
4719
  var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
4738
4720
  constructor() {
@@ -4825,7 +4807,7 @@ var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
4825
4807
  }
4826
4808
  };
4827
4809
 
4828
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_jit_trusted_types.mjs
4810
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/output_jit_trusted_types.mjs
4829
4811
  var policy;
4830
4812
  function getPolicy() {
4831
4813
  if (policy === void 0) {
@@ -4863,7 +4845,7 @@ function newTrustedFunctionForJIT(...args) {
4863
4845
  return fn2.bind(_global);
4864
4846
  }
4865
4847
 
4866
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_jit.mjs
4848
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/output_jit.mjs
4867
4849
  var JitEvaluator = class {
4868
4850
  evaluateStatements(sourceUrl, statements, refResolver, createSourceMaps) {
4869
4851
  const converter = new JitEmitterVisitor(refResolver);
@@ -4954,7 +4936,7 @@ function isUseStrictStatement(statement) {
4954
4936
  return statement.isEquivalent(literal("use strict").toStmt());
4955
4937
  }
4956
4938
 
4957
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_injector_compiler.mjs
4939
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_injector_compiler.mjs
4958
4940
  function compileInjector(meta) {
4959
4941
  const definitionMap = new DefinitionMap();
4960
4942
  if (meta.providers !== null) {
@@ -4971,7 +4953,7 @@ function createInjectorType(meta) {
4971
4953
  return new ExpressionType(importExpr(Identifiers.InjectorDeclaration, [new ExpressionType(meta.type.type)]));
4972
4954
  }
4973
4955
 
4974
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_jit.mjs
4956
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_jit.mjs
4975
4957
  var R3JitReflector = class {
4976
4958
  constructor(context) {
4977
4959
  this.context = context;
@@ -4987,7 +4969,7 @@ var R3JitReflector = class {
4987
4969
  }
4988
4970
  };
4989
4971
 
4990
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_module_compiler.mjs
4972
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_module_compiler.mjs
4991
4973
  var R3SelectorScopeMode;
4992
4974
  (function(R3SelectorScopeMode2) {
4993
4975
  R3SelectorScopeMode2[R3SelectorScopeMode2["Inline"] = 0] = "Inline";
@@ -5128,7 +5110,7 @@ function tupleOfTypes(types) {
5128
5110
  return types.length > 0 ? expressionType(literalArr(typeofTypes)) : NONE_TYPE;
5129
5111
  }
5130
5112
 
5131
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_pipe_compiler.mjs
5113
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_pipe_compiler.mjs
5132
5114
  function compilePipeFromMetadata(metadata) {
5133
5115
  const definitionMapValues = [];
5134
5116
  definitionMapValues.push({ key: "name", value: literal(metadata.pipeName), quoted: false });
@@ -5149,7 +5131,7 @@ function createPipeType(metadata) {
5149
5131
  ]));
5150
5132
  }
5151
5133
 
5152
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/api.mjs
5134
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/api.mjs
5153
5135
  var R3TemplateDependencyKind;
5154
5136
  (function(R3TemplateDependencyKind2) {
5155
5137
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["Directive"] = 0] = "Directive";
@@ -5157,7 +5139,7 @@ var R3TemplateDependencyKind;
5157
5139
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["NgModule"] = 2] = "NgModule";
5158
5140
  })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
5159
5141
 
5160
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/ast.mjs
5142
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/expression_parser/ast.mjs
5161
5143
  var ParserError = class {
5162
5144
  constructor(message, input, errLocation, ctxLocation) {
5163
5145
  this.input = input;
@@ -5823,7 +5805,7 @@ var BoundElementProperty = class {
5823
5805
  }
5824
5806
  };
5825
5807
 
5826
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/compiler_util/expression_converter.mjs
5808
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/compiler_util/expression_converter.mjs
5827
5809
  var _EventHandlerVars = class {
5828
5810
  };
5829
5811
  var EventHandlerVars = _EventHandlerVars;
@@ -6464,7 +6446,7 @@ var BuiltinFunctionCall = class extends Call {
6464
6446
  }
6465
6447
  };
6466
6448
 
6467
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/dom_security_schema.mjs
6449
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/dom_security_schema.mjs
6468
6450
  var _SECURITY_SCHEMA;
6469
6451
  function SECURITY_SCHEMA() {
6470
6452
  if (!_SECURITY_SCHEMA) {
@@ -6522,7 +6504,7 @@ function isIframeSecuritySensitiveAttr(attrName) {
6522
6504
  return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
6523
6505
  }
6524
6506
 
6525
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/shadow_css.mjs
6507
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/shadow_css.mjs
6526
6508
  var animationKeywords = /* @__PURE__ */ new Set([
6527
6509
  "inherit",
6528
6510
  "initial",
@@ -6993,7 +6975,7 @@ function repeatGroups(groups, multiples) {
6993
6975
  }
6994
6976
  }
6995
6977
 
6996
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/enums.mjs
6978
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/enums.mjs
6997
6979
  var OpKind;
6998
6980
  (function(OpKind2) {
6999
6981
  OpKind2[OpKind2["ListEnd"] = 0] = "ListEnd";
@@ -7039,8 +7021,9 @@ var OpKind;
7039
7021
  OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
7040
7022
  OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
7041
7023
  OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
7042
- OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
7043
- OpKind2[OpKind2["I18nAttributes"] = 44] = "I18nAttributes";
7024
+ OpKind2[OpKind2["IcuPlaceholder"] = 43] = "IcuPlaceholder";
7025
+ OpKind2[OpKind2["I18nContext"] = 44] = "I18nContext";
7026
+ OpKind2[OpKind2["I18nAttributes"] = 45] = "I18nAttributes";
7044
7027
  })(OpKind || (OpKind = {}));
7045
7028
  var ExpressionKind;
7046
7029
  (function(ExpressionKind2) {
@@ -7065,10 +7048,11 @@ var ExpressionKind;
7065
7048
  ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
7066
7049
  ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
7067
7050
  ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 20] = "SanitizerExpr";
7068
- ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 21] = "SlotLiteralExpr";
7069
- ExpressionKind2[ExpressionKind2["ConditionalCase"] = 22] = "ConditionalCase";
7070
- ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 23] = "DerivedRepeaterVar";
7071
- ExpressionKind2[ExpressionKind2["ConstCollected"] = 24] = "ConstCollected";
7051
+ ExpressionKind2[ExpressionKind2["TrustedValueFnExpr"] = 21] = "TrustedValueFnExpr";
7052
+ ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 22] = "SlotLiteralExpr";
7053
+ ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
7054
+ ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 24] = "DerivedRepeaterVar";
7055
+ ExpressionKind2[ExpressionKind2["ConstCollected"] = 25] = "ConstCollected";
7072
7056
  })(ExpressionKind || (ExpressionKind = {}));
7073
7057
  var VariableFlags;
7074
7058
  (function(VariableFlags2) {
@@ -7087,15 +7071,6 @@ var CompatibilityMode;
7087
7071
  CompatibilityMode2[CompatibilityMode2["Normal"] = 0] = "Normal";
7088
7072
  CompatibilityMode2[CompatibilityMode2["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
7089
7073
  })(CompatibilityMode || (CompatibilityMode = {}));
7090
- var SanitizerFn;
7091
- (function(SanitizerFn2) {
7092
- SanitizerFn2[SanitizerFn2["Html"] = 0] = "Html";
7093
- SanitizerFn2[SanitizerFn2["Script"] = 1] = "Script";
7094
- SanitizerFn2[SanitizerFn2["Style"] = 2] = "Style";
7095
- SanitizerFn2[SanitizerFn2["Url"] = 3] = "Url";
7096
- SanitizerFn2[SanitizerFn2["ResourceUrl"] = 4] = "ResourceUrl";
7097
- SanitizerFn2[SanitizerFn2["IframeAttribute"] = 5] = "IframeAttribute";
7098
- })(SanitizerFn || (SanitizerFn = {}));
7099
7074
  var DeferSecondaryKind;
7100
7075
  (function(DeferSecondaryKind2) {
7101
7076
  DeferSecondaryKind2[DeferSecondaryKind2["Loading"] = 0] = "Loading";
@@ -7166,7 +7141,7 @@ var TemplateKind;
7166
7141
  TemplateKind2[TemplateKind2["Block"] = 2] = "Block";
7167
7142
  })(TemplateKind || (TemplateKind = {}));
7168
7143
 
7169
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7144
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7170
7145
  var ConsumesSlot = Symbol("ConsumesSlot");
7171
7146
  var DependsOnSlotContext = Symbol("DependsOnSlotContext");
7172
7147
  var ConsumesVarsTrait = Symbol("ConsumesVars");
@@ -7198,7 +7173,7 @@ function hasUsesVarOffsetTrait(expr) {
7198
7173
  return expr[UsesVarOffset] === true;
7199
7174
  }
7200
7175
 
7201
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/shared.mjs
7176
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/shared.mjs
7202
7177
  function createStatementOp(statement) {
7203
7178
  return __spreadValues({
7204
7179
  kind: OpKind.Statement,
@@ -7220,7 +7195,7 @@ var NEW_OP = {
7220
7195
  next: null
7221
7196
  };
7222
7197
 
7223
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
7198
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
7224
7199
  function createInterpolateTextOp(xref, interpolation, sourceSpan) {
7225
7200
  return __spreadValues(__spreadValues(__spreadValues({
7226
7201
  kind: OpKind.InterpolateText,
@@ -7239,7 +7214,7 @@ var Interpolation2 = class {
7239
7214
  }
7240
7215
  }
7241
7216
  };
7242
- function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplate, i18nContext, sourceSpan) {
7217
+ function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7243
7218
  return __spreadValues({
7244
7219
  kind: OpKind.Binding,
7245
7220
  bindingKind: kind,
@@ -7249,12 +7224,14 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
7249
7224
  unit,
7250
7225
  securityContext,
7251
7226
  isTextAttribute,
7252
- isStructuralTemplate,
7253
- i18nContext,
7227
+ isStructuralTemplateAttribute,
7228
+ templateKind,
7229
+ i18nContext: null,
7230
+ i18nMessage,
7254
7231
  sourceSpan
7255
7232
  }, NEW_OP);
7256
7233
  }
7257
- function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplate, i18nContext, sourceSpan) {
7234
+ function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
7258
7235
  return __spreadValues(__spreadValues(__spreadValues({
7259
7236
  kind: OpKind.Property,
7260
7237
  target,
@@ -7263,8 +7240,10 @@ function createPropertyOp(target, name, expression, isAnimationTrigger, security
7263
7240
  isAnimationTrigger,
7264
7241
  securityContext,
7265
7242
  sanitizer: null,
7266
- isStructuralTemplate,
7243
+ isStructuralTemplateAttribute,
7244
+ templateKind,
7267
7245
  i18nContext,
7246
+ i18nMessage,
7268
7247
  sourceSpan
7269
7248
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7270
7249
  }
@@ -7303,7 +7282,7 @@ function createClassMapOp(xref, expression, sourceSpan) {
7303
7282
  sourceSpan
7304
7283
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7305
7284
  }
7306
- function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplate, i18nContext, sourceSpan) {
7285
+ function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7307
7286
  return __spreadValues(__spreadValues(__spreadValues({
7308
7287
  kind: OpKind.Attribute,
7309
7288
  target,
@@ -7312,8 +7291,10 @@ function createAttributeOp(target, name, expression, securityContext, isTextAttr
7312
7291
  securityContext,
7313
7292
  sanitizer: null,
7314
7293
  isTextAttribute,
7315
- isStructuralTemplate,
7316
- i18nContext,
7294
+ isStructuralTemplateAttribute,
7295
+ templateKind,
7296
+ i18nContext: null,
7297
+ i18nMessage,
7317
7298
  sourceSpan
7318
7299
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7319
7300
  }
@@ -7346,15 +7327,15 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
7346
7327
  }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7347
7328
  }
7348
7329
  function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
7349
- return __spreadValues(__spreadValues({
7330
+ return __spreadValues(__spreadValues(__spreadValues({
7350
7331
  kind: OpKind.DeferWhen,
7351
7332
  target,
7352
7333
  expr,
7353
7334
  prefetch,
7354
7335
  sourceSpan
7355
- }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7336
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7356
7337
  }
7357
- function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
7338
+ function createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
7358
7339
  return __spreadValues(__spreadValues(__spreadValues({
7359
7340
  kind: OpKind.I18nExpression,
7360
7341
  context,
@@ -7362,6 +7343,7 @@ function createI18nExpressionOp(context, target, i18nOwner, handle, expression,
7362
7343
  i18nOwner,
7363
7344
  handle,
7364
7345
  expression,
7346
+ icuPlaceholder,
7365
7347
  i18nPlaceholder,
7366
7348
  resolutionTime,
7367
7349
  usage,
@@ -7378,7 +7360,7 @@ function createI18nApplyOp(owner, handle, sourceSpan) {
7378
7360
  }, NEW_OP);
7379
7361
  }
7380
7362
 
7381
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7363
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7382
7364
  var _a;
7383
7365
  var _b;
7384
7366
  var _c;
@@ -7909,26 +7891,6 @@ var ReadTemporaryExpr = class extends ExpressionBase {
7909
7891
  return r;
7910
7892
  }
7911
7893
  };
7912
- var SanitizerExpr = class extends ExpressionBase {
7913
- constructor(fn2) {
7914
- super();
7915
- this.fn = fn2;
7916
- this.kind = ExpressionKind.SanitizerExpr;
7917
- }
7918
- visitExpression(visitor, context) {
7919
- }
7920
- isEquivalent(e) {
7921
- return e instanceof SanitizerExpr && e.fn === this.fn;
7922
- }
7923
- isConstant() {
7924
- return true;
7925
- }
7926
- clone() {
7927
- return new SanitizerExpr(this.fn);
7928
- }
7929
- transformInternalExpressions() {
7930
- }
7931
- };
7932
7894
  var SlotLiteralExpr = class extends ExpressionBase {
7933
7895
  constructor(slot) {
7934
7896
  super();
@@ -8047,7 +8009,6 @@ function transformExpressionsInOp(op, transform2, flags) {
8047
8009
  case OpKind.ClassProp:
8048
8010
  case OpKind.ClassMap:
8049
8011
  case OpKind.Binding:
8050
- case OpKind.HostProperty:
8051
8012
  if (op.expression instanceof Interpolation2) {
8052
8013
  transformExpressionsInInterpolation(op.expression, transform2, flags);
8053
8014
  } else {
@@ -8055,6 +8016,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8055
8016
  }
8056
8017
  break;
8057
8018
  case OpKind.Property:
8019
+ case OpKind.HostProperty:
8058
8020
  case OpKind.Attribute:
8059
8021
  if (op.expression instanceof Interpolation2) {
8060
8022
  transformExpressionsInInterpolation(op.expression, transform2, flags);
@@ -8096,6 +8058,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8096
8058
  break;
8097
8059
  case OpKind.ExtractedAttribute:
8098
8060
  op.expression = op.expression && transformExpressionsInExpression(op.expression, transform2, flags);
8061
+ op.trustedValueFn = op.trustedValueFn && transformExpressionsInExpression(op.trustedValueFn, transform2, flags);
8099
8062
  break;
8100
8063
  case OpKind.RepeaterCreate:
8101
8064
  op.track = transformExpressionsInExpression(op.track, transform2, flags);
@@ -8113,6 +8076,9 @@ function transformExpressionsInOp(op, transform2, flags) {
8113
8076
  if (op.placeholderConfig !== null) {
8114
8077
  op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
8115
8078
  }
8079
+ if (op.resolverFn !== null) {
8080
+ op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform2, flags);
8081
+ }
8116
8082
  break;
8117
8083
  case OpKind.I18nMessage:
8118
8084
  for (const [placeholder, expr] of op.params) {
@@ -8149,6 +8115,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8149
8115
  case OpKind.Template:
8150
8116
  case OpKind.Text:
8151
8117
  case OpKind.I18nAttributes:
8118
+ case OpKind.IcuPlaceholder:
8152
8119
  break;
8153
8120
  default:
8154
8121
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -8203,6 +8170,10 @@ function transformExpressionsInExpression(expr, transform2, flags) {
8203
8170
  }
8204
8171
  } else if (expr instanceof NotExpr) {
8205
8172
  expr.condition = transformExpressionsInExpression(expr.condition, transform2, flags);
8173
+ } else if (expr instanceof TaggedTemplateExpr) {
8174
+ expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
8175
+ expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
8176
+ } else if (expr instanceof WrappedNodeExpr) {
8206
8177
  } else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
8207
8178
  } else {
8208
8179
  throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
@@ -8234,7 +8205,7 @@ function isStringLiteral(expr) {
8234
8205
  return expr instanceof LiteralExpr && typeof expr.value === "string";
8235
8206
  }
8236
8207
 
8237
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/operations.mjs
8208
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/operations.mjs
8238
8209
  var _OpList = class {
8239
8210
  constructor() {
8240
8211
  this.debugListId = _OpList.nextListId++;
@@ -8425,14 +8396,14 @@ var OpList = _OpList;
8425
8396
  _OpList.nextListId = 0;
8426
8397
  })();
8427
8398
 
8428
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/handle.mjs
8399
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/handle.mjs
8429
8400
  var SlotHandle = class {
8430
8401
  constructor() {
8431
8402
  this.slot = null;
8432
8403
  }
8433
8404
  };
8434
8405
 
8435
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8406
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8436
8407
  var elementContainerOpKinds = /* @__PURE__ */ new Set([
8437
8408
  OpKind.Element,
8438
8409
  OpKind.ElementStart,
@@ -8444,7 +8415,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
8444
8415
  function isElementOrContainerOp(op) {
8445
8416
  return elementContainerOpKinds.has(op.kind);
8446
8417
  }
8447
- function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan) {
8418
+ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8448
8419
  return __spreadValues(__spreadValues({
8449
8420
  kind: OpKind.ElementStart,
8450
8421
  xref,
@@ -8455,10 +8426,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
8455
8426
  nonBindable: false,
8456
8427
  namespace,
8457
8428
  i18nPlaceholder,
8458
- sourceSpan
8429
+ startSourceSpan,
8430
+ wholeSourceSpan
8459
8431
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8460
8432
  }
8461
- function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
8433
+ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8462
8434
  return __spreadValues(__spreadValues({
8463
8435
  kind: OpKind.Template,
8464
8436
  xref,
@@ -8473,11 +8445,12 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
8473
8445
  nonBindable: false,
8474
8446
  namespace,
8475
8447
  i18nPlaceholder,
8476
- sourceSpan
8448
+ startSourceSpan,
8449
+ wholeSourceSpan
8477
8450
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8478
8451
  }
8479
- function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, sourceSpan) {
8480
- return __spreadProps(__spreadValues(__spreadValues({
8452
+ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8453
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
8481
8454
  kind: OpKind.RepeaterCreate,
8482
8455
  attributes: null,
8483
8456
  xref: primaryView,
@@ -8494,8 +8467,11 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, so
8494
8467
  vars: null,
8495
8468
  varNames,
8496
8469
  usesComponentInstance: false,
8497
- sourceSpan
8498
- }, TRAIT_CONSUMES_SLOT), NEW_OP), {
8470
+ i18nPlaceholder,
8471
+ emptyI18nPlaceholder,
8472
+ startSourceSpan,
8473
+ wholeSourceSpan
8474
+ }, TRAIT_CONSUMES_SLOT), NEW_OP), TRAIT_CONSUMES_VARS), {
8499
8475
  numSlotsUsed: emptyView === null ? 2 : 3
8500
8476
  });
8501
8477
  }
@@ -8518,16 +8494,19 @@ function createEnableBindingsOp(xref) {
8518
8494
  xref
8519
8495
  }, NEW_OP);
8520
8496
  }
8521
- function createTextOp(xref, initialValue, sourceSpan) {
8497
+ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
8522
8498
  return __spreadValues(__spreadValues({
8523
8499
  kind: OpKind.Text,
8524
8500
  xref,
8525
8501
  handle: new SlotHandle(),
8526
8502
  initialValue,
8503
+ icuPlaceholder,
8527
8504
  sourceSpan
8528
8505
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8529
8506
  }
8530
- function createListenerOp(target, targetSlot, name, tag, animationPhase, hostListener, sourceSpan) {
8507
+ function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPhase, eventTarget, hostListener, sourceSpan) {
8508
+ const handlerList = new OpList();
8509
+ handlerList.push(handlerOps);
8531
8510
  return __spreadValues({
8532
8511
  kind: OpKind.Listener,
8533
8512
  target,
@@ -8535,11 +8514,12 @@ function createListenerOp(target, targetSlot, name, tag, animationPhase, hostLis
8535
8514
  tag,
8536
8515
  hostListener,
8537
8516
  name,
8538
- handlerOps: new OpList(),
8517
+ handlerOps: handlerList,
8539
8518
  handlerFnName: null,
8540
8519
  consumesDollarEvent: false,
8541
8520
  isAnimationListener: animationPhase !== null,
8542
8521
  animationPhase,
8522
+ eventTarget,
8543
8523
  sourceSpan
8544
8524
  }, NEW_OP);
8545
8525
  }
@@ -8576,14 +8556,17 @@ function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceS
8576
8556
  sourceSpan
8577
8557
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8578
8558
  }
8579
- function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext) {
8559
+ function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
8580
8560
  return __spreadValues({
8581
8561
  kind: OpKind.ExtractedAttribute,
8582
8562
  target,
8583
8563
  bindingKind,
8584
8564
  name,
8585
8565
  expression,
8586
- i18nContext
8566
+ i18nContext,
8567
+ i18nMessage,
8568
+ securityContext,
8569
+ trustedValueFn: null
8587
8570
  }, NEW_OP);
8588
8571
  }
8589
8572
  function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
@@ -8668,6 +8651,15 @@ function createIcuEndOp(xref) {
8668
8651
  xref
8669
8652
  }, NEW_OP);
8670
8653
  }
8654
+ function createIcuPlaceholderOp(xref, name, strings) {
8655
+ return __spreadValues({
8656
+ kind: OpKind.IcuPlaceholder,
8657
+ xref,
8658
+ name,
8659
+ strings,
8660
+ expressionPlaceholders: []
8661
+ }, NEW_OP);
8662
+ }
8671
8663
  function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
8672
8664
  if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
8673
8665
  throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
@@ -8693,22 +8685,24 @@ function createI18nAttributesOp(xref, handle, target) {
8693
8685
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8694
8686
  }
8695
8687
 
8696
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8697
- function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, sourceSpan) {
8688
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8689
+ function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
8698
8690
  return __spreadValues(__spreadValues({
8699
8691
  kind: OpKind.HostProperty,
8700
8692
  name,
8701
8693
  expression,
8702
8694
  isAnimationTrigger,
8703
8695
  i18nContext,
8696
+ securityContext,
8697
+ sanitizer: null,
8704
8698
  sourceSpan
8705
8699
  }, TRAIT_CONSUMES_VARS), NEW_OP);
8706
8700
  }
8707
8701
 
8708
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/variable.mjs
8702
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/variable.mjs
8709
8703
  var CTX_REF = "CTX_REF_MARKER";
8710
8704
 
8711
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/compilation.mjs
8705
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/compilation.mjs
8712
8706
  var CompilationJobKind;
8713
8707
  (function(CompilationJobKind2) {
8714
8708
  CompilationJobKind2[CompilationJobKind2["Tmpl"] = 0] = "Tmpl";
@@ -8815,7 +8809,7 @@ var HostBindingCompilationUnit = class extends CompilationUnit {
8815
8809
  }
8816
8810
  };
8817
8811
 
8818
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/any_cast.mjs
8812
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/any_cast.mjs
8819
8813
  function deleteAnyCasts(job) {
8820
8814
  for (const unit of job.units) {
8821
8815
  for (const op of unit.ops()) {
@@ -8833,7 +8827,7 @@ function removeAnys(e) {
8833
8827
  return e;
8834
8828
  }
8835
8829
 
8836
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
8830
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
8837
8831
  function applyI18nExpressions(job) {
8838
8832
  const i18nContexts = /* @__PURE__ */ new Map();
8839
8833
  for (const unit of job.units) {
@@ -8876,62 +8870,52 @@ function needsApplication(i18nContexts, op) {
8876
8870
  return false;
8877
8871
  }
8878
8872
 
8879
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8873
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8880
8874
  function assignI18nSlotDependencies(job) {
8881
- const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
8882
- let lastSlotConsumer = null;
8883
- let currentI18nOp = null;
8884
8875
  for (const unit of job.units) {
8885
- for (const op of unit.create) {
8886
- if (hasConsumesSlotTrait(op)) {
8887
- lastSlotConsumer = op.xref;
8876
+ let updateOp = unit.update.head;
8877
+ let i18nExpressionsInProgress = [];
8878
+ let state = null;
8879
+ for (const createOp of unit.create) {
8880
+ if (createOp.kind === OpKind.I18nStart) {
8881
+ state = {
8882
+ blockXref: createOp.xref,
8883
+ lastSlotConsumer: createOp.xref
8884
+ };
8885
+ } else if (createOp.kind === OpKind.I18nEnd) {
8886
+ for (const op of i18nExpressionsInProgress) {
8887
+ op.target = state.lastSlotConsumer;
8888
+ OpList.insertBefore(op, updateOp);
8889
+ }
8890
+ i18nExpressionsInProgress.length = 0;
8891
+ state = null;
8888
8892
  }
8889
- switch (op.kind) {
8890
- case OpKind.I18nStart:
8891
- currentI18nOp = op;
8892
- break;
8893
- case OpKind.I18nEnd:
8894
- if (currentI18nOp === null) {
8895
- throw new Error("AssertionError: Expected an active I18n block while calculating last slot consumers");
8893
+ if (hasConsumesSlotTrait(createOp)) {
8894
+ if (state !== null) {
8895
+ state.lastSlotConsumer = createOp.xref;
8896
+ }
8897
+ while (true) {
8898
+ if (updateOp.next === null) {
8899
+ break;
8896
8900
  }
8897
- if (lastSlotConsumer === null) {
8898
- throw new Error("AssertionError: Expected a last slot consumer while calculating last slot consumers");
8901
+ if (state !== null && updateOp.kind === OpKind.I18nExpression && updateOp.usage === I18nExpressionFor.I18nText && updateOp.i18nOwner === state.blockXref) {
8902
+ const opToRemove = updateOp;
8903
+ updateOp = updateOp.next;
8904
+ OpList.remove(opToRemove);
8905
+ i18nExpressionsInProgress.push(opToRemove);
8906
+ continue;
8899
8907
  }
8900
- i18nLastSlotConsumers.set(currentI18nOp.xref, lastSlotConsumer);
8901
- currentI18nOp = null;
8902
- break;
8903
- }
8904
- }
8905
- let opsToMove = [];
8906
- let moveAfterTarget = null;
8907
- let previousTarget = null;
8908
- for (const op of unit.update) {
8909
- if (hasDependsOnSlotContextTrait(op)) {
8910
- if (moveAfterTarget !== null && previousTarget === moveAfterTarget && op.target !== previousTarget) {
8911
- OpList.insertBefore(opsToMove, op);
8912
- moveAfterTarget = null;
8913
- opsToMove = [];
8914
- }
8915
- previousTarget = op.target;
8916
- }
8917
- if (op.kind === OpKind.I18nExpression && op.usage === I18nExpressionFor.I18nText) {
8918
- OpList.remove(op);
8919
- opsToMove.push(op);
8920
- const target = i18nLastSlotConsumers.get(op.i18nOwner);
8921
- if (target === void 0) {
8922
- throw new Error("AssertionError: Expected to find a last slot consumer for an I18nExpressionOp");
8908
+ if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
8909
+ break;
8910
+ }
8911
+ updateOp = updateOp.next;
8923
8912
  }
8924
- op.target = target;
8925
- moveAfterTarget = op.target;
8926
8913
  }
8927
8914
  }
8928
- if (moveAfterTarget !== null) {
8929
- unit.update.push(opsToMove);
8930
- }
8931
8915
  }
8932
8916
  }
8933
8917
 
8934
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8918
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8935
8919
  function createOpXrefMap(unit) {
8936
8920
  const map = /* @__PURE__ */ new Map();
8937
8921
  for (const op of unit.create) {
@@ -8943,7 +8927,7 @@ function createOpXrefMap(unit) {
8943
8927
  return map;
8944
8928
  }
8945
8929
 
8946
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8930
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8947
8931
  function extractAttributes(job) {
8948
8932
  for (const unit of job.units) {
8949
8933
  const elements = createOpXrefMap(unit);
@@ -8955,25 +8939,52 @@ function extractAttributes(job) {
8955
8939
  case OpKind.Property:
8956
8940
  if (!op.isAnimationTrigger) {
8957
8941
  let bindingKind;
8958
- if (op.i18nContext !== null) {
8942
+ if (op.i18nMessage !== null && op.templateKind === null) {
8959
8943
  bindingKind = BindingKind.I18n;
8960
- } else if (op.isStructuralTemplate) {
8944
+ } else if (op.isStructuralTemplateAttribute) {
8961
8945
  bindingKind = BindingKind.Template;
8962
8946
  } else {
8963
8947
  bindingKind = BindingKind.Property;
8964
8948
  }
8965
- OpList.insertBefore(createExtractedAttributeOp(op.target, bindingKind, op.name, null, null), lookupElement(elements, op.target));
8949
+ OpList.insertBefore(
8950
+ createExtractedAttributeOp(
8951
+ op.target,
8952
+ bindingKind,
8953
+ op.name,
8954
+ null,
8955
+ null,
8956
+ null,
8957
+ op.securityContext
8958
+ ),
8959
+ lookupElement(elements, op.target)
8960
+ );
8966
8961
  }
8967
8962
  break;
8968
8963
  case OpKind.StyleProp:
8969
8964
  case OpKind.ClassProp:
8970
8965
  if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && op.expression instanceof EmptyExpr2) {
8971
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, op.name, null, null), lookupElement(elements, op.target));
8966
+ OpList.insertBefore(createExtractedAttributeOp(
8967
+ op.target,
8968
+ BindingKind.Property,
8969
+ op.name,
8970
+ null,
8971
+ null,
8972
+ null,
8973
+ SecurityContext.STYLE
8974
+ ), lookupElement(elements, op.target));
8972
8975
  }
8973
8976
  break;
8974
8977
  case OpKind.Listener:
8975
8978
  if (!op.isAnimationListener) {
8976
- const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, op.name, null, null);
8979
+ const extractedAttributeOp = createExtractedAttributeOp(
8980
+ op.target,
8981
+ BindingKind.Property,
8982
+ op.name,
8983
+ null,
8984
+ null,
8985
+ null,
8986
+ SecurityContext.NONE
8987
+ );
8977
8988
  if (job.kind === CompilationJobKind.Host) {
8978
8989
  unit.create.push(extractedAttributeOp);
8979
8990
  } else {
@@ -8996,18 +9007,12 @@ function extractAttributeOp(unit, op, elements) {
8996
9007
  if (op.expression instanceof Interpolation2) {
8997
9008
  return;
8998
9009
  }
8999
- let extractable = op.expression.isConstant();
9010
+ let extractable = op.isTextAttribute || op.expression.isConstant();
9000
9011
  if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
9001
- extractable = isStringLiteral(op.expression);
9002
- if (op.name === "style" || op.name === "class") {
9003
- extractable && (extractable = op.isTextAttribute);
9004
- }
9005
- if (unit.job.kind === CompilationJobKind.Host) {
9006
- extractable && (extractable = op.isTextAttribute);
9007
- }
9012
+ extractable && (extractable = op.isTextAttribute);
9008
9013
  }
9009
9014
  if (extractable) {
9010
- const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplate ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext);
9015
+ const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
9011
9016
  if (unit.job.kind === CompilationJobKind.Host) {
9012
9017
  unit.create.push(extractedAttributeOp);
9013
9018
  } else {
@@ -9018,7 +9023,7 @@ function extractAttributeOp(unit, op, elements) {
9018
9023
  }
9019
9024
  }
9020
9025
 
9021
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/binding_specialization.mjs
9026
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/binding_specialization.mjs
9022
9027
  function lookupElement2(elements, xref) {
9023
9028
  const el = elements.get(xref);
9024
9029
  if (el === void 0) {
@@ -9048,15 +9053,15 @@ function specializeBindings(job) {
9048
9053
  const target = lookupElement2(elements, op.target);
9049
9054
  target.nonBindable = true;
9050
9055
  } else {
9051
- OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplate, op.i18nContext, op.sourceSpan));
9056
+ OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
9052
9057
  }
9053
9058
  break;
9054
9059
  case BindingKind.Property:
9055
9060
  case BindingKind.Animation:
9056
9061
  if (job.kind === CompilationJobKind.Host) {
9057
- OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.sourceSpan));
9062
+ OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
9058
9063
  } else {
9059
- OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplate, op.i18nContext, op.sourceSpan));
9064
+ OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
9060
9065
  }
9061
9066
  break;
9062
9067
  case BindingKind.I18n:
@@ -9068,7 +9073,7 @@ function specializeBindings(job) {
9068
9073
  }
9069
9074
  }
9070
9075
 
9071
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
9076
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
9072
9077
  var CHAINABLE = /* @__PURE__ */ new Set([
9073
9078
  Identifiers.attribute,
9074
9079
  Identifiers.classProp,
@@ -9134,7 +9139,7 @@ function chainOperationsInList(opList) {
9134
9139
  }
9135
9140
  }
9136
9141
 
9137
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/collapse_singleton_interpolations.mjs
9142
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/collapse_singleton_interpolations.mjs
9138
9143
  function collapseSingletonInterpolations(job) {
9139
9144
  for (const unit of job.units) {
9140
9145
  for (const op of unit.update) {
@@ -9146,7 +9151,7 @@ function collapseSingletonInterpolations(job) {
9146
9151
  }
9147
9152
  }
9148
9153
 
9149
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/conditionals.mjs
9154
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/conditionals.mjs
9150
9155
  function generateConditionalExpressions(job) {
9151
9156
  for (const unit of job.units) {
9152
9157
  for (const op of unit.ops()) {
@@ -9183,7 +9188,7 @@ function generateConditionalExpressions(job) {
9183
9188
  }
9184
9189
  }
9185
9190
 
9186
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/conversion.mjs
9191
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/conversion.mjs
9187
9192
  var BINARY_OPERATORS = /* @__PURE__ */ new Map([
9188
9193
  ["&&", BinaryOperator.And],
9189
9194
  [">", BinaryOperator.Bigger],
@@ -9233,15 +9238,15 @@ function literalOrArrayLiteral(value) {
9233
9238
  return literal(value);
9234
9239
  }
9235
9240
 
9236
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
9241
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
9237
9242
  function collectElementConsts(job) {
9238
9243
  const allElementAttributes = /* @__PURE__ */ new Map();
9239
9244
  for (const unit of job.units) {
9240
9245
  for (const op of unit.create) {
9241
9246
  if (op.kind === OpKind.ExtractedAttribute) {
9242
- const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
9247
+ const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
9243
9248
  allElementAttributes.set(op.target, attributes);
9244
- attributes.add(op.bindingKind, op.name, op.expression);
9249
+ attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
9245
9250
  OpList.remove(op);
9246
9251
  }
9247
9252
  }
@@ -9274,11 +9279,6 @@ function collectElementConsts(job) {
9274
9279
  }
9275
9280
  var FLYWEIGHT_ARRAY = Object.freeze([]);
9276
9281
  var ElementAttributes = class {
9277
- constructor() {
9278
- this.known = /* @__PURE__ */ new Set();
9279
- this.byKind = /* @__PURE__ */ new Map();
9280
- this.projectAs = null;
9281
- }
9282
9282
  get attributes() {
9283
9283
  var _a2;
9284
9284
  return (_a2 = this.byKind.get(BindingKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
@@ -9303,12 +9303,28 @@ var ElementAttributes = class {
9303
9303
  var _a2;
9304
9304
  return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
9305
9305
  }
9306
- add(kind, name, value) {
9306
+ constructor(compatibility) {
9307
+ this.compatibility = compatibility;
9308
+ this.known = /* @__PURE__ */ new Map();
9309
+ this.byKind = /* @__PURE__ */ new Map();
9310
+ this.projectAs = null;
9311
+ }
9312
+ isKnown(kind, name, value) {
9307
9313
  var _a2;
9308
- if (this.known.has(name)) {
9314
+ const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
9315
+ this.known.set(kind, nameToValue);
9316
+ if (nameToValue.has(name)) {
9317
+ return true;
9318
+ }
9319
+ nameToValue.add(name);
9320
+ return false;
9321
+ }
9322
+ add(kind, name, value, trustedValueFn) {
9323
+ var _a2;
9324
+ const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
9325
+ if (!allowDuplicates && this.isKnown(kind, name, value)) {
9309
9326
  return;
9310
9327
  }
9311
- this.known.add(name);
9312
9328
  if (name === "ngProjectAs") {
9313
9329
  if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof ((_a2 = value.value) == null ? void 0 : _a2.toString()) !== "string") {
9314
9330
  throw Error("ngProjectAs must have a string literal value");
@@ -9321,7 +9337,14 @@ var ElementAttributes = class {
9321
9337
  if (value === null) {
9322
9338
  throw Error("Attribute, i18n attribute, & style element attributes must have a value");
9323
9339
  }
9324
- array.push(value);
9340
+ if (trustedValueFn !== null) {
9341
+ if (!isStringLiteral(value)) {
9342
+ throw Error("AssertionError: extracted attribute value should be string literal");
9343
+ }
9344
+ array.push(taggedTemplate(trustedValueFn, new TemplateLiteral([new TemplateLiteralElement(value.value)], []), void 0, value.sourceSpan));
9345
+ } else {
9346
+ array.push(value);
9347
+ }
9325
9348
  }
9326
9349
  }
9327
9350
  arrayFor(kind) {
@@ -9332,7 +9355,7 @@ var ElementAttributes = class {
9332
9355
  }
9333
9356
  };
9334
9357
  function getAttributeNameLiterals(name) {
9335
- const [attributeNamespace, attributeName] = splitNsName(name);
9358
+ const [attributeNamespace, attributeName] = splitNsName(name, false);
9336
9359
  const nameLiteral = literal(attributeName);
9337
9360
  if (attributeNamespace) {
9338
9361
  return [
@@ -9367,7 +9390,7 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
9367
9390
  return literalArr(attrArray);
9368
9391
  }
9369
9392
 
9370
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/convert_i18n_bindings.mjs
9393
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/convert_i18n_bindings.mjs
9371
9394
  function convertI18nBindings(job) {
9372
9395
  const i18nAttributesByElem = /* @__PURE__ */ new Map();
9373
9396
  for (const unit of job.units) {
@@ -9399,7 +9422,7 @@ function convertI18nBindings(job) {
9399
9422
  if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
9400
9423
  throw new Error(`AssertionError: An i18n attribute binding instruction requires the same number of expressions and placeholders, but found ${op.expression.i18nPlaceholders.length} placeholders and ${op.expression.expressions.length} expressions`);
9401
9424
  }
9402
- ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
9425
+ ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, null, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
9403
9426
  }
9404
9427
  OpList.replaceWithMany(op, ops);
9405
9428
  break;
@@ -9408,7 +9431,7 @@ function convertI18nBindings(job) {
9408
9431
  }
9409
9432
  }
9410
9433
 
9411
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
9434
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
9412
9435
  function createDeferDepsFns(job) {
9413
9436
  for (const unit of job.units) {
9414
9437
  for (const op of unit.create) {
@@ -9430,57 +9453,117 @@ function createDeferDepsFns(job) {
9430
9453
  if (op.handle.slot === null) {
9431
9454
  throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
9432
9455
  }
9433
- op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
9456
+ op.resolverFn = job.pool.getSharedFunctionReference(
9457
+ depsFnExpr,
9458
+ `${job.componentName}_Defer_${op.handle.slot}_DepsFn`,
9459
+ false
9460
+ );
9434
9461
  }
9435
9462
  }
9436
9463
  }
9437
9464
  }
9438
9465
 
9439
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
9466
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
9440
9467
  function createI18nContexts(job) {
9441
- const rootContexts = /* @__PURE__ */ new Map();
9442
- let currentI18nOp = null;
9443
- let xref;
9468
+ const attrContextByMessage = /* @__PURE__ */ new Map();
9469
+ for (const unit of job.units) {
9470
+ for (const op of unit.ops()) {
9471
+ switch (op.kind) {
9472
+ case OpKind.Binding:
9473
+ case OpKind.Property:
9474
+ case OpKind.Attribute:
9475
+ case OpKind.ExtractedAttribute:
9476
+ if (op.i18nMessage === null) {
9477
+ continue;
9478
+ }
9479
+ if (!attrContextByMessage.has(op.i18nMessage)) {
9480
+ const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);
9481
+ unit.create.push(i18nContext);
9482
+ attrContextByMessage.set(op.i18nMessage, i18nContext.xref);
9483
+ }
9484
+ op.i18nContext = attrContextByMessage.get(op.i18nMessage);
9485
+ break;
9486
+ }
9487
+ }
9488
+ }
9489
+ const blockContextByI18nBlock = /* @__PURE__ */ new Map();
9444
9490
  for (const unit of job.units) {
9445
9491
  for (const op of unit.create) {
9446
9492
  switch (op.kind) {
9447
9493
  case OpKind.I18nStart:
9448
- currentI18nOp = op;
9449
9494
  if (op.xref === op.root) {
9450
- xref = job.allocateXrefId();
9451
- unit.create.push(createI18nContextOp(I18nContextKind.RootI18n, xref, op.xref, op.message, null));
9452
- op.context = xref;
9453
- rootContexts.set(op.xref, xref);
9495
+ const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);
9496
+ unit.create.push(contextOp);
9497
+ op.context = contextOp.xref;
9498
+ blockContextByI18nBlock.set(op.xref, contextOp);
9454
9499
  }
9455
9500
  break;
9501
+ }
9502
+ }
9503
+ }
9504
+ for (const unit of job.units) {
9505
+ for (const op of unit.create) {
9506
+ if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
9507
+ const rootContext = blockContextByI18nBlock.get(op.root);
9508
+ if (rootContext === void 0) {
9509
+ throw Error("AssertionError: Root i18n block i18n context should have been created.");
9510
+ }
9511
+ op.context = rootContext.xref;
9512
+ blockContextByI18nBlock.set(op.xref, rootContext);
9513
+ }
9514
+ }
9515
+ }
9516
+ let currentI18nOp = null;
9517
+ for (const unit of job.units) {
9518
+ for (const op of unit.create) {
9519
+ switch (op.kind) {
9520
+ case OpKind.I18nStart:
9521
+ currentI18nOp = op;
9522
+ break;
9456
9523
  case OpKind.I18nEnd:
9457
9524
  currentI18nOp = null;
9458
9525
  break;
9459
9526
  case OpKind.IcuStart:
9460
9527
  if (currentI18nOp === null) {
9461
- throw Error("Unexpected ICU outside of an i18n block.");
9528
+ throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
9462
9529
  }
9463
9530
  if (op.message.id !== currentI18nOp.message.id) {
9464
- xref = job.allocateXrefId();
9465
- unit.create.push(createI18nContextOp(I18nContextKind.Icu, xref, currentI18nOp.xref, op.message, null));
9466
- op.context = xref;
9531
+ const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
9532
+ unit.create.push(contextOp);
9533
+ op.context = contextOp.xref;
9467
9534
  } else {
9468
9535
  op.context = currentI18nOp.context;
9536
+ blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;
9469
9537
  }
9470
9538
  break;
9471
9539
  }
9472
9540
  }
9473
9541
  }
9542
+ }
9543
+
9544
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/deduplicate_text_bindings.mjs
9545
+ function deduplicateTextBindings(job) {
9546
+ const seen = /* @__PURE__ */ new Map();
9474
9547
  for (const unit of job.units) {
9475
- for (const op of unit.create) {
9476
- if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
9477
- op.context = rootContexts.get(op.root);
9548
+ for (const op of unit.update.reversed()) {
9549
+ if (op.kind === OpKind.Binding && op.isTextAttribute) {
9550
+ const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
9551
+ if (seenForElement.has(op.name)) {
9552
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
9553
+ if (op.name === "style" || op.name === "class") {
9554
+ OpList.remove(op);
9555
+ }
9556
+ } else {
9557
+ }
9558
+ }
9559
+ seenForElement.add(op.name);
9560
+ seen.set(op.target, seenForElement);
9478
9561
  }
9479
9562
  }
9480
9563
  }
9481
9564
  }
9482
9565
 
9483
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
9566
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
9484
9567
  function configureDeferInstructions(job) {
9485
9568
  for (const unit of job.units) {
9486
9569
  for (const op of unit.create) {
@@ -9497,7 +9580,7 @@ function configureDeferInstructions(job) {
9497
9580
  }
9498
9581
  }
9499
9582
 
9500
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_resolve_targets.mjs
9583
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_resolve_targets.mjs
9501
9584
  function resolveDeferTargetNames(job) {
9502
9585
  const scopes = /* @__PURE__ */ new Map();
9503
9586
  function getScopeForView2(view) {
@@ -9591,7 +9674,7 @@ var Scope = class {
9591
9674
  }
9592
9675
  };
9593
9676
 
9594
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/empty_elements.mjs
9677
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/empty_elements.mjs
9595
9678
  var REPLACEMENTS = /* @__PURE__ */ new Map([
9596
9679
  [OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
9597
9680
  [OpKind.ContainerEnd, [OpKind.ContainerStart, OpKind.Container]],
@@ -9618,7 +9701,7 @@ function collapseEmptyInstructions(job) {
9618
9701
  }
9619
9702
  }
9620
9703
 
9621
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9704
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9622
9705
  function expandSafeReads(job) {
9623
9706
  for (const unit of job.units) {
9624
9707
  for (const op of unit.ops()) {
@@ -9754,7 +9837,7 @@ function ternaryTransform(e) {
9754
9837
  return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
9755
9838
  }
9756
9839
 
9757
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/extract_i18n_messages.mjs
9840
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/extract_i18n_messages.mjs
9758
9841
  var ESCAPE = "\uFFFD";
9759
9842
  var ELEMENT_MARKER = "#";
9760
9843
  var TEMPLATE_MARKER = "*";
@@ -9764,12 +9847,16 @@ var LIST_START_MARKER = "[";
9764
9847
  var LIST_END_MARKER = "]";
9765
9848
  var LIST_DELIMITER = "|";
9766
9849
  function extractI18nMessages(job) {
9767
- const i18nContexts = /* @__PURE__ */ new Map();
9850
+ const i18nMessagesByContext = /* @__PURE__ */ new Map();
9768
9851
  const i18nBlocks = /* @__PURE__ */ new Map();
9852
+ const i18nContexts = /* @__PURE__ */ new Map();
9769
9853
  for (const unit of job.units) {
9770
9854
  for (const op of unit.create) {
9771
9855
  switch (op.kind) {
9772
9856
  case OpKind.I18nContext:
9857
+ const i18nMessageOp = createI18nMessage(job, op);
9858
+ unit.create.push(i18nMessageOp);
9859
+ i18nMessagesByContext.set(op.xref, i18nMessageOp);
9773
9860
  i18nContexts.set(op.xref, op);
9774
9861
  break;
9775
9862
  case OpKind.I18nStart:
@@ -9778,49 +9865,40 @@ function extractI18nMessages(job) {
9778
9865
  }
9779
9866
  }
9780
9867
  }
9781
- for (const unit of job.units) {
9782
- for (const op of unit.create) {
9783
- if (op.kind !== OpKind.I18nContext || op.contextKind !== I18nContextKind.Attr) {
9784
- continue;
9785
- }
9786
- const i18nMessageOp = createI18nMessage(job, op);
9787
- unit.create.push(i18nMessageOp);
9788
- }
9789
- }
9790
- const i18nBlockMessages = /* @__PURE__ */ new Map();
9791
- for (const unit of job.units) {
9792
- for (const op of unit.create) {
9793
- if (op.kind === OpKind.I18nStart && op.xref === op.root) {
9794
- if (!op.context) {
9795
- throw Error("I18n start op should have its context set.");
9796
- }
9797
- const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
9798
- i18nBlockMessages.set(op.xref, i18nMessageOp);
9799
- unit.create.push(i18nMessageOp);
9800
- }
9801
- }
9802
- }
9868
+ let currentIcu = null;
9803
9869
  for (const unit of job.units) {
9804
9870
  for (const op of unit.create) {
9805
9871
  switch (op.kind) {
9806
9872
  case OpKind.IcuStart:
9807
- if (!op.context) {
9808
- throw Error("ICU op should have its context set.");
9873
+ currentIcu = op;
9874
+ OpList.remove(op);
9875
+ const icuContext = i18nContexts.get(op.context);
9876
+ if (icuContext.contextKind !== I18nContextKind.Icu) {
9877
+ continue;
9809
9878
  }
9810
- const i18nContext = i18nContexts.get(op.context);
9811
- if (i18nContext.contextKind === I18nContextKind.Icu) {
9812
- if (i18nContext.i18nBlock === null) {
9813
- throw Error("ICU context should have its i18n block set.");
9814
- }
9815
- const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
9816
- unit.create.push(subMessage);
9817
- const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
9818
- const parentMessage = i18nBlockMessages.get(rootI18nId);
9819
- parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
9879
+ const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);
9880
+ if (i18nBlock.context === icuContext.xref) {
9881
+ continue;
9820
9882
  }
9821
- OpList.remove(op);
9883
+ const rootI18nBlock = i18nBlocks.get(i18nBlock.root);
9884
+ const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);
9885
+ if (rootMessage === void 0) {
9886
+ throw Error("AssertionError: ICU sub-message should belong to a root message.");
9887
+ }
9888
+ const subMessage = i18nMessagesByContext.get(icuContext.xref);
9889
+ subMessage.messagePlaceholder = op.messagePlaceholder;
9890
+ rootMessage.subMessages.push(subMessage.xref);
9822
9891
  break;
9823
9892
  case OpKind.IcuEnd:
9893
+ currentIcu = null;
9894
+ OpList.remove(op);
9895
+ break;
9896
+ case OpKind.IcuPlaceholder:
9897
+ if (currentIcu === null || currentIcu.context == null) {
9898
+ throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");
9899
+ }
9900
+ const msg = i18nMessagesByContext.get(currentIcu.context);
9901
+ msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
9824
9902
  OpList.remove(op);
9825
9903
  break;
9826
9904
  }
@@ -9830,14 +9908,16 @@ function extractI18nMessages(job) {
9830
9908
  function createI18nMessage(job, context, messagePlaceholder) {
9831
9909
  let formattedParams = formatParams(context.params);
9832
9910
  const formattedPostprocessingParams = formatParams(context.postprocessingParams);
9833
- let needsPostprocessing = formattedPostprocessingParams.size > 0;
9834
- for (const values of context.params.values()) {
9835
- if (values.length > 1) {
9836
- needsPostprocessing = true;
9837
- }
9838
- }
9911
+ let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
9839
9912
  return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
9840
9913
  }
9914
+ function formatIcuPlaceholder(op) {
9915
+ if (op.strings.length !== op.expressionPlaceholders.length + 1) {
9916
+ throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
9917
+ }
9918
+ const values = op.expressionPlaceholders.map(formatValue);
9919
+ return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
9920
+ }
9841
9921
  function formatParams(params) {
9842
9922
  const formattedParams = /* @__PURE__ */ new Map();
9843
9923
  for (const [placeholder, placeholderValues] of params) {
@@ -9893,7 +9973,7 @@ function formatValue(value) {
9893
9973
  return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
9894
9974
  }
9895
9975
 
9896
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
9976
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
9897
9977
  function generateAdvance(job) {
9898
9978
  for (const unit of job.units) {
9899
9979
  const slotMap = /* @__PURE__ */ new Map();
@@ -9925,7 +10005,7 @@ function generateAdvance(job) {
9925
10005
  }
9926
10006
  }
9927
10007
 
9928
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_projection_def.mjs
10008
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_projection_def.mjs
9929
10009
  function generateProjectionDefs(job) {
9930
10010
  const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
9931
10011
  const selectors = [];
@@ -9949,7 +10029,7 @@ function generateProjectionDefs(job) {
9949
10029
  }
9950
10030
  }
9951
10031
 
9952
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
10032
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
9953
10033
  function generateVariables(job) {
9954
10034
  recursivelyProcessView(job.root, null);
9955
10035
  }
@@ -9958,8 +10038,13 @@ function recursivelyProcessView(view, parentScope) {
9958
10038
  for (const op of view.create) {
9959
10039
  switch (op.kind) {
9960
10040
  case OpKind.Template:
10041
+ recursivelyProcessView(view.job.views.get(op.xref), scope);
10042
+ break;
9961
10043
  case OpKind.RepeaterCreate:
9962
10044
  recursivelyProcessView(view.job.views.get(op.xref), scope);
10045
+ if (op.emptyView) {
10046
+ recursivelyProcessView(view.job.views.get(op.emptyView), scope);
10047
+ }
9963
10048
  break;
9964
10049
  case OpKind.Listener:
9965
10050
  op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
@@ -10037,7 +10122,7 @@ function generateVariablesInScopeForView(view, scope) {
10037
10122
  return newOps;
10038
10123
  }
10039
10124
 
10040
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/has_const_expression_collection.mjs
10125
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/has_const_expression_collection.mjs
10041
10126
  function collectConstExpressions(job) {
10042
10127
  for (const unit of job.units) {
10043
10128
  for (const op of unit.ops()) {
@@ -10051,7 +10136,7 @@ function collectConstExpressions(job) {
10051
10136
  }
10052
10137
  }
10053
10138
 
10054
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/host_style_property_parsing.mjs
10139
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/host_style_property_parsing.mjs
10055
10140
  var STYLE_DOT = "style.";
10056
10141
  var CLASS_DOT = "class.";
10057
10142
  var STYLE_BANG = "style!";
@@ -10059,7 +10144,7 @@ var CLASS_BANG = "class!";
10059
10144
  var BANG_IMPORTANT = "!important";
10060
10145
  function parseHostStyleProperties(job) {
10061
10146
  for (const op of job.root.update) {
10062
- if (op.kind !== OpKind.Binding) {
10147
+ if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {
10063
10148
  continue;
10064
10149
  }
10065
10150
  if (op.name.endsWith(BANG_IMPORTANT)) {
@@ -10109,7 +10194,7 @@ function parseProperty(name) {
10109
10194
  return { property: property2, suffix };
10110
10195
  }
10111
10196
 
10112
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/map_util.mjs
10197
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/map_util.mjs
10113
10198
  function mapLiteral(obj, quoted = false) {
10114
10199
  return literalMap(Object.keys(obj).map((key) => ({
10115
10200
  key,
@@ -10118,7 +10203,7 @@ function mapLiteral(obj, quoted = false) {
10118
10203
  })));
10119
10204
  }
10120
10205
 
10121
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/icu_serializer.mjs
10206
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/icu_serializer.mjs
10122
10207
  var IcuSerializerVisitor = class {
10123
10208
  visitText(text2) {
10124
10209
  return text2.value;
@@ -10152,7 +10237,7 @@ function serializeIcuNode(icu) {
10152
10237
  return icu.visit(serializer);
10153
10238
  }
10154
10239
 
10155
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/lexer.mjs
10240
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/expression_parser/lexer.mjs
10156
10241
  var TokenType;
10157
10242
  (function(TokenType2) {
10158
10243
  TokenType2[TokenType2["Character"] = 0] = "Character";
@@ -10513,7 +10598,7 @@ function parseIntAutoRadix(text2) {
10513
10598
  return result;
10514
10599
  }
10515
10600
 
10516
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/parser.mjs
10601
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/expression_parser/parser.mjs
10517
10602
  var SplitInterpolation = class {
10518
10603
  constructor(strings, expressions, offsets) {
10519
10604
  this.strings = strings;
@@ -11407,7 +11492,7 @@ function getIndexMapForOriginalTemplate(interpolatedTokens) {
11407
11492
  return offsetMap;
11408
11493
  }
11409
11494
 
11410
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/ast.mjs
11495
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/ast.mjs
11411
11496
  var NodeWithI18n = class {
11412
11497
  constructor(sourceSpan, i18n2) {
11413
11498
  this.sourceSpan = sourceSpan;
@@ -11559,11 +11644,11 @@ var RecursiveVisitor = class {
11559
11644
  }
11560
11645
  };
11561
11646
 
11562
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/element_schema_registry.mjs
11647
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/element_schema_registry.mjs
11563
11648
  var ElementSchemaRegistry = class {
11564
11649
  };
11565
11650
 
11566
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/dom_element_schema_registry.mjs
11651
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/dom_element_schema_registry.mjs
11567
11652
  var BOOLEAN = "boolean";
11568
11653
  var NUMBER = "number";
11569
11654
  var STRING = "string";
@@ -11916,7 +12001,7 @@ function _isPixelDimensionStyle(prop) {
11916
12001
  }
11917
12002
  }
11918
12003
 
11919
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_tags.mjs
12004
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/html_tags.mjs
11920
12005
  var HtmlTagDefinition = class {
11921
12006
  constructor({ closedByChildren, implicitNamespacePrefix, contentType = TagContentType.PARSABLE_DATA, closedByParent = false, isVoid = false, ignoreFirstLf = false, preventNamespaceInheritance = false, canSelfClose = false } = {}) {
11922
12007
  this.closedByChildren = {};
@@ -12034,7 +12119,7 @@ function getHtmlTagDefinition(tagName) {
12034
12119
  return (_b2 = (_a2 = TAG_DEFINITIONS[tagName]) != null ? _a2 : TAG_DEFINITIONS[tagName.toLowerCase()]) != null ? _b2 : DEFAULT_TAG_DEFINITION;
12035
12120
  }
12036
12121
 
12037
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/placeholder.mjs
12122
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/serializers/placeholder.mjs
12038
12123
  var TAG_TO_PLACEHOLDER_NAMES = {
12039
12124
  "A": "LINK",
12040
12125
  "B": "BOLD_TEXT",
@@ -12156,7 +12241,7 @@ var PlaceholderRegistry = class {
12156
12241
  }
12157
12242
  };
12158
12243
 
12159
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
12244
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
12160
12245
  var _expParser = new Parser(new Lexer());
12161
12246
  function createI18nMessageFactory(interpolationConfig, containerBlocks) {
12162
12247
  const visitor = new _I18nVisitor(_expParser, interpolationConfig, containerBlocks);
@@ -12335,14 +12420,14 @@ function extractPlaceholderName(input) {
12335
12420
  return input.split(_CUSTOM_PH_EXP)[2];
12336
12421
  }
12337
12422
 
12338
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/parse_util.mjs
12423
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/parse_util.mjs
12339
12424
  var I18nError = class extends ParseError {
12340
12425
  constructor(span, msg) {
12341
12426
  super(span, msg);
12342
12427
  }
12343
12428
  };
12344
12429
 
12345
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/entities.mjs
12430
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/entities.mjs
12346
12431
  var NAMED_ENTITIES = {
12347
12432
  "AElig": "\xC6",
12348
12433
  "AMP": "&",
@@ -14473,7 +14558,7 @@ var NAMED_ENTITIES = {
14473
14558
  var NGSP_UNICODE = "\uE500";
14474
14559
  NAMED_ENTITIES["ngsp"] = NGSP_UNICODE;
14475
14560
 
14476
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/lexer.mjs
14561
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/lexer.mjs
14477
14562
  var TokenError = class extends ParseError {
14478
14563
  constructor(errorMsg, tokenType, span) {
14479
14564
  super(span, errorMsg);
@@ -15394,7 +15479,7 @@ var CursorError = class {
15394
15479
  }
15395
15480
  };
15396
15481
 
15397
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/parser.mjs
15482
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/parser.mjs
15398
15483
  var TreeError = class extends ParseError {
15399
15484
  static create(elementName, span, msg) {
15400
15485
  return new TreeError(elementName, span, msg);
@@ -15778,7 +15863,7 @@ function decodeEntity(match, entity) {
15778
15863
  return match;
15779
15864
  }
15780
15865
 
15781
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/trusted_types_sinks.mjs
15866
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/trusted_types_sinks.mjs
15782
15867
  var TRUSTED_TYPES_SINKS = /* @__PURE__ */ new Set([
15783
15868
  "iframe|srcdoc",
15784
15869
  "*|innerhtml",
@@ -15793,7 +15878,7 @@ function isTrustedTypesSink(tagName, propName) {
15793
15878
  return TRUSTED_TYPES_SINKS.has(tagName + "|" + propName) || TRUSTED_TYPES_SINKS.has("*|" + propName);
15794
15879
  }
15795
15880
 
15796
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/meta.mjs
15881
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/meta.mjs
15797
15882
  var setI18nRefs = (htmlNode, i18nNode) => {
15798
15883
  if (htmlNode instanceof NodeWithI18n) {
15799
15884
  if (i18nNode instanceof IcuPlaceholder && htmlNode.i18n instanceof Message) {
@@ -15950,7 +16035,7 @@ function i18nMetaToJSDoc(meta) {
15950
16035
  return jsDocComment(tags);
15951
16036
  }
15952
16037
 
15953
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/get_msg_utils.mjs
16038
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/get_msg_utils.mjs
15954
16039
  var GOOG_GET_MSG = "goog.getMsg";
15955
16040
  function createGoogleGetMsgStatements(variable2, message, closureVar, placeholderValues) {
15956
16041
  const messageString = serializeI18nMessageForGetMsg(message);
@@ -16001,7 +16086,7 @@ function serializeI18nMessageForGetMsg(message) {
16001
16086
  return message.nodes.map((node) => node.visit(serializerVisitor2, null)).join("");
16002
16087
  }
16003
16088
 
16004
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/localize_utils.mjs
16089
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/localize_utils.mjs
16005
16090
  function createLocalizeStatements(variable2, message, params) {
16006
16091
  const { messageParts, placeHolders } = serializeI18nMessageForLocalize(message);
16007
16092
  const sourceSpan = getSourceSpan(message);
@@ -16090,13 +16175,13 @@ function createEmptyMessagePart(location) {
16090
16175
  return new LiteralPiece("", new ParseSourceSpan(location, location));
16091
16176
  }
16092
16177
 
16093
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
16178
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
16094
16179
  var NG_I18N_CLOSURE_MODE = "ngI18nClosureMode";
16095
16180
  var TRANSLATION_VAR_PREFIX2 = "i18n_";
16096
16181
  var I18N_ICU_MAPPING_PREFIX2 = "I18N_EXP_";
16097
16182
  var ESCAPE2 = "\uFFFD";
16098
16183
  function collectI18nConsts(job) {
16099
- var _a2;
16184
+ var _a2, _b2;
16100
16185
  const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
16101
16186
  const extractedAttributesByI18nContext = /* @__PURE__ */ new Map();
16102
16187
  const i18nAttributesByElement = /* @__PURE__ */ new Map();
@@ -16105,11 +16190,13 @@ function collectI18nConsts(job) {
16105
16190
  for (const unit of job.units) {
16106
16191
  for (const op of unit.ops()) {
16107
16192
  if (op.kind === OpKind.ExtractedAttribute && op.i18nContext !== null) {
16108
- extractedAttributesByI18nContext.set(op.i18nContext, op);
16193
+ const attributes = (_a2 = extractedAttributesByI18nContext.get(op.i18nContext)) != null ? _a2 : [];
16194
+ attributes.push(op);
16195
+ extractedAttributesByI18nContext.set(op.i18nContext, attributes);
16109
16196
  } else if (op.kind === OpKind.I18nAttributes) {
16110
16197
  i18nAttributesByElement.set(op.target, op);
16111
16198
  } else if (op.kind === OpKind.I18nExpression && op.usage === I18nExpressionFor.I18nAttribute) {
16112
- const expressions = (_a2 = i18nExpressionsByElement.get(op.target)) != null ? _a2 : [];
16199
+ const expressions = (_b2 = i18nExpressionsByElement.get(op.target)) != null ? _b2 : [];
16113
16200
  expressions.push(op);
16114
16201
  i18nExpressionsByElement.set(op.target, expressions);
16115
16202
  } else if (op.kind === OpKind.I18nMessage) {
@@ -16130,9 +16217,11 @@ function collectI18nConsts(job) {
16130
16217
  } else {
16131
16218
  job.constsInitializers.push(...statements);
16132
16219
  i18nValuesByContext.set(op.i18nContext, mainVar);
16133
- const attributeForMessage = extractedAttributesByI18nContext.get(op.i18nContext);
16134
- if (attributeForMessage !== void 0) {
16135
- attributeForMessage.expression = mainVar;
16220
+ const attributesForMessage = extractedAttributesByI18nContext.get(op.i18nContext);
16221
+ if (attributesForMessage !== void 0) {
16222
+ for (const attr of attributesForMessage) {
16223
+ attr.expression = mainVar.clone();
16224
+ }
16136
16225
  }
16137
16226
  }
16138
16227
  }
@@ -16197,7 +16286,7 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
16197
16286
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
16198
16287
  const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
16199
16288
  let transformFn = void 0;
16200
- if (messageOp.needsPostprocessing) {
16289
+ if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
16201
16290
  const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
16202
16291
  const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
16203
16292
  const extraTransformFnParams = [];
@@ -16216,7 +16305,6 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
16216
16305
  } else {
16217
16306
  messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
16218
16307
  messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
16219
- messageOp.needsPostprocessing = true;
16220
16308
  }
16221
16309
  }
16222
16310
  }
@@ -16248,14 +16336,15 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
16248
16336
  return variable(name);
16249
16337
  }
16250
16338
 
16251
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
16339
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
16252
16340
  function convertI18nText(job) {
16253
- var _a2;
16341
+ var _a2, _b2, _c2;
16254
16342
  for (const unit of job.units) {
16255
16343
  let currentI18n = null;
16256
16344
  let currentIcu = null;
16257
16345
  const textNodeI18nBlocks = /* @__PURE__ */ new Map();
16258
16346
  const textNodeIcus = /* @__PURE__ */ new Map();
16347
+ const icuPlaceholderByText = /* @__PURE__ */ new Map();
16259
16348
  for (const op of unit.create) {
16260
16349
  switch (op.kind) {
16261
16350
  case OpKind.I18nStart:
@@ -16280,7 +16369,13 @@ function convertI18nText(job) {
16280
16369
  if (currentI18n !== null) {
16281
16370
  textNodeI18nBlocks.set(op.xref, currentI18n);
16282
16371
  textNodeIcus.set(op.xref, currentIcu);
16283
- OpList.remove(op);
16372
+ if (op.icuPlaceholder !== null) {
16373
+ const icuPlaceholderOp = createIcuPlaceholderOp(job.allocateXrefId(), op.icuPlaceholder, [op.initialValue]);
16374
+ OpList.replace(op, icuPlaceholderOp);
16375
+ icuPlaceholderByText.set(op.xref, icuPlaceholderOp);
16376
+ } else {
16377
+ OpList.remove(op);
16378
+ }
16284
16379
  }
16285
16380
  break;
16286
16381
  }
@@ -16293,21 +16388,25 @@ function convertI18nText(job) {
16293
16388
  }
16294
16389
  const i18nOp = textNodeI18nBlocks.get(op.target);
16295
16390
  const icuOp = textNodeIcus.get(op.target);
16391
+ const icuPlaceholder = icuPlaceholderByText.get(op.target);
16296
16392
  const contextId = icuOp ? icuOp.context : i18nOp.context;
16297
16393
  const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
16298
16394
  const ops = [];
16299
16395
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
16300
16396
  const expr = op.interpolation.expressions[i];
16301
- ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, op.interpolation.i18nPlaceholders[i], resolutionTime, I18nExpressionFor.I18nText, "", (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
16397
+ ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, (_a2 = icuPlaceholder == null ? void 0 : icuPlaceholder.xref) != null ? _a2 : null, (_b2 = op.interpolation.i18nPlaceholders[i]) != null ? _b2 : null, resolutionTime, I18nExpressionFor.I18nText, "", (_c2 = expr.sourceSpan) != null ? _c2 : op.sourceSpan));
16302
16398
  }
16303
16399
  OpList.replaceWithMany(op, ops);
16400
+ if (icuPlaceholder !== void 0) {
16401
+ icuPlaceholder.strings = op.interpolation.strings;
16402
+ }
16304
16403
  break;
16305
16404
  }
16306
16405
  }
16307
16406
  }
16308
16407
  }
16309
16408
 
16310
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
16409
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
16311
16410
  function liftLocalRefs(job) {
16312
16411
  for (const unit of job.units) {
16313
16412
  for (const op of unit.create) {
@@ -16337,7 +16436,7 @@ function serializeLocalRefs(refs) {
16337
16436
  return literalArr(constRefs);
16338
16437
  }
16339
16438
 
16340
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
16439
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
16341
16440
  function emitNamespaceChanges(job) {
16342
16441
  for (const unit of job.units) {
16343
16442
  let activeNamespace = Namespace.HTML;
@@ -16353,7 +16452,7 @@ function emitNamespaceChanges(job) {
16353
16452
  }
16354
16453
  }
16355
16454
 
16356
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
16455
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
16357
16456
  function parse(value) {
16358
16457
  const styles = [];
16359
16458
  let i = 0;
@@ -16414,7 +16513,7 @@ function hyphenate2(value) {
16414
16513
  }).toLowerCase();
16415
16514
  }
16416
16515
 
16417
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
16516
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
16418
16517
  function nameFunctionsAndVariables(job) {
16419
16518
  addNamesToView(job.root, job.componentName, { index: 0 }, job.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
16420
16519
  }
@@ -16529,7 +16628,7 @@ function stripImportant(name) {
16529
16628
  return name;
16530
16629
  }
16531
16630
 
16532
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
16631
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
16533
16632
  function mergeNextContextExpressions(job) {
16534
16633
  for (const unit of job.units) {
16535
16634
  for (const op of unit.create) {
@@ -16575,7 +16674,7 @@ function mergeNextContextsInOps(ops) {
16575
16674
  }
16576
16675
  }
16577
16676
 
16578
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
16677
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
16579
16678
  var CONTAINER_TAG = "ng-container";
16580
16679
  function generateNgContainerOps(job) {
16581
16680
  for (const unit of job.units) {
@@ -16592,7 +16691,7 @@ function generateNgContainerOps(job) {
16592
16691
  }
16593
16692
  }
16594
16693
 
16595
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nonbindable.mjs
16694
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nonbindable.mjs
16596
16695
  function lookupElement3(elements, xref) {
16597
16696
  const el = elements.get(xref);
16598
16697
  if (el === void 0) {
@@ -16622,7 +16721,7 @@ function disableBindings(job) {
16622
16721
  }
16623
16722
  }
16624
16723
 
16625
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
16724
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
16626
16725
  function generateNullishCoalesceExpressions(job) {
16627
16726
  for (const unit of job.units) {
16628
16727
  for (const op of unit.ops()) {
@@ -16638,7 +16737,7 @@ function generateNullishCoalesceExpressions(job) {
16638
16737
  }
16639
16738
  }
16640
16739
 
16641
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ordering.mjs
16740
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ordering.mjs
16642
16741
  function kindTest(kind) {
16643
16742
  return (op) => op.kind === kind;
16644
16743
  }
@@ -16712,21 +16811,33 @@ function keepLast(ops) {
16712
16811
  return ops.slice(ops.length - 1);
16713
16812
  }
16714
16813
 
16715
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
16814
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
16716
16815
  function parseExtractedStyles(job) {
16816
+ const elements = /* @__PURE__ */ new Map();
16817
+ for (const unit of job.units) {
16818
+ for (const op of unit.create) {
16819
+ if (isElementOrContainerOp(op)) {
16820
+ elements.set(op.xref, op);
16821
+ }
16822
+ }
16823
+ }
16717
16824
  for (const unit of job.units) {
16718
16825
  for (const op of unit.create) {
16719
16826
  if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
16827
+ const target = elements.get(op.target);
16828
+ if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
16829
+ continue;
16830
+ }
16720
16831
  if (op.name === "style") {
16721
16832
  const parsedStyles = parse(op.expression.value);
16722
16833
  for (let i = 0; i < parsedStyles.length - 1; i += 2) {
16723
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null), op);
16834
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
16724
16835
  }
16725
16836
  OpList.remove(op);
16726
16837
  } else if (op.name === "class") {
16727
16838
  const parsedClasses = op.expression.value.trim().split(/\s+/g);
16728
16839
  for (const parsedClass of parsedClasses) {
16729
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null), op);
16840
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
16730
16841
  }
16731
16842
  OpList.remove(op);
16732
16843
  }
@@ -16735,7 +16846,7 @@ function parseExtractedStyles(job) {
16735
16846
  }
16736
16847
  }
16737
16848
 
16738
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs
16849
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs
16739
16850
  function removeContentSelectors(job) {
16740
16851
  for (const unit of job.units) {
16741
16852
  const elements = createOpXrefMap(unit);
@@ -16769,7 +16880,7 @@ function lookupInXrefMap(map, xref) {
16769
16880
  return el;
16770
16881
  }
16771
16882
 
16772
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
16883
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
16773
16884
  function createPipes(job) {
16774
16885
  for (const unit of job.units) {
16775
16886
  processPipeBindingsInView(unit);
@@ -16817,7 +16928,7 @@ function addPipeToCreationBlock(unit, afterTargetXref, binding) {
16817
16928
  throw new Error(`AssertionError: unable to find insertion point for pipe ${binding.name}`);
16818
16929
  }
16819
16930
 
16820
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
16931
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
16821
16932
  function createVariadicPipes(job) {
16822
16933
  for (const unit of job.units) {
16823
16934
  for (const op of unit.update) {
@@ -16834,7 +16945,7 @@ function createVariadicPipes(job) {
16834
16945
  }
16835
16946
  }
16836
16947
 
16837
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs
16948
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs
16838
16949
  function propagateI18nBlocks(job) {
16839
16950
  propagateI18nBlocksToTemplates(job.root, 0);
16840
16951
  }
@@ -16853,19 +16964,29 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
16853
16964
  i18nBlock = null;
16854
16965
  break;
16855
16966
  case OpKind.Template:
16856
- const templateView = unit.job.views.get(op.xref);
16857
- if (op.i18nPlaceholder !== void 0) {
16858
- if (i18nBlock === null) {
16859
- throw Error("Expected template with i18n placeholder to be in an i18n block.");
16860
- }
16861
- subTemplateIndex++;
16862
- wrapTemplateWithI18n(templateView, i18nBlock);
16967
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
16968
+ break;
16969
+ case OpKind.RepeaterCreate:
16970
+ const forView = unit.job.views.get(op.xref);
16971
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
16972
+ if (op.emptyView !== null) {
16973
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.emptyView), i18nBlock, op.emptyI18nPlaceholder, subTemplateIndex);
16863
16974
  }
16864
- subTemplateIndex = propagateI18nBlocksToTemplates(templateView, subTemplateIndex);
16975
+ break;
16865
16976
  }
16866
16977
  }
16867
16978
  return subTemplateIndex;
16868
16979
  }
16980
+ function propagateI18nBlocksForView(view, i18nBlock, i18nPlaceholder, subTemplateIndex) {
16981
+ if (i18nPlaceholder !== void 0) {
16982
+ if (i18nBlock === null) {
16983
+ throw Error("Expected template with i18n placeholder to be in an i18n block.");
16984
+ }
16985
+ subTemplateIndex++;
16986
+ wrapTemplateWithI18n(view, i18nBlock);
16987
+ }
16988
+ return propagateI18nBlocksToTemplates(view, subTemplateIndex);
16989
+ }
16869
16990
  function wrapTemplateWithI18n(unit, parentI18n) {
16870
16991
  var _a2;
16871
16992
  if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
@@ -16875,7 +16996,7 @@ function wrapTemplateWithI18n(unit, parentI18n) {
16875
16996
  }
16876
16997
  }
16877
16998
 
16878
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
16999
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
16879
17000
  function extractPureFunctions(job) {
16880
17001
  for (const view of job.units) {
16881
17002
  for (const op of view.ops()) {
@@ -16917,7 +17038,7 @@ var PureFunctionConstant = class extends GenericKeyFn {
16917
17038
  }
16918
17039
  };
16919
17040
 
16920
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
17041
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
16921
17042
  function generatePureLiteralStructures(job) {
16922
17043
  for (const unit of job.units) {
16923
17044
  for (const op of unit.update) {
@@ -16964,7 +17085,7 @@ function transformLiteralMap(expr) {
16964
17085
  return new PureFunctionExpr(literalMap(derivedEntries), nonConstantArgs);
16965
17086
  }
16966
17087
 
16967
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/instruction.mjs
17088
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/instruction.mjs
16968
17089
  function element(slot, tag, constIndex, localRefIndex, sourceSpan) {
16969
17090
  return elementOrContainerBase(Identifiers.element, slot, tag, constIndex, localRefIndex, sourceSpan);
16970
17091
  }
@@ -17022,17 +17143,13 @@ function disableBindings2() {
17022
17143
  function enableBindings() {
17023
17144
  return call(Identifiers.enableBindings, [], null);
17024
17145
  }
17025
- function listener(name, handlerFn, sourceSpan) {
17026
- return call(Identifiers.listener, [
17027
- literal(name),
17028
- handlerFn
17029
- ], sourceSpan);
17030
- }
17031
- function syntheticHostListener(name, handlerFn, sourceSpan) {
17032
- return call(Identifiers.syntheticHostListener, [
17033
- literal(name),
17034
- handlerFn
17035
- ], sourceSpan);
17146
+ function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
17147
+ const args = [literal(name), handlerFn];
17148
+ if (eventTargetResolver !== null) {
17149
+ args.push(literal(false));
17150
+ args.push(importExpr(eventTargetResolver));
17151
+ }
17152
+ return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
17036
17153
  }
17037
17154
  function pipe(slot, name) {
17038
17155
  return call(Identifiers.pipe, [
@@ -17291,8 +17408,12 @@ function classMapInterpolate(strings, expressions, sourceSpan) {
17291
17408
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
17292
17409
  return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
17293
17410
  }
17294
- function hostProperty(name, expression, sourceSpan) {
17295
- return call(Identifiers.hostProperty, [literal(name), expression], sourceSpan);
17411
+ function hostProperty(name, expression, sanitizer, sourceSpan) {
17412
+ const args = [literal(name), expression];
17413
+ if (sanitizer !== null) {
17414
+ args.push(sanitizer);
17415
+ }
17416
+ return call(Identifiers.hostProperty, args, sourceSpan);
17296
17417
  }
17297
17418
  function syntheticHostProperty(name, expression, sourceSpan) {
17298
17419
  return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
@@ -17479,14 +17600,11 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
17479
17600
  return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan).toStmt());
17480
17601
  }
17481
17602
 
17482
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/reify.mjs
17483
- var sanitizerIdentifierMap = /* @__PURE__ */ new Map([
17484
- [SanitizerFn.Html, Identifiers.sanitizeHtml],
17485
- [SanitizerFn.IframeAttribute, Identifiers.validateIframeAttribute],
17486
- [SanitizerFn.ResourceUrl, Identifiers.sanitizeResourceUrl],
17487
- [SanitizerFn.Script, Identifiers.sanitizeScript],
17488
- [SanitizerFn.Style, Identifiers.sanitizeStyle],
17489
- [SanitizerFn.Url, Identifiers.sanitizeUrl]
17603
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/reify.mjs
17604
+ var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([
17605
+ ["window", Identifiers.resolveWindow],
17606
+ ["document", Identifiers.resolveDocument],
17607
+ ["body", Identifiers.resolveBody]
17490
17608
  ]);
17491
17609
  function reify(job) {
17492
17610
  for (const unit of job.units) {
@@ -17503,19 +17621,19 @@ function reifyCreateOperations(unit, ops) {
17503
17621
  OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
17504
17622
  break;
17505
17623
  case OpKind.ElementStart:
17506
- OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17624
+ OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
17507
17625
  break;
17508
17626
  case OpKind.Element:
17509
- OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17627
+ OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
17510
17628
  break;
17511
17629
  case OpKind.ElementEnd:
17512
17630
  OpList.replace(op, elementEnd(op.sourceSpan));
17513
17631
  break;
17514
17632
  case OpKind.ContainerStart:
17515
- OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
17633
+ OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
17516
17634
  break;
17517
17635
  case OpKind.Container:
17518
- OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
17636
+ OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
17519
17637
  break;
17520
17638
  case OpKind.ContainerEnd:
17521
17639
  OpList.replace(op, elementContainerEnd());
@@ -17543,7 +17661,7 @@ function reifyCreateOperations(unit, ops) {
17543
17661
  throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
17544
17662
  }
17545
17663
  const childView = unit.job.views.get(op.xref);
17546
- OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17664
+ OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
17547
17665
  break;
17548
17666
  case OpKind.DisableBindings:
17549
17667
  OpList.replace(op, disableBindings2());
@@ -17556,8 +17674,11 @@ function reifyCreateOperations(unit, ops) {
17556
17674
  break;
17557
17675
  case OpKind.Listener:
17558
17676
  const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
17559
- const reified = op.hostListener && op.isAnimationListener ? syntheticHostListener(op.name, listenerFn, op.sourceSpan) : listener(op.name, listenerFn, op.sourceSpan);
17560
- OpList.replace(op, reified);
17677
+ const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
17678
+ if (eventTargetResolver === void 0) {
17679
+ throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
17680
+ }
17681
+ OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
17561
17682
  break;
17562
17683
  case OpKind.Variable:
17563
17684
  if (op.variable.name === null) {
@@ -17642,7 +17763,7 @@ function reifyCreateOperations(unit, ops) {
17642
17763
  emptyDecls = emptyView.decls;
17643
17764
  emptyVars = emptyView.vars;
17644
17765
  }
17645
- OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.sourceSpan));
17766
+ OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.wholeSourceSpan));
17646
17767
  break;
17647
17768
  case OpKind.Statement:
17648
17769
  break;
@@ -17712,7 +17833,7 @@ function reifyUpdateOperations(_unit, ops) {
17712
17833
  if (op.isAnimationTrigger) {
17713
17834
  OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
17714
17835
  } else {
17715
- OpList.replace(op, hostProperty(op.name, op.expression, op.sourceSpan));
17836
+ OpList.replace(op, hostProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
17716
17837
  }
17717
17838
  }
17718
17839
  break;
@@ -17790,8 +17911,6 @@ function reifyIrExpression(expr) {
17790
17911
  return pipeBind(expr.targetSlot.slot, expr.varOffset, expr.args);
17791
17912
  case ExpressionKind.PipeBindingVariadic:
17792
17913
  return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
17793
- case ExpressionKind.SanitizerExpr:
17794
- return importExpr(sanitizerIdentifierMap.get(expr.fn));
17795
17914
  case ExpressionKind.SlotLiteralExpr:
17796
17915
  return literal(expr.slot.slot);
17797
17916
  default:
@@ -17814,7 +17933,7 @@ function reifyListenerHandler(unit, name, handlerOps, consumesDollarEvent) {
17814
17933
  return fn(params, handlerStmts, void 0, void 0, name);
17815
17934
  }
17816
17935
 
17817
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_empty_bindings.mjs
17936
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_empty_bindings.mjs
17818
17937
  function removeEmptyBindings(job) {
17819
17938
  for (const unit of job.units) {
17820
17939
  for (const op of unit.update) {
@@ -17835,7 +17954,7 @@ function removeEmptyBindings(job) {
17835
17954
  }
17836
17955
  }
17837
17956
 
17838
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_i18n_contexts.mjs
17957
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_i18n_contexts.mjs
17839
17958
  function removeI18nContexts(job) {
17840
17959
  for (const unit of job.units) {
17841
17960
  for (const op of unit.create) {
@@ -17851,7 +17970,7 @@ function removeI18nContexts(job) {
17851
17970
  }
17852
17971
  }
17853
17972
 
17854
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_unused_i18n_attrs.mjs
17973
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_unused_i18n_attrs.mjs
17855
17974
  function removeUnusedI18nAttributesOps(job) {
17856
17975
  for (const unit of job.units) {
17857
17976
  const ownersWithI18nExpressions = /* @__PURE__ */ new Set();
@@ -17873,7 +17992,7 @@ function removeUnusedI18nAttributesOps(job) {
17873
17992
  }
17874
17993
  }
17875
17994
 
17876
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
17995
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
17877
17996
  function generateRepeaterDerivedVars(job) {
17878
17997
  const repeaters = /* @__PURE__ */ new Map();
17879
17998
  for (const unit of job.units) {
@@ -17905,7 +18024,7 @@ function generateRepeaterDerivedVars(job) {
17905
18024
  }
17906
18025
  }
17907
18026
 
17908
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
18027
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
17909
18028
  function resolveContexts(job) {
17910
18029
  for (const unit of job.units) {
17911
18030
  processLexicalScope(unit, unit.create);
@@ -17946,7 +18065,7 @@ function processLexicalScope(view, ops) {
17946
18065
  }
17947
18066
  }
17948
18067
 
17949
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
18068
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
17950
18069
  function resolveDollarEvent(job) {
17951
18070
  for (const unit of job.units) {
17952
18071
  transformDollarEvent(unit, unit.create);
@@ -17967,7 +18086,7 @@ function transformDollarEvent(unit, ops) {
17967
18086
  }
17968
18087
  }
17969
18088
 
17970
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
18089
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
17971
18090
  function resolveI18nElementPlaceholders(job) {
17972
18091
  const i18nContexts = /* @__PURE__ */ new Map();
17973
18092
  const elements = /* @__PURE__ */ new Map();
@@ -18032,18 +18151,52 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingSt
18032
18151
  }
18033
18152
  break;
18034
18153
  case OpKind.Template:
18154
+ const view = job.views.get(op.xref);
18035
18155
  if (op.i18nPlaceholder === void 0) {
18036
- resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements);
18156
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
18037
18157
  } else {
18038
18158
  if (currentOps === null) {
18039
18159
  throw Error("i18n tag placeholder should only occur inside an i18n block");
18040
18160
  }
18041
18161
  if (op.templateKind === TemplateKind.Structural) {
18042
- resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements, op);
18162
+ resolvePlaceholdersForView(job, view, i18nContexts, elements, op);
18043
18163
  } else {
18044
- recordTemplateStart(job, op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18045
- resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements);
18046
- recordTemplateClose(job, op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18164
+ recordTemplateStart(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18165
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
18166
+ recordTemplateClose(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18167
+ pendingStructuralDirective = void 0;
18168
+ }
18169
+ }
18170
+ break;
18171
+ case OpKind.RepeaterCreate:
18172
+ if (pendingStructuralDirective !== void 0) {
18173
+ throw Error("AssertionError: Unexpected structural directive associated with @for block");
18174
+ }
18175
+ const forSlot = op.handle.slot + 1;
18176
+ const forView = job.views.get(op.xref);
18177
+ if (op.i18nPlaceholder === void 0) {
18178
+ resolvePlaceholdersForView(job, forView, i18nContexts, elements);
18179
+ } else {
18180
+ if (currentOps === null) {
18181
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
18182
+ }
18183
+ recordTemplateStart(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18184
+ resolvePlaceholdersForView(job, forView, i18nContexts, elements);
18185
+ recordTemplateClose(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18186
+ pendingStructuralDirective = void 0;
18187
+ }
18188
+ if (op.emptyView !== null) {
18189
+ const emptySlot = op.handle.slot + 2;
18190
+ const emptyView = job.views.get(op.emptyView);
18191
+ if (op.emptyI18nPlaceholder === void 0) {
18192
+ resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
18193
+ } else {
18194
+ if (currentOps === null) {
18195
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
18196
+ }
18197
+ recordTemplateStart(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18198
+ resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
18199
+ recordTemplateClose(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18047
18200
  pendingStructuralDirective = void 0;
18048
18201
  }
18049
18202
  }
@@ -18076,8 +18229,8 @@ function recordElementClose(op, i18nContext, i18nBlock, structuralDirective) {
18076
18229
  addParam(i18nContext.params, closeName, value, i18nBlock.subTemplateIndex, flags);
18077
18230
  }
18078
18231
  }
18079
- function recordTemplateStart(job, op, i18nContext, i18nBlock, structuralDirective) {
18080
- let { startName, closeName } = op.i18nPlaceholder;
18232
+ function recordTemplateStart(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
18233
+ let { startName, closeName } = i18nPlaceholder;
18081
18234
  let flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.OpenTag;
18082
18235
  if (!closeName) {
18083
18236
  flags |= I18nParamValueFlags.CloseTag;
@@ -18085,20 +18238,20 @@ function recordTemplateStart(job, op, i18nContext, i18nBlock, structuralDirectiv
18085
18238
  if (structuralDirective !== void 0) {
18086
18239
  addParam(i18nContext.params, startName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
18087
18240
  }
18088
- addParam(i18nContext.params, startName, op.handle.slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, op), flags);
18241
+ addParam(i18nContext.params, startName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
18089
18242
  }
18090
- function recordTemplateClose(job, op, i18nContext, i18nBlock, structuralDirective) {
18091
- const { startName, closeName } = op.i18nPlaceholder;
18243
+ function recordTemplateClose(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
18244
+ const { startName, closeName } = i18nPlaceholder;
18092
18245
  const flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag;
18093
18246
  if (closeName) {
18094
- addParam(i18nContext.params, closeName, op.handle.slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, op), flags);
18247
+ addParam(i18nContext.params, closeName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
18095
18248
  if (structuralDirective !== void 0) {
18096
18249
  addParam(i18nContext.params, closeName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
18097
18250
  }
18098
18251
  }
18099
18252
  }
18100
- function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
18101
- for (const childOp of job.views.get(op.xref).create) {
18253
+ function getSubTemplateIndexForTemplateTag(job, i18nOp, view) {
18254
+ for (const childOp of view.create) {
18102
18255
  if (childOp.kind === OpKind.I18nStart) {
18103
18256
  return childOp.subTemplateIndex;
18104
18257
  }
@@ -18112,11 +18265,12 @@ function addParam(params, placeholder, value, subTemplateIndex, flags) {
18112
18265
  params.set(placeholder, values);
18113
18266
  }
18114
18267
 
18115
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
18268
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
18116
18269
  function resolveI18nExpressionPlaceholders(job) {
18117
18270
  var _a2;
18118
18271
  const subTemplateIndicies = /* @__PURE__ */ new Map();
18119
18272
  const i18nContexts = /* @__PURE__ */ new Map();
18273
+ const icuPlaceholders = /* @__PURE__ */ new Map();
18120
18274
  for (const unit of job.units) {
18121
18275
  for (const op of unit.create) {
18122
18276
  switch (op.kind) {
@@ -18126,6 +18280,9 @@ function resolveI18nExpressionPlaceholders(job) {
18126
18280
  case OpKind.I18nContext:
18127
18281
  i18nContexts.set(op.xref, op);
18128
18282
  break;
18283
+ case OpKind.IcuPlaceholder:
18284
+ icuPlaceholders.set(op.xref, op);
18285
+ break;
18129
18286
  }
18130
18287
  }
18131
18288
  }
@@ -18134,68 +18291,34 @@ function resolveI18nExpressionPlaceholders(job) {
18134
18291
  for (const unit of job.units) {
18135
18292
  for (const op of unit.update) {
18136
18293
  if (op.kind === OpKind.I18nExpression) {
18137
- const i18nContext = i18nContexts.get(op.context);
18138
18294
  const index = expressionIndices.get(referenceIndex(op)) || 0;
18139
18295
  const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
18140
- const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
18141
- const values = params.get(op.i18nPlaceholder) || [];
18142
- values.push({
18296
+ const value = {
18143
18297
  value: index,
18144
18298
  subTemplateIndex,
18145
18299
  flags: I18nParamValueFlags.ExpressionIndex
18146
- });
18147
- params.set(op.i18nPlaceholder, values);
18300
+ };
18301
+ updatePlaceholder(op, value, i18nContexts, icuPlaceholders);
18148
18302
  expressionIndices.set(referenceIndex(op), index + 1);
18149
18303
  }
18150
18304
  }
18151
18305
  }
18152
18306
  }
18153
-
18154
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs
18155
- function resolveI18nIcuPlaceholders(job) {
18156
- for (const unit of job.units) {
18157
- for (const op of unit.create) {
18158
- if (op.kind === OpKind.I18nContext && op.contextKind === I18nContextKind.Icu) {
18159
- for (const node of op.message.nodes) {
18160
- node.visit(new ResolveIcuPlaceholdersVisitor(op.postprocessingParams));
18161
- }
18162
- }
18163
- }
18164
- }
18165
- }
18166
- var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
18167
- constructor(params) {
18168
- super();
18169
- this.params = params;
18170
- }
18171
- visitContainerPlaceholder(placeholder) {
18172
- var _a2, _b2;
18173
- if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
18174
- this.params.set(placeholder.startName, [{
18175
- value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
18176
- subTemplateIndex: null,
18177
- flags: I18nParamValueFlags.None
18178
- }]);
18179
- }
18180
- if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
18181
- this.params.set(placeholder.closeName, [{
18182
- value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
18183
- subTemplateIndex: null,
18184
- flags: I18nParamValueFlags.None
18185
- }]);
18186
- }
18307
+ function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
18308
+ if (op.i18nPlaceholder !== null) {
18309
+ const i18nContext = i18nContexts.get(op.context);
18310
+ const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
18311
+ const values = params.get(op.i18nPlaceholder) || [];
18312
+ values.push(value);
18313
+ params.set(op.i18nPlaceholder, values);
18187
18314
  }
18188
- visitTagPlaceholder(placeholder) {
18189
- super.visitTagPlaceholder(placeholder);
18190
- this.visitContainerPlaceholder(placeholder);
18315
+ if (op.icuPlaceholder !== null) {
18316
+ const icuPlaceholderOp = icuPlaceholders.get(op.icuPlaceholder);
18317
+ icuPlaceholderOp == null ? void 0 : icuPlaceholderOp.expressionPlaceholders.push(value);
18191
18318
  }
18192
- visitBlockPlaceholder(placeholder) {
18193
- super.visitBlockPlaceholder(placeholder);
18194
- this.visitContainerPlaceholder(placeholder);
18195
- }
18196
- };
18319
+ }
18197
18320
 
18198
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
18321
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
18199
18322
  function resolveNames(job) {
18200
18323
  for (const unit of job.units) {
18201
18324
  processLexicalScope2(unit, unit.create, null);
@@ -18259,31 +18382,55 @@ function processLexicalScope2(unit, ops, savedView) {
18259
18382
  }
18260
18383
  }
18261
18384
 
18262
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_sanitizers.mjs
18263
- var sanitizers = /* @__PURE__ */ new Map([
18264
- [SecurityContext.HTML, SanitizerFn.Html],
18265
- [SecurityContext.SCRIPT, SanitizerFn.Script],
18266
- [SecurityContext.STYLE, SanitizerFn.Style],
18267
- [SecurityContext.URL, SanitizerFn.Url],
18268
- [SecurityContext.RESOURCE_URL, SanitizerFn.ResourceUrl]
18385
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_sanitizers.mjs
18386
+ var sanitizerFns = /* @__PURE__ */ new Map([
18387
+ [SecurityContext.HTML, Identifiers.sanitizeHtml],
18388
+ [SecurityContext.RESOURCE_URL, Identifiers.sanitizeResourceUrl],
18389
+ [SecurityContext.SCRIPT, Identifiers.sanitizeScript],
18390
+ [SecurityContext.STYLE, Identifiers.sanitizeStyle],
18391
+ [SecurityContext.URL, Identifiers.sanitizeUrl]
18392
+ ]);
18393
+ var trustedValueFns = /* @__PURE__ */ new Map([
18394
+ [SecurityContext.HTML, Identifiers.trustConstantHtml],
18395
+ [SecurityContext.RESOURCE_URL, Identifiers.trustConstantResourceUrl]
18269
18396
  ]);
18270
18397
  function resolveSanitizers(job) {
18398
+ var _a2, _b2;
18271
18399
  for (const unit of job.units) {
18272
18400
  const elements = createOpXrefMap(unit);
18273
- let sanitizerFn;
18401
+ if (job.kind !== CompilationJobKind.Host) {
18402
+ for (const op of unit.create) {
18403
+ if (op.kind === OpKind.ExtractedAttribute) {
18404
+ const trustedValueFn = (_a2 = trustedValueFns.get(getOnlySecurityContext(op.securityContext))) != null ? _a2 : null;
18405
+ op.trustedValueFn = trustedValueFn !== null ? importExpr(trustedValueFn) : null;
18406
+ }
18407
+ }
18408
+ }
18274
18409
  for (const op of unit.update) {
18275
18410
  switch (op.kind) {
18276
18411
  case OpKind.Property:
18277
18412
  case OpKind.Attribute:
18278
- sanitizerFn = sanitizers.get(op.securityContext) || null;
18279
- op.sanitizer = sanitizerFn ? new SanitizerExpr(sanitizerFn) : null;
18413
+ case OpKind.HostProperty:
18414
+ let sanitizerFn = null;
18415
+ if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
18416
+ sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
18417
+ } else {
18418
+ sanitizerFn = (_b2 = sanitizerFns.get(getOnlySecurityContext(op.securityContext))) != null ? _b2 : null;
18419
+ }
18420
+ op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
18280
18421
  if (op.sanitizer === null) {
18281
- const ownerOp = elements.get(op.target);
18282
- if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
18283
- throw Error("Property should have an element-like owner");
18422
+ let isIframe = false;
18423
+ if (job.kind === CompilationJobKind.Host || op.kind === OpKind.HostProperty) {
18424
+ isIframe = true;
18425
+ } else {
18426
+ const ownerOp = elements.get(op.target);
18427
+ if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
18428
+ throw Error("Property should have an element-like owner");
18429
+ }
18430
+ isIframe = isIframeElement(ownerOp);
18284
18431
  }
18285
- if (isIframeElement(ownerOp) && isIframeSecuritySensitiveAttr(op.name)) {
18286
- op.sanitizer = new SanitizerExpr(SanitizerFn.IframeAttribute);
18432
+ if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
18433
+ op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
18287
18434
  }
18288
18435
  }
18289
18436
  break;
@@ -18295,8 +18442,17 @@ function isIframeElement(op) {
18295
18442
  var _a2;
18296
18443
  return op.kind === OpKind.ElementStart && ((_a2 = op.tag) == null ? void 0 : _a2.toLowerCase()) === "iframe";
18297
18444
  }
18445
+ function getOnlySecurityContext(securityContext) {
18446
+ if (Array.isArray(securityContext)) {
18447
+ if (securityContext.length > 1) {
18448
+ throw Error(`AssertionError: Ambiguous security context`);
18449
+ }
18450
+ return securityContext[0] || SecurityContext.NONE;
18451
+ }
18452
+ return securityContext;
18453
+ }
18298
18454
 
18299
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
18455
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
18300
18456
  function saveAndRestoreView(job) {
18301
18457
  for (const unit of job.units) {
18302
18458
  unit.create.prepend([
@@ -18341,7 +18497,7 @@ function addSaveRestoreViewOperationToListener(unit, op) {
18341
18497
  }
18342
18498
  }
18343
18499
 
18344
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
18500
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
18345
18501
  function allocateSlots(job) {
18346
18502
  const slotMap = /* @__PURE__ */ new Map();
18347
18503
  for (const unit of job.units) {
@@ -18366,7 +18522,7 @@ function allocateSlots(job) {
18366
18522
  }
18367
18523
  }
18368
18524
 
18369
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/style_binding_specialization.mjs
18525
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/style_binding_specialization.mjs
18370
18526
  function specializeStyleBindings(job) {
18371
18527
  for (const unit of job.units) {
18372
18528
  for (const op of unit.update) {
@@ -18396,7 +18552,7 @@ function specializeStyleBindings(job) {
18396
18552
  }
18397
18553
  }
18398
18554
 
18399
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
18555
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
18400
18556
  function generateTemporaryVariables(job) {
18401
18557
  for (const unit of job.units) {
18402
18558
  unit.create.prepend(generateTemporaries(unit.create));
@@ -18454,7 +18610,7 @@ function assignName(names, expr) {
18454
18610
  expr.name = name;
18455
18611
  }
18456
18612
 
18457
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_generation.mjs
18613
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_generation.mjs
18458
18614
  function generateTrackFns(job) {
18459
18615
  for (const unit of job.units) {
18460
18616
  for (const op of unit.create) {
@@ -18484,7 +18640,7 @@ function generateTrackFns(job) {
18484
18640
  }
18485
18641
  }
18486
18642
 
18487
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_optimization.mjs
18643
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_optimization.mjs
18488
18644
  function optimizeTrackFns(job) {
18489
18645
  for (const unit of job.units) {
18490
18646
  for (const op of unit.create) {
@@ -18531,7 +18687,7 @@ function isTrackByFunctionCall(rootView, expr) {
18531
18687
  return true;
18532
18688
  }
18533
18689
 
18534
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_variables.mjs
18690
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_variables.mjs
18535
18691
  function generateTrackVariables(job) {
18536
18692
  for (const unit of job.units) {
18537
18693
  for (const op of unit.create) {
@@ -18552,7 +18708,7 @@ function generateTrackVariables(job) {
18552
18708
  }
18553
18709
  }
18554
18710
 
18555
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
18711
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
18556
18712
  function countVariables(job) {
18557
18713
  for (const unit of job.units) {
18558
18714
  let varCount = 0;
@@ -18630,7 +18786,10 @@ function varsUsedByOp(op) {
18630
18786
  return op.interpolation.expressions.length;
18631
18787
  case OpKind.I18nExpression:
18632
18788
  case OpKind.Conditional:
18789
+ case OpKind.DeferWhen:
18633
18790
  return 1;
18791
+ case OpKind.RepeaterCreate:
18792
+ return op.emptyView ? 1 : 0;
18634
18793
  default:
18635
18794
  throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
18636
18795
  }
@@ -18657,7 +18816,7 @@ function isSingletonInterpolation(expr) {
18657
18816
  return true;
18658
18817
  }
18659
18818
 
18660
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
18819
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
18661
18820
  function optimizeVariables(job) {
18662
18821
  for (const unit of job.units) {
18663
18822
  inlineAlwaysInlineVariables(unit.create);
@@ -18907,7 +19066,7 @@ function allowConservativeInlining(decl, target) {
18907
19066
  }
18908
19067
  }
18909
19068
 
18910
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/wrap_icus.mjs
19069
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/wrap_icus.mjs
18911
19070
  function wrapI18nIcus(job) {
18912
19071
  for (const unit of job.units) {
18913
19072
  let currentI18nOp = null;
@@ -18937,17 +19096,18 @@ function wrapI18nIcus(job) {
18937
19096
  }
18938
19097
  }
18939
19098
 
18940
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
19099
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
18941
19100
  var phases = [
18942
19101
  { kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
18943
19102
  { kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
18944
19103
  { kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
18945
19104
  { kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
18946
19105
  { kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
18947
- { kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
19106
+ { kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
18948
19107
  { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
18949
19108
  { kind: CompilationJobKind.Both, fn: specializeBindings },
18950
19109
  { kind: CompilationJobKind.Both, fn: extractAttributes },
19110
+ { kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
18951
19111
  { kind: CompilationJobKind.Both, fn: parseExtractedStyles },
18952
19112
  { kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
18953
19113
  { kind: CompilationJobKind.Both, fn: collapseSingletonInterpolations },
@@ -18965,7 +19125,7 @@ var phases = [
18965
19125
  { kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
18966
19126
  { kind: CompilationJobKind.Tmpl, fn: generateVariables },
18967
19127
  { kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
18968
- { kind: CompilationJobKind.Tmpl, fn: deleteAnyCasts },
19128
+ { kind: CompilationJobKind.Both, fn: deleteAnyCasts },
18969
19129
  { kind: CompilationJobKind.Both, fn: resolveDollarEvent },
18970
19130
  { kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
18971
19131
  { kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
@@ -18973,7 +19133,7 @@ var phases = [
18973
19133
  { kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
18974
19134
  { kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
18975
19135
  { kind: CompilationJobKind.Both, fn: resolveContexts },
18976
- { kind: CompilationJobKind.Tmpl, fn: resolveSanitizers },
19136
+ { kind: CompilationJobKind.Both, fn: resolveSanitizers },
18977
19137
  { kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
18978
19138
  { kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
18979
19139
  { kind: CompilationJobKind.Both, fn: expandSafeReads },
@@ -18982,7 +19142,6 @@ var phases = [
18982
19142
  { kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
18983
19143
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
18984
19144
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
18985
- { kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
18986
19145
  { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
18987
19146
  { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
18988
19147
  { kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
@@ -19103,8 +19262,10 @@ function emitHostBindingFunction(job) {
19103
19262
  );
19104
19263
  }
19105
19264
 
19106
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
19265
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
19107
19266
  var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
19267
+ var domSchema = new DomElementSchemaRegistry();
19268
+ var NG_TEMPLATE_TAG_NAME = "ng-template";
19108
19269
  function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
19109
19270
  const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
19110
19271
  ingestNodes(job.root, template2);
@@ -19114,17 +19275,27 @@ function ingestHostBinding(input, bindingParser, constantPool) {
19114
19275
  var _a2, _b2, _c2;
19115
19276
  const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode);
19116
19277
  for (const property2 of (_a2 = input.properties) != null ? _a2 : []) {
19117
- ingestHostProperty(job, property2, false);
19278
+ let bindingKind = BindingKind.Property;
19279
+ if (property2.name.startsWith("attr.")) {
19280
+ property2.name = property2.name.substring("attr.".length);
19281
+ bindingKind = BindingKind.Attribute;
19282
+ }
19283
+ if (property2.isAnimation) {
19284
+ bindingKind = BindingKind.Animation;
19285
+ }
19286
+ const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
19287
+ ingestHostProperty(job, property2, bindingKind, securityContexts);
19118
19288
  }
19119
19289
  for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
19120
- ingestHostAttribute(job, name, expr);
19290
+ const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
19291
+ ingestHostAttribute(job, name, expr, securityContexts);
19121
19292
  }
19122
19293
  for (const event of (_c2 = input.events) != null ? _c2 : []) {
19123
19294
  ingestHostEvent(job, event);
19124
19295
  }
19125
19296
  return job;
19126
19297
  }
19127
- function ingestHostProperty(job, property2, isTextAttribute) {
19298
+ function ingestHostProperty(job, property2, bindingKind, securityContexts) {
19128
19299
  let expression;
19129
19300
  const ast = property2.expression.ast;
19130
19301
  if (ast instanceof Interpolation) {
@@ -19132,34 +19303,27 @@ function ingestHostProperty(job, property2, isTextAttribute) {
19132
19303
  } else {
19133
19304
  expression = convertAst(ast, job, property2.sourceSpan);
19134
19305
  }
19135
- let bindingKind = BindingKind.Property;
19136
- if (property2.name.startsWith("attr.")) {
19137
- property2.name = property2.name.substring("attr.".length);
19138
- bindingKind = BindingKind.Attribute;
19139
- }
19140
- if (property2.isAnimation) {
19141
- bindingKind = BindingKind.Animation;
19142
- }
19143
- job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, SecurityContext.NONE, isTextAttribute, false, null, property2.sourceSpan));
19306
+ job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, false, false, null, null, property2.sourceSpan));
19144
19307
  }
19145
- function ingestHostAttribute(job, name, value) {
19308
+ function ingestHostAttribute(job, name, value, securityContexts) {
19146
19309
  const attrBinding = createBindingOp(
19147
19310
  job.root.xref,
19148
19311
  BindingKind.Attribute,
19149
19312
  name,
19150
19313
  value,
19151
19314
  null,
19152
- SecurityContext.NONE,
19315
+ securityContexts,
19153
19316
  true,
19154
19317
  false,
19155
19318
  null,
19156
- null
19319
+ null,
19320
+ value.sourceSpan
19157
19321
  );
19158
19322
  job.root.update.push(attrBinding);
19159
19323
  }
19160
19324
  function ingestHostEvent(job, event) {
19161
- const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, event.targetOrPhase, true, event.sourceSpan);
19162
- eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
19325
+ const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
19326
+ const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
19163
19327
  job.root.create.push(eventBinding);
19164
19328
  }
19165
19329
  function ingestNodes(unit, template2) {
@@ -19171,9 +19335,9 @@ function ingestNodes(unit, template2) {
19171
19335
  } else if (node instanceof Content) {
19172
19336
  ingestContent(unit, node);
19173
19337
  } else if (node instanceof Text) {
19174
- ingestText(unit, node);
19338
+ ingestText(unit, node, null);
19175
19339
  } else if (node instanceof BoundText) {
19176
- ingestBoundText(unit, node);
19340
+ ingestBoundText(unit, node, null);
19177
19341
  } else if (node instanceof IfBlock) {
19178
19342
  ingestIfBlock(unit, node);
19179
19343
  } else if (node instanceof SwitchBlock) {
@@ -19196,16 +19360,19 @@ function ingestElement(unit, element2) {
19196
19360
  }
19197
19361
  const id = unit.job.allocateXrefId();
19198
19362
  const [namespaceKey, elementName] = splitNsName(element2.name);
19199
- const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
19363
+ const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
19200
19364
  unit.create.push(startOp);
19201
- ingestBindings(unit, startOp, element2);
19365
+ ingestElementBindings(unit, startOp, element2);
19202
19366
  ingestReferences(startOp, element2);
19367
+ let i18nBlockId = null;
19368
+ if (element2.i18n instanceof Message) {
19369
+ i18nBlockId = unit.job.allocateXrefId();
19370
+ unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n));
19371
+ }
19203
19372
  ingestNodes(unit, element2.children);
19204
19373
  const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
19205
19374
  unit.create.push(endOp);
19206
- if (element2.i18n instanceof Message) {
19207
- const i18nBlockId = unit.job.allocateXrefId();
19208
- OpList.insertAfter(createI18nStartOp(i18nBlockId, element2.i18n), startOp);
19375
+ if (i18nBlockId !== null) {
19209
19376
  OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
19210
19377
  }
19211
19378
  }
@@ -19223,9 +19390,9 @@ function ingestTemplate(unit, tmpl) {
19223
19390
  const namespace = namespaceForKey(namespacePrefix);
19224
19391
  const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
19225
19392
  const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
19226
- const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
19393
+ const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan, tmpl.sourceSpan);
19227
19394
  unit.create.push(templateOp);
19228
- ingestBindings(unit, templateOp, tmpl);
19395
+ ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
19229
19396
  ingestReferences(templateOp, tmpl);
19230
19397
  ingestNodes(childView, tmpl.children);
19231
19398
  for (const { name, value } of tmpl.variables) {
@@ -19244,14 +19411,15 @@ function ingestContent(unit, content) {
19244
19411
  const attrs = content.attributes.flatMap((a) => [a.name, a.value]);
19245
19412
  const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, attrs, content.sourceSpan);
19246
19413
  for (const attr of content.attributes) {
19247
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue, attr.i18n);
19414
+ const securityContext = domSchema.securityContext(content.name, attr.name, true);
19415
+ unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19248
19416
  }
19249
19417
  unit.create.push(op);
19250
19418
  }
19251
- function ingestText(unit, text2) {
19252
- unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
19419
+ function ingestText(unit, text2, icuPlaceholder) {
19420
+ unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, icuPlaceholder, text2.sourceSpan));
19253
19421
  }
19254
- function ingestBoundText(unit, text2, i18nPlaceholders) {
19422
+ function ingestBoundText(unit, text2, icuPlaceholder) {
19255
19423
  var _a2;
19256
19424
  let value = text2.value;
19257
19425
  if (value instanceof ASTWithSource) {
@@ -19263,14 +19431,12 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
19263
19431
  if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
19264
19432
  throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
19265
19433
  }
19266
- if (i18nPlaceholders === void 0) {
19267
- i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
19268
- }
19434
+ const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
19269
19435
  if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
19270
19436
  throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
19271
19437
  }
19272
19438
  const textXref = unit.job.allocateXrefId();
19273
- unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
19439
+ unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
19274
19440
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
19275
19441
  unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
19276
19442
  }
@@ -19296,7 +19462,7 @@ function ingestIfBlock(unit, ifBlock) {
19296
19462
  }
19297
19463
  ifCaseI18nMeta = ifCase.i18n;
19298
19464
  }
19299
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
19465
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
19300
19466
  unit.create.push(templateOp);
19301
19467
  if (firstXref === null) {
19302
19468
  firstXref = cView.xref;
@@ -19324,7 +19490,7 @@ function ingestSwitchBlock(unit, switchBlock) {
19324
19490
  }
19325
19491
  switchCaseI18nMeta = switchCase.i18n;
19326
19492
  }
19327
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
19493
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
19328
19494
  unit.create.push(templateOp);
19329
19495
  if (firstXref === null) {
19330
19496
  firstXref = cView.xref;
@@ -19338,35 +19504,38 @@ function ingestSwitchBlock(unit, switchBlock) {
19338
19504
  const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
19339
19505
  unit.update.push(conditional2);
19340
19506
  }
19341
- function ingestDeferView(unit, suffix, children, sourceSpan) {
19507
+ function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
19508
+ if (i18nMeta !== void 0 && !(i18nMeta instanceof BlockPlaceholder)) {
19509
+ throw Error("Unhandled i18n metadata type for defer block");
19510
+ }
19342
19511
  if (children === void 0) {
19343
19512
  return null;
19344
19513
  }
19345
19514
  const secondaryView = unit.job.allocateView(unit.xref);
19346
19515
  ingestNodes(secondaryView, children);
19347
- const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, void 0, sourceSpan);
19516
+ const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan, sourceSpan);
19348
19517
  unit.create.push(templateOp);
19349
19518
  return templateOp;
19350
19519
  }
19351
19520
  function ingestDeferBlock(unit, deferBlock) {
19352
- var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
19521
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
19353
19522
  const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
19354
19523
  if (blockMeta === void 0) {
19355
19524
  throw new Error(`AssertionError: unable to find metadata for deferred block`);
19356
19525
  }
19357
- const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
19358
- const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
19359
- const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
19360
- const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
19526
+ const main = ingestDeferView(unit, "", deferBlock.i18n, deferBlock.children, deferBlock.sourceSpan);
19527
+ const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.i18n, (_b2 = deferBlock.loading) == null ? void 0 : _b2.children, (_c2 = deferBlock.loading) == null ? void 0 : _c2.sourceSpan);
19528
+ const placeholder = ingestDeferView(unit, "Placeholder", (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.i18n, (_e2 = deferBlock.placeholder) == null ? void 0 : _e2.children, (_f2 = deferBlock.placeholder) == null ? void 0 : _f2.sourceSpan);
19529
+ const error2 = ingestDeferView(unit, "Error", (_g = deferBlock.error) == null ? void 0 : _g.i18n, (_h = deferBlock.error) == null ? void 0 : _h.children, (_i = deferBlock.error) == null ? void 0 : _i.sourceSpan);
19361
19530
  const deferXref = unit.job.allocateXrefId();
19362
19531
  const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
19363
- deferOp.placeholderView = (_g = placeholder == null ? void 0 : placeholder.xref) != null ? _g : null;
19364
- deferOp.placeholderSlot = (_h = placeholder == null ? void 0 : placeholder.handle) != null ? _h : null;
19365
- deferOp.loadingSlot = (_i = loading == null ? void 0 : loading.handle) != null ? _i : null;
19366
- deferOp.errorSlot = (_j = error2 == null ? void 0 : error2.handle) != null ? _j : null;
19367
- deferOp.placeholderMinimumTime = (_l = (_k = deferBlock.placeholder) == null ? void 0 : _k.minimumTime) != null ? _l : null;
19368
- deferOp.loadingMinimumTime = (_n = (_m = deferBlock.loading) == null ? void 0 : _m.minimumTime) != null ? _n : null;
19369
- deferOp.loadingAfterTime = (_p = (_o = deferBlock.loading) == null ? void 0 : _o.afterTime) != null ? _p : null;
19532
+ deferOp.placeholderView = (_j = placeholder == null ? void 0 : placeholder.xref) != null ? _j : null;
19533
+ deferOp.placeholderSlot = (_k = placeholder == null ? void 0 : placeholder.handle) != null ? _k : null;
19534
+ deferOp.loadingSlot = (_l = loading == null ? void 0 : loading.handle) != null ? _l : null;
19535
+ deferOp.errorSlot = (_m = error2 == null ? void 0 : error2.handle) != null ? _m : null;
19536
+ deferOp.placeholderMinimumTime = (_o = (_n = deferBlock.placeholder) == null ? void 0 : _n.minimumTime) != null ? _o : null;
19537
+ deferOp.loadingMinimumTime = (_q = (_p = deferBlock.loading) == null ? void 0 : _p.minimumTime) != null ? _q : null;
19538
+ deferOp.loadingAfterTime = (_s = (_r = deferBlock.loading) == null ? void 0 : _r.afterTime) != null ? _s : null;
19370
19539
  unit.create.push(deferOp);
19371
19540
  let prefetch = false;
19372
19541
  let deferOnOps = [];
@@ -19418,6 +19587,9 @@ function ingestDeferBlock(unit, deferBlock) {
19418
19587
  deferOnOps.push(deferOnOp);
19419
19588
  }
19420
19589
  if (triggers.when !== void 0) {
19590
+ if (triggers.when.value instanceof Interpolation) {
19591
+ throw new Error(`Unexpected interpolation in defer block when trigger`);
19592
+ }
19421
19593
  const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
19422
19594
  deferWhenOps.push(deferOnOp);
19423
19595
  }
@@ -19437,9 +19609,9 @@ function ingestIcu(unit, icu) {
19437
19609
  unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
19438
19610
  for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
19439
19611
  if (text2 instanceof BoundText) {
19440
- ingestBoundText(unit, text2, [placeholder]);
19612
+ ingestBoundText(unit, text2, placeholder);
19441
19613
  } else {
19442
- ingestText(unit, text2);
19614
+ ingestText(unit, text2, placeholder);
19443
19615
  }
19444
19616
  }
19445
19617
  unit.create.push(createIcuEndOp(xref));
@@ -19448,7 +19620,7 @@ function ingestIcu(unit, icu) {
19448
19620
  }
19449
19621
  }
19450
19622
  function ingestForBlock(unit, forBlock) {
19451
- var _a2;
19623
+ var _a2, _b2, _c2;
19452
19624
  const repeaterView = unit.job.allocateView(unit.xref);
19453
19625
  const createRepeaterAlias = (ident, repeaterVar) => {
19454
19626
  repeaterView.aliases.add({
@@ -19482,8 +19654,16 @@ function ingestForBlock(unit, forBlock) {
19482
19654
  $odd: forBlock.contextVariables.$odd.name,
19483
19655
  $implicit: forBlock.item.name
19484
19656
  };
19657
+ if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
19658
+ throw Error("AssertionError: Unhandled i18n metadata type or @for");
19659
+ }
19660
+ if (((_a2 = forBlock.empty) == null ? void 0 : _a2.i18n) !== void 0 && !(forBlock.empty.i18n instanceof BlockPlaceholder)) {
19661
+ throw Error("AssertionError: Unhandled i18n metadata type or @empty");
19662
+ }
19663
+ const i18nPlaceholder = forBlock.i18n;
19664
+ const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
19485
19665
  const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
19486
- const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_a2 = emptyView == null ? void 0 : emptyView.xref) != null ? _a2 : null, tagName, track, varNames, forBlock.sourceSpan);
19666
+ const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.startSourceSpan, forBlock.sourceSpan);
19487
19667
  unit.create.push(repeaterCreate2);
19488
19668
  const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
19489
19669
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
@@ -19571,120 +19751,128 @@ function convertAst(ast, job, baseSourceSpan) {
19571
19751
  throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
19572
19752
  }
19573
19753
  }
19754
+ function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
19755
+ var _a2, _b2;
19756
+ let expression;
19757
+ if (value instanceof Interpolation) {
19758
+ expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, sourceSpan != null ? sourceSpan : null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
19759
+ } else if (value instanceof AST) {
19760
+ expression = convertAst(value, job, sourceSpan != null ? sourceSpan : null);
19761
+ } else {
19762
+ expression = literal(value);
19763
+ }
19764
+ return expression;
19765
+ }
19766
+ var BINDING_KINDS = /* @__PURE__ */ new Map([
19767
+ [0, BindingKind.Property],
19768
+ [1, BindingKind.Attribute],
19769
+ [2, BindingKind.ClassName],
19770
+ [3, BindingKind.StyleProperty],
19771
+ [4, BindingKind.Animation]
19772
+ ]);
19574
19773
  function isPlainTemplate(tmpl) {
19575
19774
  var _a2;
19576
- return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === "ng-template";
19577
- }
19578
- function ingestBindings(unit, op, element2) {
19579
- let flags = BindingFlags.None;
19580
- let hasI18nAttributes = false;
19581
- if (element2 instanceof Template) {
19582
- flags |= BindingFlags.OnNgTemplateElement;
19583
- if (element2 instanceof Template && isPlainTemplate(element2)) {
19584
- flags |= BindingFlags.BindingTargetsTemplate;
19585
- }
19586
- const templateAttrFlags = flags | BindingFlags.BindingTargetsTemplate | BindingFlags.IsStructuralTemplateAttribute;
19587
- for (const attr of element2.templateAttrs) {
19588
- if (attr instanceof TextAttribute) {
19589
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, templateAttrFlags | BindingFlags.TextValue, attr.i18n);
19590
- hasI18nAttributes || (hasI18nAttributes = attr.i18n !== void 0);
19591
- } else {
19592
- ingestBinding(unit, op.xref, attr.name, attr.value, attr.type, attr.unit, attr.securityContext, attr.sourceSpan, templateAttrFlags, attr.i18n);
19593
- hasI18nAttributes || (hasI18nAttributes = attr.i18n !== void 0);
19594
- }
19595
- }
19775
+ return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === NG_TEMPLATE_TAG_NAME;
19776
+ }
19777
+ function asMessage(i18nMeta) {
19778
+ if (i18nMeta == null) {
19779
+ return null;
19780
+ }
19781
+ if (!(i18nMeta instanceof Message)) {
19782
+ throw Error(`Expected i18n meta to be a Message, but got: ${i18nMeta.constructor.name}`);
19596
19783
  }
19784
+ return i18nMeta;
19785
+ }
19786
+ function ingestElementBindings(unit, op, element2) {
19787
+ var _a2;
19788
+ let bindings = new Array();
19597
19789
  for (const attr of element2.attributes) {
19598
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, flags | BindingFlags.TextValue, attr.i18n);
19599
- hasI18nAttributes || (hasI18nAttributes = attr.i18n !== void 0);
19790
+ const securityContext = domSchema.securityContext(element2.name, attr.name, true);
19791
+ bindings.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, convertAstWithInterpolation(unit.job, attr.value, attr.i18n), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19600
19792
  }
19601
19793
  for (const input of element2.inputs) {
19602
- ingestBinding(unit, op.xref, input.name, input.value, input.type, input.unit, input.securityContext, input.sourceSpan, flags, input.i18n);
19603
- hasI18nAttributes || (hasI18nAttributes = input.i18n !== void 0);
19794
+ bindings.push(createBindingOp(op.xref, BINDING_KINDS.get(input.type), input.name, convertAstWithInterpolation(unit.job, astOf(input.value), input.i18n), input.unit, input.securityContext, false, false, null, (_a2 = asMessage(input.i18n)) != null ? _a2 : null, input.sourceSpan));
19604
19795
  }
19796
+ unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
19797
+ unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
19605
19798
  for (const output of element2.outputs) {
19606
- let listenerOp;
19607
- if (output.type === 1) {
19608
- if (output.phase === null) {
19609
- throw Error("Animation listener should have a phase");
19610
- }
19799
+ if (output.type === 1 && output.phase === null) {
19800
+ throw Error("Animation listener should have a phase");
19611
19801
  }
19612
- if (element2 instanceof Template && !isPlainTemplate(element2)) {
19613
- unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null));
19614
- continue;
19615
- }
19616
- listenerOp = createListenerOp(op.xref, op.handle, output.name, op.tag, output.phase, false, output.sourceSpan);
19617
- let handlerExprs;
19618
- let handler = output.handler;
19619
- if (handler instanceof ASTWithSource) {
19620
- handler = handler.ast;
19621
- }
19622
- if (handler instanceof Chain) {
19623
- handlerExprs = handler.expressions;
19802
+ unit.create.push(createListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.phase, output.target, false, output.sourceSpan));
19803
+ }
19804
+ if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
19805
+ unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
19806
+ }
19807
+ }
19808
+ function ingestTemplateBindings(unit, op, template2, templateKind) {
19809
+ let bindings = new Array();
19810
+ for (const attr of template2.templateAttrs) {
19811
+ if (attr instanceof TextAttribute) {
19812
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19813
+ bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19624
19814
  } else {
19625
- handlerExprs = [handler];
19815
+ bindings.push(createTemplateBinding(unit, op.xref, attr.type, attr.name, astOf(attr.value), attr.unit, attr.securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19816
+ }
19817
+ }
19818
+ for (const attr of template2.attributes) {
19819
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19820
+ bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, false, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19821
+ }
19822
+ for (const input of template2.inputs) {
19823
+ bindings.push(createTemplateBinding(unit, op.xref, input.type, input.name, astOf(input.value), input.unit, input.securityContext, false, templateKind, asMessage(input.i18n), input.sourceSpan));
19824
+ }
19825
+ unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
19826
+ unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
19827
+ for (const output of template2.outputs) {
19828
+ if (output.type === 1 && output.phase === null) {
19829
+ throw Error("Animation listener should have a phase");
19626
19830
  }
19627
- if (handlerExprs.length === 0) {
19628
- throw new Error("Expected listener to have non-empty expression list.");
19831
+ if (templateKind === TemplateKind.NgTemplate) {
19832
+ unit.create.push(createListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.phase, output.target, false, output.sourceSpan));
19629
19833
  }
19630
- const expressions = handlerExprs.map((expr) => convertAst(expr, unit.job, output.handlerSpan));
19631
- const returnExpr = expressions.pop();
19632
- for (const expr of expressions) {
19633
- const stmtOp = createStatementOp(new ExpressionStatement(expr, expr.sourceSpan));
19634
- listenerOp.handlerOps.push(stmtOp);
19834
+ if (templateKind === TemplateKind.Structural && output.type !== 1) {
19835
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
19836
+ unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
19635
19837
  }
19636
- listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
19637
- unit.create.push(listenerOp);
19638
19838
  }
19639
- if (hasI18nAttributes) {
19839
+ if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
19640
19840
  unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
19641
19841
  }
19642
19842
  }
19643
- var BINDING_KINDS = /* @__PURE__ */ new Map([
19644
- [0, BindingKind.Property],
19645
- [1, BindingKind.Attribute],
19646
- [2, BindingKind.ClassName],
19647
- [3, BindingKind.StyleProperty],
19648
- [4, BindingKind.Animation]
19649
- ]);
19650
- var BindingFlags;
19651
- (function(BindingFlags2) {
19652
- BindingFlags2[BindingFlags2["None"] = 0] = "None";
19653
- BindingFlags2[BindingFlags2["TextValue"] = 1] = "TextValue";
19654
- BindingFlags2[BindingFlags2["BindingTargetsTemplate"] = 2] = "BindingTargetsTemplate";
19655
- BindingFlags2[BindingFlags2["IsStructuralTemplateAttribute"] = 4] = "IsStructuralTemplateAttribute";
19656
- BindingFlags2[BindingFlags2["OnNgTemplateElement"] = 8] = "OnNgTemplateElement";
19657
- })(BindingFlags || (BindingFlags = {}));
19658
- function ingestBinding(view, xref, name, value, type, unit, securityContext, sourceSpan, flags, i18nMeta) {
19659
- if (value instanceof ASTWithSource) {
19660
- value = value.ast;
19661
- }
19662
- let i18nContext = null;
19663
- if (i18nMeta !== void 0) {
19664
- if (!(i18nMeta instanceof Message)) {
19665
- throw Error(`Unhandled i18n metadata type for binding: ${i18nMeta.constructor.name}`);
19843
+ function createTemplateBinding(view, xref, type, name, value, unit, securityContext, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
19844
+ const isTextBinding = typeof value === "string";
19845
+ if (templateKind === TemplateKind.Structural) {
19846
+ if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
19847
+ return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
19848
+ }
19849
+ if (!isTextBinding && (type === 1 || type === 4)) {
19850
+ return null;
19666
19851
  }
19667
- i18nContext = view.job.allocateXrefId();
19668
- view.create.push(createI18nContextOp(I18nContextKind.Attr, i18nContext, null, i18nMeta, null));
19669
- }
19670
- if (flags & BindingFlags.OnNgTemplateElement && !(flags & BindingFlags.BindingTargetsTemplate) && type === 0) {
19671
- view.create.push(createExtractedAttributeOp(xref, BindingKind.Property, name, null, i18nContext));
19672
- return;
19673
19852
  }
19674
- let expression;
19675
- if (value instanceof Interpolation) {
19676
- let i18nPlaceholders = [];
19677
- if (i18nMeta !== void 0) {
19678
- i18nPlaceholders = Object.keys(i18nMeta.placeholders);
19853
+ let bindingType = BINDING_KINDS.get(type);
19854
+ if (templateKind === TemplateKind.NgTemplate) {
19855
+ if (type === 2 || type === 3 || type === 1 && !isTextBinding) {
19856
+ bindingType = BindingKind.Property;
19679
19857
  }
19680
- expression = new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, view.job, null)), i18nPlaceholders);
19681
- } else if (value instanceof AST) {
19682
- expression = convertAst(value, view.job, null);
19683
- } else {
19684
- expression = value;
19685
19858
  }
19686
- const kind = BINDING_KINDS.get(type);
19687
- view.update.push(createBindingOp(xref, kind, name, expression, unit, securityContext, !!(flags & BindingFlags.TextValue), !!(flags & BindingFlags.IsStructuralTemplateAttribute), i18nContext, sourceSpan));
19859
+ return createBindingOp(xref, bindingType, name, convertAstWithInterpolation(view.job, value, i18nMessage), unit, securityContext, isTextBinding, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan);
19860
+ }
19861
+ function makeListenerHandlerOps(unit, handler, handlerSpan) {
19862
+ handler = astOf(handler);
19863
+ const handlerOps = new Array();
19864
+ let handlerExprs = handler instanceof Chain ? handler.expressions : [handler];
19865
+ if (handlerExprs.length === 0) {
19866
+ throw new Error("Expected listener to have non-empty expression list.");
19867
+ }
19868
+ const expressions = handlerExprs.map((expr) => convertAst(expr, unit.job, handlerSpan));
19869
+ const returnExpr = expressions.pop();
19870
+ handlerOps.push(...expressions.map((e) => createStatementOp(new ExpressionStatement(e, e.sourceSpan))));
19871
+ handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
19872
+ return handlerOps;
19873
+ }
19874
+ function astOf(ast) {
19875
+ return ast instanceof ASTWithSource ? ast.ast : ast;
19688
19876
  }
19689
19877
  function ingestReferences(op, element2) {
19690
19878
  assertIsArray(op.localRefs);
@@ -19724,18 +19912,19 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
19724
19912
  }
19725
19913
  if (root !== null) {
19726
19914
  for (const attr of root.attributes) {
19727
- ingestBinding(unit, xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue, attr.i18n);
19915
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19916
+ unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19728
19917
  }
19729
19918
  const tagName = root instanceof Element ? root.name : root.tagName;
19730
- return tagName === "ng-template" ? null : tagName;
19919
+ return tagName === NG_TEMPLATE_TAG_NAME ? null : tagName;
19731
19920
  }
19732
19921
  return null;
19733
19922
  }
19734
19923
 
19735
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
19924
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
19736
19925
  var USE_TEMPLATE_PIPELINE = false;
19737
19926
 
19738
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/styling_builder.mjs
19927
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/styling_builder.mjs
19739
19928
  var IMPORTANT_FLAG = "!important";
19740
19929
  var MIN_STYLING_BINDING_SLOTS_REQUIRED = 2;
19741
19930
  var StylingBuilder = class {
@@ -20068,7 +20257,7 @@ function isEmptyExpression(ast) {
20068
20257
  return ast instanceof EmptyExpr;
20069
20258
  }
20070
20259
 
20071
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_parser.mjs
20260
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/html_parser.mjs
20072
20261
  var HtmlParser = class extends Parser2 {
20073
20262
  constructor() {
20074
20263
  super(getHtmlTagDefinition);
@@ -20078,7 +20267,7 @@ var HtmlParser = class extends Parser2 {
20078
20267
  }
20079
20268
  };
20080
20269
 
20081
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_whitespaces.mjs
20270
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/html_whitespaces.mjs
20082
20271
  var PRESERVE_WS_ATTR_NAME = "ngPreserveWhitespaces";
20083
20272
  var SKIP_WS_TRIM_TAGS = /* @__PURE__ */ new Set(["pre", "template", "textarea", "script", "style"]);
20084
20273
  var WS_CHARS = " \f\n\r \v\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
@@ -20144,7 +20333,7 @@ function visitAllWithSiblings(visitor, nodes) {
20144
20333
  return result;
20145
20334
  }
20146
20335
 
20147
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template_parser/binding_parser.mjs
20336
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template_parser/binding_parser.mjs
20148
20337
  var PROPERTY_PARTS_SEPARATOR = ".";
20149
20338
  var ATTRIBUTE_PREFIX = "attr";
20150
20339
  var CLASS_PREFIX = "class";
@@ -20464,7 +20653,7 @@ function moveParseSourceSpan(sourceSpan, absoluteSpan) {
20464
20653
  return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
20465
20654
  }
20466
20655
 
20467
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/style_url_resolver.mjs
20656
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/style_url_resolver.mjs
20468
20657
  function isStyleUrlResolvable(url) {
20469
20658
  if (url == null || url.length === 0 || url[0] == "/")
20470
20659
  return false;
@@ -20473,7 +20662,7 @@ function isStyleUrlResolvable(url) {
20473
20662
  }
20474
20663
  var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
20475
20664
 
20476
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template_parser/template_preparser.mjs
20665
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template_parser/template_preparser.mjs
20477
20666
  var NG_CONTENT_SELECT_ATTR = "select";
20478
20667
  var LINK_ELEMENT = "link";
20479
20668
  var LINK_STYLE_REL_ATTR = "rel";
@@ -20543,7 +20732,7 @@ function normalizeNgContentSelect(selectAttr) {
20543
20732
  return selectAttr;
20544
20733
  }
20545
20734
 
20546
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
20735
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
20547
20736
  var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/;
20548
20737
  var FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
20549
20738
  var CONDITIONAL_ALIAS_PATTERN = /^as\s+(.*)/;
@@ -20834,7 +21023,7 @@ function stripOptionalParentheses(param, errors) {
20834
21023
  return expression.slice(start, end);
20835
21024
  }
20836
21025
 
20837
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
21026
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
20838
21027
  var TIME_PATTERN = /^\d+\.?\d*(ms|s)?$/;
20839
21028
  var SEPARATOR_PATTERN = /^\s$/;
20840
21029
  var COMMA_DELIMITED_SYNTAX = /* @__PURE__ */ new Map([
@@ -21098,7 +21287,7 @@ function parseDeferredTime(value) {
21098
21287
  return parseFloat(time) * (units === "s" ? 1e3 : 1);
21099
21288
  }
21100
21289
 
21101
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
21290
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
21102
21291
  var PREFETCH_WHEN_PATTERN = /^prefetch\s+when\s/;
21103
21292
  var PREFETCH_ON_PATTERN = /^prefetch\s+on\s/;
21104
21293
  var MINIMUM_PARAMETER_PATTERN = /^minimum\s/;
@@ -21233,7 +21422,7 @@ function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
21233
21422
  return { triggers, prefetchTriggers };
21234
21423
  }
21235
21424
 
21236
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_template_transform.mjs
21425
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_template_transform.mjs
21237
21426
  var BIND_NAME_REGEXP = /^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/;
21238
21427
  var KW_BIND_IDX = 1;
21239
21428
  var KW_LET_IDX = 2;
@@ -21664,7 +21853,7 @@ function textContents(node) {
21664
21853
  }
21665
21854
  }
21666
21855
 
21667
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/context.mjs
21856
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/context.mjs
21668
21857
  var TagType;
21669
21858
  (function(TagType2) {
21670
21859
  TagType2[TagType2["ELEMENT"] = 0] = "ELEMENT";
@@ -21809,21 +21998,21 @@ function serializePlaceholderValue(value) {
21809
21998
  }
21810
21999
  }
21811
22000
 
21812
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/template.mjs
22001
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/template.mjs
21813
22002
  var NG_CONTENT_SELECT_ATTR2 = "select";
21814
22003
  var NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
21815
22004
  var EVENT_BINDING_SCOPE_GLOBALS = /* @__PURE__ */ new Set(["$event"]);
21816
- var NG_TEMPLATE_TAG_NAME = "ng-template";
21817
- var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
22005
+ var NG_TEMPLATE_TAG_NAME2 = "ng-template";
22006
+ var GLOBAL_TARGET_RESOLVERS2 = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
21818
22007
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
21819
22008
  function renderFlagCheckIfStmt(flags, statements) {
21820
22009
  return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null, false), statements);
21821
22010
  }
21822
22011
  function prepareEventListenerParameters(eventAst, handlerName = null, scope = null) {
21823
22012
  const { type, name, target, phase, handler } = eventAst;
21824
- if (target && !GLOBAL_TARGET_RESOLVERS.has(target)) {
22013
+ if (target && !GLOBAL_TARGET_RESOLVERS2.has(target)) {
21825
22014
  throw new Error(`Unexpected global target '${target}' defined for '${name}' event.
21826
- Supported list of global targets: ${Array.from(GLOBAL_TARGET_RESOLVERS.keys())}.`);
22015
+ Supported list of global targets: ${Array.from(GLOBAL_TARGET_RESOLVERS2.keys())}.`);
21827
22016
  }
21828
22017
  const eventArgumentName = "$event";
21829
22018
  const implicitReceiverAccesses = /* @__PURE__ */ new Set();
@@ -21856,7 +22045,7 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
21856
22045
  if (target) {
21857
22046
  params.push(
21858
22047
  literal(false),
21859
- importExpr(GLOBAL_TARGET_RESOLVERS.get(target))
22048
+ importExpr(GLOBAL_TARGET_RESOLVERS2.get(target))
21860
22049
  );
21861
22050
  }
21862
22051
  return params;
@@ -22402,10 +22591,10 @@ var TemplateDefinitionBuilder = class {
22402
22591
  var _a2;
22403
22592
  const tagNameWithoutNamespace = template2.tagName ? splitNsName(template2.tagName)[1] : template2.tagName;
22404
22593
  const contextNameSuffix = template2.tagName ? "_" + sanitizeIdentifier(template2.tagName) : "";
22405
- const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
22594
+ const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
22406
22595
  const templateIndex = this.createEmbeddedTemplateFn(tagNameWithoutNamespace, template2.children, contextNameSuffix, template2.sourceSpan, template2.variables, attrsExprs, template2.references, template2.i18n);
22407
22596
  this.templatePropertyBindings(templateIndex, template2.templateAttrs);
22408
- if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME) {
22597
+ if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME2) {
22409
22598
  const [i18nInputs, inputs] = partitionArray(template2.inputs, hasI18nMeta);
22410
22599
  if (i18nInputs.length > 0) {
22411
22600
  this.i18nAttributesInstruction(templateIndex, i18nInputs, (_a2 = template2.startSourceSpan) != null ? _a2 : template2.sourceSpan);
@@ -22646,8 +22835,8 @@ var TemplateDefinitionBuilder = class {
22646
22835
  }
22647
22836
  if (root !== null) {
22648
22837
  const name = root instanceof Element ? root.name : root.tagName;
22649
- tagName = name === NG_TEMPLATE_TAG_NAME ? null : name;
22650
- attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root.attributes, root.inputs, []);
22838
+ tagName = name === NG_TEMPLATE_TAG_NAME2 ? null : name;
22839
+ attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, root.attributes, root.inputs, []);
22651
22840
  }
22652
22841
  return { tagName, attrsExprs };
22653
22842
  }
@@ -23246,12 +23435,15 @@ var BindingScope = class {
23246
23435
  }
23247
23436
  };
23248
23437
  var TrackByBindingScope = class extends BindingScope {
23249
- constructor(parentScope, globalAliases) {
23438
+ constructor(parentScope, globalOverrides) {
23250
23439
  super(parentScope.bindingLevel + 1, parentScope);
23251
- this.globalAliases = globalAliases;
23440
+ this.globalOverrides = globalOverrides;
23252
23441
  this.componentAccessCount = 0;
23253
23442
  }
23254
23443
  get(name) {
23444
+ if (this.globalOverrides.hasOwnProperty(name)) {
23445
+ return variable(this.globalOverrides[name]);
23446
+ }
23255
23447
  let current = this.parent;
23256
23448
  while (current) {
23257
23449
  if (current.hasLocal(name)) {
@@ -23259,9 +23451,6 @@ var TrackByBindingScope = class extends BindingScope {
23259
23451
  }
23260
23452
  current = current.parent;
23261
23453
  }
23262
- if (this.globalAliases[name]) {
23263
- return variable(this.globalAliases[name]);
23264
- }
23265
23454
  this.componentAccessCount++;
23266
23455
  return variable("this").prop(name);
23267
23456
  }
@@ -23486,7 +23675,7 @@ function createClosureModeGuard2() {
23486
23675
  return typeofExpr(variable(NG_I18N_CLOSURE_MODE2)).notIdentical(literal("undefined", STRING_TYPE)).and(variable(NG_I18N_CLOSURE_MODE2));
23487
23676
  }
23488
23677
 
23489
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
23678
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
23490
23679
  var ATTR_REGEX = /attr\.([^\]]+)/;
23491
23680
  var COMPONENT_VARIABLE = "%COMP%";
23492
23681
  var HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
@@ -23807,6 +23996,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
23807
23996
  }
23808
23997
  const hostJob = ingestHostBinding({
23809
23998
  componentName: name,
23999
+ componentSelector: selector,
23810
24000
  properties: bindings,
23811
24001
  events: eventBindings,
23812
24002
  attributes: hostBindingsMetadata.attributes
@@ -24100,7 +24290,7 @@ function createHostDirectivesMappingArray(mapping) {
24100
24290
  return elements.length > 0 ? literalArr(elements) : null;
24101
24291
  }
24102
24292
 
24103
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/t2_binder.mjs
24293
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/t2_binder.mjs
24104
24294
  var R3TargetBinder = class {
24105
24295
  constructor(directiveMatcher) {
24106
24296
  this.directiveMatcher = directiveMatcher;
@@ -24705,11 +24895,11 @@ function extractScopedNodeEntities(rootScope) {
24705
24895
  return templateEntities;
24706
24896
  }
24707
24897
 
24708
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/resource_loader.mjs
24898
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/resource_loader.mjs
24709
24899
  var ResourceLoader = class {
24710
24900
  };
24711
24901
 
24712
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/jit_compiler_facade.mjs
24902
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/jit_compiler_facade.mjs
24713
24903
  var CompilerFacadeImpl = class {
24714
24904
  constructor(jitEvaluator = new JitEvaluator()) {
24715
24905
  this.jitEvaluator = jitEvaluator;
@@ -25261,17 +25451,17 @@ function publishFacade(global) {
25261
25451
  ng.\u0275compilerFacade = new CompilerFacadeImpl();
25262
25452
  }
25263
25453
 
25264
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/version.mjs
25265
- var VERSION2 = new Version("17.0.6");
25454
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
25455
+ var VERSION2 = new Version("17.0.8");
25266
25456
 
25267
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25457
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25268
25458
  var _VisitorMode;
25269
25459
  (function(_VisitorMode2) {
25270
25460
  _VisitorMode2[_VisitorMode2["Extract"] = 0] = "Extract";
25271
25461
  _VisitorMode2[_VisitorMode2["Merge"] = 1] = "Merge";
25272
25462
  })(_VisitorMode || (_VisitorMode = {}));
25273
25463
 
25274
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/xml_tags.mjs
25464
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/xml_tags.mjs
25275
25465
  var XmlTagDefinition = class {
25276
25466
  constructor() {
25277
25467
  this.closedByParent = false;
@@ -25293,7 +25483,7 @@ var XmlTagDefinition = class {
25293
25483
  };
25294
25484
  var _TAG_DEFINITION = new XmlTagDefinition();
25295
25485
 
25296
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/partial/api.mjs
25486
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/partial/api.mjs
25297
25487
  var FactoryTarget2;
25298
25488
  (function(FactoryTarget3) {
25299
25489
  FactoryTarget3[FactoryTarget3["Directive"] = 0] = "Directive";
@@ -25303,15 +25493,45 @@ var FactoryTarget2;
25303
25493
  FactoryTarget3[FactoryTarget3["NgModule"] = 4] = "NgModule";
25304
25494
  })(FactoryTarget2 || (FactoryTarget2 = {}));
25305
25495
 
25306
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/compiler.mjs
25496
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/compiler.mjs
25307
25497
  publishFacade(_global);
25308
25498
 
25309
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/types.mjs
25499
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/identifier-lookup.mjs
25500
+ var import_typescript5 = __toESM(require("typescript"), 1);
25501
+ function lookupIdentifiersInSourceFile(sourceFile, names) {
25502
+ const results = /* @__PURE__ */ new Set();
25503
+ const visit = (node) => {
25504
+ if (import_typescript5.default.isIdentifier(node) && names.includes(node.text)) {
25505
+ results.add(node);
25506
+ }
25507
+ import_typescript5.default.forEachChild(node, visit);
25508
+ };
25509
+ visit(sourceFile);
25510
+ return results;
25511
+ }
25512
+
25513
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/types.mjs
25310
25514
  var ngtemplate = "ng-template";
25311
25515
  var boundngifelse = "[ngIfElse]";
25312
25516
  var boundngifthenelse = "[ngIfThenElse]";
25313
25517
  var boundngifthen = "[ngIfThen]";
25314
25518
  var nakedngfor = "ngFor";
25519
+ var startMarker = "\u25EC";
25520
+ var endMarker = "\u2722";
25521
+ var startI18nMarker = "\u2688";
25522
+ var endI18nMarker = "\u2689";
25523
+ var importRemovals = [
25524
+ "NgIf",
25525
+ "NgIfElse",
25526
+ "NgIfThenElse",
25527
+ "NgFor",
25528
+ "NgForOf",
25529
+ "NgForTrackBy",
25530
+ "NgSwitch",
25531
+ "NgSwitchCase",
25532
+ "NgSwitchDefault"
25533
+ ];
25534
+ var importWithCommonRemovals = [...importRemovals, "CommonModule"];
25315
25535
  function allFormsOf(selector) {
25316
25536
  return [
25317
25537
  selector,
@@ -25461,21 +25681,24 @@ var Template2 = class {
25461
25681
  }
25462
25682
  };
25463
25683
  var AnalyzedFile = class {
25464
- constructor() {
25684
+ constructor(sourceFile) {
25465
25685
  __publicField(this, "ranges", []);
25466
25686
  __publicField(this, "removeCommonModule", false);
25467
- __publicField(this, "sourceFilePath", "");
25687
+ __publicField(this, "canRemoveImports", false);
25688
+ __publicField(this, "sourceFile");
25689
+ __publicField(this, "importRanges", []);
25690
+ __publicField(this, "templateRanges", []);
25691
+ this.sourceFile = sourceFile;
25468
25692
  }
25469
25693
  getSortedRanges() {
25470
- const templateRanges = this.ranges.slice().filter((x) => x.type !== "import").sort((aStart, bStart) => bStart.start - aStart.start);
25471
- const importRanges = this.ranges.slice().filter((x) => x.type === "import").sort((aStart, bStart) => bStart.start - aStart.start);
25472
- return [...templateRanges, ...importRanges];
25694
+ this.templateRanges = this.ranges.slice().filter((x) => x.type === "template" || x.type === "templateUrl").sort((aStart, bStart) => bStart.start - aStart.start);
25695
+ this.importRanges = this.ranges.slice().filter((x) => x.type === "importDecorator" || x.type === "importDeclaration").sort((aStart, bStart) => bStart.start - aStart.start);
25696
+ return [...this.templateRanges, ...this.importRanges];
25473
25697
  }
25474
- static addRange(path2, sourceFilePath, analyzedFiles, range) {
25698
+ static addRange(path2, sourceFile, analyzedFiles, range) {
25475
25699
  let analysis = analyzedFiles.get(path2);
25476
25700
  if (!analysis) {
25477
- analysis = new AnalyzedFile();
25478
- analysis.sourceFilePath = sourceFilePath;
25701
+ analysis = new AnalyzedFile(sourceFile);
25479
25702
  analyzedFiles.set(path2, analysis);
25480
25703
  }
25481
25704
  const duplicate = analysis.ranges.find((current) => current.start === range.start && current.end === range.end);
@@ -25483,6 +25706,25 @@ var AnalyzedFile = class {
25483
25706
  analysis.ranges.push(range);
25484
25707
  }
25485
25708
  }
25709
+ verifyCanRemoveImports() {
25710
+ const importDeclaration = this.importRanges.find((r) => r.type === "importDeclaration");
25711
+ const instances = lookupIdentifiersInSourceFile(this.sourceFile, importWithCommonRemovals);
25712
+ let foundImportDeclaration = false;
25713
+ let count = 0;
25714
+ for (let range of this.importRanges) {
25715
+ for (let instance of instances) {
25716
+ if (instance.getStart() >= range.start && instance.getEnd() <= range.end) {
25717
+ if (range === importDeclaration) {
25718
+ foundImportDeclaration = true;
25719
+ }
25720
+ count++;
25721
+ }
25722
+ }
25723
+ }
25724
+ if (instances.size !== count && importDeclaration !== void 0 && foundImportDeclaration) {
25725
+ importDeclaration.remove = false;
25726
+ }
25727
+ }
25486
25728
  };
25487
25729
  var CommonCollector = class extends RecursiveVisitor {
25488
25730
  constructor() {
@@ -25511,6 +25753,18 @@ var CommonCollector = class extends RecursiveVisitor {
25511
25753
  return commonModulePipes.some((regexp) => regexp.test(input));
25512
25754
  }
25513
25755
  };
25756
+ var i18nCollector = class extends RecursiveVisitor {
25757
+ constructor() {
25758
+ super(...arguments);
25759
+ __publicField(this, "elements", []);
25760
+ }
25761
+ visitElement(el) {
25762
+ if (el.attrs.find((a) => a.name === "i18n") !== void 0) {
25763
+ this.elements.push(el);
25764
+ }
25765
+ super.visitElement(el, null);
25766
+ }
25767
+ };
25514
25768
  var ElementCollector = class extends RecursiveVisitor {
25515
25769
  constructor(_attributes = []) {
25516
25770
  super();
@@ -25589,33 +25843,30 @@ var TemplateCollector = class extends RecursiveVisitor {
25589
25843
  }
25590
25844
  };
25591
25845
 
25592
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/util.mjs
25846
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/util.mjs
25593
25847
  var import_path2 = require("path");
25594
- var import_typescript5 = __toESM(require("typescript"), 1);
25595
- var importRemovals = [
25596
- "NgIf",
25597
- "NgIfElse",
25598
- "NgIfThenElse",
25599
- "NgFor",
25600
- "NgForOf",
25601
- "NgForTrackBy",
25602
- "NgSwitch",
25603
- "NgSwitchCase",
25604
- "NgSwitchDefault"
25605
- ];
25606
- var importWithCommonRemovals = [...importRemovals, "CommonModule"];
25848
+ var import_typescript6 = __toESM(require("typescript"), 1);
25849
+ var startMarkerRegex = new RegExp(startMarker, "gm");
25850
+ var endMarkerRegex = new RegExp(endMarker, "gm");
25851
+ var startI18nMarkerRegex = new RegExp(startI18nMarker, "gm");
25852
+ var endI18nMarkerRegex = new RegExp(endI18nMarker, "gm");
25853
+ var replaceMarkerRegex = new RegExp(`${startMarker}|${endMarker}`, "gm");
25607
25854
  function analyze(sourceFile, analyzedFiles) {
25608
25855
  forEachClass(sourceFile, (node) => {
25609
- if (import_typescript5.default.isClassDeclaration(node)) {
25856
+ if (import_typescript6.default.isClassDeclaration(node)) {
25610
25857
  analyzeDecorators(node, sourceFile, analyzedFiles);
25611
25858
  } else {
25612
25859
  analyzeImportDeclarations(node, sourceFile, analyzedFiles);
25613
25860
  }
25614
25861
  });
25615
25862
  }
25616
- function checkIfShouldChange(decl, removeCommonModule) {
25863
+ function checkIfShouldChange(decl, file) {
25864
+ const range = file.importRanges.find((r) => r.type === "importDeclaration");
25865
+ if (range === void 0 || !range.remove) {
25866
+ return false;
25867
+ }
25617
25868
  const clause = decl.getChildAt(1);
25618
- return !(!removeCommonModule && clause.namedBindings && import_typescript5.default.isNamedImports(clause.namedBindings) && clause.namedBindings.elements.length === 1 && clause.namedBindings.elements[0].getText() === "CommonModule");
25869
+ return !(!file.removeCommonModule && clause.namedBindings && import_typescript6.default.isNamedImports(clause.namedBindings) && clause.namedBindings.elements.length === 1 && clause.namedBindings.elements[0].getText() === "CommonModule");
25619
25870
  }
25620
25871
  function updateImportDeclaration(decl, removeCommonModule) {
25621
25872
  const clause = decl.getChildAt(1);
@@ -25623,81 +25874,89 @@ function updateImportDeclaration(decl, removeCommonModule) {
25623
25874
  if (updatedClause === null) {
25624
25875
  return "";
25625
25876
  }
25626
- const printer = import_typescript5.default.createPrinter({
25877
+ const printer = import_typescript6.default.createPrinter({
25627
25878
  removeComments: true
25628
25879
  });
25629
- const updated = import_typescript5.default.factory.updateImportDeclaration(decl, decl.modifiers, updatedClause, decl.moduleSpecifier, void 0);
25630
- return printer.printNode(import_typescript5.default.EmitHint.Unspecified, updated, clause.getSourceFile());
25880
+ const updated = import_typescript6.default.factory.updateImportDeclaration(decl, decl.modifiers, updatedClause, decl.moduleSpecifier, void 0);
25881
+ return printer.printNode(import_typescript6.default.EmitHint.Unspecified, updated, clause.getSourceFile());
25631
25882
  }
25632
25883
  function updateImportClause(clause, removeCommonModule) {
25633
- if (clause.namedBindings && import_typescript5.default.isNamedImports(clause.namedBindings)) {
25884
+ if (clause.namedBindings && import_typescript6.default.isNamedImports(clause.namedBindings)) {
25634
25885
  const removals = removeCommonModule ? importWithCommonRemovals : importRemovals;
25635
25886
  const elements = clause.namedBindings.elements.filter((el) => !removals.includes(el.getText()));
25636
25887
  if (elements.length === 0) {
25637
25888
  return null;
25638
25889
  }
25639
- clause = import_typescript5.default.factory.updateImportClause(clause, clause.isTypeOnly, clause.name, import_typescript5.default.factory.createNamedImports(elements));
25890
+ clause = import_typescript6.default.factory.updateImportClause(clause, clause.isTypeOnly, clause.name, import_typescript6.default.factory.createNamedImports(elements));
25640
25891
  }
25641
25892
  return clause;
25642
25893
  }
25643
25894
  function updateClassImports(propAssignment, removeCommonModule) {
25644
- const printer = import_typescript5.default.createPrinter();
25895
+ const printer = import_typescript6.default.createPrinter();
25645
25896
  const importList = propAssignment.initializer;
25646
25897
  const removals = removeCommonModule ? importWithCommonRemovals : importRemovals;
25647
25898
  const elements = importList.elements.filter((el) => !removals.includes(el.getText()));
25648
25899
  if (elements.length === importList.elements.length) {
25649
25900
  return null;
25650
25901
  }
25651
- const updatedElements = import_typescript5.default.factory.updateArrayLiteralExpression(importList, elements);
25652
- const updatedAssignment = import_typescript5.default.factory.updatePropertyAssignment(propAssignment, propAssignment.name, updatedElements);
25653
- return printer.printNode(import_typescript5.default.EmitHint.Unspecified, updatedAssignment, updatedAssignment.getSourceFile());
25902
+ const updatedElements = import_typescript6.default.factory.updateArrayLiteralExpression(importList, elements);
25903
+ const updatedAssignment = import_typescript6.default.factory.updatePropertyAssignment(propAssignment, propAssignment.name, updatedElements);
25904
+ return printer.printNode(import_typescript6.default.EmitHint.Unspecified, updatedAssignment, updatedAssignment.getSourceFile());
25654
25905
  }
25655
25906
  function analyzeImportDeclarations(node, sourceFile, analyzedFiles) {
25656
25907
  if (node.getText().indexOf("@angular/common") === -1) {
25657
25908
  return;
25658
25909
  }
25659
25910
  const clause = node.getChildAt(1);
25660
- if (clause.namedBindings && import_typescript5.default.isNamedImports(clause.namedBindings)) {
25911
+ if (clause.namedBindings && import_typescript6.default.isNamedImports(clause.namedBindings)) {
25661
25912
  const elements = clause.namedBindings.elements.filter((el) => importWithCommonRemovals.includes(el.getText()));
25662
25913
  if (elements.length > 0) {
25663
- AnalyzedFile.addRange(sourceFile.fileName, sourceFile.fileName, analyzedFiles, { start: node.getStart(), end: node.getEnd(), node, type: "import" });
25914
+ AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
25915
+ start: node.getStart(),
25916
+ end: node.getEnd(),
25917
+ node,
25918
+ type: "importDeclaration",
25919
+ remove: true
25920
+ });
25664
25921
  }
25665
25922
  }
25666
25923
  }
25667
25924
  function analyzeDecorators(node, sourceFile, analyzedFiles) {
25668
25925
  var _a2;
25669
- const decorator = (_a2 = import_typescript5.default.getDecorators(node)) == null ? void 0 : _a2.find((dec) => {
25670
- return import_typescript5.default.isCallExpression(dec.expression) && import_typescript5.default.isIdentifier(dec.expression.expression) && dec.expression.expression.text === "Component";
25926
+ const decorator = (_a2 = import_typescript6.default.getDecorators(node)) == null ? void 0 : _a2.find((dec) => {
25927
+ return import_typescript6.default.isCallExpression(dec.expression) && import_typescript6.default.isIdentifier(dec.expression.expression) && dec.expression.expression.text === "Component";
25671
25928
  });
25672
- const metadata = decorator && decorator.expression.arguments.length > 0 && import_typescript5.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
25929
+ const metadata = decorator && decorator.expression.arguments.length > 0 && import_typescript6.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
25673
25930
  if (!metadata) {
25674
25931
  return;
25675
25932
  }
25676
25933
  for (const prop of metadata.properties) {
25677
- if (!import_typescript5.default.isPropertyAssignment(prop) || !import_typescript5.default.isIdentifier(prop.name) && !import_typescript5.default.isStringLiteralLike(prop.name)) {
25934
+ if (!import_typescript6.default.isPropertyAssignment(prop) || !import_typescript6.default.isIdentifier(prop.name) && !import_typescript6.default.isStringLiteralLike(prop.name)) {
25678
25935
  continue;
25679
25936
  }
25680
25937
  switch (prop.name.text) {
25681
25938
  case "template":
25682
- AnalyzedFile.addRange(sourceFile.fileName, sourceFile.fileName, analyzedFiles, {
25939
+ AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
25683
25940
  start: prop.initializer.getStart() + 1,
25684
25941
  end: prop.initializer.getEnd() - 1,
25685
25942
  node: prop,
25686
- type: "template"
25943
+ type: "template",
25944
+ remove: true
25687
25945
  });
25688
25946
  break;
25689
25947
  case "imports":
25690
- AnalyzedFile.addRange(sourceFile.fileName, sourceFile.fileName, analyzedFiles, {
25948
+ AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
25691
25949
  start: prop.name.getStart(),
25692
25950
  end: prop.initializer.getEnd(),
25693
25951
  node: prop,
25694
- type: "import"
25952
+ type: "importDecorator",
25953
+ remove: true
25695
25954
  });
25696
25955
  break;
25697
25956
  case "templateUrl":
25698
- if (import_typescript5.default.isStringLiteralLike(prop.initializer)) {
25957
+ if (import_typescript6.default.isStringLiteralLike(prop.initializer)) {
25699
25958
  const path2 = (0, import_path2.join)((0, import_path2.dirname)(sourceFile.fileName), prop.initializer.text);
25700
- AnalyzedFile.addRange(path2, sourceFile.fileName, analyzedFiles, { start: 0, node: prop, type: "templateUrl" });
25959
+ AnalyzedFile.addRange(path2, sourceFile, analyzedFiles, { start: 0, node: prop, type: "templateUrl", remove: true });
25701
25960
  }
25702
25961
  break;
25703
25962
  }
@@ -25724,12 +25983,48 @@ function parseTemplate2(template2) {
25724
25983
  preserveLineEndings: true
25725
25984
  });
25726
25985
  if (parsed.errors && parsed.errors.length > 0) {
25727
- return null;
25986
+ const errors = parsed.errors.map((e) => ({ type: "parse", error: e }));
25987
+ return { tree: void 0, errors };
25728
25988
  }
25729
25989
  } catch (e) {
25730
- return null;
25990
+ return { tree: void 0, errors: [{ type: "parse", error: e }] };
25731
25991
  }
25732
- return parsed;
25992
+ return { tree: parsed, errors: [] };
25993
+ }
25994
+ function validateMigratedTemplate(migrated, fileName) {
25995
+ const parsed = parseTemplate2(migrated);
25996
+ let errors = [];
25997
+ if (parsed.errors.length > 0) {
25998
+ errors.push({
25999
+ type: "parse",
26000
+ error: new Error(`The migration resulted in invalid HTML for ${fileName}. Please check the template for valid HTML structures and run the migration again.`)
26001
+ });
26002
+ }
26003
+ if (parsed.tree) {
26004
+ const i18nError = validateI18nStructure(parsed.tree, fileName);
26005
+ if (i18nError !== null) {
26006
+ errors.push({ type: "i18n", error: i18nError });
26007
+ }
26008
+ }
26009
+ return errors;
26010
+ }
26011
+ function validateI18nStructure(parsed, fileName) {
26012
+ const visitor = new i18nCollector();
26013
+ visitAll2(visitor, parsed.rootNodes);
26014
+ const parents = visitor.elements.filter((el) => el.children.length > 0);
26015
+ for (const p of parents) {
26016
+ for (const el of visitor.elements) {
26017
+ if (el === p)
26018
+ continue;
26019
+ if (isChildOf(p, el)) {
26020
+ return new Error(`i18n Nesting error: The migration would result in invalid i18n nesting for ${fileName}. Element with i18n attribute "${p.name}" would result having a child of element with i18n attribute "${el.name}". Please fix and re-run the migration.`);
26021
+ }
26022
+ }
26023
+ }
26024
+ return null;
26025
+ }
26026
+ function isChildOf(parent, el) {
26027
+ return parent.sourceSpan.start.offset < el.sourceSpan.start.offset && parent.sourceSpan.end.offset > el.sourceSpan.end.offset;
25733
26028
  }
25734
26029
  function calculateNesting(visitor, hasLineBreaks2) {
25735
26030
  let nestedQueue = [];
@@ -25766,9 +26061,9 @@ function reduceNestingOffset(el, nestLevel, offset, postOffsets) {
25766
26061
  function getTemplates(template2) {
25767
26062
  var _a2;
25768
26063
  const parsed = parseTemplate2(template2);
25769
- if (parsed !== null) {
26064
+ if (parsed.tree !== void 0) {
25770
26065
  const visitor = new TemplateCollector();
25771
- visitAll2(visitor, parsed.rootNodes);
26066
+ visitAll2(visitor, parsed.tree.rootNodes);
25772
26067
  for (let [key, tmpl] of visitor.templates) {
25773
26068
  const escapeKey = escapeRegExp(key.slice(1));
25774
26069
  const regex = new RegExp(`[^a-zA-Z0-9-<(']${escapeKey}\\W`, "gm");
@@ -25821,7 +26116,7 @@ function processNgTemplates(template2) {
25821
26116
  template2 = template2.replace(replaceRegex, t.children);
25822
26117
  }
25823
26118
  if (t.count === matches.length + 1 && safeToRemove) {
25824
- template2 = template2.replace(t.contents, "");
26119
+ template2 = template2.replace(t.contents, `${startMarker}${endMarker}`);
25825
26120
  }
25826
26121
  updateTemplates(template2, templates);
25827
26122
  }
@@ -25835,30 +26130,29 @@ function processNgTemplates(template2) {
25835
26130
  function replaceRemainingPlaceholders(template2) {
25836
26131
  const replaceRegex = new RegExp(`\u03B8.*\u03B4`, "g");
25837
26132
  const placeholders = [...template2.matchAll(replaceRegex)];
25838
- let migrated = template2;
25839
26133
  for (let ph of placeholders) {
25840
26134
  const placeholder = ph[0];
25841
26135
  const name = placeholder.slice(1, placeholder.length - 1);
25842
- migrated = template2.replace(placeholder, `<ng-template [ngTemplateOutlet]="${name}"></ng-template>`);
26136
+ template2 = template2.replace(placeholder, `<ng-template [ngTemplateOutlet]="${name}"></ng-template>`);
25843
26137
  }
25844
- return migrated;
26138
+ return template2;
25845
26139
  }
25846
26140
  function canRemoveCommonModule(template2) {
25847
26141
  const parsed = parseTemplate2(template2);
25848
26142
  let removeCommonModule = false;
25849
- if (parsed !== null) {
26143
+ if (parsed.tree !== void 0) {
25850
26144
  const visitor = new CommonCollector();
25851
- visitAll2(visitor, parsed.rootNodes);
26145
+ visitAll2(visitor, parsed.tree.rootNodes);
25852
26146
  removeCommonModule = visitor.count === 0;
25853
26147
  }
25854
26148
  return removeCommonModule;
25855
26149
  }
25856
- function removeImports(template2, node, removeCommonModule) {
25857
- if (template2.startsWith("imports") && import_typescript5.default.isPropertyAssignment(node)) {
25858
- const updatedImport = updateClassImports(node, removeCommonModule);
26150
+ function removeImports(template2, node, file) {
26151
+ if (template2.startsWith("imports") && import_typescript6.default.isPropertyAssignment(node)) {
26152
+ const updatedImport = updateClassImports(node, file.removeCommonModule);
25859
26153
  return updatedImport != null ? updatedImport : template2;
25860
- } else if (import_typescript5.default.isImportDeclaration(node) && checkIfShouldChange(node, removeCommonModule)) {
25861
- return updateImportDeclaration(node, removeCommonModule);
26154
+ } else if (import_typescript6.default.isImportDeclaration(node) && checkIfShouldChange(node, file)) {
26155
+ return updateImportDeclaration(node, file.removeCommonModule);
25862
26156
  }
25863
26157
  return template2;
25864
26158
  }
@@ -25869,10 +26163,21 @@ function getOriginals(etm, tmpl, offset) {
25869
26163
  const start2 = tmpl.slice(etm.el.sourceSpan.start.offset - offset, etm.el.children[0].sourceSpan.start.offset - offset);
25870
26164
  const end = tmpl.slice(etm.el.children[etm.el.children.length - 1].sourceSpan.end.offset - offset, etm.el.sourceSpan.end.offset - offset);
25871
26165
  const childLength = childEnd - childStart;
25872
- return { start: start2, end, childLength };
26166
+ return {
26167
+ start: start2,
26168
+ end,
26169
+ childLength,
26170
+ children: getOriginalChildren(etm.el.children, tmpl, offset),
26171
+ childNodes: etm.el.children
26172
+ };
25873
26173
  }
25874
26174
  const start = tmpl.slice(etm.el.sourceSpan.start.offset - offset, etm.el.sourceSpan.end.offset - offset);
25875
- return { start, end: "", childLength: 0 };
26175
+ return { start, end: "", childLength: 0, children: [], childNodes: [] };
26176
+ }
26177
+ function getOriginalChildren(children, tmpl, offset) {
26178
+ return children.map((child) => {
26179
+ return tmpl.slice(child.sourceSpan.start.offset - offset, child.sourceSpan.end.offset - offset);
26180
+ });
25876
26181
  }
25877
26182
  function isI18nTemplate(etm, i18nAttr) {
25878
26183
  let attrCount = countAttributes(etm);
@@ -25906,6 +26211,8 @@ function getMainBlock(etm, tmpl, offset) {
25906
26211
  if (etm.hasChildren()) {
25907
26212
  const { childStart: childStart2, childEnd: childEnd2 } = etm.getChildSpan(offset);
25908
26213
  middle2 = tmpl.slice(childStart2, childEnd2);
26214
+ } else {
26215
+ middle2 = startMarker + endMarker;
25909
26216
  }
25910
26217
  return { start: "", middle: middle2, end: "" };
25911
26218
  } else if (isI18nTemplate(etm, i18nAttr)) {
@@ -25924,12 +26231,36 @@ function getMainBlock(etm, tmpl, offset) {
25924
26231
  }
25925
26232
  return { start, middle, end };
25926
26233
  }
26234
+ function generateI18nMarkers(tmpl) {
26235
+ let parsed = parseTemplate2(tmpl);
26236
+ if (parsed.tree !== void 0) {
26237
+ const visitor = new i18nCollector();
26238
+ visitAll2(visitor, parsed.tree.rootNodes);
26239
+ for (const [ix, el] of visitor.elements.entries()) {
26240
+ const offset = ix * 2;
26241
+ if (el.children.length > 0) {
26242
+ tmpl = addI18nMarkers(tmpl, el, offset);
26243
+ }
26244
+ }
26245
+ }
26246
+ return tmpl;
26247
+ }
26248
+ function addI18nMarkers(tmpl, el, offset) {
26249
+ const startPos = el.children[0].sourceSpan.start.offset + offset;
26250
+ const endPos = el.children[el.children.length - 1].sourceSpan.end.offset + offset;
26251
+ return tmpl.slice(0, startPos) + startI18nMarker + tmpl.slice(startPos, endPos) + endI18nMarker + tmpl.slice(endPos);
26252
+ }
25927
26253
  var selfClosingList = "input|br|img|base|wbr|area|col|embed|hr|link|meta|param|source|track";
25928
26254
  function formatTemplate(tmpl, templateType) {
25929
26255
  if (tmpl.indexOf("\n") > -1) {
26256
+ tmpl = generateI18nMarkers(tmpl);
25930
26257
  let openSelfClosingEl = false;
25931
26258
  const openBlockRegex = /^\s*\@(if|switch|case|default|for)|^\s*\}\s\@else/;
25932
26259
  const openElRegex = /^\s*<([a-z0-9]+)(?![^>]*\/>)[^>]*>?/;
26260
+ const openAttrDoubleRegex = /="([^"]|\\")*$/;
26261
+ const openAttrSingleRegex = /='([^']|\\')*$/;
26262
+ const closeAttrDoubleRegex = /^\s*([^><]|\\")*"/;
26263
+ const closeAttrSingleRegex = /^\s*([^><]|\\')*'/;
25933
26264
  const selfClosingRegex = new RegExp(`^\\s*<(${selfClosingList}).+\\/?>`);
25934
26265
  const openSelfClosingRegex = new RegExp(`^\\s*<(${selfClosingList})(?![^>]*\\/>)[^>]*$`);
25935
26266
  const closeBlockRegex = /^\s*\}\s*$|^\s*\}\s\@else/;
@@ -25941,8 +26272,22 @@ function formatTemplate(tmpl, templateType) {
25941
26272
  const formatted = [];
25942
26273
  let indent = "";
25943
26274
  let mindent = "";
26275
+ let depth = 0;
26276
+ let i18nDepth = 0;
26277
+ let inMigratedBlock = false;
26278
+ let inI18nBlock = false;
26279
+ let inAttribute = false;
26280
+ let isDoubleQuotes = false;
25944
26281
  for (let [index, line] of lines.entries()) {
25945
- if (line.trim() === "" && index !== 0 && index !== lines.length - 1) {
26282
+ depth += [...line.matchAll(startMarkerRegex)].length - [...line.matchAll(endMarkerRegex)].length;
26283
+ inMigratedBlock = depth > 0;
26284
+ i18nDepth += [...line.matchAll(startI18nMarkerRegex)].length - [...line.matchAll(endI18nMarkerRegex)].length;
26285
+ let lineWasMigrated = false;
26286
+ if (line.match(replaceMarkerRegex)) {
26287
+ line = line.replace(replaceMarkerRegex, "");
26288
+ lineWasMigrated = true;
26289
+ }
26290
+ if (line.trim() === "" && index !== 0 && index !== lines.length - 1 && (inMigratedBlock || lineWasMigrated) && !inI18nBlock && !inAttribute) {
25946
26291
  continue;
25947
26292
  }
25948
26293
  if (templateType === "template" && index <= 1) {
@@ -25952,7 +26297,20 @@ function formatTemplate(tmpl, templateType) {
25952
26297
  if ((closeBlockRegex.test(line) || closeElRegex.test(line) && (!singleLineElRegex.test(line) && !closeMultiLineElRegex.test(line))) && indent !== "") {
25953
26298
  indent = indent.slice(2);
25954
26299
  }
25955
- formatted.push(mindent + indent + line.trim());
26300
+ const isOpenDoubleAttr = openAttrDoubleRegex.test(line);
26301
+ const isOpenSingleAttr = openAttrSingleRegex.test(line);
26302
+ if (!inAttribute && isOpenDoubleAttr) {
26303
+ inAttribute = true;
26304
+ isDoubleQuotes = true;
26305
+ } else if (!inAttribute && isOpenSingleAttr) {
26306
+ inAttribute = true;
26307
+ isDoubleQuotes = false;
26308
+ }
26309
+ const newLine = inI18nBlock || inAttribute ? line : mindent + (line.trim() !== "" ? indent : "") + line.trim();
26310
+ formatted.push(newLine);
26311
+ if (!isOpenDoubleAttr && !isOpenSingleAttr && (inAttribute && isDoubleQuotes && closeAttrDoubleRegex.test(line) || inAttribute && !isDoubleQuotes && closeAttrSingleRegex.test(line))) {
26312
+ inAttribute = false;
26313
+ }
25956
26314
  if (closeMultiLineElRegex.test(line)) {
25957
26315
  indent = indent.slice(2);
25958
26316
  if (openSelfClosingEl) {
@@ -25970,6 +26328,7 @@ function formatTemplate(tmpl, templateType) {
25970
26328
  openSelfClosingEl = true;
25971
26329
  indent += " ";
25972
26330
  }
26331
+ inI18nBlock = i18nDepth > 0;
25973
26332
  }
25974
26333
  tmpl = formatted.join("\n");
25975
26334
  }
@@ -25977,14 +26336,14 @@ function formatTemplate(tmpl, templateType) {
25977
26336
  }
25978
26337
  function forEachClass(sourceFile, callback) {
25979
26338
  sourceFile.forEachChild(function walk(node) {
25980
- if (import_typescript5.default.isClassDeclaration(node) || import_typescript5.default.isImportDeclaration(node)) {
26339
+ if (import_typescript6.default.isClassDeclaration(node) || import_typescript6.default.isImportDeclaration(node)) {
25981
26340
  callback(node);
25982
26341
  }
25983
26342
  node.forEachChild(walk);
25984
26343
  });
25985
26344
  }
25986
26345
 
25987
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/cases.mjs
26346
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/cases.mjs
25988
26347
  var boundcase = "[ngSwitchCase]";
25989
26348
  var switchcase = "*ngSwitchCase";
25990
26349
  var nakedcase = "ngSwitchCase";
@@ -26000,12 +26359,12 @@ var cases = [
26000
26359
  function migrateCase(template2) {
26001
26360
  let errors = [];
26002
26361
  let parsed = parseTemplate2(template2);
26003
- if (parsed === null) {
26362
+ if (parsed.tree === void 0) {
26004
26363
  return { migrated: template2, errors, changed: false };
26005
26364
  }
26006
26365
  let result = template2;
26007
26366
  const visitor = new ElementCollector(cases);
26008
- visitAll2(visitor, parsed.rootNodes);
26367
+ visitAll2(visitor, parsed.tree.rootNodes);
26009
26368
  calculateNesting(visitor, hasLineBreaks(template2));
26010
26369
  let offset = 0;
26011
26370
  let nestLevel = -1;
@@ -26040,8 +26399,8 @@ function migrateNgSwitchCase(etm, tmpl, offset) {
26040
26399
  const condition = etm.attr.value;
26041
26400
  const originals = getOriginals(etm, tmpl, offset);
26042
26401
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26043
- const startBlock = `${leadingSpace}@case (${condition}) {${leadingSpace}${lbString}${start}`;
26044
- const endBlock = `${end}${lbString}${leadingSpace}}`;
26402
+ const startBlock = `${startMarker}${leadingSpace}@case (${condition}) {${leadingSpace}${lbString}${start}`;
26403
+ const endBlock = `${end}${lbString}${leadingSpace}}${endMarker}`;
26045
26404
  const defaultBlock = startBlock + middle + endBlock;
26046
26405
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
26047
26406
  const pre = originals.start.length - startBlock.length;
@@ -26053,8 +26412,8 @@ function migrateNgSwitchDefault(etm, tmpl, offset) {
26053
26412
  const leadingSpace = etm.hasLineBreaks ? "" : " ";
26054
26413
  const originals = getOriginals(etm, tmpl, offset);
26055
26414
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26056
- const startBlock = `${leadingSpace}@default {${leadingSpace}${lbString}${start}`;
26057
- const endBlock = `${end}${lbString}${leadingSpace}}`;
26415
+ const startBlock = `${startMarker}${leadingSpace}@default {${leadingSpace}${lbString}${start}`;
26416
+ const endBlock = `${end}${lbString}${leadingSpace}}${endMarker}`;
26058
26417
  const defaultBlock = startBlock + middle + endBlock;
26059
26418
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
26060
26419
  const pre = originals.start.length - startBlock.length;
@@ -26062,7 +26421,7 @@ function migrateNgSwitchDefault(etm, tmpl, offset) {
26062
26421
  return { tmpl: updatedTmpl, offsets: { pre, post } };
26063
26422
  }
26064
26423
 
26065
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/fors.mjs
26424
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/fors.mjs
26066
26425
  var ngfor = "*ngFor";
26067
26426
  var nakedngfor2 = "ngFor";
26068
26427
  var fors = [
@@ -26081,12 +26440,12 @@ var stringPairs = /* @__PURE__ */ new Map([
26081
26440
  function migrateFor(template2) {
26082
26441
  let errors = [];
26083
26442
  let parsed = parseTemplate2(template2);
26084
- if (parsed === null) {
26443
+ if (parsed.tree === void 0) {
26085
26444
  return { migrated: template2, errors, changed: false };
26086
26445
  }
26087
26446
  let result = template2;
26088
26447
  const visitor = new ElementCollector(fors);
26089
- visitAll2(visitor, parsed.rootNodes);
26448
+ visitAll2(visitor, parsed.tree.rootNodes);
26090
26449
  calculateNesting(visitor, hasLineBreaks(template2));
26091
26450
  let offset = 0;
26092
26451
  let nestLevel = -1;
@@ -26157,8 +26516,8 @@ function migrateStandardNgFor(etm, tmpl, offset) {
26157
26516
  trackBy = trackBy.replace("$index", aliasedIndex);
26158
26517
  }
26159
26518
  const aliasStr = aliases.length > 0 ? `;${aliases.join(";")}` : "";
26160
- let startBlock = `@for (${condition}; track ${trackBy}${aliasStr}) {${lbString}`;
26161
- let endBlock = `${lbString}}`;
26519
+ let startBlock = `${startMarker}@for (${condition}; track ${trackBy}${aliasStr}) {${lbString}`;
26520
+ let endBlock = `${lbString}}${endMarker}`;
26162
26521
  let forBlock = "";
26163
26522
  if (tmplPlaceholder !== "") {
26164
26523
  startBlock = startBlock + tmplPlaceholder;
@@ -26194,10 +26553,10 @@ function migrateBoundNgFor(etm, tmpl, offset) {
26194
26553
  trackBy = `${forAttrs.trackBy.trim()}(${aliasedIndex}, ${aliasAttrs.item})`;
26195
26554
  }
26196
26555
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26197
- const startBlock = `@for (${condition}; track ${trackBy}${aliasStr}) {
26556
+ const startBlock = `${startMarker}@for (${condition}; track ${trackBy}${aliasStr}) {
26198
26557
  ${start}`;
26199
26558
  const endBlock = `${end}
26200
- }`;
26559
+ }${endMarker}`;
26201
26560
  const forBlock = startBlock + middle + endBlock;
26202
26561
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + forBlock + tmpl.slice(etm.end(offset));
26203
26562
  const pre = originals.start.length - startBlock.length;
@@ -26218,10 +26577,10 @@ function getNgForParts(expression) {
26218
26577
  current = "";
26219
26578
  continue;
26220
26579
  }
26221
- if (stringPairs.has(char)) {
26222
- stringStack.push(stringPairs.get(char));
26223
- } else if (stringStack.length > 0 && stringStack[stringStack.length - 1] === char) {
26580
+ if (stringStack.length > 0 && stringStack[stringStack.length - 1] === char) {
26224
26581
  stringStack.pop();
26582
+ } else if (stringPairs.has(char)) {
26583
+ stringStack.push(stringPairs.get(char));
26225
26584
  }
26226
26585
  if (commaSeparatedSyntax.has(char)) {
26227
26586
  commaSeparatedStack.push(commaSeparatedSyntax.get(char));
@@ -26236,7 +26595,7 @@ function getNgForParts(expression) {
26236
26595
  return parts;
26237
26596
  }
26238
26597
 
26239
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/ifs.mjs
26598
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/ifs.mjs
26240
26599
  var ngif = "*ngIf";
26241
26600
  var boundngif = "[ngIf]";
26242
26601
  var nakedngif = "ngIf";
@@ -26248,12 +26607,12 @@ var ifs = [
26248
26607
  function migrateIf(template2) {
26249
26608
  let errors = [];
26250
26609
  let parsed = parseTemplate2(template2);
26251
- if (parsed === null) {
26610
+ if (parsed.tree === void 0) {
26252
26611
  return { migrated: template2, errors, changed: false };
26253
26612
  }
26254
26613
  let result = template2;
26255
26614
  const visitor = new ElementCollector(ifs);
26256
- visitAll2(visitor, parsed.rootNodes);
26615
+ visitAll2(visitor, parsed.tree.rootNodes);
26257
26616
  calculateNesting(visitor, hasLineBreaks(template2));
26258
26617
  let offset = 0;
26259
26618
  let nestLevel = -1;
@@ -26303,8 +26662,8 @@ function buildIfBlock(etm, tmpl, offset) {
26303
26662
  }
26304
26663
  const originals = getOriginals(etm, tmpl, offset);
26305
26664
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26306
- const startBlock = `@if (${condition}) {${lbString}${start}`;
26307
- const endBlock = `${end}${lbString}}`;
26665
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}${start}`;
26666
+ const endBlock = `${end}${lbString}}${endMarker}`;
26308
26667
  const ifBlock = startBlock + middle + endBlock;
26309
26668
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + ifBlock + tmpl.slice(etm.end(offset));
26310
26669
  const pre = originals.start.length - startBlock.length;
@@ -26328,9 +26687,9 @@ function buildBoundIfElseBlock(etm, tmpl, offset) {
26328
26687
  } else if (aliases.length === 1) {
26329
26688
  condition += `; as ${aliases[0]}`;
26330
26689
  }
26331
- const elsePlaceholder = `\u03B8${etm.elseAttr.value}\u03B4`;
26690
+ const elsePlaceholder = `\u03B8${etm.elseAttr.value.trim()}\u03B4`;
26332
26691
  if (etm.thenAttr !== void 0) {
26333
- const thenPlaceholder = `\u03B8${etm.thenAttr.value}\u03B4`;
26692
+ const thenPlaceholder = `\u03B8${etm.thenAttr.value.trim()}\u03B4`;
26334
26693
  return buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceholder, offset);
26335
26694
  }
26336
26695
  return buildIfElseBlock(etm, tmpl, condition, elsePlaceholder, offset);
@@ -26339,9 +26698,9 @@ function buildIfElseBlock(etm, tmpl, condition, elsePlaceholder, offset) {
26339
26698
  const lbString = etm.hasLineBreaks ? "\n" : "";
26340
26699
  const originals = getOriginals(etm, tmpl, offset);
26341
26700
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26342
- const startBlock = `@if (${condition}) {${lbString}${start}`;
26701
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}${start}`;
26343
26702
  const elseBlock = `${end}${lbString}} @else {${lbString}`;
26344
- const postBlock = elseBlock + elsePlaceholder + `${lbString}}`;
26703
+ const postBlock = elseBlock + elsePlaceholder + `${lbString}}${endMarker}`;
26345
26704
  const ifElseBlock = startBlock + middle + postBlock;
26346
26705
  const tmplStart = tmpl.slice(0, etm.start(offset));
26347
26706
  const tmplEnd = tmpl.slice(etm.end(offset));
@@ -26364,9 +26723,9 @@ function buildStandardIfThenBlock(etm, tmpl, thenString, offset) {
26364
26723
  function buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceholder, offset) {
26365
26724
  const lbString = etm.hasLineBreaks ? "\n" : "";
26366
26725
  const originals = getOriginals(etm, tmpl, offset);
26367
- const startBlock = `@if (${condition}) {${lbString}`;
26726
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}`;
26368
26727
  const elseBlock = `${lbString}} @else {${lbString}`;
26369
- const postBlock = thenPlaceholder + elseBlock + elsePlaceholder + `${lbString}}`;
26728
+ const postBlock = thenPlaceholder + elseBlock + elsePlaceholder + `${lbString}}${endMarker}`;
26370
26729
  const ifThenElseBlock = startBlock + postBlock;
26371
26730
  const tmplStart = tmpl.slice(0, etm.start(offset));
26372
26731
  const tmplEnd = tmpl.slice(etm.end(offset));
@@ -26378,8 +26737,8 @@ function buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceho
26378
26737
  function buildIfThenBlock(etm, tmpl, condition, thenPlaceholder, offset) {
26379
26738
  const lbString = etm.hasLineBreaks ? "\n" : "";
26380
26739
  const originals = getOriginals(etm, tmpl, offset);
26381
- const startBlock = `@if (${condition}) {${lbString}`;
26382
- const postBlock = thenPlaceholder + `${lbString}}`;
26740
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}`;
26741
+ const postBlock = thenPlaceholder + `${lbString}}${endMarker}`;
26383
26742
  const ifThenBlock = startBlock + postBlock;
26384
26743
  const tmplStart = tmpl.slice(0, etm.start(offset));
26385
26744
  const tmplEnd = tmpl.slice(etm.end(offset));
@@ -26389,7 +26748,7 @@ function buildIfThenBlock(etm, tmpl, condition, thenPlaceholder, offset) {
26389
26748
  return { tmpl: updatedTmpl, offsets: { pre, post } };
26390
26749
  }
26391
26750
 
26392
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/switches.mjs
26751
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/switches.mjs
26393
26752
  var ngswitch = "[ngSwitch]";
26394
26753
  var switches = [
26395
26754
  ngswitch
@@ -26397,12 +26756,12 @@ var switches = [
26397
26756
  function migrateSwitch(template2) {
26398
26757
  let errors = [];
26399
26758
  let parsed = parseTemplate2(template2);
26400
- if (parsed === null) {
26759
+ if (parsed.tree === void 0) {
26401
26760
  return { migrated: template2, errors, changed: false };
26402
26761
  }
26403
26762
  let result = template2;
26404
26763
  const visitor = new ElementCollector(switches);
26405
- visitAll2(visitor, parsed.rootNodes);
26764
+ visitAll2(visitor, parsed.tree.rootNodes);
26406
26765
  calculateNesting(visitor, hasLineBreaks(template2));
26407
26766
  let offset = 0;
26408
26767
  let nestLevel = -1;
@@ -26425,13 +26784,31 @@ function migrateSwitch(template2) {
26425
26784
  const changed = visitor.elements.length > 0;
26426
26785
  return { migrated: result, errors, changed };
26427
26786
  }
26787
+ function assertValidSwitchStructure(children) {
26788
+ for (const child of children) {
26789
+ if (child instanceof Text4 && child.value.trim() !== "") {
26790
+ throw new Error(`Text node: "${child.value}" would result in invalid migrated @switch block structure. @switch can only have @case or @default as children.`);
26791
+ } else if (child instanceof Element2) {
26792
+ let hasCase = false;
26793
+ for (const attr of child.attrs) {
26794
+ if (cases.includes(attr.name)) {
26795
+ hasCase = true;
26796
+ }
26797
+ }
26798
+ if (!hasCase) {
26799
+ throw new Error(`Element node: "${child.name}" would result in invalid migrated @switch block structure. @switch can only have @case or @default as children.`);
26800
+ }
26801
+ }
26802
+ }
26803
+ }
26428
26804
  function migrateNgSwitch(etm, tmpl, offset) {
26429
26805
  const lbString = etm.hasLineBreaks ? "\n" : "";
26430
26806
  const condition = etm.attr.value;
26431
26807
  const originals = getOriginals(etm, tmpl, offset);
26808
+ assertValidSwitchStructure(originals.childNodes);
26432
26809
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26433
- const startBlock = `${start}${lbString}@switch (${condition}) {`;
26434
- const endBlock = `}${lbString}${end}`;
26810
+ const startBlock = `${startMarker}${start}${lbString}@switch (${condition}) {`;
26811
+ const endBlock = `}${lbString}${end}${endMarker}`;
26435
26812
  const switchBlock = startBlock + middle + endBlock;
26436
26813
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + switchBlock + tmpl.slice(etm.end(offset));
26437
26814
  const pre = originals.start.length - startBlock.length;
@@ -26439,7 +26816,7 @@ function migrateNgSwitch(etm, tmpl, offset) {
26439
26816
  return { tmpl: updatedTmpl, offsets: { pre, post } };
26440
26817
  }
26441
26818
 
26442
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/migration.mjs
26819
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/migration.mjs
26443
26820
  function migrateTemplate(template2, templateType, node, file, format = true, analyzedFiles) {
26444
26821
  let errors = [];
26445
26822
  let migrated = template2;
@@ -26447,6 +26824,9 @@ function migrateTemplate(template2, templateType, node, file, format = true, ana
26447
26824
  const ifResult = migrateIf(template2);
26448
26825
  const forResult = migrateFor(ifResult.migrated);
26449
26826
  const switchResult = migrateSwitch(forResult.migrated);
26827
+ if (switchResult.errors.length > 0) {
26828
+ return { migrated: template2, errors: switchResult.errors };
26829
+ }
26450
26830
  const caseResult = migrateCase(switchResult.migrated);
26451
26831
  const templateResult = processNgTemplates(caseResult.migrated);
26452
26832
  if (templateResult.err !== void 0) {
@@ -26454,27 +26834,40 @@ function migrateTemplate(template2, templateType, node, file, format = true, ana
26454
26834
  }
26455
26835
  migrated = templateResult.migrated;
26456
26836
  const changed = ifResult.changed || forResult.changed || switchResult.changed || caseResult.changed;
26837
+ if (changed) {
26838
+ const errors2 = validateMigratedTemplate(migrated, file.sourceFile.fileName);
26839
+ if (errors2.length > 0) {
26840
+ return { migrated: template2, errors: errors2 };
26841
+ }
26842
+ }
26457
26843
  if (format && changed) {
26458
26844
  migrated = formatTemplate(migrated, templateType);
26459
26845
  }
26846
+ const markerRegex = new RegExp(`${startMarker}|${endMarker}|${startI18nMarker}|${endI18nMarker}`, "gm");
26847
+ migrated = migrated.replace(markerRegex, "");
26460
26848
  file.removeCommonModule = canRemoveCommonModule(template2);
26461
- if (templateType === "templateUrl" && analyzedFiles !== null && analyzedFiles.has(file.sourceFilePath)) {
26462
- const componentFile = analyzedFiles.get(file.sourceFilePath);
26849
+ file.canRemoveImports = true;
26850
+ if (templateType === "templateUrl" && analyzedFiles !== null && analyzedFiles.has(file.sourceFile.fileName)) {
26851
+ const componentFile = analyzedFiles.get(file.sourceFile.fileName);
26852
+ componentFile.getSortedRanges();
26463
26853
  componentFile.removeCommonModule = file.removeCommonModule;
26854
+ componentFile.canRemoveImports = file.canRemoveImports;
26855
+ componentFile.verifyCanRemoveImports();
26464
26856
  }
26857
+ file.verifyCanRemoveImports();
26465
26858
  errors = [
26466
26859
  ...ifResult.errors,
26467
26860
  ...forResult.errors,
26468
26861
  ...switchResult.errors,
26469
26862
  ...caseResult.errors
26470
26863
  ];
26471
- } else {
26472
- migrated = removeImports(template2, node, file.removeCommonModule);
26864
+ } else if (file.canRemoveImports) {
26865
+ migrated = removeImports(template2, node, file);
26473
26866
  }
26474
26867
  return { migrated, errors };
26475
26868
  }
26476
26869
 
26477
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/index.mjs
26870
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/index.mjs
26478
26871
  function control_flow_migration_default(options) {
26479
26872
  return (tree, context) => __async(this, null, function* () {
26480
26873
  const basePath = process.cwd();