@angular/core 17.1.0-next.2 → 17.1.0-next.4

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 (69) 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 +509 -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/scheduling.mjs +103 -0
  13. package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
  14. package/esm2022/src/core.mjs +15 -7
  15. package/esm2022/src/core_private_export.mjs +5 -3
  16. package/esm2022/src/core_reactivity_export_internal.mjs +2 -2
  17. package/esm2022/src/core_render3_private_export.mjs +2 -2
  18. package/esm2022/src/error_handler.mjs +15 -1
  19. package/esm2022/src/hydration/annotate.mjs +30 -20
  20. package/esm2022/src/hydration/api.mjs +2 -2
  21. package/esm2022/src/hydration/cleanup.mjs +1 -1
  22. package/esm2022/src/hydration/interfaces.mjs +1 -1
  23. package/esm2022/src/hydration/node_lookup_utils.mjs +23 -2
  24. package/esm2022/src/image_performance_warning.mjs +2 -2
  25. package/esm2022/src/linker/query_list.mjs +8 -6
  26. package/esm2022/src/metadata/do_bootstrap.mjs +1 -1
  27. package/esm2022/src/platform/platform.mjs +135 -0
  28. package/esm2022/src/platform/platform_core_providers.mjs +15 -0
  29. package/esm2022/src/platform/platform_ref.mjs +179 -0
  30. package/esm2022/src/render3/instructions/change_detection.mjs +2 -4
  31. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  32. package/esm2022/src/render3/interfaces/public_definitions.mjs +1 -1
  33. package/esm2022/src/render3/list_reconciliation.mjs +58 -24
  34. package/esm2022/src/render3/node_manipulation.mjs +2 -2
  35. package/esm2022/src/render3/util/change_detection_utils.mjs +3 -1
  36. package/esm2022/src/render3/util/misc_utils.mjs +2 -2
  37. package/esm2022/src/render3/view_manipulation.mjs +13 -5
  38. package/esm2022/src/render3/view_ref.mjs +7 -1
  39. package/esm2022/src/transfer_state.mjs +2 -2
  40. package/esm2022/src/util/performance.mjs +2 -2
  41. package/esm2022/src/version.mjs +1 -1
  42. package/esm2022/src/zone/ng_zone.mjs +10 -1
  43. package/esm2022/testing/src/component_fixture.mjs +20 -36
  44. package/esm2022/testing/src/logger.mjs +3 -3
  45. package/esm2022/testing/src/test_bed.mjs +5 -6
  46. package/fesm2022/core.mjs +1280 -1169
  47. package/fesm2022/core.mjs.map +1 -1
  48. package/fesm2022/primitives/signals.mjs +2 -9
  49. package/fesm2022/primitives/signals.mjs.map +1 -1
  50. package/fesm2022/rxjs-interop.mjs +1 -1
  51. package/fesm2022/testing.mjs +46 -64
  52. package/fesm2022/testing.mjs.map +1 -1
  53. package/index.d.ts +161 -21
  54. package/package.json +1 -1
  55. package/primitives/signals/index.d.ts +1 -1
  56. package/rxjs-interop/index.d.ts +1 -1
  57. package/schematics/migrations/block-template-entities/bundle.js +951 -429
  58. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  59. package/schematics/ng-generate/control-flow-migration/bundle.js +1214 -497
  60. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  61. package/schematics/ng-generate/standalone-migration/bundle.js +2023 -1223
  62. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  63. package/testing/index.d.ts +6 -10
  64. package/esm2022/src/application_config.mjs +0 -21
  65. package/esm2022/src/application_init.mjs +0 -188
  66. package/esm2022/src/application_module.mjs +0 -29
  67. package/esm2022/src/application_ref.mjs +0 -997
  68. package/esm2022/src/application_tokens.mjs +0 -121
  69. package/esm2022/src/platform_core_providers.mjs +0 -15
@@ -2586,6 +2586,12 @@ var Identifiers = _Identifiers;
2586
2586
  (() => {
2587
2587
  _Identifiers.validateIframeAttribute = { name: "\u0275\u0275validateIframeAttribute", moduleName: CORE };
2588
2588
  })();
2589
+ (() => {
2590
+ _Identifiers.InputSignalBrandWriteType = { name: "\u0275INPUT_SIGNAL_BRAND_WRITE_TYPE", moduleName: CORE };
2591
+ })();
2592
+ (() => {
2593
+ _Identifiers.UnwrapDirectiveSignalInputs = { name: "\u0275UnwrapDirectiveSignalInputs", moduleName: CORE };
2594
+ })();
2589
2595
 
2590
2596
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/util.mjs
2591
2597
  var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
@@ -7109,6 +7115,7 @@ var OpKind;
7109
7115
  OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
7110
7116
  OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
7111
7117
  OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
7118
+ OpKind2[OpKind2["I18nAttributes"] = 44] = "I18nAttributes";
7112
7119
  })(OpKind || (OpKind = {}));
7113
7120
  var ExpressionKind;
7114
7121
  (function(ExpressionKind2) {
@@ -7133,10 +7140,11 @@ var ExpressionKind;
7133
7140
  ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
7134
7141
  ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
7135
7142
  ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 20] = "SanitizerExpr";
7136
- ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 21] = "SlotLiteralExpr";
7137
- ExpressionKind2[ExpressionKind2["ConditionalCase"] = 22] = "ConditionalCase";
7138
- ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 23] = "DerivedRepeaterVar";
7139
- ExpressionKind2[ExpressionKind2["ConstCollected"] = 24] = "ConstCollected";
7143
+ ExpressionKind2[ExpressionKind2["TrustedValueFnExpr"] = 21] = "TrustedValueFnExpr";
7144
+ ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 22] = "SlotLiteralExpr";
7145
+ ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
7146
+ ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 24] = "DerivedRepeaterVar";
7147
+ ExpressionKind2[ExpressionKind2["ConstCollected"] = 25] = "ConstCollected";
7140
7148
  })(ExpressionKind || (ExpressionKind = {}));
7141
7149
  var VariableFlags;
7142
7150
  (function(VariableFlags2) {
@@ -7155,15 +7163,6 @@ var CompatibilityMode;
7155
7163
  CompatibilityMode2[CompatibilityMode2["Normal"] = 0] = "Normal";
7156
7164
  CompatibilityMode2[CompatibilityMode2["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
7157
7165
  })(CompatibilityMode || (CompatibilityMode = {}));
7158
- var SanitizerFn;
7159
- (function(SanitizerFn2) {
7160
- SanitizerFn2[SanitizerFn2["Html"] = 0] = "Html";
7161
- SanitizerFn2[SanitizerFn2["Script"] = 1] = "Script";
7162
- SanitizerFn2[SanitizerFn2["Style"] = 2] = "Style";
7163
- SanitizerFn2[SanitizerFn2["Url"] = 3] = "Url";
7164
- SanitizerFn2[SanitizerFn2["ResourceUrl"] = 4] = "ResourceUrl";
7165
- SanitizerFn2[SanitizerFn2["IframeAttribute"] = 5] = "IframeAttribute";
7166
- })(SanitizerFn || (SanitizerFn = {}));
7167
7166
  var DeferSecondaryKind;
7168
7167
  (function(DeferSecondaryKind2) {
7169
7168
  DeferSecondaryKind2[DeferSecondaryKind2["Loading"] = 0] = "Loading";
@@ -7185,6 +7184,11 @@ var I18nParamResolutionTime;
7185
7184
  I18nParamResolutionTime2[I18nParamResolutionTime2["Creation"] = 0] = "Creation";
7186
7185
  I18nParamResolutionTime2[I18nParamResolutionTime2["Postproccessing"] = 1] = "Postproccessing";
7187
7186
  })(I18nParamResolutionTime || (I18nParamResolutionTime = {}));
7187
+ var I18nExpressionFor;
7188
+ (function(I18nExpressionFor2) {
7189
+ I18nExpressionFor2[I18nExpressionFor2["I18nText"] = 0] = "I18nText";
7190
+ I18nExpressionFor2[I18nExpressionFor2["I18nAttribute"] = 1] = "I18nAttribute";
7191
+ })(I18nExpressionFor || (I18nExpressionFor = {}));
7188
7192
  var I18nParamValueFlags;
7189
7193
  (function(I18nParamValueFlags2) {
7190
7194
  I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
@@ -7220,7 +7224,14 @@ var I18nContextKind;
7220
7224
  (function(I18nContextKind2) {
7221
7225
  I18nContextKind2[I18nContextKind2["RootI18n"] = 0] = "RootI18n";
7222
7226
  I18nContextKind2[I18nContextKind2["Icu"] = 1] = "Icu";
7227
+ I18nContextKind2[I18nContextKind2["Attr"] = 2] = "Attr";
7223
7228
  })(I18nContextKind || (I18nContextKind = {}));
7229
+ var TemplateKind;
7230
+ (function(TemplateKind2) {
7231
+ TemplateKind2[TemplateKind2["NgTemplate"] = 0] = "NgTemplate";
7232
+ TemplateKind2[TemplateKind2["Structural"] = 1] = "Structural";
7233
+ TemplateKind2[TemplateKind2["Block"] = 2] = "Block";
7234
+ })(TemplateKind || (TemplateKind = {}));
7224
7235
 
7225
7236
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7226
7237
  var ConsumesSlot = Symbol("ConsumesSlot");
@@ -7277,22 +7288,25 @@ var NEW_OP = {
7277
7288
  };
7278
7289
 
7279
7290
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
7280
- function createInterpolateTextOp(xref, interpolation, i18nPlaceholders, sourceSpan) {
7291
+ function createInterpolateTextOp(xref, interpolation, sourceSpan) {
7281
7292
  return __spreadValues(__spreadValues(__spreadValues({
7282
7293
  kind: OpKind.InterpolateText,
7283
7294
  target: xref,
7284
7295
  interpolation,
7285
- i18nPlaceholders,
7286
7296
  sourceSpan
7287
7297
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7288
7298
  }
7289
7299
  var Interpolation2 = class {
7290
- constructor(strings, expressions) {
7300
+ constructor(strings, expressions, i18nPlaceholders) {
7291
7301
  this.strings = strings;
7292
7302
  this.expressions = expressions;
7303
+ this.i18nPlaceholders = i18nPlaceholders;
7304
+ if (i18nPlaceholders.length !== 0 && i18nPlaceholders.length !== expressions.length) {
7305
+ throw new Error(`Expected ${expressions.length} placeholders to match interpolation expression count, but got ${i18nPlaceholders.length}`);
7306
+ }
7293
7307
  }
7294
7308
  };
7295
- function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isTemplate, sourceSpan) {
7309
+ function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7296
7310
  return __spreadValues({
7297
7311
  kind: OpKind.Binding,
7298
7312
  bindingKind: kind,
@@ -7302,11 +7316,14 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
7302
7316
  unit,
7303
7317
  securityContext,
7304
7318
  isTextAttribute,
7305
- isTemplate,
7319
+ isStructuralTemplateAttribute,
7320
+ templateKind,
7321
+ i18nContext: null,
7322
+ i18nMessage,
7306
7323
  sourceSpan
7307
7324
  }, NEW_OP);
7308
7325
  }
7309
- function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isTemplate, sourceSpan) {
7326
+ function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
7310
7327
  return __spreadValues(__spreadValues(__spreadValues({
7311
7328
  kind: OpKind.Property,
7312
7329
  target,
@@ -7315,7 +7332,10 @@ function createPropertyOp(target, name, expression, isAnimationTrigger, security
7315
7332
  isAnimationTrigger,
7316
7333
  securityContext,
7317
7334
  sanitizer: null,
7318
- isTemplate,
7335
+ isStructuralTemplateAttribute,
7336
+ templateKind,
7337
+ i18nContext,
7338
+ i18nMessage,
7319
7339
  sourceSpan
7320
7340
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7321
7341
  }
@@ -7354,7 +7374,7 @@ function createClassMapOp(xref, expression, sourceSpan) {
7354
7374
  sourceSpan
7355
7375
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7356
7376
  }
7357
- function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isTemplate, sourceSpan) {
7377
+ function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7358
7378
  return __spreadValues(__spreadValues(__spreadValues({
7359
7379
  kind: OpKind.Attribute,
7360
7380
  target,
@@ -7363,7 +7383,10 @@ function createAttributeOp(target, name, expression, securityContext, isTextAttr
7363
7383
  securityContext,
7364
7384
  sanitizer: null,
7365
7385
  isTextAttribute,
7366
- isTemplate,
7386
+ isStructuralTemplateAttribute,
7387
+ templateKind,
7388
+ i18nContext: null,
7389
+ i18nMessage,
7367
7390
  sourceSpan
7368
7391
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7369
7392
  }
@@ -7404,22 +7427,25 @@ function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
7404
7427
  sourceSpan
7405
7428
  }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7406
7429
  }
7407
- function createI18nExpressionOp(context, target, handle, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
7430
+ function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
7408
7431
  return __spreadValues(__spreadValues(__spreadValues({
7409
7432
  kind: OpKind.I18nExpression,
7410
7433
  context,
7411
7434
  target,
7435
+ i18nOwner,
7412
7436
  handle,
7413
7437
  expression,
7414
7438
  i18nPlaceholder,
7415
7439
  resolutionTime,
7440
+ usage,
7441
+ name,
7416
7442
  sourceSpan
7417
7443
  }, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7418
7444
  }
7419
- function createI18nApplyOp(target, handle, sourceSpan) {
7445
+ function createI18nApplyOp(owner, handle, sourceSpan) {
7420
7446
  return __spreadValues({
7421
7447
  kind: OpKind.I18nApply,
7422
- target,
7448
+ owner,
7423
7449
  handle,
7424
7450
  sourceSpan
7425
7451
  }, NEW_OP);
@@ -7956,26 +7982,6 @@ var ReadTemporaryExpr = class extends ExpressionBase {
7956
7982
  return r;
7957
7983
  }
7958
7984
  };
7959
- var SanitizerExpr = class extends ExpressionBase {
7960
- constructor(fn2) {
7961
- super();
7962
- this.fn = fn2;
7963
- this.kind = ExpressionKind.SanitizerExpr;
7964
- }
7965
- visitExpression(visitor, context) {
7966
- }
7967
- isEquivalent(e) {
7968
- return e instanceof SanitizerExpr && e.fn === this.fn;
7969
- }
7970
- isConstant() {
7971
- return true;
7972
- }
7973
- clone() {
7974
- return new SanitizerExpr(this.fn);
7975
- }
7976
- transformInternalExpressions() {
7977
- }
7978
- };
7979
7985
  var SlotLiteralExpr = class extends ExpressionBase {
7980
7986
  constructor(slot) {
7981
7987
  super();
@@ -8094,7 +8100,6 @@ function transformExpressionsInOp(op, transform2, flags) {
8094
8100
  case OpKind.ClassProp:
8095
8101
  case OpKind.ClassMap:
8096
8102
  case OpKind.Binding:
8097
- case OpKind.HostProperty:
8098
8103
  if (op.expression instanceof Interpolation2) {
8099
8104
  transformExpressionsInInterpolation(op.expression, transform2, flags);
8100
8105
  } else {
@@ -8102,6 +8107,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8102
8107
  }
8103
8108
  break;
8104
8109
  case OpKind.Property:
8110
+ case OpKind.HostProperty:
8105
8111
  case OpKind.Attribute:
8106
8112
  if (op.expression instanceof Interpolation2) {
8107
8113
  transformExpressionsInInterpolation(op.expression, transform2, flags);
@@ -8143,6 +8149,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8143
8149
  break;
8144
8150
  case OpKind.ExtractedAttribute:
8145
8151
  op.expression = op.expression && transformExpressionsInExpression(op.expression, transform2, flags);
8152
+ op.trustedValueFn = op.trustedValueFn && transformExpressionsInExpression(op.trustedValueFn, transform2, flags);
8146
8153
  break;
8147
8154
  case OpKind.RepeaterCreate:
8148
8155
  op.track = transformExpressionsInExpression(op.track, transform2, flags);
@@ -8195,6 +8202,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8195
8202
  case OpKind.ProjectionDef:
8196
8203
  case OpKind.Template:
8197
8204
  case OpKind.Text:
8205
+ case OpKind.I18nAttributes:
8198
8206
  break;
8199
8207
  default:
8200
8208
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -8206,6 +8214,8 @@ function transformExpressionsInExpression(expr, transform2, flags) {
8206
8214
  } else if (expr instanceof BinaryOperatorExpr) {
8207
8215
  expr.lhs = transformExpressionsInExpression(expr.lhs, transform2, flags);
8208
8216
  expr.rhs = transformExpressionsInExpression(expr.rhs, transform2, flags);
8217
+ } else if (expr instanceof UnaryOperatorExpr) {
8218
+ expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
8209
8219
  } else if (expr instanceof ReadPropExpr) {
8210
8220
  expr.receiver = transformExpressionsInExpression(expr.receiver, transform2, flags);
8211
8221
  } else if (expr instanceof ReadKeyExpr) {
@@ -8245,6 +8255,12 @@ function transformExpressionsInExpression(expr, transform2, flags) {
8245
8255
  for (let i = 0; i < expr.expressions.length; i++) {
8246
8256
  expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
8247
8257
  }
8258
+ } else if (expr instanceof NotExpr) {
8259
+ expr.condition = transformExpressionsInExpression(expr.condition, transform2, flags);
8260
+ } else if (expr instanceof TaggedTemplateExpr) {
8261
+ expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
8262
+ expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
8263
+ } else if (expr instanceof WrappedNodeExpr) {
8248
8264
  } else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
8249
8265
  } else {
8250
8266
  throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
@@ -8500,10 +8516,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
8500
8516
  sourceSpan
8501
8517
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8502
8518
  }
8503
- function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
8519
+ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
8504
8520
  return __spreadValues(__spreadValues({
8505
8521
  kind: OpKind.Template,
8506
8522
  xref,
8523
+ templateKind,
8507
8524
  attributes: null,
8508
8525
  tag,
8509
8526
  handle: new SlotHandle(),
@@ -8517,7 +8534,7 @@ function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlacehol
8517
8534
  sourceSpan
8518
8535
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8519
8536
  }
8520
- function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, sourceSpan) {
8537
+ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, sourceSpan) {
8521
8538
  return __spreadProps(__spreadValues(__spreadValues({
8522
8539
  kind: OpKind.RepeaterCreate,
8523
8540
  attributes: null,
@@ -8535,6 +8552,8 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, so
8535
8552
  vars: null,
8536
8553
  varNames,
8537
8554
  usesComponentInstance: false,
8555
+ i18nPlaceholder,
8556
+ emptyI18nPlaceholder,
8538
8557
  sourceSpan
8539
8558
  }, TRAIT_CONSUMES_SLOT), NEW_OP), {
8540
8559
  numSlotsUsed: emptyView === null ? 2 : 3
@@ -8568,7 +8587,9 @@ function createTextOp(xref, initialValue, sourceSpan) {
8568
8587
  sourceSpan
8569
8588
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8570
8589
  }
8571
- function createListenerOp(target, targetSlot, name, tag, animationPhase, hostListener, sourceSpan) {
8590
+ function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPhase, eventTarget, hostListener, sourceSpan) {
8591
+ const handlerList = new OpList();
8592
+ handlerList.push(handlerOps);
8572
8593
  return __spreadValues({
8573
8594
  kind: OpKind.Listener,
8574
8595
  target,
@@ -8576,11 +8597,12 @@ function createListenerOp(target, targetSlot, name, tag, animationPhase, hostLis
8576
8597
  tag,
8577
8598
  hostListener,
8578
8599
  name,
8579
- handlerOps: new OpList(),
8600
+ handlerOps: handlerList,
8580
8601
  handlerFnName: null,
8581
8602
  consumesDollarEvent: false,
8582
8603
  isAnimationListener: animationPhase !== null,
8583
8604
  animationPhase,
8605
+ eventTarget,
8584
8606
  sourceSpan
8585
8607
  }, NEW_OP);
8586
8608
  }
@@ -8604,25 +8626,30 @@ function createProjectionDefOp(def) {
8604
8626
  def
8605
8627
  }, NEW_OP);
8606
8628
  }
8607
- function createProjectionOp(xref, selector, sourceSpan) {
8629
+ function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceSpan) {
8608
8630
  return __spreadValues(__spreadValues({
8609
8631
  kind: OpKind.Projection,
8610
8632
  xref,
8611
8633
  handle: new SlotHandle(),
8612
8634
  selector,
8635
+ i18nPlaceholder,
8613
8636
  projectionSlotIndex: 0,
8614
- attributes: [],
8637
+ attributes,
8615
8638
  localRefs: [],
8616
8639
  sourceSpan
8617
8640
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8618
8641
  }
8619
- function createExtractedAttributeOp(target, bindingKind, name, expression) {
8642
+ function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
8620
8643
  return __spreadValues({
8621
8644
  kind: OpKind.ExtractedAttribute,
8622
8645
  target,
8623
8646
  bindingKind,
8624
8647
  name,
8625
- expression
8648
+ expression,
8649
+ i18nContext,
8650
+ i18nMessage,
8651
+ securityContext,
8652
+ trustedValueFn: null
8626
8653
  }, NEW_OP);
8627
8654
  }
8628
8655
  function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
@@ -8659,10 +8686,11 @@ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
8659
8686
  sourceSpan
8660
8687
  }, NEW_OP);
8661
8688
  }
8662
- function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
8689
+ function createI18nMessageOp(xref, i18nContext, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
8663
8690
  return __spreadValues({
8664
8691
  kind: OpKind.I18nMessage,
8665
8692
  xref,
8693
+ i18nContext,
8666
8694
  i18nBlock,
8667
8695
  message,
8668
8696
  messagePlaceholder,
@@ -8707,6 +8735,9 @@ function createIcuEndOp(xref) {
8707
8735
  }, NEW_OP);
8708
8736
  }
8709
8737
  function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
8738
+ if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
8739
+ throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
8740
+ }
8710
8741
  return __spreadValues({
8711
8742
  kind: OpKind.I18nContext,
8712
8743
  contextKind,
@@ -8718,14 +8749,26 @@ function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan)
8718
8749
  postprocessingParams: /* @__PURE__ */ new Map()
8719
8750
  }, NEW_OP);
8720
8751
  }
8752
+ function createI18nAttributesOp(xref, handle, target) {
8753
+ return __spreadValues(__spreadValues({
8754
+ kind: OpKind.I18nAttributes,
8755
+ xref,
8756
+ handle,
8757
+ target,
8758
+ i18nAttributesConfig: null
8759
+ }, NEW_OP), TRAIT_CONSUMES_SLOT);
8760
+ }
8721
8761
 
8722
8762
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8723
- function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
8763
+ function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
8724
8764
  return __spreadValues(__spreadValues({
8725
8765
  kind: OpKind.HostProperty,
8726
8766
  name,
8727
8767
  expression,
8728
8768
  isAnimationTrigger,
8769
+ i18nContext,
8770
+ securityContext,
8771
+ sanitizer: null,
8729
8772
  sourceSpan
8730
8773
  }, TRAIT_CONSUMES_VARS), NEW_OP);
8731
8774
  }
@@ -8871,7 +8914,7 @@ function applyI18nExpressions(job) {
8871
8914
  for (const unit of job.units) {
8872
8915
  for (const op of unit.update) {
8873
8916
  if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {
8874
- OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
8917
+ OpList.insertAfter(createI18nApplyOp(op.i18nOwner, op.handle, null), op);
8875
8918
  }
8876
8919
  }
8877
8920
  }
@@ -8883,7 +8926,19 @@ function needsApplication(i18nContexts, op) {
8883
8926
  }
8884
8927
  const context = i18nContexts.get(op.context);
8885
8928
  const nextContext2 = i18nContexts.get(op.next.context);
8886
- if (context.i18nBlock !== nextContext2.i18nBlock) {
8929
+ if (context === void 0) {
8930
+ throw new Error("AssertionError: expected an I18nContextOp to exist for the I18nExpressionOp's context");
8931
+ }
8932
+ if (nextContext2 === void 0) {
8933
+ throw new Error("AssertionError: expected an I18nContextOp to exist for the next I18nExpressionOp's context");
8934
+ }
8935
+ if (context.i18nBlock !== null) {
8936
+ if (context.i18nBlock !== nextContext2.i18nBlock) {
8937
+ return true;
8938
+ }
8939
+ return false;
8940
+ }
8941
+ if (op.i18nOwner !== op.next.i18nOwner) {
8887
8942
  return true;
8888
8943
  }
8889
8944
  return false;
@@ -8891,27 +8946,44 @@ function needsApplication(i18nContexts, op) {
8891
8946
 
8892
8947
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8893
8948
  function assignI18nSlotDependencies(job) {
8894
- const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
8895
- let lastSlotConsumer = null;
8896
- let currentI18nOp = null;
8897
8949
  for (const unit of job.units) {
8898
- for (const op of unit.create) {
8899
- if (hasConsumesSlotTrait(op)) {
8900
- lastSlotConsumer = op.xref;
8901
- }
8902
- switch (op.kind) {
8903
- case OpKind.I18nStart:
8904
- currentI18nOp = op;
8905
- break;
8906
- case OpKind.I18nEnd:
8907
- i18nLastSlotConsumers.set(currentI18nOp.xref, lastSlotConsumer);
8908
- currentI18nOp = null;
8909
- break;
8950
+ let updateOp = unit.update.head;
8951
+ let i18nExpressionsInProgress = [];
8952
+ let state = null;
8953
+ for (const createOp of unit.create) {
8954
+ if (createOp.kind === OpKind.I18nStart) {
8955
+ state = {
8956
+ blockXref: createOp.xref,
8957
+ lastSlotConsumer: createOp.xref
8958
+ };
8959
+ } else if (createOp.kind === OpKind.I18nEnd) {
8960
+ for (const op of i18nExpressionsInProgress) {
8961
+ op.target = state.lastSlotConsumer;
8962
+ OpList.insertBefore(op, updateOp);
8963
+ }
8964
+ i18nExpressionsInProgress.length = 0;
8965
+ state = null;
8910
8966
  }
8911
- }
8912
- for (const op of unit.update) {
8913
- if (op.kind === OpKind.I18nExpression) {
8914
- op.target = i18nLastSlotConsumers.get(op.target);
8967
+ if (hasConsumesSlotTrait(createOp)) {
8968
+ if (state !== null) {
8969
+ state.lastSlotConsumer = createOp.xref;
8970
+ }
8971
+ while (true) {
8972
+ if (updateOp.next === null) {
8973
+ break;
8974
+ }
8975
+ if (state !== null && updateOp.kind === OpKind.I18nExpression && updateOp.usage === I18nExpressionFor.I18nText && updateOp.i18nOwner === state.blockXref) {
8976
+ const opToRemove = updateOp;
8977
+ updateOp = updateOp.next;
8978
+ OpList.remove(opToRemove);
8979
+ i18nExpressionsInProgress.push(opToRemove);
8980
+ continue;
8981
+ }
8982
+ if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
8983
+ break;
8984
+ }
8985
+ updateOp = updateOp.next;
8986
+ }
8915
8987
  }
8916
8988
  }
8917
8989
  }
@@ -8940,18 +9012,53 @@ function extractAttributes(job) {
8940
9012
  break;
8941
9013
  case OpKind.Property:
8942
9014
  if (!op.isAnimationTrigger) {
8943
- OpList.insertBefore(createExtractedAttributeOp(op.target, op.isTemplate ? BindingKind.Template : BindingKind.Property, op.name, null), lookupElement(elements, op.target));
9015
+ let bindingKind;
9016
+ if (op.i18nMessage !== null && op.templateKind === null) {
9017
+ bindingKind = BindingKind.I18n;
9018
+ } else if (op.isStructuralTemplateAttribute) {
9019
+ bindingKind = BindingKind.Template;
9020
+ } else {
9021
+ bindingKind = BindingKind.Property;
9022
+ }
9023
+ OpList.insertBefore(
9024
+ createExtractedAttributeOp(
9025
+ op.target,
9026
+ bindingKind,
9027
+ op.name,
9028
+ null,
9029
+ null,
9030
+ null,
9031
+ op.securityContext
9032
+ ),
9033
+ lookupElement(elements, op.target)
9034
+ );
8944
9035
  }
8945
9036
  break;
8946
9037
  case OpKind.StyleProp:
8947
9038
  case OpKind.ClassProp:
8948
9039
  if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && op.expression instanceof EmptyExpr2) {
8949
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, op.name, null), lookupElement(elements, op.target));
9040
+ OpList.insertBefore(createExtractedAttributeOp(
9041
+ op.target,
9042
+ BindingKind.Property,
9043
+ op.name,
9044
+ null,
9045
+ null,
9046
+ null,
9047
+ SecurityContext.STYLE
9048
+ ), lookupElement(elements, op.target));
8950
9049
  }
8951
9050
  break;
8952
9051
  case OpKind.Listener:
8953
9052
  if (!op.isAnimationListener) {
8954
- const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, op.name, null);
9053
+ const extractedAttributeOp = createExtractedAttributeOp(
9054
+ op.target,
9055
+ BindingKind.Property,
9056
+ op.name,
9057
+ null,
9058
+ null,
9059
+ null,
9060
+ SecurityContext.NONE
9061
+ );
8955
9062
  if (job.kind === CompilationJobKind.Host) {
8956
9063
  unit.create.push(extractedAttributeOp);
8957
9064
  } else {
@@ -8985,7 +9092,7 @@ function extractAttributeOp(unit, op, elements) {
8985
9092
  }
8986
9093
  }
8987
9094
  if (extractable) {
8988
- const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isTemplate ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression);
9095
+ const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
8989
9096
  if (unit.job.kind === CompilationJobKind.Host) {
8990
9097
  unit.create.push(extractedAttributeOp);
8991
9098
  } else {
@@ -9026,15 +9133,15 @@ function specializeBindings(job) {
9026
9133
  const target = lookupElement2(elements, op.target);
9027
9134
  target.nonBindable = true;
9028
9135
  } else {
9029
- OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isTemplate, op.sourceSpan));
9136
+ OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
9030
9137
  }
9031
9138
  break;
9032
9139
  case BindingKind.Property:
9033
9140
  case BindingKind.Animation:
9034
9141
  if (job.kind === CompilationJobKind.Host) {
9035
- OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.sourceSpan));
9142
+ OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
9036
9143
  } else {
9037
- OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isTemplate, op.sourceSpan));
9144
+ 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));
9038
9145
  }
9039
9146
  break;
9040
9147
  case BindingKind.I18n:
@@ -9219,7 +9326,7 @@ function collectElementConsts(job) {
9219
9326
  if (op.kind === OpKind.ExtractedAttribute) {
9220
9327
  const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
9221
9328
  allElementAttributes.set(op.target, attributes);
9222
- attributes.add(op.bindingKind, op.name, op.expression);
9329
+ attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
9223
9330
  OpList.remove(op);
9224
9331
  }
9225
9332
  }
@@ -9281,7 +9388,7 @@ var ElementAttributes = class {
9281
9388
  var _a2;
9282
9389
  return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
9283
9390
  }
9284
- add(kind, name, value) {
9391
+ add(kind, name, value, trustedValueFn) {
9285
9392
  var _a2;
9286
9393
  if (this.known.has(name)) {
9287
9394
  return;
@@ -9297,9 +9404,16 @@ var ElementAttributes = class {
9297
9404
  array.push(...getAttributeNameLiterals(name));
9298
9405
  if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
9299
9406
  if (value === null) {
9300
- throw Error("Attribute & style element attributes must have a value");
9407
+ throw Error("Attribute, i18n attribute, & style element attributes must have a value");
9408
+ }
9409
+ if (trustedValueFn !== null) {
9410
+ if (!isStringLiteral(value)) {
9411
+ throw Error("AssertionError: extracted attribute value should be string literal");
9412
+ }
9413
+ array.push(taggedTemplate(trustedValueFn, new TemplateLiteral([new TemplateLiteralElement(value.value)], []), void 0, value.sourceSpan));
9414
+ } else {
9415
+ array.push(value);
9301
9416
  }
9302
- array.push(value);
9303
9417
  }
9304
9418
  }
9305
9419
  arrayFor(kind) {
@@ -9345,6 +9459,47 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
9345
9459
  return literalArr(attrArray);
9346
9460
  }
9347
9461
 
9462
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/convert_i18n_bindings.mjs
9463
+ function convertI18nBindings(job) {
9464
+ const i18nAttributesByElem = /* @__PURE__ */ new Map();
9465
+ for (const unit of job.units) {
9466
+ for (const op of unit.create) {
9467
+ if (op.kind === OpKind.I18nAttributes) {
9468
+ i18nAttributesByElem.set(op.target, op);
9469
+ }
9470
+ }
9471
+ for (const op of unit.update) {
9472
+ switch (op.kind) {
9473
+ case OpKind.Property:
9474
+ case OpKind.Attribute:
9475
+ if (op.i18nContext === null) {
9476
+ continue;
9477
+ }
9478
+ if (!(op.expression instanceof Interpolation2)) {
9479
+ continue;
9480
+ }
9481
+ const i18nAttributesForElem = i18nAttributesByElem.get(op.target);
9482
+ if (i18nAttributesForElem === void 0) {
9483
+ throw new Error("AssertionError: An i18n attribute binding instruction requires the owning element to have an I18nAttributes create instruction");
9484
+ }
9485
+ if (i18nAttributesForElem.target !== op.target) {
9486
+ throw new Error("AssertionError: Expected i18nAttributes target element to match binding target element");
9487
+ }
9488
+ const ops = [];
9489
+ for (let i = 0; i < op.expression.expressions.length; i++) {
9490
+ const expr = op.expression.expressions[i];
9491
+ if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
9492
+ 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`);
9493
+ }
9494
+ ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
9495
+ }
9496
+ OpList.replaceWithMany(op, ops);
9497
+ break;
9498
+ }
9499
+ }
9500
+ }
9501
+ }
9502
+
9348
9503
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
9349
9504
  function createDeferDepsFns(job) {
9350
9505
  for (const unit of job.units) {
@@ -9378,6 +9533,7 @@ function createI18nContexts(job) {
9378
9533
  const rootContexts = /* @__PURE__ */ new Map();
9379
9534
  let currentI18nOp = null;
9380
9535
  let xref;
9536
+ const messageToContext = /* @__PURE__ */ new Map();
9381
9537
  for (const unit of job.units) {
9382
9538
  for (const op of unit.create) {
9383
9539
  switch (op.kind) {
@@ -9407,6 +9563,24 @@ function createI18nContexts(job) {
9407
9563
  break;
9408
9564
  }
9409
9565
  }
9566
+ for (const op of unit.ops()) {
9567
+ switch (op.kind) {
9568
+ case OpKind.Binding:
9569
+ case OpKind.Property:
9570
+ case OpKind.Attribute:
9571
+ case OpKind.ExtractedAttribute:
9572
+ if (!op.i18nMessage) {
9573
+ continue;
9574
+ }
9575
+ if (!messageToContext.has(op.i18nMessage)) {
9576
+ const i18nContext = job.allocateXrefId();
9577
+ unit.create.push(createI18nContextOp(I18nContextKind.Attr, i18nContext, null, op.i18nMessage, null));
9578
+ messageToContext.set(op.i18nMessage, i18nContext);
9579
+ }
9580
+ op.i18nContext = messageToContext.get(op.i18nMessage);
9581
+ break;
9582
+ }
9583
+ }
9410
9584
  }
9411
9585
  for (const unit of job.units) {
9412
9586
  for (const op of unit.create) {
@@ -9715,6 +9889,15 @@ function extractI18nMessages(job) {
9715
9889
  }
9716
9890
  }
9717
9891
  }
9892
+ for (const unit of job.units) {
9893
+ for (const op of unit.create) {
9894
+ if (op.kind !== OpKind.I18nContext || op.contextKind !== I18nContextKind.Attr) {
9895
+ continue;
9896
+ }
9897
+ const i18nMessageOp = createI18nMessage(job, op);
9898
+ unit.create.push(i18nMessageOp);
9899
+ }
9900
+ }
9718
9901
  const i18nBlockMessages = /* @__PURE__ */ new Map();
9719
9902
  for (const unit of job.units) {
9720
9903
  for (const op of unit.create) {
@@ -9737,6 +9920,9 @@ function extractI18nMessages(job) {
9737
9920
  }
9738
9921
  const i18nContext = i18nContexts.get(op.context);
9739
9922
  if (i18nContext.contextKind === I18nContextKind.Icu) {
9923
+ if (i18nContext.i18nBlock === null) {
9924
+ throw Error("ICU context should have its i18n block set.");
9925
+ }
9740
9926
  const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
9741
9927
  unit.create.push(subMessage);
9742
9928
  const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
@@ -9753,69 +9939,54 @@ function extractI18nMessages(job) {
9753
9939
  }
9754
9940
  }
9755
9941
  function createI18nMessage(job, context, messagePlaceholder) {
9756
- let [formattedParams, needsPostprocessing] = formatParams(context.params);
9757
- const [formattedPostprocessingParams] = formatParams(context.postprocessingParams);
9758
- needsPostprocessing || (needsPostprocessing = formattedPostprocessingParams.size > 0);
9759
- return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
9942
+ let formattedParams = formatParams(context.params);
9943
+ const formattedPostprocessingParams = formatParams(context.postprocessingParams);
9944
+ let needsPostprocessing = formattedPostprocessingParams.size > 0;
9945
+ for (const values of context.params.values()) {
9946
+ if (values.length > 1) {
9947
+ needsPostprocessing = true;
9948
+ }
9949
+ }
9950
+ return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
9760
9951
  }
9761
9952
  function formatParams(params) {
9762
9953
  const formattedParams = /* @__PURE__ */ new Map();
9763
- let needsPostprocessing = false;
9764
9954
  for (const [placeholder, placeholderValues] of params) {
9765
- const [serializedValues, paramNeedsPostprocessing] = formatParamValues(placeholderValues);
9766
- needsPostprocessing || (needsPostprocessing = paramNeedsPostprocessing);
9955
+ const serializedValues = formatParamValues(placeholderValues);
9767
9956
  if (serializedValues !== null) {
9768
9957
  formattedParams.set(placeholder, literal(serializedValues));
9769
9958
  }
9770
9959
  }
9771
- return [formattedParams, needsPostprocessing];
9960
+ return formattedParams;
9772
9961
  }
9773
9962
  function formatParamValues(values) {
9774
9963
  if (values.length === 0) {
9775
- return [null, false];
9964
+ return null;
9776
9965
  }
9777
- collapseElementTemplatePairs(values);
9778
9966
  const serializedValues = values.map((value) => formatValue(value));
9779
- return serializedValues.length === 1 ? [serializedValues[0], false] : [`${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`, true];
9967
+ return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
9780
9968
  }
9781
- function collapseElementTemplatePairs(values) {
9782
- var _a2;
9783
- const valueIndiciesBySubTemplateIndex = /* @__PURE__ */ new Map();
9784
- for (let i = 0; i < values.length; i++) {
9785
- const value = values[i];
9786
- if (value.subTemplateIndex !== null && value.flags & (I18nParamValueFlags.ElementTag | I18nParamValueFlags.TemplateTag)) {
9787
- const valueIndicies = (_a2 = valueIndiciesBySubTemplateIndex.get(value.subTemplateIndex)) != null ? _a2 : [];
9788
- valueIndicies.push(i);
9789
- valueIndiciesBySubTemplateIndex.set(value.subTemplateIndex, valueIndicies);
9790
- }
9791
- }
9792
- for (const [subTemplateIndex, valueIndicies] of valueIndiciesBySubTemplateIndex) {
9793
- if (valueIndicies.length > 1) {
9794
- const elementIndex = valueIndicies.find((index) => values[index].flags & I18nParamValueFlags.ElementTag);
9795
- const templateIndex = valueIndicies.find((index) => values[index].flags & I18nParamValueFlags.TemplateTag);
9796
- if (elementIndex !== void 0 && templateIndex !== void 0) {
9797
- const elementValue = values[elementIndex];
9798
- const templateValue = values[templateIndex];
9799
- let compundValue;
9800
- if (elementValue.flags & I18nParamValueFlags.OpenTag && elementValue.flags & I18nParamValueFlags.CloseTag) {
9801
- compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}${formatValue(templateValue)}`;
9802
- } else if (elementValue.flags & I18nParamValueFlags.OpenTag) {
9803
- compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}`;
9804
- } else {
9805
- compundValue = `${formatValue(elementValue)}${formatValue(templateValue)}`;
9806
- }
9807
- values.splice(elementIndex, 1, { value: compundValue, subTemplateIndex, flags: I18nParamValueFlags.None });
9808
- values.splice(templateIndex, 1, null);
9809
- }
9969
+ function formatValue(value) {
9970
+ if (value.flags & I18nParamValueFlags.ElementTag && value.flags & I18nParamValueFlags.TemplateTag) {
9971
+ if (typeof value.value !== "object") {
9972
+ throw Error("AssertionError: Expected i18n param value to have an element and template slot");
9810
9973
  }
9811
- }
9812
- for (let i = values.length - 1; i >= 0; i--) {
9813
- if (values[i] === null) {
9814
- values.splice(i, 1);
9974
+ const elementValue = formatValue(__spreadProps(__spreadValues({}, value), {
9975
+ value: value.value.element,
9976
+ flags: value.flags & ~I18nParamValueFlags.TemplateTag
9977
+ }));
9978
+ const templateValue = formatValue(__spreadProps(__spreadValues({}, value), {
9979
+ value: value.value.template,
9980
+ flags: value.flags & ~I18nParamValueFlags.ElementTag
9981
+ }));
9982
+ if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
9983
+ return `${templateValue}${elementValue}${templateValue}`;
9815
9984
  }
9985
+ return value.flags & I18nParamValueFlags.CloseTag ? `${elementValue}${templateValue}` : `${templateValue}${elementValue}`;
9986
+ }
9987
+ if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
9988
+ return `${formatValue(__spreadProps(__spreadValues({}, value), { flags: value.flags & ~I18nParamValueFlags.CloseTag }))}${formatValue(__spreadProps(__spreadValues({}, value), { flags: value.flags & ~I18nParamValueFlags.OpenTag }))}`;
9816
9989
  }
9817
- }
9818
- function formatValue(value) {
9819
9990
  if (value.flags === I18nParamValueFlags.None) {
9820
9991
  return `${value.value}`;
9821
9992
  }
@@ -9830,9 +10001,6 @@ function formatValue(value) {
9830
10001
  closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
9831
10002
  }
9832
10003
  const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
9833
- if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
9834
- return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
9835
- }
9836
10004
  return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
9837
10005
  }
9838
10006
 
@@ -9853,7 +10021,7 @@ function generateAdvance(job) {
9853
10021
  if (!hasDependsOnSlotContextTrait(op)) {
9854
10022
  continue;
9855
10023
  } else if (!slotMap.has(op.target)) {
9856
- throw new Error(`AssertionError: reference to unknown slot for var ${op.target}`);
10024
+ throw new Error(`AssertionError: reference to unknown slot for target ${op.target}`);
9857
10025
  }
9858
10026
  const slot = slotMap.get(op.target);
9859
10027
  if (slotContext !== slot) {
@@ -9901,8 +10069,13 @@ function recursivelyProcessView(view, parentScope) {
9901
10069
  for (const op of view.create) {
9902
10070
  switch (op.kind) {
9903
10071
  case OpKind.Template:
10072
+ recursivelyProcessView(view.job.views.get(op.xref), scope);
10073
+ break;
9904
10074
  case OpKind.RepeaterCreate:
9905
10075
  recursivelyProcessView(view.job.views.get(op.xref), scope);
10076
+ if (op.emptyView) {
10077
+ recursivelyProcessView(view.job.views.get(op.emptyView), scope);
10078
+ }
9906
10079
  break;
9907
10080
  case OpKind.Listener:
9908
10081
  op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
@@ -16036,56 +16209,137 @@ function createEmptyMessagePart(location) {
16036
16209
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
16037
16210
  var NG_I18N_CLOSURE_MODE = "ngI18nClosureMode";
16038
16211
  var TRANSLATION_VAR_PREFIX2 = "i18n_";
16212
+ var I18N_ICU_MAPPING_PREFIX2 = "I18N_EXP_";
16213
+ var ESCAPE2 = "\uFFFD";
16039
16214
  function collectI18nConsts(job) {
16215
+ var _a2, _b2;
16040
16216
  const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
16041
- const messageConstIndices = /* @__PURE__ */ new Map();
16217
+ const extractedAttributesByI18nContext = /* @__PURE__ */ new Map();
16218
+ const i18nAttributesByElement = /* @__PURE__ */ new Map();
16219
+ const i18nExpressionsByElement = /* @__PURE__ */ new Map();
16042
16220
  const messages = /* @__PURE__ */ new Map();
16221
+ for (const unit of job.units) {
16222
+ for (const op of unit.ops()) {
16223
+ if (op.kind === OpKind.ExtractedAttribute && op.i18nContext !== null) {
16224
+ const attributes = (_a2 = extractedAttributesByI18nContext.get(op.i18nContext)) != null ? _a2 : [];
16225
+ attributes.push(op);
16226
+ extractedAttributesByI18nContext.set(op.i18nContext, attributes);
16227
+ } else if (op.kind === OpKind.I18nAttributes) {
16228
+ i18nAttributesByElement.set(op.target, op);
16229
+ } else if (op.kind === OpKind.I18nExpression && op.usage === I18nExpressionFor.I18nAttribute) {
16230
+ const expressions = (_b2 = i18nExpressionsByElement.get(op.target)) != null ? _b2 : [];
16231
+ expressions.push(op);
16232
+ i18nExpressionsByElement.set(op.target, expressions);
16233
+ } else if (op.kind === OpKind.I18nMessage) {
16234
+ messages.set(op.xref, op);
16235
+ }
16236
+ }
16237
+ }
16238
+ const i18nValuesByContext = /* @__PURE__ */ new Map();
16239
+ const messageConstIndices = /* @__PURE__ */ new Map();
16043
16240
  for (const unit of job.units) {
16044
16241
  for (const op of unit.create) {
16045
16242
  if (op.kind === OpKind.I18nMessage) {
16046
- messages.set(op.xref, op);
16243
+ if (op.messagePlaceholder === null) {
16244
+ const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
16245
+ if (op.i18nBlock !== null) {
16246
+ const i18nConst = job.addConst(mainVar, statements);
16247
+ messageConstIndices.set(op.i18nBlock, i18nConst);
16248
+ } else {
16249
+ job.constsInitializers.push(...statements);
16250
+ i18nValuesByContext.set(op.i18nContext, mainVar);
16251
+ const attributesForMessage = extractedAttributesByI18nContext.get(op.i18nContext);
16252
+ if (attributesForMessage !== void 0) {
16253
+ for (const attr of attributesForMessage) {
16254
+ attr.expression = mainVar.clone();
16255
+ }
16256
+ }
16257
+ }
16258
+ }
16047
16259
  OpList.remove(op);
16048
16260
  }
16049
16261
  }
16050
16262
  }
16051
- for (const op of messages.values()) {
16052
- if (op.kind === OpKind.I18nMessage && op.messagePlaceholder === null) {
16053
- const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
16054
- messageConstIndices.set(op.i18nBlock, job.addConst(mainVar, statements));
16263
+ for (const unit of job.units) {
16264
+ for (const elem of unit.create) {
16265
+ if (isElementOrContainerOp(elem)) {
16266
+ const i18nAttributes2 = i18nAttributesByElement.get(elem.xref);
16267
+ if (i18nAttributes2 === void 0) {
16268
+ continue;
16269
+ }
16270
+ let i18nExpressions = i18nExpressionsByElement.get(elem.xref);
16271
+ if (i18nExpressions === void 0) {
16272
+ throw new Error("AssertionError: Could not find any i18n expressions associated with an I18nAttributes instruction");
16273
+ }
16274
+ const seenPropertyNames = /* @__PURE__ */ new Set();
16275
+ i18nExpressions = i18nExpressions.filter((i18nExpr) => {
16276
+ const seen = seenPropertyNames.has(i18nExpr.name);
16277
+ seenPropertyNames.add(i18nExpr.name);
16278
+ return !seen;
16279
+ });
16280
+ const i18nAttributeConfig = i18nExpressions.flatMap((i18nExpr) => {
16281
+ const i18nExprValue = i18nValuesByContext.get(i18nExpr.context);
16282
+ if (i18nExprValue === void 0) {
16283
+ throw new Error("AssertionError: Could not find i18n expression's value");
16284
+ }
16285
+ return [literal(i18nExpr.name), i18nExprValue];
16286
+ });
16287
+ i18nAttributes2.i18nAttributesConfig = job.addConst(new LiteralArrayExpr(i18nAttributeConfig));
16288
+ }
16055
16289
  }
16056
16290
  }
16057
16291
  for (const unit of job.units) {
16058
16292
  for (const op of unit.create) {
16059
16293
  if (op.kind === OpKind.I18nStart) {
16060
- op.messageIndex = messageConstIndices.get(op.root);
16294
+ const msgIndex = messageConstIndices.get(op.root);
16295
+ if (msgIndex === void 0) {
16296
+ throw new Error("AssertionError: Could not find corresponding i18n block index for an i18n message op; was an i18n message incorrectly assumed to correspond to an attribute?");
16297
+ }
16298
+ op.messageIndex = msgIndex;
16061
16299
  }
16062
16300
  }
16063
16301
  }
16064
16302
  }
16065
16303
  function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
16304
+ var _a2;
16066
16305
  const statements = [];
16306
+ const subMessagePlaceholders = /* @__PURE__ */ new Map();
16067
16307
  for (const subMessageId of messageOp.subMessages) {
16068
16308
  const subMessage = messages.get(subMessageId);
16069
16309
  const { mainVar: subMessageVar, statements: subMessageStatements } = collectMessage(job, fileBasedI18nSuffix, messages, subMessage);
16070
16310
  statements.push(...subMessageStatements);
16071
- messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
16311
+ const subMessages = (_a2 = subMessagePlaceholders.get(subMessage.messagePlaceholder)) != null ? _a2 : [];
16312
+ subMessages.push(subMessageVar);
16313
+ subMessagePlaceholders.set(subMessage.messagePlaceholder, subMessages);
16072
16314
  }
16315
+ addSubMessageParams(messageOp, subMessagePlaceholders);
16073
16316
  messageOp.params = new Map([...messageOp.params.entries()].sort());
16074
- assertAllParamsResolved(messageOp);
16075
16317
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
16076
16318
  const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
16077
16319
  let transformFn = void 0;
16078
16320
  if (messageOp.needsPostprocessing) {
16079
- messageOp.postprocessingParams = new Map([...messageOp.postprocessingParams.entries()].sort());
16321
+ const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
16322
+ const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
16080
16323
  const extraTransformFnParams = [];
16081
16324
  if (messageOp.postprocessingParams.size > 0) {
16082
- extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
16325
+ extraTransformFnParams.push(mapLiteral(formattedPostprocessingParams, true));
16083
16326
  }
16084
16327
  transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
16085
16328
  }
16086
16329
  statements.push(...getTranslationDeclStmts(messageOp.message, mainVar, closureVar, messageOp.params, transformFn));
16087
16330
  return { mainVar, statements };
16088
16331
  }
16332
+ function addSubMessageParams(messageOp, subMessagePlaceholders) {
16333
+ for (const [placeholder, subMessages] of subMessagePlaceholders) {
16334
+ if (subMessages.length === 1) {
16335
+ messageOp.params.set(placeholder, subMessages[0]);
16336
+ } else {
16337
+ messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
16338
+ messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
16339
+ messageOp.needsPostprocessing = true;
16340
+ }
16341
+ }
16342
+ }
16089
16343
  function getTranslationDeclStmts(message, variable2, closureVar, params, transformFn) {
16090
16344
  const paramsObject = Object.fromEntries(params);
16091
16345
  const statements = [
@@ -16113,23 +16367,9 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
16113
16367
  }
16114
16368
  return variable(name);
16115
16369
  }
16116
- function assertAllParamsResolved(op) {
16117
- for (let placeholder in op.message.placeholders) {
16118
- placeholder = placeholder.trimEnd();
16119
- if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
16120
- throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
16121
- }
16122
- }
16123
- for (let placeholder in op.message.placeholderToMessage) {
16124
- placeholder = placeholder.trimEnd();
16125
- if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
16126
- throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
16127
- }
16128
- }
16129
- }
16130
16370
 
16131
16371
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
16132
- function extractI18nText(job) {
16372
+ function convertI18nText(job) {
16133
16373
  var _a2;
16134
16374
  for (const unit of job.units) {
16135
16375
  let currentI18n = null;
@@ -16178,7 +16418,7 @@ function extractI18nText(job) {
16178
16418
  const ops = [];
16179
16419
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
16180
16420
  const expr = op.interpolation.expressions[i];
16181
- ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.handle, expr, op.i18nPlaceholders[i], resolutionTime, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
16421
+ 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));
16182
16422
  }
16183
16423
  OpList.replaceWithMany(op, ops);
16184
16424
  break;
@@ -16600,13 +16840,13 @@ function parseExtractedStyles(job) {
16600
16840
  if (op.name === "style") {
16601
16841
  const parsedStyles = parse(op.expression.value);
16602
16842
  for (let i = 0; i < parsedStyles.length - 1; i += 2) {
16603
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1])), op);
16843
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
16604
16844
  }
16605
16845
  OpList.remove(op);
16606
16846
  } else if (op.name === "class") {
16607
16847
  const parsedClasses = op.expression.value.trim().split(/\s+/g);
16608
16848
  for (const parsedClass of parsedClasses) {
16609
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null), op);
16849
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
16610
16850
  }
16611
16851
  OpList.remove(op);
16612
16852
  }
@@ -16619,18 +16859,28 @@ function parseExtractedStyles(job) {
16619
16859
  function removeContentSelectors(job) {
16620
16860
  for (const unit of job.units) {
16621
16861
  const elements = createOpXrefMap(unit);
16622
- for (const op of unit.update) {
16862
+ for (const op of unit.ops()) {
16623
16863
  switch (op.kind) {
16624
16864
  case OpKind.Binding:
16625
16865
  const target = lookupInXrefMap(elements, op.target);
16626
- if (op.name.toLowerCase() === "select" && target.kind === OpKind.Projection) {
16866
+ if (isSelectAttribute(op.name) && target.kind === OpKind.Projection) {
16627
16867
  OpList.remove(op);
16628
16868
  }
16629
16869
  break;
16870
+ case OpKind.Projection:
16871
+ for (let i = op.attributes.length - 2; i >= 0; i -= 2) {
16872
+ if (isSelectAttribute(op.attributes[i])) {
16873
+ op.attributes.splice(i, 2);
16874
+ }
16875
+ }
16876
+ break;
16630
16877
  }
16631
16878
  }
16632
16879
  }
16633
16880
  }
16881
+ function isSelectAttribute(name) {
16882
+ return name.toLowerCase() === "select";
16883
+ }
16634
16884
  function lookupInXrefMap(map, xref) {
16635
16885
  const el = map.get(xref);
16636
16886
  if (el === void 0) {
@@ -16717,22 +16967,35 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
16717
16967
  i18nBlock = op;
16718
16968
  break;
16719
16969
  case OpKind.I18nEnd:
16970
+ if (i18nBlock.subTemplateIndex === null) {
16971
+ subTemplateIndex = 0;
16972
+ }
16720
16973
  i18nBlock = null;
16721
16974
  break;
16722
16975
  case OpKind.Template:
16723
- const templateView = unit.job.views.get(op.xref);
16724
- if (op.i18nPlaceholder !== void 0) {
16725
- if (i18nBlock === null) {
16726
- throw Error("Expected template with i18n placeholder to be in an i18n block.");
16727
- }
16728
- subTemplateIndex++;
16729
- wrapTemplateWithI18n(templateView, i18nBlock);
16976
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
16977
+ break;
16978
+ case OpKind.RepeaterCreate:
16979
+ const forView = unit.job.views.get(op.xref);
16980
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
16981
+ if (op.emptyView !== null) {
16982
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.emptyView), i18nBlock, op.emptyI18nPlaceholder, subTemplateIndex);
16730
16983
  }
16731
- subTemplateIndex = propagateI18nBlocksToTemplates(templateView, subTemplateIndex);
16984
+ break;
16732
16985
  }
16733
16986
  }
16734
16987
  return subTemplateIndex;
16735
16988
  }
16989
+ function propagateI18nBlocksForView(view, i18nBlock, i18nPlaceholder, subTemplateIndex) {
16990
+ if (i18nPlaceholder !== void 0) {
16991
+ if (i18nBlock === null) {
16992
+ throw Error("Expected template with i18n placeholder to be in an i18n block.");
16993
+ }
16994
+ subTemplateIndex++;
16995
+ wrapTemplateWithI18n(view, i18nBlock);
16996
+ }
16997
+ return propagateI18nBlocksToTemplates(view, subTemplateIndex);
16998
+ }
16736
16999
  function wrapTemplateWithI18n(unit, parentI18n) {
16737
17000
  var _a2;
16738
17001
  if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
@@ -16889,17 +17152,13 @@ function disableBindings2() {
16889
17152
  function enableBindings() {
16890
17153
  return call(Identifiers.enableBindings, [], null);
16891
17154
  }
16892
- function listener(name, handlerFn, sourceSpan) {
16893
- return call(Identifiers.listener, [
16894
- literal(name),
16895
- handlerFn
16896
- ], sourceSpan);
16897
- }
16898
- function syntheticHostListener(name, handlerFn, sourceSpan) {
16899
- return call(Identifiers.syntheticHostListener, [
16900
- literal(name),
16901
- handlerFn
16902
- ], sourceSpan);
17155
+ function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
17156
+ const args = [literal(name), handlerFn];
17157
+ if (eventTargetResolver !== null) {
17158
+ args.push(literal(false));
17159
+ args.push(importExpr(eventTargetResolver));
17160
+ }
17161
+ return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
16903
17162
  }
16904
17163
  function pipe(slot, name) {
16905
17164
  return call(Identifiers.pipe, [
@@ -17046,6 +17305,10 @@ function i18n(slot, constIndex, subTemplateIndex) {
17046
17305
  function i18nEnd() {
17047
17306
  return call(Identifiers.i18nEnd, [], null);
17048
17307
  }
17308
+ function i18nAttributes(slot, i18nAttributesConfig) {
17309
+ const args = [literal(slot), literal(i18nAttributesConfig)];
17310
+ return call(Identifiers.i18nAttributes, args, null);
17311
+ }
17049
17312
  function property(name, expression, sanitizer, sourceSpan) {
17050
17313
  const args = [literal(name), expression];
17051
17314
  if (sanitizer !== null) {
@@ -17154,8 +17417,12 @@ function classMapInterpolate(strings, expressions, sourceSpan) {
17154
17417
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
17155
17418
  return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
17156
17419
  }
17157
- function hostProperty(name, expression, sourceSpan) {
17158
- return call(Identifiers.hostProperty, [literal(name), expression], sourceSpan);
17420
+ function hostProperty(name, expression, sanitizer, sourceSpan) {
17421
+ const args = [literal(name), expression];
17422
+ if (sanitizer !== null) {
17423
+ args.push(sanitizer);
17424
+ }
17425
+ return call(Identifiers.hostProperty, args, sourceSpan);
17159
17426
  }
17160
17427
  function syntheticHostProperty(name, expression, sourceSpan) {
17161
17428
  return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
@@ -17343,13 +17610,10 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
17343
17610
  }
17344
17611
 
17345
17612
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/reify.mjs
17346
- var sanitizerIdentifierMap = /* @__PURE__ */ new Map([
17347
- [SanitizerFn.Html, Identifiers.sanitizeHtml],
17348
- [SanitizerFn.IframeAttribute, Identifiers.validateIframeAttribute],
17349
- [SanitizerFn.ResourceUrl, Identifiers.sanitizeResourceUrl],
17350
- [SanitizerFn.Script, Identifiers.sanitizeScript],
17351
- [SanitizerFn.Style, Identifiers.sanitizeStyle],
17352
- [SanitizerFn.Url, Identifiers.sanitizeUrl]
17613
+ var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([
17614
+ ["window", Identifiers.resolveWindow],
17615
+ ["document", Identifiers.resolveDocument],
17616
+ ["body", Identifiers.resolveBody]
17353
17617
  ]);
17354
17618
  function reify(job) {
17355
17619
  for (const unit of job.units) {
@@ -17392,6 +17656,12 @@ function reifyCreateOperations(unit, ops) {
17392
17656
  case OpKind.I18n:
17393
17657
  OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
17394
17658
  break;
17659
+ case OpKind.I18nAttributes:
17660
+ if (op.i18nAttributesConfig === null) {
17661
+ throw new Error(`AssertionError: i18nAttributesConfig was not set`);
17662
+ }
17663
+ OpList.replace(op, i18nAttributes(op.handle.slot, op.i18nAttributesConfig));
17664
+ break;
17395
17665
  case OpKind.Template:
17396
17666
  if (!(unit instanceof ViewCompilationUnit)) {
17397
17667
  throw new Error(`AssertionError: must be compiling a component`);
@@ -17413,8 +17683,11 @@ function reifyCreateOperations(unit, ops) {
17413
17683
  break;
17414
17684
  case OpKind.Listener:
17415
17685
  const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
17416
- const reified = op.hostListener && op.isAnimationListener ? syntheticHostListener(op.name, listenerFn, op.sourceSpan) : listener(op.name, listenerFn, op.sourceSpan);
17417
- OpList.replace(op, reified);
17686
+ const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
17687
+ if (eventTargetResolver === void 0) {
17688
+ throw new Error(`AssertionError: unknown event target ${op.eventTarget}`);
17689
+ }
17690
+ OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
17418
17691
  break;
17419
17692
  case OpKind.Variable:
17420
17693
  if (op.variable.name === null) {
@@ -17569,7 +17842,7 @@ function reifyUpdateOperations(_unit, ops) {
17569
17842
  if (op.isAnimationTrigger) {
17570
17843
  OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
17571
17844
  } else {
17572
- OpList.replace(op, hostProperty(op.name, op.expression, op.sourceSpan));
17845
+ OpList.replace(op, hostProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
17573
17846
  }
17574
17847
  }
17575
17848
  break;
@@ -17647,8 +17920,6 @@ function reifyIrExpression(expr) {
17647
17920
  return pipeBind(expr.targetSlot.slot, expr.varOffset, expr.args);
17648
17921
  case ExpressionKind.PipeBindingVariadic:
17649
17922
  return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
17650
- case ExpressionKind.SanitizerExpr:
17651
- return importExpr(sanitizerIdentifierMap.get(expr.fn));
17652
17923
  case ExpressionKind.SlotLiteralExpr:
17653
17924
  return literal(expr.slot.slot);
17654
17925
  default:
@@ -17708,6 +17979,28 @@ function removeI18nContexts(job) {
17708
17979
  }
17709
17980
  }
17710
17981
 
17982
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_unused_i18n_attrs.mjs
17983
+ function removeUnusedI18nAttributesOps(job) {
17984
+ for (const unit of job.units) {
17985
+ const ownersWithI18nExpressions = /* @__PURE__ */ new Set();
17986
+ for (const op of unit.update) {
17987
+ switch (op.kind) {
17988
+ case OpKind.I18nExpression:
17989
+ ownersWithI18nExpressions.add(op.i18nOwner);
17990
+ }
17991
+ }
17992
+ for (const op of unit.create) {
17993
+ switch (op.kind) {
17994
+ case OpKind.I18nAttributes:
17995
+ if (ownersWithI18nExpressions.has(op.xref)) {
17996
+ continue;
17997
+ }
17998
+ OpList.remove(op);
17999
+ }
18000
+ }
18001
+ }
18002
+ }
18003
+
17711
18004
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
17712
18005
  function generateRepeaterDerivedVars(job) {
17713
18006
  const repeaters = /* @__PURE__ */ new Map();
@@ -17820,8 +18113,9 @@ function resolveI18nElementPlaceholders(job) {
17820
18113
  }
17821
18114
  resolvePlaceholdersForView(job, job.root, i18nContexts, elements);
17822
18115
  }
17823
- function resolvePlaceholdersForView(job, unit, i18nContexts, elements) {
18116
+ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingStructuralDirective) {
17824
18117
  let currentOps = null;
18118
+ let pendingStructuralDirectiveCloses = /* @__PURE__ */ new Map();
17825
18119
  for (const op of unit.create) {
17826
18120
  switch (op.kind) {
17827
18121
  case OpKind.I18nStart:
@@ -17838,52 +18132,135 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements) {
17838
18132
  if (currentOps === null) {
17839
18133
  throw Error("i18n tag placeholder should only occur inside an i18n block");
17840
18134
  }
17841
- const { startName, closeName } = op.i18nPlaceholder;
17842
- let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
17843
- if (closeName === "") {
17844
- flags |= I18nParamValueFlags.CloseTag;
18135
+ recordElementStart(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18136
+ if (pendingStructuralDirective && op.i18nPlaceholder.closeName) {
18137
+ pendingStructuralDirectiveCloses.set(op.xref, pendingStructuralDirective);
17845
18138
  }
17846
- addParam(currentOps.i18nContext.params, startName, op.handle.slot, currentOps.i18nBlock.subTemplateIndex, flags);
18139
+ pendingStructuralDirective = void 0;
17847
18140
  }
17848
18141
  break;
17849
18142
  case OpKind.ElementEnd:
17850
18143
  const startOp = elements.get(op.xref);
17851
18144
  if (startOp && startOp.i18nPlaceholder !== void 0) {
17852
18145
  if (currentOps === null) {
17853
- throw Error("i18n tag placeholder should only occur inside an i18n block");
17854
- }
17855
- const { closeName } = startOp.i18nPlaceholder;
17856
- if (closeName !== "") {
17857
- addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
18146
+ throw Error("AssertionError: i18n tag placeholder should only occur inside an i18n block");
17858
18147
  }
18148
+ recordElementClose(startOp, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirectiveCloses.get(op.xref));
18149
+ pendingStructuralDirectiveCloses.delete(op.xref);
17859
18150
  }
17860
18151
  break;
17861
- case OpKind.Template:
18152
+ case OpKind.Projection:
17862
18153
  if (op.i18nPlaceholder !== void 0) {
17863
18154
  if (currentOps === null) {
17864
18155
  throw Error("i18n tag placeholder should only occur inside an i18n block");
17865
18156
  }
17866
- let startFlags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.OpenTag;
17867
- const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18nBlock, op);
17868
- const { startName, closeName } = op.i18nPlaceholder;
17869
- const isSelfClosing = closeName === "";
17870
- if (isSelfClosing) {
17871
- startFlags |= I18nParamValueFlags.CloseTag;
18157
+ recordElementStart(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18158
+ recordElementClose(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18159
+ pendingStructuralDirective = void 0;
18160
+ }
18161
+ break;
18162
+ case OpKind.Template:
18163
+ const view = job.views.get(op.xref);
18164
+ if (op.i18nPlaceholder === void 0) {
18165
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
18166
+ } else {
18167
+ if (currentOps === null) {
18168
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
17872
18169
  }
17873
- addParam(currentOps.i18nContext.params, startName, op.handle.slot, subTemplateIndex, startFlags);
17874
- resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements);
17875
- if (!isSelfClosing) {
17876
- addParam(currentOps.i18nContext.params, closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
18170
+ if (op.templateKind === TemplateKind.Structural) {
18171
+ resolvePlaceholdersForView(job, view, i18nContexts, elements, op);
18172
+ } else {
18173
+ recordTemplateStart(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18174
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
18175
+ recordTemplateClose(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18176
+ pendingStructuralDirective = void 0;
17877
18177
  }
18178
+ }
18179
+ break;
18180
+ case OpKind.RepeaterCreate:
18181
+ if (pendingStructuralDirective !== void 0) {
18182
+ throw Error("AssertionError: Unexpected structural directive associated with @for block");
18183
+ }
18184
+ const forSlot = op.handle.slot + 1;
18185
+ const forView = job.views.get(op.xref);
18186
+ if (op.i18nPlaceholder === void 0) {
18187
+ resolvePlaceholdersForView(job, forView, i18nContexts, elements);
17878
18188
  } else {
17879
- resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements);
18189
+ if (currentOps === null) {
18190
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
18191
+ }
18192
+ recordTemplateStart(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18193
+ resolvePlaceholdersForView(job, forView, i18nContexts, elements);
18194
+ recordTemplateClose(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18195
+ pendingStructuralDirective = void 0;
18196
+ }
18197
+ if (op.emptyView !== null) {
18198
+ const emptySlot = op.handle.slot + 2;
18199
+ const emptyView = job.views.get(op.emptyView);
18200
+ if (op.emptyI18nPlaceholder === void 0) {
18201
+ resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
18202
+ } else {
18203
+ if (currentOps === null) {
18204
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
18205
+ }
18206
+ recordTemplateStart(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18207
+ resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
18208
+ recordTemplateClose(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
18209
+ pendingStructuralDirective = void 0;
18210
+ }
17880
18211
  }
17881
18212
  break;
17882
18213
  }
17883
18214
  }
17884
18215
  }
17885
- function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
17886
- for (const childOp of job.views.get(op.xref).create) {
18216
+ function recordElementStart(op, i18nContext, i18nBlock, structuralDirective) {
18217
+ const { startName, closeName } = op.i18nPlaceholder;
18218
+ let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
18219
+ let value = op.handle.slot;
18220
+ if (structuralDirective !== void 0) {
18221
+ flags |= I18nParamValueFlags.TemplateTag;
18222
+ value = { element: value, template: structuralDirective.handle.slot };
18223
+ }
18224
+ if (!closeName) {
18225
+ flags |= I18nParamValueFlags.CloseTag;
18226
+ }
18227
+ addParam(i18nContext.params, startName, value, i18nBlock.subTemplateIndex, flags);
18228
+ }
18229
+ function recordElementClose(op, i18nContext, i18nBlock, structuralDirective) {
18230
+ const { closeName } = op.i18nPlaceholder;
18231
+ if (closeName) {
18232
+ let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag;
18233
+ let value = op.handle.slot;
18234
+ if (structuralDirective !== void 0) {
18235
+ flags |= I18nParamValueFlags.TemplateTag;
18236
+ value = { element: value, template: structuralDirective.handle.slot };
18237
+ }
18238
+ addParam(i18nContext.params, closeName, value, i18nBlock.subTemplateIndex, flags);
18239
+ }
18240
+ }
18241
+ function recordTemplateStart(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
18242
+ let { startName, closeName } = i18nPlaceholder;
18243
+ let flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.OpenTag;
18244
+ if (!closeName) {
18245
+ flags |= I18nParamValueFlags.CloseTag;
18246
+ }
18247
+ if (structuralDirective !== void 0) {
18248
+ addParam(i18nContext.params, startName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
18249
+ }
18250
+ addParam(i18nContext.params, startName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
18251
+ }
18252
+ function recordTemplateClose(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
18253
+ const { startName, closeName } = i18nPlaceholder;
18254
+ const flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag;
18255
+ if (closeName) {
18256
+ addParam(i18nContext.params, closeName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
18257
+ if (structuralDirective !== void 0) {
18258
+ addParam(i18nContext.params, closeName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
18259
+ }
18260
+ }
18261
+ }
18262
+ function getSubTemplateIndexForTemplateTag(job, i18nOp, view) {
18263
+ for (const childOp of view.create) {
17887
18264
  if (childOp.kind === OpKind.I18nStart) {
17888
18265
  return childOp.subTemplateIndex;
17889
18266
  }
@@ -17899,6 +18276,7 @@ function addParam(params, placeholder, value, subTemplateIndex, flags) {
17899
18276
 
17900
18277
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
17901
18278
  function resolveI18nExpressionPlaceholders(job) {
18279
+ var _a2;
17902
18280
  const subTemplateIndicies = /* @__PURE__ */ new Map();
17903
18281
  const i18nContexts = /* @__PURE__ */ new Map();
17904
18282
  for (const unit of job.units) {
@@ -17914,12 +18292,13 @@ function resolveI18nExpressionPlaceholders(job) {
17914
18292
  }
17915
18293
  }
17916
18294
  const expressionIndices = /* @__PURE__ */ new Map();
18295
+ const referenceIndex = (op) => op.usage === I18nExpressionFor.I18nText ? op.i18nOwner : op.context;
17917
18296
  for (const unit of job.units) {
17918
18297
  for (const op of unit.update) {
17919
18298
  if (op.kind === OpKind.I18nExpression) {
17920
18299
  const i18nContext = i18nContexts.get(op.context);
17921
- const index = expressionIndices.get(op.target) || 0;
17922
- const subTemplateIndex = subTemplateIndicies.get(op.target);
18300
+ const index = expressionIndices.get(referenceIndex(op)) || 0;
18301
+ const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
17923
18302
  const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
17924
18303
  const values = params.get(op.i18nPlaceholder) || [];
17925
18304
  values.push({
@@ -17928,7 +18307,7 @@ function resolveI18nExpressionPlaceholders(job) {
17928
18307
  flags: I18nParamValueFlags.ExpressionIndex
17929
18308
  });
17930
18309
  params.set(op.i18nPlaceholder, values);
17931
- expressionIndices.set(op.target, index + 1);
18310
+ expressionIndices.set(referenceIndex(op), index + 1);
17932
18311
  }
17933
18312
  }
17934
18313
  }
@@ -18043,30 +18422,54 @@ function processLexicalScope2(unit, ops, savedView) {
18043
18422
  }
18044
18423
 
18045
18424
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_sanitizers.mjs
18046
- var sanitizers = /* @__PURE__ */ new Map([
18047
- [SecurityContext.HTML, SanitizerFn.Html],
18048
- [SecurityContext.SCRIPT, SanitizerFn.Script],
18049
- [SecurityContext.STYLE, SanitizerFn.Style],
18050
- [SecurityContext.URL, SanitizerFn.Url],
18051
- [SecurityContext.RESOURCE_URL, SanitizerFn.ResourceUrl]
18425
+ var sanitizerFns = /* @__PURE__ */ new Map([
18426
+ [SecurityContext.HTML, Identifiers.sanitizeHtml],
18427
+ [SecurityContext.RESOURCE_URL, Identifiers.sanitizeResourceUrl],
18428
+ [SecurityContext.SCRIPT, Identifiers.sanitizeScript],
18429
+ [SecurityContext.STYLE, Identifiers.sanitizeStyle],
18430
+ [SecurityContext.URL, Identifiers.sanitizeUrl]
18431
+ ]);
18432
+ var trustedValueFns = /* @__PURE__ */ new Map([
18433
+ [SecurityContext.HTML, Identifiers.trustConstantHtml],
18434
+ [SecurityContext.RESOURCE_URL, Identifiers.trustConstantResourceUrl]
18052
18435
  ]);
18053
18436
  function resolveSanitizers(job) {
18437
+ var _a2, _b2;
18054
18438
  for (const unit of job.units) {
18055
18439
  const elements = createOpXrefMap(unit);
18056
- let sanitizerFn;
18440
+ if (job.kind !== CompilationJobKind.Host) {
18441
+ for (const op of unit.create) {
18442
+ if (op.kind === OpKind.ExtractedAttribute) {
18443
+ const trustedValueFn = (_a2 = trustedValueFns.get(getOnlySecurityContext(op.securityContext))) != null ? _a2 : null;
18444
+ op.trustedValueFn = trustedValueFn !== null ? importExpr(trustedValueFn) : null;
18445
+ }
18446
+ }
18447
+ }
18057
18448
  for (const op of unit.update) {
18058
18449
  switch (op.kind) {
18059
18450
  case OpKind.Property:
18060
18451
  case OpKind.Attribute:
18061
- sanitizerFn = sanitizers.get(op.securityContext) || null;
18062
- op.sanitizer = sanitizerFn ? new SanitizerExpr(sanitizerFn) : null;
18452
+ case OpKind.HostProperty:
18453
+ let sanitizerFn = null;
18454
+ if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
18455
+ sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
18456
+ } else {
18457
+ sanitizerFn = (_b2 = sanitizerFns.get(getOnlySecurityContext(op.securityContext))) != null ? _b2 : null;
18458
+ }
18459
+ op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
18063
18460
  if (op.sanitizer === null) {
18064
- const ownerOp = elements.get(op.target);
18065
- if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
18066
- throw Error("Property should have an element-like owner");
18461
+ let isIframe = false;
18462
+ if (job.kind === CompilationJobKind.Host || op.kind === OpKind.HostProperty) {
18463
+ isIframe = true;
18464
+ } else {
18465
+ const ownerOp = elements.get(op.target);
18466
+ if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
18467
+ throw Error("Property should have an element-like owner");
18468
+ }
18469
+ isIframe = isIframeElement(ownerOp);
18067
18470
  }
18068
- if (isIframeElement(ownerOp) && isIframeSecuritySensitiveAttr(op.name)) {
18069
- op.sanitizer = new SanitizerExpr(SanitizerFn.IframeAttribute);
18471
+ if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
18472
+ op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
18070
18473
  }
18071
18474
  }
18072
18475
  break;
@@ -18078,6 +18481,15 @@ function isIframeElement(op) {
18078
18481
  var _a2;
18079
18482
  return op.kind === OpKind.ElementStart && ((_a2 = op.tag) == null ? void 0 : _a2.toLowerCase()) === "iframe";
18080
18483
  }
18484
+ function getOnlySecurityContext(securityContext) {
18485
+ if (Array.isArray(securityContext)) {
18486
+ if (securityContext.length > 1) {
18487
+ throw Error(`AssertionError: Ambiguous security context`);
18488
+ }
18489
+ return securityContext[0] || SecurityContext.NONE;
18490
+ }
18491
+ return securityContext;
18492
+ }
18081
18493
 
18082
18494
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
18083
18495
  function saveAndRestoreView(job) {
@@ -18725,12 +19137,12 @@ var phases = [
18725
19137
  { kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
18726
19138
  { kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
18727
19139
  { kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
18728
- { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
18729
- { kind: CompilationJobKind.Both, fn: specializeBindings },
18730
19140
  { kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
18731
19141
  { kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
18732
- { kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
19142
+ { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
19143
+ { kind: CompilationJobKind.Both, fn: specializeBindings },
18733
19144
  { kind: CompilationJobKind.Both, fn: extractAttributes },
19145
+ { kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
18734
19146
  { kind: CompilationJobKind.Both, fn: parseExtractedStyles },
18735
19147
  { kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
18736
19148
  { kind: CompilationJobKind.Both, fn: collapseSingletonInterpolations },
@@ -18738,14 +19150,17 @@ var phases = [
18738
19150
  { kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
18739
19151
  { kind: CompilationJobKind.Tmpl, fn: createPipes },
18740
19152
  { kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
18741
- { kind: CompilationJobKind.Tmpl, fn: extractI18nText },
19153
+ { kind: CompilationJobKind.Tmpl, fn: convertI18nText },
19154
+ { kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
19155
+ { kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
19156
+ { kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
18742
19157
  { kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
18743
19158
  { kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
18744
19159
  { kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
18745
19160
  { kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
18746
19161
  { kind: CompilationJobKind.Tmpl, fn: generateVariables },
18747
19162
  { kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
18748
- { kind: CompilationJobKind.Tmpl, fn: deleteAnyCasts },
19163
+ { kind: CompilationJobKind.Both, fn: deleteAnyCasts },
18749
19164
  { kind: CompilationJobKind.Both, fn: resolveDollarEvent },
18750
19165
  { kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
18751
19166
  { kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
@@ -18753,7 +19168,7 @@ var phases = [
18753
19168
  { kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
18754
19169
  { kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
18755
19170
  { kind: CompilationJobKind.Both, fn: resolveContexts },
18756
- { kind: CompilationJobKind.Tmpl, fn: resolveSanitizers },
19171
+ { kind: CompilationJobKind.Both, fn: resolveSanitizers },
18757
19172
  { kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
18758
19173
  { kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
18759
19174
  { kind: CompilationJobKind.Both, fn: expandSafeReads },
@@ -18768,7 +19183,6 @@ var phases = [
18768
19183
  { kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
18769
19184
  { kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
18770
19185
  { kind: CompilationJobKind.Both, fn: collectElementConsts },
18771
- { kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
18772
19186
  { kind: CompilationJobKind.Tmpl, fn: removeI18nContexts },
18773
19187
  { kind: CompilationJobKind.Both, fn: countVariables },
18774
19188
  { kind: CompilationJobKind.Tmpl, fn: generateAdvance },
@@ -18886,6 +19300,8 @@ function emitHostBindingFunction(job) {
18886
19300
 
18887
19301
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
18888
19302
  var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
19303
+ var domSchema = new DomElementSchemaRegistry();
19304
+ var NG_TEMPLATE_TAG_NAME = "ng-template";
18889
19305
  function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
18890
19306
  const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
18891
19307
  ingestNodes(job.root, template2);
@@ -18895,50 +19311,55 @@ function ingestHostBinding(input, bindingParser, constantPool) {
18895
19311
  var _a2, _b2, _c2;
18896
19312
  const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode);
18897
19313
  for (const property2 of (_a2 = input.properties) != null ? _a2 : []) {
18898
- ingestHostProperty(job, property2, false);
19314
+ let bindingKind = BindingKind.Property;
19315
+ if (property2.name.startsWith("attr.")) {
19316
+ property2.name = property2.name.substring("attr.".length);
19317
+ bindingKind = BindingKind.Attribute;
19318
+ }
19319
+ if (property2.isAnimation) {
19320
+ bindingKind = BindingKind.Animation;
19321
+ }
19322
+ const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
19323
+ ingestHostProperty(job, property2, bindingKind, false, securityContexts);
18899
19324
  }
18900
19325
  for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
18901
- ingestHostAttribute(job, name, expr);
19326
+ const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
19327
+ ingestHostAttribute(job, name, expr, securityContexts);
18902
19328
  }
18903
19329
  for (const event of (_c2 = input.events) != null ? _c2 : []) {
18904
19330
  ingestHostEvent(job, event);
18905
19331
  }
18906
19332
  return job;
18907
19333
  }
18908
- function ingestHostProperty(job, property2, isTextAttribute) {
19334
+ function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securityContexts) {
18909
19335
  let expression;
18910
19336
  const ast = property2.expression.ast;
18911
19337
  if (ast instanceof Interpolation) {
18912
- expression = new Interpolation2(ast.strings, ast.expressions.map((expr) => convertAst(expr, job, property2.sourceSpan)));
19338
+ expression = new Interpolation2(ast.strings, ast.expressions.map((expr) => convertAst(expr, job, property2.sourceSpan)), []);
18913
19339
  } else {
18914
19340
  expression = convertAst(ast, job, property2.sourceSpan);
18915
19341
  }
18916
- let bindingKind = BindingKind.Property;
18917
- if (property2.name.startsWith("attr.")) {
18918
- property2.name = property2.name.substring("attr.".length);
18919
- bindingKind = BindingKind.Attribute;
18920
- }
18921
- if (property2.isAnimation) {
18922
- bindingKind = BindingKind.Animation;
18923
- }
18924
- job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, SecurityContext.NONE, isTextAttribute, false, property2.sourceSpan));
19342
+ job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, isTextAttribute, false, null, null, property2.sourceSpan));
18925
19343
  }
18926
- function ingestHostAttribute(job, name, value) {
19344
+ function ingestHostAttribute(job, name, value, securityContexts) {
18927
19345
  const attrBinding = createBindingOp(
18928
19346
  job.root.xref,
18929
19347
  BindingKind.Attribute,
18930
19348
  name,
18931
19349
  value,
18932
19350
  null,
18933
- SecurityContext.NONE,
19351
+ securityContexts,
18934
19352
  true,
18935
19353
  false,
19354
+ null,
19355
+ null,
18936
19356
  null
18937
19357
  );
18938
19358
  job.root.update.push(attrBinding);
18939
19359
  }
18940
19360
  function ingestHostEvent(job, event) {
18941
- const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, event.targetOrPhase, true, event.sourceSpan);
19361
+ const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
19362
+ const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, [], phase, target, true, event.sourceSpan);
18942
19363
  eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
18943
19364
  job.root.create.push(eventBinding);
18944
19365
  }
@@ -18978,14 +19399,17 @@ function ingestElement(unit, element2) {
18978
19399
  const [namespaceKey, elementName] = splitNsName(element2.name);
18979
19400
  const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
18980
19401
  unit.create.push(startOp);
18981
- ingestBindings(unit, startOp, element2);
19402
+ ingestElementBindings(unit, startOp, element2);
18982
19403
  ingestReferences(startOp, element2);
19404
+ let i18nBlockId = null;
19405
+ if (element2.i18n instanceof Message) {
19406
+ i18nBlockId = unit.job.allocateXrefId();
19407
+ unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n));
19408
+ }
18983
19409
  ingestNodes(unit, element2.children);
18984
19410
  const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
18985
19411
  unit.create.push(endOp);
18986
- if (element2.i18n instanceof Message) {
18987
- const i18nBlockId = unit.job.allocateXrefId();
18988
- OpList.insertAfter(createI18nStartOp(i18nBlockId, element2.i18n), startOp);
19412
+ if (i18nBlockId !== null) {
18989
19413
  OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
18990
19414
  }
18991
19415
  }
@@ -19002,24 +19426,30 @@ function ingestTemplate(unit, tmpl) {
19002
19426
  const i18nPlaceholder = tmpl.i18n instanceof TagPlaceholder ? tmpl.i18n : void 0;
19003
19427
  const namespace = namespaceForKey(namespacePrefix);
19004
19428
  const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
19005
- const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
19006
- unit.create.push(tplOp);
19007
- ingestBindings(unit, tplOp, tmpl);
19008
- ingestReferences(tplOp, tmpl);
19429
+ const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
19430
+ const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
19431
+ unit.create.push(templateOp);
19432
+ ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
19433
+ ingestReferences(templateOp, tmpl);
19009
19434
  ingestNodes(childView, tmpl.children);
19010
19435
  for (const { name, value } of tmpl.variables) {
19011
19436
  childView.contextVariables.set(name, value !== "" ? value : "$implicit");
19012
19437
  }
19013
- if (isPlainTemplate(tmpl) && tmpl.i18n instanceof Message) {
19438
+ if (templateKind === TemplateKind.NgTemplate && tmpl.i18n instanceof Message) {
19014
19439
  const id = unit.job.allocateXrefId();
19015
19440
  OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
19016
19441
  OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
19017
19442
  }
19018
19443
  }
19019
19444
  function ingestContent(unit, content) {
19020
- const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.sourceSpan);
19445
+ if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
19446
+ throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
19447
+ }
19448
+ const attrs = content.attributes.flatMap((a) => [a.name, a.value]);
19449
+ const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, attrs, content.sourceSpan);
19021
19450
  for (const attr of content.attributes) {
19022
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
19451
+ const securityContext = domSchema.securityContext(content.name, attr.name, true);
19452
+ unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19023
19453
  }
19024
19454
  unit.create.push(op);
19025
19455
  }
@@ -19047,9 +19477,10 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
19047
19477
  const textXref = unit.job.allocateXrefId();
19048
19478
  unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
19049
19479
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
19050
- unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan))), i18nPlaceholders, text2.sourceSpan));
19480
+ unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
19051
19481
  }
19052
19482
  function ingestIfBlock(unit, ifBlock) {
19483
+ var _a2;
19053
19484
  let firstXref = null;
19054
19485
  let firstSlotHandle = null;
19055
19486
  let conditions = [];
@@ -19063,14 +19494,21 @@ function ingestIfBlock(unit, ifBlock) {
19063
19494
  if (ifCase.expressionAlias !== null) {
19064
19495
  cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
19065
19496
  }
19066
- const tmplOp = createTemplateOp(cView.xref, tagName, "Conditional", Namespace.HTML, void 0, ifCase.sourceSpan);
19067
- unit.create.push(tmplOp);
19497
+ let ifCaseI18nMeta = void 0;
19498
+ if (ifCase.i18n !== void 0) {
19499
+ if (!(ifCase.i18n instanceof BlockPlaceholder)) {
19500
+ throw Error(`Unhandled i18n metadata type for if block: ${(_a2 = ifCase.i18n) == null ? void 0 : _a2.constructor.name}`);
19501
+ }
19502
+ ifCaseI18nMeta = ifCase.i18n;
19503
+ }
19504
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
19505
+ unit.create.push(templateOp);
19068
19506
  if (firstXref === null) {
19069
19507
  firstXref = cView.xref;
19070
- firstSlotHandle = tmplOp.handle;
19508
+ firstSlotHandle = templateOp.handle;
19071
19509
  }
19072
19510
  const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
19073
- const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, tmplOp.xref, tmplOp.handle, ifCase.expressionAlias);
19511
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle, ifCase.expressionAlias);
19074
19512
  conditions.push(conditionalCaseExpr);
19075
19513
  ingestNodes(cView, ifCase.children);
19076
19514
  }
@@ -19078,54 +19516,65 @@ function ingestIfBlock(unit, ifBlock) {
19078
19516
  unit.update.push(conditional2);
19079
19517
  }
19080
19518
  function ingestSwitchBlock(unit, switchBlock) {
19519
+ var _a2;
19081
19520
  let firstXref = null;
19082
19521
  let firstSlotHandle = null;
19083
19522
  let conditions = [];
19084
19523
  for (const switchCase of switchBlock.cases) {
19085
19524
  const cView = unit.job.allocateView(unit.xref);
19086
- const tmplOp = createTemplateOp(cView.xref, null, "Case", Namespace.HTML, void 0, switchCase.sourceSpan);
19087
- unit.create.push(tmplOp);
19525
+ let switchCaseI18nMeta = void 0;
19526
+ if (switchCase.i18n !== void 0) {
19527
+ if (!(switchCase.i18n instanceof BlockPlaceholder)) {
19528
+ throw Error(`Unhandled i18n metadata type for switch block: ${(_a2 = switchCase.i18n) == null ? void 0 : _a2.constructor.name}`);
19529
+ }
19530
+ switchCaseI18nMeta = switchCase.i18n;
19531
+ }
19532
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
19533
+ unit.create.push(templateOp);
19088
19534
  if (firstXref === null) {
19089
19535
  firstXref = cView.xref;
19090
- firstSlotHandle = tmplOp.handle;
19536
+ firstSlotHandle = templateOp.handle;
19091
19537
  }
19092
19538
  const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
19093
- const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, tmplOp.xref, tmplOp.handle);
19539
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle);
19094
19540
  conditions.push(conditionalCaseExpr);
19095
19541
  ingestNodes(cView, switchCase.children);
19096
19542
  }
19097
19543
  const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
19098
19544
  unit.update.push(conditional2);
19099
19545
  }
19100
- function ingestDeferView(unit, suffix, children, sourceSpan) {
19546
+ function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
19547
+ if (i18nMeta !== void 0 && !(i18nMeta instanceof BlockPlaceholder)) {
19548
+ throw Error("Unhandled i18n metadata type for defer block");
19549
+ }
19101
19550
  if (children === void 0) {
19102
19551
  return null;
19103
19552
  }
19104
19553
  const secondaryView = unit.job.allocateView(unit.xref);
19105
19554
  ingestNodes(secondaryView, children);
19106
- const templateOp = createTemplateOp(secondaryView.xref, null, `Defer${suffix}`, Namespace.HTML, void 0, sourceSpan);
19555
+ const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan);
19107
19556
  unit.create.push(templateOp);
19108
19557
  return templateOp;
19109
19558
  }
19110
19559
  function ingestDeferBlock(unit, deferBlock) {
19111
- var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
19560
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
19112
19561
  const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
19113
19562
  if (blockMeta === void 0) {
19114
19563
  throw new Error(`AssertionError: unable to find metadata for deferred block`);
19115
19564
  }
19116
- const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
19117
- const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
19118
- const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
19119
- const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
19565
+ const main = ingestDeferView(unit, "", deferBlock.i18n, deferBlock.children, deferBlock.sourceSpan);
19566
+ 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);
19567
+ 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);
19568
+ 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);
19120
19569
  const deferXref = unit.job.allocateXrefId();
19121
19570
  const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
19122
- deferOp.placeholderView = (_g = placeholder == null ? void 0 : placeholder.xref) != null ? _g : null;
19123
- deferOp.placeholderSlot = (_h = placeholder == null ? void 0 : placeholder.handle) != null ? _h : null;
19124
- deferOp.loadingSlot = (_i = loading == null ? void 0 : loading.handle) != null ? _i : null;
19125
- deferOp.errorSlot = (_j = error2 == null ? void 0 : error2.handle) != null ? _j : null;
19126
- deferOp.placeholderMinimumTime = (_l = (_k = deferBlock.placeholder) == null ? void 0 : _k.minimumTime) != null ? _l : null;
19127
- deferOp.loadingMinimumTime = (_n = (_m = deferBlock.loading) == null ? void 0 : _m.minimumTime) != null ? _n : null;
19128
- deferOp.loadingAfterTime = (_p = (_o = deferBlock.loading) == null ? void 0 : _o.afterTime) != null ? _p : null;
19571
+ deferOp.placeholderView = (_j = placeholder == null ? void 0 : placeholder.xref) != null ? _j : null;
19572
+ deferOp.placeholderSlot = (_k = placeholder == null ? void 0 : placeholder.handle) != null ? _k : null;
19573
+ deferOp.loadingSlot = (_l = loading == null ? void 0 : loading.handle) != null ? _l : null;
19574
+ deferOp.errorSlot = (_m = error2 == null ? void 0 : error2.handle) != null ? _m : null;
19575
+ deferOp.placeholderMinimumTime = (_o = (_n = deferBlock.placeholder) == null ? void 0 : _n.minimumTime) != null ? _o : null;
19576
+ deferOp.loadingMinimumTime = (_q = (_p = deferBlock.loading) == null ? void 0 : _p.minimumTime) != null ? _q : null;
19577
+ deferOp.loadingAfterTime = (_s = (_r = deferBlock.loading) == null ? void 0 : _r.afterTime) != null ? _s : null;
19129
19578
  unit.create.push(deferOp);
19130
19579
  let prefetch = false;
19131
19580
  let deferOnOps = [];
@@ -19189,17 +19638,12 @@ function ingestDeferBlock(unit, deferBlock) {
19189
19638
  unit.update.push(deferWhenOps);
19190
19639
  }
19191
19640
  function ingestIcu(unit, icu) {
19192
- var _a2, _b2;
19641
+ var _a2;
19193
19642
  if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
19194
19643
  const xref = unit.job.allocateXrefId();
19195
19644
  const icuNode = icu.i18n.nodes[0];
19196
19645
  unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
19197
- const expressionPlaceholder = (_a2 = icuNode.expressionPlaceholder) == null ? void 0 : _a2.trimEnd();
19198
- if (expressionPlaceholder === void 0 || icu.vars[expressionPlaceholder] === void 0) {
19199
- throw Error("ICU should have a text binding");
19200
- }
19201
- ingestBoundText(unit, icu.vars[expressionPlaceholder], [expressionPlaceholder]);
19202
- for (const [placeholder, text2] of Object.entries(icu.placeholders)) {
19646
+ for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
19203
19647
  if (text2 instanceof BoundText) {
19204
19648
  ingestBoundText(unit, text2, [placeholder]);
19205
19649
  } else {
@@ -19208,11 +19652,11 @@ function ingestIcu(unit, icu) {
19208
19652
  }
19209
19653
  unit.create.push(createIcuEndOp(xref));
19210
19654
  } else {
19211
- throw Error(`Unhandled i18n metadata type for ICU: ${(_b2 = icu.i18n) == null ? void 0 : _b2.constructor.name}`);
19655
+ throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
19212
19656
  }
19213
19657
  }
19214
19658
  function ingestForBlock(unit, forBlock) {
19215
- var _a2;
19659
+ var _a2, _b2, _c2;
19216
19660
  const repeaterView = unit.job.allocateView(unit.xref);
19217
19661
  const createRepeaterAlias = (ident, repeaterVar) => {
19218
19662
  repeaterView.aliases.add({
@@ -19246,8 +19690,16 @@ function ingestForBlock(unit, forBlock) {
19246
19690
  $odd: forBlock.contextVariables.$odd.name,
19247
19691
  $implicit: forBlock.item.name
19248
19692
  };
19693
+ if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
19694
+ throw Error("AssertionError: Unhandled i18n metadata type or @for");
19695
+ }
19696
+ if (((_a2 = forBlock.empty) == null ? void 0 : _a2.i18n) !== void 0 && !(forBlock.empty.i18n instanceof BlockPlaceholder)) {
19697
+ throw Error("AssertionError: Unhandled i18n metadata type or @empty");
19698
+ }
19699
+ const i18nPlaceholder = forBlock.i18n;
19700
+ const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
19249
19701
  const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
19250
- const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_a2 = emptyView == null ? void 0 : emptyView.xref) != null ? _a2 : null, tagName, track, varNames, forBlock.sourceSpan);
19702
+ const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.sourceSpan);
19251
19703
  unit.create.push(repeaterCreate2);
19252
19704
  const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
19253
19705
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
@@ -19283,6 +19735,15 @@ function convertAst(ast, job, baseSourceSpan) {
19283
19735
  }
19284
19736
  } else if (ast instanceof LiteralPrimitive) {
19285
19737
  return literal(ast.value, void 0, convertSourceSpan(ast.span, baseSourceSpan));
19738
+ } else if (ast instanceof Unary) {
19739
+ switch (ast.operator) {
19740
+ case "+":
19741
+ return new UnaryOperatorExpr(UnaryOperator.Plus, convertAst(ast.expr, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
19742
+ case "-":
19743
+ return new UnaryOperatorExpr(UnaryOperator.Minus, convertAst(ast.expr, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
19744
+ default:
19745
+ throw new Error(`AssertionError: unknown unary operator ${ast.operator}`);
19746
+ }
19286
19747
  } else if (ast instanceof Binary) {
19287
19748
  const operator = BINARY_OPERATORS.get(ast.operation);
19288
19749
  if (operator === void 0) {
@@ -19320,104 +19781,134 @@ function convertAst(ast, job, baseSourceSpan) {
19320
19781
  return new SafeInvokeFunctionExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.args.map((a) => convertAst(a, job, baseSourceSpan)));
19321
19782
  } else if (ast instanceof EmptyExpr) {
19322
19783
  return new EmptyExpr2(convertSourceSpan(ast.span, baseSourceSpan));
19784
+ } else if (ast instanceof PrefixNot) {
19785
+ return not(convertAst(ast.expression, job, baseSourceSpan), convertSourceSpan(ast.span, baseSourceSpan));
19323
19786
  } else {
19324
19787
  throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
19325
19788
  }
19326
19789
  }
19790
+ function convertAstWithInterpolation(job, value, i18nMeta) {
19791
+ var _a2, _b2;
19792
+ let expression;
19793
+ if (value instanceof Interpolation) {
19794
+ expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
19795
+ } else if (value instanceof AST) {
19796
+ expression = convertAst(value, job, null);
19797
+ } else {
19798
+ expression = literal(value);
19799
+ }
19800
+ return expression;
19801
+ }
19802
+ var BINDING_KINDS = /* @__PURE__ */ new Map([
19803
+ [0, BindingKind.Property],
19804
+ [1, BindingKind.Attribute],
19805
+ [2, BindingKind.ClassName],
19806
+ [3, BindingKind.StyleProperty],
19807
+ [4, BindingKind.Animation]
19808
+ ]);
19327
19809
  function isPlainTemplate(tmpl) {
19328
19810
  var _a2;
19329
- return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === "ng-template";
19330
- }
19331
- function ingestBindings(unit, op, element2) {
19332
- let flags = BindingFlags.None;
19333
- if (element2 instanceof Template) {
19334
- flags |= BindingFlags.OnNgTemplateElement;
19335
- if (element2 instanceof Template && isPlainTemplate(element2)) {
19336
- flags |= BindingFlags.BindingTargetsTemplate;
19337
- }
19338
- const templateAttrFlags = flags | BindingFlags.BindingTargetsTemplate | BindingFlags.IsStructuralTemplateAttribute;
19339
- for (const attr of element2.templateAttrs) {
19340
- if (attr instanceof TextAttribute) {
19341
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, templateAttrFlags | BindingFlags.TextValue);
19342
- } else {
19343
- ingestBinding(unit, op.xref, attr.name, attr.value, attr.type, attr.unit, attr.securityContext, attr.sourceSpan, templateAttrFlags);
19344
- }
19345
- }
19811
+ return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === NG_TEMPLATE_TAG_NAME;
19812
+ }
19813
+ function asMessage(i18nMeta) {
19814
+ if (i18nMeta == null) {
19815
+ return null;
19816
+ }
19817
+ if (!(i18nMeta instanceof Message)) {
19818
+ throw Error(`Expected i18n meta to be a Message, but got: ${i18nMeta.constructor.name}`);
19346
19819
  }
19820
+ return i18nMeta;
19821
+ }
19822
+ function ingestElementBindings(unit, op, element2) {
19823
+ var _a2;
19824
+ let bindings = new Array();
19347
19825
  for (const attr of element2.attributes) {
19348
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, flags | BindingFlags.TextValue);
19826
+ const securityContext = domSchema.securityContext(element2.name, attr.name, true);
19827
+ 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));
19349
19828
  }
19350
19829
  for (const input of element2.inputs) {
19351
- ingestBinding(unit, op.xref, input.name, input.value, input.type, input.unit, input.securityContext, input.sourceSpan, flags);
19830
+ 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));
19352
19831
  }
19832
+ unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
19833
+ unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
19353
19834
  for (const output of element2.outputs) {
19354
- let listenerOp;
19355
- if (output.type === 1) {
19356
- if (output.phase === null) {
19357
- throw Error("Animation listener should have a phase");
19358
- }
19359
- }
19360
- if (element2 instanceof Template && !isPlainTemplate(element2)) {
19361
- unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null));
19362
- continue;
19363
- }
19364
- listenerOp = createListenerOp(op.xref, op.handle, output.name, op.tag, output.phase, false, output.sourceSpan);
19365
- let handlerExprs;
19366
- let handler = output.handler;
19367
- if (handler instanceof ASTWithSource) {
19368
- handler = handler.ast;
19835
+ if (output.type === 1 && output.phase === null) {
19836
+ throw Error("Animation listener should have a phase");
19369
19837
  }
19370
- if (handler instanceof Chain) {
19371
- handlerExprs = handler.expressions;
19838
+ 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));
19839
+ }
19840
+ if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
19841
+ unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
19842
+ }
19843
+ }
19844
+ function ingestTemplateBindings(unit, op, template2, templateKind) {
19845
+ let bindings = new Array();
19846
+ for (const attr of template2.templateAttrs) {
19847
+ if (attr instanceof TextAttribute) {
19848
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19849
+ bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19372
19850
  } else {
19373
- handlerExprs = [handler];
19851
+ bindings.push(createTemplateBinding(unit, op.xref, attr.type, attr.name, astOf(attr.value), attr.unit, attr.securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19852
+ }
19853
+ }
19854
+ for (const attr of template2.attributes) {
19855
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19856
+ bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, false, templateKind, asMessage(attr.i18n), attr.sourceSpan));
19857
+ }
19858
+ for (const input of template2.inputs) {
19859
+ bindings.push(createTemplateBinding(unit, op.xref, input.type, input.name, astOf(input.value), input.unit, input.securityContext, false, templateKind, asMessage(input.i18n), input.sourceSpan));
19860
+ }
19861
+ unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
19862
+ unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
19863
+ for (const output of template2.outputs) {
19864
+ if (output.type === 1 && output.phase === null) {
19865
+ throw Error("Animation listener should have a phase");
19374
19866
  }
19375
- if (handlerExprs.length === 0) {
19376
- throw new Error("Expected listener to have non-empty expression list.");
19867
+ if (templateKind === TemplateKind.NgTemplate) {
19868
+ 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));
19377
19869
  }
19378
- const expressions = handlerExprs.map((expr) => convertAst(expr, unit.job, output.handlerSpan));
19379
- const returnExpr = expressions.pop();
19380
- for (const expr of expressions) {
19381
- const stmtOp = createStatementOp(new ExpressionStatement(expr, expr.sourceSpan));
19382
- listenerOp.handlerOps.push(stmtOp);
19870
+ if (templateKind === TemplateKind.Structural && output.type !== 1) {
19871
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
19872
+ unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
19383
19873
  }
19384
- listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
19385
- unit.create.push(listenerOp);
19874
+ }
19875
+ if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
19876
+ unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
19386
19877
  }
19387
19878
  }
19388
- var BINDING_KINDS = /* @__PURE__ */ new Map([
19389
- [0, BindingKind.Property],
19390
- [1, BindingKind.Attribute],
19391
- [2, BindingKind.ClassName],
19392
- [3, BindingKind.StyleProperty],
19393
- [4, BindingKind.Animation]
19394
- ]);
19395
- var BindingFlags;
19396
- (function(BindingFlags2) {
19397
- BindingFlags2[BindingFlags2["None"] = 0] = "None";
19398
- BindingFlags2[BindingFlags2["TextValue"] = 1] = "TextValue";
19399
- BindingFlags2[BindingFlags2["BindingTargetsTemplate"] = 2] = "BindingTargetsTemplate";
19400
- BindingFlags2[BindingFlags2["IsStructuralTemplateAttribute"] = 4] = "IsStructuralTemplateAttribute";
19401
- BindingFlags2[BindingFlags2["OnNgTemplateElement"] = 8] = "OnNgTemplateElement";
19402
- })(BindingFlags || (BindingFlags = {}));
19403
- function ingestBinding(view, xref, name, value, type, unit, securityContext, sourceSpan, flags) {
19404
- if (value instanceof ASTWithSource) {
19405
- value = value.ast;
19879
+ function createTemplateBinding(view, xref, type, name, value, unit, securityContext, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
19880
+ const isTextBinding = typeof value === "string";
19881
+ if (templateKind === TemplateKind.Structural) {
19882
+ if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
19883
+ return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
19884
+ }
19885
+ if (!isTextBinding && (type === 1 || type === 4)) {
19886
+ return null;
19887
+ }
19406
19888
  }
19407
- if (flags & BindingFlags.OnNgTemplateElement && !(flags & BindingFlags.BindingTargetsTemplate) && type === 0) {
19408
- view.create.push(createExtractedAttributeOp(xref, BindingKind.Property, name, null));
19409
- return;
19889
+ let bindingType = BINDING_KINDS.get(type);
19890
+ if (templateKind === TemplateKind.NgTemplate) {
19891
+ if (type === 2 || type === 3 || type === 1 && !isTextBinding) {
19892
+ bindingType = BindingKind.Property;
19893
+ }
19410
19894
  }
19411
- let expression;
19412
- if (value instanceof Interpolation) {
19413
- expression = new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, view.job, null)));
19414
- } else if (value instanceof AST) {
19415
- expression = convertAst(value, view.job, null);
19416
- } else {
19417
- expression = value;
19895
+ return createBindingOp(xref, bindingType, name, convertAstWithInterpolation(view.job, value, i18nMessage), unit, securityContext, isTextBinding, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan);
19896
+ }
19897
+ function makeListenerHandlerOps(unit, handler, handlerSpan) {
19898
+ handler = astOf(handler);
19899
+ const handlerOps = new Array();
19900
+ let handlerExprs = handler instanceof Chain ? handler.expressions : [handler];
19901
+ if (handlerExprs.length === 0) {
19902
+ throw new Error("Expected listener to have non-empty expression list.");
19418
19903
  }
19419
- const kind = BINDING_KINDS.get(type);
19420
- view.update.push(createBindingOp(xref, kind, name, expression, unit, securityContext, !!(flags & BindingFlags.TextValue), !!(flags & BindingFlags.IsStructuralTemplateAttribute), sourceSpan));
19904
+ const expressions = handlerExprs.map((expr) => convertAst(expr, unit.job, handlerSpan));
19905
+ const returnExpr = expressions.pop();
19906
+ handlerOps.push(...expressions.map((e) => createStatementOp(new ExpressionStatement(e, e.sourceSpan))));
19907
+ handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
19908
+ return handlerOps;
19909
+ }
19910
+ function astOf(ast) {
19911
+ return ast instanceof ASTWithSource ? ast.ast : ast;
19421
19912
  }
19422
19913
  function ingestReferences(op, element2) {
19423
19914
  assertIsArray(op.localRefs);
@@ -19457,10 +19948,11 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
19457
19948
  }
19458
19949
  if (root !== null) {
19459
19950
  for (const attr of root.attributes) {
19460
- ingestBinding(unit, xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
19951
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19952
+ unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19461
19953
  }
19462
19954
  const tagName = root instanceof Element ? root.name : root.tagName;
19463
- return tagName === "ng-template" ? null : tagName;
19955
+ return tagName === NG_TEMPLATE_TAG_NAME ? null : tagName;
19464
19956
  }
19465
19957
  return null;
19466
19958
  }
@@ -21546,17 +22038,17 @@ function serializePlaceholderValue(value) {
21546
22038
  var NG_CONTENT_SELECT_ATTR2 = "select";
21547
22039
  var NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
21548
22040
  var EVENT_BINDING_SCOPE_GLOBALS = /* @__PURE__ */ new Set(["$event"]);
21549
- var NG_TEMPLATE_TAG_NAME = "ng-template";
21550
- var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
22041
+ var NG_TEMPLATE_TAG_NAME2 = "ng-template";
22042
+ var GLOBAL_TARGET_RESOLVERS2 = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
21551
22043
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
21552
22044
  function renderFlagCheckIfStmt(flags, statements) {
21553
22045
  return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null, false), statements);
21554
22046
  }
21555
22047
  function prepareEventListenerParameters(eventAst, handlerName = null, scope = null) {
21556
22048
  const { type, name, target, phase, handler } = eventAst;
21557
- if (target && !GLOBAL_TARGET_RESOLVERS.has(target)) {
22049
+ if (target && !GLOBAL_TARGET_RESOLVERS2.has(target)) {
21558
22050
  throw new Error(`Unexpected global target '${target}' defined for '${name}' event.
21559
- Supported list of global targets: ${Array.from(GLOBAL_TARGET_RESOLVERS.keys())}.`);
22051
+ Supported list of global targets: ${Array.from(GLOBAL_TARGET_RESOLVERS2.keys())}.`);
21560
22052
  }
21561
22053
  const eventArgumentName = "$event";
21562
22054
  const implicitReceiverAccesses = /* @__PURE__ */ new Set();
@@ -21589,7 +22081,7 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
21589
22081
  if (target) {
21590
22082
  params.push(
21591
22083
  literal(false),
21592
- importExpr(GLOBAL_TARGET_RESOLVERS.get(target))
22084
+ importExpr(GLOBAL_TARGET_RESOLVERS2.get(target))
21593
22085
  );
21594
22086
  }
21595
22087
  return params;
@@ -22135,10 +22627,10 @@ var TemplateDefinitionBuilder = class {
22135
22627
  var _a2;
22136
22628
  const tagNameWithoutNamespace = template2.tagName ? splitNsName(template2.tagName)[1] : template2.tagName;
22137
22629
  const contextNameSuffix = template2.tagName ? "_" + sanitizeIdentifier(template2.tagName) : "";
22138
- const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
22630
+ const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
22139
22631
  const templateIndex = this.createEmbeddedTemplateFn(tagNameWithoutNamespace, template2.children, contextNameSuffix, template2.sourceSpan, template2.variables, attrsExprs, template2.references, template2.i18n);
22140
22632
  this.templatePropertyBindings(templateIndex, template2.templateAttrs);
22141
- if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME) {
22633
+ if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME2) {
22142
22634
  const [i18nInputs, inputs] = partitionArray(template2.inputs, hasI18nMeta);
22143
22635
  if (i18nInputs.length > 0) {
22144
22636
  this.i18nAttributesInstruction(templateIndex, i18nInputs, (_a2 = template2.startSourceSpan) != null ? _a2 : template2.sourceSpan);
@@ -22379,8 +22871,8 @@ var TemplateDefinitionBuilder = class {
22379
22871
  }
22380
22872
  if (root !== null) {
22381
22873
  const name = root instanceof Element ? root.name : root.tagName;
22382
- tagName = name === NG_TEMPLATE_TAG_NAME ? null : name;
22383
- attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root.attributes, root.inputs, []);
22874
+ tagName = name === NG_TEMPLATE_TAG_NAME2 ? null : name;
22875
+ attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, root.attributes, root.inputs, []);
22384
22876
  }
22385
22877
  return { tagName, attrsExprs };
22386
22878
  }
@@ -23489,14 +23981,14 @@ function createBaseDirectiveTypeParams(meta) {
23489
23981
  function getInputsTypeExpression(meta) {
23490
23982
  return literalMap(Object.keys(meta.inputs).map((key) => {
23491
23983
  const value = meta.inputs[key];
23492
- return {
23493
- key,
23494
- value: literalMap([
23495
- { key: "alias", value: literal(value.bindingPropertyName), quoted: true },
23496
- { key: "required", value: literal(value.required), quoted: true }
23497
- ]),
23498
- quoted: true
23499
- };
23984
+ const values = [
23985
+ { key: "alias", value: literal(value.bindingPropertyName), quoted: true },
23986
+ { key: "required", value: literal(value.required), quoted: true }
23987
+ ];
23988
+ if (value.isSignal) {
23989
+ values.push({ key: "isSignal", value: literal(value.isSignal), quoted: true });
23990
+ }
23991
+ return { key, value: literalMap(values), quoted: true };
23500
23992
  }));
23501
23993
  }
23502
23994
  function createDirectiveType(meta) {
@@ -23540,6 +24032,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
23540
24032
  }
23541
24033
  const hostJob = ingestHostBinding({
23542
24034
  componentName: name,
24035
+ componentSelector: selector,
23543
24036
  properties: bindings,
23544
24037
  events: eventBindings,
23545
24038
  attributes: hostBindingsMetadata.attributes
@@ -23552,6 +24045,8 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
23552
24045
  }
23553
24046
  return emitHostBindingFunction(hostJob);
23554
24047
  }
24048
+ let bindingId = 0;
24049
+ const getNextBindingId = () => `${bindingId++}`;
23555
24050
  const bindingContext = variable(CONTEXT_NAME);
23556
24051
  const styleBuilder = new StylingBuilder(bindingContext);
23557
24052
  const { styleAttr, classAttr } = hostBindingsMetadata.specialAttributes;
@@ -23601,7 +24096,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
23601
24096
  const syntheticHostBindings = [];
23602
24097
  for (const binding of allOtherBindings) {
23603
24098
  const value = binding.expression.visit(getValueConverter());
23604
- const bindingExpr = bindingFn(bindingContext, value);
24099
+ const bindingExpr = bindingFn(bindingContext, value, getNextBindingId);
23605
24100
  const { bindingName, instruction, isAttribute } = getBindingNameAndInstruction(binding);
23606
24101
  const securityContexts = bindingParser.calcPossibleSecurityContexts(selector, bindingName, isAttribute).filter((context) => context !== SecurityContext.NONE);
23607
24102
  let sanitizerFn = null;
@@ -23646,9 +24141,11 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
23646
24141
  styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach((instruction) => {
23647
24142
  for (const call2 of instruction.calls) {
23648
24143
  totalHostVarsCount += Math.max(call2.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
24144
+ const { params, stmts } = convertStylingCall(call2, bindingContext, bindingFn, getNextBindingId);
24145
+ updateVariables.push(...stmts);
23649
24146
  updateInstructions.push({
23650
24147
  reference: instruction.reference,
23651
- paramsOrFn: convertStylingCall(call2, bindingContext, bindingFn),
24148
+ paramsOrFn: params,
23652
24149
  span: null
23653
24150
  });
23654
24151
  }
@@ -23670,11 +24167,19 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
23670
24167
  }
23671
24168
  return null;
23672
24169
  }
23673
- function bindingFn(implicit, value) {
23674
- return convertPropertyBinding(null, implicit, value, "b");
24170
+ function bindingFn(implicit, value, getNextBindingIdFn) {
24171
+ return convertPropertyBinding(null, implicit, value, getNextBindingIdFn());
23675
24172
  }
23676
- function convertStylingCall(call2, bindingContext, bindingFn2) {
23677
- return call2.params((value) => bindingFn2(bindingContext, value).currValExpr);
24173
+ function convertStylingCall(call2, bindingContext, bindingFn2, getNextBindingIdFn) {
24174
+ const stmts = [];
24175
+ const params = call2.params((value) => {
24176
+ const result = bindingFn2(bindingContext, value, getNextBindingIdFn);
24177
+ if (Array.isArray(result.stmts) && result.stmts.length > 0) {
24178
+ stmts.push(...result.stmts);
24179
+ }
24180
+ return result.currValExpr;
24181
+ });
24182
+ return { params, stmts };
23678
24183
  }
23679
24184
  function getBindingNameAndInstruction(binding) {
23680
24185
  let bindingName = binding.name;
@@ -24646,6 +25151,7 @@ function convertDirectiveFacadeToMetadata(facade) {
24646
25151
  bindingPropertyName: ann.alias || field,
24647
25152
  classPropertyName: field,
24648
25153
  required: ann.required || false,
25154
+ isSignal: false,
24649
25155
  transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null
24650
25156
  };
24651
25157
  } else if (isOutput(ann)) {
@@ -24676,7 +25182,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
24676
25182
  type: wrapReference(declaration.type),
24677
25183
  typeSourceSpan,
24678
25184
  selector: (_a2 = declaration.selector) != null ? _a2 : null,
24679
- inputs: declaration.inputs ? inputsMappingToInputMetadata(declaration.inputs) : {},
25185
+ inputs: declaration.inputs ? inputsPartialMetadataToInputMetadata(declaration.inputs) : {},
24680
25186
  outputs: (_b2 = declaration.outputs) != null ? _b2 : {},
24681
25187
  host: convertHostDeclarationToMetadata(declaration.host),
24682
25188
  queries: ((_c2 = declaration.queries) != null ? _c2 : []).map(convertQueryDeclarationToMetadata),
@@ -24904,27 +25410,41 @@ function isInput(value) {
24904
25410
  function isOutput(value) {
24905
25411
  return value.ngMetadataName === "Output";
24906
25412
  }
24907
- function inputsMappingToInputMetadata(inputs) {
24908
- return Object.keys(inputs).reduce((result, key) => {
24909
- const value = inputs[key];
24910
- if (typeof value === "string") {
24911
- result[key] = {
24912
- bindingPropertyName: value,
24913
- classPropertyName: value,
24914
- transformFunction: null,
24915
- required: false
24916
- };
25413
+ function inputsPartialMetadataToInputMetadata(inputs) {
25414
+ return Object.keys(inputs).reduce((result, minifiedClassName) => {
25415
+ const value = inputs[minifiedClassName];
25416
+ if (typeof value === "string" || Array.isArray(value)) {
25417
+ result[minifiedClassName] = parseLegacyInputPartialOutput(value);
24917
25418
  } else {
24918
- result[key] = {
24919
- bindingPropertyName: value[0],
24920
- classPropertyName: value[1],
24921
- transformFunction: value[2] ? new WrappedNodeExpr(value[2]) : null,
24922
- required: false
25419
+ result[minifiedClassName] = {
25420
+ bindingPropertyName: value.publicName,
25421
+ classPropertyName: minifiedClassName,
25422
+ transformFunction: value.transformFunction !== null ? new WrappedNodeExpr(value.transformFunction) : null,
25423
+ required: value.isRequired,
25424
+ isSignal: value.isSignal
24923
25425
  };
24924
25426
  }
24925
25427
  return result;
24926
25428
  }, {});
24927
25429
  }
25430
+ function parseLegacyInputPartialOutput(value) {
25431
+ if (typeof value === "string") {
25432
+ return {
25433
+ bindingPropertyName: value,
25434
+ classPropertyName: value,
25435
+ transformFunction: null,
25436
+ required: false,
25437
+ isSignal: false
25438
+ };
25439
+ }
25440
+ return {
25441
+ bindingPropertyName: value[0],
25442
+ classPropertyName: value[1],
25443
+ transformFunction: value[2] ? new WrappedNodeExpr(value[2]) : null,
25444
+ required: false,
25445
+ isSignal: false
25446
+ };
25447
+ }
24928
25448
  function parseInputsArray(values) {
24929
25449
  return values.reduce((results, value) => {
24930
25450
  if (typeof value === "string") {
@@ -24933,6 +25453,7 @@ function parseInputsArray(values) {
24933
25453
  bindingPropertyName,
24934
25454
  classPropertyName,
24935
25455
  required: false,
25456
+ isSignal: false,
24936
25457
  transformFunction: null
24937
25458
  };
24938
25459
  } else {
@@ -24940,6 +25461,7 @@ function parseInputsArray(values) {
24940
25461
  bindingPropertyName: value.alias || value.name,
24941
25462
  classPropertyName: value.name,
24942
25463
  required: value.required || false,
25464
+ isSignal: false,
24943
25465
  transformFunction: value.transform != null ? new WrappedNodeExpr(value.transform) : null
24944
25466
  };
24945
25467
  }
@@ -24983,7 +25505,7 @@ function publishFacade(global) {
24983
25505
  }
24984
25506
 
24985
25507
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
24986
- var VERSION2 = new Version("17.1.0-next.2");
25508
+ var VERSION2 = new Version("17.1.0-next.4");
24987
25509
 
24988
25510
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
24989
25511
  var _VisitorMode;