@angular/core 17.1.0-next.3 → 17.1.0-next.5

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 (79) 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/authoring/input.mjs +41 -0
  9. package/esm2022/src/authoring/input_signal.mjs +10 -0
  10. package/esm2022/src/authoring/input_type_checking.mjs +9 -0
  11. package/esm2022/src/authoring.mjs +12 -0
  12. package/esm2022/src/change_detection/flags.mjs +16 -0
  13. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +164 -0
  14. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +13 -0
  15. package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
  16. package/esm2022/src/core.mjs +15 -7
  17. package/esm2022/src/core_private_export.mjs +8 -4
  18. package/esm2022/src/core_reactivity_export_internal.mjs +2 -2
  19. package/esm2022/src/core_render3_private_export.mjs +2 -2
  20. package/esm2022/src/error_handler.mjs +15 -1
  21. package/esm2022/src/event_emitter.mjs +1 -2
  22. package/esm2022/src/hydration/annotate.mjs +1 -1
  23. package/esm2022/src/hydration/api.mjs +2 -2
  24. package/esm2022/src/hydration/cleanup.mjs +1 -1
  25. package/esm2022/src/image_performance_warning.mjs +2 -2
  26. package/esm2022/src/linker/query_list.mjs +8 -6
  27. package/esm2022/src/metadata/do_bootstrap.mjs +1 -1
  28. package/esm2022/src/pending_tasks.mjs +57 -0
  29. package/esm2022/src/platform/platform.mjs +135 -0
  30. package/esm2022/src/platform/platform_core_providers.mjs +15 -0
  31. package/esm2022/src/platform/platform_ref.mjs +179 -0
  32. package/esm2022/src/render3/after_render_hooks.mjs +2 -2
  33. package/esm2022/src/render3/component_ref.mjs +13 -9
  34. package/esm2022/src/render3/instructions/change_detection.mjs +2 -4
  35. package/esm2022/src/render3/instructions/control_flow.mjs +5 -3
  36. package/esm2022/src/render3/instructions/mark_view_dirty.mjs +3 -2
  37. package/esm2022/src/render3/instructions/shared.mjs +3 -2
  38. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  39. package/esm2022/src/render3/interfaces/public_definitions.mjs +1 -1
  40. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  41. package/esm2022/src/render3/list_reconciliation.mjs +58 -24
  42. package/esm2022/src/render3/util/change_detection_utils.mjs +3 -1
  43. package/esm2022/src/render3/util/misc_utils.mjs +2 -2
  44. package/esm2022/src/render3/util/view_utils.mjs +18 -5
  45. package/esm2022/src/render3/view_ref.mjs +8 -1
  46. package/esm2022/src/transfer_state.mjs +2 -2
  47. package/esm2022/src/util/performance.mjs +2 -2
  48. package/esm2022/src/version.mjs +6 -5
  49. package/esm2022/src/zone/ng_zone.mjs +10 -61
  50. package/esm2022/testing/src/component_fixture.mjs +20 -36
  51. package/esm2022/testing/src/logger.mjs +3 -3
  52. package/esm2022/testing/src/test_bed.mjs +5 -6
  53. package/fesm2022/core.mjs +1446 -1336
  54. package/fesm2022/core.mjs.map +1 -1
  55. package/fesm2022/primitives/signals.mjs +2 -9
  56. package/fesm2022/primitives/signals.mjs.map +1 -1
  57. package/fesm2022/rxjs-interop.mjs +1 -1
  58. package/fesm2022/testing.mjs +46 -64
  59. package/fesm2022/testing.mjs.map +1 -1
  60. package/index.d.ts +196 -43
  61. package/package.json +1 -1
  62. package/primitives/signals/index.d.ts +1 -1
  63. package/rxjs-interop/index.d.ts +1 -1
  64. package/schematics/migrations/block-template-entities/bundle.js +1019 -745
  65. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  66. package/schematics/migrations/compiler-options/bundle.js +13 -13
  67. package/schematics/migrations/transfer-state/bundle.js +13 -13
  68. package/schematics/ng-generate/control-flow-migration/bundle.js +1331 -854
  69. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  70. package/schematics/ng-generate/standalone-migration/bundle.js +2329 -1757
  71. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  72. package/testing/index.d.ts +6 -10
  73. package/esm2022/src/application_config.mjs +0 -21
  74. package/esm2022/src/application_init.mjs +0 -188
  75. package/esm2022/src/application_module.mjs +0 -29
  76. package/esm2022/src/application_ref.mjs +0 -997
  77. package/esm2022/src/application_tokens.mjs +0 -121
  78. package/esm2022/src/initial_render_pending_tasks.mjs +0 -49
  79. 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
  };
@@ -2517,8 +2517,14 @@ var Identifiers = _Identifiers;
2517
2517
  (() => {
2518
2518
  _Identifiers.validateIframeAttribute = { name: "\u0275\u0275validateIframeAttribute", moduleName: CORE };
2519
2519
  })();
2520
+ (() => {
2521
+ _Identifiers.InputSignalBrandWriteType = { name: "\u0275INPUT_SIGNAL_BRAND_WRITE_TYPE", moduleName: CORE };
2522
+ })();
2523
+ (() => {
2524
+ _Identifiers.UnwrapDirectiveSignalInputs = { name: "\u0275UnwrapDirectiveSignalInputs", moduleName: CORE };
2525
+ })();
2520
2526
 
2521
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/util.mjs
2527
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/util.mjs
2522
2528
  var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
2523
2529
  function dashCaseToCamelCase(input) {
2524
2530
  return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
@@ -2606,7 +2612,7 @@ function partitionArray(arr, conditionFn) {
2606
2612
  return [truthy, falsy];
2607
2613
  }
2608
2614
 
2609
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/source_map.mjs
2615
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/source_map.mjs
2610
2616
  var VERSION = 3;
2611
2617
  var JS_B64_PREFIX = "# sourceMappingURL=data:application/json;base64,";
2612
2618
  var SourceMapGenerator = class {
@@ -2735,7 +2741,7 @@ function toBase64Digit(value) {
2735
2741
  return B64_DIGITS[value];
2736
2742
  }
2737
2743
 
2738
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/abstract_emitter.mjs
2744
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/abstract_emitter.mjs
2739
2745
  var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
2740
2746
  var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
2741
2747
  var _INDENT_WITH = " ";
@@ -3220,7 +3226,7 @@ function _createIndent(count) {
3220
3226
  return res;
3221
3227
  }
3222
3228
 
3223
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/util.mjs
3229
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/util.mjs
3224
3230
  function typeWithParameters(type, numParams) {
3225
3231
  if (numParams === 0) {
3226
3232
  return expressionType(type);
@@ -3285,7 +3291,7 @@ function generateForwardRef(expr) {
3285
3291
  return importExpr(Identifiers.forwardRef).callFn([arrowFn([], expr)]);
3286
3292
  }
3287
3293
 
3288
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_factory.mjs
3294
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_factory.mjs
3289
3295
  var R3FactoryDelegateType;
3290
3296
  (function(R3FactoryDelegateType2) {
3291
3297
  R3FactoryDelegateType2[R3FactoryDelegateType2["Class"] = 0] = "Class";
@@ -3430,20 +3436,24 @@ function getInjectFn(target) {
3430
3436
  }
3431
3437
  }
3432
3438
 
3433
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
3439
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
3434
3440
  var TagContentType;
3435
3441
  (function(TagContentType2) {
3436
3442
  TagContentType2[TagContentType2["RAW_TEXT"] = 0] = "RAW_TEXT";
3437
3443
  TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
3438
3444
  TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
3439
3445
  })(TagContentType || (TagContentType = {}));
3440
- function splitNsName(elementName) {
3446
+ function splitNsName(elementName, fatal = true) {
3441
3447
  if (elementName[0] != ":") {
3442
3448
  return [null, elementName];
3443
3449
  }
3444
3450
  const colonIndex = elementName.indexOf(":", 1);
3445
3451
  if (colonIndex === -1) {
3446
- throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
3452
+ if (fatal) {
3453
+ throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
3454
+ } else {
3455
+ return [null, elementName];
3456
+ }
3447
3457
  }
3448
3458
  return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
3449
3459
  }
@@ -3463,7 +3473,7 @@ function mergeNsAndName(prefix, localName) {
3463
3473
  return prefix ? `:${prefix}:${localName}` : localName;
3464
3474
  }
3465
3475
 
3466
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_ast.mjs
3476
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_ast.mjs
3467
3477
  var Comment = class {
3468
3478
  constructor(value, sourceSpan) {
3469
3479
  this.value = value;
@@ -3844,7 +3854,7 @@ function visitAll(visitor, nodes) {
3844
3854
  return result;
3845
3855
  }
3846
3856
 
3847
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/i18n_ast.mjs
3857
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/i18n_ast.mjs
3848
3858
  var Message = class {
3849
3859
  constructor(nodes, placeholders, placeholderToMessage, meaning, description, customId) {
3850
3860
  this.nodes = nodes;
@@ -3950,28 +3960,6 @@ var BlockPlaceholder = class {
3950
3960
  return visitor.visitBlockPlaceholder(this, context);
3951
3961
  }
3952
3962
  };
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
3963
  function serializeMessage(messageNodes) {
3976
3964
  const visitor = new LocalizeMessageStringVisitor();
3977
3965
  const str = messageNodes.map((n) => n.visit(visitor)).join("");
@@ -4004,7 +3992,7 @@ var LocalizeMessageStringVisitor = class {
4004
3992
  }
4005
3993
  };
4006
3994
 
4007
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
3995
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
4008
3996
  var _Visitor = class {
4009
3997
  visitTag(tag) {
4010
3998
  const strAttrs = this._serializeAttributes(tag.attrs);
@@ -4032,12 +4020,12 @@ ${doctype.dtd}
4032
4020
  };
4033
4021
  var _visitor = new _Visitor();
4034
4022
 
4035
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/xmb.mjs
4023
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/serializers/xmb.mjs
4036
4024
  function toPublicName(internalName) {
4037
4025
  return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, "_");
4038
4026
  }
4039
4027
 
4040
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/util.mjs
4028
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/util.mjs
4041
4029
  var CLOSURE_TRANSLATION_VAR_PREFIX = "MSG_";
4042
4030
  var TRANSLATION_VAR_PREFIX = "i18n_";
4043
4031
  var I18N_ATTR = "i18n";
@@ -4139,7 +4127,7 @@ function declareI18nVariable(variable2) {
4139
4127
  return new DeclareVarStmt(variable2.name, void 0, INFERRED_TYPE, void 0, variable2.sourceSpan);
4140
4128
  }
4141
4129
 
4142
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/util.mjs
4130
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/util.mjs
4143
4131
  var UNSAFE_OBJECT_KEY_NAME_REGEXP = /[-.]/;
4144
4132
  var TEMPORARY_NAME = "_t";
4145
4133
  var CONTEXT_NAME = "ctx";
@@ -4379,7 +4367,7 @@ function getInstructionStatements(instructions) {
4379
4367
  return statements;
4380
4368
  }
4381
4369
 
4382
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/injectable_compiler_2.mjs
4370
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/injectable_compiler_2.mjs
4383
4371
  function compileInjectable(meta, resolveForwardRefs) {
4384
4372
  let result = null;
4385
4373
  const factoryMeta = {
@@ -4464,7 +4452,7 @@ function createFactoryFunction(type) {
4464
4452
  return arrowFn([new FnParam("t", DYNAMIC_TYPE)], type.prop("\u0275fac").callFn([variable("t")]));
4465
4453
  }
4466
4454
 
4467
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/assertions.mjs
4455
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/assertions.mjs
4468
4456
  var UNUSABLE_INTERPOLATION_REGEXPS = [
4469
4457
  /^\s*$/,
4470
4458
  /[<>]/,
@@ -4486,7 +4474,7 @@ function assertInterpolationSymbols(identifier, value) {
4486
4474
  }
4487
4475
  }
4488
4476
 
4489
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
4477
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
4490
4478
  var InterpolationConfig = class {
4491
4479
  static fromArray(markers) {
4492
4480
  if (!markers) {
@@ -4503,7 +4491,7 @@ var InterpolationConfig = class {
4503
4491
  var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig("{{", "}}");
4504
4492
  var DEFAULT_CONTAINER_BLOCKS = /* @__PURE__ */ new Set(["switch"]);
4505
4493
 
4506
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/chars.mjs
4494
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/chars.mjs
4507
4495
  var $EOF = 0;
4508
4496
  var $BSPACE = 8;
4509
4497
  var $TAB = 9;
@@ -4585,7 +4573,7 @@ function isQuote(code) {
4585
4573
  return code === $SQ || code === $DQ || code === $BT;
4586
4574
  }
4587
4575
 
4588
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/parse_util.mjs
4576
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/parse_util.mjs
4589
4577
  var ParseLocation = class {
4590
4578
  constructor(file, offset, line, col) {
4591
4579
  this.file = file;
@@ -4732,7 +4720,7 @@ function sanitizeIdentifier(name) {
4732
4720
  return name.replace(/\W/g, "_");
4733
4721
  }
4734
4722
 
4735
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/abstract_js_emitter.mjs
4723
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/abstract_js_emitter.mjs
4736
4724
  var makeTemplateObjectPolyfill = '(this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e})';
4737
4725
  var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
4738
4726
  constructor() {
@@ -4825,7 +4813,7 @@ var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
4825
4813
  }
4826
4814
  };
4827
4815
 
4828
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_jit_trusted_types.mjs
4816
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/output_jit_trusted_types.mjs
4829
4817
  var policy;
4830
4818
  function getPolicy() {
4831
4819
  if (policy === void 0) {
@@ -4863,7 +4851,7 @@ function newTrustedFunctionForJIT(...args) {
4863
4851
  return fn2.bind(_global);
4864
4852
  }
4865
4853
 
4866
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_jit.mjs
4854
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/output_jit.mjs
4867
4855
  var JitEvaluator = class {
4868
4856
  evaluateStatements(sourceUrl, statements, refResolver, createSourceMaps) {
4869
4857
  const converter = new JitEmitterVisitor(refResolver);
@@ -4954,7 +4942,7 @@ function isUseStrictStatement(statement) {
4954
4942
  return statement.isEquivalent(literal("use strict").toStmt());
4955
4943
  }
4956
4944
 
4957
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_injector_compiler.mjs
4945
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_injector_compiler.mjs
4958
4946
  function compileInjector(meta) {
4959
4947
  const definitionMap = new DefinitionMap();
4960
4948
  if (meta.providers !== null) {
@@ -4971,7 +4959,7 @@ function createInjectorType(meta) {
4971
4959
  return new ExpressionType(importExpr(Identifiers.InjectorDeclaration, [new ExpressionType(meta.type.type)]));
4972
4960
  }
4973
4961
 
4974
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_jit.mjs
4962
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_jit.mjs
4975
4963
  var R3JitReflector = class {
4976
4964
  constructor(context) {
4977
4965
  this.context = context;
@@ -4987,7 +4975,7 @@ var R3JitReflector = class {
4987
4975
  }
4988
4976
  };
4989
4977
 
4990
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_module_compiler.mjs
4978
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_module_compiler.mjs
4991
4979
  var R3SelectorScopeMode;
4992
4980
  (function(R3SelectorScopeMode2) {
4993
4981
  R3SelectorScopeMode2[R3SelectorScopeMode2["Inline"] = 0] = "Inline";
@@ -5128,7 +5116,7 @@ function tupleOfTypes(types) {
5128
5116
  return types.length > 0 ? expressionType(literalArr(typeofTypes)) : NONE_TYPE;
5129
5117
  }
5130
5118
 
5131
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_pipe_compiler.mjs
5119
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_pipe_compiler.mjs
5132
5120
  function compilePipeFromMetadata(metadata) {
5133
5121
  const definitionMapValues = [];
5134
5122
  definitionMapValues.push({ key: "name", value: literal(metadata.pipeName), quoted: false });
@@ -5149,7 +5137,7 @@ function createPipeType(metadata) {
5149
5137
  ]));
5150
5138
  }
5151
5139
 
5152
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/api.mjs
5140
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/api.mjs
5153
5141
  var R3TemplateDependencyKind;
5154
5142
  (function(R3TemplateDependencyKind2) {
5155
5143
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["Directive"] = 0] = "Directive";
@@ -5157,7 +5145,7 @@ var R3TemplateDependencyKind;
5157
5145
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["NgModule"] = 2] = "NgModule";
5158
5146
  })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
5159
5147
 
5160
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/ast.mjs
5148
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/expression_parser/ast.mjs
5161
5149
  var ParserError = class {
5162
5150
  constructor(message, input, errLocation, ctxLocation) {
5163
5151
  this.input = input;
@@ -5823,7 +5811,7 @@ var BoundElementProperty = class {
5823
5811
  }
5824
5812
  };
5825
5813
 
5826
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/compiler_util/expression_converter.mjs
5814
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/compiler_util/expression_converter.mjs
5827
5815
  var _EventHandlerVars = class {
5828
5816
  };
5829
5817
  var EventHandlerVars = _EventHandlerVars;
@@ -6464,7 +6452,7 @@ var BuiltinFunctionCall = class extends Call {
6464
6452
  }
6465
6453
  };
6466
6454
 
6467
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/dom_security_schema.mjs
6455
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/dom_security_schema.mjs
6468
6456
  var _SECURITY_SCHEMA;
6469
6457
  function SECURITY_SCHEMA() {
6470
6458
  if (!_SECURITY_SCHEMA) {
@@ -6522,7 +6510,7 @@ function isIframeSecuritySensitiveAttr(attrName) {
6522
6510
  return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
6523
6511
  }
6524
6512
 
6525
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/shadow_css.mjs
6513
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/shadow_css.mjs
6526
6514
  var animationKeywords = /* @__PURE__ */ new Set([
6527
6515
  "inherit",
6528
6516
  "initial",
@@ -6993,7 +6981,7 @@ function repeatGroups(groups, multiples) {
6993
6981
  }
6994
6982
  }
6995
6983
 
6996
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/enums.mjs
6984
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/enums.mjs
6997
6985
  var OpKind;
6998
6986
  (function(OpKind2) {
6999
6987
  OpKind2[OpKind2["ListEnd"] = 0] = "ListEnd";
@@ -7039,8 +7027,9 @@ var OpKind;
7039
7027
  OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
7040
7028
  OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
7041
7029
  OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
7042
- OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
7043
- OpKind2[OpKind2["I18nAttributes"] = 44] = "I18nAttributes";
7030
+ OpKind2[OpKind2["IcuPlaceholder"] = 43] = "IcuPlaceholder";
7031
+ OpKind2[OpKind2["I18nContext"] = 44] = "I18nContext";
7032
+ OpKind2[OpKind2["I18nAttributes"] = 45] = "I18nAttributes";
7044
7033
  })(OpKind || (OpKind = {}));
7045
7034
  var ExpressionKind;
7046
7035
  (function(ExpressionKind2) {
@@ -7065,10 +7054,11 @@ var ExpressionKind;
7065
7054
  ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
7066
7055
  ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
7067
7056
  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";
7057
+ ExpressionKind2[ExpressionKind2["TrustedValueFnExpr"] = 21] = "TrustedValueFnExpr";
7058
+ ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 22] = "SlotLiteralExpr";
7059
+ ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
7060
+ ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 24] = "DerivedRepeaterVar";
7061
+ ExpressionKind2[ExpressionKind2["ConstCollected"] = 25] = "ConstCollected";
7072
7062
  })(ExpressionKind || (ExpressionKind = {}));
7073
7063
  var VariableFlags;
7074
7064
  (function(VariableFlags2) {
@@ -7087,15 +7077,6 @@ var CompatibilityMode;
7087
7077
  CompatibilityMode2[CompatibilityMode2["Normal"] = 0] = "Normal";
7088
7078
  CompatibilityMode2[CompatibilityMode2["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
7089
7079
  })(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
7080
  var DeferSecondaryKind;
7100
7081
  (function(DeferSecondaryKind2) {
7101
7082
  DeferSecondaryKind2[DeferSecondaryKind2["Loading"] = 0] = "Loading";
@@ -7166,7 +7147,7 @@ var TemplateKind;
7166
7147
  TemplateKind2[TemplateKind2["Block"] = 2] = "Block";
7167
7148
  })(TemplateKind || (TemplateKind = {}));
7168
7149
 
7169
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7150
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7170
7151
  var ConsumesSlot = Symbol("ConsumesSlot");
7171
7152
  var DependsOnSlotContext = Symbol("DependsOnSlotContext");
7172
7153
  var ConsumesVarsTrait = Symbol("ConsumesVars");
@@ -7198,7 +7179,7 @@ function hasUsesVarOffsetTrait(expr) {
7198
7179
  return expr[UsesVarOffset] === true;
7199
7180
  }
7200
7181
 
7201
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/shared.mjs
7182
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/shared.mjs
7202
7183
  function createStatementOp(statement) {
7203
7184
  return __spreadValues({
7204
7185
  kind: OpKind.Statement,
@@ -7220,7 +7201,7 @@ var NEW_OP = {
7220
7201
  next: null
7221
7202
  };
7222
7203
 
7223
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
7204
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
7224
7205
  function createInterpolateTextOp(xref, interpolation, sourceSpan) {
7225
7206
  return __spreadValues(__spreadValues(__spreadValues({
7226
7207
  kind: OpKind.InterpolateText,
@@ -7239,7 +7220,7 @@ var Interpolation2 = class {
7239
7220
  }
7240
7221
  }
7241
7222
  };
7242
- function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplate, i18nContext, sourceSpan) {
7223
+ function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7243
7224
  return __spreadValues({
7244
7225
  kind: OpKind.Binding,
7245
7226
  bindingKind: kind,
@@ -7249,12 +7230,14 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
7249
7230
  unit,
7250
7231
  securityContext,
7251
7232
  isTextAttribute,
7252
- isStructuralTemplate,
7253
- i18nContext,
7233
+ isStructuralTemplateAttribute,
7234
+ templateKind,
7235
+ i18nContext: null,
7236
+ i18nMessage,
7254
7237
  sourceSpan
7255
7238
  }, NEW_OP);
7256
7239
  }
7257
- function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplate, i18nContext, sourceSpan) {
7240
+ function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
7258
7241
  return __spreadValues(__spreadValues(__spreadValues({
7259
7242
  kind: OpKind.Property,
7260
7243
  target,
@@ -7263,8 +7246,10 @@ function createPropertyOp(target, name, expression, isAnimationTrigger, security
7263
7246
  isAnimationTrigger,
7264
7247
  securityContext,
7265
7248
  sanitizer: null,
7266
- isStructuralTemplate,
7249
+ isStructuralTemplateAttribute,
7250
+ templateKind,
7267
7251
  i18nContext,
7252
+ i18nMessage,
7268
7253
  sourceSpan
7269
7254
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7270
7255
  }
@@ -7303,7 +7288,7 @@ function createClassMapOp(xref, expression, sourceSpan) {
7303
7288
  sourceSpan
7304
7289
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7305
7290
  }
7306
- function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplate, i18nContext, sourceSpan) {
7291
+ function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7307
7292
  return __spreadValues(__spreadValues(__spreadValues({
7308
7293
  kind: OpKind.Attribute,
7309
7294
  target,
@@ -7312,8 +7297,10 @@ function createAttributeOp(target, name, expression, securityContext, isTextAttr
7312
7297
  securityContext,
7313
7298
  sanitizer: null,
7314
7299
  isTextAttribute,
7315
- isStructuralTemplate,
7316
- i18nContext,
7300
+ isStructuralTemplateAttribute,
7301
+ templateKind,
7302
+ i18nContext: null,
7303
+ i18nMessage,
7317
7304
  sourceSpan
7318
7305
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7319
7306
  }
@@ -7346,15 +7333,15 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
7346
7333
  }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7347
7334
  }
7348
7335
  function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
7349
- return __spreadValues(__spreadValues({
7336
+ return __spreadValues(__spreadValues(__spreadValues({
7350
7337
  kind: OpKind.DeferWhen,
7351
7338
  target,
7352
7339
  expr,
7353
7340
  prefetch,
7354
7341
  sourceSpan
7355
- }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7342
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7356
7343
  }
7357
- function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
7344
+ function createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
7358
7345
  return __spreadValues(__spreadValues(__spreadValues({
7359
7346
  kind: OpKind.I18nExpression,
7360
7347
  context,
@@ -7362,6 +7349,7 @@ function createI18nExpressionOp(context, target, i18nOwner, handle, expression,
7362
7349
  i18nOwner,
7363
7350
  handle,
7364
7351
  expression,
7352
+ icuPlaceholder,
7365
7353
  i18nPlaceholder,
7366
7354
  resolutionTime,
7367
7355
  usage,
@@ -7378,7 +7366,7 @@ function createI18nApplyOp(owner, handle, sourceSpan) {
7378
7366
  }, NEW_OP);
7379
7367
  }
7380
7368
 
7381
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7369
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7382
7370
  var _a;
7383
7371
  var _b;
7384
7372
  var _c;
@@ -7909,26 +7897,6 @@ var ReadTemporaryExpr = class extends ExpressionBase {
7909
7897
  return r;
7910
7898
  }
7911
7899
  };
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
7900
  var SlotLiteralExpr = class extends ExpressionBase {
7933
7901
  constructor(slot) {
7934
7902
  super();
@@ -8047,7 +8015,6 @@ function transformExpressionsInOp(op, transform2, flags) {
8047
8015
  case OpKind.ClassProp:
8048
8016
  case OpKind.ClassMap:
8049
8017
  case OpKind.Binding:
8050
- case OpKind.HostProperty:
8051
8018
  if (op.expression instanceof Interpolation2) {
8052
8019
  transformExpressionsInInterpolation(op.expression, transform2, flags);
8053
8020
  } else {
@@ -8055,6 +8022,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8055
8022
  }
8056
8023
  break;
8057
8024
  case OpKind.Property:
8025
+ case OpKind.HostProperty:
8058
8026
  case OpKind.Attribute:
8059
8027
  if (op.expression instanceof Interpolation2) {
8060
8028
  transformExpressionsInInterpolation(op.expression, transform2, flags);
@@ -8096,6 +8064,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8096
8064
  break;
8097
8065
  case OpKind.ExtractedAttribute:
8098
8066
  op.expression = op.expression && transformExpressionsInExpression(op.expression, transform2, flags);
8067
+ op.trustedValueFn = op.trustedValueFn && transformExpressionsInExpression(op.trustedValueFn, transform2, flags);
8099
8068
  break;
8100
8069
  case OpKind.RepeaterCreate:
8101
8070
  op.track = transformExpressionsInExpression(op.track, transform2, flags);
@@ -8113,6 +8082,9 @@ function transformExpressionsInOp(op, transform2, flags) {
8113
8082
  if (op.placeholderConfig !== null) {
8114
8083
  op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
8115
8084
  }
8085
+ if (op.resolverFn !== null) {
8086
+ op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform2, flags);
8087
+ }
8116
8088
  break;
8117
8089
  case OpKind.I18nMessage:
8118
8090
  for (const [placeholder, expr] of op.params) {
@@ -8149,6 +8121,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8149
8121
  case OpKind.Template:
8150
8122
  case OpKind.Text:
8151
8123
  case OpKind.I18nAttributes:
8124
+ case OpKind.IcuPlaceholder:
8152
8125
  break;
8153
8126
  default:
8154
8127
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -8203,6 +8176,18 @@ function transformExpressionsInExpression(expr, transform2, flags) {
8203
8176
  }
8204
8177
  } else if (expr instanceof NotExpr) {
8205
8178
  expr.condition = transformExpressionsInExpression(expr.condition, transform2, flags);
8179
+ } else if (expr instanceof TaggedTemplateExpr) {
8180
+ expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
8181
+ expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
8182
+ } else if (expr instanceof ArrowFunctionExpr) {
8183
+ if (Array.isArray(expr.body)) {
8184
+ for (let i = 0; i < expr.body.length; i++) {
8185
+ transformExpressionsInStatement(expr.body[i], transform2, flags);
8186
+ }
8187
+ } else {
8188
+ expr.body = transformExpressionsInExpression(expr.body, transform2, flags);
8189
+ }
8190
+ } else if (expr instanceof WrappedNodeExpr) {
8206
8191
  } else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
8207
8192
  } else {
8208
8193
  throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
@@ -8234,7 +8219,7 @@ function isStringLiteral(expr) {
8234
8219
  return expr instanceof LiteralExpr && typeof expr.value === "string";
8235
8220
  }
8236
8221
 
8237
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/operations.mjs
8222
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/operations.mjs
8238
8223
  var _OpList = class {
8239
8224
  constructor() {
8240
8225
  this.debugListId = _OpList.nextListId++;
@@ -8425,14 +8410,14 @@ var OpList = _OpList;
8425
8410
  _OpList.nextListId = 0;
8426
8411
  })();
8427
8412
 
8428
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/handle.mjs
8413
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/handle.mjs
8429
8414
  var SlotHandle = class {
8430
8415
  constructor() {
8431
8416
  this.slot = null;
8432
8417
  }
8433
8418
  };
8434
8419
 
8435
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8420
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8436
8421
  var elementContainerOpKinds = /* @__PURE__ */ new Set([
8437
8422
  OpKind.Element,
8438
8423
  OpKind.ElementStart,
@@ -8444,7 +8429,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
8444
8429
  function isElementOrContainerOp(op) {
8445
8430
  return elementContainerOpKinds.has(op.kind);
8446
8431
  }
8447
- function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan) {
8432
+ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8448
8433
  return __spreadValues(__spreadValues({
8449
8434
  kind: OpKind.ElementStart,
8450
8435
  xref,
@@ -8455,10 +8440,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
8455
8440
  nonBindable: false,
8456
8441
  namespace,
8457
8442
  i18nPlaceholder,
8458
- sourceSpan
8443
+ startSourceSpan,
8444
+ wholeSourceSpan
8459
8445
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8460
8446
  }
8461
- function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
8447
+ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8462
8448
  return __spreadValues(__spreadValues({
8463
8449
  kind: OpKind.Template,
8464
8450
  xref,
@@ -8473,11 +8459,12 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
8473
8459
  nonBindable: false,
8474
8460
  namespace,
8475
8461
  i18nPlaceholder,
8476
- sourceSpan
8462
+ startSourceSpan,
8463
+ wholeSourceSpan
8477
8464
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8478
8465
  }
8479
- function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, sourceSpan) {
8480
- return __spreadProps(__spreadValues(__spreadValues({
8466
+ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8467
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
8481
8468
  kind: OpKind.RepeaterCreate,
8482
8469
  attributes: null,
8483
8470
  xref: primaryView,
@@ -8486,6 +8473,8 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, so
8486
8473
  track,
8487
8474
  trackByFn: null,
8488
8475
  tag,
8476
+ emptyTag,
8477
+ emptyAttributes: null,
8489
8478
  functionNameSuffix: "For",
8490
8479
  namespace: Namespace.HTML,
8491
8480
  nonBindable: false,
@@ -8494,8 +8483,11 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, so
8494
8483
  vars: null,
8495
8484
  varNames,
8496
8485
  usesComponentInstance: false,
8497
- sourceSpan
8498
- }, TRAIT_CONSUMES_SLOT), NEW_OP), {
8486
+ i18nPlaceholder,
8487
+ emptyI18nPlaceholder,
8488
+ startSourceSpan,
8489
+ wholeSourceSpan
8490
+ }, TRAIT_CONSUMES_SLOT), NEW_OP), TRAIT_CONSUMES_VARS), {
8499
8491
  numSlotsUsed: emptyView === null ? 2 : 3
8500
8492
  });
8501
8493
  }
@@ -8518,16 +8510,19 @@ function createEnableBindingsOp(xref) {
8518
8510
  xref
8519
8511
  }, NEW_OP);
8520
8512
  }
8521
- function createTextOp(xref, initialValue, sourceSpan) {
8513
+ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
8522
8514
  return __spreadValues(__spreadValues({
8523
8515
  kind: OpKind.Text,
8524
8516
  xref,
8525
8517
  handle: new SlotHandle(),
8526
8518
  initialValue,
8519
+ icuPlaceholder,
8527
8520
  sourceSpan
8528
8521
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8529
8522
  }
8530
- function createListenerOp(target, targetSlot, name, tag, animationPhase, hostListener, sourceSpan) {
8523
+ function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPhase, eventTarget, hostListener, sourceSpan) {
8524
+ const handlerList = new OpList();
8525
+ handlerList.push(handlerOps);
8531
8526
  return __spreadValues({
8532
8527
  kind: OpKind.Listener,
8533
8528
  target,
@@ -8535,11 +8530,12 @@ function createListenerOp(target, targetSlot, name, tag, animationPhase, hostLis
8535
8530
  tag,
8536
8531
  hostListener,
8537
8532
  name,
8538
- handlerOps: new OpList(),
8533
+ handlerOps: handlerList,
8539
8534
  handlerFnName: null,
8540
8535
  consumesDollarEvent: false,
8541
8536
  isAnimationListener: animationPhase !== null,
8542
8537
  animationPhase,
8538
+ eventTarget,
8543
8539
  sourceSpan
8544
8540
  }, NEW_OP);
8545
8541
  }
@@ -8563,7 +8559,7 @@ function createProjectionDefOp(def) {
8563
8559
  def
8564
8560
  }, NEW_OP);
8565
8561
  }
8566
- function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceSpan) {
8562
+ function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
8567
8563
  return __spreadValues(__spreadValues({
8568
8564
  kind: OpKind.Projection,
8569
8565
  xref,
@@ -8571,19 +8567,22 @@ function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceS
8571
8567
  selector,
8572
8568
  i18nPlaceholder,
8573
8569
  projectionSlotIndex: 0,
8574
- attributes,
8570
+ attributes: null,
8575
8571
  localRefs: [],
8576
8572
  sourceSpan
8577
8573
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8578
8574
  }
8579
- function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext) {
8575
+ function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
8580
8576
  return __spreadValues({
8581
8577
  kind: OpKind.ExtractedAttribute,
8582
8578
  target,
8583
8579
  bindingKind,
8584
8580
  name,
8585
8581
  expression,
8586
- i18nContext
8582
+ i18nContext,
8583
+ i18nMessage,
8584
+ securityContext,
8585
+ trustedValueFn: null
8587
8586
  }, NEW_OP);
8588
8587
  }
8589
8588
  function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
@@ -8634,7 +8633,7 @@ function createI18nMessageOp(xref, i18nContext, i18nBlock, message, messagePlace
8634
8633
  subMessages: []
8635
8634
  }, NEW_OP);
8636
8635
  }
8637
- function createI18nStartOp(xref, message, root) {
8636
+ function createI18nStartOp(xref, message, root, sourceSpan) {
8638
8637
  return __spreadValues(__spreadValues({
8639
8638
  kind: OpKind.I18nStart,
8640
8639
  xref,
@@ -8643,13 +8642,15 @@ function createI18nStartOp(xref, message, root) {
8643
8642
  message,
8644
8643
  messageIndex: null,
8645
8644
  subTemplateIndex: null,
8646
- context: null
8645
+ context: null,
8646
+ sourceSpan
8647
8647
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8648
8648
  }
8649
- function createI18nEndOp(xref) {
8649
+ function createI18nEndOp(xref, sourceSpan) {
8650
8650
  return __spreadValues({
8651
8651
  kind: OpKind.I18nEnd,
8652
- xref
8652
+ xref,
8653
+ sourceSpan
8653
8654
  }, NEW_OP);
8654
8655
  }
8655
8656
  function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
@@ -8668,6 +8669,15 @@ function createIcuEndOp(xref) {
8668
8669
  xref
8669
8670
  }, NEW_OP);
8670
8671
  }
8672
+ function createIcuPlaceholderOp(xref, name, strings) {
8673
+ return __spreadValues({
8674
+ kind: OpKind.IcuPlaceholder,
8675
+ xref,
8676
+ name,
8677
+ strings,
8678
+ expressionPlaceholders: []
8679
+ }, NEW_OP);
8680
+ }
8671
8681
  function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
8672
8682
  if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
8673
8683
  throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
@@ -8693,22 +8703,24 @@ function createI18nAttributesOp(xref, handle, target) {
8693
8703
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8694
8704
  }
8695
8705
 
8696
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8697
- function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, sourceSpan) {
8706
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8707
+ function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
8698
8708
  return __spreadValues(__spreadValues({
8699
8709
  kind: OpKind.HostProperty,
8700
8710
  name,
8701
8711
  expression,
8702
8712
  isAnimationTrigger,
8703
8713
  i18nContext,
8714
+ securityContext,
8715
+ sanitizer: null,
8704
8716
  sourceSpan
8705
8717
  }, TRAIT_CONSUMES_VARS), NEW_OP);
8706
8718
  }
8707
8719
 
8708
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/variable.mjs
8720
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/variable.mjs
8709
8721
  var CTX_REF = "CTX_REF_MARKER";
8710
8722
 
8711
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/compilation.mjs
8723
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/compilation.mjs
8712
8724
  var CompilationJobKind;
8713
8725
  (function(CompilationJobKind2) {
8714
8726
  CompilationJobKind2[CompilationJobKind2["Tmpl"] = 0] = "Tmpl";
@@ -8815,7 +8827,7 @@ var HostBindingCompilationUnit = class extends CompilationUnit {
8815
8827
  }
8816
8828
  };
8817
8829
 
8818
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/any_cast.mjs
8830
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/any_cast.mjs
8819
8831
  function deleteAnyCasts(job) {
8820
8832
  for (const unit of job.units) {
8821
8833
  for (const op of unit.ops()) {
@@ -8833,7 +8845,7 @@ function removeAnys(e) {
8833
8845
  return e;
8834
8846
  }
8835
8847
 
8836
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
8848
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
8837
8849
  function applyI18nExpressions(job) {
8838
8850
  const i18nContexts = /* @__PURE__ */ new Map();
8839
8851
  for (const unit of job.units) {
@@ -8876,62 +8888,52 @@ function needsApplication(i18nContexts, op) {
8876
8888
  return false;
8877
8889
  }
8878
8890
 
8879
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8891
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8880
8892
  function assignI18nSlotDependencies(job) {
8881
- const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
8882
- let lastSlotConsumer = null;
8883
- let currentI18nOp = null;
8884
8893
  for (const unit of job.units) {
8885
- for (const op of unit.create) {
8886
- if (hasConsumesSlotTrait(op)) {
8887
- lastSlotConsumer = op.xref;
8894
+ let updateOp = unit.update.head;
8895
+ let i18nExpressionsInProgress = [];
8896
+ let state = null;
8897
+ for (const createOp of unit.create) {
8898
+ if (createOp.kind === OpKind.I18nStart) {
8899
+ state = {
8900
+ blockXref: createOp.xref,
8901
+ lastSlotConsumer: createOp.xref
8902
+ };
8903
+ } else if (createOp.kind === OpKind.I18nEnd) {
8904
+ for (const op of i18nExpressionsInProgress) {
8905
+ op.target = state.lastSlotConsumer;
8906
+ OpList.insertBefore(op, updateOp);
8907
+ }
8908
+ i18nExpressionsInProgress.length = 0;
8909
+ state = null;
8888
8910
  }
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");
8911
+ if (hasConsumesSlotTrait(createOp)) {
8912
+ if (state !== null) {
8913
+ state.lastSlotConsumer = createOp.xref;
8914
+ }
8915
+ while (true) {
8916
+ if (updateOp.next === null) {
8917
+ break;
8896
8918
  }
8897
- if (lastSlotConsumer === null) {
8898
- throw new Error("AssertionError: Expected a last slot consumer while calculating last slot consumers");
8919
+ if (state !== null && updateOp.kind === OpKind.I18nExpression && updateOp.usage === I18nExpressionFor.I18nText && updateOp.i18nOwner === state.blockXref) {
8920
+ const opToRemove = updateOp;
8921
+ updateOp = updateOp.next;
8922
+ OpList.remove(opToRemove);
8923
+ i18nExpressionsInProgress.push(opToRemove);
8924
+ continue;
8899
8925
  }
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");
8926
+ if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
8927
+ break;
8928
+ }
8929
+ updateOp = updateOp.next;
8923
8930
  }
8924
- op.target = target;
8925
- moveAfterTarget = op.target;
8926
8931
  }
8927
8932
  }
8928
- if (moveAfterTarget !== null) {
8929
- unit.update.push(opsToMove);
8930
- }
8931
8933
  }
8932
8934
  }
8933
8935
 
8934
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8936
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8935
8937
  function createOpXrefMap(unit) {
8936
8938
  const map = /* @__PURE__ */ new Map();
8937
8939
  for (const op of unit.create) {
@@ -8939,11 +8941,14 @@ function createOpXrefMap(unit) {
8939
8941
  continue;
8940
8942
  }
8941
8943
  map.set(op.xref, op);
8944
+ if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
8945
+ map.set(op.emptyView, op);
8946
+ }
8942
8947
  }
8943
8948
  return map;
8944
8949
  }
8945
8950
 
8946
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8951
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8947
8952
  function extractAttributes(job) {
8948
8953
  for (const unit of job.units) {
8949
8954
  const elements = createOpXrefMap(unit);
@@ -8955,26 +8960,56 @@ function extractAttributes(job) {
8955
8960
  case OpKind.Property:
8956
8961
  if (!op.isAnimationTrigger) {
8957
8962
  let bindingKind;
8958
- if (op.i18nContext !== null) {
8963
+ if (op.i18nMessage !== null && op.templateKind === null) {
8959
8964
  bindingKind = BindingKind.I18n;
8960
- } else if (op.isStructuralTemplate) {
8965
+ } else if (op.isStructuralTemplateAttribute) {
8961
8966
  bindingKind = BindingKind.Template;
8962
8967
  } else {
8963
8968
  bindingKind = BindingKind.Property;
8964
8969
  }
8965
- OpList.insertBefore(createExtractedAttributeOp(op.target, bindingKind, op.name, null, null), lookupElement(elements, op.target));
8970
+ OpList.insertBefore(
8971
+ createExtractedAttributeOp(
8972
+ op.target,
8973
+ bindingKind,
8974
+ op.name,
8975
+ null,
8976
+ null,
8977
+ null,
8978
+ op.securityContext
8979
+ ),
8980
+ lookupElement(elements, op.target)
8981
+ );
8966
8982
  }
8967
8983
  break;
8968
8984
  case OpKind.StyleProp:
8969
8985
  case OpKind.ClassProp:
8970
8986
  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));
8987
+ OpList.insertBefore(createExtractedAttributeOp(
8988
+ op.target,
8989
+ BindingKind.Property,
8990
+ op.name,
8991
+ null,
8992
+ null,
8993
+ null,
8994
+ SecurityContext.STYLE
8995
+ ), lookupElement(elements, op.target));
8972
8996
  }
8973
8997
  break;
8974
8998
  case OpKind.Listener:
8975
8999
  if (!op.isAnimationListener) {
8976
- const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, op.name, null, null);
9000
+ const extractedAttributeOp = createExtractedAttributeOp(
9001
+ op.target,
9002
+ BindingKind.Property,
9003
+ op.name,
9004
+ null,
9005
+ null,
9006
+ null,
9007
+ SecurityContext.NONE
9008
+ );
8977
9009
  if (job.kind === CompilationJobKind.Host) {
9010
+ if (job.compatibility) {
9011
+ break;
9012
+ }
8978
9013
  unit.create.push(extractedAttributeOp);
8979
9014
  } else {
8980
9015
  OpList.insertBefore(extractedAttributeOp, lookupElement(elements, op.target));
@@ -8996,18 +9031,12 @@ function extractAttributeOp(unit, op, elements) {
8996
9031
  if (op.expression instanceof Interpolation2) {
8997
9032
  return;
8998
9033
  }
8999
- let extractable = op.expression.isConstant();
9034
+ let extractable = op.isTextAttribute || op.expression.isConstant();
9000
9035
  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
- }
9036
+ extractable && (extractable = op.isTextAttribute);
9008
9037
  }
9009
9038
  if (extractable) {
9010
- const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplate ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext);
9039
+ const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
9011
9040
  if (unit.job.kind === CompilationJobKind.Host) {
9012
9041
  unit.create.push(extractedAttributeOp);
9013
9042
  } else {
@@ -9018,7 +9047,7 @@ function extractAttributeOp(unit, op, elements) {
9018
9047
  }
9019
9048
  }
9020
9049
 
9021
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/binding_specialization.mjs
9050
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/binding_specialization.mjs
9022
9051
  function lookupElement2(elements, xref) {
9023
9052
  const el = elements.get(xref);
9024
9053
  if (el === void 0) {
@@ -9048,15 +9077,15 @@ function specializeBindings(job) {
9048
9077
  const target = lookupElement2(elements, op.target);
9049
9078
  target.nonBindable = true;
9050
9079
  } else {
9051
- OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplate, op.i18nContext, op.sourceSpan));
9080
+ OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
9052
9081
  }
9053
9082
  break;
9054
9083
  case BindingKind.Property:
9055
9084
  case BindingKind.Animation:
9056
9085
  if (job.kind === CompilationJobKind.Host) {
9057
- OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.sourceSpan));
9086
+ OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
9058
9087
  } else {
9059
- OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplate, op.i18nContext, op.sourceSpan));
9088
+ 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
9089
  }
9061
9090
  break;
9062
9091
  case BindingKind.I18n:
@@ -9068,7 +9097,7 @@ function specializeBindings(job) {
9068
9097
  }
9069
9098
  }
9070
9099
 
9071
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
9100
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
9072
9101
  var CHAINABLE = /* @__PURE__ */ new Set([
9073
9102
  Identifiers.attribute,
9074
9103
  Identifiers.classProp,
@@ -9134,7 +9163,7 @@ function chainOperationsInList(opList) {
9134
9163
  }
9135
9164
  }
9136
9165
 
9137
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/collapse_singleton_interpolations.mjs
9166
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/collapse_singleton_interpolations.mjs
9138
9167
  function collapseSingletonInterpolations(job) {
9139
9168
  for (const unit of job.units) {
9140
9169
  for (const op of unit.update) {
@@ -9146,7 +9175,7 @@ function collapseSingletonInterpolations(job) {
9146
9175
  }
9147
9176
  }
9148
9177
 
9149
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/conditionals.mjs
9178
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/conditionals.mjs
9150
9179
  function generateConditionalExpressions(job) {
9151
9180
  for (const unit of job.units) {
9152
9181
  for (const op of unit.ops()) {
@@ -9183,7 +9212,7 @@ function generateConditionalExpressions(job) {
9183
9212
  }
9184
9213
  }
9185
9214
 
9186
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/conversion.mjs
9215
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/conversion.mjs
9187
9216
  var BINARY_OPERATORS = /* @__PURE__ */ new Map([
9188
9217
  ["&&", BinaryOperator.And],
9189
9218
  [">", BinaryOperator.Bigger],
@@ -9233,15 +9262,15 @@ function literalOrArrayLiteral(value) {
9233
9262
  return literal(value);
9234
9263
  }
9235
9264
 
9236
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
9265
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
9237
9266
  function collectElementConsts(job) {
9238
9267
  const allElementAttributes = /* @__PURE__ */ new Map();
9239
9268
  for (const unit of job.units) {
9240
9269
  for (const op of unit.create) {
9241
9270
  if (op.kind === OpKind.ExtractedAttribute) {
9242
- const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
9271
+ const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
9243
9272
  allElementAttributes.set(op.target, attributes);
9244
- attributes.add(op.bindingKind, op.name, op.expression);
9273
+ attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
9245
9274
  OpList.remove(op);
9246
9275
  }
9247
9276
  }
@@ -9249,14 +9278,19 @@ function collectElementConsts(job) {
9249
9278
  if (job instanceof ComponentCompilationJob) {
9250
9279
  for (const unit of job.units) {
9251
9280
  for (const op of unit.create) {
9252
- if (isElementOrContainerOp(op)) {
9281
+ if (op.kind == OpKind.Projection) {
9253
9282
  const attributes = allElementAttributes.get(op.xref);
9254
9283
  if (attributes !== void 0) {
9255
9284
  const attrArray = serializeAttributes(attributes);
9256
9285
  if (attrArray.entries.length > 0) {
9257
- op.attributes = job.addConst(attrArray);
9286
+ op.attributes = attrArray;
9258
9287
  }
9259
9288
  }
9289
+ } else if (isElementOrContainerOp(op)) {
9290
+ op.attributes = getConstIndex(job, allElementAttributes, op.xref);
9291
+ if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
9292
+ op.emptyAttributes = getConstIndex(job, allElementAttributes, op.emptyView);
9293
+ }
9260
9294
  }
9261
9295
  }
9262
9296
  }
@@ -9272,13 +9306,18 @@ function collectElementConsts(job) {
9272
9306
  }
9273
9307
  }
9274
9308
  }
9309
+ function getConstIndex(job, allElementAttributes, xref) {
9310
+ const attributes = allElementAttributes.get(xref);
9311
+ if (attributes !== void 0) {
9312
+ const attrArray = serializeAttributes(attributes);
9313
+ if (attrArray.entries.length > 0) {
9314
+ return job.addConst(attrArray);
9315
+ }
9316
+ }
9317
+ return null;
9318
+ }
9275
9319
  var FLYWEIGHT_ARRAY = Object.freeze([]);
9276
9320
  var ElementAttributes = class {
9277
- constructor() {
9278
- this.known = /* @__PURE__ */ new Set();
9279
- this.byKind = /* @__PURE__ */ new Map();
9280
- this.projectAs = null;
9281
- }
9282
9321
  get attributes() {
9283
9322
  var _a2;
9284
9323
  return (_a2 = this.byKind.get(BindingKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
@@ -9303,12 +9342,28 @@ var ElementAttributes = class {
9303
9342
  var _a2;
9304
9343
  return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
9305
9344
  }
9306
- add(kind, name, value) {
9345
+ constructor(compatibility) {
9346
+ this.compatibility = compatibility;
9347
+ this.known = /* @__PURE__ */ new Map();
9348
+ this.byKind = /* @__PURE__ */ new Map();
9349
+ this.projectAs = null;
9350
+ }
9351
+ isKnown(kind, name, value) {
9307
9352
  var _a2;
9308
- if (this.known.has(name)) {
9353
+ const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
9354
+ this.known.set(kind, nameToValue);
9355
+ if (nameToValue.has(name)) {
9356
+ return true;
9357
+ }
9358
+ nameToValue.add(name);
9359
+ return false;
9360
+ }
9361
+ add(kind, name, value, trustedValueFn) {
9362
+ var _a2;
9363
+ const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
9364
+ if (!allowDuplicates && this.isKnown(kind, name, value)) {
9309
9365
  return;
9310
9366
  }
9311
- this.known.add(name);
9312
9367
  if (name === "ngProjectAs") {
9313
9368
  if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof ((_a2 = value.value) == null ? void 0 : _a2.toString()) !== "string") {
9314
9369
  throw Error("ngProjectAs must have a string literal value");
@@ -9321,7 +9376,14 @@ var ElementAttributes = class {
9321
9376
  if (value === null) {
9322
9377
  throw Error("Attribute, i18n attribute, & style element attributes must have a value");
9323
9378
  }
9324
- array.push(value);
9379
+ if (trustedValueFn !== null) {
9380
+ if (!isStringLiteral(value)) {
9381
+ throw Error("AssertionError: extracted attribute value should be string literal");
9382
+ }
9383
+ array.push(taggedTemplate(trustedValueFn, new TemplateLiteral([new TemplateLiteralElement(value.value)], []), void 0, value.sourceSpan));
9384
+ } else {
9385
+ array.push(value);
9386
+ }
9325
9387
  }
9326
9388
  }
9327
9389
  arrayFor(kind) {
@@ -9332,7 +9394,7 @@ var ElementAttributes = class {
9332
9394
  }
9333
9395
  };
9334
9396
  function getAttributeNameLiterals(name) {
9335
- const [attributeNamespace, attributeName] = splitNsName(name);
9397
+ const [attributeNamespace, attributeName] = splitNsName(name, false);
9336
9398
  const nameLiteral = literal(attributeName);
9337
9399
  if (attributeNamespace) {
9338
9400
  return [
@@ -9367,7 +9429,7 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
9367
9429
  return literalArr(attrArray);
9368
9430
  }
9369
9431
 
9370
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/convert_i18n_bindings.mjs
9432
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/convert_i18n_bindings.mjs
9371
9433
  function convertI18nBindings(job) {
9372
9434
  const i18nAttributesByElem = /* @__PURE__ */ new Map();
9373
9435
  for (const unit of job.units) {
@@ -9399,7 +9461,7 @@ function convertI18nBindings(job) {
9399
9461
  if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
9400
9462
  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
9463
  }
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));
9464
+ 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
9465
  }
9404
9466
  OpList.replaceWithMany(op, ops);
9405
9467
  break;
@@ -9408,7 +9470,7 @@ function convertI18nBindings(job) {
9408
9470
  }
9409
9471
  }
9410
9472
 
9411
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
9473
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
9412
9474
  function createDeferDepsFns(job) {
9413
9475
  for (const unit of job.units) {
9414
9476
  for (const op of unit.create) {
@@ -9430,57 +9492,117 @@ function createDeferDepsFns(job) {
9430
9492
  if (op.handle.slot === null) {
9431
9493
  throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
9432
9494
  }
9433
- op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
9495
+ op.resolverFn = job.pool.getSharedFunctionReference(
9496
+ depsFnExpr,
9497
+ `${job.componentName}_Defer_${op.handle.slot}_DepsFn`,
9498
+ false
9499
+ );
9434
9500
  }
9435
9501
  }
9436
9502
  }
9437
9503
  }
9438
9504
 
9439
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
9505
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
9440
9506
  function createI18nContexts(job) {
9441
- const rootContexts = /* @__PURE__ */ new Map();
9442
- let currentI18nOp = null;
9443
- let xref;
9507
+ const attrContextByMessage = /* @__PURE__ */ new Map();
9508
+ for (const unit of job.units) {
9509
+ for (const op of unit.ops()) {
9510
+ switch (op.kind) {
9511
+ case OpKind.Binding:
9512
+ case OpKind.Property:
9513
+ case OpKind.Attribute:
9514
+ case OpKind.ExtractedAttribute:
9515
+ if (op.i18nMessage === null) {
9516
+ continue;
9517
+ }
9518
+ if (!attrContextByMessage.has(op.i18nMessage)) {
9519
+ const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);
9520
+ unit.create.push(i18nContext);
9521
+ attrContextByMessage.set(op.i18nMessage, i18nContext.xref);
9522
+ }
9523
+ op.i18nContext = attrContextByMessage.get(op.i18nMessage);
9524
+ break;
9525
+ }
9526
+ }
9527
+ }
9528
+ const blockContextByI18nBlock = /* @__PURE__ */ new Map();
9444
9529
  for (const unit of job.units) {
9445
9530
  for (const op of unit.create) {
9446
9531
  switch (op.kind) {
9447
9532
  case OpKind.I18nStart:
9448
- currentI18nOp = op;
9449
9533
  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);
9534
+ const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);
9535
+ unit.create.push(contextOp);
9536
+ op.context = contextOp.xref;
9537
+ blockContextByI18nBlock.set(op.xref, contextOp);
9454
9538
  }
9455
9539
  break;
9540
+ }
9541
+ }
9542
+ }
9543
+ for (const unit of job.units) {
9544
+ for (const op of unit.create) {
9545
+ if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
9546
+ const rootContext = blockContextByI18nBlock.get(op.root);
9547
+ if (rootContext === void 0) {
9548
+ throw Error("AssertionError: Root i18n block i18n context should have been created.");
9549
+ }
9550
+ op.context = rootContext.xref;
9551
+ blockContextByI18nBlock.set(op.xref, rootContext);
9552
+ }
9553
+ }
9554
+ }
9555
+ let currentI18nOp = null;
9556
+ for (const unit of job.units) {
9557
+ for (const op of unit.create) {
9558
+ switch (op.kind) {
9559
+ case OpKind.I18nStart:
9560
+ currentI18nOp = op;
9561
+ break;
9456
9562
  case OpKind.I18nEnd:
9457
9563
  currentI18nOp = null;
9458
9564
  break;
9459
9565
  case OpKind.IcuStart:
9460
9566
  if (currentI18nOp === null) {
9461
- throw Error("Unexpected ICU outside of an i18n block.");
9567
+ throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
9462
9568
  }
9463
9569
  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;
9570
+ const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
9571
+ unit.create.push(contextOp);
9572
+ op.context = contextOp.xref;
9467
9573
  } else {
9468
9574
  op.context = currentI18nOp.context;
9575
+ blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;
9469
9576
  }
9470
9577
  break;
9471
9578
  }
9472
9579
  }
9473
9580
  }
9581
+ }
9582
+
9583
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/deduplicate_text_bindings.mjs
9584
+ function deduplicateTextBindings(job) {
9585
+ const seen = /* @__PURE__ */ new Map();
9474
9586
  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);
9587
+ for (const op of unit.update.reversed()) {
9588
+ if (op.kind === OpKind.Binding && op.isTextAttribute) {
9589
+ const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
9590
+ if (seenForElement.has(op.name)) {
9591
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
9592
+ if (op.name === "style" || op.name === "class") {
9593
+ OpList.remove(op);
9594
+ }
9595
+ } else {
9596
+ }
9597
+ }
9598
+ seenForElement.add(op.name);
9599
+ seen.set(op.target, seenForElement);
9478
9600
  }
9479
9601
  }
9480
9602
  }
9481
9603
  }
9482
9604
 
9483
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
9605
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
9484
9606
  function configureDeferInstructions(job) {
9485
9607
  for (const unit of job.units) {
9486
9608
  for (const op of unit.create) {
@@ -9497,7 +9619,7 @@ function configureDeferInstructions(job) {
9497
9619
  }
9498
9620
  }
9499
9621
 
9500
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_resolve_targets.mjs
9622
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_resolve_targets.mjs
9501
9623
  function resolveDeferTargetNames(job) {
9502
9624
  const scopes = /* @__PURE__ */ new Map();
9503
9625
  function getScopeForView2(view) {
@@ -9591,7 +9713,7 @@ var Scope = class {
9591
9713
  }
9592
9714
  };
9593
9715
 
9594
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/empty_elements.mjs
9716
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/empty_elements.mjs
9595
9717
  var REPLACEMENTS = /* @__PURE__ */ new Map([
9596
9718
  [OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
9597
9719
  [OpKind.ContainerEnd, [OpKind.ContainerStart, OpKind.Container]],
@@ -9618,7 +9740,7 @@ function collapseEmptyInstructions(job) {
9618
9740
  }
9619
9741
  }
9620
9742
 
9621
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9743
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9622
9744
  function expandSafeReads(job) {
9623
9745
  for (const unit of job.units) {
9624
9746
  for (const op of unit.ops()) {
@@ -9754,7 +9876,7 @@ function ternaryTransform(e) {
9754
9876
  return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
9755
9877
  }
9756
9878
 
9757
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/extract_i18n_messages.mjs
9879
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/extract_i18n_messages.mjs
9758
9880
  var ESCAPE = "\uFFFD";
9759
9881
  var ELEMENT_MARKER = "#";
9760
9882
  var TEMPLATE_MARKER = "*";
@@ -9764,12 +9886,16 @@ var LIST_START_MARKER = "[";
9764
9886
  var LIST_END_MARKER = "]";
9765
9887
  var LIST_DELIMITER = "|";
9766
9888
  function extractI18nMessages(job) {
9767
- const i18nContexts = /* @__PURE__ */ new Map();
9889
+ const i18nMessagesByContext = /* @__PURE__ */ new Map();
9768
9890
  const i18nBlocks = /* @__PURE__ */ new Map();
9891
+ const i18nContexts = /* @__PURE__ */ new Map();
9769
9892
  for (const unit of job.units) {
9770
9893
  for (const op of unit.create) {
9771
9894
  switch (op.kind) {
9772
9895
  case OpKind.I18nContext:
9896
+ const i18nMessageOp = createI18nMessage(job, op);
9897
+ unit.create.push(i18nMessageOp);
9898
+ i18nMessagesByContext.set(op.xref, i18nMessageOp);
9773
9899
  i18nContexts.set(op.xref, op);
9774
9900
  break;
9775
9901
  case OpKind.I18nStart:
@@ -9778,49 +9904,40 @@ function extractI18nMessages(job) {
9778
9904
  }
9779
9905
  }
9780
9906
  }
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
- }
9907
+ let currentIcu = null;
9803
9908
  for (const unit of job.units) {
9804
9909
  for (const op of unit.create) {
9805
9910
  switch (op.kind) {
9806
9911
  case OpKind.IcuStart:
9807
- if (!op.context) {
9808
- throw Error("ICU op should have its context set.");
9912
+ currentIcu = op;
9913
+ OpList.remove(op);
9914
+ const icuContext = i18nContexts.get(op.context);
9915
+ if (icuContext.contextKind !== I18nContextKind.Icu) {
9916
+ continue;
9809
9917
  }
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);
9918
+ const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);
9919
+ if (i18nBlock.context === icuContext.xref) {
9920
+ continue;
9820
9921
  }
9821
- OpList.remove(op);
9922
+ const rootI18nBlock = i18nBlocks.get(i18nBlock.root);
9923
+ const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);
9924
+ if (rootMessage === void 0) {
9925
+ throw Error("AssertionError: ICU sub-message should belong to a root message.");
9926
+ }
9927
+ const subMessage = i18nMessagesByContext.get(icuContext.xref);
9928
+ subMessage.messagePlaceholder = op.messagePlaceholder;
9929
+ rootMessage.subMessages.push(subMessage.xref);
9822
9930
  break;
9823
9931
  case OpKind.IcuEnd:
9932
+ currentIcu = null;
9933
+ OpList.remove(op);
9934
+ break;
9935
+ case OpKind.IcuPlaceholder:
9936
+ if (currentIcu === null || currentIcu.context == null) {
9937
+ throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");
9938
+ }
9939
+ const msg = i18nMessagesByContext.get(currentIcu.context);
9940
+ msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
9824
9941
  OpList.remove(op);
9825
9942
  break;
9826
9943
  }
@@ -9830,14 +9947,16 @@ function extractI18nMessages(job) {
9830
9947
  function createI18nMessage(job, context, messagePlaceholder) {
9831
9948
  let formattedParams = formatParams(context.params);
9832
9949
  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
- }
9950
+ let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
9839
9951
  return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
9840
9952
  }
9953
+ function formatIcuPlaceholder(op) {
9954
+ if (op.strings.length !== op.expressionPlaceholders.length + 1) {
9955
+ throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
9956
+ }
9957
+ const values = op.expressionPlaceholders.map(formatValue);
9958
+ return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
9959
+ }
9841
9960
  function formatParams(params) {
9842
9961
  const formattedParams = /* @__PURE__ */ new Map();
9843
9962
  for (const [placeholder, placeholderValues] of params) {
@@ -9893,7 +10012,7 @@ function formatValue(value) {
9893
10012
  return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
9894
10013
  }
9895
10014
 
9896
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
10015
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
9897
10016
  function generateAdvance(job) {
9898
10017
  for (const unit of job.units) {
9899
10018
  const slotMap = /* @__PURE__ */ new Map();
@@ -9925,7 +10044,7 @@ function generateAdvance(job) {
9925
10044
  }
9926
10045
  }
9927
10046
 
9928
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_projection_def.mjs
10047
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_projection_def.mjs
9929
10048
  function generateProjectionDefs(job) {
9930
10049
  const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
9931
10050
  const selectors = [];
@@ -9949,7 +10068,7 @@ function generateProjectionDefs(job) {
9949
10068
  }
9950
10069
  }
9951
10070
 
9952
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
10071
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
9953
10072
  function generateVariables(job) {
9954
10073
  recursivelyProcessView(job.root, null);
9955
10074
  }
@@ -9958,8 +10077,13 @@ function recursivelyProcessView(view, parentScope) {
9958
10077
  for (const op of view.create) {
9959
10078
  switch (op.kind) {
9960
10079
  case OpKind.Template:
10080
+ recursivelyProcessView(view.job.views.get(op.xref), scope);
10081
+ break;
9961
10082
  case OpKind.RepeaterCreate:
9962
10083
  recursivelyProcessView(view.job.views.get(op.xref), scope);
10084
+ if (op.emptyView) {
10085
+ recursivelyProcessView(view.job.views.get(op.emptyView), scope);
10086
+ }
9963
10087
  break;
9964
10088
  case OpKind.Listener:
9965
10089
  op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
@@ -10037,7 +10161,7 @@ function generateVariablesInScopeForView(view, scope) {
10037
10161
  return newOps;
10038
10162
  }
10039
10163
 
10040
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/has_const_expression_collection.mjs
10164
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/has_const_expression_collection.mjs
10041
10165
  function collectConstExpressions(job) {
10042
10166
  for (const unit of job.units) {
10043
10167
  for (const op of unit.ops()) {
@@ -10051,7 +10175,7 @@ function collectConstExpressions(job) {
10051
10175
  }
10052
10176
  }
10053
10177
 
10054
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/host_style_property_parsing.mjs
10178
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/host_style_property_parsing.mjs
10055
10179
  var STYLE_DOT = "style.";
10056
10180
  var CLASS_DOT = "class.";
10057
10181
  var STYLE_BANG = "style!";
@@ -10059,7 +10183,7 @@ var CLASS_BANG = "class!";
10059
10183
  var BANG_IMPORTANT = "!important";
10060
10184
  function parseHostStyleProperties(job) {
10061
10185
  for (const op of job.root.update) {
10062
- if (op.kind !== OpKind.Binding) {
10186
+ if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {
10063
10187
  continue;
10064
10188
  }
10065
10189
  if (op.name.endsWith(BANG_IMPORTANT)) {
@@ -10109,7 +10233,7 @@ function parseProperty(name) {
10109
10233
  return { property: property2, suffix };
10110
10234
  }
10111
10235
 
10112
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/map_util.mjs
10236
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/map_util.mjs
10113
10237
  function mapLiteral(obj, quoted = false) {
10114
10238
  return literalMap(Object.keys(obj).map((key) => ({
10115
10239
  key,
@@ -10118,7 +10242,7 @@ function mapLiteral(obj, quoted = false) {
10118
10242
  })));
10119
10243
  }
10120
10244
 
10121
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/icu_serializer.mjs
10245
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/icu_serializer.mjs
10122
10246
  var IcuSerializerVisitor = class {
10123
10247
  visitText(text2) {
10124
10248
  return text2.value;
@@ -10152,7 +10276,7 @@ function serializeIcuNode(icu) {
10152
10276
  return icu.visit(serializer);
10153
10277
  }
10154
10278
 
10155
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/lexer.mjs
10279
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/expression_parser/lexer.mjs
10156
10280
  var TokenType;
10157
10281
  (function(TokenType2) {
10158
10282
  TokenType2[TokenType2["Character"] = 0] = "Character";
@@ -10513,7 +10637,7 @@ function parseIntAutoRadix(text2) {
10513
10637
  return result;
10514
10638
  }
10515
10639
 
10516
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/parser.mjs
10640
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/expression_parser/parser.mjs
10517
10641
  var SplitInterpolation = class {
10518
10642
  constructor(strings, expressions, offsets) {
10519
10643
  this.strings = strings;
@@ -11407,7 +11531,7 @@ function getIndexMapForOriginalTemplate(interpolatedTokens) {
11407
11531
  return offsetMap;
11408
11532
  }
11409
11533
 
11410
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/ast.mjs
11534
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/ast.mjs
11411
11535
  var NodeWithI18n = class {
11412
11536
  constructor(sourceSpan, i18n2) {
11413
11537
  this.sourceSpan = sourceSpan;
@@ -11559,11 +11683,11 @@ var RecursiveVisitor = class {
11559
11683
  }
11560
11684
  };
11561
11685
 
11562
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/element_schema_registry.mjs
11686
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/element_schema_registry.mjs
11563
11687
  var ElementSchemaRegistry = class {
11564
11688
  };
11565
11689
 
11566
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/dom_element_schema_registry.mjs
11690
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/dom_element_schema_registry.mjs
11567
11691
  var BOOLEAN = "boolean";
11568
11692
  var NUMBER = "number";
11569
11693
  var STRING = "string";
@@ -11916,7 +12040,7 @@ function _isPixelDimensionStyle(prop) {
11916
12040
  }
11917
12041
  }
11918
12042
 
11919
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_tags.mjs
12043
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/html_tags.mjs
11920
12044
  var HtmlTagDefinition = class {
11921
12045
  constructor({ closedByChildren, implicitNamespacePrefix, contentType = TagContentType.PARSABLE_DATA, closedByParent = false, isVoid = false, ignoreFirstLf = false, preventNamespaceInheritance = false, canSelfClose = false } = {}) {
11922
12046
  this.closedByChildren = {};
@@ -12034,7 +12158,7 @@ function getHtmlTagDefinition(tagName) {
12034
12158
  return (_b2 = (_a2 = TAG_DEFINITIONS[tagName]) != null ? _a2 : TAG_DEFINITIONS[tagName.toLowerCase()]) != null ? _b2 : DEFAULT_TAG_DEFINITION;
12035
12159
  }
12036
12160
 
12037
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/placeholder.mjs
12161
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/serializers/placeholder.mjs
12038
12162
  var TAG_TO_PLACEHOLDER_NAMES = {
12039
12163
  "A": "LINK",
12040
12164
  "B": "BOLD_TEXT",
@@ -12156,7 +12280,7 @@ var PlaceholderRegistry = class {
12156
12280
  }
12157
12281
  };
12158
12282
 
12159
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
12283
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
12160
12284
  var _expParser = new Parser(new Lexer());
12161
12285
  function createI18nMessageFactory(interpolationConfig, containerBlocks) {
12162
12286
  const visitor = new _I18nVisitor(_expParser, interpolationConfig, containerBlocks);
@@ -12335,14 +12459,14 @@ function extractPlaceholderName(input) {
12335
12459
  return input.split(_CUSTOM_PH_EXP)[2];
12336
12460
  }
12337
12461
 
12338
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/parse_util.mjs
12462
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/parse_util.mjs
12339
12463
  var I18nError = class extends ParseError {
12340
12464
  constructor(span, msg) {
12341
12465
  super(span, msg);
12342
12466
  }
12343
12467
  };
12344
12468
 
12345
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/entities.mjs
12469
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/entities.mjs
12346
12470
  var NAMED_ENTITIES = {
12347
12471
  "AElig": "\xC6",
12348
12472
  "AMP": "&",
@@ -14473,7 +14597,7 @@ var NAMED_ENTITIES = {
14473
14597
  var NGSP_UNICODE = "\uE500";
14474
14598
  NAMED_ENTITIES["ngsp"] = NGSP_UNICODE;
14475
14599
 
14476
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/lexer.mjs
14600
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/lexer.mjs
14477
14601
  var TokenError = class extends ParseError {
14478
14602
  constructor(errorMsg, tokenType, span) {
14479
14603
  super(span, errorMsg);
@@ -15394,7 +15518,7 @@ var CursorError = class {
15394
15518
  }
15395
15519
  };
15396
15520
 
15397
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/parser.mjs
15521
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/parser.mjs
15398
15522
  var TreeError = class extends ParseError {
15399
15523
  static create(elementName, span, msg) {
15400
15524
  return new TreeError(elementName, span, msg);
@@ -15778,7 +15902,7 @@ function decodeEntity(match, entity) {
15778
15902
  return match;
15779
15903
  }
15780
15904
 
15781
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/trusted_types_sinks.mjs
15905
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/schema/trusted_types_sinks.mjs
15782
15906
  var TRUSTED_TYPES_SINKS = /* @__PURE__ */ new Set([
15783
15907
  "iframe|srcdoc",
15784
15908
  "*|innerhtml",
@@ -15793,7 +15917,7 @@ function isTrustedTypesSink(tagName, propName) {
15793
15917
  return TRUSTED_TYPES_SINKS.has(tagName + "|" + propName) || TRUSTED_TYPES_SINKS.has("*|" + propName);
15794
15918
  }
15795
15919
 
15796
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/meta.mjs
15920
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/meta.mjs
15797
15921
  var setI18nRefs = (htmlNode, i18nNode) => {
15798
15922
  if (htmlNode instanceof NodeWithI18n) {
15799
15923
  if (i18nNode instanceof IcuPlaceholder && htmlNode.i18n instanceof Message) {
@@ -15950,7 +16074,7 @@ function i18nMetaToJSDoc(meta) {
15950
16074
  return jsDocComment(tags);
15951
16075
  }
15952
16076
 
15953
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/get_msg_utils.mjs
16077
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/get_msg_utils.mjs
15954
16078
  var GOOG_GET_MSG = "goog.getMsg";
15955
16079
  function createGoogleGetMsgStatements(variable2, message, closureVar, placeholderValues) {
15956
16080
  const messageString = serializeI18nMessageForGetMsg(message);
@@ -16001,7 +16125,7 @@ function serializeI18nMessageForGetMsg(message) {
16001
16125
  return message.nodes.map((node) => node.visit(serializerVisitor2, null)).join("");
16002
16126
  }
16003
16127
 
16004
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/localize_utils.mjs
16128
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/localize_utils.mjs
16005
16129
  function createLocalizeStatements(variable2, message, params) {
16006
16130
  const { messageParts, placeHolders } = serializeI18nMessageForLocalize(message);
16007
16131
  const sourceSpan = getSourceSpan(message);
@@ -16090,13 +16214,13 @@ function createEmptyMessagePart(location) {
16090
16214
  return new LiteralPiece("", new ParseSourceSpan(location, location));
16091
16215
  }
16092
16216
 
16093
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
16217
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
16094
16218
  var NG_I18N_CLOSURE_MODE = "ngI18nClosureMode";
16095
16219
  var TRANSLATION_VAR_PREFIX2 = "i18n_";
16096
16220
  var I18N_ICU_MAPPING_PREFIX2 = "I18N_EXP_";
16097
16221
  var ESCAPE2 = "\uFFFD";
16098
16222
  function collectI18nConsts(job) {
16099
- var _a2;
16223
+ var _a2, _b2;
16100
16224
  const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
16101
16225
  const extractedAttributesByI18nContext = /* @__PURE__ */ new Map();
16102
16226
  const i18nAttributesByElement = /* @__PURE__ */ new Map();
@@ -16105,11 +16229,13 @@ function collectI18nConsts(job) {
16105
16229
  for (const unit of job.units) {
16106
16230
  for (const op of unit.ops()) {
16107
16231
  if (op.kind === OpKind.ExtractedAttribute && op.i18nContext !== null) {
16108
- extractedAttributesByI18nContext.set(op.i18nContext, op);
16232
+ const attributes = (_a2 = extractedAttributesByI18nContext.get(op.i18nContext)) != null ? _a2 : [];
16233
+ attributes.push(op);
16234
+ extractedAttributesByI18nContext.set(op.i18nContext, attributes);
16109
16235
  } else if (op.kind === OpKind.I18nAttributes) {
16110
16236
  i18nAttributesByElement.set(op.target, op);
16111
16237
  } else if (op.kind === OpKind.I18nExpression && op.usage === I18nExpressionFor.I18nAttribute) {
16112
- const expressions = (_a2 = i18nExpressionsByElement.get(op.target)) != null ? _a2 : [];
16238
+ const expressions = (_b2 = i18nExpressionsByElement.get(op.target)) != null ? _b2 : [];
16113
16239
  expressions.push(op);
16114
16240
  i18nExpressionsByElement.set(op.target, expressions);
16115
16241
  } else if (op.kind === OpKind.I18nMessage) {
@@ -16130,9 +16256,11 @@ function collectI18nConsts(job) {
16130
16256
  } else {
16131
16257
  job.constsInitializers.push(...statements);
16132
16258
  i18nValuesByContext.set(op.i18nContext, mainVar);
16133
- const attributeForMessage = extractedAttributesByI18nContext.get(op.i18nContext);
16134
- if (attributeForMessage !== void 0) {
16135
- attributeForMessage.expression = mainVar;
16259
+ const attributesForMessage = extractedAttributesByI18nContext.get(op.i18nContext);
16260
+ if (attributesForMessage !== void 0) {
16261
+ for (const attr of attributesForMessage) {
16262
+ attr.expression = mainVar.clone();
16263
+ }
16136
16264
  }
16137
16265
  }
16138
16266
  }
@@ -16197,7 +16325,7 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
16197
16325
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
16198
16326
  const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
16199
16327
  let transformFn = void 0;
16200
- if (messageOp.needsPostprocessing) {
16328
+ if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
16201
16329
  const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
16202
16330
  const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
16203
16331
  const extraTransformFnParams = [];
@@ -16216,7 +16344,6 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
16216
16344
  } else {
16217
16345
  messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
16218
16346
  messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
16219
- messageOp.needsPostprocessing = true;
16220
16347
  }
16221
16348
  }
16222
16349
  }
@@ -16248,14 +16375,15 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
16248
16375
  return variable(name);
16249
16376
  }
16250
16377
 
16251
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
16378
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
16252
16379
  function convertI18nText(job) {
16253
- var _a2;
16380
+ var _a2, _b2, _c2;
16254
16381
  for (const unit of job.units) {
16255
16382
  let currentI18n = null;
16256
16383
  let currentIcu = null;
16257
16384
  const textNodeI18nBlocks = /* @__PURE__ */ new Map();
16258
16385
  const textNodeIcus = /* @__PURE__ */ new Map();
16386
+ const icuPlaceholderByText = /* @__PURE__ */ new Map();
16259
16387
  for (const op of unit.create) {
16260
16388
  switch (op.kind) {
16261
16389
  case OpKind.I18nStart:
@@ -16280,7 +16408,13 @@ function convertI18nText(job) {
16280
16408
  if (currentI18n !== null) {
16281
16409
  textNodeI18nBlocks.set(op.xref, currentI18n);
16282
16410
  textNodeIcus.set(op.xref, currentIcu);
16283
- OpList.remove(op);
16411
+ if (op.icuPlaceholder !== null) {
16412
+ const icuPlaceholderOp = createIcuPlaceholderOp(job.allocateXrefId(), op.icuPlaceholder, [op.initialValue]);
16413
+ OpList.replace(op, icuPlaceholderOp);
16414
+ icuPlaceholderByText.set(op.xref, icuPlaceholderOp);
16415
+ } else {
16416
+ OpList.remove(op);
16417
+ }
16284
16418
  }
16285
16419
  break;
16286
16420
  }
@@ -16293,21 +16427,25 @@ function convertI18nText(job) {
16293
16427
  }
16294
16428
  const i18nOp = textNodeI18nBlocks.get(op.target);
16295
16429
  const icuOp = textNodeIcus.get(op.target);
16430
+ const icuPlaceholder = icuPlaceholderByText.get(op.target);
16296
16431
  const contextId = icuOp ? icuOp.context : i18nOp.context;
16297
16432
  const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
16298
16433
  const ops = [];
16299
16434
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
16300
16435
  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));
16436
+ 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
16437
  }
16303
16438
  OpList.replaceWithMany(op, ops);
16439
+ if (icuPlaceholder !== void 0) {
16440
+ icuPlaceholder.strings = op.interpolation.strings;
16441
+ }
16304
16442
  break;
16305
16443
  }
16306
16444
  }
16307
16445
  }
16308
16446
  }
16309
16447
 
16310
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
16448
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
16311
16449
  function liftLocalRefs(job) {
16312
16450
  for (const unit of job.units) {
16313
16451
  for (const op of unit.create) {
@@ -16337,7 +16475,7 @@ function serializeLocalRefs(refs) {
16337
16475
  return literalArr(constRefs);
16338
16476
  }
16339
16477
 
16340
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
16478
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
16341
16479
  function emitNamespaceChanges(job) {
16342
16480
  for (const unit of job.units) {
16343
16481
  let activeNamespace = Namespace.HTML;
@@ -16353,7 +16491,7 @@ function emitNamespaceChanges(job) {
16353
16491
  }
16354
16492
  }
16355
16493
 
16356
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
16494
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
16357
16495
  function parse(value) {
16358
16496
  const styles = [];
16359
16497
  let i = 0;
@@ -16414,7 +16552,7 @@ function hyphenate2(value) {
16414
16552
  }).toLowerCase();
16415
16553
  }
16416
16554
 
16417
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
16555
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
16418
16556
  function nameFunctionsAndVariables(job) {
16419
16557
  addNamesToView(job.root, job.componentName, { index: 0 }, job.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
16420
16558
  }
@@ -16451,7 +16589,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
16451
16589
  op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
16452
16590
  break;
16453
16591
  case OpKind.Variable:
16454
- varNames.set(op.xref, getVariableName(op.variable, state));
16592
+ varNames.set(op.xref, getVariableName(unit, op.variable, state));
16455
16593
  break;
16456
16594
  case OpKind.RepeaterCreate:
16457
16595
  if (!(unit instanceof ViewCompilationUnit)) {
@@ -16502,14 +16640,19 @@ function addNamesToView(unit, baseName, state, compatibility) {
16502
16640
  });
16503
16641
  }
16504
16642
  }
16505
- function getVariableName(variable2, state) {
16643
+ function getVariableName(unit, variable2, state) {
16506
16644
  if (variable2.name === null) {
16507
16645
  switch (variable2.kind) {
16508
16646
  case SemanticVariableKind.Context:
16509
16647
  variable2.name = `ctx_r${state.index++}`;
16510
16648
  break;
16511
16649
  case SemanticVariableKind.Identifier:
16512
- variable2.name = `${variable2.identifier}_r${++state.index}`;
16650
+ if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
16651
+ const compatPrefix = variable2.identifier === "ctx" ? "i" : "";
16652
+ variable2.name = `${variable2.identifier}_${compatPrefix}r${++state.index}`;
16653
+ } else {
16654
+ variable2.name = `${variable2.identifier}_i${state.index++}`;
16655
+ }
16513
16656
  break;
16514
16657
  default:
16515
16658
  variable2.name = `_r${++state.index}`;
@@ -16529,7 +16672,7 @@ function stripImportant(name) {
16529
16672
  return name;
16530
16673
  }
16531
16674
 
16532
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
16675
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
16533
16676
  function mergeNextContextExpressions(job) {
16534
16677
  for (const unit of job.units) {
16535
16678
  for (const op of unit.create) {
@@ -16575,7 +16718,7 @@ function mergeNextContextsInOps(ops) {
16575
16718
  }
16576
16719
  }
16577
16720
 
16578
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
16721
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
16579
16722
  var CONTAINER_TAG = "ng-container";
16580
16723
  function generateNgContainerOps(job) {
16581
16724
  for (const unit of job.units) {
@@ -16592,7 +16735,7 @@ function generateNgContainerOps(job) {
16592
16735
  }
16593
16736
  }
16594
16737
 
16595
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nonbindable.mjs
16738
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nonbindable.mjs
16596
16739
  function lookupElement3(elements, xref) {
16597
16740
  const el = elements.get(xref);
16598
16741
  if (el === void 0) {
@@ -16622,7 +16765,7 @@ function disableBindings(job) {
16622
16765
  }
16623
16766
  }
16624
16767
 
16625
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
16768
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
16626
16769
  function generateNullishCoalesceExpressions(job) {
16627
16770
  for (const unit of job.units) {
16628
16771
  for (const op of unit.ops()) {
@@ -16638,7 +16781,7 @@ function generateNullishCoalesceExpressions(job) {
16638
16781
  }
16639
16782
  }
16640
16783
 
16641
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ordering.mjs
16784
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ordering.mjs
16642
16785
  function kindTest(kind) {
16643
16786
  return (op) => op.kind === kind;
16644
16787
  }
@@ -16652,17 +16795,24 @@ var CREATE_ORDERING = [
16652
16795
  { test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
16653
16796
  ];
16654
16797
  var UPDATE_ORDERING = [
16655
- { test: kindWithInterpolationTest(OpKind.HostProperty, true) },
16656
- { test: kindWithInterpolationTest(OpKind.HostProperty, false) },
16657
16798
  { test: kindTest(OpKind.StyleMap), transform: keepLast },
16658
16799
  { test: kindTest(OpKind.ClassMap), transform: keepLast },
16659
16800
  { test: kindTest(OpKind.StyleProp) },
16660
16801
  { test: kindTest(OpKind.ClassProp) },
16661
- { test: kindWithInterpolationTest(OpKind.Property, true) },
16662
16802
  { test: kindWithInterpolationTest(OpKind.Attribute, true) },
16803
+ { test: kindWithInterpolationTest(OpKind.Property, true) },
16663
16804
  { test: kindWithInterpolationTest(OpKind.Property, false) },
16664
16805
  { test: kindWithInterpolationTest(OpKind.Attribute, false) }
16665
16806
  ];
16807
+ var UPDATE_HOST_ORDERING = [
16808
+ { test: kindWithInterpolationTest(OpKind.HostProperty, true) },
16809
+ { test: kindWithInterpolationTest(OpKind.HostProperty, false) },
16810
+ { test: kindTest(OpKind.Attribute) },
16811
+ { test: kindTest(OpKind.StyleMap), transform: keepLast },
16812
+ { test: kindTest(OpKind.ClassMap), transform: keepLast },
16813
+ { test: kindTest(OpKind.StyleProp) },
16814
+ { test: kindTest(OpKind.ClassProp) }
16815
+ ];
16666
16816
  var handledOpKinds = /* @__PURE__ */ new Set([
16667
16817
  OpKind.Listener,
16668
16818
  OpKind.StyleMap,
@@ -16676,7 +16826,8 @@ var handledOpKinds = /* @__PURE__ */ new Set([
16676
16826
  function orderOps(job) {
16677
16827
  for (const unit of job.units) {
16678
16828
  orderWithin(unit.create, CREATE_ORDERING);
16679
- orderWithin(unit.update, UPDATE_ORDERING);
16829
+ const ordering = unit.job.kind === CompilationJobKind.Host ? UPDATE_HOST_ORDERING : UPDATE_ORDERING;
16830
+ orderWithin(unit.update, ordering);
16680
16831
  }
16681
16832
  }
16682
16833
  function orderWithin(opList, ordering) {
@@ -16712,21 +16863,33 @@ function keepLast(ops) {
16712
16863
  return ops.slice(ops.length - 1);
16713
16864
  }
16714
16865
 
16715
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
16866
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
16716
16867
  function parseExtractedStyles(job) {
16868
+ const elements = /* @__PURE__ */ new Map();
16869
+ for (const unit of job.units) {
16870
+ for (const op of unit.create) {
16871
+ if (isElementOrContainerOp(op)) {
16872
+ elements.set(op.xref, op);
16873
+ }
16874
+ }
16875
+ }
16717
16876
  for (const unit of job.units) {
16718
16877
  for (const op of unit.create) {
16719
16878
  if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
16879
+ const target = elements.get(op.target);
16880
+ if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
16881
+ continue;
16882
+ }
16720
16883
  if (op.name === "style") {
16721
16884
  const parsedStyles = parse(op.expression.value);
16722
16885
  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);
16886
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
16724
16887
  }
16725
16888
  OpList.remove(op);
16726
16889
  } else if (op.name === "class") {
16727
16890
  const parsedClasses = op.expression.value.trim().split(/\s+/g);
16728
16891
  for (const parsedClass of parsedClasses) {
16729
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null), op);
16892
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
16730
16893
  }
16731
16894
  OpList.remove(op);
16732
16895
  }
@@ -16735,7 +16898,7 @@ function parseExtractedStyles(job) {
16735
16898
  }
16736
16899
  }
16737
16900
 
16738
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs
16901
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs
16739
16902
  function removeContentSelectors(job) {
16740
16903
  for (const unit of job.units) {
16741
16904
  const elements = createOpXrefMap(unit);
@@ -16747,13 +16910,6 @@ function removeContentSelectors(job) {
16747
16910
  OpList.remove(op);
16748
16911
  }
16749
16912
  break;
16750
- case OpKind.Projection:
16751
- for (let i = op.attributes.length - 2; i >= 0; i -= 2) {
16752
- if (isSelectAttribute(op.attributes[i])) {
16753
- op.attributes.splice(i, 2);
16754
- }
16755
- }
16756
- break;
16757
16913
  }
16758
16914
  }
16759
16915
  }
@@ -16769,7 +16925,7 @@ function lookupInXrefMap(map, xref) {
16769
16925
  return el;
16770
16926
  }
16771
16927
 
16772
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
16928
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
16773
16929
  function createPipes(job) {
16774
16930
  for (const unit of job.units) {
16775
16931
  processPipeBindingsInView(unit);
@@ -16817,7 +16973,7 @@ function addPipeToCreationBlock(unit, afterTargetXref, binding) {
16817
16973
  throw new Error(`AssertionError: unable to find insertion point for pipe ${binding.name}`);
16818
16974
  }
16819
16975
 
16820
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
16976
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
16821
16977
  function createVariadicPipes(job) {
16822
16978
  for (const unit of job.units) {
16823
16979
  for (const op of unit.update) {
@@ -16834,7 +16990,7 @@ function createVariadicPipes(job) {
16834
16990
  }
16835
16991
  }
16836
16992
 
16837
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs
16993
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs
16838
16994
  function propagateI18nBlocks(job) {
16839
16995
  propagateI18nBlocksToTemplates(job.root, 0);
16840
16996
  }
@@ -16853,29 +17009,42 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
16853
17009
  i18nBlock = null;
16854
17010
  break;
16855
17011
  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);
17012
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
17013
+ break;
17014
+ case OpKind.RepeaterCreate:
17015
+ const forView = unit.job.views.get(op.xref);
17016
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
17017
+ if (op.emptyView !== null) {
17018
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.emptyView), i18nBlock, op.emptyI18nPlaceholder, subTemplateIndex);
16863
17019
  }
16864
- subTemplateIndex = propagateI18nBlocksToTemplates(templateView, subTemplateIndex);
17020
+ break;
16865
17021
  }
16866
17022
  }
16867
17023
  return subTemplateIndex;
16868
17024
  }
17025
+ function propagateI18nBlocksForView(view, i18nBlock, i18nPlaceholder, subTemplateIndex) {
17026
+ if (i18nPlaceholder !== void 0) {
17027
+ if (i18nBlock === null) {
17028
+ throw Error("Expected template with i18n placeholder to be in an i18n block.");
17029
+ }
17030
+ subTemplateIndex++;
17031
+ wrapTemplateWithI18n(view, i18nBlock);
17032
+ }
17033
+ return propagateI18nBlocksToTemplates(view, subTemplateIndex);
17034
+ }
16869
17035
  function wrapTemplateWithI18n(unit, parentI18n) {
16870
17036
  var _a2;
16871
17037
  if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
16872
17038
  const id = unit.job.allocateXrefId();
16873
- OpList.insertAfter(createI18nStartOp(id, parentI18n.message, parentI18n.root), unit.create.head);
16874
- OpList.insertBefore(createI18nEndOp(id), unit.create.tail);
17039
+ OpList.insertAfter(
17040
+ createI18nStartOp(id, parentI18n.message, parentI18n.root, null),
17041
+ unit.create.head
17042
+ );
17043
+ OpList.insertBefore(createI18nEndOp(id, null), unit.create.tail);
16875
17044
  }
16876
17045
  }
16877
17046
 
16878
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
17047
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
16879
17048
  function extractPureFunctions(job) {
16880
17049
  for (const view of job.units) {
16881
17050
  for (const op of view.ops()) {
@@ -16917,7 +17086,7 @@ var PureFunctionConstant = class extends GenericKeyFn {
16917
17086
  }
16918
17087
  };
16919
17088
 
16920
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
17089
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
16921
17090
  function generatePureLiteralStructures(job) {
16922
17091
  for (const unit of job.units) {
16923
17092
  for (const op of unit.update) {
@@ -16964,7 +17133,7 @@ function transformLiteralMap(expr) {
16964
17133
  return new PureFunctionExpr(literalMap(derivedEntries), nonConstantArgs);
16965
17134
  }
16966
17135
 
16967
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/instruction.mjs
17136
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/instruction.mjs
16968
17137
  function element(slot, tag, constIndex, localRefIndex, sourceSpan) {
16969
17138
  return elementOrContainerBase(Identifiers.element, slot, tag, constIndex, localRefIndex, sourceSpan);
16970
17139
  }
@@ -17022,17 +17191,13 @@ function disableBindings2() {
17022
17191
  function enableBindings() {
17023
17192
  return call(Identifiers.enableBindings, [], null);
17024
17193
  }
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);
17194
+ function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
17195
+ const args = [literal(name), handlerFn];
17196
+ if (eventTargetResolver !== null) {
17197
+ args.push(literal(false));
17198
+ args.push(importExpr(eventTargetResolver));
17199
+ }
17200
+ return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
17036
17201
  }
17037
17202
  function pipe(slot, name) {
17038
17203
  return call(Identifiers.pipe, [
@@ -17130,22 +17295,22 @@ function projectionDef(def) {
17130
17295
  }
17131
17296
  function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
17132
17297
  const args = [literal(slot)];
17133
- if (projectionSlotIndex !== 0 || attributes.length > 0) {
17298
+ if (projectionSlotIndex !== 0 || attributes !== null) {
17134
17299
  args.push(literal(projectionSlotIndex));
17135
- if (attributes.length > 0) {
17136
- args.push(literalArr(attributes.map((attr) => literal(attr))));
17300
+ if (attributes !== null) {
17301
+ args.push(attributes);
17137
17302
  }
17138
17303
  }
17139
17304
  return call(Identifiers.projection, args, sourceSpan);
17140
17305
  }
17141
- function i18nStart(slot, constIndex, subTemplateIndex) {
17306
+ function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
17142
17307
  const args = [literal(slot), literal(constIndex)];
17143
17308
  if (subTemplateIndex !== null) {
17144
17309
  args.push(literal(subTemplateIndex));
17145
17310
  }
17146
- return call(Identifiers.i18nStart, args, null);
17311
+ return call(Identifiers.i18nStart, args, sourceSpan);
17147
17312
  }
17148
- function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, sourceSpan) {
17313
+ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
17149
17314
  const args = [
17150
17315
  literal(slot),
17151
17316
  variable(viewFnName),
@@ -17159,6 +17324,12 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
17159
17324
  args.push(literal(trackByUsesComponentInstance));
17160
17325
  if (emptyViewFnName !== null) {
17161
17326
  args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
17327
+ if (emptyTag !== null || emptyConstIndex !== null) {
17328
+ args.push(literal(emptyTag));
17329
+ }
17330
+ if (emptyConstIndex !== null) {
17331
+ args.push(literal(emptyConstIndex));
17332
+ }
17162
17333
  }
17163
17334
  }
17164
17335
  return call(Identifiers.repeaterCreate, args, sourceSpan);
@@ -17169,15 +17340,15 @@ function repeater(collection, sourceSpan) {
17169
17340
  function deferWhen(prefetch, expr, sourceSpan) {
17170
17341
  return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
17171
17342
  }
17172
- function i18n(slot, constIndex, subTemplateIndex) {
17343
+ function i18n(slot, constIndex, subTemplateIndex, sourceSpan) {
17173
17344
  const args = [literal(slot), literal(constIndex)];
17174
17345
  if (subTemplateIndex) {
17175
17346
  args.push(literal(subTemplateIndex));
17176
17347
  }
17177
- return call(Identifiers.i18n, args, null);
17348
+ return call(Identifiers.i18n, args, sourceSpan);
17178
17349
  }
17179
- function i18nEnd() {
17180
- return call(Identifiers.i18nEnd, [], null);
17350
+ function i18nEnd(endSourceSpan) {
17351
+ return call(Identifiers.i18nEnd, [], endSourceSpan);
17181
17352
  }
17182
17353
  function i18nAttributes(slot, i18nAttributesConfig) {
17183
17354
  const args = [literal(slot), literal(i18nAttributesConfig)];
@@ -17291,8 +17462,12 @@ function classMapInterpolate(strings, expressions, sourceSpan) {
17291
17462
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
17292
17463
  return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
17293
17464
  }
17294
- function hostProperty(name, expression, sourceSpan) {
17295
- return call(Identifiers.hostProperty, [literal(name), expression], sourceSpan);
17465
+ function hostProperty(name, expression, sanitizer, sourceSpan) {
17466
+ const args = [literal(name), expression];
17467
+ if (sanitizer !== null) {
17468
+ args.push(sanitizer);
17469
+ }
17470
+ return call(Identifiers.hostProperty, args, sourceSpan);
17296
17471
  }
17297
17472
  function syntheticHostProperty(name, expression, sourceSpan) {
17298
17473
  return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
@@ -17479,14 +17654,11 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
17479
17654
  return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan).toStmt());
17480
17655
  }
17481
17656
 
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]
17657
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/reify.mjs
17658
+ var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([
17659
+ ["window", Identifiers.resolveWindow],
17660
+ ["document", Identifiers.resolveDocument],
17661
+ ["body", Identifiers.resolveBody]
17490
17662
  ]);
17491
17663
  function reify(job) {
17492
17664
  for (const unit of job.units) {
@@ -17503,31 +17675,31 @@ function reifyCreateOperations(unit, ops) {
17503
17675
  OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
17504
17676
  break;
17505
17677
  case OpKind.ElementStart:
17506
- OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17678
+ OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
17507
17679
  break;
17508
17680
  case OpKind.Element:
17509
- OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17681
+ OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
17510
17682
  break;
17511
17683
  case OpKind.ElementEnd:
17512
17684
  OpList.replace(op, elementEnd(op.sourceSpan));
17513
17685
  break;
17514
17686
  case OpKind.ContainerStart:
17515
- OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
17687
+ OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
17516
17688
  break;
17517
17689
  case OpKind.Container:
17518
- OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
17690
+ OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
17519
17691
  break;
17520
17692
  case OpKind.ContainerEnd:
17521
17693
  OpList.replace(op, elementContainerEnd());
17522
17694
  break;
17523
17695
  case OpKind.I18nStart:
17524
- OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex));
17696
+ OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
17525
17697
  break;
17526
17698
  case OpKind.I18nEnd:
17527
- OpList.replace(op, i18nEnd());
17699
+ OpList.replace(op, i18nEnd(op.sourceSpan));
17528
17700
  break;
17529
17701
  case OpKind.I18n:
17530
- OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
17702
+ OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
17531
17703
  break;
17532
17704
  case OpKind.I18nAttributes:
17533
17705
  if (op.i18nAttributesConfig === null) {
@@ -17543,7 +17715,7 @@ function reifyCreateOperations(unit, ops) {
17543
17715
  throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
17544
17716
  }
17545
17717
  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));
17718
+ OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
17547
17719
  break;
17548
17720
  case OpKind.DisableBindings:
17549
17721
  OpList.replace(op, disableBindings2());
@@ -17556,8 +17728,11 @@ function reifyCreateOperations(unit, ops) {
17556
17728
  break;
17557
17729
  case OpKind.Listener:
17558
17730
  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);
17731
+ const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
17732
+ if (eventTargetResolver === void 0) {
17733
+ throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
17734
+ }
17735
+ OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
17561
17736
  break;
17562
17737
  case OpKind.Variable:
17563
17738
  if (op.variable.name === null) {
@@ -17642,7 +17817,7 @@ function reifyCreateOperations(unit, ops) {
17642
17817
  emptyDecls = emptyView.decls;
17643
17818
  emptyVars = emptyView.vars;
17644
17819
  }
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));
17820
+ 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.emptyTag, op.emptyAttributes, op.wholeSourceSpan));
17646
17821
  break;
17647
17822
  case OpKind.Statement:
17648
17823
  break;
@@ -17712,7 +17887,7 @@ function reifyUpdateOperations(_unit, ops) {
17712
17887
  if (op.isAnimationTrigger) {
17713
17888
  OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
17714
17889
  } else {
17715
- OpList.replace(op, hostProperty(op.name, op.expression, op.sourceSpan));
17890
+ OpList.replace(op, hostProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
17716
17891
  }
17717
17892
  }
17718
17893
  break;
@@ -17790,8 +17965,6 @@ function reifyIrExpression(expr) {
17790
17965
  return pipeBind(expr.targetSlot.slot, expr.varOffset, expr.args);
17791
17966
  case ExpressionKind.PipeBindingVariadic:
17792
17967
  return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
17793
- case ExpressionKind.SanitizerExpr:
17794
- return importExpr(sanitizerIdentifierMap.get(expr.fn));
17795
17968
  case ExpressionKind.SlotLiteralExpr:
17796
17969
  return literal(expr.slot.slot);
17797
17970
  default:
@@ -17814,7 +17987,7 @@ function reifyListenerHandler(unit, name, handlerOps, consumesDollarEvent) {
17814
17987
  return fn(params, handlerStmts, void 0, void 0, name);
17815
17988
  }
17816
17989
 
17817
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_empty_bindings.mjs
17990
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_empty_bindings.mjs
17818
17991
  function removeEmptyBindings(job) {
17819
17992
  for (const unit of job.units) {
17820
17993
  for (const op of unit.update) {
@@ -17835,7 +18008,7 @@ function removeEmptyBindings(job) {
17835
18008
  }
17836
18009
  }
17837
18010
 
17838
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_i18n_contexts.mjs
18011
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_i18n_contexts.mjs
17839
18012
  function removeI18nContexts(job) {
17840
18013
  for (const unit of job.units) {
17841
18014
  for (const op of unit.create) {
@@ -17851,7 +18024,7 @@ function removeI18nContexts(job) {
17851
18024
  }
17852
18025
  }
17853
18026
 
17854
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_unused_i18n_attrs.mjs
18027
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_unused_i18n_attrs.mjs
17855
18028
  function removeUnusedI18nAttributesOps(job) {
17856
18029
  for (const unit of job.units) {
17857
18030
  const ownersWithI18nExpressions = /* @__PURE__ */ new Set();
@@ -17873,7 +18046,7 @@ function removeUnusedI18nAttributesOps(job) {
17873
18046
  }
17874
18047
  }
17875
18048
 
17876
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
18049
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
17877
18050
  function generateRepeaterDerivedVars(job) {
17878
18051
  const repeaters = /* @__PURE__ */ new Map();
17879
18052
  for (const unit of job.units) {
@@ -17905,7 +18078,7 @@ function generateRepeaterDerivedVars(job) {
17905
18078
  }
17906
18079
  }
17907
18080
 
17908
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
18081
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
17909
18082
  function resolveContexts(job) {
17910
18083
  for (const unit of job.units) {
17911
18084
  processLexicalScope(unit, unit.create);
@@ -17946,7 +18119,7 @@ function processLexicalScope(view, ops) {
17946
18119
  }
17947
18120
  }
17948
18121
 
17949
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
18122
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
17950
18123
  function resolveDollarEvent(job) {
17951
18124
  for (const unit of job.units) {
17952
18125
  transformDollarEvent(unit, unit.create);
@@ -17967,7 +18140,7 @@ function transformDollarEvent(unit, ops) {
17967
18140
  }
17968
18141
  }
17969
18142
 
17970
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
18143
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
17971
18144
  function resolveI18nElementPlaceholders(job) {
17972
18145
  const i18nContexts = /* @__PURE__ */ new Map();
17973
18146
  const elements = /* @__PURE__ */ new Map();
@@ -18032,18 +18205,52 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingSt
18032
18205
  }
18033
18206
  break;
18034
18207
  case OpKind.Template:
18208
+ const view = job.views.get(op.xref);
18035
18209
  if (op.i18nPlaceholder === void 0) {
18036
- resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements);
18210
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
18037
18211
  } else {
18038
18212
  if (currentOps === null) {
18039
18213
  throw Error("i18n tag placeholder should only occur inside an i18n block");
18040
18214
  }
18041
18215
  if (op.templateKind === TemplateKind.Structural) {
18042
- resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements, op);
18216
+ resolvePlaceholdersForView(job, view, i18nContexts, elements, op);
18043
18217
  } 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);
18218
+ recordTemplateStart(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18219
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
18220
+ recordTemplateClose(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18221
+ pendingStructuralDirective = void 0;
18222
+ }
18223
+ }
18224
+ break;
18225
+ case OpKind.RepeaterCreate:
18226
+ if (pendingStructuralDirective !== void 0) {
18227
+ throw Error("AssertionError: Unexpected structural directive associated with @for block");
18228
+ }
18229
+ const forSlot = op.handle.slot + 1;
18230
+ const forView = job.views.get(op.xref);
18231
+ if (op.i18nPlaceholder === void 0) {
18232
+ resolvePlaceholdersForView(job, forView, i18nContexts, elements);
18233
+ } else {
18234
+ if (currentOps === null) {
18235
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
18236
+ }
18237
+ recordTemplateStart(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18238
+ resolvePlaceholdersForView(job, forView, i18nContexts, elements);
18239
+ recordTemplateClose(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18240
+ pendingStructuralDirective = void 0;
18241
+ }
18242
+ if (op.emptyView !== null) {
18243
+ const emptySlot = op.handle.slot + 2;
18244
+ const emptyView = job.views.get(op.emptyView);
18245
+ if (op.emptyI18nPlaceholder === void 0) {
18246
+ resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
18247
+ } else {
18248
+ if (currentOps === null) {
18249
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
18250
+ }
18251
+ recordTemplateStart(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18252
+ resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
18253
+ recordTemplateClose(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18047
18254
  pendingStructuralDirective = void 0;
18048
18255
  }
18049
18256
  }
@@ -18076,8 +18283,8 @@ function recordElementClose(op, i18nContext, i18nBlock, structuralDirective) {
18076
18283
  addParam(i18nContext.params, closeName, value, i18nBlock.subTemplateIndex, flags);
18077
18284
  }
18078
18285
  }
18079
- function recordTemplateStart(job, op, i18nContext, i18nBlock, structuralDirective) {
18080
- let { startName, closeName } = op.i18nPlaceholder;
18286
+ function recordTemplateStart(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
18287
+ let { startName, closeName } = i18nPlaceholder;
18081
18288
  let flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.OpenTag;
18082
18289
  if (!closeName) {
18083
18290
  flags |= I18nParamValueFlags.CloseTag;
@@ -18085,20 +18292,20 @@ function recordTemplateStart(job, op, i18nContext, i18nBlock, structuralDirectiv
18085
18292
  if (structuralDirective !== void 0) {
18086
18293
  addParam(i18nContext.params, startName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
18087
18294
  }
18088
- addParam(i18nContext.params, startName, op.handle.slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, op), flags);
18295
+ addParam(i18nContext.params, startName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
18089
18296
  }
18090
- function recordTemplateClose(job, op, i18nContext, i18nBlock, structuralDirective) {
18091
- const { startName, closeName } = op.i18nPlaceholder;
18297
+ function recordTemplateClose(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
18298
+ const { startName, closeName } = i18nPlaceholder;
18092
18299
  const flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag;
18093
18300
  if (closeName) {
18094
- addParam(i18nContext.params, closeName, op.handle.slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, op), flags);
18301
+ addParam(i18nContext.params, closeName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
18095
18302
  if (structuralDirective !== void 0) {
18096
18303
  addParam(i18nContext.params, closeName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
18097
18304
  }
18098
18305
  }
18099
18306
  }
18100
- function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
18101
- for (const childOp of job.views.get(op.xref).create) {
18307
+ function getSubTemplateIndexForTemplateTag(job, i18nOp, view) {
18308
+ for (const childOp of view.create) {
18102
18309
  if (childOp.kind === OpKind.I18nStart) {
18103
18310
  return childOp.subTemplateIndex;
18104
18311
  }
@@ -18112,11 +18319,12 @@ function addParam(params, placeholder, value, subTemplateIndex, flags) {
18112
18319
  params.set(placeholder, values);
18113
18320
  }
18114
18321
 
18115
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
18322
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
18116
18323
  function resolveI18nExpressionPlaceholders(job) {
18117
18324
  var _a2;
18118
18325
  const subTemplateIndicies = /* @__PURE__ */ new Map();
18119
18326
  const i18nContexts = /* @__PURE__ */ new Map();
18327
+ const icuPlaceholders = /* @__PURE__ */ new Map();
18120
18328
  for (const unit of job.units) {
18121
18329
  for (const op of unit.create) {
18122
18330
  switch (op.kind) {
@@ -18126,6 +18334,9 @@ function resolveI18nExpressionPlaceholders(job) {
18126
18334
  case OpKind.I18nContext:
18127
18335
  i18nContexts.set(op.xref, op);
18128
18336
  break;
18337
+ case OpKind.IcuPlaceholder:
18338
+ icuPlaceholders.set(op.xref, op);
18339
+ break;
18129
18340
  }
18130
18341
  }
18131
18342
  }
@@ -18134,68 +18345,34 @@ function resolveI18nExpressionPlaceholders(job) {
18134
18345
  for (const unit of job.units) {
18135
18346
  for (const op of unit.update) {
18136
18347
  if (op.kind === OpKind.I18nExpression) {
18137
- const i18nContext = i18nContexts.get(op.context);
18138
18348
  const index = expressionIndices.get(referenceIndex(op)) || 0;
18139
18349
  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({
18350
+ const value = {
18143
18351
  value: index,
18144
18352
  subTemplateIndex,
18145
18353
  flags: I18nParamValueFlags.ExpressionIndex
18146
- });
18147
- params.set(op.i18nPlaceholder, values);
18354
+ };
18355
+ updatePlaceholder(op, value, i18nContexts, icuPlaceholders);
18148
18356
  expressionIndices.set(referenceIndex(op), index + 1);
18149
18357
  }
18150
18358
  }
18151
18359
  }
18152
18360
  }
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
- }
18187
- }
18188
- visitTagPlaceholder(placeholder) {
18189
- super.visitTagPlaceholder(placeholder);
18190
- this.visitContainerPlaceholder(placeholder);
18361
+ function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
18362
+ if (op.i18nPlaceholder !== null) {
18363
+ const i18nContext = i18nContexts.get(op.context);
18364
+ const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
18365
+ const values = params.get(op.i18nPlaceholder) || [];
18366
+ values.push(value);
18367
+ params.set(op.i18nPlaceholder, values);
18191
18368
  }
18192
- visitBlockPlaceholder(placeholder) {
18193
- super.visitBlockPlaceholder(placeholder);
18194
- this.visitContainerPlaceholder(placeholder);
18369
+ if (op.icuPlaceholder !== null) {
18370
+ const icuPlaceholderOp = icuPlaceholders.get(op.icuPlaceholder);
18371
+ icuPlaceholderOp == null ? void 0 : icuPlaceholderOp.expressionPlaceholders.push(value);
18195
18372
  }
18196
- };
18373
+ }
18197
18374
 
18198
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
18375
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
18199
18376
  function resolveNames(job) {
18200
18377
  for (const unit of job.units) {
18201
18378
  processLexicalScope2(unit, unit.create, null);
@@ -18259,31 +18436,55 @@ function processLexicalScope2(unit, ops, savedView) {
18259
18436
  }
18260
18437
  }
18261
18438
 
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]
18439
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_sanitizers.mjs
18440
+ var sanitizerFns = /* @__PURE__ */ new Map([
18441
+ [SecurityContext.HTML, Identifiers.sanitizeHtml],
18442
+ [SecurityContext.RESOURCE_URL, Identifiers.sanitizeResourceUrl],
18443
+ [SecurityContext.SCRIPT, Identifiers.sanitizeScript],
18444
+ [SecurityContext.STYLE, Identifiers.sanitizeStyle],
18445
+ [SecurityContext.URL, Identifiers.sanitizeUrl]
18446
+ ]);
18447
+ var trustedValueFns = /* @__PURE__ */ new Map([
18448
+ [SecurityContext.HTML, Identifiers.trustConstantHtml],
18449
+ [SecurityContext.RESOURCE_URL, Identifiers.trustConstantResourceUrl]
18269
18450
  ]);
18270
18451
  function resolveSanitizers(job) {
18452
+ var _a2, _b2;
18271
18453
  for (const unit of job.units) {
18272
18454
  const elements = createOpXrefMap(unit);
18273
- let sanitizerFn;
18455
+ if (job.kind !== CompilationJobKind.Host) {
18456
+ for (const op of unit.create) {
18457
+ if (op.kind === OpKind.ExtractedAttribute) {
18458
+ const trustedValueFn = (_a2 = trustedValueFns.get(getOnlySecurityContext(op.securityContext))) != null ? _a2 : null;
18459
+ op.trustedValueFn = trustedValueFn !== null ? importExpr(trustedValueFn) : null;
18460
+ }
18461
+ }
18462
+ }
18274
18463
  for (const op of unit.update) {
18275
18464
  switch (op.kind) {
18276
18465
  case OpKind.Property:
18277
18466
  case OpKind.Attribute:
18278
- sanitizerFn = sanitizers.get(op.securityContext) || null;
18279
- op.sanitizer = sanitizerFn ? new SanitizerExpr(sanitizerFn) : null;
18467
+ case OpKind.HostProperty:
18468
+ let sanitizerFn = null;
18469
+ if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
18470
+ sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
18471
+ } else {
18472
+ sanitizerFn = (_b2 = sanitizerFns.get(getOnlySecurityContext(op.securityContext))) != null ? _b2 : null;
18473
+ }
18474
+ op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
18280
18475
  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");
18476
+ let isIframe = false;
18477
+ if (job.kind === CompilationJobKind.Host || op.kind === OpKind.HostProperty) {
18478
+ isIframe = true;
18479
+ } else {
18480
+ const ownerOp = elements.get(op.target);
18481
+ if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
18482
+ throw Error("Property should have an element-like owner");
18483
+ }
18484
+ isIframe = isIframeElement(ownerOp);
18284
18485
  }
18285
- if (isIframeElement(ownerOp) && isIframeSecuritySensitiveAttr(op.name)) {
18286
- op.sanitizer = new SanitizerExpr(SanitizerFn.IframeAttribute);
18486
+ if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
18487
+ op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
18287
18488
  }
18288
18489
  }
18289
18490
  break;
@@ -18295,8 +18496,17 @@ function isIframeElement(op) {
18295
18496
  var _a2;
18296
18497
  return op.kind === OpKind.ElementStart && ((_a2 = op.tag) == null ? void 0 : _a2.toLowerCase()) === "iframe";
18297
18498
  }
18499
+ function getOnlySecurityContext(securityContext) {
18500
+ if (Array.isArray(securityContext)) {
18501
+ if (securityContext.length > 1) {
18502
+ throw Error(`AssertionError: Ambiguous security context`);
18503
+ }
18504
+ return securityContext[0] || SecurityContext.NONE;
18505
+ }
18506
+ return securityContext;
18507
+ }
18298
18508
 
18299
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
18509
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
18300
18510
  function saveAndRestoreView(job) {
18301
18511
  for (const unit of job.units) {
18302
18512
  unit.create.prepend([
@@ -18341,7 +18551,7 @@ function addSaveRestoreViewOperationToListener(unit, op) {
18341
18551
  }
18342
18552
  }
18343
18553
 
18344
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
18554
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
18345
18555
  function allocateSlots(job) {
18346
18556
  const slotMap = /* @__PURE__ */ new Map();
18347
18557
  for (const unit of job.units) {
@@ -18366,7 +18576,7 @@ function allocateSlots(job) {
18366
18576
  }
18367
18577
  }
18368
18578
 
18369
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/style_binding_specialization.mjs
18579
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/style_binding_specialization.mjs
18370
18580
  function specializeStyleBindings(job) {
18371
18581
  for (const unit of job.units) {
18372
18582
  for (const op of unit.update) {
@@ -18396,7 +18606,7 @@ function specializeStyleBindings(job) {
18396
18606
  }
18397
18607
  }
18398
18608
 
18399
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
18609
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
18400
18610
  function generateTemporaryVariables(job) {
18401
18611
  for (const unit of job.units) {
18402
18612
  unit.create.prepend(generateTemporaries(unit.create));
@@ -18454,7 +18664,7 @@ function assignName(names, expr) {
18454
18664
  expr.name = name;
18455
18665
  }
18456
18666
 
18457
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_generation.mjs
18667
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_generation.mjs
18458
18668
  function generateTrackFns(job) {
18459
18669
  for (const unit of job.units) {
18460
18670
  for (const op of unit.create) {
@@ -18466,6 +18676,9 @@ function generateTrackFns(job) {
18466
18676
  }
18467
18677
  let usesComponentContext = false;
18468
18678
  op.track = transformExpressionsInExpression(op.track, (expr) => {
18679
+ if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
18680
+ throw new Error(`Illegal State: Pipes are not allowed in this context`);
18681
+ }
18469
18682
  if (expr instanceof TrackContextExpr) {
18470
18683
  usesComponentContext = true;
18471
18684
  return variable("this");
@@ -18484,7 +18697,7 @@ function generateTrackFns(job) {
18484
18697
  }
18485
18698
  }
18486
18699
 
18487
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_optimization.mjs
18700
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_optimization.mjs
18488
18701
  function optimizeTrackFns(job) {
18489
18702
  for (const unit of job.units) {
18490
18703
  for (const op of unit.create) {
@@ -18531,7 +18744,7 @@ function isTrackByFunctionCall(rootView, expr) {
18531
18744
  return true;
18532
18745
  }
18533
18746
 
18534
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_variables.mjs
18747
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_variables.mjs
18535
18748
  function generateTrackVariables(job) {
18536
18749
  for (const unit of job.units) {
18537
18750
  for (const op of unit.create) {
@@ -18552,7 +18765,7 @@ function generateTrackVariables(job) {
18552
18765
  }
18553
18766
  }
18554
18767
 
18555
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
18768
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
18556
18769
  function countVariables(job) {
18557
18770
  for (const unit of job.units) {
18558
18771
  let varCount = 0;
@@ -18630,7 +18843,10 @@ function varsUsedByOp(op) {
18630
18843
  return op.interpolation.expressions.length;
18631
18844
  case OpKind.I18nExpression:
18632
18845
  case OpKind.Conditional:
18846
+ case OpKind.DeferWhen:
18633
18847
  return 1;
18848
+ case OpKind.RepeaterCreate:
18849
+ return op.emptyView ? 1 : 0;
18634
18850
  default:
18635
18851
  throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
18636
18852
  }
@@ -18657,7 +18873,7 @@ function isSingletonInterpolation(expr) {
18657
18873
  return true;
18658
18874
  }
18659
18875
 
18660
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
18876
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
18661
18877
  function optimizeVariables(job) {
18662
18878
  for (const unit of job.units) {
18663
18879
  inlineAlwaysInlineVariables(unit.create);
@@ -18907,7 +19123,7 @@ function allowConservativeInlining(decl, target) {
18907
19123
  }
18908
19124
  }
18909
19125
 
18910
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/wrap_icus.mjs
19126
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/wrap_icus.mjs
18911
19127
  function wrapI18nIcus(job) {
18912
19128
  for (const unit of job.units) {
18913
19129
  let currentI18nOp = null;
@@ -18923,12 +19139,12 @@ function wrapI18nIcus(job) {
18923
19139
  case OpKind.IcuStart:
18924
19140
  if (currentI18nOp === null) {
18925
19141
  addedI18nId = job.allocateXrefId();
18926
- OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
19142
+ OpList.insertBefore(createI18nStartOp(addedI18nId, op.message, void 0, null), op);
18927
19143
  }
18928
19144
  break;
18929
19145
  case OpKind.IcuEnd:
18930
19146
  if (addedI18nId !== null) {
18931
- OpList.insertAfter(createI18nEndOp(addedI18nId), op);
19147
+ OpList.insertAfter(createI18nEndOp(addedI18nId, null), op);
18932
19148
  addedI18nId = null;
18933
19149
  }
18934
19150
  break;
@@ -18937,17 +19153,18 @@ function wrapI18nIcus(job) {
18937
19153
  }
18938
19154
  }
18939
19155
 
18940
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
19156
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
18941
19157
  var phases = [
18942
19158
  { kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
18943
19159
  { kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
18944
19160
  { kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
18945
19161
  { kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
18946
19162
  { kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
18947
- { kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
19163
+ { kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
18948
19164
  { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
18949
19165
  { kind: CompilationJobKind.Both, fn: specializeBindings },
18950
19166
  { kind: CompilationJobKind.Both, fn: extractAttributes },
19167
+ { kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
18951
19168
  { kind: CompilationJobKind.Both, fn: parseExtractedStyles },
18952
19169
  { kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
18953
19170
  { kind: CompilationJobKind.Both, fn: collapseSingletonInterpolations },
@@ -18965,7 +19182,7 @@ var phases = [
18965
19182
  { kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
18966
19183
  { kind: CompilationJobKind.Tmpl, fn: generateVariables },
18967
19184
  { kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
18968
- { kind: CompilationJobKind.Tmpl, fn: deleteAnyCasts },
19185
+ { kind: CompilationJobKind.Both, fn: deleteAnyCasts },
18969
19186
  { kind: CompilationJobKind.Both, fn: resolveDollarEvent },
18970
19187
  { kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
18971
19188
  { kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
@@ -18973,7 +19190,7 @@ var phases = [
18973
19190
  { kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
18974
19191
  { kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
18975
19192
  { kind: CompilationJobKind.Both, fn: resolveContexts },
18976
- { kind: CompilationJobKind.Tmpl, fn: resolveSanitizers },
19193
+ { kind: CompilationJobKind.Both, fn: resolveSanitizers },
18977
19194
  { kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
18978
19195
  { kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
18979
19196
  { kind: CompilationJobKind.Both, fn: expandSafeReads },
@@ -18982,7 +19199,6 @@ var phases = [
18982
19199
  { kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
18983
19200
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
18984
19201
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
18985
- { kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
18986
19202
  { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
18987
19203
  { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
18988
19204
  { kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
@@ -19103,8 +19319,10 @@ function emitHostBindingFunction(job) {
19103
19319
  );
19104
19320
  }
19105
19321
 
19106
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
19322
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
19107
19323
  var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
19324
+ var domSchema = new DomElementSchemaRegistry();
19325
+ var NG_TEMPLATE_TAG_NAME = "ng-template";
19108
19326
  function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
19109
19327
  const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
19110
19328
  ingestNodes(job.root, template2);
@@ -19114,17 +19332,27 @@ function ingestHostBinding(input, bindingParser, constantPool) {
19114
19332
  var _a2, _b2, _c2;
19115
19333
  const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode);
19116
19334
  for (const property2 of (_a2 = input.properties) != null ? _a2 : []) {
19117
- ingestHostProperty(job, property2, false);
19335
+ let bindingKind = BindingKind.Property;
19336
+ if (property2.name.startsWith("attr.")) {
19337
+ property2.name = property2.name.substring("attr.".length);
19338
+ bindingKind = BindingKind.Attribute;
19339
+ }
19340
+ if (property2.isAnimation) {
19341
+ bindingKind = BindingKind.Animation;
19342
+ }
19343
+ const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
19344
+ ingestHostProperty(job, property2, bindingKind, securityContexts);
19118
19345
  }
19119
19346
  for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
19120
- ingestHostAttribute(job, name, expr);
19347
+ const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
19348
+ ingestHostAttribute(job, name, expr, securityContexts);
19121
19349
  }
19122
19350
  for (const event of (_c2 = input.events) != null ? _c2 : []) {
19123
19351
  ingestHostEvent(job, event);
19124
19352
  }
19125
19353
  return job;
19126
19354
  }
19127
- function ingestHostProperty(job, property2, isTextAttribute) {
19355
+ function ingestHostProperty(job, property2, bindingKind, securityContexts) {
19128
19356
  let expression;
19129
19357
  const ast = property2.expression.ast;
19130
19358
  if (ast instanceof Interpolation) {
@@ -19132,34 +19360,27 @@ function ingestHostProperty(job, property2, isTextAttribute) {
19132
19360
  } else {
19133
19361
  expression = convertAst(ast, job, property2.sourceSpan);
19134
19362
  }
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));
19363
+ job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, false, false, null, null, property2.sourceSpan));
19144
19364
  }
19145
- function ingestHostAttribute(job, name, value) {
19365
+ function ingestHostAttribute(job, name, value, securityContexts) {
19146
19366
  const attrBinding = createBindingOp(
19147
19367
  job.root.xref,
19148
19368
  BindingKind.Attribute,
19149
19369
  name,
19150
19370
  value,
19151
19371
  null,
19152
- SecurityContext.NONE,
19372
+ securityContexts,
19153
19373
  true,
19154
19374
  false,
19155
19375
  null,
19156
- null
19376
+ null,
19377
+ value.sourceSpan
19157
19378
  );
19158
19379
  job.root.update.push(attrBinding);
19159
19380
  }
19160
19381
  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)));
19382
+ const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
19383
+ const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
19163
19384
  job.root.create.push(eventBinding);
19164
19385
  }
19165
19386
  function ingestNodes(unit, template2) {
@@ -19171,9 +19392,9 @@ function ingestNodes(unit, template2) {
19171
19392
  } else if (node instanceof Content) {
19172
19393
  ingestContent(unit, node);
19173
19394
  } else if (node instanceof Text) {
19174
- ingestText(unit, node);
19395
+ ingestText(unit, node, null);
19175
19396
  } else if (node instanceof BoundText) {
19176
- ingestBoundText(unit, node);
19397
+ ingestBoundText(unit, node, null);
19177
19398
  } else if (node instanceof IfBlock) {
19178
19399
  ingestIfBlock(unit, node);
19179
19400
  } else if (node instanceof SwitchBlock) {
@@ -19190,26 +19411,30 @@ function ingestNodes(unit, template2) {
19190
19411
  }
19191
19412
  }
19192
19413
  function ingestElement(unit, element2) {
19193
- var _a2;
19414
+ var _a2, _b2;
19194
19415
  if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
19195
19416
  throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
19196
19417
  }
19197
19418
  const id = unit.job.allocateXrefId();
19198
19419
  const [namespaceKey, elementName] = splitNsName(element2.name);
19199
- const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
19420
+ const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
19200
19421
  unit.create.push(startOp);
19201
- ingestBindings(unit, startOp, element2);
19422
+ ingestElementBindings(unit, startOp, element2);
19202
19423
  ingestReferences(startOp, element2);
19424
+ let i18nBlockId = null;
19425
+ if (element2.i18n instanceof Message) {
19426
+ i18nBlockId = unit.job.allocateXrefId();
19427
+ unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n, void 0, element2.startSourceSpan));
19428
+ }
19203
19429
  ingestNodes(unit, element2.children);
19204
19430
  const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
19205
19431
  unit.create.push(endOp);
19206
- if (element2.i18n instanceof Message) {
19207
- const i18nBlockId = unit.job.allocateXrefId();
19208
- OpList.insertAfter(createI18nStartOp(i18nBlockId, element2.i18n), startOp);
19209
- OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
19432
+ if (i18nBlockId !== null) {
19433
+ OpList.insertBefore(createI18nEndOp(i18nBlockId, (_b2 = element2.endSourceSpan) != null ? _b2 : element2.startSourceSpan), endOp);
19210
19434
  }
19211
19435
  }
19212
19436
  function ingestTemplate(unit, tmpl) {
19437
+ var _a2;
19213
19438
  if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message || tmpl.i18n instanceof TagPlaceholder)) {
19214
19439
  throw Error(`Unhandled i18n metadata type for template: ${tmpl.i18n.constructor.name}`);
19215
19440
  }
@@ -19223,9 +19448,9 @@ function ingestTemplate(unit, tmpl) {
19223
19448
  const namespace = namespaceForKey(namespacePrefix);
19224
19449
  const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
19225
19450
  const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
19226
- const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
19451
+ const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan, tmpl.sourceSpan);
19227
19452
  unit.create.push(templateOp);
19228
- ingestBindings(unit, templateOp, tmpl);
19453
+ ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
19229
19454
  ingestReferences(templateOp, tmpl);
19230
19455
  ingestNodes(childView, tmpl.children);
19231
19456
  for (const { name, value } of tmpl.variables) {
@@ -19233,25 +19458,25 @@ function ingestTemplate(unit, tmpl) {
19233
19458
  }
19234
19459
  if (templateKind === TemplateKind.NgTemplate && tmpl.i18n instanceof Message) {
19235
19460
  const id = unit.job.allocateXrefId();
19236
- OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
19237
- OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
19461
+ OpList.insertAfter(createI18nStartOp(id, tmpl.i18n, void 0, tmpl.startSourceSpan), childView.create.head);
19462
+ OpList.insertBefore(createI18nEndOp(id, (_a2 = tmpl.endSourceSpan) != null ? _a2 : tmpl.startSourceSpan), childView.create.tail);
19238
19463
  }
19239
19464
  }
19240
19465
  function ingestContent(unit, content) {
19241
19466
  if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
19242
19467
  throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
19243
19468
  }
19244
- const attrs = content.attributes.flatMap((a) => [a.name, a.value]);
19245
- const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, attrs, content.sourceSpan);
19469
+ const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, content.sourceSpan);
19246
19470
  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);
19471
+ const securityContext = domSchema.securityContext(content.name, attr.name, true);
19472
+ unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19248
19473
  }
19249
19474
  unit.create.push(op);
19250
19475
  }
19251
- function ingestText(unit, text2) {
19252
- unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
19476
+ function ingestText(unit, text2, icuPlaceholder) {
19477
+ unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, icuPlaceholder, text2.sourceSpan));
19253
19478
  }
19254
- function ingestBoundText(unit, text2, i18nPlaceholders) {
19479
+ function ingestBoundText(unit, text2, icuPlaceholder) {
19255
19480
  var _a2;
19256
19481
  let value = text2.value;
19257
19482
  if (value instanceof ASTWithSource) {
@@ -19263,14 +19488,12 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
19263
19488
  if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
19264
19489
  throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
19265
19490
  }
19266
- if (i18nPlaceholders === void 0) {
19267
- i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
19268
- }
19491
+ const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
19269
19492
  if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
19270
19493
  throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
19271
19494
  }
19272
19495
  const textXref = unit.job.allocateXrefId();
19273
- unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
19496
+ unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
19274
19497
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
19275
19498
  unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
19276
19499
  }
@@ -19296,7 +19519,7 @@ function ingestIfBlock(unit, ifBlock) {
19296
19519
  }
19297
19520
  ifCaseI18nMeta = ifCase.i18n;
19298
19521
  }
19299
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
19522
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
19300
19523
  unit.create.push(templateOp);
19301
19524
  if (firstXref === null) {
19302
19525
  firstXref = cView.xref;
@@ -19324,7 +19547,7 @@ function ingestSwitchBlock(unit, switchBlock) {
19324
19547
  }
19325
19548
  switchCaseI18nMeta = switchCase.i18n;
19326
19549
  }
19327
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
19550
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
19328
19551
  unit.create.push(templateOp);
19329
19552
  if (firstXref === null) {
19330
19553
  firstXref = cView.xref;
@@ -19338,35 +19561,38 @@ function ingestSwitchBlock(unit, switchBlock) {
19338
19561
  const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
19339
19562
  unit.update.push(conditional2);
19340
19563
  }
19341
- function ingestDeferView(unit, suffix, children, sourceSpan) {
19564
+ function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
19565
+ if (i18nMeta !== void 0 && !(i18nMeta instanceof BlockPlaceholder)) {
19566
+ throw Error("Unhandled i18n metadata type for defer block");
19567
+ }
19342
19568
  if (children === void 0) {
19343
19569
  return null;
19344
19570
  }
19345
19571
  const secondaryView = unit.job.allocateView(unit.xref);
19346
19572
  ingestNodes(secondaryView, children);
19347
- const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, void 0, sourceSpan);
19573
+ const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan, sourceSpan);
19348
19574
  unit.create.push(templateOp);
19349
19575
  return templateOp;
19350
19576
  }
19351
19577
  function ingestDeferBlock(unit, deferBlock) {
19352
- var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
19578
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
19353
19579
  const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
19354
19580
  if (blockMeta === void 0) {
19355
19581
  throw new Error(`AssertionError: unable to find metadata for deferred block`);
19356
19582
  }
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);
19583
+ const main = ingestDeferView(unit, "", deferBlock.i18n, deferBlock.children, deferBlock.sourceSpan);
19584
+ 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);
19585
+ 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);
19586
+ 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
19587
  const deferXref = unit.job.allocateXrefId();
19362
19588
  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;
19589
+ deferOp.placeholderView = (_j = placeholder == null ? void 0 : placeholder.xref) != null ? _j : null;
19590
+ deferOp.placeholderSlot = (_k = placeholder == null ? void 0 : placeholder.handle) != null ? _k : null;
19591
+ deferOp.loadingSlot = (_l = loading == null ? void 0 : loading.handle) != null ? _l : null;
19592
+ deferOp.errorSlot = (_m = error2 == null ? void 0 : error2.handle) != null ? _m : null;
19593
+ deferOp.placeholderMinimumTime = (_o = (_n = deferBlock.placeholder) == null ? void 0 : _n.minimumTime) != null ? _o : null;
19594
+ deferOp.loadingMinimumTime = (_q = (_p = deferBlock.loading) == null ? void 0 : _p.minimumTime) != null ? _q : null;
19595
+ deferOp.loadingAfterTime = (_s = (_r = deferBlock.loading) == null ? void 0 : _r.afterTime) != null ? _s : null;
19370
19596
  unit.create.push(deferOp);
19371
19597
  let prefetch = false;
19372
19598
  let deferOnOps = [];
@@ -19418,6 +19644,9 @@ function ingestDeferBlock(unit, deferBlock) {
19418
19644
  deferOnOps.push(deferOnOp);
19419
19645
  }
19420
19646
  if (triggers.when !== void 0) {
19647
+ if (triggers.when.value instanceof Interpolation) {
19648
+ throw new Error(`Unexpected interpolation in defer block when trigger`);
19649
+ }
19421
19650
  const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
19422
19651
  deferWhenOps.push(deferOnOp);
19423
19652
  }
@@ -19437,9 +19666,9 @@ function ingestIcu(unit, icu) {
19437
19666
  unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
19438
19667
  for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
19439
19668
  if (text2 instanceof BoundText) {
19440
- ingestBoundText(unit, text2, [placeholder]);
19669
+ ingestBoundText(unit, text2, placeholder);
19441
19670
  } else {
19442
- ingestText(unit, text2);
19671
+ ingestText(unit, text2, placeholder);
19443
19672
  }
19444
19673
  }
19445
19674
  unit.create.push(createIcuEndOp(xref));
@@ -19448,7 +19677,7 @@ function ingestIcu(unit, icu) {
19448
19677
  }
19449
19678
  }
19450
19679
  function ingestForBlock(unit, forBlock) {
19451
- var _a2;
19680
+ var _a2, _b2, _c2;
19452
19681
  const repeaterView = unit.job.allocateView(unit.xref);
19453
19682
  const createRepeaterAlias = (ident, repeaterVar) => {
19454
19683
  repeaterView.aliases.add({
@@ -19469,9 +19698,11 @@ function ingestForBlock(unit, forBlock) {
19469
19698
  const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
19470
19699
  ingestNodes(repeaterView, forBlock.children);
19471
19700
  let emptyView = null;
19701
+ let emptyTagName = null;
19472
19702
  if (forBlock.empty !== null) {
19473
19703
  emptyView = unit.job.allocateView(unit.xref);
19474
19704
  ingestNodes(emptyView, forBlock.empty.children);
19705
+ emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
19475
19706
  }
19476
19707
  const varNames = {
19477
19708
  $index: forBlock.contextVariables.$index.name,
@@ -19482,8 +19713,16 @@ function ingestForBlock(unit, forBlock) {
19482
19713
  $odd: forBlock.contextVariables.$odd.name,
19483
19714
  $implicit: forBlock.item.name
19484
19715
  };
19716
+ if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
19717
+ throw Error("AssertionError: Unhandled i18n metadata type or @for");
19718
+ }
19719
+ if (((_a2 = forBlock.empty) == null ? void 0 : _a2.i18n) !== void 0 && !(forBlock.empty.i18n instanceof BlockPlaceholder)) {
19720
+ throw Error("AssertionError: Unhandled i18n metadata type or @empty");
19721
+ }
19722
+ const i18nPlaceholder = forBlock.i18n;
19723
+ const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
19485
19724
  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);
19725
+ const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, emptyTagName, i18nPlaceholder, emptyI18nPlaceholder, forBlock.startSourceSpan, forBlock.sourceSpan);
19487
19726
  unit.create.push(repeaterCreate2);
19488
19727
  const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
19489
19728
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
@@ -19493,7 +19732,10 @@ function convertAst(ast, job, baseSourceSpan) {
19493
19732
  if (ast instanceof ASTWithSource) {
19494
19733
  return convertAst(ast.ast, job, baseSourceSpan);
19495
19734
  } else if (ast instanceof PropertyRead) {
19496
- if (ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver)) {
19735
+ const isThisReceiver = ast.receiver instanceof ThisReceiver;
19736
+ const isImplicitReceiver = ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver);
19737
+ const isSpecialNode = ast.name === "$any" || ast.name === "$event";
19738
+ if (isImplicitReceiver || isThisReceiver && !isSpecialNode) {
19497
19739
  return new LexicalReadExpr(ast.name);
19498
19740
  } else {
19499
19741
  return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
@@ -19571,120 +19813,128 @@ function convertAst(ast, job, baseSourceSpan) {
19571
19813
  throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
19572
19814
  }
19573
19815
  }
19816
+ function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
19817
+ var _a2, _b2;
19818
+ let expression;
19819
+ if (value instanceof Interpolation) {
19820
+ 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 : {}));
19821
+ } else if (value instanceof AST) {
19822
+ expression = convertAst(value, job, sourceSpan != null ? sourceSpan : null);
19823
+ } else {
19824
+ expression = literal(value);
19825
+ }
19826
+ return expression;
19827
+ }
19828
+ var BINDING_KINDS = /* @__PURE__ */ new Map([
19829
+ [0, BindingKind.Property],
19830
+ [1, BindingKind.Attribute],
19831
+ [2, BindingKind.ClassName],
19832
+ [3, BindingKind.StyleProperty],
19833
+ [4, BindingKind.Animation]
19834
+ ]);
19574
19835
  function isPlainTemplate(tmpl) {
19575
19836
  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
- }
19837
+ return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === NG_TEMPLATE_TAG_NAME;
19838
+ }
19839
+ function asMessage(i18nMeta) {
19840
+ if (i18nMeta == null) {
19841
+ return null;
19842
+ }
19843
+ if (!(i18nMeta instanceof Message)) {
19844
+ throw Error(`Expected i18n meta to be a Message, but got: ${i18nMeta.constructor.name}`);
19596
19845
  }
19846
+ return i18nMeta;
19847
+ }
19848
+ function ingestElementBindings(unit, op, element2) {
19849
+ var _a2;
19850
+ let bindings = new Array();
19597
19851
  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);
19852
+ const securityContext = domSchema.securityContext(element2.name, attr.name, true);
19853
+ 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
19854
  }
19601
19855
  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);
19856
+ 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
19857
  }
19858
+ unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
19859
+ unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
19605
19860
  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
- }
19611
- }
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;
19861
+ if (output.type === 1 && output.phase === null) {
19862
+ throw Error("Animation listener should have a phase");
19621
19863
  }
19622
- if (handler instanceof Chain) {
19623
- handlerExprs = handler.expressions;
19864
+ 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));
19865
+ }
19866
+ if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
19867
+ unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
19868
+ }
19869
+ }
19870
+ function ingestTemplateBindings(unit, op, template2, templateKind) {
19871
+ let bindings = new Array();
19872
+ for (const attr of template2.templateAttrs) {
19873
+ if (attr instanceof TextAttribute) {
19874
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19875
+ bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19624
19876
  } else {
19625
- handlerExprs = [handler];
19877
+ bindings.push(createTemplateBinding(unit, op.xref, attr.type, attr.name, astOf(attr.value), attr.unit, attr.securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19626
19878
  }
19627
- if (handlerExprs.length === 0) {
19628
- throw new Error("Expected listener to have non-empty expression list.");
19879
+ }
19880
+ for (const attr of template2.attributes) {
19881
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19882
+ bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, false, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19883
+ }
19884
+ for (const input of template2.inputs) {
19885
+ bindings.push(createTemplateBinding(unit, op.xref, input.type, input.name, astOf(input.value), input.unit, input.securityContext, false, templateKind, asMessage(input.i18n), input.sourceSpan));
19886
+ }
19887
+ unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
19888
+ unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
19889
+ for (const output of template2.outputs) {
19890
+ if (output.type === 1 && output.phase === null) {
19891
+ throw Error("Animation listener should have a phase");
19892
+ }
19893
+ if (templateKind === TemplateKind.NgTemplate) {
19894
+ 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
19895
  }
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);
19896
+ if (templateKind === TemplateKind.Structural && output.type !== 1) {
19897
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
19898
+ unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
19635
19899
  }
19636
- listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
19637
- unit.create.push(listenerOp);
19638
19900
  }
19639
- if (hasI18nAttributes) {
19901
+ if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
19640
19902
  unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
19641
19903
  }
19642
19904
  }
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}`);
19905
+ function createTemplateBinding(view, xref, type, name, value, unit, securityContext, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
19906
+ const isTextBinding = typeof value === "string";
19907
+ if (templateKind === TemplateKind.Structural) {
19908
+ if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
19909
+ return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
19910
+ }
19911
+ if (!isTextBinding && (type === 1 || type === 4)) {
19912
+ return null;
19666
19913
  }
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
19914
  }
19674
- let expression;
19675
- if (value instanceof Interpolation) {
19676
- let i18nPlaceholders = [];
19677
- if (i18nMeta !== void 0) {
19678
- i18nPlaceholders = Object.keys(i18nMeta.placeholders);
19915
+ let bindingType = BINDING_KINDS.get(type);
19916
+ if (templateKind === TemplateKind.NgTemplate) {
19917
+ if (type === 2 || type === 3 || type === 1 && !isTextBinding) {
19918
+ bindingType = BindingKind.Property;
19679
19919
  }
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
19920
  }
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));
19921
+ return createBindingOp(xref, bindingType, name, convertAstWithInterpolation(view.job, value, i18nMessage), unit, securityContext, isTextBinding, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan);
19922
+ }
19923
+ function makeListenerHandlerOps(unit, handler, handlerSpan) {
19924
+ handler = astOf(handler);
19925
+ const handlerOps = new Array();
19926
+ let handlerExprs = handler instanceof Chain ? handler.expressions : [handler];
19927
+ if (handlerExprs.length === 0) {
19928
+ throw new Error("Expected listener to have non-empty expression list.");
19929
+ }
19930
+ const expressions = handlerExprs.map((expr) => convertAst(expr, unit.job, handlerSpan));
19931
+ const returnExpr = expressions.pop();
19932
+ handlerOps.push(...expressions.map((e) => createStatementOp(new ExpressionStatement(e, e.sourceSpan))));
19933
+ handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
19934
+ return handlerOps;
19935
+ }
19936
+ function astOf(ast) {
19937
+ return ast instanceof ASTWithSource ? ast.ast : ast;
19688
19938
  }
19689
19939
  function ingestReferences(op, element2) {
19690
19940
  assertIsArray(op.localRefs);
@@ -19724,18 +19974,19 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
19724
19974
  }
19725
19975
  if (root !== null) {
19726
19976
  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);
19977
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19978
+ unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19728
19979
  }
19729
19980
  const tagName = root instanceof Element ? root.name : root.tagName;
19730
- return tagName === "ng-template" ? null : tagName;
19981
+ return tagName === NG_TEMPLATE_TAG_NAME ? null : tagName;
19731
19982
  }
19732
19983
  return null;
19733
19984
  }
19734
19985
 
19735
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
19986
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
19736
19987
  var USE_TEMPLATE_PIPELINE = false;
19737
19988
 
19738
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/styling_builder.mjs
19989
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/styling_builder.mjs
19739
19990
  var IMPORTANT_FLAG = "!important";
19740
19991
  var MIN_STYLING_BINDING_SLOTS_REQUIRED = 2;
19741
19992
  var StylingBuilder = class {
@@ -20068,7 +20319,7 @@ function isEmptyExpression(ast) {
20068
20319
  return ast instanceof EmptyExpr;
20069
20320
  }
20070
20321
 
20071
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_parser.mjs
20322
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/html_parser.mjs
20072
20323
  var HtmlParser = class extends Parser2 {
20073
20324
  constructor() {
20074
20325
  super(getHtmlTagDefinition);
@@ -20078,7 +20329,7 @@ var HtmlParser = class extends Parser2 {
20078
20329
  }
20079
20330
  };
20080
20331
 
20081
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_whitespaces.mjs
20332
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/html_whitespaces.mjs
20082
20333
  var PRESERVE_WS_ATTR_NAME = "ngPreserveWhitespaces";
20083
20334
  var SKIP_WS_TRIM_TAGS = /* @__PURE__ */ new Set(["pre", "template", "textarea", "script", "style"]);
20084
20335
  var WS_CHARS = " \f\n\r \v\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
@@ -20144,7 +20395,7 @@ function visitAllWithSiblings(visitor, nodes) {
20144
20395
  return result;
20145
20396
  }
20146
20397
 
20147
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template_parser/binding_parser.mjs
20398
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template_parser/binding_parser.mjs
20148
20399
  var PROPERTY_PARTS_SEPARATOR = ".";
20149
20400
  var ATTRIBUTE_PREFIX = "attr";
20150
20401
  var CLASS_PREFIX = "class";
@@ -20464,7 +20715,7 @@ function moveParseSourceSpan(sourceSpan, absoluteSpan) {
20464
20715
  return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
20465
20716
  }
20466
20717
 
20467
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/style_url_resolver.mjs
20718
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/style_url_resolver.mjs
20468
20719
  function isStyleUrlResolvable(url) {
20469
20720
  if (url == null || url.length === 0 || url[0] == "/")
20470
20721
  return false;
@@ -20473,7 +20724,7 @@ function isStyleUrlResolvable(url) {
20473
20724
  }
20474
20725
  var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
20475
20726
 
20476
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template_parser/template_preparser.mjs
20727
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template_parser/template_preparser.mjs
20477
20728
  var NG_CONTENT_SELECT_ATTR = "select";
20478
20729
  var LINK_ELEMENT = "link";
20479
20730
  var LINK_STYLE_REL_ATTR = "rel";
@@ -20543,7 +20794,7 @@ function normalizeNgContentSelect(selectAttr) {
20543
20794
  return selectAttr;
20544
20795
  }
20545
20796
 
20546
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
20797
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
20547
20798
  var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/;
20548
20799
  var FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
20549
20800
  var CONDITIONAL_ALIAS_PATTERN = /^as\s+(.*)/;
@@ -20834,7 +21085,7 @@ function stripOptionalParentheses(param, errors) {
20834
21085
  return expression.slice(start, end);
20835
21086
  }
20836
21087
 
20837
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
21088
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
20838
21089
  var TIME_PATTERN = /^\d+\.?\d*(ms|s)?$/;
20839
21090
  var SEPARATOR_PATTERN = /^\s$/;
20840
21091
  var COMMA_DELIMITED_SYNTAX = /* @__PURE__ */ new Map([
@@ -21098,7 +21349,7 @@ function parseDeferredTime(value) {
21098
21349
  return parseFloat(time) * (units === "s" ? 1e3 : 1);
21099
21350
  }
21100
21351
 
21101
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
21352
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
21102
21353
  var PREFETCH_WHEN_PATTERN = /^prefetch\s+when\s/;
21103
21354
  var PREFETCH_ON_PATTERN = /^prefetch\s+on\s/;
21104
21355
  var MINIMUM_PARAMETER_PATTERN = /^minimum\s/;
@@ -21233,7 +21484,7 @@ function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
21233
21484
  return { triggers, prefetchTriggers };
21234
21485
  }
21235
21486
 
21236
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_template_transform.mjs
21487
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_template_transform.mjs
21237
21488
  var BIND_NAME_REGEXP = /^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/;
21238
21489
  var KW_BIND_IDX = 1;
21239
21490
  var KW_LET_IDX = 2;
@@ -21664,7 +21915,7 @@ function textContents(node) {
21664
21915
  }
21665
21916
  }
21666
21917
 
21667
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/context.mjs
21918
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/context.mjs
21668
21919
  var TagType;
21669
21920
  (function(TagType2) {
21670
21921
  TagType2[TagType2["ELEMENT"] = 0] = "ELEMENT";
@@ -21809,21 +22060,21 @@ function serializePlaceholderValue(value) {
21809
22060
  }
21810
22061
  }
21811
22062
 
21812
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/template.mjs
22063
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/template.mjs
21813
22064
  var NG_CONTENT_SELECT_ATTR2 = "select";
21814
22065
  var NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
21815
22066
  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]]);
22067
+ var NG_TEMPLATE_TAG_NAME2 = "ng-template";
22068
+ var GLOBAL_TARGET_RESOLVERS2 = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
21818
22069
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
21819
22070
  function renderFlagCheckIfStmt(flags, statements) {
21820
22071
  return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null, false), statements);
21821
22072
  }
21822
22073
  function prepareEventListenerParameters(eventAst, handlerName = null, scope = null) {
21823
22074
  const { type, name, target, phase, handler } = eventAst;
21824
- if (target && !GLOBAL_TARGET_RESOLVERS.has(target)) {
22075
+ if (target && !GLOBAL_TARGET_RESOLVERS2.has(target)) {
21825
22076
  throw new Error(`Unexpected global target '${target}' defined for '${name}' event.
21826
- Supported list of global targets: ${Array.from(GLOBAL_TARGET_RESOLVERS.keys())}.`);
22077
+ Supported list of global targets: ${Array.from(GLOBAL_TARGET_RESOLVERS2.keys())}.`);
21827
22078
  }
21828
22079
  const eventArgumentName = "$event";
21829
22080
  const implicitReceiverAccesses = /* @__PURE__ */ new Set();
@@ -21856,7 +22107,7 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
21856
22107
  if (target) {
21857
22108
  params.push(
21858
22109
  literal(false),
21859
- importExpr(GLOBAL_TARGET_RESOLVERS.get(target))
22110
+ importExpr(GLOBAL_TARGET_RESOLVERS2.get(target))
21860
22111
  );
21861
22112
  }
21862
22113
  return params;
@@ -22402,10 +22653,10 @@ var TemplateDefinitionBuilder = class {
22402
22653
  var _a2;
22403
22654
  const tagNameWithoutNamespace = template2.tagName ? splitNsName(template2.tagName)[1] : template2.tagName;
22404
22655
  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);
22656
+ const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
22406
22657
  const templateIndex = this.createEmbeddedTemplateFn(tagNameWithoutNamespace, template2.children, contextNameSuffix, template2.sourceSpan, template2.variables, attrsExprs, template2.references, template2.i18n);
22407
22658
  this.templatePropertyBindings(templateIndex, template2.templateAttrs);
22408
- if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME) {
22659
+ if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME2) {
22409
22660
  const [i18nInputs, inputs] = partitionArray(template2.inputs, hasI18nMeta);
22410
22661
  if (i18nInputs.length > 0) {
22411
22662
  this.i18nAttributesInstruction(templateIndex, i18nInputs, (_a2 = template2.startSourceSpan) != null ? _a2 : template2.sourceSpan);
@@ -22646,8 +22897,8 @@ var TemplateDefinitionBuilder = class {
22646
22897
  }
22647
22898
  if (root !== null) {
22648
22899
  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, []);
22900
+ tagName = name === NG_TEMPLATE_TAG_NAME2 ? null : name;
22901
+ attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, root.attributes, root.inputs, []);
22651
22902
  }
22652
22903
  return { tagName, attrsExprs };
22653
22904
  }
@@ -22663,7 +22914,12 @@ var TemplateDefinitionBuilder = class {
22663
22914
  });
22664
22915
  const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
22665
22916
  let emptyData = null;
22917
+ let emptyTagName = null;
22918
+ let emptyAttrsExprs;
22666
22919
  if (block.empty !== null) {
22920
+ const emptyInferred = this.inferProjectionDataFromInsertionPoint(block.empty);
22921
+ emptyTagName = emptyInferred.tagName;
22922
+ emptyAttrsExprs = emptyInferred.attrsExprs;
22667
22923
  emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
22668
22924
  this.allocateBindingSlots(null);
22669
22925
  }
@@ -22679,11 +22935,11 @@ var TemplateDefinitionBuilder = class {
22679
22935
  trackByExpression
22680
22936
  ];
22681
22937
  if (emptyData !== null) {
22682
- params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()));
22938
+ params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()), literal(emptyTagName), this.addAttrsToConsts(emptyAttrsExprs || null));
22683
22939
  } else if (trackByUsesComponentInstance) {
22684
22940
  params.push(literal(trackByUsesComponentInstance));
22685
22941
  }
22686
- return params;
22942
+ return trimTrailingNulls(params);
22687
22943
  });
22688
22944
  const value = block.expression.visit(this._valueConverter);
22689
22945
  this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
@@ -23246,12 +23502,15 @@ var BindingScope = class {
23246
23502
  }
23247
23503
  };
23248
23504
  var TrackByBindingScope = class extends BindingScope {
23249
- constructor(parentScope, globalAliases) {
23505
+ constructor(parentScope, globalOverrides) {
23250
23506
  super(parentScope.bindingLevel + 1, parentScope);
23251
- this.globalAliases = globalAliases;
23507
+ this.globalOverrides = globalOverrides;
23252
23508
  this.componentAccessCount = 0;
23253
23509
  }
23254
23510
  get(name) {
23511
+ if (this.globalOverrides.hasOwnProperty(name)) {
23512
+ return variable(this.globalOverrides[name]);
23513
+ }
23255
23514
  let current = this.parent;
23256
23515
  while (current) {
23257
23516
  if (current.hasLocal(name)) {
@@ -23259,9 +23518,6 @@ var TrackByBindingScope = class extends BindingScope {
23259
23518
  }
23260
23519
  current = current.parent;
23261
23520
  }
23262
- if (this.globalAliases[name]) {
23263
- return variable(this.globalAliases[name]);
23264
- }
23265
23521
  this.componentAccessCount++;
23266
23522
  return variable("this").prop(name);
23267
23523
  }
@@ -23486,7 +23742,7 @@ function createClosureModeGuard2() {
23486
23742
  return typeofExpr(variable(NG_I18N_CLOSURE_MODE2)).notIdentical(literal("undefined", STRING_TYPE)).and(variable(NG_I18N_CLOSURE_MODE2));
23487
23743
  }
23488
23744
 
23489
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
23745
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
23490
23746
  var ATTR_REGEX = /attr\.([^\]]+)/;
23491
23747
  var COMPONENT_VARIABLE = "%COMP%";
23492
23748
  var HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
@@ -23756,14 +24012,14 @@ function createBaseDirectiveTypeParams(meta) {
23756
24012
  function getInputsTypeExpression(meta) {
23757
24013
  return literalMap(Object.keys(meta.inputs).map((key) => {
23758
24014
  const value = meta.inputs[key];
23759
- return {
23760
- key,
23761
- value: literalMap([
23762
- { key: "alias", value: literal(value.bindingPropertyName), quoted: true },
23763
- { key: "required", value: literal(value.required), quoted: true }
23764
- ]),
23765
- quoted: true
23766
- };
24015
+ const values = [
24016
+ { key: "alias", value: literal(value.bindingPropertyName), quoted: true },
24017
+ { key: "required", value: literal(value.required), quoted: true }
24018
+ ];
24019
+ if (value.isSignal) {
24020
+ values.push({ key: "isSignal", value: literal(value.isSignal), quoted: true });
24021
+ }
24022
+ return { key, value: literalMap(values), quoted: true };
23767
24023
  }));
23768
24024
  }
23769
24025
  function createDirectiveType(meta) {
@@ -23807,6 +24063,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
23807
24063
  }
23808
24064
  const hostJob = ingestHostBinding({
23809
24065
  componentName: name,
24066
+ componentSelector: selector,
23810
24067
  properties: bindings,
23811
24068
  events: eventBindings,
23812
24069
  attributes: hostBindingsMetadata.attributes
@@ -24100,7 +24357,7 @@ function createHostDirectivesMappingArray(mapping) {
24100
24357
  return elements.length > 0 ? literalArr(elements) : null;
24101
24358
  }
24102
24359
 
24103
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/t2_binder.mjs
24360
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/t2_binder.mjs
24104
24361
  var R3TargetBinder = class {
24105
24362
  constructor(directiveMatcher) {
24106
24363
  this.directiveMatcher = directiveMatcher;
@@ -24705,11 +24962,11 @@ function extractScopedNodeEntities(rootScope) {
24705
24962
  return templateEntities;
24706
24963
  }
24707
24964
 
24708
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/resource_loader.mjs
24965
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/resource_loader.mjs
24709
24966
  var ResourceLoader = class {
24710
24967
  };
24711
24968
 
24712
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/jit_compiler_facade.mjs
24969
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/jit_compiler_facade.mjs
24713
24970
  var CompilerFacadeImpl = class {
24714
24971
  constructor(jitEvaluator = new JitEvaluator()) {
24715
24972
  this.jitEvaluator = jitEvaluator;
@@ -24925,6 +25182,7 @@ function convertDirectiveFacadeToMetadata(facade) {
24925
25182
  bindingPropertyName: ann.alias || field,
24926
25183
  classPropertyName: field,
24927
25184
  required: ann.required || false,
25185
+ isSignal: false,
24928
25186
  transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null
24929
25187
  };
24930
25188
  } else if (isOutput(ann)) {
@@ -24955,7 +25213,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
24955
25213
  type: wrapReference(declaration.type),
24956
25214
  typeSourceSpan,
24957
25215
  selector: (_a2 = declaration.selector) != null ? _a2 : null,
24958
- inputs: declaration.inputs ? inputsMappingToInputMetadata(declaration.inputs) : {},
25216
+ inputs: declaration.inputs ? inputsPartialMetadataToInputMetadata(declaration.inputs) : {},
24959
25217
  outputs: (_b2 = declaration.outputs) != null ? _b2 : {},
24960
25218
  host: convertHostDeclarationToMetadata(declaration.host),
24961
25219
  queries: ((_c2 = declaration.queries) != null ? _c2 : []).map(convertQueryDeclarationToMetadata),
@@ -25183,27 +25441,41 @@ function isInput(value) {
25183
25441
  function isOutput(value) {
25184
25442
  return value.ngMetadataName === "Output";
25185
25443
  }
25186
- function inputsMappingToInputMetadata(inputs) {
25187
- return Object.keys(inputs).reduce((result, key) => {
25188
- const value = inputs[key];
25189
- if (typeof value === "string") {
25190
- result[key] = {
25191
- bindingPropertyName: value,
25192
- classPropertyName: value,
25193
- transformFunction: null,
25194
- required: false
25195
- };
25444
+ function inputsPartialMetadataToInputMetadata(inputs) {
25445
+ return Object.keys(inputs).reduce((result, minifiedClassName) => {
25446
+ const value = inputs[minifiedClassName];
25447
+ if (typeof value === "string" || Array.isArray(value)) {
25448
+ result[minifiedClassName] = parseLegacyInputPartialOutput(value);
25196
25449
  } else {
25197
- result[key] = {
25198
- bindingPropertyName: value[0],
25199
- classPropertyName: value[1],
25200
- transformFunction: value[2] ? new WrappedNodeExpr(value[2]) : null,
25201
- required: false
25450
+ result[minifiedClassName] = {
25451
+ bindingPropertyName: value.publicName,
25452
+ classPropertyName: minifiedClassName,
25453
+ transformFunction: value.transformFunction !== null ? new WrappedNodeExpr(value.transformFunction) : null,
25454
+ required: value.isRequired,
25455
+ isSignal: value.isSignal
25202
25456
  };
25203
25457
  }
25204
25458
  return result;
25205
25459
  }, {});
25206
25460
  }
25461
+ function parseLegacyInputPartialOutput(value) {
25462
+ if (typeof value === "string") {
25463
+ return {
25464
+ bindingPropertyName: value,
25465
+ classPropertyName: value,
25466
+ transformFunction: null,
25467
+ required: false,
25468
+ isSignal: false
25469
+ };
25470
+ }
25471
+ return {
25472
+ bindingPropertyName: value[0],
25473
+ classPropertyName: value[1],
25474
+ transformFunction: value[2] ? new WrappedNodeExpr(value[2]) : null,
25475
+ required: false,
25476
+ isSignal: false
25477
+ };
25478
+ }
25207
25479
  function parseInputsArray(values) {
25208
25480
  return values.reduce((results, value) => {
25209
25481
  if (typeof value === "string") {
@@ -25212,6 +25484,7 @@ function parseInputsArray(values) {
25212
25484
  bindingPropertyName,
25213
25485
  classPropertyName,
25214
25486
  required: false,
25487
+ isSignal: false,
25215
25488
  transformFunction: null
25216
25489
  };
25217
25490
  } else {
@@ -25219,6 +25492,7 @@ function parseInputsArray(values) {
25219
25492
  bindingPropertyName: value.alias || value.name,
25220
25493
  classPropertyName: value.name,
25221
25494
  required: value.required || false,
25495
+ isSignal: false,
25222
25496
  transformFunction: value.transform != null ? new WrappedNodeExpr(value.transform) : null
25223
25497
  };
25224
25498
  }
@@ -25261,17 +25535,17 @@ function publishFacade(global) {
25261
25535
  ng.\u0275compilerFacade = new CompilerFacadeImpl();
25262
25536
  }
25263
25537
 
25264
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/version.mjs
25265
- var VERSION2 = new Version("17.1.0-next.3");
25538
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
25539
+ var VERSION2 = new Version("17.1.0-next.5");
25266
25540
 
25267
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25541
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25268
25542
  var _VisitorMode;
25269
25543
  (function(_VisitorMode2) {
25270
25544
  _VisitorMode2[_VisitorMode2["Extract"] = 0] = "Extract";
25271
25545
  _VisitorMode2[_VisitorMode2["Merge"] = 1] = "Merge";
25272
25546
  })(_VisitorMode || (_VisitorMode = {}));
25273
25547
 
25274
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/xml_tags.mjs
25548
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/xml_tags.mjs
25275
25549
  var XmlTagDefinition = class {
25276
25550
  constructor() {
25277
25551
  this.closedByParent = false;
@@ -25293,7 +25567,7 @@ var XmlTagDefinition = class {
25293
25567
  };
25294
25568
  var _TAG_DEFINITION = new XmlTagDefinition();
25295
25569
 
25296
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/partial/api.mjs
25570
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/partial/api.mjs
25297
25571
  var FactoryTarget2;
25298
25572
  (function(FactoryTarget3) {
25299
25573
  FactoryTarget3[FactoryTarget3["Directive"] = 0] = "Directive";
@@ -25303,15 +25577,45 @@ var FactoryTarget2;
25303
25577
  FactoryTarget3[FactoryTarget3["NgModule"] = 4] = "NgModule";
25304
25578
  })(FactoryTarget2 || (FactoryTarget2 = {}));
25305
25579
 
25306
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/compiler.mjs
25580
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/compiler.mjs
25307
25581
  publishFacade(_global);
25308
25582
 
25309
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/types.mjs
25583
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/identifier-lookup.mjs
25584
+ var import_typescript5 = __toESM(require("typescript"), 1);
25585
+ function lookupIdentifiersInSourceFile(sourceFile, names) {
25586
+ const results = /* @__PURE__ */ new Set();
25587
+ const visit = (node) => {
25588
+ if (import_typescript5.default.isIdentifier(node) && names.includes(node.text)) {
25589
+ results.add(node);
25590
+ }
25591
+ import_typescript5.default.forEachChild(node, visit);
25592
+ };
25593
+ visit(sourceFile);
25594
+ return results;
25595
+ }
25596
+
25597
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/types.mjs
25310
25598
  var ngtemplate = "ng-template";
25311
25599
  var boundngifelse = "[ngIfElse]";
25312
25600
  var boundngifthenelse = "[ngIfThenElse]";
25313
25601
  var boundngifthen = "[ngIfThen]";
25314
25602
  var nakedngfor = "ngFor";
25603
+ var startMarker = "\u25EC";
25604
+ var endMarker = "\u2722";
25605
+ var startI18nMarker = "\u2688";
25606
+ var endI18nMarker = "\u2689";
25607
+ var importRemovals = [
25608
+ "NgIf",
25609
+ "NgIfElse",
25610
+ "NgIfThenElse",
25611
+ "NgFor",
25612
+ "NgForOf",
25613
+ "NgForTrackBy",
25614
+ "NgSwitch",
25615
+ "NgSwitchCase",
25616
+ "NgSwitchDefault"
25617
+ ];
25618
+ var importWithCommonRemovals = [...importRemovals, "CommonModule"];
25315
25619
  function allFormsOf(selector) {
25316
25620
  return [
25317
25621
  selector,
@@ -25461,21 +25765,24 @@ var Template2 = class {
25461
25765
  }
25462
25766
  };
25463
25767
  var AnalyzedFile = class {
25464
- constructor() {
25768
+ constructor(sourceFile) {
25465
25769
  __publicField(this, "ranges", []);
25466
25770
  __publicField(this, "removeCommonModule", false);
25467
- __publicField(this, "sourceFilePath", "");
25771
+ __publicField(this, "canRemoveImports", false);
25772
+ __publicField(this, "sourceFile");
25773
+ __publicField(this, "importRanges", []);
25774
+ __publicField(this, "templateRanges", []);
25775
+ this.sourceFile = sourceFile;
25468
25776
  }
25469
25777
  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];
25778
+ this.templateRanges = this.ranges.slice().filter((x) => x.type === "template" || x.type === "templateUrl").sort((aStart, bStart) => bStart.start - aStart.start);
25779
+ this.importRanges = this.ranges.slice().filter((x) => x.type === "importDecorator" || x.type === "importDeclaration").sort((aStart, bStart) => bStart.start - aStart.start);
25780
+ return [...this.templateRanges, ...this.importRanges];
25473
25781
  }
25474
- static addRange(path2, sourceFilePath, analyzedFiles, range) {
25782
+ static addRange(path2, sourceFile, analyzedFiles, range) {
25475
25783
  let analysis = analyzedFiles.get(path2);
25476
25784
  if (!analysis) {
25477
- analysis = new AnalyzedFile();
25478
- analysis.sourceFilePath = sourceFilePath;
25785
+ analysis = new AnalyzedFile(sourceFile);
25479
25786
  analyzedFiles.set(path2, analysis);
25480
25787
  }
25481
25788
  const duplicate = analysis.ranges.find((current) => current.start === range.start && current.end === range.end);
@@ -25483,6 +25790,25 @@ var AnalyzedFile = class {
25483
25790
  analysis.ranges.push(range);
25484
25791
  }
25485
25792
  }
25793
+ verifyCanRemoveImports() {
25794
+ const importDeclaration = this.importRanges.find((r) => r.type === "importDeclaration");
25795
+ const instances = lookupIdentifiersInSourceFile(this.sourceFile, importWithCommonRemovals);
25796
+ let foundImportDeclaration = false;
25797
+ let count = 0;
25798
+ for (let range of this.importRanges) {
25799
+ for (let instance of instances) {
25800
+ if (instance.getStart() >= range.start && instance.getEnd() <= range.end) {
25801
+ if (range === importDeclaration) {
25802
+ foundImportDeclaration = true;
25803
+ }
25804
+ count++;
25805
+ }
25806
+ }
25807
+ }
25808
+ if (instances.size !== count && importDeclaration !== void 0 && foundImportDeclaration) {
25809
+ importDeclaration.remove = false;
25810
+ }
25811
+ }
25486
25812
  };
25487
25813
  var CommonCollector = class extends RecursiveVisitor {
25488
25814
  constructor() {
@@ -25511,6 +25837,18 @@ var CommonCollector = class extends RecursiveVisitor {
25511
25837
  return commonModulePipes.some((regexp) => regexp.test(input));
25512
25838
  }
25513
25839
  };
25840
+ var i18nCollector = class extends RecursiveVisitor {
25841
+ constructor() {
25842
+ super(...arguments);
25843
+ __publicField(this, "elements", []);
25844
+ }
25845
+ visitElement(el) {
25846
+ if (el.attrs.find((a) => a.name === "i18n") !== void 0) {
25847
+ this.elements.push(el);
25848
+ }
25849
+ super.visitElement(el, null);
25850
+ }
25851
+ };
25514
25852
  var ElementCollector = class extends RecursiveVisitor {
25515
25853
  constructor(_attributes = []) {
25516
25854
  super();
@@ -25589,33 +25927,30 @@ var TemplateCollector = class extends RecursiveVisitor {
25589
25927
  }
25590
25928
  };
25591
25929
 
25592
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/util.mjs
25930
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/util.mjs
25593
25931
  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"];
25932
+ var import_typescript6 = __toESM(require("typescript"), 1);
25933
+ var startMarkerRegex = new RegExp(startMarker, "gm");
25934
+ var endMarkerRegex = new RegExp(endMarker, "gm");
25935
+ var startI18nMarkerRegex = new RegExp(startI18nMarker, "gm");
25936
+ var endI18nMarkerRegex = new RegExp(endI18nMarker, "gm");
25937
+ var replaceMarkerRegex = new RegExp(`${startMarker}|${endMarker}`, "gm");
25607
25938
  function analyze(sourceFile, analyzedFiles) {
25608
25939
  forEachClass(sourceFile, (node) => {
25609
- if (import_typescript5.default.isClassDeclaration(node)) {
25940
+ if (import_typescript6.default.isClassDeclaration(node)) {
25610
25941
  analyzeDecorators(node, sourceFile, analyzedFiles);
25611
25942
  } else {
25612
25943
  analyzeImportDeclarations(node, sourceFile, analyzedFiles);
25613
25944
  }
25614
25945
  });
25615
25946
  }
25616
- function checkIfShouldChange(decl, removeCommonModule) {
25947
+ function checkIfShouldChange(decl, file) {
25948
+ const range = file.importRanges.find((r) => r.type === "importDeclaration");
25949
+ if (range === void 0 || !range.remove) {
25950
+ return false;
25951
+ }
25617
25952
  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");
25953
+ return !(!file.removeCommonModule && clause.namedBindings && import_typescript6.default.isNamedImports(clause.namedBindings) && clause.namedBindings.elements.length === 1 && clause.namedBindings.elements[0].getText() === "CommonModule");
25619
25954
  }
25620
25955
  function updateImportDeclaration(decl, removeCommonModule) {
25621
25956
  const clause = decl.getChildAt(1);
@@ -25623,81 +25958,89 @@ function updateImportDeclaration(decl, removeCommonModule) {
25623
25958
  if (updatedClause === null) {
25624
25959
  return "";
25625
25960
  }
25626
- const printer = import_typescript5.default.createPrinter({
25961
+ const printer = import_typescript6.default.createPrinter({
25627
25962
  removeComments: true
25628
25963
  });
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());
25964
+ const updated = import_typescript6.default.factory.updateImportDeclaration(decl, decl.modifiers, updatedClause, decl.moduleSpecifier, void 0);
25965
+ return printer.printNode(import_typescript6.default.EmitHint.Unspecified, updated, clause.getSourceFile());
25631
25966
  }
25632
25967
  function updateImportClause(clause, removeCommonModule) {
25633
- if (clause.namedBindings && import_typescript5.default.isNamedImports(clause.namedBindings)) {
25968
+ if (clause.namedBindings && import_typescript6.default.isNamedImports(clause.namedBindings)) {
25634
25969
  const removals = removeCommonModule ? importWithCommonRemovals : importRemovals;
25635
25970
  const elements = clause.namedBindings.elements.filter((el) => !removals.includes(el.getText()));
25636
25971
  if (elements.length === 0) {
25637
25972
  return null;
25638
25973
  }
25639
- clause = import_typescript5.default.factory.updateImportClause(clause, clause.isTypeOnly, clause.name, import_typescript5.default.factory.createNamedImports(elements));
25974
+ clause = import_typescript6.default.factory.updateImportClause(clause, clause.isTypeOnly, clause.name, import_typescript6.default.factory.createNamedImports(elements));
25640
25975
  }
25641
25976
  return clause;
25642
25977
  }
25643
25978
  function updateClassImports(propAssignment, removeCommonModule) {
25644
- const printer = import_typescript5.default.createPrinter();
25979
+ const printer = import_typescript6.default.createPrinter();
25645
25980
  const importList = propAssignment.initializer;
25646
25981
  const removals = removeCommonModule ? importWithCommonRemovals : importRemovals;
25647
25982
  const elements = importList.elements.filter((el) => !removals.includes(el.getText()));
25648
25983
  if (elements.length === importList.elements.length) {
25649
25984
  return null;
25650
25985
  }
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());
25986
+ const updatedElements = import_typescript6.default.factory.updateArrayLiteralExpression(importList, elements);
25987
+ const updatedAssignment = import_typescript6.default.factory.updatePropertyAssignment(propAssignment, propAssignment.name, updatedElements);
25988
+ return printer.printNode(import_typescript6.default.EmitHint.Unspecified, updatedAssignment, updatedAssignment.getSourceFile());
25654
25989
  }
25655
25990
  function analyzeImportDeclarations(node, sourceFile, analyzedFiles) {
25656
25991
  if (node.getText().indexOf("@angular/common") === -1) {
25657
25992
  return;
25658
25993
  }
25659
25994
  const clause = node.getChildAt(1);
25660
- if (clause.namedBindings && import_typescript5.default.isNamedImports(clause.namedBindings)) {
25995
+ if (clause.namedBindings && import_typescript6.default.isNamedImports(clause.namedBindings)) {
25661
25996
  const elements = clause.namedBindings.elements.filter((el) => importWithCommonRemovals.includes(el.getText()));
25662
25997
  if (elements.length > 0) {
25663
- AnalyzedFile.addRange(sourceFile.fileName, sourceFile.fileName, analyzedFiles, { start: node.getStart(), end: node.getEnd(), node, type: "import" });
25998
+ AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
25999
+ start: node.getStart(),
26000
+ end: node.getEnd(),
26001
+ node,
26002
+ type: "importDeclaration",
26003
+ remove: true
26004
+ });
25664
26005
  }
25665
26006
  }
25666
26007
  }
25667
26008
  function analyzeDecorators(node, sourceFile, analyzedFiles) {
25668
26009
  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";
26010
+ const decorator = (_a2 = import_typescript6.default.getDecorators(node)) == null ? void 0 : _a2.find((dec) => {
26011
+ return import_typescript6.default.isCallExpression(dec.expression) && import_typescript6.default.isIdentifier(dec.expression.expression) && dec.expression.expression.text === "Component";
25671
26012
  });
25672
- const metadata = decorator && decorator.expression.arguments.length > 0 && import_typescript5.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
26013
+ const metadata = decorator && decorator.expression.arguments.length > 0 && import_typescript6.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
25673
26014
  if (!metadata) {
25674
26015
  return;
25675
26016
  }
25676
26017
  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)) {
26018
+ if (!import_typescript6.default.isPropertyAssignment(prop) || !import_typescript6.default.isIdentifier(prop.name) && !import_typescript6.default.isStringLiteralLike(prop.name)) {
25678
26019
  continue;
25679
26020
  }
25680
26021
  switch (prop.name.text) {
25681
26022
  case "template":
25682
- AnalyzedFile.addRange(sourceFile.fileName, sourceFile.fileName, analyzedFiles, {
26023
+ AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
25683
26024
  start: prop.initializer.getStart() + 1,
25684
26025
  end: prop.initializer.getEnd() - 1,
25685
26026
  node: prop,
25686
- type: "template"
26027
+ type: "template",
26028
+ remove: true
25687
26029
  });
25688
26030
  break;
25689
26031
  case "imports":
25690
- AnalyzedFile.addRange(sourceFile.fileName, sourceFile.fileName, analyzedFiles, {
26032
+ AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
25691
26033
  start: prop.name.getStart(),
25692
26034
  end: prop.initializer.getEnd(),
25693
26035
  node: prop,
25694
- type: "import"
26036
+ type: "importDecorator",
26037
+ remove: true
25695
26038
  });
25696
26039
  break;
25697
26040
  case "templateUrl":
25698
- if (import_typescript5.default.isStringLiteralLike(prop.initializer)) {
26041
+ if (import_typescript6.default.isStringLiteralLike(prop.initializer)) {
25699
26042
  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" });
26043
+ AnalyzedFile.addRange(path2, sourceFile, analyzedFiles, { start: 0, node: prop, type: "templateUrl", remove: true });
25701
26044
  }
25702
26045
  break;
25703
26046
  }
@@ -25724,12 +26067,48 @@ function parseTemplate2(template2) {
25724
26067
  preserveLineEndings: true
25725
26068
  });
25726
26069
  if (parsed.errors && parsed.errors.length > 0) {
25727
- return null;
26070
+ const errors = parsed.errors.map((e) => ({ type: "parse", error: e }));
26071
+ return { tree: void 0, errors };
25728
26072
  }
25729
26073
  } catch (e) {
25730
- return null;
26074
+ return { tree: void 0, errors: [{ type: "parse", error: e }] };
25731
26075
  }
25732
- return parsed;
26076
+ return { tree: parsed, errors: [] };
26077
+ }
26078
+ function validateMigratedTemplate(migrated, fileName) {
26079
+ const parsed = parseTemplate2(migrated);
26080
+ let errors = [];
26081
+ if (parsed.errors.length > 0) {
26082
+ errors.push({
26083
+ type: "parse",
26084
+ error: new Error(`The migration resulted in invalid HTML for ${fileName}. Please check the template for valid HTML structures and run the migration again.`)
26085
+ });
26086
+ }
26087
+ if (parsed.tree) {
26088
+ const i18nError = validateI18nStructure(parsed.tree, fileName);
26089
+ if (i18nError !== null) {
26090
+ errors.push({ type: "i18n", error: i18nError });
26091
+ }
26092
+ }
26093
+ return errors;
26094
+ }
26095
+ function validateI18nStructure(parsed, fileName) {
26096
+ const visitor = new i18nCollector();
26097
+ visitAll2(visitor, parsed.rootNodes);
26098
+ const parents = visitor.elements.filter((el) => el.children.length > 0);
26099
+ for (const p of parents) {
26100
+ for (const el of visitor.elements) {
26101
+ if (el === p)
26102
+ continue;
26103
+ if (isChildOf(p, el)) {
26104
+ 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.`);
26105
+ }
26106
+ }
26107
+ }
26108
+ return null;
26109
+ }
26110
+ function isChildOf(parent, el) {
26111
+ return parent.sourceSpan.start.offset < el.sourceSpan.start.offset && parent.sourceSpan.end.offset > el.sourceSpan.end.offset;
25733
26112
  }
25734
26113
  function calculateNesting(visitor, hasLineBreaks2) {
25735
26114
  let nestedQueue = [];
@@ -25766,9 +26145,9 @@ function reduceNestingOffset(el, nestLevel, offset, postOffsets) {
25766
26145
  function getTemplates(template2) {
25767
26146
  var _a2;
25768
26147
  const parsed = parseTemplate2(template2);
25769
- if (parsed !== null) {
26148
+ if (parsed.tree !== void 0) {
25770
26149
  const visitor = new TemplateCollector();
25771
- visitAll2(visitor, parsed.rootNodes);
26150
+ visitAll2(visitor, parsed.tree.rootNodes);
25772
26151
  for (let [key, tmpl] of visitor.templates) {
25773
26152
  const escapeKey = escapeRegExp(key.slice(1));
25774
26153
  const regex = new RegExp(`[^a-zA-Z0-9-<(']${escapeKey}\\W`, "gm");
@@ -25821,7 +26200,7 @@ function processNgTemplates(template2) {
25821
26200
  template2 = template2.replace(replaceRegex, t.children);
25822
26201
  }
25823
26202
  if (t.count === matches.length + 1 && safeToRemove) {
25824
- template2 = template2.replace(t.contents, "");
26203
+ template2 = template2.replace(t.contents, `${startMarker}${endMarker}`);
25825
26204
  }
25826
26205
  updateTemplates(template2, templates);
25827
26206
  }
@@ -25835,30 +26214,29 @@ function processNgTemplates(template2) {
25835
26214
  function replaceRemainingPlaceholders(template2) {
25836
26215
  const replaceRegex = new RegExp(`\u03B8.*\u03B4`, "g");
25837
26216
  const placeholders = [...template2.matchAll(replaceRegex)];
25838
- let migrated = template2;
25839
26217
  for (let ph of placeholders) {
25840
26218
  const placeholder = ph[0];
25841
26219
  const name = placeholder.slice(1, placeholder.length - 1);
25842
- migrated = template2.replace(placeholder, `<ng-template [ngTemplateOutlet]="${name}"></ng-template>`);
26220
+ template2 = template2.replace(placeholder, `<ng-template [ngTemplateOutlet]="${name}"></ng-template>`);
25843
26221
  }
25844
- return migrated;
26222
+ return template2;
25845
26223
  }
25846
26224
  function canRemoveCommonModule(template2) {
25847
26225
  const parsed = parseTemplate2(template2);
25848
26226
  let removeCommonModule = false;
25849
- if (parsed !== null) {
26227
+ if (parsed.tree !== void 0) {
25850
26228
  const visitor = new CommonCollector();
25851
- visitAll2(visitor, parsed.rootNodes);
26229
+ visitAll2(visitor, parsed.tree.rootNodes);
25852
26230
  removeCommonModule = visitor.count === 0;
25853
26231
  }
25854
26232
  return removeCommonModule;
25855
26233
  }
25856
- function removeImports(template2, node, removeCommonModule) {
25857
- if (template2.startsWith("imports") && import_typescript5.default.isPropertyAssignment(node)) {
25858
- const updatedImport = updateClassImports(node, removeCommonModule);
26234
+ function removeImports(template2, node, file) {
26235
+ if (template2.startsWith("imports") && import_typescript6.default.isPropertyAssignment(node)) {
26236
+ const updatedImport = updateClassImports(node, file.removeCommonModule);
25859
26237
  return updatedImport != null ? updatedImport : template2;
25860
- } else if (import_typescript5.default.isImportDeclaration(node) && checkIfShouldChange(node, removeCommonModule)) {
25861
- return updateImportDeclaration(node, removeCommonModule);
26238
+ } else if (import_typescript6.default.isImportDeclaration(node) && checkIfShouldChange(node, file)) {
26239
+ return updateImportDeclaration(node, file.removeCommonModule);
25862
26240
  }
25863
26241
  return template2;
25864
26242
  }
@@ -25869,10 +26247,21 @@ function getOriginals(etm, tmpl, offset) {
25869
26247
  const start2 = tmpl.slice(etm.el.sourceSpan.start.offset - offset, etm.el.children[0].sourceSpan.start.offset - offset);
25870
26248
  const end = tmpl.slice(etm.el.children[etm.el.children.length - 1].sourceSpan.end.offset - offset, etm.el.sourceSpan.end.offset - offset);
25871
26249
  const childLength = childEnd - childStart;
25872
- return { start: start2, end, childLength };
26250
+ return {
26251
+ start: start2,
26252
+ end,
26253
+ childLength,
26254
+ children: getOriginalChildren(etm.el.children, tmpl, offset),
26255
+ childNodes: etm.el.children
26256
+ };
25873
26257
  }
25874
26258
  const start = tmpl.slice(etm.el.sourceSpan.start.offset - offset, etm.el.sourceSpan.end.offset - offset);
25875
- return { start, end: "", childLength: 0 };
26259
+ return { start, end: "", childLength: 0, children: [], childNodes: [] };
26260
+ }
26261
+ function getOriginalChildren(children, tmpl, offset) {
26262
+ return children.map((child) => {
26263
+ return tmpl.slice(child.sourceSpan.start.offset - offset, child.sourceSpan.end.offset - offset);
26264
+ });
25876
26265
  }
25877
26266
  function isI18nTemplate(etm, i18nAttr) {
25878
26267
  let attrCount = countAttributes(etm);
@@ -25906,6 +26295,8 @@ function getMainBlock(etm, tmpl, offset) {
25906
26295
  if (etm.hasChildren()) {
25907
26296
  const { childStart: childStart2, childEnd: childEnd2 } = etm.getChildSpan(offset);
25908
26297
  middle2 = tmpl.slice(childStart2, childEnd2);
26298
+ } else {
26299
+ middle2 = startMarker + endMarker;
25909
26300
  }
25910
26301
  return { start: "", middle: middle2, end: "" };
25911
26302
  } else if (isI18nTemplate(etm, i18nAttr)) {
@@ -25924,12 +26315,36 @@ function getMainBlock(etm, tmpl, offset) {
25924
26315
  }
25925
26316
  return { start, middle, end };
25926
26317
  }
26318
+ function generateI18nMarkers(tmpl) {
26319
+ let parsed = parseTemplate2(tmpl);
26320
+ if (parsed.tree !== void 0) {
26321
+ const visitor = new i18nCollector();
26322
+ visitAll2(visitor, parsed.tree.rootNodes);
26323
+ for (const [ix, el] of visitor.elements.entries()) {
26324
+ const offset = ix * 2;
26325
+ if (el.children.length > 0) {
26326
+ tmpl = addI18nMarkers(tmpl, el, offset);
26327
+ }
26328
+ }
26329
+ }
26330
+ return tmpl;
26331
+ }
26332
+ function addI18nMarkers(tmpl, el, offset) {
26333
+ const startPos = el.children[0].sourceSpan.start.offset + offset;
26334
+ const endPos = el.children[el.children.length - 1].sourceSpan.end.offset + offset;
26335
+ return tmpl.slice(0, startPos) + startI18nMarker + tmpl.slice(startPos, endPos) + endI18nMarker + tmpl.slice(endPos);
26336
+ }
25927
26337
  var selfClosingList = "input|br|img|base|wbr|area|col|embed|hr|link|meta|param|source|track";
25928
26338
  function formatTemplate(tmpl, templateType) {
25929
26339
  if (tmpl.indexOf("\n") > -1) {
26340
+ tmpl = generateI18nMarkers(tmpl);
25930
26341
  let openSelfClosingEl = false;
25931
26342
  const openBlockRegex = /^\s*\@(if|switch|case|default|for)|^\s*\}\s\@else/;
25932
26343
  const openElRegex = /^\s*<([a-z0-9]+)(?![^>]*\/>)[^>]*>?/;
26344
+ const openAttrDoubleRegex = /="([^"]|\\")*$/;
26345
+ const openAttrSingleRegex = /='([^']|\\')*$/;
26346
+ const closeAttrDoubleRegex = /^\s*([^><]|\\")*"/;
26347
+ const closeAttrSingleRegex = /^\s*([^><]|\\')*'/;
25933
26348
  const selfClosingRegex = new RegExp(`^\\s*<(${selfClosingList}).+\\/?>`);
25934
26349
  const openSelfClosingRegex = new RegExp(`^\\s*<(${selfClosingList})(?![^>]*\\/>)[^>]*$`);
25935
26350
  const closeBlockRegex = /^\s*\}\s*$|^\s*\}\s\@else/;
@@ -25941,8 +26356,22 @@ function formatTemplate(tmpl, templateType) {
25941
26356
  const formatted = [];
25942
26357
  let indent = "";
25943
26358
  let mindent = "";
26359
+ let depth = 0;
26360
+ let i18nDepth = 0;
26361
+ let inMigratedBlock = false;
26362
+ let inI18nBlock = false;
26363
+ let inAttribute = false;
26364
+ let isDoubleQuotes = false;
25944
26365
  for (let [index, line] of lines.entries()) {
25945
- if (line.trim() === "" && index !== 0 && index !== lines.length - 1) {
26366
+ depth += [...line.matchAll(startMarkerRegex)].length - [...line.matchAll(endMarkerRegex)].length;
26367
+ inMigratedBlock = depth > 0;
26368
+ i18nDepth += [...line.matchAll(startI18nMarkerRegex)].length - [...line.matchAll(endI18nMarkerRegex)].length;
26369
+ let lineWasMigrated = false;
26370
+ if (line.match(replaceMarkerRegex)) {
26371
+ line = line.replace(replaceMarkerRegex, "");
26372
+ lineWasMigrated = true;
26373
+ }
26374
+ if (line.trim() === "" && index !== 0 && index !== lines.length - 1 && (inMigratedBlock || lineWasMigrated) && !inI18nBlock && !inAttribute) {
25946
26375
  continue;
25947
26376
  }
25948
26377
  if (templateType === "template" && index <= 1) {
@@ -25952,7 +26381,20 @@ function formatTemplate(tmpl, templateType) {
25952
26381
  if ((closeBlockRegex.test(line) || closeElRegex.test(line) && (!singleLineElRegex.test(line) && !closeMultiLineElRegex.test(line))) && indent !== "") {
25953
26382
  indent = indent.slice(2);
25954
26383
  }
25955
- formatted.push(mindent + indent + line.trim());
26384
+ const isOpenDoubleAttr = openAttrDoubleRegex.test(line);
26385
+ const isOpenSingleAttr = openAttrSingleRegex.test(line);
26386
+ if (!inAttribute && isOpenDoubleAttr) {
26387
+ inAttribute = true;
26388
+ isDoubleQuotes = true;
26389
+ } else if (!inAttribute && isOpenSingleAttr) {
26390
+ inAttribute = true;
26391
+ isDoubleQuotes = false;
26392
+ }
26393
+ const newLine = inI18nBlock || inAttribute ? line : mindent + (line.trim() !== "" ? indent : "") + line.trim();
26394
+ formatted.push(newLine);
26395
+ if (!isOpenDoubleAttr && !isOpenSingleAttr && (inAttribute && isDoubleQuotes && closeAttrDoubleRegex.test(line) || inAttribute && !isDoubleQuotes && closeAttrSingleRegex.test(line))) {
26396
+ inAttribute = false;
26397
+ }
25956
26398
  if (closeMultiLineElRegex.test(line)) {
25957
26399
  indent = indent.slice(2);
25958
26400
  if (openSelfClosingEl) {
@@ -25970,6 +26412,7 @@ function formatTemplate(tmpl, templateType) {
25970
26412
  openSelfClosingEl = true;
25971
26413
  indent += " ";
25972
26414
  }
26415
+ inI18nBlock = i18nDepth > 0;
25973
26416
  }
25974
26417
  tmpl = formatted.join("\n");
25975
26418
  }
@@ -25977,14 +26420,14 @@ function formatTemplate(tmpl, templateType) {
25977
26420
  }
25978
26421
  function forEachClass(sourceFile, callback) {
25979
26422
  sourceFile.forEachChild(function walk(node) {
25980
- if (import_typescript5.default.isClassDeclaration(node) || import_typescript5.default.isImportDeclaration(node)) {
26423
+ if (import_typescript6.default.isClassDeclaration(node) || import_typescript6.default.isImportDeclaration(node)) {
25981
26424
  callback(node);
25982
26425
  }
25983
26426
  node.forEachChild(walk);
25984
26427
  });
25985
26428
  }
25986
26429
 
25987
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/cases.mjs
26430
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/cases.mjs
25988
26431
  var boundcase = "[ngSwitchCase]";
25989
26432
  var switchcase = "*ngSwitchCase";
25990
26433
  var nakedcase = "ngSwitchCase";
@@ -26000,12 +26443,12 @@ var cases = [
26000
26443
  function migrateCase(template2) {
26001
26444
  let errors = [];
26002
26445
  let parsed = parseTemplate2(template2);
26003
- if (parsed === null) {
26446
+ if (parsed.tree === void 0) {
26004
26447
  return { migrated: template2, errors, changed: false };
26005
26448
  }
26006
26449
  let result = template2;
26007
26450
  const visitor = new ElementCollector(cases);
26008
- visitAll2(visitor, parsed.rootNodes);
26451
+ visitAll2(visitor, parsed.tree.rootNodes);
26009
26452
  calculateNesting(visitor, hasLineBreaks(template2));
26010
26453
  let offset = 0;
26011
26454
  let nestLevel = -1;
@@ -26040,8 +26483,8 @@ function migrateNgSwitchCase(etm, tmpl, offset) {
26040
26483
  const condition = etm.attr.value;
26041
26484
  const originals = getOriginals(etm, tmpl, offset);
26042
26485
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26043
- const startBlock = `${leadingSpace}@case (${condition}) {${leadingSpace}${lbString}${start}`;
26044
- const endBlock = `${end}${lbString}${leadingSpace}}`;
26486
+ const startBlock = `${startMarker}${leadingSpace}@case (${condition}) {${leadingSpace}${lbString}${start}`;
26487
+ const endBlock = `${end}${lbString}${leadingSpace}}${endMarker}`;
26045
26488
  const defaultBlock = startBlock + middle + endBlock;
26046
26489
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
26047
26490
  const pre = originals.start.length - startBlock.length;
@@ -26053,8 +26496,8 @@ function migrateNgSwitchDefault(etm, tmpl, offset) {
26053
26496
  const leadingSpace = etm.hasLineBreaks ? "" : " ";
26054
26497
  const originals = getOriginals(etm, tmpl, offset);
26055
26498
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26056
- const startBlock = `${leadingSpace}@default {${leadingSpace}${lbString}${start}`;
26057
- const endBlock = `${end}${lbString}${leadingSpace}}`;
26499
+ const startBlock = `${startMarker}${leadingSpace}@default {${leadingSpace}${lbString}${start}`;
26500
+ const endBlock = `${end}${lbString}${leadingSpace}}${endMarker}`;
26058
26501
  const defaultBlock = startBlock + middle + endBlock;
26059
26502
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
26060
26503
  const pre = originals.start.length - startBlock.length;
@@ -26062,7 +26505,7 @@ function migrateNgSwitchDefault(etm, tmpl, offset) {
26062
26505
  return { tmpl: updatedTmpl, offsets: { pre, post } };
26063
26506
  }
26064
26507
 
26065
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/fors.mjs
26508
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/fors.mjs
26066
26509
  var ngfor = "*ngFor";
26067
26510
  var nakedngfor2 = "ngFor";
26068
26511
  var fors = [
@@ -26081,12 +26524,12 @@ var stringPairs = /* @__PURE__ */ new Map([
26081
26524
  function migrateFor(template2) {
26082
26525
  let errors = [];
26083
26526
  let parsed = parseTemplate2(template2);
26084
- if (parsed === null) {
26527
+ if (parsed.tree === void 0) {
26085
26528
  return { migrated: template2, errors, changed: false };
26086
26529
  }
26087
26530
  let result = template2;
26088
26531
  const visitor = new ElementCollector(fors);
26089
- visitAll2(visitor, parsed.rootNodes);
26532
+ visitAll2(visitor, parsed.tree.rootNodes);
26090
26533
  calculateNesting(visitor, hasLineBreaks(template2));
26091
26534
  let offset = 0;
26092
26535
  let nestLevel = -1;
@@ -26157,8 +26600,8 @@ function migrateStandardNgFor(etm, tmpl, offset) {
26157
26600
  trackBy = trackBy.replace("$index", aliasedIndex);
26158
26601
  }
26159
26602
  const aliasStr = aliases.length > 0 ? `;${aliases.join(";")}` : "";
26160
- let startBlock = `@for (${condition}; track ${trackBy}${aliasStr}) {${lbString}`;
26161
- let endBlock = `${lbString}}`;
26603
+ let startBlock = `${startMarker}@for (${condition}; track ${trackBy}${aliasStr}) {${lbString}`;
26604
+ let endBlock = `${lbString}}${endMarker}`;
26162
26605
  let forBlock = "";
26163
26606
  if (tmplPlaceholder !== "") {
26164
26607
  startBlock = startBlock + tmplPlaceholder;
@@ -26194,10 +26637,10 @@ function migrateBoundNgFor(etm, tmpl, offset) {
26194
26637
  trackBy = `${forAttrs.trackBy.trim()}(${aliasedIndex}, ${aliasAttrs.item})`;
26195
26638
  }
26196
26639
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26197
- const startBlock = `@for (${condition}; track ${trackBy}${aliasStr}) {
26640
+ const startBlock = `${startMarker}@for (${condition}; track ${trackBy}${aliasStr}) {
26198
26641
  ${start}`;
26199
26642
  const endBlock = `${end}
26200
- }`;
26643
+ }${endMarker}`;
26201
26644
  const forBlock = startBlock + middle + endBlock;
26202
26645
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + forBlock + tmpl.slice(etm.end(offset));
26203
26646
  const pre = originals.start.length - startBlock.length;
@@ -26218,10 +26661,10 @@ function getNgForParts(expression) {
26218
26661
  current = "";
26219
26662
  continue;
26220
26663
  }
26221
- if (stringPairs.has(char)) {
26222
- stringStack.push(stringPairs.get(char));
26223
- } else if (stringStack.length > 0 && stringStack[stringStack.length - 1] === char) {
26664
+ if (stringStack.length > 0 && stringStack[stringStack.length - 1] === char) {
26224
26665
  stringStack.pop();
26666
+ } else if (stringPairs.has(char)) {
26667
+ stringStack.push(stringPairs.get(char));
26225
26668
  }
26226
26669
  if (commaSeparatedSyntax.has(char)) {
26227
26670
  commaSeparatedStack.push(commaSeparatedSyntax.get(char));
@@ -26236,7 +26679,7 @@ function getNgForParts(expression) {
26236
26679
  return parts;
26237
26680
  }
26238
26681
 
26239
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/ifs.mjs
26682
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/ifs.mjs
26240
26683
  var ngif = "*ngIf";
26241
26684
  var boundngif = "[ngIf]";
26242
26685
  var nakedngif = "ngIf";
@@ -26248,12 +26691,12 @@ var ifs = [
26248
26691
  function migrateIf(template2) {
26249
26692
  let errors = [];
26250
26693
  let parsed = parseTemplate2(template2);
26251
- if (parsed === null) {
26694
+ if (parsed.tree === void 0) {
26252
26695
  return { migrated: template2, errors, changed: false };
26253
26696
  }
26254
26697
  let result = template2;
26255
26698
  const visitor = new ElementCollector(ifs);
26256
- visitAll2(visitor, parsed.rootNodes);
26699
+ visitAll2(visitor, parsed.tree.rootNodes);
26257
26700
  calculateNesting(visitor, hasLineBreaks(template2));
26258
26701
  let offset = 0;
26259
26702
  let nestLevel = -1;
@@ -26303,8 +26746,8 @@ function buildIfBlock(etm, tmpl, offset) {
26303
26746
  }
26304
26747
  const originals = getOriginals(etm, tmpl, offset);
26305
26748
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26306
- const startBlock = `@if (${condition}) {${lbString}${start}`;
26307
- const endBlock = `${end}${lbString}}`;
26749
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}${start}`;
26750
+ const endBlock = `${end}${lbString}}${endMarker}`;
26308
26751
  const ifBlock = startBlock + middle + endBlock;
26309
26752
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + ifBlock + tmpl.slice(etm.end(offset));
26310
26753
  const pre = originals.start.length - startBlock.length;
@@ -26328,9 +26771,9 @@ function buildBoundIfElseBlock(etm, tmpl, offset) {
26328
26771
  } else if (aliases.length === 1) {
26329
26772
  condition += `; as ${aliases[0]}`;
26330
26773
  }
26331
- const elsePlaceholder = `\u03B8${etm.elseAttr.value}\u03B4`;
26774
+ const elsePlaceholder = `\u03B8${etm.elseAttr.value.trim()}\u03B4`;
26332
26775
  if (etm.thenAttr !== void 0) {
26333
- const thenPlaceholder = `\u03B8${etm.thenAttr.value}\u03B4`;
26776
+ const thenPlaceholder = `\u03B8${etm.thenAttr.value.trim()}\u03B4`;
26334
26777
  return buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceholder, offset);
26335
26778
  }
26336
26779
  return buildIfElseBlock(etm, tmpl, condition, elsePlaceholder, offset);
@@ -26339,9 +26782,9 @@ function buildIfElseBlock(etm, tmpl, condition, elsePlaceholder, offset) {
26339
26782
  const lbString = etm.hasLineBreaks ? "\n" : "";
26340
26783
  const originals = getOriginals(etm, tmpl, offset);
26341
26784
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26342
- const startBlock = `@if (${condition}) {${lbString}${start}`;
26785
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}${start}`;
26343
26786
  const elseBlock = `${end}${lbString}} @else {${lbString}`;
26344
- const postBlock = elseBlock + elsePlaceholder + `${lbString}}`;
26787
+ const postBlock = elseBlock + elsePlaceholder + `${lbString}}${endMarker}`;
26345
26788
  const ifElseBlock = startBlock + middle + postBlock;
26346
26789
  const tmplStart = tmpl.slice(0, etm.start(offset));
26347
26790
  const tmplEnd = tmpl.slice(etm.end(offset));
@@ -26364,9 +26807,9 @@ function buildStandardIfThenBlock(etm, tmpl, thenString, offset) {
26364
26807
  function buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceholder, offset) {
26365
26808
  const lbString = etm.hasLineBreaks ? "\n" : "";
26366
26809
  const originals = getOriginals(etm, tmpl, offset);
26367
- const startBlock = `@if (${condition}) {${lbString}`;
26810
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}`;
26368
26811
  const elseBlock = `${lbString}} @else {${lbString}`;
26369
- const postBlock = thenPlaceholder + elseBlock + elsePlaceholder + `${lbString}}`;
26812
+ const postBlock = thenPlaceholder + elseBlock + elsePlaceholder + `${lbString}}${endMarker}`;
26370
26813
  const ifThenElseBlock = startBlock + postBlock;
26371
26814
  const tmplStart = tmpl.slice(0, etm.start(offset));
26372
26815
  const tmplEnd = tmpl.slice(etm.end(offset));
@@ -26378,8 +26821,8 @@ function buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceho
26378
26821
  function buildIfThenBlock(etm, tmpl, condition, thenPlaceholder, offset) {
26379
26822
  const lbString = etm.hasLineBreaks ? "\n" : "";
26380
26823
  const originals = getOriginals(etm, tmpl, offset);
26381
- const startBlock = `@if (${condition}) {${lbString}`;
26382
- const postBlock = thenPlaceholder + `${lbString}}`;
26824
+ const startBlock = `${startMarker}@if (${condition}) {${lbString}`;
26825
+ const postBlock = thenPlaceholder + `${lbString}}${endMarker}`;
26383
26826
  const ifThenBlock = startBlock + postBlock;
26384
26827
  const tmplStart = tmpl.slice(0, etm.start(offset));
26385
26828
  const tmplEnd = tmpl.slice(etm.end(offset));
@@ -26389,7 +26832,7 @@ function buildIfThenBlock(etm, tmpl, condition, thenPlaceholder, offset) {
26389
26832
  return { tmpl: updatedTmpl, offsets: { pre, post } };
26390
26833
  }
26391
26834
 
26392
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/switches.mjs
26835
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/switches.mjs
26393
26836
  var ngswitch = "[ngSwitch]";
26394
26837
  var switches = [
26395
26838
  ngswitch
@@ -26397,12 +26840,12 @@ var switches = [
26397
26840
  function migrateSwitch(template2) {
26398
26841
  let errors = [];
26399
26842
  let parsed = parseTemplate2(template2);
26400
- if (parsed === null) {
26843
+ if (parsed.tree === void 0) {
26401
26844
  return { migrated: template2, errors, changed: false };
26402
26845
  }
26403
26846
  let result = template2;
26404
26847
  const visitor = new ElementCollector(switches);
26405
- visitAll2(visitor, parsed.rootNodes);
26848
+ visitAll2(visitor, parsed.tree.rootNodes);
26406
26849
  calculateNesting(visitor, hasLineBreaks(template2));
26407
26850
  let offset = 0;
26408
26851
  let nestLevel = -1;
@@ -26425,13 +26868,31 @@ function migrateSwitch(template2) {
26425
26868
  const changed = visitor.elements.length > 0;
26426
26869
  return { migrated: result, errors, changed };
26427
26870
  }
26871
+ function assertValidSwitchStructure(children) {
26872
+ for (const child of children) {
26873
+ if (child instanceof Text4 && child.value.trim() !== "") {
26874
+ throw new Error(`Text node: "${child.value}" would result in invalid migrated @switch block structure. @switch can only have @case or @default as children.`);
26875
+ } else if (child instanceof Element2) {
26876
+ let hasCase = false;
26877
+ for (const attr of child.attrs) {
26878
+ if (cases.includes(attr.name)) {
26879
+ hasCase = true;
26880
+ }
26881
+ }
26882
+ if (!hasCase) {
26883
+ throw new Error(`Element node: "${child.name}" would result in invalid migrated @switch block structure. @switch can only have @case or @default as children.`);
26884
+ }
26885
+ }
26886
+ }
26887
+ }
26428
26888
  function migrateNgSwitch(etm, tmpl, offset) {
26429
26889
  const lbString = etm.hasLineBreaks ? "\n" : "";
26430
26890
  const condition = etm.attr.value;
26431
26891
  const originals = getOriginals(etm, tmpl, offset);
26892
+ assertValidSwitchStructure(originals.childNodes);
26432
26893
  const { start, middle, end } = getMainBlock(etm, tmpl, offset);
26433
- const startBlock = `${start}${lbString}@switch (${condition}) {`;
26434
- const endBlock = `}${lbString}${end}`;
26894
+ const startBlock = `${startMarker}${start}${lbString}@switch (${condition}) {`;
26895
+ const endBlock = `}${lbString}${end}${endMarker}`;
26435
26896
  const switchBlock = startBlock + middle + endBlock;
26436
26897
  const updatedTmpl = tmpl.slice(0, etm.start(offset)) + switchBlock + tmpl.slice(etm.end(offset));
26437
26898
  const pre = originals.start.length - startBlock.length;
@@ -26439,7 +26900,7 @@ function migrateNgSwitch(etm, tmpl, offset) {
26439
26900
  return { tmpl: updatedTmpl, offsets: { pre, post } };
26440
26901
  }
26441
26902
 
26442
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/migration.mjs
26903
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/migration.mjs
26443
26904
  function migrateTemplate(template2, templateType, node, file, format = true, analyzedFiles) {
26444
26905
  let errors = [];
26445
26906
  let migrated = template2;
@@ -26447,6 +26908,9 @@ function migrateTemplate(template2, templateType, node, file, format = true, ana
26447
26908
  const ifResult = migrateIf(template2);
26448
26909
  const forResult = migrateFor(ifResult.migrated);
26449
26910
  const switchResult = migrateSwitch(forResult.migrated);
26911
+ if (switchResult.errors.length > 0) {
26912
+ return { migrated: template2, errors: switchResult.errors };
26913
+ }
26450
26914
  const caseResult = migrateCase(switchResult.migrated);
26451
26915
  const templateResult = processNgTemplates(caseResult.migrated);
26452
26916
  if (templateResult.err !== void 0) {
@@ -26454,27 +26918,40 @@ function migrateTemplate(template2, templateType, node, file, format = true, ana
26454
26918
  }
26455
26919
  migrated = templateResult.migrated;
26456
26920
  const changed = ifResult.changed || forResult.changed || switchResult.changed || caseResult.changed;
26921
+ if (changed) {
26922
+ const errors2 = validateMigratedTemplate(migrated, file.sourceFile.fileName);
26923
+ if (errors2.length > 0) {
26924
+ return { migrated: template2, errors: errors2 };
26925
+ }
26926
+ }
26457
26927
  if (format && changed) {
26458
26928
  migrated = formatTemplate(migrated, templateType);
26459
26929
  }
26930
+ const markerRegex = new RegExp(`${startMarker}|${endMarker}|${startI18nMarker}|${endI18nMarker}`, "gm");
26931
+ migrated = migrated.replace(markerRegex, "");
26460
26932
  file.removeCommonModule = canRemoveCommonModule(template2);
26461
- if (templateType === "templateUrl" && analyzedFiles !== null && analyzedFiles.has(file.sourceFilePath)) {
26462
- const componentFile = analyzedFiles.get(file.sourceFilePath);
26933
+ file.canRemoveImports = true;
26934
+ if (templateType === "templateUrl" && analyzedFiles !== null && analyzedFiles.has(file.sourceFile.fileName)) {
26935
+ const componentFile = analyzedFiles.get(file.sourceFile.fileName);
26936
+ componentFile.getSortedRanges();
26463
26937
  componentFile.removeCommonModule = file.removeCommonModule;
26938
+ componentFile.canRemoveImports = file.canRemoveImports;
26939
+ componentFile.verifyCanRemoveImports();
26464
26940
  }
26941
+ file.verifyCanRemoveImports();
26465
26942
  errors = [
26466
26943
  ...ifResult.errors,
26467
26944
  ...forResult.errors,
26468
26945
  ...switchResult.errors,
26469
26946
  ...caseResult.errors
26470
26947
  ];
26471
- } else {
26472
- migrated = removeImports(template2, node, file.removeCommonModule);
26948
+ } else if (file.canRemoveImports) {
26949
+ migrated = removeImports(template2, node, file);
26473
26950
  }
26474
26951
  return { migrated, errors };
26475
26952
  }
26476
26953
 
26477
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/index.mjs
26954
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/index.mjs
26478
26955
  function control_flow_migration_default(options) {
26479
26956
  return (tree, context) => __async(this, null, function* () {
26480
26957
  const basePath = process.cwd();