@angular/material 17.0.0-rc.2 → 17.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/button/_icon-button-theme.scss +0 -1
  2. package/core/_core-theme.scss +4 -4
  3. package/core/ripple/_ripple-theme.scss +27 -17
  4. package/core/ripple/_ripple.scss +8 -0
  5. package/core/tokens/m2/mat/_ripple.scss +49 -0
  6. package/esm2022/autocomplete/autocomplete-origin.mjs +3 -3
  7. package/esm2022/autocomplete/autocomplete-trigger.mjs +3 -3
  8. package/esm2022/autocomplete/autocomplete.mjs +3 -3
  9. package/esm2022/autocomplete/module.mjs +4 -4
  10. package/esm2022/badge/badge-module.mjs +4 -4
  11. package/esm2022/badge/badge.mjs +3 -3
  12. package/esm2022/bottom-sheet/bottom-sheet-container.mjs +3 -3
  13. package/esm2022/bottom-sheet/bottom-sheet-module.mjs +4 -4
  14. package/esm2022/bottom-sheet/bottom-sheet.mjs +3 -3
  15. package/esm2022/button/button-base.mjs +6 -6
  16. package/esm2022/button/button.mjs +6 -6
  17. package/esm2022/button/fab.mjs +12 -12
  18. package/esm2022/button/icon-button.mjs +6 -6
  19. package/esm2022/button/module.mjs +4 -4
  20. package/esm2022/button-toggle/button-toggle-module.mjs +4 -4
  21. package/esm2022/button-toggle/button-toggle.mjs +6 -6
  22. package/esm2022/card/card.mjs +42 -42
  23. package/esm2022/card/module.mjs +4 -4
  24. package/esm2022/checkbox/checkbox-required-validator.mjs +3 -3
  25. package/esm2022/checkbox/checkbox.mjs +3 -3
  26. package/esm2022/checkbox/module.mjs +8 -8
  27. package/esm2022/chips/chip-action.mjs +3 -3
  28. package/esm2022/chips/chip-edit-input.mjs +3 -3
  29. package/esm2022/chips/chip-grid.mjs +3 -3
  30. package/esm2022/chips/chip-icons.mjs +9 -9
  31. package/esm2022/chips/chip-input.mjs +3 -3
  32. package/esm2022/chips/chip-listbox.mjs +3 -3
  33. package/esm2022/chips/chip-option.mjs +3 -3
  34. package/esm2022/chips/chip-row.mjs +3 -3
  35. package/esm2022/chips/chip-set.mjs +3 -3
  36. package/esm2022/chips/chip.mjs +3 -3
  37. package/esm2022/chips/module.mjs +4 -4
  38. package/esm2022/core/common-behaviors/common-module.mjs +4 -4
  39. package/esm2022/core/datetime/index.mjs +8 -8
  40. package/esm2022/core/datetime/native-date-adapter.mjs +3 -3
  41. package/esm2022/core/error/error-options.mjs +6 -6
  42. package/esm2022/core/line/line.mjs +7 -7
  43. package/esm2022/core/option/index.mjs +4 -4
  44. package/esm2022/core/option/optgroup.mjs +3 -3
  45. package/esm2022/core/option/option.mjs +3 -3
  46. package/esm2022/core/private/ripple-loader.mjs +3 -3
  47. package/esm2022/core/ripple/index.mjs +4 -4
  48. package/esm2022/core/ripple/ripple.mjs +3 -3
  49. package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox-module.mjs +4 -4
  50. package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +3 -3
  51. package/esm2022/core/version.mjs +1 -1
  52. package/esm2022/datepicker/calendar-body.mjs +3 -3
  53. package/esm2022/datepicker/calendar.mjs +6 -6
  54. package/esm2022/datepicker/date-range-input-parts.mjs +9 -9
  55. package/esm2022/datepicker/date-range-input.mjs +3 -3
  56. package/esm2022/datepicker/date-range-picker.mjs +3 -3
  57. package/esm2022/datepicker/date-range-selection-strategy.mjs +3 -3
  58. package/esm2022/datepicker/date-selection-model.mjs +9 -9
  59. package/esm2022/datepicker/datepicker-actions.mjs +9 -9
  60. package/esm2022/datepicker/datepicker-base.mjs +6 -6
  61. package/esm2022/datepicker/datepicker-input-base.mjs +3 -3
  62. package/esm2022/datepicker/datepicker-input.mjs +3 -3
  63. package/esm2022/datepicker/datepicker-intl.mjs +3 -3
  64. package/esm2022/datepicker/datepicker-module.mjs +4 -4
  65. package/esm2022/datepicker/datepicker-toggle.mjs +6 -6
  66. package/esm2022/datepicker/datepicker.mjs +3 -3
  67. package/esm2022/datepicker/month-view.mjs +3 -3
  68. package/esm2022/datepicker/multi-year-view.mjs +3 -3
  69. package/esm2022/datepicker/year-view.mjs +3 -3
  70. package/esm2022/dialog/dialog-container.mjs +3 -3
  71. package/esm2022/dialog/dialog-content-directives.mjs +12 -12
  72. package/esm2022/dialog/dialog.mjs +3 -3
  73. package/esm2022/dialog/module.mjs +4 -4
  74. package/esm2022/divider/divider-module.mjs +4 -4
  75. package/esm2022/divider/divider.mjs +3 -3
  76. package/esm2022/expansion/accordion.mjs +3 -3
  77. package/esm2022/expansion/expansion-module.mjs +4 -4
  78. package/esm2022/expansion/expansion-panel-content.mjs +3 -3
  79. package/esm2022/expansion/expansion-panel-header.mjs +9 -9
  80. package/esm2022/expansion/expansion-panel.mjs +6 -6
  81. package/esm2022/form-field/directives/error.mjs +3 -3
  82. package/esm2022/form-field/directives/floating-label.mjs +3 -3
  83. package/esm2022/form-field/directives/hint.mjs +3 -3
  84. package/esm2022/form-field/directives/label.mjs +3 -3
  85. package/esm2022/form-field/directives/line-ripple.mjs +3 -3
  86. package/esm2022/form-field/directives/notched-outline.mjs +3 -3
  87. package/esm2022/form-field/directives/prefix.mjs +3 -3
  88. package/esm2022/form-field/directives/suffix.mjs +3 -3
  89. package/esm2022/form-field/form-field-control.mjs +3 -3
  90. package/esm2022/form-field/form-field.mjs +3 -3
  91. package/esm2022/form-field/module.mjs +4 -4
  92. package/esm2022/grid-list/grid-list-module.mjs +4 -4
  93. package/esm2022/grid-list/grid-list.mjs +3 -3
  94. package/esm2022/grid-list/grid-tile.mjs +15 -15
  95. package/esm2022/icon/icon-module.mjs +4 -4
  96. package/esm2022/icon/icon-registry.mjs +3 -3
  97. package/esm2022/icon/icon.mjs +3 -3
  98. package/esm2022/icon/testing/fake-icon-registry.mjs +7 -7
  99. package/esm2022/input/input.mjs +3 -3
  100. package/esm2022/input/module.mjs +4 -4
  101. package/esm2022/list/action-list.mjs +3 -3
  102. package/esm2022/list/list-base.mjs +6 -6
  103. package/esm2022/list/list-item-sections.mjs +18 -18
  104. package/esm2022/list/list-module.mjs +4 -4
  105. package/esm2022/list/list-option.mjs +3 -3
  106. package/esm2022/list/list.mjs +6 -6
  107. package/esm2022/list/nav-list.mjs +3 -3
  108. package/esm2022/list/selection-list.mjs +3 -3
  109. package/esm2022/list/subheader.mjs +3 -3
  110. package/esm2022/menu/menu-content.mjs +3 -3
  111. package/esm2022/menu/menu-item.mjs +3 -3
  112. package/esm2022/menu/menu-trigger.mjs +3 -3
  113. package/esm2022/menu/menu.mjs +3 -3
  114. package/esm2022/menu/module.mjs +4 -4
  115. package/esm2022/paginator/module.mjs +4 -4
  116. package/esm2022/paginator/paginator-intl.mjs +3 -3
  117. package/esm2022/paginator/paginator.mjs +3 -3
  118. package/esm2022/progress-bar/module.mjs +4 -4
  119. package/esm2022/progress-bar/progress-bar.mjs +3 -3
  120. package/esm2022/progress-spinner/module.mjs +4 -4
  121. package/esm2022/progress-spinner/progress-spinner.mjs +3 -3
  122. package/esm2022/radio/module.mjs +4 -4
  123. package/esm2022/radio/radio.mjs +6 -6
  124. package/esm2022/select/module.mjs +4 -4
  125. package/esm2022/select/select.mjs +6 -6
  126. package/esm2022/sidenav/drawer.mjs +9 -9
  127. package/esm2022/sidenav/sidenav-module.mjs +4 -4
  128. package/esm2022/sidenav/sidenav.mjs +9 -9
  129. package/esm2022/slide-toggle/module.mjs +8 -8
  130. package/esm2022/slide-toggle/slide-toggle-required-validator.mjs +3 -3
  131. package/esm2022/slide-toggle/slide-toggle.mjs +3 -3
  132. package/esm2022/slider/module.mjs +4 -4
  133. package/esm2022/slider/slider-input.mjs +6 -6
  134. package/esm2022/slider/slider-thumb.mjs +3 -3
  135. package/esm2022/slider/slider.mjs +3 -3
  136. package/esm2022/snack-bar/module.mjs +4 -4
  137. package/esm2022/snack-bar/simple-snack-bar.mjs +3 -3
  138. package/esm2022/snack-bar/snack-bar-container.mjs +3 -3
  139. package/esm2022/snack-bar/snack-bar-content.mjs +9 -9
  140. package/esm2022/snack-bar/snack-bar.mjs +3 -3
  141. package/esm2022/sort/sort-header-intl.mjs +3 -3
  142. package/esm2022/sort/sort-header.mjs +3 -3
  143. package/esm2022/sort/sort-module.mjs +4 -4
  144. package/esm2022/sort/sort.mjs +3 -3
  145. package/esm2022/stepper/step-content.mjs +3 -3
  146. package/esm2022/stepper/step-header.mjs +3 -3
  147. package/esm2022/stepper/step-label.mjs +3 -3
  148. package/esm2022/stepper/stepper-button.mjs +6 -6
  149. package/esm2022/stepper/stepper-icon.mjs +3 -3
  150. package/esm2022/stepper/stepper-intl.mjs +3 -3
  151. package/esm2022/stepper/stepper-module.mjs +4 -4
  152. package/esm2022/stepper/stepper.mjs +6 -6
  153. package/esm2022/table/cell.mjs +21 -21
  154. package/esm2022/table/module.mjs +4 -4
  155. package/esm2022/table/row.mjs +21 -21
  156. package/esm2022/table/table.mjs +6 -6
  157. package/esm2022/table/text-column.mjs +3 -3
  158. package/esm2022/tabs/module.mjs +4 -4
  159. package/esm2022/tabs/paginated-tab-header.mjs +3 -3
  160. package/esm2022/tabs/tab-body.mjs +6 -6
  161. package/esm2022/tabs/tab-content.mjs +3 -3
  162. package/esm2022/tabs/tab-group.mjs +3 -3
  163. package/esm2022/tabs/tab-header.mjs +3 -3
  164. package/esm2022/tabs/tab-label-wrapper.mjs +3 -3
  165. package/esm2022/tabs/tab-label.mjs +3 -3
  166. package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +9 -9
  167. package/esm2022/tabs/tab.mjs +3 -3
  168. package/esm2022/toolbar/toolbar-module.mjs +4 -4
  169. package/esm2022/toolbar/toolbar.mjs +6 -6
  170. package/esm2022/tooltip/module.mjs +4 -4
  171. package/esm2022/tooltip/tooltip.mjs +6 -6
  172. package/esm2022/tree/node.mjs +9 -9
  173. package/esm2022/tree/outlet.mjs +3 -3
  174. package/esm2022/tree/padding.mjs +3 -3
  175. package/esm2022/tree/toggle.mjs +3 -3
  176. package/esm2022/tree/tree-module.mjs +4 -4
  177. package/esm2022/tree/tree.mjs +3 -3
  178. package/fesm2022/autocomplete.mjs +13 -13
  179. package/fesm2022/badge.mjs +7 -7
  180. package/fesm2022/bottom-sheet.mjs +10 -10
  181. package/fesm2022/button-toggle.mjs +10 -10
  182. package/fesm2022/button.mjs +34 -34
  183. package/fesm2022/card.mjs +46 -46
  184. package/fesm2022/checkbox.mjs +14 -14
  185. package/fesm2022/chips.mjs +40 -40
  186. package/fesm2022/core.mjs +56 -56
  187. package/fesm2022/core.mjs.map +1 -1
  188. package/fesm2022/datepicker.mjs +82 -82
  189. package/fesm2022/dialog.mjs +22 -22
  190. package/fesm2022/divider.mjs +7 -7
  191. package/fesm2022/expansion.mjs +25 -25
  192. package/fesm2022/form-field.mjs +34 -34
  193. package/fesm2022/grid-list.mjs +22 -22
  194. package/fesm2022/icon/testing.mjs +7 -7
  195. package/fesm2022/icon.mjs +10 -10
  196. package/fesm2022/input.mjs +7 -7
  197. package/fesm2022/list.mjs +49 -49
  198. package/fesm2022/menu.mjs +16 -16
  199. package/fesm2022/paginator.mjs +10 -10
  200. package/fesm2022/progress-bar.mjs +7 -7
  201. package/fesm2022/progress-spinner.mjs +7 -7
  202. package/fesm2022/radio.mjs +10 -10
  203. package/fesm2022/select.mjs +10 -10
  204. package/fesm2022/sidenav.mjs +22 -22
  205. package/fesm2022/slide-toggle.mjs +14 -14
  206. package/fesm2022/slider.mjs +16 -16
  207. package/fesm2022/snack-bar.mjs +22 -22
  208. package/fesm2022/sort.mjs +13 -13
  209. package/fesm2022/stepper.mjs +31 -31
  210. package/fesm2022/table.mjs +55 -55
  211. package/fesm2022/tabs.mjs +40 -40
  212. package/fesm2022/toolbar.mjs +10 -10
  213. package/fesm2022/tooltip.mjs +10 -10
  214. package/fesm2022/tree.mjs +25 -25
  215. package/package.json +2 -2
  216. package/prebuilt-themes/deeppurple-amber.css +1 -1
  217. package/prebuilt-themes/indigo-pink.css +1 -1
  218. package/prebuilt-themes/pink-bluegrey.css +1 -1
  219. package/prebuilt-themes/purple-green.css +1 -1
  220. package/schematics/ng-add/index.js +1 -1
  221. package/schematics/ng-add/index.mjs +1 -1
  222. package/schematics/ng-generate/mdc-migration/index_bundled.js +1620 -892
  223. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +4 -4
  224. package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +4 -1
@@ -9955,16 +9955,19 @@ var Element$1 = class {
9955
9955
  }
9956
9956
  };
9957
9957
  var DeferredTrigger = class {
9958
- constructor(sourceSpan) {
9958
+ constructor(nameSpan, sourceSpan, prefetchSpan, whenOrOnSourceSpan) {
9959
+ this.nameSpan = nameSpan;
9959
9960
  this.sourceSpan = sourceSpan;
9961
+ this.prefetchSpan = prefetchSpan;
9962
+ this.whenOrOnSourceSpan = whenOrOnSourceSpan;
9960
9963
  }
9961
9964
  visit(visitor) {
9962
9965
  return visitor.visitDeferredTrigger(this);
9963
9966
  }
9964
9967
  };
9965
9968
  var BoundDeferredTrigger = class extends DeferredTrigger {
9966
- constructor(value, sourceSpan) {
9967
- super(sourceSpan);
9969
+ constructor(value, sourceSpan, prefetchSpan, whenSourceSpan) {
9970
+ super(null, sourceSpan, prefetchSpan, whenSourceSpan);
9968
9971
  this.value = value;
9969
9972
  }
9970
9973
  };
@@ -9973,75 +9976,75 @@ var IdleDeferredTrigger = class extends DeferredTrigger {
9973
9976
  var ImmediateDeferredTrigger = class extends DeferredTrigger {
9974
9977
  };
9975
9978
  var HoverDeferredTrigger = class extends DeferredTrigger {
9976
- constructor(reference2, sourceSpan) {
9977
- super(sourceSpan);
9979
+ constructor(reference2, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
9980
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
9978
9981
  this.reference = reference2;
9979
9982
  }
9980
9983
  };
9981
9984
  var TimerDeferredTrigger = class extends DeferredTrigger {
9982
- constructor(delay, sourceSpan) {
9983
- super(sourceSpan);
9985
+ constructor(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
9986
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
9984
9987
  this.delay = delay;
9985
9988
  }
9986
9989
  };
9987
9990
  var InteractionDeferredTrigger = class extends DeferredTrigger {
9988
- constructor(reference2, sourceSpan) {
9989
- super(sourceSpan);
9991
+ constructor(reference2, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
9992
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
9990
9993
  this.reference = reference2;
9991
9994
  }
9992
9995
  };
9993
9996
  var ViewportDeferredTrigger = class extends DeferredTrigger {
9994
- constructor(reference2, sourceSpan) {
9995
- super(sourceSpan);
9997
+ constructor(reference2, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
9998
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
9996
9999
  this.reference = reference2;
9997
10000
  }
9998
10001
  };
9999
- var DeferredBlockPlaceholder = class {
10000
- constructor(children, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
10001
- this.children = children;
10002
- this.minimumTime = minimumTime;
10002
+ var BlockNode = class {
10003
+ constructor(nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
10004
+ this.nameSpan = nameSpan;
10003
10005
  this.sourceSpan = sourceSpan;
10004
10006
  this.startSourceSpan = startSourceSpan;
10005
10007
  this.endSourceSpan = endSourceSpan;
10006
10008
  }
10009
+ };
10010
+ var DeferredBlockPlaceholder = class extends BlockNode {
10011
+ constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
10012
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10013
+ this.children = children;
10014
+ this.minimumTime = minimumTime;
10015
+ }
10007
10016
  visit(visitor) {
10008
10017
  return visitor.visitDeferredBlockPlaceholder(this);
10009
10018
  }
10010
10019
  };
10011
- var DeferredBlockLoading = class {
10012
- constructor(children, afterTime, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
10020
+ var DeferredBlockLoading = class extends BlockNode {
10021
+ constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
10022
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10013
10023
  this.children = children;
10014
10024
  this.afterTime = afterTime;
10015
10025
  this.minimumTime = minimumTime;
10016
- this.sourceSpan = sourceSpan;
10017
- this.startSourceSpan = startSourceSpan;
10018
- this.endSourceSpan = endSourceSpan;
10019
10026
  }
10020
10027
  visit(visitor) {
10021
10028
  return visitor.visitDeferredBlockLoading(this);
10022
10029
  }
10023
10030
  };
10024
- var DeferredBlockError = class {
10025
- constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
10031
+ var DeferredBlockError = class extends BlockNode {
10032
+ constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
10033
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10026
10034
  this.children = children;
10027
- this.sourceSpan = sourceSpan;
10028
- this.startSourceSpan = startSourceSpan;
10029
- this.endSourceSpan = endSourceSpan;
10030
10035
  }
10031
10036
  visit(visitor) {
10032
10037
  return visitor.visitDeferredBlockError(this);
10033
10038
  }
10034
10039
  };
10035
- var DeferredBlock = class {
10036
- constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
10040
+ var DeferredBlock = class extends BlockNode {
10041
+ constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
10042
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10037
10043
  this.children = children;
10038
10044
  this.placeholder = placeholder;
10039
10045
  this.loading = loading;
10040
10046
  this.error = error2;
10041
- this.sourceSpan = sourceSpan;
10042
10047
  this.mainBlockSpan = mainBlockSpan;
10043
- this.startSourceSpan = startSourceSpan;
10044
- this.endSourceSpan = endSourceSpan;
10045
10048
  this.triggers = triggers;
10046
10049
  this.prefetchTriggers = prefetchTriggers;
10047
10050
  this.definedTriggers = Object.keys(triggers);
@@ -10061,87 +10064,77 @@ var DeferredBlock = class {
10061
10064
  visitAll$1(visitor, keys.map((k) => triggers[k]));
10062
10065
  }
10063
10066
  };
10064
- var SwitchBlock = class {
10065
- constructor(expression, cases, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan) {
10067
+ var SwitchBlock = class extends BlockNode {
10068
+ constructor(expression, cases, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
10069
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10066
10070
  this.expression = expression;
10067
10071
  this.cases = cases;
10068
10072
  this.unknownBlocks = unknownBlocks;
10069
- this.sourceSpan = sourceSpan;
10070
- this.startSourceSpan = startSourceSpan;
10071
- this.endSourceSpan = endSourceSpan;
10072
10073
  }
10073
10074
  visit(visitor) {
10074
10075
  return visitor.visitSwitchBlock(this);
10075
10076
  }
10076
10077
  };
10077
- var SwitchBlockCase = class {
10078
- constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan) {
10078
+ var SwitchBlockCase = class extends BlockNode {
10079
+ constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
10080
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10079
10081
  this.expression = expression;
10080
10082
  this.children = children;
10081
- this.sourceSpan = sourceSpan;
10082
- this.startSourceSpan = startSourceSpan;
10083
- this.endSourceSpan = endSourceSpan;
10084
10083
  }
10085
10084
  visit(visitor) {
10086
10085
  return visitor.visitSwitchBlockCase(this);
10087
10086
  }
10088
10087
  };
10089
- var ForLoopBlock = class {
10090
- constructor(item, expression, trackBy, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
10088
+ var ForLoopBlock = class extends BlockNode {
10089
+ constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan) {
10090
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10091
10091
  this.item = item;
10092
10092
  this.expression = expression;
10093
10093
  this.trackBy = trackBy;
10094
+ this.trackKeywordSpan = trackKeywordSpan;
10094
10095
  this.contextVariables = contextVariables;
10095
10096
  this.children = children;
10096
10097
  this.empty = empty;
10097
- this.sourceSpan = sourceSpan;
10098
10098
  this.mainBlockSpan = mainBlockSpan;
10099
- this.startSourceSpan = startSourceSpan;
10100
- this.endSourceSpan = endSourceSpan;
10101
10099
  }
10102
10100
  visit(visitor) {
10103
10101
  return visitor.visitForLoopBlock(this);
10104
10102
  }
10105
10103
  };
10106
- var ForLoopBlockEmpty = class {
10107
- constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
10104
+ var ForLoopBlockEmpty = class extends BlockNode {
10105
+ constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
10106
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10108
10107
  this.children = children;
10109
- this.sourceSpan = sourceSpan;
10110
- this.startSourceSpan = startSourceSpan;
10111
- this.endSourceSpan = endSourceSpan;
10112
10108
  }
10113
10109
  visit(visitor) {
10114
10110
  return visitor.visitForLoopBlockEmpty(this);
10115
10111
  }
10116
10112
  };
10117
- var IfBlock = class {
10118
- constructor(branches, sourceSpan, startSourceSpan, endSourceSpan) {
10113
+ var IfBlock = class extends BlockNode {
10114
+ constructor(branches, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
10115
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10119
10116
  this.branches = branches;
10120
- this.sourceSpan = sourceSpan;
10121
- this.startSourceSpan = startSourceSpan;
10122
- this.endSourceSpan = endSourceSpan;
10123
10117
  }
10124
10118
  visit(visitor) {
10125
10119
  return visitor.visitIfBlock(this);
10126
10120
  }
10127
10121
  };
10128
- var IfBlockBranch = class {
10129
- constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan) {
10122
+ var IfBlockBranch = class extends BlockNode {
10123
+ constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
10124
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
10130
10125
  this.expression = expression;
10131
10126
  this.children = children;
10132
10127
  this.expressionAlias = expressionAlias;
10133
- this.sourceSpan = sourceSpan;
10134
- this.startSourceSpan = startSourceSpan;
10135
- this.endSourceSpan = endSourceSpan;
10136
10128
  }
10137
10129
  visit(visitor) {
10138
10130
  return visitor.visitIfBlockBranch(this);
10139
10131
  }
10140
10132
  };
10141
10133
  var UnknownBlock = class {
10142
- constructor(name, sourceSpan) {
10134
+ constructor(name, sourceSpan, nameSpan) {
10143
10135
  this.name = name;
10144
10136
  this.sourceSpan = sourceSpan;
10137
+ this.nameSpan = nameSpan;
10145
10138
  }
10146
10139
  visit(visitor) {
10147
10140
  return visitor.visitUnknownBlock(this);
@@ -13304,51 +13297,61 @@ var OpKind;
13304
13297
  OpKind2[OpKind2["Attribute"] = 24] = "Attribute";
13305
13298
  OpKind2[OpKind2["ExtractedAttribute"] = 25] = "ExtractedAttribute";
13306
13299
  OpKind2[OpKind2["Defer"] = 26] = "Defer";
13307
- OpKind2[OpKind2["DeferSecondaryBlock"] = 27] = "DeferSecondaryBlock";
13308
- OpKind2[OpKind2["DeferOn"] = 28] = "DeferOn";
13309
- OpKind2[OpKind2["ExtractedMessage"] = 29] = "ExtractedMessage";
13310
- OpKind2[OpKind2["HostProperty"] = 30] = "HostProperty";
13311
- OpKind2[OpKind2["Namespace"] = 31] = "Namespace";
13312
- OpKind2[OpKind2["ProjectionDef"] = 32] = "ProjectionDef";
13313
- OpKind2[OpKind2["Projection"] = 33] = "Projection";
13314
- OpKind2[OpKind2["I18nStart"] = 34] = "I18nStart";
13315
- OpKind2[OpKind2["I18n"] = 35] = "I18n";
13316
- OpKind2[OpKind2["I18nEnd"] = 36] = "I18nEnd";
13317
- OpKind2[OpKind2["I18nExpression"] = 37] = "I18nExpression";
13318
- OpKind2[OpKind2["I18nApply"] = 38] = "I18nApply";
13319
- OpKind2[OpKind2["Icu"] = 39] = "Icu";
13320
- OpKind2[OpKind2["IcuUpdate"] = 40] = "IcuUpdate";
13300
+ OpKind2[OpKind2["DeferOn"] = 27] = "DeferOn";
13301
+ OpKind2[OpKind2["ExtractedMessage"] = 28] = "ExtractedMessage";
13302
+ OpKind2[OpKind2["HostProperty"] = 29] = "HostProperty";
13303
+ OpKind2[OpKind2["Namespace"] = 30] = "Namespace";
13304
+ OpKind2[OpKind2["ProjectionDef"] = 31] = "ProjectionDef";
13305
+ OpKind2[OpKind2["Projection"] = 32] = "Projection";
13306
+ OpKind2[OpKind2["RepeaterCreate"] = 33] = "RepeaterCreate";
13307
+ OpKind2[OpKind2["Repeater"] = 34] = "Repeater";
13308
+ OpKind2[OpKind2["I18nStart"] = 35] = "I18nStart";
13309
+ OpKind2[OpKind2["I18n"] = 36] = "I18n";
13310
+ OpKind2[OpKind2["I18nEnd"] = 37] = "I18nEnd";
13311
+ OpKind2[OpKind2["I18nExpression"] = 38] = "I18nExpression";
13312
+ OpKind2[OpKind2["I18nApply"] = 39] = "I18nApply";
13313
+ OpKind2[OpKind2["Icu"] = 40] = "Icu";
13314
+ OpKind2[OpKind2["IcuUpdate"] = 41] = "IcuUpdate";
13321
13315
  })(OpKind || (OpKind = {}));
13322
13316
  var ExpressionKind;
13323
13317
  (function(ExpressionKind2) {
13324
13318
  ExpressionKind2[ExpressionKind2["LexicalRead"] = 0] = "LexicalRead";
13325
13319
  ExpressionKind2[ExpressionKind2["Context"] = 1] = "Context";
13326
- ExpressionKind2[ExpressionKind2["ReadVariable"] = 2] = "ReadVariable";
13327
- ExpressionKind2[ExpressionKind2["NextContext"] = 3] = "NextContext";
13328
- ExpressionKind2[ExpressionKind2["Reference"] = 4] = "Reference";
13329
- ExpressionKind2[ExpressionKind2["GetCurrentView"] = 5] = "GetCurrentView";
13330
- ExpressionKind2[ExpressionKind2["RestoreView"] = 6] = "RestoreView";
13331
- ExpressionKind2[ExpressionKind2["ResetView"] = 7] = "ResetView";
13332
- ExpressionKind2[ExpressionKind2["PureFunctionExpr"] = 8] = "PureFunctionExpr";
13333
- ExpressionKind2[ExpressionKind2["PureFunctionParameterExpr"] = 9] = "PureFunctionParameterExpr";
13334
- ExpressionKind2[ExpressionKind2["PipeBinding"] = 10] = "PipeBinding";
13335
- ExpressionKind2[ExpressionKind2["PipeBindingVariadic"] = 11] = "PipeBindingVariadic";
13336
- ExpressionKind2[ExpressionKind2["SafePropertyRead"] = 12] = "SafePropertyRead";
13337
- ExpressionKind2[ExpressionKind2["SafeKeyedRead"] = 13] = "SafeKeyedRead";
13338
- ExpressionKind2[ExpressionKind2["SafeInvokeFunction"] = 14] = "SafeInvokeFunction";
13339
- ExpressionKind2[ExpressionKind2["SafeTernaryExpr"] = 15] = "SafeTernaryExpr";
13340
- ExpressionKind2[ExpressionKind2["EmptyExpr"] = 16] = "EmptyExpr";
13341
- ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 17] = "AssignTemporaryExpr";
13342
- ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 18] = "ReadTemporaryExpr";
13343
- ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 19] = "SanitizerExpr";
13344
- ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 20] = "SlotLiteralExpr";
13345
- ExpressionKind2[ExpressionKind2["ConditionalCase"] = 21] = "ConditionalCase";
13320
+ ExpressionKind2[ExpressionKind2["TrackContext"] = 2] = "TrackContext";
13321
+ ExpressionKind2[ExpressionKind2["ReadVariable"] = 3] = "ReadVariable";
13322
+ ExpressionKind2[ExpressionKind2["NextContext"] = 4] = "NextContext";
13323
+ ExpressionKind2[ExpressionKind2["Reference"] = 5] = "Reference";
13324
+ ExpressionKind2[ExpressionKind2["GetCurrentView"] = 6] = "GetCurrentView";
13325
+ ExpressionKind2[ExpressionKind2["RestoreView"] = 7] = "RestoreView";
13326
+ ExpressionKind2[ExpressionKind2["ResetView"] = 8] = "ResetView";
13327
+ ExpressionKind2[ExpressionKind2["PureFunctionExpr"] = 9] = "PureFunctionExpr";
13328
+ ExpressionKind2[ExpressionKind2["PureFunctionParameterExpr"] = 10] = "PureFunctionParameterExpr";
13329
+ ExpressionKind2[ExpressionKind2["PipeBinding"] = 11] = "PipeBinding";
13330
+ ExpressionKind2[ExpressionKind2["PipeBindingVariadic"] = 12] = "PipeBindingVariadic";
13331
+ ExpressionKind2[ExpressionKind2["SafePropertyRead"] = 13] = "SafePropertyRead";
13332
+ ExpressionKind2[ExpressionKind2["SafeKeyedRead"] = 14] = "SafeKeyedRead";
13333
+ ExpressionKind2[ExpressionKind2["SafeInvokeFunction"] = 15] = "SafeInvokeFunction";
13334
+ ExpressionKind2[ExpressionKind2["SafeTernaryExpr"] = 16] = "SafeTernaryExpr";
13335
+ ExpressionKind2[ExpressionKind2["EmptyExpr"] = 17] = "EmptyExpr";
13336
+ ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
13337
+ ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
13338
+ ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 20] = "SanitizerExpr";
13339
+ ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 21] = "SlotLiteralExpr";
13340
+ ExpressionKind2[ExpressionKind2["ConditionalCase"] = 22] = "ConditionalCase";
13341
+ ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 23] = "DerivedRepeaterVar";
13342
+ ExpressionKind2[ExpressionKind2["ConstCollected"] = 24] = "ConstCollected";
13346
13343
  })(ExpressionKind || (ExpressionKind = {}));
13344
+ var VariableFlags;
13345
+ (function(VariableFlags2) {
13346
+ VariableFlags2[VariableFlags2["None"] = 0] = "None";
13347
+ VariableFlags2[VariableFlags2["AlwaysInline"] = 1] = "AlwaysInline";
13348
+ })(VariableFlags || (VariableFlags = {}));
13347
13349
  var SemanticVariableKind;
13348
13350
  (function(SemanticVariableKind2) {
13349
13351
  SemanticVariableKind2[SemanticVariableKind2["Context"] = 0] = "Context";
13350
13352
  SemanticVariableKind2[SemanticVariableKind2["Identifier"] = 1] = "Identifier";
13351
13353
  SemanticVariableKind2[SemanticVariableKind2["SavedView"] = 2] = "SavedView";
13354
+ SemanticVariableKind2[SemanticVariableKind2["Alias"] = 3] = "Alias";
13352
13355
  })(SemanticVariableKind || (SemanticVariableKind = {}));
13353
13356
  var CompatibilityMode;
13354
13357
  (function(CompatibilityMode2) {
@@ -13385,21 +13388,44 @@ var I18nParamResolutionTime;
13385
13388
  I18nParamResolutionTime2[I18nParamResolutionTime2["Creation"] = 0] = "Creation";
13386
13389
  I18nParamResolutionTime2[I18nParamResolutionTime2["Postproccessing"] = 1] = "Postproccessing";
13387
13390
  })(I18nParamResolutionTime || (I18nParamResolutionTime = {}));
13391
+ var I18nParamValueFlags;
13392
+ (function(I18nParamValueFlags2) {
13393
+ I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
13394
+ I18nParamValueFlags2[I18nParamValueFlags2["ElementTag"] = 1] = "ElementTag";
13395
+ I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
13396
+ I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
13397
+ I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
13398
+ })(I18nParamValueFlags || (I18nParamValueFlags = {}));
13399
+ var Namespace;
13400
+ (function(Namespace2) {
13401
+ Namespace2[Namespace2["HTML"] = 0] = "HTML";
13402
+ Namespace2[Namespace2["SVG"] = 1] = "SVG";
13403
+ Namespace2[Namespace2["Math"] = 2] = "Math";
13404
+ })(Namespace || (Namespace = {}));
13405
+ var DeferTriggerKind;
13406
+ (function(DeferTriggerKind2) {
13407
+ DeferTriggerKind2[DeferTriggerKind2["Idle"] = 0] = "Idle";
13408
+ DeferTriggerKind2[DeferTriggerKind2["Immediate"] = 1] = "Immediate";
13409
+ DeferTriggerKind2[DeferTriggerKind2["Timer"] = 2] = "Timer";
13410
+ DeferTriggerKind2[DeferTriggerKind2["Hover"] = 3] = "Hover";
13411
+ DeferTriggerKind2[DeferTriggerKind2["Interaction"] = 4] = "Interaction";
13412
+ DeferTriggerKind2[DeferTriggerKind2["Viewport"] = 5] = "Viewport";
13413
+ })(DeferTriggerKind || (DeferTriggerKind = {}));
13414
+ var DerivedRepeaterVarIdentity;
13415
+ (function(DerivedRepeaterVarIdentity2) {
13416
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["First"] = 0] = "First";
13417
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Last"] = 1] = "Last";
13418
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Even"] = 2] = "Even";
13419
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Odd"] = 3] = "Odd";
13420
+ })(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
13388
13421
  var ConsumesSlot = Symbol("ConsumesSlot");
13389
13422
  var DependsOnSlotContext = Symbol("DependsOnSlotContext");
13390
- var UsesSlotIndex = Symbol("UsesSlotIndex");
13391
13423
  var ConsumesVarsTrait = Symbol("ConsumesVars");
13392
13424
  var UsesVarOffset = Symbol("UsesVarOffset");
13393
- var HasConst = Symbol("HasConst");
13394
13425
  var TRAIT_CONSUMES_SLOT = {
13395
13426
  [ConsumesSlot]: true,
13396
- slot: null,
13397
13427
  numSlotsUsed: 1
13398
13428
  };
13399
- var TRAIT_USES_SLOT_INDEX = {
13400
- [UsesSlotIndex]: true,
13401
- targetSlot: null
13402
- };
13403
13429
  var TRAIT_DEPENDS_ON_SLOT_CONTEXT = {
13404
13430
  [DependsOnSlotContext]: true
13405
13431
  };
@@ -13410,10 +13436,6 @@ var TRAIT_USES_VAR_OFFSET = {
13410
13436
  [UsesVarOffset]: true,
13411
13437
  varOffset: null
13412
13438
  };
13413
- var TRAIT_HAS_CONST = {
13414
- [HasConst]: true,
13415
- constIndex: null
13416
- };
13417
13439
  function hasConsumesSlotTrait(op) {
13418
13440
  return op[ConsumesSlot] === true;
13419
13441
  }
@@ -13426,24 +13448,19 @@ function hasConsumesVarsTrait(value) {
13426
13448
  function hasUsesVarOffsetTrait(expr) {
13427
13449
  return expr[UsesVarOffset] === true;
13428
13450
  }
13429
- function hasUsesSlotIndexTrait(value) {
13430
- return value[UsesSlotIndex] === true;
13431
- }
13432
- function hasConstTrait(value) {
13433
- return value[HasConst] === true;
13434
- }
13435
13451
  function createStatementOp(statement) {
13436
13452
  return __spreadValues({
13437
13453
  kind: OpKind.Statement,
13438
13454
  statement
13439
13455
  }, NEW_OP);
13440
13456
  }
13441
- function createVariableOp(xref, variable2, initializer) {
13457
+ function createVariableOp(xref, variable2, initializer, flags) {
13442
13458
  return __spreadValues({
13443
13459
  kind: OpKind.Variable,
13444
13460
  xref,
13445
13461
  variable: variable2,
13446
- initializer
13462
+ initializer,
13463
+ flags
13447
13464
  }, NEW_OP);
13448
13465
  }
13449
13466
  var NEW_OP = {
@@ -13548,21 +13565,32 @@ function createAdvanceOp(delta, sourceSpan) {
13548
13565
  sourceSpan
13549
13566
  }, NEW_OP);
13550
13567
  }
13551
- function createConditionalOp(target, test, conditions, sourceSpan) {
13552
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues({
13568
+ function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
13569
+ return __spreadValues(__spreadValues(__spreadValues({
13553
13570
  kind: OpKind.Conditional,
13554
13571
  target,
13572
+ targetSlot,
13555
13573
  test,
13556
13574
  conditions,
13557
13575
  processed: null,
13558
13576
  sourceSpan,
13559
13577
  contextValue: null
13560
- }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
13578
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
13579
+ }
13580
+ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
13581
+ return __spreadValues({
13582
+ kind: OpKind.Repeater,
13583
+ target: repeaterCreate2,
13584
+ targetSlot,
13585
+ collection,
13586
+ sourceSpan
13587
+ }, NEW_OP);
13561
13588
  }
13562
- function createI18nExpressionOp(owner, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
13589
+ function createI18nExpressionOp(owner, ownerSlot, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
13563
13590
  return __spreadValues(__spreadValues(__spreadValues({
13564
13591
  kind: OpKind.I18nExpression,
13565
13592
  owner,
13593
+ ownerSlot,
13566
13594
  target: owner,
13567
13595
  expression,
13568
13596
  i18nPlaceholder,
@@ -13570,12 +13598,13 @@ function createI18nExpressionOp(owner, expression, i18nPlaceholder, resolutionTi
13570
13598
  sourceSpan
13571
13599
  }, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
13572
13600
  }
13573
- function createI18nApplyOp(target, sourceSpan) {
13574
- return __spreadValues(__spreadValues({
13601
+ function createI18nApplyOp(target, targetSlot, sourceSpan) {
13602
+ return __spreadValues({
13575
13603
  kind: OpKind.I18nApply,
13576
13604
  target,
13605
+ targetSlot,
13577
13606
  sourceSpan
13578
- }, NEW_OP), TRAIT_USES_SLOT_INDEX);
13607
+ }, NEW_OP);
13579
13608
  }
13580
13609
  function createIcuUpdateOp(xref, sourceSpan) {
13581
13610
  return __spreadValues({
@@ -13590,10 +13619,6 @@ var _c;
13590
13619
  var _d;
13591
13620
  var _e;
13592
13621
  var _f;
13593
- var _g;
13594
- var _h;
13595
- var _j;
13596
- var _k;
13597
13622
  function isIrExpression(expr) {
13598
13623
  return expr instanceof ExpressionBase;
13599
13624
  }
@@ -13610,8 +13635,8 @@ var LexicalReadExpr = class extends ExpressionBase {
13610
13635
  }
13611
13636
  visitExpression(visitor, context) {
13612
13637
  }
13613
- isEquivalent() {
13614
- return false;
13638
+ isEquivalent(other) {
13639
+ return this.name === other.name;
13615
13640
  }
13616
13641
  isConstant() {
13617
13642
  return false;
@@ -13622,19 +13647,18 @@ var LexicalReadExpr = class extends ExpressionBase {
13622
13647
  return new LexicalReadExpr(this.name);
13623
13648
  }
13624
13649
  };
13625
- var _ReferenceExpr = class extends ExpressionBase {
13626
- constructor(target, offset) {
13650
+ var ReferenceExpr = class extends ExpressionBase {
13651
+ constructor(target, targetSlot, offset) {
13627
13652
  super();
13628
13653
  this.target = target;
13654
+ this.targetSlot = targetSlot;
13629
13655
  this.offset = offset;
13630
13656
  this.kind = ExpressionKind.Reference;
13631
- this[_a] = true;
13632
- this.targetSlot = null;
13633
13657
  }
13634
13658
  visitExpression() {
13635
13659
  }
13636
13660
  isEquivalent(e) {
13637
- return e instanceof _ReferenceExpr && e.target === this.target;
13661
+ return e instanceof ReferenceExpr && e.target === this.target;
13638
13662
  }
13639
13663
  isConstant() {
13640
13664
  return false;
@@ -13642,15 +13666,9 @@ var _ReferenceExpr = class extends ExpressionBase {
13642
13666
  transformInternalExpressions() {
13643
13667
  }
13644
13668
  clone() {
13645
- const expr = new _ReferenceExpr(this.target, this.offset);
13646
- expr.targetSlot = this.targetSlot;
13647
- return expr;
13669
+ return new ReferenceExpr(this.target, this.targetSlot, this.offset);
13648
13670
  }
13649
13671
  };
13650
- var ReferenceExpr = _ReferenceExpr;
13651
- (() => {
13652
- _a = UsesSlotIndex;
13653
- })();
13654
13672
  var ContextExpr = class extends ExpressionBase {
13655
13673
  constructor(view) {
13656
13674
  super();
@@ -13671,6 +13689,26 @@ var ContextExpr = class extends ExpressionBase {
13671
13689
  return new ContextExpr(this.view);
13672
13690
  }
13673
13691
  };
13692
+ var TrackContextExpr = class extends ExpressionBase {
13693
+ constructor(view) {
13694
+ super();
13695
+ this.view = view;
13696
+ this.kind = ExpressionKind.TrackContext;
13697
+ }
13698
+ visitExpression() {
13699
+ }
13700
+ isEquivalent(e) {
13701
+ return e instanceof TrackContextExpr && e.view === this.view;
13702
+ }
13703
+ isConstant() {
13704
+ return false;
13705
+ }
13706
+ transformInternalExpressions() {
13707
+ }
13708
+ clone() {
13709
+ return new TrackContextExpr(this.view);
13710
+ }
13711
+ };
13674
13712
  var NextContextExpr = class extends ExpressionBase {
13675
13713
  constructor() {
13676
13714
  super();
@@ -13794,8 +13832,8 @@ var _PureFunctionExpr = class extends ExpressionBase {
13794
13832
  constructor(expression, args) {
13795
13833
  super();
13796
13834
  this.kind = ExpressionKind.PureFunctionExpr;
13835
+ this[_a] = true;
13797
13836
  this[_b] = true;
13798
- this[_c] = true;
13799
13837
  this.varOffset = null;
13800
13838
  this.fn = null;
13801
13839
  this.body = expression;
@@ -13837,7 +13875,7 @@ var _PureFunctionExpr = class extends ExpressionBase {
13837
13875
  };
13838
13876
  var PureFunctionExpr = _PureFunctionExpr;
13839
13877
  (() => {
13840
- _b = ConsumesVarsTrait, _c = UsesVarOffset;
13878
+ _a = ConsumesVarsTrait, _b = UsesVarOffset;
13841
13879
  })();
13842
13880
  var PureFunctionParameterExpr = class extends ExpressionBase {
13843
13881
  constructor(index2) {
@@ -13860,16 +13898,15 @@ var PureFunctionParameterExpr = class extends ExpressionBase {
13860
13898
  }
13861
13899
  };
13862
13900
  var _PipeBindingExpr = class extends ExpressionBase {
13863
- constructor(target, name, args) {
13901
+ constructor(target, targetSlot, name, args) {
13864
13902
  super();
13865
13903
  this.target = target;
13904
+ this.targetSlot = targetSlot;
13866
13905
  this.name = name;
13867
13906
  this.args = args;
13868
13907
  this.kind = ExpressionKind.PipeBinding;
13908
+ this[_c] = true;
13869
13909
  this[_d] = true;
13870
- this[_e] = true;
13871
- this[_f] = true;
13872
- this.targetSlot = null;
13873
13910
  this.varOffset = null;
13874
13911
  }
13875
13912
  visitExpression(visitor, context) {
@@ -13889,28 +13926,26 @@ var _PipeBindingExpr = class extends ExpressionBase {
13889
13926
  }
13890
13927
  }
13891
13928
  clone() {
13892
- const r = new _PipeBindingExpr(this.target, this.name, this.args.map((a) => a.clone()));
13893
- r.targetSlot = this.targetSlot;
13929
+ const r = new _PipeBindingExpr(this.target, this.targetSlot, this.name, this.args.map((a) => a.clone()));
13894
13930
  r.varOffset = this.varOffset;
13895
13931
  return r;
13896
13932
  }
13897
13933
  };
13898
13934
  var PipeBindingExpr = _PipeBindingExpr;
13899
13935
  (() => {
13900
- _d = UsesSlotIndex, _e = ConsumesVarsTrait, _f = UsesVarOffset;
13936
+ _c = ConsumesVarsTrait, _d = UsesVarOffset;
13901
13937
  })();
13902
13938
  var _PipeBindingVariadicExpr = class extends ExpressionBase {
13903
- constructor(target, name, args, numArgs) {
13939
+ constructor(target, targetSlot, name, args, numArgs) {
13904
13940
  super();
13905
13941
  this.target = target;
13942
+ this.targetSlot = targetSlot;
13906
13943
  this.name = name;
13907
13944
  this.args = args;
13908
13945
  this.numArgs = numArgs;
13909
13946
  this.kind = ExpressionKind.PipeBindingVariadic;
13910
- this[_g] = true;
13911
- this[_h] = true;
13912
- this[_j] = true;
13913
- this.targetSlot = null;
13947
+ this[_e] = true;
13948
+ this[_f] = true;
13914
13949
  this.varOffset = null;
13915
13950
  }
13916
13951
  visitExpression(visitor, context) {
@@ -13926,15 +13961,14 @@ var _PipeBindingVariadicExpr = class extends ExpressionBase {
13926
13961
  this.args = transformExpressionsInExpression(this.args, transform2, flags);
13927
13962
  }
13928
13963
  clone() {
13929
- const r = new _PipeBindingVariadicExpr(this.target, this.name, this.args.clone(), this.numArgs);
13930
- r.targetSlot = this.targetSlot;
13964
+ const r = new _PipeBindingVariadicExpr(this.target, this.targetSlot, this.name, this.args.clone(), this.numArgs);
13931
13965
  r.varOffset = this.varOffset;
13932
13966
  return r;
13933
13967
  }
13934
13968
  };
13935
13969
  var PipeBindingVariadicExpr = _PipeBindingVariadicExpr;
13936
13970
  (() => {
13937
- _g = UsesSlotIndex, _h = ConsumesVarsTrait, _j = UsesVarOffset;
13971
+ _e = ConsumesVarsTrait, _f = UsesVarOffset;
13938
13972
  })();
13939
13973
  var SafePropertyReadExpr = class extends ExpressionBase {
13940
13974
  constructor(receiver, name) {
@@ -14129,39 +14163,32 @@ var SanitizerExpr = class extends ExpressionBase {
14129
14163
  transformInternalExpressions() {
14130
14164
  }
14131
14165
  };
14132
- var _SlotLiteralExpr = class extends ExpressionBase {
14133
- constructor(target) {
14166
+ var SlotLiteralExpr = class extends ExpressionBase {
14167
+ constructor(slot) {
14134
14168
  super();
14135
- this.target = target;
14169
+ this.slot = slot;
14136
14170
  this.kind = ExpressionKind.SlotLiteralExpr;
14137
- this[_k] = true;
14138
- this.targetSlot = null;
14139
14171
  }
14140
14172
  visitExpression(visitor, context) {
14141
14173
  }
14142
14174
  isEquivalent(e) {
14143
- return e instanceof _SlotLiteralExpr && e.target === this.target && e.targetSlot === this.targetSlot;
14175
+ return e instanceof SlotLiteralExpr && e.slot === this.slot;
14144
14176
  }
14145
14177
  isConstant() {
14146
14178
  return true;
14147
14179
  }
14148
14180
  clone() {
14149
- const copy = new _SlotLiteralExpr(this.target);
14150
- copy.targetSlot = this.targetSlot;
14151
- return copy;
14181
+ return new SlotLiteralExpr(this.slot);
14152
14182
  }
14153
14183
  transformInternalExpressions() {
14154
14184
  }
14155
14185
  };
14156
- var SlotLiteralExpr = _SlotLiteralExpr;
14157
- (() => {
14158
- _k = UsesSlotIndex;
14159
- })();
14160
14186
  var ConditionalCaseExpr = class extends ExpressionBase {
14161
- constructor(expr, target, alias = null) {
14187
+ constructor(expr, target, targetSlot, alias = null) {
14162
14188
  super();
14163
14189
  this.expr = expr;
14164
14190
  this.target = target;
14191
+ this.targetSlot = targetSlot;
14165
14192
  this.alias = alias;
14166
14193
  this.kind = ExpressionKind.ConditionalCase;
14167
14194
  }
@@ -14177,7 +14204,7 @@ var ConditionalCaseExpr = class extends ExpressionBase {
14177
14204
  return true;
14178
14205
  }
14179
14206
  clone() {
14180
- return new ConditionalCaseExpr(this.expr, this.target);
14207
+ return new ConditionalCaseExpr(this.expr, this.target, this.targetSlot);
14181
14208
  }
14182
14209
  transformInternalExpressions(transform2, flags) {
14183
14210
  if (this.expr !== null) {
@@ -14185,6 +14212,52 @@ var ConditionalCaseExpr = class extends ExpressionBase {
14185
14212
  }
14186
14213
  }
14187
14214
  };
14215
+ var DerivedRepeaterVarExpr = class extends ExpressionBase {
14216
+ constructor(xref, identity) {
14217
+ super();
14218
+ this.xref = xref;
14219
+ this.identity = identity;
14220
+ this.kind = ExpressionKind.DerivedRepeaterVar;
14221
+ }
14222
+ transformInternalExpressions(transform2, flags) {
14223
+ }
14224
+ visitExpression(visitor, context) {
14225
+ }
14226
+ isEquivalent(e) {
14227
+ return e instanceof DerivedRepeaterVarExpr && e.identity === this.identity && e.xref === this.xref;
14228
+ }
14229
+ isConstant() {
14230
+ return false;
14231
+ }
14232
+ clone() {
14233
+ return new DerivedRepeaterVarExpr(this.xref, this.identity);
14234
+ }
14235
+ };
14236
+ var ConstCollectedExpr = class extends ExpressionBase {
14237
+ constructor(expr) {
14238
+ super();
14239
+ this.expr = expr;
14240
+ this.kind = ExpressionKind.ConstCollected;
14241
+ }
14242
+ transformInternalExpressions(transform2, flags) {
14243
+ this.expr = transform2(this.expr, flags);
14244
+ }
14245
+ visitExpression(visitor, context) {
14246
+ this.expr.visitExpression(visitor, context);
14247
+ }
14248
+ isEquivalent(e) {
14249
+ if (!(e instanceof ConstCollectedExpr)) {
14250
+ return false;
14251
+ }
14252
+ return this.expr.isEquivalent(e.expr);
14253
+ }
14254
+ isConstant() {
14255
+ return this.expr.isConstant();
14256
+ }
14257
+ clone() {
14258
+ return new ConstCollectedExpr(this.expr);
14259
+ }
14260
+ };
14188
14261
  function visitExpressionsInOp(op, visitor) {
14189
14262
  transformExpressionsInOp(op, (expr, flags) => {
14190
14263
  visitor(expr, flags);
@@ -14258,40 +14331,46 @@ function transformExpressionsInOp(op, transform2, flags) {
14258
14331
  case OpKind.ExtractedAttribute:
14259
14332
  op.expression = op.expression && transformExpressionsInExpression(op.expression, transform2, flags);
14260
14333
  break;
14261
- case OpKind.ExtractedMessage:
14262
- op.expression = transformExpressionsInExpression(op.expression, transform2, flags);
14263
- for (const statement of op.statements) {
14264
- transformExpressionsInStatement(statement, transform2, flags);
14334
+ case OpKind.RepeaterCreate:
14335
+ op.track = transformExpressionsInExpression(op.track, transform2, flags);
14336
+ if (op.trackByFn !== null) {
14337
+ op.trackByFn = transformExpressionsInExpression(op.trackByFn, transform2, flags);
14265
14338
  }
14266
14339
  break;
14267
- case OpKind.I18n:
14268
- case OpKind.I18nStart:
14269
- for (const [placeholder, expression] of op.params) {
14270
- op.params.set(placeholder, transformExpressionsInExpression(expression, transform2, flags));
14271
- }
14340
+ case OpKind.Repeater:
14341
+ op.collection = transformExpressionsInExpression(op.collection, transform2, flags);
14272
14342
  break;
14273
14343
  case OpKind.Defer:
14274
- case OpKind.DeferSecondaryBlock:
14275
- case OpKind.DeferOn:
14276
- case OpKind.Projection:
14277
- case OpKind.ProjectionDef:
14278
- case OpKind.Element:
14279
- case OpKind.ElementStart:
14280
- case OpKind.ElementEnd:
14281
- case OpKind.I18nEnd:
14344
+ if (op.loadingConfig !== null) {
14345
+ op.loadingConfig = transformExpressionsInExpression(op.loadingConfig, transform2, flags);
14346
+ }
14347
+ if (op.placeholderConfig !== null) {
14348
+ op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
14349
+ }
14350
+ break;
14351
+ case OpKind.Advance:
14282
14352
  case OpKind.Container:
14283
- case OpKind.ContainerStart:
14284
14353
  case OpKind.ContainerEnd:
14285
- case OpKind.Template:
14354
+ case OpKind.ContainerStart:
14355
+ case OpKind.DeferOn:
14286
14356
  case OpKind.DisableBindings:
14357
+ case OpKind.Element:
14358
+ case OpKind.ElementEnd:
14359
+ case OpKind.ElementStart:
14287
14360
  case OpKind.EnableBindings:
14288
- case OpKind.Text:
14289
- case OpKind.Pipe:
14290
- case OpKind.Advance:
14291
- case OpKind.Namespace:
14361
+ case OpKind.ExtractedMessage:
14362
+ case OpKind.I18n:
14292
14363
  case OpKind.I18nApply:
14364
+ case OpKind.I18nEnd:
14365
+ case OpKind.I18nStart:
14293
14366
  case OpKind.Icu:
14294
14367
  case OpKind.IcuUpdate:
14368
+ case OpKind.Namespace:
14369
+ case OpKind.Pipe:
14370
+ case OpKind.Projection:
14371
+ case OpKind.ProjectionDef:
14372
+ case OpKind.Template:
14373
+ case OpKind.Text:
14295
14374
  break;
14296
14375
  default:
14297
14376
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -14561,13 +14640,18 @@ var OpList = _OpList;
14561
14640
  (() => {
14562
14641
  _OpList.nextListId = 0;
14563
14642
  })();
14643
+ var SlotHandle = class {
14644
+ constructor() {
14645
+ this.slot = null;
14646
+ }
14647
+ };
14564
14648
  var elementContainerOpKinds = /* @__PURE__ */ new Set([
14565
14649
  OpKind.Element,
14566
14650
  OpKind.ElementStart,
14567
14651
  OpKind.Container,
14568
14652
  OpKind.ContainerStart,
14569
14653
  OpKind.Template,
14570
- OpKind.Projection
14654
+ OpKind.RepeaterCreate
14571
14655
  ]);
14572
14656
  function isElementOrContainerOp(op) {
14573
14657
  return elementContainerOpKinds.has(op.kind);
@@ -14577,6 +14661,7 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
14577
14661
  kind: OpKind.ElementStart,
14578
14662
  xref,
14579
14663
  tag,
14664
+ handle: new SlotHandle(),
14580
14665
  attributes: null,
14581
14666
  localRefs: [],
14582
14667
  nonBindable: false,
@@ -14585,13 +14670,14 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
14585
14670
  sourceSpan
14586
14671
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
14587
14672
  }
14588
- function createTemplateOp(xref, tag, namespace, generatedInBlock, i18nPlaceholder, sourceSpan) {
14673
+ function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
14589
14674
  return __spreadValues(__spreadValues({
14590
14675
  kind: OpKind.Template,
14591
14676
  xref,
14592
14677
  attributes: null,
14593
14678
  tag,
14594
- block: generatedInBlock,
14679
+ handle: new SlotHandle(),
14680
+ functionNameSuffix,
14595
14681
  decls: null,
14596
14682
  vars: null,
14597
14683
  localRefs: [],
@@ -14601,6 +14687,29 @@ function createTemplateOp(xref, tag, namespace, generatedInBlock, i18nPlaceholde
14601
14687
  sourceSpan
14602
14688
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
14603
14689
  }
14690
+ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, sourceSpan) {
14691
+ return __spreadProps(__spreadValues(__spreadValues({
14692
+ kind: OpKind.RepeaterCreate,
14693
+ attributes: null,
14694
+ xref: primaryView,
14695
+ handle: new SlotHandle(),
14696
+ emptyView,
14697
+ track,
14698
+ trackByFn: null,
14699
+ tag,
14700
+ functionNameSuffix: "For",
14701
+ namespace: Namespace.HTML,
14702
+ nonBindable: false,
14703
+ localRefs: [],
14704
+ decls: null,
14705
+ vars: null,
14706
+ varNames,
14707
+ usesComponentInstance: false,
14708
+ sourceSpan
14709
+ }, TRAIT_CONSUMES_SLOT), NEW_OP), {
14710
+ numSlotsUsed: emptyView === null ? 2 : 3
14711
+ });
14712
+ }
14604
14713
  function createElementEndOp(xref, sourceSpan) {
14605
14714
  return __spreadValues({
14606
14715
  kind: OpKind.ElementEnd,
@@ -14624,14 +14733,16 @@ function createTextOp(xref, initialValue, sourceSpan) {
14624
14733
  return __spreadValues(__spreadValues({
14625
14734
  kind: OpKind.Text,
14626
14735
  xref,
14736
+ handle: new SlotHandle(),
14627
14737
  initialValue,
14628
14738
  sourceSpan
14629
14739
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
14630
14740
  }
14631
- function createListenerOp(target, name, tag, animationPhase, hostListener, sourceSpan) {
14632
- return __spreadValues(__spreadValues({
14741
+ function createListenerOp(target, targetSlot, name, tag, animationPhase, hostListener, sourceSpan) {
14742
+ return __spreadValues({
14633
14743
  kind: OpKind.Listener,
14634
14744
  target,
14745
+ targetSlot,
14635
14746
  tag,
14636
14747
  hostListener,
14637
14748
  name,
@@ -14641,21 +14752,16 @@ function createListenerOp(target, name, tag, animationPhase, hostListener, sourc
14641
14752
  isAnimationListener: animationPhase !== null,
14642
14753
  animationPhase,
14643
14754
  sourceSpan
14644
- }, NEW_OP), TRAIT_USES_SLOT_INDEX);
14755
+ }, NEW_OP);
14645
14756
  }
14646
- function createPipeOp(xref, name) {
14757
+ function createPipeOp(xref, slot, name) {
14647
14758
  return __spreadValues(__spreadValues({
14648
14759
  kind: OpKind.Pipe,
14649
14760
  xref,
14761
+ handle: slot,
14650
14762
  name
14651
14763
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
14652
14764
  }
14653
- var Namespace;
14654
- (function(Namespace2) {
14655
- Namespace2[Namespace2["HTML"] = 0] = "HTML";
14656
- Namespace2[Namespace2["SVG"] = 1] = "SVG";
14657
- Namespace2[Namespace2["Math"] = 2] = "Math";
14658
- })(Namespace || (Namespace = {}));
14659
14765
  function createNamespaceOp(namespace) {
14660
14766
  return __spreadValues({
14661
14767
  kind: OpKind.Namespace,
@@ -14668,16 +14774,16 @@ function createProjectionDefOp(def) {
14668
14774
  def
14669
14775
  }, NEW_OP);
14670
14776
  }
14671
- function createProjectionOp(xref, selector) {
14777
+ function createProjectionOp(xref, selector, sourceSpan) {
14672
14778
  return __spreadValues(__spreadValues({
14673
14779
  kind: OpKind.Projection,
14674
14780
  xref,
14781
+ handle: new SlotHandle(),
14675
14782
  selector,
14676
14783
  projectionSlotIndex: 0,
14677
- attributes: null,
14784
+ attributes: [],
14678
14785
  localRefs: [],
14679
- nonBindable: false,
14680
- sourceSpan: null
14786
+ sourceSpan
14681
14787
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
14682
14788
  }
14683
14789
  function createExtractedAttributeOp(target, bindingKind, name, expression) {
@@ -14689,53 +14795,60 @@ function createExtractedAttributeOp(target, bindingKind, name, expression) {
14689
14795
  expression
14690
14796
  }, NEW_OP);
14691
14797
  }
14692
- function createDeferOp(xref, main, sourceSpan) {
14693
- return __spreadValues(__spreadValues(__spreadValues({
14798
+ function createDeferOp(xref, main, mainSlot, sourceSpan) {
14799
+ return __spreadProps(__spreadValues(__spreadValues({
14694
14800
  kind: OpKind.Defer,
14695
14801
  xref,
14696
- target: main,
14697
- loading: null,
14698
- placeholder: null,
14699
- error: null,
14802
+ handle: new SlotHandle(),
14803
+ mainView: main,
14804
+ mainSlot,
14805
+ loadingView: null,
14806
+ loadingSlot: null,
14807
+ loadingConfig: null,
14808
+ loadingMinimumTime: null,
14809
+ loadingAfterTime: null,
14810
+ placeholderView: null,
14811
+ placeholderSlot: null,
14812
+ placeholderConfig: null,
14813
+ placeholderMinimumTime: null,
14814
+ errorView: null,
14815
+ errorSlot: null,
14700
14816
  sourceSpan
14701
- }, NEW_OP), TRAIT_CONSUMES_SLOT), TRAIT_USES_SLOT_INDEX);
14817
+ }, NEW_OP), TRAIT_CONSUMES_SLOT), {
14818
+ numSlotsUsed: 2
14819
+ });
14702
14820
  }
14703
- function createDeferSecondaryOp(deferOp, secondaryView, secondaryBlockKind) {
14704
- return __spreadValues(__spreadValues(__spreadValues({
14705
- kind: OpKind.DeferSecondaryBlock,
14706
- deferOp,
14707
- target: secondaryView,
14708
- secondaryBlockKind,
14709
- constValue: null,
14710
- makeExpression: literalOrArrayLiteral$1
14711
- }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_HAS_CONST);
14712
- }
14713
- function createDeferOnOp(xref, sourceSpan) {
14714
- return __spreadValues(__spreadValues({
14821
+ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
14822
+ return __spreadValues({
14715
14823
  kind: OpKind.DeferOn,
14716
- xref,
14824
+ defer: defer2,
14825
+ trigger,
14826
+ prefetch,
14717
14827
  sourceSpan
14718
- }, NEW_OP), TRAIT_CONSUMES_SLOT);
14828
+ }, NEW_OP);
14719
14829
  }
14720
- function createExtractedMessageOp(owner, expression, statements) {
14830
+ function createExtractedMessageOp(owner, message, isRoot) {
14721
14831
  return __spreadValues({
14722
14832
  kind: OpKind.ExtractedMessage,
14723
14833
  owner,
14724
- expression,
14725
- statements
14834
+ message,
14835
+ isRoot,
14836
+ params: /* @__PURE__ */ new Map(),
14837
+ postprocessingParams: /* @__PURE__ */ new Map(),
14838
+ needsPostprocessing: false,
14839
+ formattedParams: null,
14840
+ formattedPostprocessingParams: null
14726
14841
  }, NEW_OP);
14727
14842
  }
14728
14843
  function createI18nStartOp(xref, message, root2) {
14729
14844
  return __spreadValues(__spreadValues({
14730
14845
  kind: OpKind.I18nStart,
14731
14846
  xref,
14847
+ handle: new SlotHandle(),
14732
14848
  root: root2 != null ? root2 : xref,
14733
14849
  message,
14734
- params: /* @__PURE__ */ new Map(),
14735
- postprocessingParams: /* @__PURE__ */ new Map(),
14736
14850
  messageIndex: null,
14737
- subTemplateIndex: null,
14738
- needsPostprocessing: false
14851
+ subTemplateIndex: null
14739
14852
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
14740
14853
  }
14741
14854
  function createI18nEndOp(xref) {
@@ -14752,12 +14865,6 @@ function createIcuOp(xref, message, sourceSpan) {
14752
14865
  sourceSpan
14753
14866
  }, NEW_OP);
14754
14867
  }
14755
- function literalOrArrayLiteral$1(value) {
14756
- if (Array.isArray(value)) {
14757
- return literalArr(value.map(literalOrArrayLiteral$1));
14758
- }
14759
- return literal(value, INFERRED_TYPE);
14760
- }
14761
14868
  function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
14762
14869
  return __spreadValues(__spreadValues({
14763
14870
  kind: OpKind.HostProperty,
@@ -14850,6 +14957,7 @@ var ViewCompilationUnit = class extends CompilationUnit {
14850
14957
  this.job = job;
14851
14958
  this.parent = parent;
14852
14959
  this.contextVariables = /* @__PURE__ */ new Map();
14960
+ this.aliases = /* @__PURE__ */ new Set();
14853
14961
  this.decls = null;
14854
14962
  }
14855
14963
  };
@@ -14871,103 +14979,7 @@ var HostBindingCompilationUnit = class extends CompilationUnit {
14871
14979
  this.attributes = null;
14872
14980
  }
14873
14981
  };
14874
- function phaseVarCounting(job) {
14875
- for (const unit of job.units) {
14876
- let varCount = 0;
14877
- for (const op of unit.ops()) {
14878
- if (hasConsumesVarsTrait(op)) {
14879
- varCount += varsUsedByOp(op);
14880
- }
14881
- }
14882
- for (const op of unit.ops()) {
14883
- visitExpressionsInOp(op, (expr) => {
14884
- if (!isIrExpression(expr)) {
14885
- return;
14886
- }
14887
- if (hasUsesVarOffsetTrait(expr)) {
14888
- expr.varOffset = varCount;
14889
- }
14890
- if (hasConsumesVarsTrait(expr)) {
14891
- varCount += varsUsedByIrExpression(expr);
14892
- }
14893
- });
14894
- }
14895
- unit.vars = varCount;
14896
- }
14897
- if (job instanceof ComponentCompilationJob) {
14898
- for (const unit of job.units) {
14899
- for (const op of unit.create) {
14900
- if (op.kind !== OpKind.Template) {
14901
- continue;
14902
- }
14903
- const childView = job.views.get(op.xref);
14904
- op.vars = childView.vars;
14905
- }
14906
- }
14907
- }
14908
- }
14909
- function varsUsedByOp(op) {
14910
- let slots;
14911
- switch (op.kind) {
14912
- case OpKind.Property:
14913
- case OpKind.HostProperty:
14914
- case OpKind.Attribute:
14915
- slots = 1;
14916
- if (op.expression instanceof Interpolation) {
14917
- slots += op.expression.expressions.length;
14918
- }
14919
- return slots;
14920
- case OpKind.StyleProp:
14921
- case OpKind.ClassProp:
14922
- case OpKind.StyleMap:
14923
- case OpKind.ClassMap:
14924
- slots = 2;
14925
- if (op.expression instanceof Interpolation) {
14926
- slots += op.expression.expressions.length;
14927
- }
14928
- return slots;
14929
- case OpKind.InterpolateText:
14930
- return op.interpolation.expressions.length;
14931
- case OpKind.I18nExpression:
14932
- case OpKind.Conditional:
14933
- return 1;
14934
- default:
14935
- throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
14936
- }
14937
- }
14938
- function varsUsedByIrExpression(expr) {
14939
- switch (expr.kind) {
14940
- case ExpressionKind.PureFunctionExpr:
14941
- return 1 + expr.args.length;
14942
- case ExpressionKind.PipeBinding:
14943
- return 1 + expr.args.length;
14944
- case ExpressionKind.PipeBindingVariadic:
14945
- return 1 + expr.numArgs;
14946
- default:
14947
- throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
14948
- }
14949
- }
14950
- function phaseAlignPipeVariadicVarOffset(job) {
14951
- for (const unit of job.units) {
14952
- for (const op of unit.update) {
14953
- visitExpressionsInOp(op, (expr) => {
14954
- if (!(expr instanceof PipeBindingVariadicExpr)) {
14955
- return expr;
14956
- }
14957
- if (!(expr.args instanceof PureFunctionExpr)) {
14958
- return expr;
14959
- }
14960
- if (expr.varOffset === null || expr.args.varOffset === null) {
14961
- throw new Error(`Must run after variable counting`);
14962
- }
14963
- expr.varOffset = expr.args.varOffset;
14964
- expr.args.varOffset = expr.varOffset + varsUsedByIrExpression(expr);
14965
- return void 0;
14966
- });
14967
- }
14968
- }
14969
- }
14970
- function phaseFindAnyCasts(job) {
14982
+ function deleteAnyCasts(job) {
14971
14983
  for (const unit of job.units) {
14972
14984
  for (const op of unit.ops()) {
14973
14985
  transformExpressionsInOp(op, removeAnys, VisitorContextFlag.None);
@@ -14983,11 +14995,11 @@ function removeAnys(e) {
14983
14995
  }
14984
14996
  return e;
14985
14997
  }
14986
- function phaseApplyI18nExpressions(job) {
14998
+ function applyI18nExpressions(job) {
14987
14999
  for (const unit of job.units) {
14988
15000
  for (const op of unit.update) {
14989
15001
  if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
14990
- OpList.insertAfter(createI18nApplyOp(op.owner, null), op);
15002
+ OpList.insertAfter(createI18nApplyOp(op.owner, op.ownerSlot, null), op);
14991
15003
  }
14992
15004
  }
14993
15005
  }
@@ -15002,7 +15014,7 @@ function needsApplication(op) {
15002
15014
  }
15003
15015
  return false;
15004
15016
  }
15005
- function phaseAssignI18nSlotDependencies(job) {
15017
+ function assignI18nSlotDependencies(job) {
15006
15018
  const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
15007
15019
  let lastSlotConsumer = null;
15008
15020
  for (const unit of job.units) {
@@ -15021,19 +15033,19 @@ function phaseAssignI18nSlotDependencies(job) {
15021
15033
  }
15022
15034
  }
15023
15035
  }
15024
- function getElementsByXrefId(unit) {
15025
- const elements = /* @__PURE__ */ new Map();
15036
+ function createOpXrefMap(unit) {
15037
+ const map = /* @__PURE__ */ new Map();
15026
15038
  for (const op of unit.create) {
15027
- if (!isElementOrContainerOp(op)) {
15039
+ if (!hasConsumesSlotTrait(op)) {
15028
15040
  continue;
15029
15041
  }
15030
- elements.set(op.xref, op);
15042
+ map.set(op.xref, op);
15031
15043
  }
15032
- return elements;
15044
+ return map;
15033
15045
  }
15034
- function phaseAttributeExtraction(job) {
15046
+ function extractAttributes(job) {
15035
15047
  for (const unit of job.units) {
15036
- const elements = getElementsByXrefId(unit);
15048
+ const elements = createOpXrefMap(unit);
15037
15049
  for (const op of unit.ops()) {
15038
15050
  switch (op.kind) {
15039
15051
  case OpKind.Attribute:
@@ -15041,13 +15053,13 @@ function phaseAttributeExtraction(job) {
15041
15053
  break;
15042
15054
  case OpKind.Property:
15043
15055
  if (!op.isAnimationTrigger) {
15044
- OpList.insertBefore(createExtractedAttributeOp(op.target, op.isTemplate ? BindingKind.Template : BindingKind.Property, op.name, null), lookupElement$3(elements, op.target));
15056
+ OpList.insertBefore(createExtractedAttributeOp(op.target, op.isTemplate ? BindingKind.Template : BindingKind.Property, op.name, null), lookupElement$2(elements, op.target));
15045
15057
  }
15046
15058
  break;
15047
15059
  case OpKind.StyleProp:
15048
15060
  case OpKind.ClassProp:
15049
15061
  if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && op.expression instanceof EmptyExpr) {
15050
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, op.name, null), lookupElement$3(elements, op.target));
15062
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, op.name, null), lookupElement$2(elements, op.target));
15051
15063
  }
15052
15064
  break;
15053
15065
  case OpKind.Listener:
@@ -15056,7 +15068,7 @@ function phaseAttributeExtraction(job) {
15056
15068
  if (job.kind === CompilationJobKind.Host) {
15057
15069
  unit.create.push(extractedAttributeOp);
15058
15070
  } else {
15059
- OpList.insertBefore(extractedAttributeOp, lookupElement$3(elements, op.target));
15071
+ OpList.insertBefore(extractedAttributeOp, lookupElement$2(elements, op.target));
15060
15072
  }
15061
15073
  }
15062
15074
  break;
@@ -15064,7 +15076,7 @@ function phaseAttributeExtraction(job) {
15064
15076
  }
15065
15077
  }
15066
15078
  }
15067
- function lookupElement$3(elements, xref) {
15079
+ function lookupElement$2(elements, xref) {
15068
15080
  const el = elements.get(xref);
15069
15081
  if (el === void 0) {
15070
15082
  throw new Error("All attributes should have an element-like target.");
@@ -15090,20 +15102,20 @@ function extractAttributeOp(unit, op, elements) {
15090
15102
  if (unit.job.kind === CompilationJobKind.Host) {
15091
15103
  unit.create.push(extractedAttributeOp);
15092
15104
  } else {
15093
- const ownerOp = lookupElement$3(elements, op.target);
15105
+ const ownerOp = lookupElement$2(elements, op.target);
15094
15106
  OpList.insertBefore(extractedAttributeOp, ownerOp);
15095
15107
  }
15096
15108
  OpList.remove(op);
15097
15109
  }
15098
15110
  }
15099
- function lookupElement$2(elements, xref) {
15111
+ function lookupElement$1(elements, xref) {
15100
15112
  const el = elements.get(xref);
15101
15113
  if (el === void 0) {
15102
15114
  throw new Error("All attributes should have an element-like target.");
15103
15115
  }
15104
15116
  return el;
15105
15117
  }
15106
- function phaseBindingSpecialization(job) {
15118
+ function specializeBindings(job) {
15107
15119
  const elements = /* @__PURE__ */ new Map();
15108
15120
  for (const unit of job.units) {
15109
15121
  for (const op of unit.create) {
@@ -15122,7 +15134,7 @@ function phaseBindingSpecialization(job) {
15122
15134
  case BindingKind.Attribute:
15123
15135
  if (op.name === "ngNonBindable") {
15124
15136
  OpList.remove(op);
15125
- const target = lookupElement$2(elements, op.target);
15137
+ const target = lookupElement$1(elements, op.target);
15126
15138
  target.nonBindable = true;
15127
15139
  } else {
15128
15140
  OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isTemplate, op.sourceSpan));
@@ -15172,35 +15184,35 @@ var CHAINABLE = /* @__PURE__ */ new Set([
15172
15184
  Identifiers.syntheticHostProperty,
15173
15185
  Identifiers.templateCreate
15174
15186
  ]);
15175
- function phaseChaining(job) {
15187
+ function chain(job) {
15176
15188
  for (const unit of job.units) {
15177
15189
  chainOperationsInList(unit.create);
15178
15190
  chainOperationsInList(unit.update);
15179
15191
  }
15180
15192
  }
15181
15193
  function chainOperationsInList(opList) {
15182
- let chain = null;
15194
+ let chain2 = null;
15183
15195
  for (const op of opList) {
15184
15196
  if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement)) {
15185
- chain = null;
15197
+ chain2 = null;
15186
15198
  continue;
15187
15199
  }
15188
15200
  if (!(op.statement.expr instanceof InvokeFunctionExpr) || !(op.statement.expr.fn instanceof ExternalExpr)) {
15189
- chain = null;
15201
+ chain2 = null;
15190
15202
  continue;
15191
15203
  }
15192
15204
  const instruction = op.statement.expr.fn.value;
15193
15205
  if (!CHAINABLE.has(instruction)) {
15194
- chain = null;
15206
+ chain2 = null;
15195
15207
  continue;
15196
15208
  }
15197
- if (chain !== null && chain.instruction === instruction) {
15198
- const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
15199
- chain.expression = expression;
15200
- chain.op.statement = expression.toStmt();
15209
+ if (chain2 !== null && chain2.instruction === instruction) {
15210
+ const expression = chain2.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
15211
+ chain2.expression = expression;
15212
+ chain2.op.statement = expression.toStmt();
15201
15213
  OpList.remove(op);
15202
15214
  } else {
15203
- chain = {
15215
+ chain2 = {
15204
15216
  op,
15205
15217
  instruction,
15206
15218
  expression: op.statement.expr
@@ -15208,7 +15220,17 @@ function chainOperationsInList(opList) {
15208
15220
  }
15209
15221
  }
15210
15222
  }
15211
- function phaseConditionals(job) {
15223
+ function collapseSingletonInterpolations(job) {
15224
+ for (const unit of job.units) {
15225
+ for (const op of unit.update) {
15226
+ const eligibleOpKind = op.kind === OpKind.Attribute;
15227
+ if (eligibleOpKind && op.expression instanceof Interpolation && op.expression.strings.length === 2 && op.expression.strings.every((s) => s === "")) {
15228
+ op.expression = op.expression.expressions[0];
15229
+ }
15230
+ }
15231
+ }
15232
+ }
15233
+ function generateConditionalExpressions(job) {
15212
15234
  for (const unit of job.units) {
15213
15235
  for (const op of unit.ops()) {
15214
15236
  if (op.kind !== OpKind.Conditional) {
@@ -15217,8 +15239,8 @@ function phaseConditionals(job) {
15217
15239
  let test;
15218
15240
  const defaultCase = op.conditions.findIndex((cond) => cond.expr === null);
15219
15241
  if (defaultCase >= 0) {
15220
- const xref = op.conditions.splice(defaultCase, 1)[0].target;
15221
- test = new SlotLiteralExpr(xref);
15242
+ const slot = op.conditions.splice(defaultCase, 1)[0].targetSlot;
15243
+ test = new SlotLiteralExpr(slot);
15222
15244
  } else {
15223
15245
  test = literal(-1);
15224
15246
  }
@@ -15236,9 +15258,10 @@ function phaseConditionals(job) {
15236
15258
  conditionalCase.expr = new AssignTemporaryExpr(conditionalCase.expr, caseExpressionTemporaryXref);
15237
15259
  op.contextValue = new ReadTemporaryExpr(caseExpressionTemporaryXref);
15238
15260
  }
15239
- test = new ConditionalExpr(conditionalCase.expr, new SlotLiteralExpr(conditionalCase.target), test);
15261
+ test = new ConditionalExpr(conditionalCase.expr, new SlotLiteralExpr(conditionalCase.targetSlot), test);
15240
15262
  }
15241
15263
  op.processed = test;
15264
+ op.conditions = [];
15242
15265
  }
15243
15266
  }
15244
15267
  }
@@ -15319,9 +15342,9 @@ function literalOrArrayLiteral(value) {
15319
15342
  if (Array.isArray(value)) {
15320
15343
  return literalArr(value.map(literalOrArrayLiteral));
15321
15344
  }
15322
- return literal(value, INFERRED_TYPE);
15345
+ return literal(value);
15323
15346
  }
15324
- function phaseConstCollection(job) {
15347
+ function collectElementConsts(job) {
15325
15348
  const allElementAttributes = /* @__PURE__ */ new Map();
15326
15349
  for (const unit of job.units) {
15327
15350
  for (const op of unit.create) {
@@ -15448,18 +15471,109 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
15448
15471
  if (template2.length > 0) {
15449
15472
  attrArray.push(literal(4), ...template2);
15450
15473
  }
15451
- if (i18n2.length > 0) {
15452
- attrArray.push(literal(6), ...i18n2);
15474
+ if (i18n2.length > 0) {
15475
+ attrArray.push(literal(6), ...i18n2);
15476
+ }
15477
+ return literalArr(attrArray);
15478
+ }
15479
+ function configureDeferInstructions(job) {
15480
+ for (const unit of job.units) {
15481
+ for (const op of unit.create) {
15482
+ if (op.kind !== OpKind.Defer) {
15483
+ continue;
15484
+ }
15485
+ if (op.placeholderMinimumTime !== null) {
15486
+ op.placeholderConfig = new ConstCollectedExpr(literalOrArrayLiteral([op.placeholderMinimumTime]));
15487
+ }
15488
+ if (op.loadingMinimumTime !== null || op.loadingAfterTime !== null) {
15489
+ op.loadingConfig = new ConstCollectedExpr(literalOrArrayLiteral([op.loadingMinimumTime, op.loadingAfterTime]));
15490
+ }
15491
+ }
15492
+ }
15493
+ }
15494
+ function resolveDeferTargetNames(job) {
15495
+ const scopes = /* @__PURE__ */ new Map();
15496
+ function getScopeForView2(view) {
15497
+ if (scopes.has(view.xref)) {
15498
+ return scopes.get(view.xref);
15499
+ }
15500
+ const scope = new Scope$1();
15501
+ for (const op of view.create) {
15502
+ if (!isElementOrContainerOp(op) || op.localRefs === null) {
15503
+ continue;
15504
+ }
15505
+ if (!Array.isArray(op.localRefs)) {
15506
+ throw new Error("LocalRefs were already processed, but were needed to resolve defer targets.");
15507
+ }
15508
+ for (const ref of op.localRefs) {
15509
+ if (ref.target !== "") {
15510
+ continue;
15511
+ }
15512
+ scope.targets.set(ref.name, { xref: op.xref, slot: op.handle });
15513
+ }
15514
+ }
15515
+ scopes.set(view.xref, scope);
15516
+ return scope;
15517
+ }
15518
+ function resolveTrigger(deferOwnerView, op, placeholderView) {
15519
+ switch (op.trigger.kind) {
15520
+ case DeferTriggerKind.Idle:
15521
+ case DeferTriggerKind.Immediate:
15522
+ case DeferTriggerKind.Timer:
15523
+ return;
15524
+ case DeferTriggerKind.Hover:
15525
+ case DeferTriggerKind.Interaction:
15526
+ case DeferTriggerKind.Viewport:
15527
+ if (op.trigger.targetName === null) {
15528
+ return;
15529
+ }
15530
+ let view = placeholderView !== null ? job.views.get(placeholderView) : deferOwnerView;
15531
+ let step = placeholderView !== null ? -1 : 0;
15532
+ while (view !== null) {
15533
+ const scope = getScopeForView2(view);
15534
+ if (scope.targets.has(op.trigger.targetName)) {
15535
+ const { xref, slot } = scope.targets.get(op.trigger.targetName);
15536
+ op.trigger.targetXref = xref;
15537
+ op.trigger.targetView = view.xref;
15538
+ op.trigger.targetSlotViewSteps = step;
15539
+ op.trigger.targetSlot = slot;
15540
+ return;
15541
+ }
15542
+ view = view.parent !== null ? job.views.get(view.parent) : null;
15543
+ step++;
15544
+ }
15545
+ break;
15546
+ default:
15547
+ throw new Error(`Trigger kind ${op.trigger.kind} not handled`);
15548
+ }
15549
+ }
15550
+ for (const unit of job.units) {
15551
+ const defers = /* @__PURE__ */ new Map();
15552
+ for (const op of unit.create) {
15553
+ switch (op.kind) {
15554
+ case OpKind.Defer:
15555
+ defers.set(op.xref, op);
15556
+ break;
15557
+ case OpKind.DeferOn:
15558
+ const deferOp = defers.get(op.defer);
15559
+ resolveTrigger(unit, op, deferOp.placeholderView);
15560
+ break;
15561
+ }
15562
+ }
15453
15563
  }
15454
- return literalArr(attrArray);
15455
15564
  }
15565
+ var Scope$1 = class {
15566
+ constructor() {
15567
+ this.targets = /* @__PURE__ */ new Map();
15568
+ }
15569
+ };
15456
15570
  var REPLACEMENTS = /* @__PURE__ */ new Map([
15457
15571
  [OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
15458
15572
  [OpKind.ContainerEnd, [OpKind.ContainerStart, OpKind.Container]],
15459
15573
  [OpKind.I18nEnd, [OpKind.I18nStart, OpKind.I18n]]
15460
15574
  ]);
15461
15575
  var IGNORED_OP_KINDS = /* @__PURE__ */ new Set([OpKind.Pipe]);
15462
- function phaseEmptyElements(job) {
15576
+ function collapseEmptyInstructions(job) {
15463
15577
  for (const unit of job.units) {
15464
15578
  for (const op of unit.create) {
15465
15579
  const opReplacements = REPLACEMENTS.get(op.kind);
@@ -15478,7 +15592,7 @@ function phaseEmptyElements(job) {
15478
15592
  }
15479
15593
  }
15480
15594
  }
15481
- function phaseExpandSafeReads(job) {
15595
+ function expandSafeReads(job) {
15482
15596
  for (const unit of job.units) {
15483
15597
  for (const op of unit.ops()) {
15484
15598
  transformExpressionsInOp(op, (e) => safeTransform(e, { job }), VisitorContextFlag.None);
@@ -15612,16 +15726,76 @@ function ternaryTransform(e) {
15612
15726
  }
15613
15727
  return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
15614
15728
  }
15615
- function phaseGenerateAdvance(job) {
15729
+ var ESCAPE = "\uFFFD";
15730
+ var ELEMENT_MARKER = "#";
15731
+ var TEMPLATE_MARKER = "*";
15732
+ var TAG_CLOSE_MARKER = "/";
15733
+ var CONTEXT_MARKER = ":";
15734
+ var LIST_START_MARKER = "[";
15735
+ var LIST_END_MARKER = "]";
15736
+ var LIST_DELIMITER = "|";
15737
+ function formatI18nParams(job) {
15738
+ for (const unit of job.units) {
15739
+ for (const op of unit.create) {
15740
+ if (op.kind === OpKind.ExtractedMessage) {
15741
+ if (op.isRoot) {
15742
+ op.formattedParams = formatParams(op.params);
15743
+ op.formattedPostprocessingParams = formatParams(op.postprocessingParams);
15744
+ op.needsPostprocessing = op.postprocessingParams.size > 0;
15745
+ for (const [param, values] of op.params) {
15746
+ if (values.length > 1) {
15747
+ op.needsPostprocessing = true;
15748
+ }
15749
+ }
15750
+ }
15751
+ }
15752
+ }
15753
+ }
15754
+ }
15755
+ function formatParams(params) {
15756
+ const result = /* @__PURE__ */ new Map();
15757
+ for (const [placeholder, placeholderValues] of [...params].sort()) {
15758
+ const serializedValues = formatParamValues(placeholderValues);
15759
+ if (serializedValues !== null) {
15760
+ result.set(placeholder, literal(formatParamValues(placeholderValues)));
15761
+ }
15762
+ }
15763
+ return result;
15764
+ }
15765
+ function formatParamValues(values) {
15766
+ if (values.length === 0) {
15767
+ return null;
15768
+ }
15769
+ const serializedValues = values.map((value) => formatValue(value));
15770
+ return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
15771
+ }
15772
+ function formatValue(value) {
15773
+ let tagMarker = "";
15774
+ let closeMarker = "";
15775
+ if (value.flags & I18nParamValueFlags.ElementTag) {
15776
+ tagMarker = ELEMENT_MARKER;
15777
+ } else if (value.flags & I18nParamValueFlags.TemplateTag) {
15778
+ tagMarker = TEMPLATE_MARKER;
15779
+ }
15780
+ if (tagMarker !== "") {
15781
+ closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
15782
+ }
15783
+ const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
15784
+ if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
15785
+ return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
15786
+ }
15787
+ return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
15788
+ }
15789
+ function generateAdvance(job) {
15616
15790
  for (const unit of job.units) {
15617
15791
  const slotMap = /* @__PURE__ */ new Map();
15618
15792
  for (const op of unit.create) {
15619
15793
  if (!hasConsumesSlotTrait(op)) {
15620
15794
  continue;
15621
- } else if (op.slot === null) {
15795
+ } else if (op.handle.slot === null) {
15622
15796
  throw new Error(`AssertionError: expected slots to have been allocated before generating advance() calls`);
15623
15797
  }
15624
- slotMap.set(op.xref, op.slot);
15798
+ slotMap.set(op.xref, op.handle.slot);
15625
15799
  }
15626
15800
  let slotContext = 0;
15627
15801
  for (const op of unit.update) {
@@ -15642,7 +15816,7 @@ function phaseGenerateAdvance(job) {
15642
15816
  }
15643
15817
  }
15644
15818
  }
15645
- function phaseGenerateProjectionDef(job) {
15819
+ function generateProjectionDefs(job) {
15646
15820
  const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
15647
15821
  const selectors = [];
15648
15822
  let projectionSlotIndex = 0;
@@ -15664,7 +15838,7 @@ function phaseGenerateProjectionDef(job) {
15664
15838
  job.root.create.prepend([createProjectionDefOp(defExpr)]);
15665
15839
  }
15666
15840
  }
15667
- function phaseGenerateVariables(job) {
15841
+ function generateVariables(job) {
15668
15842
  recursivelyProcessView(job.root, null);
15669
15843
  }
15670
15844
  function recursivelyProcessView(view, parentScope) {
@@ -15672,6 +15846,7 @@ function recursivelyProcessView(view, parentScope) {
15672
15846
  for (const op of view.create) {
15673
15847
  switch (op.kind) {
15674
15848
  case OpKind.Template:
15849
+ case OpKind.RepeaterCreate:
15675
15850
  recursivelyProcessView(view.job.views.get(op.xref), scope);
15676
15851
  break;
15677
15852
  case OpKind.Listener:
@@ -15691,6 +15866,7 @@ function getScopeForView(view, parent) {
15691
15866
  view: view.xref
15692
15867
  },
15693
15868
  contextVariables: /* @__PURE__ */ new Map(),
15869
+ aliases: view.aliases,
15694
15870
  references: [],
15695
15871
  parent
15696
15872
  };
@@ -15712,6 +15888,7 @@ function getScopeForView(view, parent) {
15712
15888
  scope.references.push({
15713
15889
  name: op.localRefs[offset].name,
15714
15890
  targetId: op.xref,
15891
+ targetSlot: op.handle,
15715
15892
  offset,
15716
15893
  variable: {
15717
15894
  kind: SemanticVariableKind.Identifier,
@@ -15728,37 +15905,34 @@ function getScopeForView(view, parent) {
15728
15905
  function generateVariablesInScopeForView(view, scope) {
15729
15906
  const newOps = [];
15730
15907
  if (scope.view !== view.xref) {
15731
- newOps.push(createVariableOp(view.job.allocateXrefId(), scope.viewContextVariable, new NextContextExpr()));
15908
+ newOps.push(createVariableOp(view.job.allocateXrefId(), scope.viewContextVariable, new NextContextExpr(), VariableFlags.None));
15732
15909
  }
15733
- for (const [name, value] of view.job.views.get(scope.view).contextVariables) {
15910
+ const scopeView = view.job.views.get(scope.view);
15911
+ for (const [name, value] of scopeView.contextVariables) {
15734
15912
  const context = new ContextExpr(scope.view);
15735
15913
  const variable2 = value === CTX_REF ? context : new ReadPropExpr(context, value);
15736
- newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), variable2));
15914
+ newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), variable2, VariableFlags.None));
15915
+ }
15916
+ for (const alias of scopeView.aliases) {
15917
+ newOps.push(createVariableOp(view.job.allocateXrefId(), alias, alias.expression.clone(), VariableFlags.AlwaysInline));
15737
15918
  }
15738
15919
  for (const ref of scope.references) {
15739
- newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.offset)));
15920
+ newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.targetSlot, ref.offset), VariableFlags.None));
15740
15921
  }
15741
15922
  if (scope.parent !== null) {
15742
15923
  newOps.push(...generateVariablesInScopeForView(view, scope.parent));
15743
15924
  }
15744
15925
  return newOps;
15745
15926
  }
15746
- function phaseConstTraitCollection(job) {
15747
- const collectGlobalConsts = (e) => {
15748
- if (e instanceof ExpressionBase && hasConstTrait(e)) {
15749
- const ea = e;
15750
- if (ea.constValue !== null) {
15751
- ea.constIndex = job.addConst(ea.constValue);
15752
- }
15753
- }
15754
- return e;
15755
- };
15927
+ function collectConstExpressions(job) {
15756
15928
  for (const unit of job.units) {
15757
15929
  for (const op of unit.ops()) {
15758
- if (hasConstTrait(op) && op.constValue !== null) {
15759
- op.constIndex = job.addConst(op.makeExpression(op.constValue));
15760
- }
15761
- transformExpressionsInOp(op, collectGlobalConsts, VisitorContextFlag.None);
15930
+ transformExpressionsInOp(op, (expr) => {
15931
+ if (!(expr instanceof ConstCollectedExpr)) {
15932
+ return expr;
15933
+ }
15934
+ return literal(job.addConst(expr.expr));
15935
+ }, VisitorContextFlag.None);
15762
15936
  }
15763
15937
  }
15764
15938
  }
@@ -15767,7 +15941,7 @@ var CLASS_DOT = "class.";
15767
15941
  var STYLE_BANG = "style!";
15768
15942
  var CLASS_BANG = "class!";
15769
15943
  var BANG_IMPORTANT = "!important";
15770
- function phaseHostStylePropertyParsing(job) {
15944
+ function parseHostStyleProperties(job) {
15771
15945
  for (const op of job.root.update) {
15772
15946
  if (op.kind !== OpKind.Binding) {
15773
15947
  continue;
@@ -15818,24 +15992,6 @@ function parseProperty$1(name) {
15818
15992
  }
15819
15993
  return { property: property2, suffix };
15820
15994
  }
15821
- function phaseI18nConstCollection(job) {
15822
- const messageConstIndices = {};
15823
- for (const unit of job.units) {
15824
- for (const op of unit.create) {
15825
- if (op.kind === OpKind.ExtractedMessage) {
15826
- messageConstIndices[op.owner] = job.addConst(op.expression, op.statements);
15827
- OpList.remove(op);
15828
- }
15829
- }
15830
- }
15831
- for (const unit of job.units) {
15832
- for (const op of unit.create) {
15833
- if (op.kind === OpKind.I18nStart) {
15834
- op.messageIndex = messageConstIndices[op.root];
15835
- }
15836
- }
15837
- }
15838
- }
15839
15995
  function mapLiteral(obj, quoted = false) {
15840
15996
  return literalMap(Object.keys(obj).map((key) => ({
15841
15997
  key,
@@ -17199,11 +17355,12 @@ var Comment = class {
17199
17355
  }
17200
17356
  };
17201
17357
  var Block = class {
17202
- constructor(name, parameters, children, sourceSpan, startSourceSpan, endSourceSpan = null) {
17358
+ constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null) {
17203
17359
  this.name = name;
17204
17360
  this.parameters = parameters;
17205
17361
  this.children = children;
17206
17362
  this.sourceSpan = sourceSpan;
17363
+ this.nameSpan = nameSpan;
17207
17364
  this.startSourceSpan = startSourceSpan;
17208
17365
  this.endSourceSpan = endSourceSpan;
17209
17366
  }
@@ -20719,7 +20876,7 @@ var _Tokenizer = class {
20719
20876
  return true;
20720
20877
  }
20721
20878
  }
20722
- if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._isBlockStart() || this._cursor.peek() === $RBRACE)) {
20879
+ if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._cursor.peek() === $AT || this._cursor.peek() === $RBRACE)) {
20723
20880
  return true;
20724
20881
  }
20725
20882
  return false;
@@ -20735,16 +20892,6 @@ var _Tokenizer = class {
20735
20892
  }
20736
20893
  return false;
20737
20894
  }
20738
- _isBlockStart() {
20739
- if (this._tokenizeBlocks && this._cursor.peek() === $AT) {
20740
- const tmp = this._cursor.clone();
20741
- tmp.advance();
20742
- if (isBlockNameChar(tmp.peek())) {
20743
- return true;
20744
- }
20745
- }
20746
- return false;
20747
- }
20748
20895
  _readUntil(char) {
20749
20896
  const start = this._cursor.clone();
20750
20897
  this._attemptUntilChar(char);
@@ -21327,7 +21474,7 @@ var _TreeBuilder = class {
21327
21474
  const end = this._peek.sourceSpan.fullStart;
21328
21475
  const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
21329
21476
  const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
21330
- const block = new Block(token.parts[0], parameters, [], span, startSpan);
21477
+ const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);
21331
21478
  this._pushContainer(block, false);
21332
21479
  }
21333
21480
  _consumeBlockClose(token) {
@@ -21344,7 +21491,7 @@ var _TreeBuilder = class {
21344
21491
  const end = this._peek.sourceSpan.fullStart;
21345
21492
  const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
21346
21493
  const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
21347
- const block = new Block(token.parts[0], parameters, [], span, startSpan);
21494
+ const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);
21348
21495
  this._pushContainer(block, false);
21349
21496
  this._popContainer(null, Block, null);
21350
21497
  this.errors.push(TreeError.create(token.parts[0], span, `Incomplete block "${token.parts[0]}". If you meant to write the @ character, you should use the "@" HTML entity instead.`));
@@ -21693,26 +21840,35 @@ function createEmptyMessagePart(location) {
21693
21840
  }
21694
21841
  var NG_I18N_CLOSURE_MODE$1 = "ngI18nClosureMode";
21695
21842
  var TRANSLATION_VAR_PREFIX = "i18n_";
21696
- function phaseI18nMessageExtraction(job) {
21843
+ function collectI18nConsts(job) {
21697
21844
  const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
21845
+ const messageConstIndices = /* @__PURE__ */ new Map();
21698
21846
  for (const unit of job.units) {
21699
21847
  for (const op of unit.create) {
21700
- if (op.kind === OpKind.I18nStart) {
21701
- if (op.xref === op.root) {
21702
- const params = new Map([...op.params.entries()].sort());
21848
+ if (op.kind === OpKind.ExtractedMessage) {
21849
+ if (op.isRoot) {
21850
+ assertAllParamsResolved(op);
21703
21851
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX));
21704
21852
  const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
21705
21853
  let transformFn = void 0;
21706
21854
  if (op.needsPostprocessing) {
21707
21855
  const extraTransformFnParams = [];
21708
- if (op.postprocessingParams.size > 0) {
21709
- extraTransformFnParams.push(literalMap([...op.postprocessingParams.entries()].map(([key, value]) => ({ key, value, quoted: true }))));
21856
+ if (op.formattedPostprocessingParams.size > 0) {
21857
+ extraTransformFnParams.push(literalMap([...op.formattedPostprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
21710
21858
  }
21711
21859
  transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
21712
21860
  }
21713
- const statements = getTranslationDeclStmts$1(op.message, mainVar, closureVar, params, transformFn);
21714
- unit.create.push(createExtractedMessageOp(op.xref, mainVar, statements));
21861
+ const statements = getTranslationDeclStmts$1(op.message, mainVar, closureVar, op.formattedParams, transformFn);
21862
+ messageConstIndices.set(op.owner, job.addConst(mainVar, statements));
21715
21863
  }
21864
+ OpList.remove(op);
21865
+ }
21866
+ }
21867
+ }
21868
+ for (const unit of job.units) {
21869
+ for (const op of unit.create) {
21870
+ if (op.kind === OpKind.I18nStart) {
21871
+ op.messageIndex = messageConstIndices.get(op.root);
21716
21872
  }
21717
21873
  }
21718
21874
  }
@@ -21744,22 +21900,49 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
21744
21900
  }
21745
21901
  return variable(name);
21746
21902
  }
21747
- function phaseI18nTextExtraction(job) {
21903
+ function assertAllParamsResolved(op) {
21904
+ if (op.formattedParams === null || op.formattedPostprocessingParams === null) {
21905
+ throw Error("Params should have been formatted.");
21906
+ }
21907
+ for (const placeholder in op.message.placeholders) {
21908
+ if (!op.formattedParams.has(placeholder) && !op.formattedPostprocessingParams.has(placeholder)) {
21909
+ throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
21910
+ }
21911
+ }
21912
+ for (const placeholder in op.message.placeholderToMessage) {
21913
+ if (!op.formattedParams.has(placeholder) && !op.formattedPostprocessingParams.has(placeholder)) {
21914
+ throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
21915
+ }
21916
+ }
21917
+ }
21918
+ function extractI18nMessages(job) {
21919
+ for (const unit of job.units) {
21920
+ for (const op of unit.create) {
21921
+ if (op.kind === OpKind.I18nStart) {
21922
+ unit.create.push(createExtractedMessageOp(op.xref, op.message, op.xref === op.root));
21923
+ }
21924
+ }
21925
+ }
21926
+ }
21927
+ function extractI18nText(job) {
21748
21928
  var _a2;
21749
21929
  for (const unit of job.units) {
21750
21930
  let currentI18nId = null;
21931
+ let currentI18nSlot = null;
21751
21932
  const textNodes = /* @__PURE__ */ new Map();
21752
21933
  for (const op of unit.create) {
21753
21934
  switch (op.kind) {
21754
21935
  case OpKind.I18nStart:
21755
21936
  currentI18nId = op.xref;
21937
+ currentI18nSlot = op.handle;
21756
21938
  break;
21757
21939
  case OpKind.I18nEnd:
21758
21940
  currentI18nId = null;
21941
+ currentI18nSlot = null;
21759
21942
  break;
21760
21943
  case OpKind.Text:
21761
- if (currentI18nId !== null) {
21762
- textNodes.set(op.xref, currentI18nId);
21944
+ if (currentI18nId !== null && currentI18nSlot !== null) {
21945
+ textNodes.set(op.xref, { xref: currentI18nId, slot: currentI18nSlot });
21763
21946
  OpList.remove(op);
21764
21947
  }
21765
21948
  break;
@@ -21771,12 +21954,12 @@ function phaseI18nTextExtraction(job) {
21771
21954
  if (!textNodes.has(op.target)) {
21772
21955
  continue;
21773
21956
  }
21774
- const i18nBlockId = textNodes.get(op.target);
21957
+ const i18nBlock = textNodes.get(op.target);
21775
21958
  const ops = [];
21776
21959
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
21777
21960
  const expr = op.interpolation.expressions[i];
21778
21961
  const placeholder = op.i18nPlaceholders[i];
21779
- ops.push(createI18nExpressionOp(i18nBlockId, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
21962
+ ops.push(createI18nExpressionOp(i18nBlock.xref, i18nBlock.slot, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
21780
21963
  }
21781
21964
  if (ops.length > 0) {
21782
21965
  }
@@ -21786,23 +21969,26 @@ function phaseI18nTextExtraction(job) {
21786
21969
  }
21787
21970
  }
21788
21971
  }
21789
- function phaseIcuExtraction(job) {
21972
+ function extractI18nICUs(job) {
21790
21973
  for (const unit of job.units) {
21791
21974
  const icus = /* @__PURE__ */ new Map();
21792
21975
  let currentI18nId = null;
21976
+ let currentI18nSlot = null;
21793
21977
  for (const op of unit.create) {
21794
21978
  switch (op.kind) {
21795
21979
  case OpKind.I18nStart:
21796
21980
  currentI18nId = op.xref;
21981
+ currentI18nSlot = op.handle;
21797
21982
  break;
21798
21983
  case OpKind.I18nEnd:
21799
21984
  currentI18nId = null;
21985
+ currentI18nSlot = null;
21800
21986
  break;
21801
21987
  case OpKind.Icu:
21802
21988
  if (currentI18nId === null) {
21803
21989
  throw Error("Unexpected ICU outside of an i18n block.");
21804
21990
  }
21805
- icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId });
21991
+ icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId, i18nBlockSlot: currentI18nSlot });
21806
21992
  OpList.remove(op);
21807
21993
  break;
21808
21994
  }
@@ -21810,7 +21996,7 @@ function phaseIcuExtraction(job) {
21810
21996
  for (const op of unit.update) {
21811
21997
  switch (op.kind) {
21812
21998
  case OpKind.IcuUpdate:
21813
- const { message, i18nBlockId } = icus.get(op.xref);
21999
+ const { message, i18nBlockId, i18nBlockSlot } = icus.get(op.xref);
21814
22000
  const icuNode = message.nodes.find((n) => n instanceof Icu);
21815
22001
  if (icuNode === void 0) {
21816
22002
  throw Error("Could not find ICU in i18n AST");
@@ -21818,13 +22004,13 @@ function phaseIcuExtraction(job) {
21818
22004
  if (icuNode.expressionPlaceholder === void 0) {
21819
22005
  throw Error("ICU is missing an i18n placeholder");
21820
22006
  }
21821
- OpList.replace(op, createI18nExpressionOp(i18nBlockId, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
22007
+ OpList.replace(op, createI18nExpressionOp(i18nBlockId, i18nBlockSlot, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
21822
22008
  break;
21823
22009
  }
21824
22010
  }
21825
22011
  }
21826
22012
  }
21827
- function phaseLocalRefs(job) {
22013
+ function liftLocalRefs(job) {
21828
22014
  for (const unit of job.units) {
21829
22015
  for (const op of unit.create) {
21830
22016
  switch (op.kind) {
@@ -21852,7 +22038,7 @@ function serializeLocalRefs(refs) {
21852
22038
  }
21853
22039
  return literalArr(constRefs);
21854
22040
  }
21855
- function phaseNamespace(job) {
22041
+ function emitNamespaceChanges(job) {
21856
22042
  for (const unit of job.units) {
21857
22043
  let activeNamespace = Namespace.HTML;
21858
22044
  for (const op of unit.create) {
@@ -21925,8 +22111,8 @@ function hyphenate(value) {
21925
22111
  return v.charAt(0) + "-" + v.charAt(1);
21926
22112
  }).toLowerCase();
21927
22113
  }
21928
- function phaseNaming(cpl) {
21929
- addNamesToView(cpl.root, cpl.componentName, { index: 0 }, cpl.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
22114
+ function nameFunctionsAndVariables(job) {
22115
+ addNamesToView(job.root, job.componentName, { index: 0 }, job.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
21930
22116
  }
21931
22117
  function addNamesToView(unit, baseName, state, compatibility) {
21932
22118
  if (unit.fnName === null) {
@@ -21945,7 +22131,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
21945
22131
  if (op.handlerFnName !== null) {
21946
22132
  break;
21947
22133
  }
21948
- if (!op.hostListener && op.targetSlot === null) {
22134
+ if (!op.hostListener && op.targetSlot.slot === null) {
21949
22135
  throw new Error(`Expected a slot to be assigned`);
21950
22136
  }
21951
22137
  let animation = "";
@@ -21956,23 +22142,36 @@ function addNamesToView(unit, baseName, state, compatibility) {
21956
22142
  if (op.hostListener) {
21957
22143
  op.handlerFnName = `${baseName}_${animation}${op.name}_HostBindingHandler`;
21958
22144
  } else {
21959
- op.handlerFnName = `${unit.fnName}_${op.tag.replace("-", "_")}_${animation}${op.name}_${op.targetSlot}_listener`;
22145
+ op.handlerFnName = `${unit.fnName}_${op.tag.replace("-", "_")}_${animation}${op.name}_${op.targetSlot.slot}_listener`;
21960
22146
  }
21961
22147
  op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
21962
22148
  break;
21963
22149
  case OpKind.Variable:
21964
22150
  varNames.set(op.xref, getVariableName(op.variable, state));
21965
22151
  break;
22152
+ case OpKind.RepeaterCreate:
22153
+ if (!(unit instanceof ViewCompilationUnit)) {
22154
+ throw new Error(`AssertionError: must be compiling a component`);
22155
+ }
22156
+ if (op.handle.slot === null) {
22157
+ throw new Error(`Expected slot to be assigned`);
22158
+ }
22159
+ if (op.emptyView !== null) {
22160
+ const emptyView = unit.job.views.get(op.emptyView);
22161
+ addNamesToView(emptyView, `${baseName}_${`${op.functionNameSuffix}Empty`}_${op.handle.slot + 2}`, state, compatibility);
22162
+ }
22163
+ addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
22164
+ break;
21966
22165
  case OpKind.Template:
21967
22166
  if (!(unit instanceof ViewCompilationUnit)) {
21968
22167
  throw new Error(`AssertionError: must be compiling a component`);
21969
22168
  }
21970
22169
  const childView = unit.job.views.get(op.xref);
21971
- if (op.slot === null) {
22170
+ if (op.handle.slot === null) {
21972
22171
  throw new Error(`Expected slot to be assigned`);
21973
22172
  }
21974
- const tagToken = op.tag === null ? "" : "_" + prefixWithNamespace(op.tag, op.namespace);
21975
- addNamesToView(childView, `${baseName}${tagToken}_${op.slot}`, state, compatibility);
22173
+ const suffix = op.functionNameSuffix.length === 0 ? "" : `_${op.functionNameSuffix}`;
22174
+ addNamesToView(childView, `${baseName}${suffix}_${op.handle.slot}`, state, compatibility);
21976
22175
  break;
21977
22176
  case OpKind.StyleProp:
21978
22177
  op.name = normalizeStylePropName(op.name);
@@ -22006,10 +22205,10 @@ function getVariableName(variable2, state) {
22006
22205
  variable2.name = `ctx_r${state.index++}`;
22007
22206
  break;
22008
22207
  case SemanticVariableKind.Identifier:
22009
- variable2.name = `${variable2.identifier}_${state.index++}`;
22208
+ variable2.name = `${variable2.identifier}_r${++state.index}`;
22010
22209
  break;
22011
22210
  default:
22012
- variable2.name = `_r${state.index++}`;
22211
+ variable2.name = `_r${++state.index}`;
22013
22212
  break;
22014
22213
  }
22015
22214
  }
@@ -22025,7 +22224,7 @@ function stripImportant(name) {
22025
22224
  }
22026
22225
  return name;
22027
22226
  }
22028
- function phaseMergeNextContext(job) {
22227
+ function mergeNextContextExpressions(job) {
22029
22228
  for (const unit of job.units) {
22030
22229
  for (const op of unit.create) {
22031
22230
  if (op.kind === OpKind.Listener) {
@@ -22070,7 +22269,7 @@ function mergeNextContextsInOps(ops) {
22070
22269
  }
22071
22270
  }
22072
22271
  var CONTAINER_TAG = "ng-container";
22073
- function phaseNgContainer(job) {
22272
+ function generateNgContainerOps(job) {
22074
22273
  for (const unit of job.units) {
22075
22274
  const updatedElementXrefs = /* @__PURE__ */ new Set();
22076
22275
  for (const op of unit.create) {
@@ -22084,14 +22283,14 @@ function phaseNgContainer(job) {
22084
22283
  }
22085
22284
  }
22086
22285
  }
22087
- function lookupElement$1(elements, xref) {
22286
+ function lookupElement(elements, xref) {
22088
22287
  const el = elements.get(xref);
22089
22288
  if (el === void 0) {
22090
22289
  throw new Error("All attributes should have an element-like target.");
22091
22290
  }
22092
22291
  return el;
22093
22292
  }
22094
- function phaseNonbindable(job) {
22293
+ function disableBindings$1(job) {
22095
22294
  const elements = /* @__PURE__ */ new Map();
22096
22295
  for (const view of job.units) {
22097
22296
  for (const op of view.create) {
@@ -22106,13 +22305,13 @@ function phaseNonbindable(job) {
22106
22305
  if ((op.kind === OpKind.ElementStart || op.kind === OpKind.ContainerStart) && op.nonBindable) {
22107
22306
  OpList.insertAfter(createDisableBindingsOp(op.xref), op);
22108
22307
  }
22109
- if ((op.kind === OpKind.ElementEnd || op.kind === OpKind.ContainerEnd) && lookupElement$1(elements, op.xref).nonBindable) {
22308
+ if ((op.kind === OpKind.ElementEnd || op.kind === OpKind.ContainerEnd) && lookupElement(elements, op.xref).nonBindable) {
22110
22309
  OpList.insertBefore(createEnableBindingsOp(op.xref), op);
22111
22310
  }
22112
22311
  }
22113
22312
  }
22114
22313
  }
22115
- function phaseNullishCoalescing(job) {
22314
+ function generateNullishCoalesceExpressions(job) {
22116
22315
  for (const unit of job.units) {
22117
22316
  for (const op of unit.ops()) {
22118
22317
  transformExpressionsInOp(op, (expr) => {
@@ -22129,20 +22328,26 @@ function phaseNullishCoalescing(job) {
22129
22328
  function kindTest(kind) {
22130
22329
  return (op) => op.kind === kind;
22131
22330
  }
22331
+ function kindWithInterpolationTest(kind, interpolation) {
22332
+ return (op) => {
22333
+ return op.kind === kind && interpolation === op.expression instanceof Interpolation;
22334
+ };
22335
+ }
22132
22336
  var CREATE_ORDERING = [
22133
22337
  { test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isAnimationListener },
22134
22338
  { test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
22135
22339
  ];
22136
22340
  var UPDATE_ORDERING = [
22137
- { test: (op) => op.kind === OpKind.HostProperty && op.expression instanceof Interpolation },
22138
- { test: (op) => op.kind === OpKind.HostProperty && !(op.expression instanceof Interpolation) },
22341
+ { test: kindWithInterpolationTest(OpKind.HostProperty, true) },
22342
+ { test: kindWithInterpolationTest(OpKind.HostProperty, false) },
22139
22343
  { test: kindTest(OpKind.StyleMap), transform: keepLast },
22140
22344
  { test: kindTest(OpKind.ClassMap), transform: keepLast },
22141
22345
  { test: kindTest(OpKind.StyleProp) },
22142
22346
  { test: kindTest(OpKind.ClassProp) },
22143
- { test: (op) => op.kind === OpKind.Property && op.expression instanceof Interpolation },
22144
- { test: (op) => op.kind === OpKind.Property && !(op.expression instanceof Interpolation) },
22145
- { test: kindTest(OpKind.Attribute) }
22347
+ { test: kindWithInterpolationTest(OpKind.Property, true) },
22348
+ { test: kindWithInterpolationTest(OpKind.Attribute, true) },
22349
+ { test: kindWithInterpolationTest(OpKind.Property, false) },
22350
+ { test: kindWithInterpolationTest(OpKind.Attribute, false) }
22146
22351
  ];
22147
22352
  var handledOpKinds = /* @__PURE__ */ new Set([
22148
22353
  OpKind.Listener,
@@ -22154,31 +22359,29 @@ var handledOpKinds = /* @__PURE__ */ new Set([
22154
22359
  OpKind.HostProperty,
22155
22360
  OpKind.Attribute
22156
22361
  ]);
22157
- function phaseOrdering(job) {
22362
+ function orderOps(job) {
22158
22363
  for (const unit of job.units) {
22159
- let opsToOrder = [];
22160
- for (const op of unit.create) {
22161
- if (handledOpKinds.has(op.kind)) {
22162
- opsToOrder.push(op);
22163
- OpList.remove(op);
22164
- } else {
22165
- OpList.insertBefore(reorder(opsToOrder, CREATE_ORDERING), op);
22166
- opsToOrder = [];
22167
- }
22168
- }
22169
- unit.create.push(reorder(opsToOrder, CREATE_ORDERING));
22170
- opsToOrder = [];
22171
- for (const op of unit.update) {
22172
- if (handledOpKinds.has(op.kind)) {
22173
- opsToOrder.push(op);
22174
- OpList.remove(op);
22175
- } else {
22176
- OpList.insertBefore(reorder(opsToOrder, UPDATE_ORDERING), op);
22177
- opsToOrder = [];
22178
- }
22364
+ orderWithin(unit.create, CREATE_ORDERING);
22365
+ orderWithin(unit.update, UPDATE_ORDERING);
22366
+ }
22367
+ }
22368
+ function orderWithin(opList, ordering) {
22369
+ let opsToOrder = [];
22370
+ let firstTargetInGroup = null;
22371
+ for (const op of opList) {
22372
+ const currentTarget = hasDependsOnSlotContextTrait(op) ? op.target : null;
22373
+ if (!handledOpKinds.has(op.kind) || currentTarget !== firstTargetInGroup && (firstTargetInGroup !== null && currentTarget !== null)) {
22374
+ OpList.insertBefore(reorder(opsToOrder, ordering), op);
22375
+ opsToOrder = [];
22376
+ firstTargetInGroup = null;
22377
+ }
22378
+ if (handledOpKinds.has(op.kind)) {
22379
+ opsToOrder.push(op);
22380
+ OpList.remove(op);
22381
+ firstTargetInGroup = currentTarget != null ? currentTarget : firstTargetInGroup;
22179
22382
  }
22180
- unit.update.push(reorder(opsToOrder, UPDATE_ORDERING));
22181
22383
  }
22384
+ opList.push(reorder(opsToOrder, ordering));
22182
22385
  }
22183
22386
  function reorder(ops, ordering) {
22184
22387
  const groups = Array.from(ordering, () => new Array());
@@ -22194,8 +22397,8 @@ function reorder(ops, ordering) {
22194
22397
  function keepLast(ops) {
22195
22398
  return ops.slice(ops.length - 1);
22196
22399
  }
22197
- function phaseParseExtractedStyles(cpl) {
22198
- for (const unit of cpl.units) {
22400
+ function parseExtractedStyles(job) {
22401
+ for (const unit of job.units) {
22199
22402
  for (const op of unit.create) {
22200
22403
  if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
22201
22404
  if (op.name === "style") {
@@ -22215,29 +22418,29 @@ function phaseParseExtractedStyles(cpl) {
22215
22418
  }
22216
22419
  }
22217
22420
  }
22218
- function phaseRemoveContentSelectors(job) {
22421
+ function removeContentSelectors(job) {
22219
22422
  for (const unit of job.units) {
22220
- const elements = getElementsByXrefId(unit);
22423
+ const elements = createOpXrefMap(unit);
22221
22424
  for (const op of unit.update) {
22222
22425
  switch (op.kind) {
22223
22426
  case OpKind.Binding:
22224
- const target = lookupElement(elements, op.target);
22427
+ const target = lookupInXrefMap(elements, op.target);
22225
22428
  if (op.name.toLowerCase() === "select" && target.kind === OpKind.Projection) {
22226
22429
  OpList.remove(op);
22227
22430
  }
22228
- continue;
22431
+ break;
22229
22432
  }
22230
22433
  }
22231
22434
  }
22232
22435
  }
22233
- function lookupElement(elements, xref) {
22234
- const el = elements.get(xref);
22436
+ function lookupInXrefMap(map, xref) {
22437
+ const el = map.get(xref);
22235
22438
  if (el === void 0) {
22236
- throw new Error("All attributes should have an element-like target.");
22439
+ throw new Error("All attributes should have an slottable target.");
22237
22440
  }
22238
22441
  return el;
22239
22442
  }
22240
- function phasePipeCreation(job) {
22443
+ function createPipes(job) {
22241
22444
  for (const unit of job.units) {
22242
22445
  processPipeBindingsInView(unit);
22243
22446
  }
@@ -22254,10 +22457,15 @@ function processPipeBindingsInView(unit) {
22254
22457
  if (flags & VisitorContextFlag.InChildOperation) {
22255
22458
  throw new Error(`AssertionError: pipe bindings should not appear in child expressions`);
22256
22459
  }
22257
- if (!hasDependsOnSlotContextTrait(updateOp)) {
22258
- throw new Error(`AssertionError: pipe binding associated with non-slot operation ${OpKind[updateOp.kind]}`);
22460
+ if (unit.job.compatibility) {
22461
+ const slotHandle = updateOp.target;
22462
+ if (slotHandle == void 0) {
22463
+ throw new Error(`AssertionError: expected slot handle to be assigned for pipe creation`);
22464
+ }
22465
+ addPipeToCreationBlock(unit, updateOp.target, expr);
22466
+ } else {
22467
+ unit.create.push(createPipeOp(expr.target, expr.targetSlot, expr.name));
22259
22468
  }
22260
- addPipeToCreationBlock(unit, updateOp.target, expr);
22261
22469
  });
22262
22470
  }
22263
22471
  }
@@ -22272,13 +22480,13 @@ function addPipeToCreationBlock(unit, afterTargetXref, binding) {
22272
22480
  while (op.next.kind === OpKind.Pipe) {
22273
22481
  op = op.next;
22274
22482
  }
22275
- const pipe2 = createPipeOp(binding.target, binding.name);
22483
+ const pipe2 = createPipeOp(binding.target, binding.targetSlot, binding.name);
22276
22484
  OpList.insertBefore(pipe2, op.next);
22277
22485
  return;
22278
22486
  }
22279
22487
  throw new Error(`AssertionError: unable to find insertion point for pipe ${binding.name}`);
22280
22488
  }
22281
- function phasePipeVariadic(job) {
22489
+ function createVariadicPipes(job) {
22282
22490
  for (const unit of job.units) {
22283
22491
  for (const op of unit.update) {
22284
22492
  transformExpressionsInOp(op, (expr) => {
@@ -22288,12 +22496,12 @@ function phasePipeVariadic(job) {
22288
22496
  if (expr.args.length <= 4) {
22289
22497
  return expr;
22290
22498
  }
22291
- return new PipeBindingVariadicExpr(expr.target, expr.name, literalArr(expr.args), expr.args.length);
22499
+ return new PipeBindingVariadicExpr(expr.target, expr.targetSlot, expr.name, literalArr(expr.args), expr.args.length);
22292
22500
  }, VisitorContextFlag.None);
22293
22501
  }
22294
22502
  }
22295
22503
  }
22296
- function phasePropagateI18nBlocks(job) {
22504
+ function propagateI18nBlocks(job) {
22297
22505
  propagateI18nBlocksToTemplates(job.root, 0);
22298
22506
  }
22299
22507
  function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
@@ -22328,7 +22536,48 @@ function wrapTemplateWithI18n(unit, parentI18n) {
22328
22536
  OpList.insertBefore(createI18nEndOp(id), unit.create.tail);
22329
22537
  }
22330
22538
  }
22331
- function phasePureFunctionExtraction(job) {
22539
+ function propogateI18nPlaceholders(job) {
22540
+ const i18nOps = /* @__PURE__ */ new Map();
22541
+ const extractedMessageOps = /* @__PURE__ */ new Map();
22542
+ for (const unit of job.units) {
22543
+ for (const op of unit.create) {
22544
+ switch (op.kind) {
22545
+ case OpKind.I18nStart:
22546
+ i18nOps.set(op.xref, op);
22547
+ break;
22548
+ case OpKind.ExtractedMessage:
22549
+ extractedMessageOps.set(op.owner, op);
22550
+ break;
22551
+ }
22552
+ }
22553
+ }
22554
+ for (const [xref, childExtractedMessageOp] of extractedMessageOps) {
22555
+ if (!childExtractedMessageOp.isRoot) {
22556
+ const i18nOp = i18nOps.get(xref);
22557
+ if (i18nOp === void 0) {
22558
+ throw Error("Could not find owner i18n block for extracted message.");
22559
+ }
22560
+ const rootExtractedMessageOp = extractedMessageOps.get(i18nOp.root);
22561
+ if (rootExtractedMessageOp === void 0) {
22562
+ throw Error("Could not find extracted message op for root i18n block.");
22563
+ }
22564
+ mergeParams(rootExtractedMessageOp.params, childExtractedMessageOp.params);
22565
+ mergeParams(rootExtractedMessageOp.postprocessingParams, childExtractedMessageOp.postprocessingParams);
22566
+ }
22567
+ }
22568
+ }
22569
+ function mergeParams(to, from) {
22570
+ for (const [placeholder, fromValues] of from) {
22571
+ const toValues = to.get(placeholder) || [];
22572
+ const flags = fromValues[0].flags;
22573
+ if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
22574
+ to.set(placeholder, [...fromValues, ...toValues]);
22575
+ } else {
22576
+ to.set(placeholder, [...toValues, ...fromValues]);
22577
+ }
22578
+ }
22579
+ }
22580
+ function extractPureFunctions(job) {
22332
22581
  for (const view of job.units) {
22333
22582
  for (const op of view.ops()) {
22334
22583
  visitExpressionsInOp(op, (expr) => {
@@ -22368,9 +22617,9 @@ var PureFunctionConstant = class extends GenericKeyFn {
22368
22617
  return new DeclareVarStmt(declName, new ArrowFunctionExpr(fnParams, returnExpr), void 0, StmtModifier.Final);
22369
22618
  }
22370
22619
  };
22371
- function phasePureLiteralStructures(job) {
22372
- for (const view of job.units) {
22373
- for (const op of view.update) {
22620
+ function generatePureLiteralStructures(job) {
22621
+ for (const unit of job.units) {
22622
+ for (const op of unit.update) {
22374
22623
  transformExpressionsInOp(op, (expr, flags) => {
22375
22624
  if (flags & VisitorContextFlag.InChildOperation) {
22376
22625
  return expr;
@@ -22522,7 +22771,7 @@ function text(slot, initialValue, sourceSpan) {
22522
22771
  }
22523
22772
  return call(Identifiers.text, args, sourceSpan);
22524
22773
  }
22525
- function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfigIndex, placeholderConfigIndex, sourceSpan) {
22774
+ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan) {
22526
22775
  const args = [
22527
22776
  literal(selfSlot),
22528
22777
  literal(primarySlot),
@@ -22530,29 +22779,53 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
22530
22779
  literal(loadingSlot),
22531
22780
  literal(placeholderSlot),
22532
22781
  literal(errorSlot),
22533
- literal(loadingConfigIndex),
22534
- literal(placeholderConfigIndex)
22782
+ loadingConfig != null ? loadingConfig : literal(null),
22783
+ placeholderConfig != null ? placeholderConfig : literal(null),
22784
+ enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal(null)
22535
22785
  ];
22536
- while (args[args.length - 1].value === null) {
22786
+ let expr;
22787
+ while ((expr = args[args.length - 1]) !== null && expr instanceof LiteralExpr && expr.value === null) {
22537
22788
  args.pop();
22538
22789
  }
22539
22790
  return call(Identifiers.defer, args, sourceSpan);
22540
22791
  }
22541
- function deferOn(sourceSpan) {
22542
- return call(Identifiers.deferOnIdle, [], sourceSpan);
22792
+ var deferTriggerToR3TriggerInstructionsMap = /* @__PURE__ */ new Map([
22793
+ [DeferTriggerKind.Idle, [Identifiers.deferOnIdle, Identifiers.deferPrefetchOnIdle]],
22794
+ [
22795
+ DeferTriggerKind.Immediate,
22796
+ [Identifiers.deferOnImmediate, Identifiers.deferPrefetchOnImmediate]
22797
+ ],
22798
+ [DeferTriggerKind.Timer, [Identifiers.deferOnTimer, Identifiers.deferPrefetchOnTimer]],
22799
+ [DeferTriggerKind.Hover, [Identifiers.deferOnHover, Identifiers.deferPrefetchOnHover]],
22800
+ [
22801
+ DeferTriggerKind.Interaction,
22802
+ [Identifiers.deferOnInteraction, Identifiers.deferPrefetchOnInteraction]
22803
+ ],
22804
+ [
22805
+ DeferTriggerKind.Viewport,
22806
+ [Identifiers.deferOnViewport, Identifiers.deferPrefetchOnViewport]
22807
+ ]
22808
+ ]);
22809
+ function deferOn(trigger, args, prefetch, sourceSpan) {
22810
+ const instructions = deferTriggerToR3TriggerInstructionsMap.get(trigger);
22811
+ if (instructions === void 0) {
22812
+ throw new Error(`Unable to determine instruction for trigger ${trigger}`);
22813
+ }
22814
+ const instructionToCall = prefetch ? instructions[1] : instructions[0];
22815
+ return call(instructionToCall, args.map((a) => literal(a)), sourceSpan);
22543
22816
  }
22544
22817
  function projectionDef(def) {
22545
22818
  return call(Identifiers.projectionDef, def ? [def] : [], null);
22546
22819
  }
22547
- function projection(slot, projectionSlotIndex, attributes) {
22820
+ function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
22548
22821
  const args = [literal(slot)];
22549
- if (projectionSlotIndex !== 0 || attributes !== null) {
22822
+ if (projectionSlotIndex !== 0 || attributes.length > 0) {
22550
22823
  args.push(literal(projectionSlotIndex));
22551
- if (attributes != null) {
22552
- args.push(literal(attributes));
22824
+ if (attributes.length > 0) {
22825
+ args.push(literalArr(attributes.map((attr) => literal(attr))));
22553
22826
  }
22554
22827
  }
22555
- return call(Identifiers.projection, args, null);
22828
+ return call(Identifiers.projection, args, sourceSpan);
22556
22829
  }
22557
22830
  function i18nStart(slot, constIndex, subTemplateIndex) {
22558
22831
  const args = [literal(slot), literal(constIndex)];
@@ -22561,6 +22834,27 @@ function i18nStart(slot, constIndex, subTemplateIndex) {
22561
22834
  }
22562
22835
  return call(Identifiers.i18nStart, args, null);
22563
22836
  }
22837
+ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, sourceSpan) {
22838
+ const args = [
22839
+ literal(slot),
22840
+ variable(viewFnName),
22841
+ literal(decls),
22842
+ literal(vars),
22843
+ literal(tag),
22844
+ literal(constIndex),
22845
+ trackByFn
22846
+ ];
22847
+ if (trackByUsesComponentInstance || emptyViewFnName !== null) {
22848
+ args.push(literal(trackByUsesComponentInstance));
22849
+ if (emptyViewFnName !== null) {
22850
+ args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
22851
+ }
22852
+ }
22853
+ return call(Identifiers.repeaterCreate, args, sourceSpan);
22854
+ }
22855
+ function repeater(metadataSlot, collection, sourceSpan) {
22856
+ return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
22857
+ }
22564
22858
  function i18n(slot, constIndex, subTemplateIndex) {
22565
22859
  const args = [literal(slot), literal(constIndex)];
22566
22860
  if (subTemplateIndex) {
@@ -22874,53 +23168,53 @@ var sanitizerIdentifierMap = /* @__PURE__ */ new Map([
22874
23168
  [SanitizerFn.Style, Identifiers.sanitizeStyle],
22875
23169
  [SanitizerFn.Url, Identifiers.sanitizeUrl]
22876
23170
  ]);
22877
- function phaseReify(cpl) {
22878
- for (const unit of cpl.units) {
23171
+ function reify(job) {
23172
+ for (const unit of job.units) {
22879
23173
  reifyCreateOperations(unit, unit.create);
22880
23174
  reifyUpdateOperations(unit, unit.update);
22881
23175
  }
22882
23176
  }
22883
23177
  function reifyCreateOperations(unit, ops) {
22884
- var _a2, _b2, _c2, _d2;
23178
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
22885
23179
  for (const op of ops) {
22886
23180
  transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
22887
23181
  switch (op.kind) {
22888
23182
  case OpKind.Text:
22889
- OpList.replace(op, text(op.slot, op.initialValue, op.sourceSpan));
23183
+ OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
22890
23184
  break;
22891
23185
  case OpKind.ElementStart:
22892
- OpList.replace(op, elementStart(op.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
23186
+ OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
22893
23187
  break;
22894
23188
  case OpKind.Element:
22895
- OpList.replace(op, element(op.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
23189
+ OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
22896
23190
  break;
22897
23191
  case OpKind.ElementEnd:
22898
23192
  OpList.replace(op, elementEnd(op.sourceSpan));
22899
23193
  break;
22900
23194
  case OpKind.ContainerStart:
22901
- OpList.replace(op, elementContainerStart(op.slot, op.attributes, op.localRefs, op.sourceSpan));
23195
+ OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
22902
23196
  break;
22903
23197
  case OpKind.Container:
22904
- OpList.replace(op, elementContainer(op.slot, op.attributes, op.localRefs, op.sourceSpan));
23198
+ OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
22905
23199
  break;
22906
23200
  case OpKind.ContainerEnd:
22907
23201
  OpList.replace(op, elementContainerEnd());
22908
23202
  break;
22909
23203
  case OpKind.I18nStart:
22910
- OpList.replace(op, i18nStart(op.slot, op.messageIndex, op.subTemplateIndex));
23204
+ OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex));
22911
23205
  break;
22912
23206
  case OpKind.I18nEnd:
22913
23207
  OpList.replace(op, i18nEnd());
22914
23208
  break;
22915
23209
  case OpKind.I18n:
22916
- OpList.replace(op, i18n(op.slot, op.messageIndex, op.subTemplateIndex));
23210
+ OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
22917
23211
  break;
22918
23212
  case OpKind.Template:
22919
23213
  if (!(unit instanceof ViewCompilationUnit)) {
22920
23214
  throw new Error(`AssertionError: must be compiling a component`);
22921
23215
  }
22922
23216
  const childView = unit.job.views.get(op.xref);
22923
- OpList.replace(op, template(op.slot, variable(childView.fnName), childView.decls, childView.vars, op.block ? null : op.tag, op.attributes, op.sourceSpan));
23217
+ OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.sourceSpan));
22924
23218
  break;
22925
23219
  case OpKind.DisableBindings:
22926
23220
  OpList.replace(op, disableBindings());
@@ -22929,7 +23223,7 @@ function reifyCreateOperations(unit, ops) {
22929
23223
  OpList.replace(op, enableBindings());
22930
23224
  break;
22931
23225
  case OpKind.Pipe:
22932
- OpList.replace(op, pipe(op.slot, op.name));
23226
+ OpList.replace(op, pipe(op.handle.slot, op.name));
22933
23227
  break;
22934
23228
  case OpKind.Listener:
22935
23229
  const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
@@ -22956,22 +23250,70 @@ function reifyCreateOperations(unit, ops) {
22956
23250
  }
22957
23251
  break;
22958
23252
  case OpKind.Defer:
22959
- OpList.replace(op, defer(op.slot, op.targetSlot, null, op.loading && op.loading.targetSlot, op.placeholder && op.placeholder.targetSlot, op.error && op.error.targetSlot, (_b2 = (_a2 = op.loading) == null ? void 0 : _a2.constIndex) != null ? _b2 : null, (_d2 = (_c2 = op.placeholder) == null ? void 0 : _c2.constIndex) != null ? _d2 : null, op.sourceSpan));
22960
- break;
22961
- case OpKind.DeferSecondaryBlock:
22962
- OpList.remove(op);
23253
+ const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
23254
+ OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, null, (_b2 = (_a2 = op.loadingSlot) == null ? void 0 : _a2.slot) != null ? _b2 : null, (_d2 = (_c2 = op.placeholderSlot) == null ? void 0 : _c2.slot) != null ? _d2 : null, (_f2 = (_e2 = op.errorSlot) == null ? void 0 : _e2.slot) != null ? _f2 : null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan));
22963
23255
  break;
22964
23256
  case OpKind.DeferOn:
22965
- OpList.replace(op, deferOn(op.sourceSpan));
23257
+ let args = [];
23258
+ switch (op.trigger.kind) {
23259
+ case DeferTriggerKind.Idle:
23260
+ case DeferTriggerKind.Immediate:
23261
+ break;
23262
+ case DeferTriggerKind.Timer:
23263
+ args = [op.trigger.delay];
23264
+ break;
23265
+ case DeferTriggerKind.Interaction:
23266
+ case DeferTriggerKind.Hover:
23267
+ case DeferTriggerKind.Viewport:
23268
+ if (((_g = op.trigger.targetSlot) == null ? void 0 : _g.slot) == null || op.trigger.targetSlotViewSteps === null) {
23269
+ throw new Error(`Slot or view steps not set in trigger reification for trigger kind ${op.trigger.kind}`);
23270
+ }
23271
+ args = [op.trigger.targetSlot.slot];
23272
+ if (op.trigger.targetSlotViewSteps !== 0) {
23273
+ args.push(op.trigger.targetSlotViewSteps);
23274
+ }
23275
+ break;
23276
+ default:
23277
+ throw new Error(`AssertionError: Unsupported reification of defer trigger kind ${op.trigger.kind}`);
23278
+ }
23279
+ OpList.replace(op, deferOn(op.trigger.kind, args, op.prefetch, op.sourceSpan));
22966
23280
  break;
22967
23281
  case OpKind.ProjectionDef:
22968
23282
  OpList.replace(op, projectionDef(op.def));
22969
23283
  break;
22970
23284
  case OpKind.Projection:
22971
- if (op.slot === null) {
23285
+ if (op.handle.slot === null) {
22972
23286
  throw new Error("No slot was assigned for project instruction");
22973
23287
  }
22974
- OpList.replace(op, projection(op.slot, op.projectionSlotIndex, op.attributes));
23288
+ OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, op.sourceSpan));
23289
+ break;
23290
+ case OpKind.RepeaterCreate:
23291
+ if (op.handle.slot === null) {
23292
+ throw new Error("No slot was assigned for repeater instruction");
23293
+ }
23294
+ if (!(unit instanceof ViewCompilationUnit)) {
23295
+ throw new Error(`AssertionError: must be compiling a component`);
23296
+ }
23297
+ const repeaterView = unit.job.views.get(op.xref);
23298
+ if (repeaterView.fnName === null) {
23299
+ throw new Error(`AssertionError: expected repeater primary view to have been named`);
23300
+ }
23301
+ let emptyViewFnName = null;
23302
+ let emptyDecls = null;
23303
+ let emptyVars = null;
23304
+ if (op.emptyView !== null) {
23305
+ const emptyView = unit.job.views.get(op.emptyView);
23306
+ if (emptyView === void 0) {
23307
+ throw new Error("AssertionError: repeater had empty view xref, but empty view was not found");
23308
+ }
23309
+ if (emptyView.fnName === null || emptyView.decls === null || emptyView.vars === null) {
23310
+ throw new Error(`AssertionError: expected repeater empty view to have been named and counted`);
23311
+ }
23312
+ emptyViewFnName = emptyView.fnName;
23313
+ emptyDecls = emptyView.decls;
23314
+ emptyVars = emptyView.vars;
23315
+ }
23316
+ OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.sourceSpan));
22975
23317
  break;
22976
23318
  case OpKind.Statement:
22977
23319
  break;
@@ -23022,7 +23364,7 @@ function reifyUpdateOperations(_unit, ops) {
23022
23364
  OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
23023
23365
  break;
23024
23366
  case OpKind.I18nApply:
23025
- OpList.replace(op, i18nApply(op.targetSlot, op.sourceSpan));
23367
+ OpList.replace(op, i18nApply(op.targetSlot.slot, op.sourceSpan));
23026
23368
  break;
23027
23369
  case OpKind.InterpolateText:
23028
23370
  OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
@@ -23055,10 +23397,13 @@ function reifyUpdateOperations(_unit, ops) {
23055
23397
  if (op.processed === null) {
23056
23398
  throw new Error(`Conditional test was not set.`);
23057
23399
  }
23058
- if (op.targetSlot === null) {
23400
+ if (op.targetSlot.slot === null) {
23059
23401
  throw new Error(`Conditional slot was not set.`);
23060
23402
  }
23061
- OpList.replace(op, conditional(op.targetSlot, op.processed, op.contextValue, op.sourceSpan));
23403
+ OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
23404
+ break;
23405
+ case OpKind.Repeater:
23406
+ OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
23062
23407
  break;
23063
23408
  case OpKind.Statement:
23064
23409
  break;
@@ -23075,7 +23420,7 @@ function reifyIrExpression(expr) {
23075
23420
  case ExpressionKind.NextContext:
23076
23421
  return nextContext(expr.steps);
23077
23422
  case ExpressionKind.Reference:
23078
- return reference(expr.targetSlot + 1 + expr.offset);
23423
+ return reference(expr.targetSlot.slot + 1 + expr.offset);
23079
23424
  case ExpressionKind.LexicalRead:
23080
23425
  throw new Error(`AssertionError: unresolved LexicalRead of ${expr.name}`);
23081
23426
  case ExpressionKind.RestoreView:
@@ -23110,13 +23455,13 @@ function reifyIrExpression(expr) {
23110
23455
  case ExpressionKind.PureFunctionParameterExpr:
23111
23456
  throw new Error(`AssertionError: expected PureFunctionParameterExpr to have been extracted`);
23112
23457
  case ExpressionKind.PipeBinding:
23113
- return pipeBind(expr.targetSlot, expr.varOffset, expr.args);
23458
+ return pipeBind(expr.targetSlot.slot, expr.varOffset, expr.args);
23114
23459
  case ExpressionKind.PipeBindingVariadic:
23115
- return pipeBindV(expr.targetSlot, expr.varOffset, expr.args);
23460
+ return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
23116
23461
  case ExpressionKind.SanitizerExpr:
23117
23462
  return importExpr(sanitizerIdentifierMap.get(expr.fn));
23118
23463
  case ExpressionKind.SlotLiteralExpr:
23119
- return literal(expr.targetSlot);
23464
+ return literal(expr.slot.slot);
23120
23465
  default:
23121
23466
  throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${ExpressionKind[expr.kind]}`);
23122
23467
  }
@@ -23136,7 +23481,7 @@ function reifyListenerHandler(unit, name, handlerOps, consumesDollarEvent) {
23136
23481
  }
23137
23482
  return fn(params, handlerStmts, void 0, void 0, name);
23138
23483
  }
23139
- function phaseRemoveEmptyBindings(job) {
23484
+ function removeEmptyBindings(job) {
23140
23485
  for (const unit of job.units) {
23141
23486
  for (const op of unit.update) {
23142
23487
  switch (op.kind) {
@@ -23155,8 +23500,38 @@ function phaseRemoveEmptyBindings(job) {
23155
23500
  }
23156
23501
  }
23157
23502
  }
23158
- function phaseResolveContexts(cpl) {
23159
- for (const unit of cpl.units) {
23503
+ function generateRepeaterDerivedVars(job) {
23504
+ const repeaters = /* @__PURE__ */ new Map();
23505
+ for (const unit of job.units) {
23506
+ for (const op of unit.ops()) {
23507
+ if (op.kind === OpKind.RepeaterCreate) {
23508
+ repeaters.set(op.xref, op);
23509
+ }
23510
+ }
23511
+ }
23512
+ for (const unit of job.units) {
23513
+ for (const op of unit.ops()) {
23514
+ transformExpressionsInOp(op, (expr) => {
23515
+ if (!(expr instanceof DerivedRepeaterVarExpr)) {
23516
+ return expr;
23517
+ }
23518
+ const repeaterOp = repeaters.get(expr.xref);
23519
+ switch (expr.identity) {
23520
+ case DerivedRepeaterVarIdentity.First:
23521
+ return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), literal(0));
23522
+ case DerivedRepeaterVarIdentity.Last:
23523
+ return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), new BinaryOperatorExpr(BinaryOperator.Minus, new LexicalReadExpr(repeaterOp.varNames.$count), literal(1)));
23524
+ case DerivedRepeaterVarIdentity.Even:
23525
+ return new BinaryOperatorExpr(BinaryOperator.Identical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
23526
+ case DerivedRepeaterVarIdentity.Odd:
23527
+ return new BinaryOperatorExpr(BinaryOperator.NotIdentical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
23528
+ }
23529
+ }, VisitorContextFlag.None);
23530
+ }
23531
+ }
23532
+ }
23533
+ function resolveContexts(job) {
23534
+ for (const unit of job.units) {
23160
23535
  processLexicalScope$1(unit, unit.create);
23161
23536
  processLexicalScope$1(unit, unit.update);
23162
23537
  }
@@ -23178,6 +23553,9 @@ function processLexicalScope$1(view, ops) {
23178
23553
  break;
23179
23554
  }
23180
23555
  }
23556
+ if (view === view.job.root) {
23557
+ scope.set(view.xref, variable("ctx"));
23558
+ }
23181
23559
  for (const op of ops) {
23182
23560
  transformExpressionsInOp(op, (expr) => {
23183
23561
  if (expr instanceof ContextExpr) {
@@ -23191,13 +23569,13 @@ function processLexicalScope$1(view, ops) {
23191
23569
  }, VisitorContextFlag.None);
23192
23570
  }
23193
23571
  }
23194
- function phaseResolveDollarEvent(job) {
23572
+ function resolveDollarEvent(job) {
23195
23573
  for (const unit of job.units) {
23196
- resolveDollarEvent(unit, unit.create);
23197
- resolveDollarEvent(unit, unit.update);
23574
+ transformDollarEvent(unit, unit.create);
23575
+ transformDollarEvent(unit, unit.update);
23198
23576
  }
23199
23577
  }
23200
- function resolveDollarEvent(unit, ops) {
23578
+ function transformDollarEvent(unit, ops) {
23201
23579
  for (const op of ops) {
23202
23580
  if (op.kind === OpKind.Listener) {
23203
23581
  transformExpressionsInOp(op, (expr) => {
@@ -23210,173 +23588,73 @@ function resolveDollarEvent(unit, ops) {
23210
23588
  }
23211
23589
  }
23212
23590
  }
23213
- var ESCAPE = "\uFFFD";
23214
- var ELEMENT_MARKER = "#";
23215
- var TEMPLATE_MARKER = "*";
23216
- var TAG_CLOSE_MARKER = "/";
23217
- var CONTEXT_MARKER = ":";
23218
- var LIST_START_MARKER = "[";
23219
- var LIST_END_MARKER = "]";
23220
- var LIST_DELIMITER = "|";
23221
- var I18nParamValueFlags;
23222
- (function(I18nParamValueFlags2) {
23223
- I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
23224
- I18nParamValueFlags2[I18nParamValueFlags2["ElementTag"] = 1] = "ElementTag";
23225
- I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
23226
- I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
23227
- I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
23228
- })(I18nParamValueFlags || (I18nParamValueFlags = {}));
23229
- var I18nPlaceholderParams = class {
23230
- constructor() {
23231
- this.values = /* @__PURE__ */ new Map();
23232
- }
23233
- addValue(placeholder, value, subTemplateIndex, resolutionTime, flags) {
23234
- var _a2;
23235
- const placeholderValues = (_a2 = this.values.get(placeholder)) != null ? _a2 : [];
23236
- placeholderValues.push({ value, subTemplateIndex, resolutionTime, flags });
23237
- this.values.set(placeholder, placeholderValues);
23238
- }
23239
- saveToOp(op) {
23240
- for (const [placeholder, placeholderValues] of this.values) {
23241
- const creationValues = placeholderValues.filter(({ resolutionTime }) => resolutionTime === I18nParamResolutionTime.Creation);
23242
- if (creationValues.length > 1) {
23243
- op.needsPostprocessing = true;
23244
- }
23245
- const serializedCreationValues = this.serializeValues(creationValues);
23246
- if (serializedCreationValues !== null) {
23247
- op.params.set(placeholder, literal(serializedCreationValues));
23248
- }
23249
- const serializedPostprocessingValues = this.serializeValues(placeholderValues.filter(({ resolutionTime }) => resolutionTime === I18nParamResolutionTime.Postproccessing));
23250
- if (serializedPostprocessingValues !== null) {
23251
- op.needsPostprocessing = true;
23252
- op.postprocessingParams.set(placeholder, literal(serializedPostprocessingValues));
23253
- }
23254
- }
23255
- }
23256
- merge(other) {
23257
- for (const [placeholder, otherValues] of other.values) {
23258
- const currentValues = this.values.get(placeholder) || [];
23259
- const flags = otherValues[0].flags;
23260
- if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
23261
- this.values.set(placeholder, [...otherValues, ...currentValues]);
23262
- } else {
23263
- this.values.set(placeholder, [...currentValues, ...otherValues]);
23264
- }
23265
- }
23266
- }
23267
- serializeValues(values) {
23268
- if (values.length === 0) {
23269
- return null;
23270
- }
23271
- const serializedValues = values.map((value) => this.serializeValue(value));
23272
- return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
23273
- }
23274
- serializeValue(value) {
23275
- let tagMarker = "";
23276
- let closeMarker = "";
23277
- if (value.flags & I18nParamValueFlags.ElementTag) {
23278
- tagMarker = ELEMENT_MARKER;
23279
- } else if (value.flags & I18nParamValueFlags.TemplateTag) {
23280
- tagMarker = TEMPLATE_MARKER;
23281
- }
23282
- if (tagMarker !== "") {
23283
- closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
23284
- }
23285
- const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
23286
- if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
23287
- return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
23288
- }
23289
- return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
23290
- }
23291
- };
23292
- function phaseResolveI18nPlaceholders(job) {
23293
- const params = /* @__PURE__ */ new Map();
23294
- const i18nOps = /* @__PURE__ */ new Map();
23295
- resolvePlaceholders(job, params, i18nOps);
23296
- propagatePlaceholders(params, i18nOps);
23297
- for (const [xref, i18nOpParams] of params) {
23298
- i18nOpParams.saveToOp(i18nOps.get(xref));
23299
- }
23300
- for (const op of i18nOps.values()) {
23301
- if (op.xref === op.root) {
23302
- for (const placeholder in op.message.placeholders) {
23303
- if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
23304
- throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
23305
- }
23591
+ function resolveI18nElementPlaceholders(job) {
23592
+ const extractedMessageOps = /* @__PURE__ */ new Map();
23593
+ const elements = /* @__PURE__ */ new Map();
23594
+ for (const unit of job.units) {
23595
+ for (const op of unit.create) {
23596
+ switch (op.kind) {
23597
+ case OpKind.ExtractedMessage:
23598
+ extractedMessageOps.set(op.owner, op);
23599
+ break;
23600
+ case OpKind.ElementStart:
23601
+ elements.set(op.xref, op);
23602
+ break;
23306
23603
  }
23307
23604
  }
23308
23605
  }
23309
- }
23310
- function resolvePlaceholders(job, params, i18nOps) {
23311
23606
  for (const unit of job.units) {
23312
- const elements = /* @__PURE__ */ new Map();
23313
- let currentI18nOp = null;
23607
+ let currentOps = null;
23314
23608
  for (const op of unit.create) {
23315
23609
  switch (op.kind) {
23316
23610
  case OpKind.I18nStart:
23317
- i18nOps.set(op.xref, op);
23318
- currentI18nOp = op.kind === OpKind.I18nStart ? op : null;
23611
+ if (!extractedMessageOps.has(op.xref)) {
23612
+ throw Error("Could not find extracted message for i18n op");
23613
+ }
23614
+ currentOps = { i18n: op, extractedMessage: extractedMessageOps.get(op.xref) };
23319
23615
  break;
23320
23616
  case OpKind.I18nEnd:
23321
- currentI18nOp = null;
23617
+ currentOps = null;
23322
23618
  break;
23323
23619
  case OpKind.ElementStart:
23324
23620
  if (op.i18nPlaceholder !== void 0) {
23325
- if (currentI18nOp === null) {
23621
+ if (currentOps === null) {
23326
23622
  throw Error("i18n tag placeholder should only occur inside an i18n block");
23327
23623
  }
23328
- elements.set(op.xref, op);
23329
23624
  const { startName, closeName } = op.i18nPlaceholder;
23330
23625
  let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
23331
23626
  if (closeName === "") {
23332
23627
  flags |= I18nParamValueFlags.CloseTag;
23333
23628
  }
23334
- addParam(params, currentI18nOp, startName, op.slot, currentI18nOp.subTemplateIndex, I18nParamResolutionTime.Creation, flags);
23629
+ addParam(currentOps.extractedMessage.params, startName, op.handle.slot, currentOps.i18n.subTemplateIndex, flags);
23335
23630
  }
23336
23631
  break;
23337
23632
  case OpKind.ElementEnd:
23338
23633
  const startOp = elements.get(op.xref);
23339
23634
  if (startOp && startOp.i18nPlaceholder !== void 0) {
23340
- if (currentI18nOp === null) {
23635
+ if (currentOps === null) {
23341
23636
  throw Error("i18n tag placeholder should only occur inside an i18n block");
23342
23637
  }
23343
23638
  const { closeName } = startOp.i18nPlaceholder;
23344
23639
  if (closeName !== "") {
23345
- addParam(params, currentI18nOp, closeName, startOp.slot, currentI18nOp.subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
23640
+ addParam(currentOps.extractedMessage.params, closeName, startOp.handle.slot, currentOps.i18n.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
23346
23641
  }
23347
23642
  }
23348
23643
  break;
23349
23644
  case OpKind.Template:
23350
23645
  if (op.i18nPlaceholder !== void 0) {
23351
- if (currentI18nOp === null) {
23646
+ if (currentOps === null) {
23352
23647
  throw Error("i18n tag placeholder should only occur inside an i18n block");
23353
23648
  }
23354
- const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentI18nOp, op);
23355
- addParam(params, currentI18nOp, op.i18nPlaceholder.startName, op.slot, subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.TemplateTag);
23356
- addParam(params, currentI18nOp, op.i18nPlaceholder.closeName, op.slot, subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
23649
+ const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18n, op);
23650
+ addParam(currentOps.extractedMessage.params, op.i18nPlaceholder.startName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag);
23651
+ addParam(currentOps.extractedMessage.params, op.i18nPlaceholder.closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
23357
23652
  }
23358
23653
  break;
23359
23654
  }
23360
23655
  }
23361
- const i18nBlockPlaceholderIndices = /* @__PURE__ */ new Map();
23362
- for (const op of unit.update) {
23363
- if (op.kind === OpKind.I18nExpression) {
23364
- const i18nOp = i18nOps.get(op.owner);
23365
- let index2 = i18nBlockPlaceholderIndices.get(op.owner) || 0;
23366
- if (!i18nOp) {
23367
- throw Error("Cannot find corresponding i18nStart for i18nExpr");
23368
- }
23369
- addParam(params, i18nOp, op.i18nPlaceholder, index2++, i18nOp.subTemplateIndex, op.resolutionTime);
23370
- i18nBlockPlaceholderIndices.set(op.owner, index2);
23371
- }
23372
- }
23373
23656
  }
23374
23657
  }
23375
- function addParam(params, i18nOp, placeholder, value, subTemplateIndex, resolutionTime, flags = I18nParamValueFlags.None) {
23376
- const i18nOpParams = params.get(i18nOp.xref) || new I18nPlaceholderParams();
23377
- i18nOpParams.addValue(placeholder, value, subTemplateIndex, resolutionTime, flags);
23378
- params.set(i18nOp.xref, i18nOpParams);
23379
- }
23380
23658
  function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
23381
23659
  for (const childOp of job.views.get(op.xref).create) {
23382
23660
  if (childOp.kind === OpKind.I18nStart) {
@@ -23385,17 +23663,55 @@ function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
23385
23663
  }
23386
23664
  return i18nOp.subTemplateIndex;
23387
23665
  }
23388
- function propagatePlaceholders(params, i18nOps) {
23389
- for (const [xref, opParams] of params) {
23390
- const op = i18nOps.get(xref);
23391
- if (op.xref !== op.root) {
23392
- const rootParams = params.get(op.root) || new I18nPlaceholderParams();
23393
- rootParams.merge(opParams);
23666
+ function addParam(params, placeholder, value, subTemplateIndex, flags = I18nParamValueFlags.None) {
23667
+ var _a2;
23668
+ const values = (_a2 = params.get(placeholder)) != null ? _a2 : [];
23669
+ values.push({ value, subTemplateIndex, flags });
23670
+ params.set(placeholder, values);
23671
+ }
23672
+ function resolveI18nExpressionPlaceholders(job) {
23673
+ const i18nOps = /* @__PURE__ */ new Map();
23674
+ const extractedMessageOps = /* @__PURE__ */ new Map();
23675
+ for (const unit of job.units) {
23676
+ for (const op of unit.create) {
23677
+ switch (op.kind) {
23678
+ case OpKind.I18nStart:
23679
+ i18nOps.set(op.xref, op);
23680
+ break;
23681
+ case OpKind.ExtractedMessage:
23682
+ extractedMessageOps.set(op.owner, op);
23683
+ break;
23684
+ }
23685
+ }
23686
+ }
23687
+ const expressionIndices = /* @__PURE__ */ new Map();
23688
+ for (const unit of job.units) {
23689
+ for (const op of unit.update) {
23690
+ if (op.kind === OpKind.I18nExpression) {
23691
+ const i18nOp = i18nOps.get(op.owner);
23692
+ let index2 = expressionIndices.get(op.owner) || 0;
23693
+ if (!i18nOp) {
23694
+ throw Error("Cannot find corresponding i18n block for i18nExpr");
23695
+ }
23696
+ const extractedMessageOp = extractedMessageOps.get(i18nOp.xref);
23697
+ if (!extractedMessageOp) {
23698
+ throw Error("Cannot find extracted message for i18n block");
23699
+ }
23700
+ const params = op.resolutionTime === I18nParamResolutionTime.Creation ? extractedMessageOp.params : extractedMessageOp.postprocessingParams;
23701
+ const values = params.get(op.i18nPlaceholder) || [];
23702
+ values.push({
23703
+ value: index2,
23704
+ subTemplateIndex: i18nOp.subTemplateIndex,
23705
+ flags: I18nParamValueFlags.None
23706
+ });
23707
+ params.set(op.i18nPlaceholder, values);
23708
+ expressionIndices.set(op.owner, index2 + 1);
23709
+ }
23394
23710
  }
23395
23711
  }
23396
23712
  }
23397
- function phaseResolveNames(cpl) {
23398
- for (const unit of cpl.units) {
23713
+ function resolveNames(job) {
23714
+ for (const unit of job.units) {
23399
23715
  processLexicalScope(unit, unit.create, null);
23400
23716
  processLexicalScope(unit, unit.update, null);
23401
23717
  }
@@ -23407,6 +23723,7 @@ function processLexicalScope(unit, ops, savedView) {
23407
23723
  case OpKind.Variable:
23408
23724
  switch (op.variable.kind) {
23409
23725
  case SemanticVariableKind.Identifier:
23726
+ case SemanticVariableKind.Alias:
23410
23727
  if (scope.has(op.variable.identifier)) {
23411
23728
  continue;
23412
23729
  }
@@ -23462,9 +23779,9 @@ var sanitizers = /* @__PURE__ */ new Map([
23462
23779
  [SecurityContext.URL, SanitizerFn.Url],
23463
23780
  [SecurityContext.RESOURCE_URL, SanitizerFn.ResourceUrl]
23464
23781
  ]);
23465
- function phaseResolveSanitizers(job) {
23782
+ function resolveSanitizers(job) {
23466
23783
  for (const unit of job.units) {
23467
- const elements = getElementsByXrefId(unit);
23784
+ const elements = createOpXrefMap(unit);
23468
23785
  let sanitizerFn;
23469
23786
  for (const op of unit.update) {
23470
23787
  switch (op.kind) {
@@ -23474,7 +23791,7 @@ function phaseResolveSanitizers(job) {
23474
23791
  op.sanitizer = sanitizerFn ? new SanitizerExpr(sanitizerFn) : null;
23475
23792
  if (op.sanitizer === null) {
23476
23793
  const ownerOp = elements.get(op.target);
23477
- if (ownerOp === void 0) {
23794
+ if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
23478
23795
  throw Error("Property should have an element-like owner");
23479
23796
  }
23480
23797
  if (isIframeElement$1(ownerOp) && isIframeSecuritySensitiveAttr(op.name)) {
@@ -23490,20 +23807,20 @@ function isIframeElement$1(op) {
23490
23807
  var _a2;
23491
23808
  return op.kind === OpKind.ElementStart && ((_a2 = op.tag) == null ? void 0 : _a2.toLowerCase()) === "iframe";
23492
23809
  }
23493
- function phaseSaveRestoreView(job) {
23494
- for (const view of job.views.values()) {
23495
- view.create.prepend([
23496
- createVariableOp(view.job.allocateXrefId(), {
23810
+ function saveAndRestoreView(job) {
23811
+ for (const unit of job.units) {
23812
+ unit.create.prepend([
23813
+ createVariableOp(unit.job.allocateXrefId(), {
23497
23814
  kind: SemanticVariableKind.SavedView,
23498
23815
  name: null,
23499
- view: view.xref
23500
- }, new GetCurrentViewExpr())
23816
+ view: unit.xref
23817
+ }, new GetCurrentViewExpr(), VariableFlags.None)
23501
23818
  ]);
23502
- for (const op of view.create) {
23819
+ for (const op of unit.create) {
23503
23820
  if (op.kind !== OpKind.Listener) {
23504
23821
  continue;
23505
23822
  }
23506
- let needsRestoreView = view !== job.root;
23823
+ let needsRestoreView = unit !== job.root;
23507
23824
  if (!needsRestoreView) {
23508
23825
  for (const handlerOp of op.handlerOps) {
23509
23826
  visitExpressionsInOp(handlerOp, (expr) => {
@@ -23514,7 +23831,7 @@ function phaseSaveRestoreView(job) {
23514
23831
  }
23515
23832
  }
23516
23833
  if (needsRestoreView) {
23517
- addSaveRestoreViewOperationToListener(view, op);
23834
+ addSaveRestoreViewOperationToListener(unit, op);
23518
23835
  }
23519
23836
  }
23520
23837
  }
@@ -23525,7 +23842,7 @@ function addSaveRestoreViewOperationToListener(unit, op) {
23525
23842
  kind: SemanticVariableKind.Context,
23526
23843
  name: null,
23527
23844
  view: unit.xref
23528
- }, new RestoreViewExpr(unit.xref))
23845
+ }, new RestoreViewExpr(unit.xref), VariableFlags.None)
23529
23846
  ]);
23530
23847
  for (const handlerOp of op.handlerOps) {
23531
23848
  if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
@@ -23533,7 +23850,7 @@ function addSaveRestoreViewOperationToListener(unit, op) {
23533
23850
  }
23534
23851
  }
23535
23852
  }
23536
- function phaseSlotAllocation(job) {
23853
+ function allocateSlots(job) {
23537
23854
  const slotMap = /* @__PURE__ */ new Map();
23538
23855
  for (const unit of job.units) {
23539
23856
  let slotCount = 0;
@@ -23541,41 +23858,23 @@ function phaseSlotAllocation(job) {
23541
23858
  if (!hasConsumesSlotTrait(op)) {
23542
23859
  continue;
23543
23860
  }
23544
- op.slot = slotCount;
23545
- slotMap.set(op.xref, op.slot);
23861
+ op.handle.slot = slotCount;
23862
+ slotMap.set(op.xref, op.handle.slot);
23546
23863
  slotCount += op.numSlotsUsed;
23547
23864
  }
23548
23865
  unit.decls = slotCount;
23549
23866
  }
23550
23867
  for (const unit of job.units) {
23551
23868
  for (const op of unit.ops()) {
23552
- if (op.kind === OpKind.Template) {
23869
+ if (op.kind === OpKind.Template || op.kind === OpKind.RepeaterCreate) {
23553
23870
  const childView = job.views.get(op.xref);
23554
23871
  op.decls = childView.decls;
23555
23872
  }
23556
- if (hasUsesSlotIndexTrait(op) && op.targetSlot === null) {
23557
- if (!slotMap.has(op.target)) {
23558
- throw new Error(`AssertionError: no slot allocated for ${OpKind[op.kind]} target ${op.target}`);
23559
- }
23560
- op.targetSlot = slotMap.get(op.target);
23561
- }
23562
- visitExpressionsInOp(op, (expr) => {
23563
- if (!isIrExpression(expr)) {
23564
- return;
23565
- }
23566
- if (!hasUsesSlotIndexTrait(expr) || expr.targetSlot !== null) {
23567
- return;
23568
- }
23569
- if (!slotMap.has(expr.target)) {
23570
- throw new Error(`AssertionError: no slot allocated for ${expr.constructor.name} target ${expr.target}`);
23571
- }
23572
- expr.targetSlot = slotMap.get(expr.target);
23573
- });
23574
23873
  }
23575
23874
  }
23576
23875
  }
23577
- function phaseStyleBindingSpecialization(cpl) {
23578
- for (const unit of cpl.units) {
23876
+ function specializeStyleBindings(job) {
23877
+ for (const unit of job.units) {
23579
23878
  for (const op of unit.update) {
23580
23879
  if (op.kind !== OpKind.Binding) {
23581
23880
  continue;
@@ -23602,8 +23901,8 @@ function phaseStyleBindingSpecialization(cpl) {
23602
23901
  }
23603
23902
  }
23604
23903
  }
23605
- function phaseTemporaryVariables(cpl) {
23606
- for (const unit of cpl.units) {
23904
+ function generateTemporaryVariables(job) {
23905
+ for (const unit of job.units) {
23607
23906
  unit.create.prepend(generateTemporaries(unit.create));
23608
23907
  unit.update.prepend(generateTemporaries(unit.update));
23609
23908
  }
@@ -23658,8 +23957,210 @@ function assignName(names, expr) {
23658
23957
  }
23659
23958
  expr.name = name;
23660
23959
  }
23661
- function phaseVariableOptimization(job) {
23960
+ function generateTrackFns(job) {
23961
+ for (const unit of job.units) {
23962
+ for (const op of unit.create) {
23963
+ if (op.kind !== OpKind.RepeaterCreate) {
23964
+ continue;
23965
+ }
23966
+ if (op.trackByFn !== null) {
23967
+ continue;
23968
+ }
23969
+ let usesComponentContext = false;
23970
+ op.track = transformExpressionsInExpression(op.track, (expr) => {
23971
+ if (expr instanceof TrackContextExpr) {
23972
+ usesComponentContext = true;
23973
+ return variable("this");
23974
+ }
23975
+ return expr;
23976
+ }, VisitorContextFlag.None);
23977
+ let fn2;
23978
+ const fnParams = [new FnParam("$index"), new FnParam("$item")];
23979
+ if (usesComponentContext) {
23980
+ fn2 = new FunctionExpr(fnParams, [new ReturnStatement(op.track)]);
23981
+ } else {
23982
+ fn2 = arrowFn(fnParams, op.track);
23983
+ }
23984
+ op.trackByFn = job.pool.getSharedFunctionReference(fn2, "_forTrack");
23985
+ }
23986
+ }
23987
+ }
23988
+ function optimizeTrackFns(job) {
23989
+ for (const unit of job.units) {
23990
+ for (const op of unit.create) {
23991
+ if (op.kind !== OpKind.RepeaterCreate) {
23992
+ continue;
23993
+ }
23994
+ if (op.track instanceof ReadVarExpr && op.track.name === "$index") {
23995
+ op.trackByFn = importExpr(Identifiers.repeaterTrackByIndex);
23996
+ } else if (op.track instanceof ReadVarExpr && op.track.name === "$item") {
23997
+ op.trackByFn = importExpr(Identifiers.repeaterTrackByIdentity);
23998
+ } else if (isTrackByFunctionCall(job.root.xref, op.track)) {
23999
+ if (op.track.receiver.receiver.view === unit.xref) {
24000
+ op.trackByFn = op.track.receiver;
24001
+ } else {
24002
+ op.trackByFn = importExpr(Identifiers.componentInstance).callFn([]).prop(op.track.receiver.name);
24003
+ op.track = op.trackByFn;
24004
+ }
24005
+ } else {
24006
+ op.track = transformExpressionsInExpression(op.track, (expr) => {
24007
+ if (expr instanceof ContextExpr) {
24008
+ op.usesComponentInstance = true;
24009
+ return new TrackContextExpr(expr.view);
24010
+ }
24011
+ return expr;
24012
+ }, VisitorContextFlag.None);
24013
+ }
24014
+ }
24015
+ }
24016
+ }
24017
+ function isTrackByFunctionCall(rootView, expr) {
24018
+ if (!(expr instanceof InvokeFunctionExpr) || expr.args.length !== 2) {
24019
+ return false;
24020
+ }
24021
+ if (!(expr.receiver instanceof ReadPropExpr && expr.receiver.receiver instanceof ContextExpr) || expr.receiver.receiver.view !== rootView) {
24022
+ return false;
24023
+ }
24024
+ const [arg0, arg1] = expr.args;
24025
+ if (!(arg0 instanceof ReadVarExpr) || arg0.name !== "$index") {
24026
+ return false;
24027
+ }
24028
+ if (!(arg1 instanceof ReadVarExpr) || arg1.name !== "$item") {
24029
+ return false;
24030
+ }
24031
+ return true;
24032
+ }
24033
+ function generateTrackVariables(job) {
24034
+ for (const unit of job.units) {
24035
+ for (const op of unit.create) {
24036
+ if (op.kind !== OpKind.RepeaterCreate) {
24037
+ continue;
24038
+ }
24039
+ op.track = transformExpressionsInExpression(op.track, (expr) => {
24040
+ if (expr instanceof LexicalReadExpr) {
24041
+ if (expr.name === op.varNames.$index) {
24042
+ return variable("$index");
24043
+ } else if (expr.name === op.varNames.$implicit) {
24044
+ return variable("$item");
24045
+ }
24046
+ }
24047
+ return expr;
24048
+ }, VisitorContextFlag.None);
24049
+ }
24050
+ }
24051
+ }
24052
+ function countVariables(job) {
24053
+ for (const unit of job.units) {
24054
+ let varCount = 0;
24055
+ for (const op of unit.ops()) {
24056
+ if (hasConsumesVarsTrait(op)) {
24057
+ varCount += varsUsedByOp(op);
24058
+ }
24059
+ }
24060
+ for (const op of unit.ops()) {
24061
+ visitExpressionsInOp(op, (expr) => {
24062
+ if (!isIrExpression(expr)) {
24063
+ return;
24064
+ }
24065
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && expr instanceof PureFunctionExpr) {
24066
+ return;
24067
+ }
24068
+ if (hasUsesVarOffsetTrait(expr)) {
24069
+ expr.varOffset = varCount;
24070
+ }
24071
+ if (hasConsumesVarsTrait(expr)) {
24072
+ varCount += varsUsedByIrExpression(expr);
24073
+ }
24074
+ });
24075
+ }
24076
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
24077
+ for (const op of unit.ops()) {
24078
+ visitExpressionsInOp(op, (expr) => {
24079
+ if (!isIrExpression(expr) || !(expr instanceof PureFunctionExpr)) {
24080
+ return;
24081
+ }
24082
+ if (hasUsesVarOffsetTrait(expr)) {
24083
+ expr.varOffset = varCount;
24084
+ }
24085
+ if (hasConsumesVarsTrait(expr)) {
24086
+ varCount += varsUsedByIrExpression(expr);
24087
+ }
24088
+ });
24089
+ }
24090
+ }
24091
+ unit.vars = varCount;
24092
+ }
24093
+ if (job instanceof ComponentCompilationJob) {
24094
+ for (const unit of job.units) {
24095
+ for (const op of unit.create) {
24096
+ if (op.kind !== OpKind.Template && op.kind !== OpKind.RepeaterCreate) {
24097
+ continue;
24098
+ }
24099
+ const childView = job.views.get(op.xref);
24100
+ op.vars = childView.vars;
24101
+ }
24102
+ }
24103
+ }
24104
+ }
24105
+ function varsUsedByOp(op) {
24106
+ let slots;
24107
+ switch (op.kind) {
24108
+ case OpKind.Property:
24109
+ case OpKind.HostProperty:
24110
+ case OpKind.Attribute:
24111
+ slots = 1;
24112
+ if (op.expression instanceof Interpolation && !isSingletonInterpolation(op.expression)) {
24113
+ slots += op.expression.expressions.length;
24114
+ }
24115
+ return slots;
24116
+ case OpKind.StyleProp:
24117
+ case OpKind.ClassProp:
24118
+ case OpKind.StyleMap:
24119
+ case OpKind.ClassMap:
24120
+ slots = 2;
24121
+ if (op.expression instanceof Interpolation) {
24122
+ slots += op.expression.expressions.length;
24123
+ }
24124
+ return slots;
24125
+ case OpKind.InterpolateText:
24126
+ return op.interpolation.expressions.length;
24127
+ case OpKind.I18nExpression:
24128
+ case OpKind.Conditional:
24129
+ return 1;
24130
+ default:
24131
+ throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
24132
+ }
24133
+ }
24134
+ function varsUsedByIrExpression(expr) {
24135
+ switch (expr.kind) {
24136
+ case ExpressionKind.PureFunctionExpr:
24137
+ return 1 + expr.args.length;
24138
+ case ExpressionKind.PipeBinding:
24139
+ return 1 + expr.args.length;
24140
+ case ExpressionKind.PipeBindingVariadic:
24141
+ return 1 + expr.numArgs;
24142
+ default:
24143
+ throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
24144
+ }
24145
+ }
24146
+ function isSingletonInterpolation(expr) {
24147
+ if (expr.expressions.length !== 1 || expr.strings.length !== 2) {
24148
+ return false;
24149
+ }
24150
+ if (expr.strings[0] !== "" || expr.strings[1] !== "") {
24151
+ return false;
24152
+ }
24153
+ return true;
24154
+ }
24155
+ function optimizeVariables(job) {
23662
24156
  for (const unit of job.units) {
24157
+ inlineAlwaysInlineVariables(unit.create);
24158
+ inlineAlwaysInlineVariables(unit.update);
24159
+ for (const op of unit.create) {
24160
+ if (op.kind === OpKind.Listener) {
24161
+ inlineAlwaysInlineVariables(op.handlerOps);
24162
+ }
24163
+ }
23663
24164
  optimizeVariablesInOpList(unit.create, job.compatibility);
23664
24165
  optimizeVariablesInOpList(unit.update, job.compatibility);
23665
24166
  for (const op of unit.create) {
@@ -23673,9 +24174,32 @@ var Fence;
23673
24174
  (function(Fence2) {
23674
24175
  Fence2[Fence2["None"] = 0] = "None";
23675
24176
  Fence2[Fence2["ViewContextRead"] = 1] = "ViewContextRead";
23676
- Fence2[Fence2["ViewContextWrite"] = 3] = "ViewContextWrite";
24177
+ Fence2[Fence2["ViewContextWrite"] = 2] = "ViewContextWrite";
23677
24178
  Fence2[Fence2["SideEffectful"] = 4] = "SideEffectful";
23678
24179
  })(Fence || (Fence = {}));
24180
+ function inlineAlwaysInlineVariables(ops) {
24181
+ const vars = /* @__PURE__ */ new Map();
24182
+ for (const op of ops) {
24183
+ if (op.kind === OpKind.Variable && op.flags & VariableFlags.AlwaysInline) {
24184
+ visitExpressionsInOp(op, (expr) => {
24185
+ if (isIrExpression(expr) && fencesForIrExpression(expr) !== Fence.None) {
24186
+ throw new Error(`AssertionError: A context-sensitive variable was marked AlwaysInline`);
24187
+ }
24188
+ });
24189
+ vars.set(op.xref, op);
24190
+ }
24191
+ transformExpressionsInOp(op, (expr) => {
24192
+ if (expr instanceof ReadVariableExpr && vars.has(expr.xref)) {
24193
+ const varOp = vars.get(expr.xref);
24194
+ return varOp.initializer.clone();
24195
+ }
24196
+ return expr;
24197
+ }, VisitorContextFlag.None);
24198
+ }
24199
+ for (const op of vars.values()) {
24200
+ OpList.remove(op);
24201
+ }
24202
+ }
23679
24203
  function optimizeVariablesInOpList(ops, compatibility) {
23680
24204
  const varDecls = /* @__PURE__ */ new Map();
23681
24205
  const varUsages = /* @__PURE__ */ new Map();
@@ -23715,7 +24239,10 @@ function optimizeVariablesInOpList(ops, compatibility) {
23715
24239
  }
23716
24240
  const toInline = [];
23717
24241
  for (const [id, count] of varUsages) {
23718
- if (count !== 1) {
24242
+ const decl2 = varDecls.get(id);
24243
+ const varInfo = opMap.get(decl2);
24244
+ const isAlwaysInline = !!(decl2.flags & VariableFlags.AlwaysInline);
24245
+ if (count !== 1 || isAlwaysInline) {
23719
24246
  continue;
23720
24247
  }
23721
24248
  if (varRemoteUsages.has(id)) {
@@ -23727,6 +24254,10 @@ function optimizeVariablesInOpList(ops, compatibility) {
23727
24254
  while (candidate = toInline.pop()) {
23728
24255
  const decl2 = varDecls.get(candidate);
23729
24256
  const varInfo = opMap.get(decl2);
24257
+ const isAlwaysInline = !!(decl2.flags & VariableFlags.AlwaysInline);
24258
+ if (isAlwaysInline) {
24259
+ throw new Error(`AssertionError: Found an 'AlwaysInline' variable after the always inlining pass.`);
24260
+ }
23730
24261
  for (let targetOp = decl2.next; targetOp.kind !== OpKind.ListEnd; targetOp = targetOp.next) {
23731
24262
  const opInfo = opMap.get(targetOp);
23732
24263
  if (opInfo.variablesUsed.has(candidate)) {
@@ -23755,9 +24286,9 @@ function optimizeVariablesInOpList(ops, compatibility) {
23755
24286
  function fencesForIrExpression(expr) {
23756
24287
  switch (expr.kind) {
23757
24288
  case ExpressionKind.NextContext:
23758
- return Fence.ViewContextWrite;
24289
+ return Fence.ViewContextRead | Fence.ViewContextWrite;
23759
24290
  case ExpressionKind.RestoreView:
23760
- return Fence.ViewContextWrite | Fence.SideEffectful;
24291
+ return Fence.ViewContextRead | Fence.ViewContextWrite | Fence.SideEffectful;
23761
24292
  case ExpressionKind.Reference:
23762
24293
  return Fence.ViewContextRead;
23763
24294
  default:
@@ -23869,7 +24400,7 @@ function allowConservativeInlining(decl2, target) {
23869
24400
  return true;
23870
24401
  }
23871
24402
  }
23872
- function phaseWrapIcus(job) {
24403
+ function wrapI18nIcus(job) {
23873
24404
  for (const unit of job.units) {
23874
24405
  let currentI18nOp = null;
23875
24406
  for (const op of unit.create) {
@@ -23892,55 +24423,64 @@ function phaseWrapIcus(job) {
23892
24423
  }
23893
24424
  }
23894
24425
  var phases = [
23895
- { kind: CompilationJobKind.Tmpl, fn: phaseRemoveContentSelectors },
23896
- { kind: CompilationJobKind.Host, fn: phaseHostStylePropertyParsing },
23897
- { kind: CompilationJobKind.Tmpl, fn: phaseNamespace },
23898
- { kind: CompilationJobKind.Both, fn: phaseStyleBindingSpecialization },
23899
- { kind: CompilationJobKind.Both, fn: phaseBindingSpecialization },
23900
- { kind: CompilationJobKind.Tmpl, fn: phasePropagateI18nBlocks },
23901
- { kind: CompilationJobKind.Tmpl, fn: phaseWrapIcus },
23902
- { kind: CompilationJobKind.Both, fn: phaseAttributeExtraction },
23903
- { kind: CompilationJobKind.Both, fn: phaseParseExtractedStyles },
23904
- { kind: CompilationJobKind.Tmpl, fn: phaseRemoveEmptyBindings },
23905
- { kind: CompilationJobKind.Tmpl, fn: phaseConditionals },
23906
- { kind: CompilationJobKind.Tmpl, fn: phasePipeCreation },
23907
- { kind: CompilationJobKind.Tmpl, fn: phaseI18nTextExtraction },
23908
- { kind: CompilationJobKind.Tmpl, fn: phaseIcuExtraction },
23909
- { kind: CompilationJobKind.Tmpl, fn: phaseApplyI18nExpressions },
23910
- { kind: CompilationJobKind.Tmpl, fn: phasePipeVariadic },
23911
- { kind: CompilationJobKind.Both, fn: phasePureLiteralStructures },
23912
- { kind: CompilationJobKind.Tmpl, fn: phaseGenerateProjectionDef },
23913
- { kind: CompilationJobKind.Tmpl, fn: phaseGenerateVariables },
23914
- { kind: CompilationJobKind.Tmpl, fn: phaseSaveRestoreView },
23915
- { kind: CompilationJobKind.Tmpl, fn: phaseFindAnyCasts },
23916
- { kind: CompilationJobKind.Both, fn: phaseResolveDollarEvent },
23917
- { kind: CompilationJobKind.Both, fn: phaseResolveNames },
23918
- { kind: CompilationJobKind.Both, fn: phaseResolveContexts },
23919
- { kind: CompilationJobKind.Tmpl, fn: phaseResolveSanitizers },
23920
- { kind: CompilationJobKind.Tmpl, fn: phaseLocalRefs },
23921
- { kind: CompilationJobKind.Both, fn: phaseNullishCoalescing },
23922
- { kind: CompilationJobKind.Both, fn: phaseExpandSafeReads },
23923
- { kind: CompilationJobKind.Both, fn: phaseTemporaryVariables },
23924
- { kind: CompilationJobKind.Tmpl, fn: phaseSlotAllocation },
23925
- { kind: CompilationJobKind.Tmpl, fn: phaseResolveI18nPlaceholders },
23926
- { kind: CompilationJobKind.Tmpl, fn: phaseI18nMessageExtraction },
23927
- { kind: CompilationJobKind.Tmpl, fn: phaseI18nConstCollection },
23928
- { kind: CompilationJobKind.Tmpl, fn: phaseConstTraitCollection },
23929
- { kind: CompilationJobKind.Both, fn: phaseConstCollection },
23930
- { kind: CompilationJobKind.Tmpl, fn: phaseAssignI18nSlotDependencies },
23931
- { kind: CompilationJobKind.Both, fn: phaseVarCounting },
23932
- { kind: CompilationJobKind.Tmpl, fn: phaseGenerateAdvance },
23933
- { kind: CompilationJobKind.Both, fn: phaseVariableOptimization },
23934
- { kind: CompilationJobKind.Both, fn: phaseNaming },
23935
- { kind: CompilationJobKind.Tmpl, fn: phaseMergeNextContext },
23936
- { kind: CompilationJobKind.Tmpl, fn: phaseNgContainer },
23937
- { kind: CompilationJobKind.Tmpl, fn: phaseEmptyElements },
23938
- { kind: CompilationJobKind.Tmpl, fn: phaseNonbindable },
23939
- { kind: CompilationJobKind.Both, fn: phasePureFunctionExtraction },
23940
- { kind: CompilationJobKind.Tmpl, fn: phaseAlignPipeVariadicVarOffset },
23941
- { kind: CompilationJobKind.Both, fn: phaseOrdering },
23942
- { kind: CompilationJobKind.Both, fn: phaseReify },
23943
- { kind: CompilationJobKind.Both, fn: phaseChaining }
24426
+ { kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
24427
+ { kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
24428
+ { kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
24429
+ { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
24430
+ { kind: CompilationJobKind.Both, fn: specializeBindings },
24431
+ { kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
24432
+ { kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
24433
+ { kind: CompilationJobKind.Both, fn: extractAttributes },
24434
+ { kind: CompilationJobKind.Both, fn: parseExtractedStyles },
24435
+ { kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
24436
+ { kind: CompilationJobKind.Both, fn: collapseSingletonInterpolations },
24437
+ { kind: CompilationJobKind.Both, fn: orderOps },
24438
+ { kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
24439
+ { kind: CompilationJobKind.Tmpl, fn: createPipes },
24440
+ { kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
24441
+ { kind: CompilationJobKind.Tmpl, fn: extractI18nText },
24442
+ { kind: CompilationJobKind.Tmpl, fn: extractI18nICUs },
24443
+ { kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
24444
+ { kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
24445
+ { kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
24446
+ { kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
24447
+ { kind: CompilationJobKind.Tmpl, fn: generateVariables },
24448
+ { kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
24449
+ { kind: CompilationJobKind.Tmpl, fn: deleteAnyCasts },
24450
+ { kind: CompilationJobKind.Both, fn: resolveDollarEvent },
24451
+ { kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
24452
+ { kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
24453
+ { kind: CompilationJobKind.Both, fn: resolveNames },
24454
+ { kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
24455
+ { kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
24456
+ { kind: CompilationJobKind.Both, fn: resolveContexts },
24457
+ { kind: CompilationJobKind.Tmpl, fn: resolveSanitizers },
24458
+ { kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
24459
+ { kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
24460
+ { kind: CompilationJobKind.Both, fn: expandSafeReads },
24461
+ { kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
24462
+ { kind: CompilationJobKind.Tmpl, fn: allocateSlots },
24463
+ { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
24464
+ { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
24465
+ { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
24466
+ { kind: CompilationJobKind.Tmpl, fn: propogateI18nPlaceholders },
24467
+ { kind: CompilationJobKind.Tmpl, fn: formatI18nParams },
24468
+ { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
24469
+ { kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
24470
+ { kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
24471
+ { kind: CompilationJobKind.Both, fn: collectElementConsts },
24472
+ { kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
24473
+ { kind: CompilationJobKind.Both, fn: countVariables },
24474
+ { kind: CompilationJobKind.Tmpl, fn: generateAdvance },
24475
+ { kind: CompilationJobKind.Both, fn: optimizeVariables },
24476
+ { kind: CompilationJobKind.Both, fn: nameFunctionsAndVariables },
24477
+ { kind: CompilationJobKind.Tmpl, fn: mergeNextContextExpressions },
24478
+ { kind: CompilationJobKind.Tmpl, fn: generateNgContainerOps },
24479
+ { kind: CompilationJobKind.Tmpl, fn: collapseEmptyInstructions },
24480
+ { kind: CompilationJobKind.Tmpl, fn: disableBindings$1 },
24481
+ { kind: CompilationJobKind.Both, fn: extractPureFunctions },
24482
+ { kind: CompilationJobKind.Both, fn: reify },
24483
+ { kind: CompilationJobKind.Both, fn: chain }
23944
24484
  ];
23945
24485
  function transform(job, kind) {
23946
24486
  for (const phase of phases) {
@@ -24045,9 +24585,9 @@ function emitHostBindingFunction(job) {
24045
24585
  }
24046
24586
  var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
24047
24587
  function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds) {
24048
- const cpl = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
24049
- ingestNodes(cpl.root, template2);
24050
- return cpl;
24588
+ const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
24589
+ ingestNodes(job.root, template2);
24590
+ return job;
24051
24591
  }
24052
24592
  function ingestHostBinding(input, bindingParser, constantPool) {
24053
24593
  var _a2, _b2, _c2;
@@ -24096,7 +24636,7 @@ function ingestHostAttribute(job, name, value) {
24096
24636
  job.root.update.push(attrBinding);
24097
24637
  }
24098
24638
  function ingestHostEvent(job, event) {
24099
- const eventBinding = createListenerOp(job.root.xref, event.name, null, event.targetOrPhase, true, event.sourceSpan);
24639
+ const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, event.targetOrPhase, true, event.sourceSpan);
24100
24640
  eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
24101
24641
  job.root.create.push(eventBinding);
24102
24642
  }
@@ -24120,6 +24660,8 @@ function ingestNodes(unit, template2) {
24120
24660
  ingestDeferBlock(unit, node);
24121
24661
  } else if (node instanceof Icu$1) {
24122
24662
  ingestIcu(unit, node);
24663
+ } else if (node instanceof ForLoopBlock) {
24664
+ ingestForBlock(unit, node);
24123
24665
  } else {
24124
24666
  throw new Error(`Unsupported template node: ${node.constructor.name}`);
24125
24667
  }
@@ -24129,10 +24671,6 @@ function ingestElement(unit, element2) {
24129
24671
  if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
24130
24672
  throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
24131
24673
  }
24132
- const staticAttributes = {};
24133
- for (const attr of element2.attributes) {
24134
- staticAttributes[attr.name] = attr.value;
24135
- }
24136
24674
  const id = unit.job.allocateXrefId();
24137
24675
  const [namespaceKey, elementName] = splitNsName(element2.name);
24138
24676
  const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
@@ -24159,13 +24697,15 @@ function ingestTemplate(unit, tmpl) {
24159
24697
  [namespacePrefix, tagNameWithoutNamespace] = splitNsName(tmpl.tagName);
24160
24698
  }
24161
24699
  const i18nPlaceholder = tmpl.i18n instanceof TagPlaceholder ? tmpl.i18n : void 0;
24162
- const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace, namespaceForKey(namespacePrefix), false, i18nPlaceholder, tmpl.startSourceSpan);
24700
+ const namespace = namespaceForKey(namespacePrefix);
24701
+ const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
24702
+ const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
24163
24703
  unit.create.push(tplOp);
24164
24704
  ingestBindings(unit, tplOp, tmpl);
24165
24705
  ingestReferences(tplOp, tmpl);
24166
24706
  ingestNodes(childView, tmpl.children);
24167
24707
  for (const { name, value } of tmpl.variables) {
24168
- childView.contextVariables.set(name, value);
24708
+ childView.contextVariables.set(name, value !== "" ? value : "$implicit");
24169
24709
  }
24170
24710
  if (isPlainTemplate(tmpl) && tmpl.i18n instanceof Message) {
24171
24711
  const id = unit.job.allocateXrefId();
@@ -24174,7 +24714,7 @@ function ingestTemplate(unit, tmpl) {
24174
24714
  }
24175
24715
  }
24176
24716
  function ingestContent(unit, content) {
24177
- const op = createProjectionOp(unit.job.allocateXrefId(), content.selector);
24717
+ const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.sourceSpan);
24178
24718
  for (const attr of content.attributes) {
24179
24719
  ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
24180
24720
  }
@@ -24203,39 +24743,50 @@ function ingestBoundText(unit, text2) {
24203
24743
  }
24204
24744
  function ingestIfBlock(unit, ifBlock) {
24205
24745
  let firstXref = null;
24746
+ let firstSlotHandle = null;
24206
24747
  let conditions = [];
24207
- for (const ifCase of ifBlock.branches) {
24748
+ for (let i = 0; i < ifBlock.branches.length; i++) {
24749
+ const ifCase = ifBlock.branches[i];
24208
24750
  const cView = unit.job.allocateView(unit.xref);
24751
+ let tagName = null;
24752
+ if (i === 0) {
24753
+ tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
24754
+ }
24209
24755
  if (ifCase.expressionAlias !== null) {
24210
24756
  cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
24211
24757
  }
24758
+ const tmplOp = createTemplateOp(cView.xref, tagName, "Conditional", Namespace.HTML, void 0, ifCase.sourceSpan);
24759
+ unit.create.push(tmplOp);
24212
24760
  if (firstXref === null) {
24213
24761
  firstXref = cView.xref;
24762
+ firstSlotHandle = tmplOp.handle;
24214
24763
  }
24215
- unit.create.push(createTemplateOp(cView.xref, "Conditional", Namespace.HTML, true, void 0, ifCase.sourceSpan));
24216
24764
  const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
24217
- const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, cView.xref, ifCase.expressionAlias);
24765
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, tmplOp.xref, tmplOp.handle, ifCase.expressionAlias);
24218
24766
  conditions.push(conditionalCaseExpr);
24219
24767
  ingestNodes(cView, ifCase.children);
24220
24768
  }
24221
- const conditional2 = createConditionalOp(firstXref, null, conditions, ifBlock.sourceSpan);
24769
+ const conditional2 = createConditionalOp(firstXref, firstSlotHandle, null, conditions, ifBlock.sourceSpan);
24222
24770
  unit.update.push(conditional2);
24223
24771
  }
24224
24772
  function ingestSwitchBlock(unit, switchBlock) {
24225
24773
  let firstXref = null;
24774
+ let firstSlotHandle = null;
24226
24775
  let conditions = [];
24227
24776
  for (const switchCase of switchBlock.cases) {
24228
24777
  const cView = unit.job.allocateView(unit.xref);
24778
+ const tmplOp = createTemplateOp(cView.xref, null, "Case", Namespace.HTML, void 0, switchCase.sourceSpan);
24779
+ unit.create.push(tmplOp);
24229
24780
  if (firstXref === null) {
24230
24781
  firstXref = cView.xref;
24782
+ firstSlotHandle = tmplOp.handle;
24231
24783
  }
24232
- unit.create.push(createTemplateOp(cView.xref, "Case", Namespace.HTML, true, void 0, switchCase.sourceSpan));
24233
24784
  const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
24234
- const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, cView.xref);
24785
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, tmplOp.xref, tmplOp.handle);
24235
24786
  conditions.push(conditionalCaseExpr);
24236
24787
  ingestNodes(cView, switchCase.children);
24237
24788
  }
24238
- const conditional2 = createConditionalOp(firstXref, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
24789
+ const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
24239
24790
  unit.update.push(conditional2);
24240
24791
  }
24241
24792
  function ingestDeferView(unit, suffix, children, sourceSpan) {
@@ -24244,38 +24795,80 @@ function ingestDeferView(unit, suffix, children, sourceSpan) {
24244
24795
  }
24245
24796
  const secondaryView = unit.job.allocateView(unit.xref);
24246
24797
  ingestNodes(secondaryView, children);
24247
- const templateOp = createTemplateOp(secondaryView.xref, `Defer${suffix}`, Namespace.HTML, true, void 0, sourceSpan);
24798
+ const templateOp = createTemplateOp(secondaryView.xref, null, `Defer${suffix}`, Namespace.HTML, void 0, sourceSpan);
24248
24799
  unit.create.push(templateOp);
24249
24800
  return templateOp;
24250
24801
  }
24251
24802
  function ingestDeferBlock(unit, deferBlock) {
24252
- var _a2, _b2, _c2, _d2, _e2, _f2;
24803
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
24253
24804
  const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
24254
24805
  const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
24255
24806
  const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
24256
24807
  const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
24257
- const deferOp = createDeferOp(unit.job.allocateXrefId(), main.xref, deferBlock.sourceSpan);
24808
+ const deferXref = unit.job.allocateXrefId();
24809
+ const deferOp = createDeferOp(deferXref, main.xref, main.handle, deferBlock.sourceSpan);
24810
+ deferOp.placeholderView = (_g = placeholder == null ? void 0 : placeholder.xref) != null ? _g : null;
24811
+ deferOp.placeholderSlot = (_h = placeholder == null ? void 0 : placeholder.handle) != null ? _h : null;
24812
+ deferOp.loadingSlot = (_i = loading == null ? void 0 : loading.handle) != null ? _i : null;
24813
+ deferOp.errorSlot = (_j = error2 == null ? void 0 : error2.handle) != null ? _j : null;
24814
+ deferOp.placeholderMinimumTime = (_l = (_k = deferBlock.placeholder) == null ? void 0 : _k.minimumTime) != null ? _l : null;
24815
+ deferOp.loadingMinimumTime = (_n = (_m = deferBlock.loading) == null ? void 0 : _m.minimumTime) != null ? _n : null;
24816
+ deferOp.loadingAfterTime = (_p = (_o = deferBlock.loading) == null ? void 0 : _o.afterTime) != null ? _p : null;
24258
24817
  unit.create.push(deferOp);
24259
- if (loading && deferBlock.loading) {
24260
- deferOp.loading = createDeferSecondaryOp(deferOp.xref, loading.xref, DeferSecondaryKind.Loading);
24261
- if (deferBlock.loading.afterTime !== null || deferBlock.loading.minimumTime !== null) {
24262
- deferOp.loading.constValue = [deferBlock.loading.minimumTime, deferBlock.loading.afterTime];
24263
- }
24264
- unit.create.push(deferOp.loading);
24265
- }
24266
- if (placeholder && deferBlock.placeholder) {
24267
- deferOp.placeholder = createDeferSecondaryOp(deferOp.xref, placeholder.xref, DeferSecondaryKind.Placeholder);
24268
- if (deferBlock.placeholder.minimumTime !== null) {
24269
- deferOp.placeholder.constValue = [deferBlock.placeholder.minimumTime];
24270
- }
24271
- unit.create.push(deferOp.placeholder);
24272
- }
24273
- if (error2 && deferBlock.error) {
24274
- deferOp.error = createDeferSecondaryOp(deferOp.xref, error2.xref, DeferSecondaryKind.Error);
24275
- unit.create.push(deferOp.error);
24276
- }
24277
- const deferOnOp = createDeferOnOp(unit.job.allocateXrefId(), null);
24278
- unit.create.push(deferOnOp);
24818
+ let prefetch = false;
24819
+ let deferOnOps = [];
24820
+ for (const triggers of [deferBlock.triggers, deferBlock.prefetchTriggers]) {
24821
+ if (triggers.idle !== void 0) {
24822
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch, null);
24823
+ deferOnOps.push(deferOnOp);
24824
+ }
24825
+ if (triggers.immediate !== void 0) {
24826
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch, null);
24827
+ deferOnOps.push(deferOnOp);
24828
+ }
24829
+ if (triggers.timer !== void 0) {
24830
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch, null);
24831
+ deferOnOps.push(deferOnOp);
24832
+ }
24833
+ if (triggers.hover !== void 0) {
24834
+ const deferOnOp = createDeferOnOp(deferXref, {
24835
+ kind: DeferTriggerKind.Hover,
24836
+ targetName: triggers.hover.reference,
24837
+ targetXref: null,
24838
+ targetSlot: null,
24839
+ targetView: null,
24840
+ targetSlotViewSteps: null
24841
+ }, prefetch, null);
24842
+ deferOnOps.push(deferOnOp);
24843
+ }
24844
+ if (triggers.interaction !== void 0) {
24845
+ const deferOnOp = createDeferOnOp(deferXref, {
24846
+ kind: DeferTriggerKind.Interaction,
24847
+ targetName: triggers.interaction.reference,
24848
+ targetXref: null,
24849
+ targetSlot: null,
24850
+ targetView: null,
24851
+ targetSlotViewSteps: null
24852
+ }, prefetch, null);
24853
+ deferOnOps.push(deferOnOp);
24854
+ }
24855
+ if (triggers.viewport !== void 0) {
24856
+ const deferOnOp = createDeferOnOp(deferXref, {
24857
+ kind: DeferTriggerKind.Viewport,
24858
+ targetName: triggers.viewport.reference,
24859
+ targetXref: null,
24860
+ targetSlot: null,
24861
+ targetView: null,
24862
+ targetSlotViewSteps: null
24863
+ }, prefetch, null);
24864
+ deferOnOps.push(deferOnOp);
24865
+ }
24866
+ if (deferOnOps.length === 0) {
24867
+ deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, false, null));
24868
+ }
24869
+ prefetch = true;
24870
+ }
24871
+ unit.create.push(deferOnOps);
24279
24872
  }
24280
24873
  function ingestIcu(unit, icu) {
24281
24874
  var _a2;
@@ -24287,6 +24880,48 @@ function ingestIcu(unit, icu) {
24287
24880
  throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
24288
24881
  }
24289
24882
  }
24883
+ function ingestForBlock(unit, forBlock) {
24884
+ var _a2;
24885
+ const repeaterView = unit.job.allocateView(unit.xref);
24886
+ const createRepeaterAlias = (ident, repeaterVar) => {
24887
+ repeaterView.aliases.add({
24888
+ kind: SemanticVariableKind.Alias,
24889
+ name: null,
24890
+ identifier: ident,
24891
+ expression: new DerivedRepeaterVarExpr(repeaterView.xref, repeaterVar)
24892
+ });
24893
+ };
24894
+ repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
24895
+ repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
24896
+ repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
24897
+ createRepeaterAlias(forBlock.contextVariables.$first.name, DerivedRepeaterVarIdentity.First);
24898
+ createRepeaterAlias(forBlock.contextVariables.$last.name, DerivedRepeaterVarIdentity.Last);
24899
+ createRepeaterAlias(forBlock.contextVariables.$even.name, DerivedRepeaterVarIdentity.Even);
24900
+ createRepeaterAlias(forBlock.contextVariables.$odd.name, DerivedRepeaterVarIdentity.Odd);
24901
+ const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
24902
+ const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
24903
+ ingestNodes(repeaterView, forBlock.children);
24904
+ let emptyView = null;
24905
+ if (forBlock.empty !== null) {
24906
+ emptyView = unit.job.allocateView(unit.xref);
24907
+ ingestNodes(emptyView, forBlock.empty.children);
24908
+ }
24909
+ const varNames = {
24910
+ $index: forBlock.contextVariables.$index.name,
24911
+ $count: forBlock.contextVariables.$count.name,
24912
+ $first: forBlock.contextVariables.$first.name,
24913
+ $last: forBlock.contextVariables.$last.name,
24914
+ $even: forBlock.contextVariables.$even.name,
24915
+ $odd: forBlock.contextVariables.$odd.name,
24916
+ $implicit: forBlock.item.name
24917
+ };
24918
+ const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
24919
+ const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_a2 = emptyView == null ? void 0 : emptyView.xref) != null ? _a2 : null, tagName, track, varNames, forBlock.sourceSpan);
24920
+ unit.create.push(repeaterCreate2);
24921
+ const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
24922
+ const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
24923
+ unit.update.push(repeater2);
24924
+ }
24290
24925
  function convertAst(ast, job, baseSourceSpan) {
24291
24926
  if (ast instanceof ASTWithSource) {
24292
24927
  return convertAst(ast.ast, job, baseSourceSpan);
@@ -24333,7 +24968,7 @@ function convertAst(ast, job, baseSourceSpan) {
24333
24968
  } else if (ast instanceof NonNullAssert) {
24334
24969
  return convertAst(ast.expression, job, baseSourceSpan);
24335
24970
  } else if (ast instanceof BindingPipe) {
24336
- return new PipeBindingExpr(job.allocateXrefId(), ast.name, [
24971
+ return new PipeBindingExpr(job.allocateXrefId(), new SlotHandle(), ast.name, [
24337
24972
  convertAst(ast.exp, job, baseSourceSpan),
24338
24973
  ...ast.args.map((arg) => convertAst(arg, job, baseSourceSpan))
24339
24974
  ]);
@@ -24386,7 +25021,7 @@ function ingestBindings(unit, op, element2) {
24386
25021
  unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null));
24387
25022
  continue;
24388
25023
  }
24389
- listenerOp = createListenerOp(op.xref, output.name, op.tag, output.phase, false, output.sourceSpan);
25024
+ listenerOp = createListenerOp(op.xref, op.handle, output.name, op.tag, output.phase, false, output.sourceSpan);
24390
25025
  let handlerExprs;
24391
25026
  let handler = output.handler;
24392
25027
  if (handler instanceof ASTWithSource) {
@@ -24467,6 +25102,27 @@ function convertSourceSpan(span, baseSourceSpan) {
24467
25102
  const fullStart = baseSourceSpan.fullStart.moveBy(span.start);
24468
25103
  return new ParseSourceSpan(start, end, fullStart);
24469
25104
  }
25105
+ function ingestControlFlowInsertionPoint(unit, xref, node) {
25106
+ let root2 = null;
25107
+ for (const child of node.children) {
25108
+ if (child instanceof Comment$1) {
25109
+ continue;
25110
+ }
25111
+ if (root2 !== null) {
25112
+ return null;
25113
+ }
25114
+ if (child instanceof Element$1 || child instanceof Template && child.tagName !== null) {
25115
+ root2 = child;
25116
+ }
25117
+ }
25118
+ if (root2 !== null) {
25119
+ for (const attr of root2.attributes) {
25120
+ ingestBinding(unit, xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
25121
+ }
25122
+ return root2 instanceof Element$1 ? root2.name : root2.tagName;
25123
+ }
25124
+ return null;
25125
+ }
24470
25126
  var USE_TEMPLATE_PIPELINE = false;
24471
25127
  var IMPORTANT_FLAG = "!important";
24472
25128
  var MIN_STYLING_BINDING_SLOTS_REQUIRED = 2;
@@ -24848,7 +25504,7 @@ var WhitespaceVisitor = class {
24848
25504
  return expansionCase;
24849
25505
  }
24850
25506
  visitBlock(block, context) {
24851
- return new Block(block.name, block.parameters, visitAllWithSiblings(this, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
25507
+ return new Block(block.name, block.parameters, visitAllWithSiblings(this, block.children), block.sourceSpan, block.nameSpan, block.startSourceSpan, block.endSourceSpan);
24852
25508
  }
24853
25509
  visitBlockParameter(parameter, context) {
24854
25510
  return parameter;
@@ -25264,7 +25920,7 @@ function normalizeNgContentSelect(selectAttr) {
25264
25920
  }
25265
25921
  return selectAttr;
25266
25922
  }
25267
- var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+(.*)/;
25923
+ var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/;
25268
25924
  var FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
25269
25925
  var CONDITIONAL_ALIAS_PATTERN = /^as\s+(.*)/;
25270
25926
  var ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
@@ -25281,18 +25937,18 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
25281
25937
  const branches = [];
25282
25938
  const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
25283
25939
  if (mainBlockParams !== null) {
25284
- branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan));
25940
+ branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan));
25285
25941
  }
25286
25942
  for (const block of connectedBlocks) {
25287
25943
  if (ELSE_IF_PATTERN.test(block.name)) {
25288
25944
  const params = parseConditionalBlockParameters(block, errors, bindingParser);
25289
25945
  if (params !== null) {
25290
25946
  const children = visitAll(visitor, block.children, block.children);
25291
- branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
25947
+ branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
25292
25948
  }
25293
25949
  } else if (block.name === "else") {
25294
25950
  const children = visitAll(visitor, block.children, block.children);
25295
- branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
25951
+ branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
25296
25952
  }
25297
25953
  }
25298
25954
  const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
@@ -25303,7 +25959,7 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
25303
25959
  wholeSourceSpan = new ParseSourceSpan(ifBlockStartSourceSpan.start, lastBranch.sourceSpan.end);
25304
25960
  }
25305
25961
  return {
25306
- node: new IfBlock(branches, wholeSourceSpan, ast.startSourceSpan, ifBlockEndSourceSpan),
25962
+ node: new IfBlock(branches, wholeSourceSpan, ast.startSourceSpan, ifBlockEndSourceSpan, ast.nameSpan),
25307
25963
  errors
25308
25964
  };
25309
25965
  }
@@ -25320,7 +25976,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
25320
25976
  } else if (block.parameters.length > 0) {
25321
25977
  errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
25322
25978
  } else {
25323
- empty = new ForLoopBlockEmpty(visitAll(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
25979
+ empty = new ForLoopBlockEmpty(visitAll(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan);
25324
25980
  }
25325
25981
  } else {
25326
25982
  errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
@@ -25332,7 +25988,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
25332
25988
  } else {
25333
25989
  const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
25334
25990
  const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
25335
- node = new ForLoopBlock(params.itemName, params.expression, params.trackBy, params.context, visitAll(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan);
25991
+ node = new ForLoopBlock(params.itemName, params.expression, params.trackBy.expression, params.trackBy.keywordSpan, params.context, visitAll(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan, ast.nameSpan);
25336
25992
  }
25337
25993
  }
25338
25994
  return { node, errors };
@@ -25348,11 +26004,11 @@ function createSwitchBlock(ast, visitor, bindingParser) {
25348
26004
  continue;
25349
26005
  }
25350
26006
  if ((node.name !== "case" || node.parameters.length === 0) && node.name !== "default") {
25351
- unknownBlocks.push(new UnknownBlock(node.name, node.sourceSpan));
26007
+ unknownBlocks.push(new UnknownBlock(node.name, node.sourceSpan, node.nameSpan));
25352
26008
  continue;
25353
26009
  }
25354
26010
  const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
25355
- const ast2 = new SwitchBlockCase(expression, visitAll(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
26011
+ const ast2 = new SwitchBlockCase(expression, visitAll(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
25356
26012
  if (expression === null) {
25357
26013
  defaultCase = ast2;
25358
26014
  } else {
@@ -25363,7 +26019,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
25363
26019
  cases.push(defaultCase);
25364
26020
  }
25365
26021
  return {
25366
- node: new SwitchBlock(primaryExpression, cases, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
26022
+ node: new SwitchBlock(primaryExpression, cases, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan),
25367
26023
  errors
25368
26024
  };
25369
26025
  }
@@ -25397,7 +26053,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
25397
26053
  if (result.trackBy !== null) {
25398
26054
  errors.push(new ParseError(param.sourceSpan, '@for loop can only have one "track" expression'));
25399
26055
  } else {
25400
- result.trackBy = parseBlockParameterToBinding(param, bindingParser, trackMatch[1]);
26056
+ const expression = parseBlockParameterToBinding(param, bindingParser, trackMatch[1]);
26057
+ const keywordSpan = new ParseSourceSpan(param.sourceSpan.start, param.sourceSpan.start.moveBy("track".length));
26058
+ result.trackBy = { expression, keywordSpan };
25401
26059
  }
25402
26060
  continue;
25403
26061
  }
@@ -25456,7 +26114,7 @@ function validateSwitchBlock(ast) {
25456
26114
  return errors;
25457
26115
  }
25458
26116
  for (const node of ast.children) {
25459
- if (node instanceof Text && node.value.trim().length === 0) {
26117
+ if (node instanceof Comment || node instanceof Text && node.value.trim().length === 0) {
25460
26118
  continue;
25461
26119
  }
25462
26120
  if (!(node instanceof Block) || node.name !== "case" && node.name !== "default") {
@@ -25551,7 +26209,7 @@ function stripOptionalParentheses(param, errors) {
25551
26209
  }
25552
26210
  return expression.slice(start, end);
25553
26211
  }
25554
- var TIME_PATTERN = /^\d+(ms|s)?$/;
26212
+ var TIME_PATTERN = /^\d+\.?\d*(ms|s)?$/;
25555
26213
  var SEPARATOR_PATTERN = /^\s$/;
25556
26214
  var COMMA_DELIMITED_SYNTAX = /* @__PURE__ */ new Map([
25557
26215
  [$LBRACE, $RBRACE],
@@ -25569,32 +26227,44 @@ var OnTriggerType;
25569
26227
  })(OnTriggerType || (OnTriggerType = {}));
25570
26228
  function parseWhenTrigger({ expression, sourceSpan }, bindingParser, triggers, errors) {
25571
26229
  const whenIndex = expression.indexOf("when");
26230
+ const whenSourceSpan = new ParseSourceSpan(sourceSpan.start.moveBy(whenIndex), sourceSpan.start.moveBy(whenIndex + "when".length));
26231
+ const prefetchSpan = getPrefetchSpan(expression, sourceSpan);
25572
26232
  if (whenIndex === -1) {
25573
26233
  errors.push(new ParseError(sourceSpan, `Could not find "when" keyword in expression`));
25574
26234
  } else {
25575
26235
  const start = getTriggerParametersStart(expression, whenIndex + 1);
25576
26236
  const parsed = bindingParser.parseBinding(expression.slice(start), false, sourceSpan, sourceSpan.start.offset + start);
25577
- trackTrigger("when", triggers, errors, new BoundDeferredTrigger(parsed, sourceSpan));
26237
+ trackTrigger("when", triggers, errors, new BoundDeferredTrigger(parsed, sourceSpan, prefetchSpan, whenSourceSpan));
25578
26238
  }
25579
26239
  }
25580
26240
  function parseOnTrigger({ expression, sourceSpan }, triggers, errors, placeholder) {
25581
26241
  const onIndex = expression.indexOf("on");
26242
+ const onSourceSpan = new ParseSourceSpan(sourceSpan.start.moveBy(onIndex), sourceSpan.start.moveBy(onIndex + "on".length));
26243
+ const prefetchSpan = getPrefetchSpan(expression, sourceSpan);
25582
26244
  if (onIndex === -1) {
25583
26245
  errors.push(new ParseError(sourceSpan, `Could not find "on" keyword in expression`));
25584
26246
  } else {
25585
26247
  const start = getTriggerParametersStart(expression, onIndex + 1);
25586
- const parser = new OnTriggerParser(expression, start, sourceSpan, triggers, errors, placeholder);
26248
+ const parser = new OnTriggerParser(expression, start, sourceSpan, triggers, errors, placeholder, prefetchSpan, onSourceSpan);
25587
26249
  parser.parse();
25588
26250
  }
25589
26251
  }
26252
+ function getPrefetchSpan(expression, sourceSpan) {
26253
+ if (!expression.startsWith("prefetch")) {
26254
+ return null;
26255
+ }
26256
+ return new ParseSourceSpan(sourceSpan.start, sourceSpan.start.moveBy("prefetch".length));
26257
+ }
25590
26258
  var OnTriggerParser = class {
25591
- constructor(expression, start, span, triggers, errors, placeholder) {
26259
+ constructor(expression, start, span, triggers, errors, placeholder, prefetchSpan, onSourceSpan) {
25592
26260
  this.expression = expression;
25593
26261
  this.start = start;
25594
26262
  this.span = span;
25595
26263
  this.triggers = triggers;
25596
26264
  this.errors = errors;
25597
26265
  this.placeholder = placeholder;
26266
+ this.prefetchSpan = prefetchSpan;
26267
+ this.onSourceSpan = onSourceSpan;
25598
26268
  this.index = 0;
25599
26269
  this.tokens = new Lexer().tokenize(expression.slice(start));
25600
26270
  }
@@ -25636,28 +26306,32 @@ var OnTriggerParser = class {
25636
26306
  return this.tokens[Math.min(this.index, this.tokens.length - 1)];
25637
26307
  }
25638
26308
  consumeTrigger(identifier, parameters) {
25639
- const startSpan = this.span.start.moveBy(this.start + identifier.index - this.tokens[0].index);
25640
- const endSpan = startSpan.moveBy(this.token().end - identifier.index);
25641
- const sourceSpan = new ParseSourceSpan(startSpan, endSpan);
26309
+ const triggerNameStartSpan = this.span.start.moveBy(this.start + identifier.index - this.tokens[0].index);
26310
+ const nameSpan = new ParseSourceSpan(triggerNameStartSpan, triggerNameStartSpan.moveBy(identifier.strValue.length));
26311
+ const endSpan = triggerNameStartSpan.moveBy(this.token().end - identifier.index);
26312
+ const isFirstTrigger = identifier.index === 0;
26313
+ const onSourceSpan = isFirstTrigger ? this.onSourceSpan : null;
26314
+ const prefetchSourceSpan = isFirstTrigger ? this.prefetchSpan : null;
26315
+ const sourceSpan = new ParseSourceSpan(isFirstTrigger ? this.span.start : triggerNameStartSpan, endSpan);
25642
26316
  try {
25643
26317
  switch (identifier.toString()) {
25644
26318
  case OnTriggerType.IDLE:
25645
- this.trackTrigger("idle", createIdleTrigger(parameters, sourceSpan));
26319
+ this.trackTrigger("idle", createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSourceSpan, onSourceSpan));
25646
26320
  break;
25647
26321
  case OnTriggerType.TIMER:
25648
- this.trackTrigger("timer", createTimerTrigger(parameters, sourceSpan));
26322
+ this.trackTrigger("timer", createTimerTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan));
25649
26323
  break;
25650
26324
  case OnTriggerType.INTERACTION:
25651
- this.trackTrigger("interaction", createInteractionTrigger(parameters, sourceSpan, this.placeholder));
26325
+ this.trackTrigger("interaction", createInteractionTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
25652
26326
  break;
25653
26327
  case OnTriggerType.IMMEDIATE:
25654
- this.trackTrigger("immediate", createImmediateTrigger(parameters, sourceSpan));
26328
+ this.trackTrigger("immediate", createImmediateTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan));
25655
26329
  break;
25656
26330
  case OnTriggerType.HOVER:
25657
- this.trackTrigger("hover", createHoverTrigger(parameters, sourceSpan, this.placeholder));
26331
+ this.trackTrigger("hover", createHoverTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
25658
26332
  break;
25659
26333
  case OnTriggerType.VIEWPORT:
25660
- this.trackTrigger("viewport", createViewportTrigger(parameters, sourceSpan, this.placeholder));
26334
+ this.trackTrigger("viewport", createViewportTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
25661
26335
  break;
25662
26336
  default:
25663
26337
  throw new Error(`Unrecognized trigger type "${identifier}"`);
@@ -25728,13 +26402,13 @@ function trackTrigger(name, allTriggers, errors, trigger) {
25728
26402
  allTriggers[name] = trigger;
25729
26403
  }
25730
26404
  }
25731
- function createIdleTrigger(parameters, sourceSpan) {
26405
+ function createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
25732
26406
  if (parameters.length > 0) {
25733
26407
  throw new Error(`"${OnTriggerType.IDLE}" trigger cannot have parameters`);
25734
26408
  }
25735
- return new IdleDeferredTrigger(sourceSpan);
26409
+ return new IdleDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
25736
26410
  }
25737
- function createTimerTrigger(parameters, sourceSpan) {
26411
+ function createTimerTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
25738
26412
  if (parameters.length !== 1) {
25739
26413
  throw new Error(`"${OnTriggerType.TIMER}" trigger must have exactly one parameter`);
25740
26414
  }
@@ -25742,28 +26416,28 @@ function createTimerTrigger(parameters, sourceSpan) {
25742
26416
  if (delay === null) {
25743
26417
  throw new Error(`Could not parse time value of trigger "${OnTriggerType.TIMER}"`);
25744
26418
  }
25745
- return new TimerDeferredTrigger(delay, sourceSpan);
26419
+ return new TimerDeferredTrigger(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
25746
26420
  }
25747
- function createImmediateTrigger(parameters, sourceSpan) {
26421
+ function createImmediateTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
25748
26422
  if (parameters.length > 0) {
25749
26423
  throw new Error(`"${OnTriggerType.IMMEDIATE}" trigger cannot have parameters`);
25750
26424
  }
25751
- return new ImmediateDeferredTrigger(sourceSpan);
26425
+ return new ImmediateDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
25752
26426
  }
25753
- function createHoverTrigger(parameters, sourceSpan, placeholder) {
26427
+ function createHoverTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
25754
26428
  var _a2;
25755
26429
  validateReferenceBasedTrigger(OnTriggerType.HOVER, parameters, placeholder);
25756
- return new HoverDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
26430
+ return new HoverDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
25757
26431
  }
25758
- function createInteractionTrigger(parameters, sourceSpan, placeholder) {
26432
+ function createInteractionTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
25759
26433
  var _a2;
25760
26434
  validateReferenceBasedTrigger(OnTriggerType.INTERACTION, parameters, placeholder);
25761
- return new InteractionDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
26435
+ return new InteractionDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
25762
26436
  }
25763
- function createViewportTrigger(parameters, sourceSpan, placeholder) {
26437
+ function createViewportTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
25764
26438
  var _a2;
25765
26439
  validateReferenceBasedTrigger(OnTriggerType.VIEWPORT, parameters, placeholder);
25766
- return new ViewportDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
26440
+ return new ViewportDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
25767
26441
  }
25768
26442
  function validateReferenceBasedTrigger(type, parameters, placeholder) {
25769
26443
  if (parameters.length > 1) {
@@ -25795,7 +26469,7 @@ function parseDeferredTime(value) {
25795
26469
  return null;
25796
26470
  }
25797
26471
  const [time, units] = match;
25798
- return parseInt(time) * (units === "s" ? 1e3 : 1);
26472
+ return parseFloat(time) * (units === "s" ? 1e3 : 1);
25799
26473
  }
25800
26474
  var PREFETCH_WHEN_PATTERN = /^prefetch\s+when\s/;
25801
26475
  var PREFETCH_ON_PATTERN = /^prefetch\s+on\s/;
@@ -25817,8 +26491,8 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
25817
26491
  lastEndSourceSpan = lastConnectedBlock.endSourceSpan;
25818
26492
  endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
25819
26493
  }
25820
- const mainDeferredSourceSpan = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
25821
- const node = new DeferredBlock(visitAll(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, mainDeferredSourceSpan, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
26494
+ const sourceSpanWithConnectedBlocks = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
26495
+ const node = new DeferredBlock(visitAll(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
25822
26496
  return { node, errors };
25823
26497
  }
25824
26498
  function parseConnectedBlocks(connectedBlocks, errors, visitor) {
@@ -25876,7 +26550,7 @@ function parsePlaceholderBlock(ast, visitor) {
25876
26550
  throw new Error(`Unrecognized parameter in @placeholder block: "${param.expression}"`);
25877
26551
  }
25878
26552
  }
25879
- return new DeferredBlockPlaceholder(visitAll(visitor, ast.children, ast.children), minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
26553
+ return new DeferredBlockPlaceholder(visitAll(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
25880
26554
  }
25881
26555
  function parseLoadingBlock(ast, visitor) {
25882
26556
  let afterTime = null;
@@ -25904,13 +26578,13 @@ function parseLoadingBlock(ast, visitor) {
25904
26578
  throw new Error(`Unrecognized parameter in @loading block: "${param.expression}"`);
25905
26579
  }
25906
26580
  }
25907
- return new DeferredBlockLoading(visitAll(visitor, ast.children, ast.children), afterTime, minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
26581
+ return new DeferredBlockLoading(visitAll(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
25908
26582
  }
25909
26583
  function parseErrorBlock(ast, visitor) {
25910
26584
  if (ast.parameters.length > 0) {
25911
26585
  throw new Error(`@error block cannot have parameters`);
25912
26586
  }
25913
- return new DeferredBlockError(visitAll(visitor, ast.children, ast.children), ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
26587
+ return new DeferredBlockError(visitAll(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
25914
26588
  }
25915
26589
  function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
25916
26590
  const triggers = {};
@@ -26147,7 +26821,7 @@ var HtmlAstToIvyAst = class {
26147
26821
  errorMessage = `Unrecognized block @${block.name}.`;
26148
26822
  }
26149
26823
  result = {
26150
- node: new UnknownBlock(block.name, block.sourceSpan),
26824
+ node: new UnknownBlock(block.name, block.sourceSpan, block.nameSpan),
26151
26825
  errors: [new ParseError(block.sourceSpan, errorMessage)]
26152
26826
  };
26153
26827
  break;
@@ -26495,6 +27169,7 @@ function serializePlaceholderValue(value) {
26495
27169
  var NG_CONTENT_SELECT_ATTR = "select";
26496
27170
  var NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
26497
27171
  var EVENT_BINDING_SCOPE_GLOBALS = /* @__PURE__ */ new Set(["$event"]);
27172
+ var NG_TEMPLATE_TAG_NAME = "ng-template";
26498
27173
  var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
26499
27174
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
26500
27175
  function renderFlagCheckIfStmt(flags, statements) {
@@ -27073,7 +27748,6 @@ var TemplateDefinitionBuilder = class {
27073
27748
  var _a2;
27074
27749
  const tagNameWithoutNamespace = template2.tagName ? splitNsName(template2.tagName)[1] : template2.tagName;
27075
27750
  const contextNameSuffix = template2.tagName ? "_" + sanitizeIdentifier(template2.tagName) : "";
27076
- const NG_TEMPLATE_TAG_NAME = "ng-template";
27077
27751
  const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
27078
27752
  const templateIndex = this.createEmbeddedTemplateFn(tagNameWithoutNamespace, template2.children, contextNameSuffix, template2.sourceSpan, template2.variables, attrsExprs, template2.references, template2.i18n);
27079
27753
  this.templatePropertyBindings(templateIndex, template2.templateAttrs);
@@ -27143,11 +27817,19 @@ var TemplateDefinitionBuilder = class {
27143
27817
  }
27144
27818
  visitIfBlock(block) {
27145
27819
  this.allocateBindingSlots(null);
27146
- const branchData = block.branches.map(({ expression, expressionAlias, children, sourceSpan }) => {
27820
+ const branchData = block.branches.map((branch, branchIndex) => {
27821
+ const { expression, expressionAlias, children, sourceSpan } = branch;
27147
27822
  const variables = expressionAlias !== null ? [new Variable(expressionAlias.name, DIRECT_CONTEXT_REFERENCE, expressionAlias.sourceSpan, expressionAlias.keySpan)] : void 0;
27148
- const index2 = this.createEmbeddedTemplateFn(null, children, "_Conditional", sourceSpan, variables);
27823
+ let tagName = null;
27824
+ let attrsExprs;
27825
+ if (branchIndex === 0) {
27826
+ const inferredData = this.inferProjectionDataFromInsertionPoint(branch);
27827
+ tagName = inferredData.tagName;
27828
+ attrsExprs = inferredData.attrsExprs;
27829
+ }
27830
+ const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs);
27149
27831
  const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
27150
- return { index: index2, expression: processedExpression, alias: expressionAlias };
27832
+ return { index: templateIndex, expression: processedExpression, alias: expressionAlias };
27151
27833
  });
27152
27834
  const containerIndex = branchData[0].index;
27153
27835
  const paramsCallback = () => {
@@ -27292,11 +27974,34 @@ var TemplateDefinitionBuilder = class {
27292
27974
  return params;
27293
27975
  });
27294
27976
  }
27977
+ inferProjectionDataFromInsertionPoint(node) {
27978
+ let root2 = null;
27979
+ let tagName = null;
27980
+ let attrsExprs;
27981
+ for (const child of node.children) {
27982
+ if (child instanceof Comment$1) {
27983
+ continue;
27984
+ }
27985
+ if (root2 !== null) {
27986
+ root2 = null;
27987
+ break;
27988
+ }
27989
+ if (child instanceof Element$1 || child instanceof Template && child.tagName !== null) {
27990
+ root2 = child;
27991
+ }
27992
+ }
27993
+ if (root2 !== null) {
27994
+ tagName = root2 instanceof Element$1 ? root2.name : root2.tagName;
27995
+ attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root2.attributes, root2.inputs, []);
27996
+ }
27997
+ return { tagName, attrsExprs };
27998
+ }
27295
27999
  allocateDataSlot() {
27296
28000
  return this._dataIndex++;
27297
28001
  }
27298
28002
  visitForLoopBlock(block) {
27299
28003
  const blockIndex = this.allocateDataSlot();
28004
+ const { tagName, attrsExprs } = this.inferProjectionDataFromInsertionPoint(block);
27300
28005
  const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]);
27301
28006
  const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
27302
28007
  let emptyData = null;
@@ -27311,6 +28016,8 @@ var TemplateDefinitionBuilder = class {
27311
28016
  variable(primaryData.name),
27312
28017
  literal(primaryData.getConstCount()),
27313
28018
  literal(primaryData.getVarCount()),
28019
+ literal(tagName),
28020
+ this.addAttrsToConsts(attrsExprs || null),
27314
28021
  trackByExpression
27315
28022
  ];
27316
28023
  if (emptyData !== null) {
@@ -27677,9 +28384,9 @@ function pureFunctionCallInfo(args) {
27677
28384
  function generateNextContextExpr(relativeLevelDiff) {
27678
28385
  return importExpr(Identifiers.nextContext).callFn(relativeLevelDiff > 1 ? [literal(relativeLevelDiff)] : []);
27679
28386
  }
27680
- function getLiteralFactory(constantPool, literal$1, allocateSlots) {
28387
+ function getLiteralFactory(constantPool, literal$1, allocateSlots2) {
27681
28388
  const { literalFactory, literalFactoryArguments } = constantPool.getLiteralFactory(literal$1);
27682
- const startSlot = allocateSlots(1 + literalFactoryArguments.length);
28389
+ const startSlot = allocateSlots2(1 + literalFactoryArguments.length);
27683
28390
  const { identifier, isVarLength } = pureFunctionCallInfo(literalFactoryArguments);
27684
28391
  const args = [literal(startSlot), literalFactory];
27685
28392
  if (isVarLength) {
@@ -29242,8 +29949,21 @@ var R3BoundTarget = class {
29242
29949
  }
29243
29950
  const name = trigger.reference;
29244
29951
  if (name === null) {
29245
- const children = block.placeholder ? block.placeholder.children : null;
29246
- return children !== null && children.length === 1 && children[0] instanceof Element$1 ? children[0] : null;
29952
+ let trigger2 = null;
29953
+ if (block.placeholder !== null) {
29954
+ for (const child of block.placeholder.children) {
29955
+ if (child instanceof Comment$1) {
29956
+ continue;
29957
+ }
29958
+ if (trigger2 !== null) {
29959
+ return null;
29960
+ }
29961
+ if (child instanceof Element$1) {
29962
+ trigger2 = child;
29963
+ }
29964
+ }
29965
+ }
29966
+ return trigger2;
29247
29967
  }
29248
29968
  const outsideRef = this.findEntityInScope(block, name);
29249
29969
  if (outsideRef instanceof Reference && this.getDefinitionNodeOfSymbol(outsideRef) !== block) {
@@ -29551,7 +30271,7 @@ function convertDirectiveFacadeToMetadata(facade) {
29551
30271
  });
29552
30272
  }
29553
30273
  function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
29554
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i;
30274
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
29555
30275
  return {
29556
30276
  name: declaration.type.name,
29557
30277
  type: wrapReference(declaration.type),
@@ -29565,11 +30285,11 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
29565
30285
  providers: declaration.providers !== void 0 ? new WrappedNodeExpr(declaration.providers) : null,
29566
30286
  exportAs: (_e2 = declaration.exportAs) != null ? _e2 : null,
29567
30287
  usesInheritance: (_f2 = declaration.usesInheritance) != null ? _f2 : false,
29568
- lifecycle: { usesOnChanges: (_g2 = declaration.usesOnChanges) != null ? _g2 : false },
30288
+ lifecycle: { usesOnChanges: (_g = declaration.usesOnChanges) != null ? _g : false },
29569
30289
  deps: null,
29570
30290
  typeArgumentCount: 0,
29571
30291
  fullInheritance: false,
29572
- isStandalone: (_h2 = declaration.isStandalone) != null ? _h2 : false,
30292
+ isStandalone: (_h = declaration.isStandalone) != null ? _h : false,
29573
30293
  isSignal: (_i = declaration.isSignal) != null ? _i : false,
29574
30294
  hostDirectives: convertHostDirectivesToMetadata(declaration)
29575
30295
  };
@@ -29862,7 +30582,7 @@ function publishFacade(global) {
29862
30582
  const ng = global.ng || (global.ng = {});
29863
30583
  ng.\u0275compilerFacade = new CompilerFacadeImpl();
29864
30584
  }
29865
- var VERSION = new Version("17.0.0-rc.0");
30585
+ var VERSION = new Version("17.0.0-rc.2");
29866
30586
  var _VisitorMode;
29867
30587
  (function(_VisitorMode2) {
29868
30588
  _VisitorMode2[_VisitorMode2["Extract"] = 0] = "Extract";
@@ -31793,6 +32513,14 @@ ${[...componentsToMigrate].join("\n")}`);
31793
32513
  }
31794
32514
  // Annotate the CommonJS export names for ESM import in node:
31795
32515
  0 && (module.exports = {});
32516
+ /**
32517
+ *
32518
+ * @license
32519
+ * Copyright Google LLC All Rights Reserved.
32520
+ *
32521
+ * Use of this source code is governed by an MIT-style license that can be
32522
+ * found in the LICENSE file at https://angular.io/license
32523
+ */
31796
32524
  /**
31797
32525
  * @license
31798
32526
  * Copyright Google LLC All Rights Reserved.
@@ -31801,7 +32529,7 @@ ${[...componentsToMigrate].join("\n")}`);
31801
32529
  * found in the LICENSE file at https://angular.io/license
31802
32530
  */
31803
32531
  /**
31804
- * @license Angular v17.0.0-rc.0
32532
+ * @license Angular v17.0.0-rc.2
31805
32533
  * (c) 2010-2022 Google LLC. https://angular.io/
31806
32534
  * License: MIT
31807
32535
  */