@forgeroute/ui 0.5.16 → 0.5.17

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 (340) hide show
  1. package/fesm2022/forgeroute-ui-action-bar.mjs +190 -0
  2. package/fesm2022/forgeroute-ui-action-bar.mjs.map +1 -0
  3. package/fesm2022/forgeroute-ui-address-input.mjs +1164 -0
  4. package/fesm2022/forgeroute-ui-address-input.mjs.map +1 -0
  5. package/fesm2022/forgeroute-ui-alert.mjs +223 -0
  6. package/fesm2022/forgeroute-ui-alert.mjs.map +1 -0
  7. package/fesm2022/forgeroute-ui-avatar.mjs +320 -0
  8. package/fesm2022/forgeroute-ui-avatar.mjs.map +1 -0
  9. package/fesm2022/forgeroute-ui-badge.mjs +158 -0
  10. package/fesm2022/forgeroute-ui-badge.mjs.map +1 -0
  11. package/fesm2022/forgeroute-ui-bar-row.mjs +255 -0
  12. package/fesm2022/forgeroute-ui-bar-row.mjs.map +1 -0
  13. package/fesm2022/forgeroute-ui-boards.mjs +2201 -0
  14. package/fesm2022/forgeroute-ui-boards.mjs.map +1 -0
  15. package/fesm2022/forgeroute-ui-bulk-eligible.mjs +172 -0
  16. package/fesm2022/forgeroute-ui-bulk-eligible.mjs.map +1 -0
  17. package/fesm2022/forgeroute-ui-business-hours.mjs +771 -0
  18. package/fesm2022/forgeroute-ui-business-hours.mjs.map +1 -0
  19. package/fesm2022/forgeroute-ui-calendar.mjs +2006 -0
  20. package/fesm2022/forgeroute-ui-calendar.mjs.map +1 -0
  21. package/fesm2022/forgeroute-ui-card-list-item.mjs +556 -0
  22. package/fesm2022/forgeroute-ui-card-list-item.mjs.map +1 -0
  23. package/fesm2022/forgeroute-ui-charts.mjs +1 -1
  24. package/fesm2022/forgeroute-ui-charts.mjs.map +1 -1
  25. package/fesm2022/forgeroute-ui-checkbox.mjs +815 -0
  26. package/fesm2022/forgeroute-ui-checkbox.mjs.map +1 -0
  27. package/fesm2022/forgeroute-ui-chip.mjs +379 -0
  28. package/fesm2022/forgeroute-ui-chip.mjs.map +1 -0
  29. package/fesm2022/forgeroute-ui-color-input.mjs +492 -0
  30. package/fesm2022/forgeroute-ui-color-input.mjs.map +1 -0
  31. package/fesm2022/forgeroute-ui-column-filter.mjs +645 -0
  32. package/fesm2022/forgeroute-ui-column-filter.mjs.map +1 -0
  33. package/fesm2022/forgeroute-ui-columns.mjs +351 -0
  34. package/fesm2022/forgeroute-ui-columns.mjs.map +1 -0
  35. package/fesm2022/forgeroute-ui-combobox.mjs +772 -0
  36. package/fesm2022/forgeroute-ui-combobox.mjs.map +1 -0
  37. package/fesm2022/forgeroute-ui-confirm.mjs +48 -0
  38. package/fesm2022/forgeroute-ui-confirm.mjs.map +1 -0
  39. package/fesm2022/forgeroute-ui-contact-picker.mjs +865 -0
  40. package/fesm2022/forgeroute-ui-contact-picker.mjs.map +1 -0
  41. package/fesm2022/forgeroute-ui-conversations.mjs +3627 -0
  42. package/fesm2022/forgeroute-ui-conversations.mjs.map +1 -0
  43. package/fesm2022/forgeroute-ui-copy-field.mjs +378 -0
  44. package/fesm2022/forgeroute-ui-copy-field.mjs.map +1 -0
  45. package/fesm2022/forgeroute-ui-data-table-core.mjs +6150 -0
  46. package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -0
  47. package/fesm2022/forgeroute-ui-date-input.mjs +384 -0
  48. package/fesm2022/forgeroute-ui-date-input.mjs.map +1 -0
  49. package/fesm2022/forgeroute-ui-date-range-picker.mjs +453 -0
  50. package/fesm2022/forgeroute-ui-date-range-picker.mjs.map +1 -0
  51. package/fesm2022/forgeroute-ui-datetime-input.mjs +375 -0
  52. package/fesm2022/forgeroute-ui-datetime-input.mjs.map +1 -0
  53. package/fesm2022/forgeroute-ui-detail-card.mjs +655 -0
  54. package/fesm2022/forgeroute-ui-detail-card.mjs.map +1 -0
  55. package/fesm2022/forgeroute-ui-discount-selector.mjs +259 -0
  56. package/fesm2022/forgeroute-ui-discount-selector.mjs.map +1 -0
  57. package/fesm2022/forgeroute-ui-divider.mjs +111 -0
  58. package/fesm2022/forgeroute-ui-divider.mjs.map +1 -0
  59. package/fesm2022/forgeroute-ui-dropdown.mjs +550 -0
  60. package/fesm2022/forgeroute-ui-dropdown.mjs.map +1 -0
  61. package/fesm2022/forgeroute-ui-editor.mjs +4545 -0
  62. package/fesm2022/forgeroute-ui-editor.mjs.map +1 -0
  63. package/fesm2022/forgeroute-ui-empty-state.mjs +231 -0
  64. package/fesm2022/forgeroute-ui-empty-state.mjs.map +1 -0
  65. package/fesm2022/forgeroute-ui-error-state.mjs +195 -0
  66. package/fesm2022/forgeroute-ui-error-state.mjs.map +1 -0
  67. package/fesm2022/forgeroute-ui-error.mjs +93 -0
  68. package/fesm2022/forgeroute-ui-error.mjs.map +1 -0
  69. package/fesm2022/forgeroute-ui-fade.mjs +117 -0
  70. package/fesm2022/forgeroute-ui-fade.mjs.map +1 -0
  71. package/fesm2022/forgeroute-ui-file-input.mjs +999 -0
  72. package/fesm2022/forgeroute-ui-file-input.mjs.map +1 -0
  73. package/fesm2022/forgeroute-ui-fixed-footer.mjs +115 -0
  74. package/fesm2022/forgeroute-ui-fixed-footer.mjs.map +1 -0
  75. package/fesm2022/forgeroute-ui-form-row.mjs +126 -0
  76. package/fesm2022/forgeroute-ui-form-row.mjs.map +1 -0
  77. package/fesm2022/forgeroute-ui-form-section.mjs +93 -0
  78. package/fesm2022/forgeroute-ui-form-section.mjs.map +1 -0
  79. package/fesm2022/forgeroute-ui-form.mjs +139 -0
  80. package/fesm2022/forgeroute-ui-form.mjs.map +1 -0
  81. package/fesm2022/forgeroute-ui-hint.mjs +47 -0
  82. package/fesm2022/forgeroute-ui-hint.mjs.map +1 -0
  83. package/fesm2022/forgeroute-ui-icon-picker.mjs +424 -0
  84. package/fesm2022/forgeroute-ui-icon-picker.mjs.map +1 -0
  85. package/fesm2022/forgeroute-ui-icon.mjs +311 -0
  86. package/fesm2022/forgeroute-ui-icon.mjs.map +1 -0
  87. package/fesm2022/forgeroute-ui-image-preview.mjs +237 -0
  88. package/fesm2022/forgeroute-ui-image-preview.mjs.map +1 -0
  89. package/fesm2022/forgeroute-ui-keypad.mjs +278 -0
  90. package/fesm2022/forgeroute-ui-keypad.mjs.map +1 -0
  91. package/fesm2022/forgeroute-ui-kpi-card.mjs +490 -0
  92. package/fesm2022/forgeroute-ui-kpi-card.mjs.map +1 -0
  93. package/fesm2022/forgeroute-ui-language-switcher.mjs +134 -0
  94. package/fesm2022/forgeroute-ui-language-switcher.mjs.map +1 -0
  95. package/fesm2022/forgeroute-ui-layout.mjs +18 -0
  96. package/fesm2022/forgeroute-ui-layout.mjs.map +1 -0
  97. package/fesm2022/forgeroute-ui-list-item.mjs +620 -0
  98. package/fesm2022/forgeroute-ui-list-item.mjs.map +1 -0
  99. package/fesm2022/forgeroute-ui-list.mjs +866 -0
  100. package/fesm2022/forgeroute-ui-list.mjs.map +1 -0
  101. package/fesm2022/forgeroute-ui-live-region.mjs +118 -0
  102. package/fesm2022/forgeroute-ui-live-region.mjs.map +1 -0
  103. package/fesm2022/forgeroute-ui-map.mjs +5 -1
  104. package/fesm2022/forgeroute-ui-map.mjs.map +1 -1
  105. package/fesm2022/forgeroute-ui-maps.mjs +2 -1
  106. package/fesm2022/forgeroute-ui-maps.mjs.map +1 -1
  107. package/fesm2022/forgeroute-ui-media.mjs +4615 -0
  108. package/fesm2022/forgeroute-ui-media.mjs.map +1 -0
  109. package/fesm2022/forgeroute-ui-messaging.mjs +20 -1
  110. package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
  111. package/fesm2022/forgeroute-ui-more-menu.mjs +418 -0
  112. package/fesm2022/forgeroute-ui-more-menu.mjs.map +1 -0
  113. package/fesm2022/forgeroute-ui-multi-select.mjs +532 -0
  114. package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -0
  115. package/fesm2022/forgeroute-ui-notes.mjs +768 -0
  116. package/fesm2022/forgeroute-ui-notes.mjs.map +1 -0
  117. package/fesm2022/forgeroute-ui-notification-bell.mjs +587 -0
  118. package/fesm2022/forgeroute-ui-notification-bell.mjs.map +1 -0
  119. package/fesm2022/forgeroute-ui-offline-banner.mjs +156 -0
  120. package/fesm2022/forgeroute-ui-offline-banner.mjs.map +1 -0
  121. package/fesm2022/forgeroute-ui-option-card.mjs +379 -0
  122. package/fesm2022/forgeroute-ui-option-card.mjs.map +1 -0
  123. package/fesm2022/forgeroute-ui-page.mjs +317 -0
  124. package/fesm2022/forgeroute-ui-page.mjs.map +1 -0
  125. package/fesm2022/forgeroute-ui-pagination.mjs +225 -0
  126. package/fesm2022/forgeroute-ui-pagination.mjs.map +1 -0
  127. package/fesm2022/forgeroute-ui-panel-info-list.mjs +422 -0
  128. package/fesm2022/forgeroute-ui-panel-info-list.mjs.map +1 -0
  129. package/fesm2022/forgeroute-ui-password-requirements.mjs +237 -0
  130. package/fesm2022/forgeroute-ui-password-requirements.mjs.map +1 -0
  131. package/fesm2022/forgeroute-ui-payments.mjs +6243 -0
  132. package/fesm2022/forgeroute-ui-payments.mjs.map +1 -0
  133. package/fesm2022/forgeroute-ui-pdf.mjs +9 -1
  134. package/fesm2022/forgeroute-ui-pdf.mjs.map +1 -1
  135. package/fesm2022/forgeroute-ui-phone-number-picker.mjs +840 -0
  136. package/fesm2022/forgeroute-ui-phone-number-picker.mjs.map +1 -0
  137. package/fesm2022/forgeroute-ui-pill-tabs.mjs +546 -0
  138. package/fesm2022/forgeroute-ui-pill-tabs.mjs.map +1 -0
  139. package/fesm2022/forgeroute-ui-print.mjs +76 -0
  140. package/fesm2022/forgeroute-ui-print.mjs.map +1 -0
  141. package/fesm2022/forgeroute-ui-progress-bar.mjs +252 -0
  142. package/fesm2022/forgeroute-ui-progress-bar.mjs.map +1 -0
  143. package/fesm2022/forgeroute-ui-progress-ring.mjs +277 -0
  144. package/fesm2022/forgeroute-ui-progress-ring.mjs.map +1 -0
  145. package/fesm2022/forgeroute-ui-quick-filter-tabs.mjs +301 -0
  146. package/fesm2022/forgeroute-ui-quick-filter-tabs.mjs.map +1 -0
  147. package/fesm2022/forgeroute-ui-quickbooks.mjs +18 -1
  148. package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
  149. package/fesm2022/forgeroute-ui-radio-matrix.mjs +471 -0
  150. package/fesm2022/forgeroute-ui-radio-matrix.mjs.map +1 -0
  151. package/fesm2022/forgeroute-ui-radio.mjs +911 -0
  152. package/fesm2022/forgeroute-ui-radio.mjs.map +1 -0
  153. package/fesm2022/forgeroute-ui-read-only-mode.mjs +15 -0
  154. package/fesm2022/forgeroute-ui-read-only-mode.mjs.map +1 -0
  155. package/fesm2022/forgeroute-ui-readonly-fieldset.mjs +146 -0
  156. package/fesm2022/forgeroute-ui-readonly-fieldset.mjs.map +1 -0
  157. package/fesm2022/forgeroute-ui-reminder-alerts.mjs +249 -0
  158. package/fesm2022/forgeroute-ui-reminder-alerts.mjs.map +1 -0
  159. package/fesm2022/forgeroute-ui-search-input.mjs +373 -0
  160. package/fesm2022/forgeroute-ui-search-input.mjs.map +1 -0
  161. package/fesm2022/forgeroute-ui-section-header.mjs +296 -0
  162. package/fesm2022/forgeroute-ui-section-header.mjs.map +1 -0
  163. package/fesm2022/forgeroute-ui-select.mjs +498 -0
  164. package/fesm2022/forgeroute-ui-select.mjs.map +1 -0
  165. package/fesm2022/forgeroute-ui-setup.mjs +4649 -0
  166. package/fesm2022/forgeroute-ui-setup.mjs.map +1 -0
  167. package/fesm2022/forgeroute-ui-share-menu.mjs +461 -0
  168. package/fesm2022/forgeroute-ui-share-menu.mjs.map +1 -0
  169. package/fesm2022/forgeroute-ui-shell.mjs +981 -0
  170. package/fesm2022/forgeroute-ui-shell.mjs.map +1 -0
  171. package/fesm2022/forgeroute-ui-show.mjs +129 -0
  172. package/fesm2022/forgeroute-ui-show.mjs.map +1 -0
  173. package/fesm2022/forgeroute-ui-sidebar-layout.mjs +355 -0
  174. package/fesm2022/forgeroute-ui-sidebar-layout.mjs.map +1 -0
  175. package/fesm2022/forgeroute-ui-skeleton.mjs +152 -0
  176. package/fesm2022/forgeroute-ui-skeleton.mjs.map +1 -0
  177. package/fesm2022/forgeroute-ui-skip-link.mjs +129 -0
  178. package/fesm2022/forgeroute-ui-skip-link.mjs.map +1 -0
  179. package/fesm2022/forgeroute-ui-snackbar.mjs +200 -0
  180. package/fesm2022/forgeroute-ui-snackbar.mjs.map +1 -0
  181. package/fesm2022/forgeroute-ui-square.mjs +15 -1
  182. package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
  183. package/fesm2022/forgeroute-ui-stack.mjs +233 -0
  184. package/fesm2022/forgeroute-ui-stack.mjs.map +1 -0
  185. package/fesm2022/forgeroute-ui-stacked-bar.mjs +200 -0
  186. package/fesm2022/forgeroute-ui-stacked-bar.mjs.map +1 -0
  187. package/fesm2022/forgeroute-ui-stacking-plan.mjs +365 -0
  188. package/fesm2022/forgeroute-ui-stacking-plan.mjs.map +1 -0
  189. package/fesm2022/forgeroute-ui-star-rating.mjs +498 -0
  190. package/fesm2022/forgeroute-ui-star-rating.mjs.map +1 -0
  191. package/fesm2022/forgeroute-ui-star.mjs +184 -0
  192. package/fesm2022/forgeroute-ui-star.mjs.map +1 -0
  193. package/fesm2022/forgeroute-ui-stepper.mjs +615 -0
  194. package/fesm2022/forgeroute-ui-stepper.mjs.map +1 -0
  195. package/fesm2022/forgeroute-ui-stripe.mjs +14 -1
  196. package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
  197. package/fesm2022/forgeroute-ui-swatch-picker.mjs +416 -0
  198. package/fesm2022/forgeroute-ui-swatch-picker.mjs.map +1 -0
  199. package/fesm2022/forgeroute-ui-table-toolbar.mjs +770 -0
  200. package/fesm2022/forgeroute-ui-table-toolbar.mjs.map +1 -0
  201. package/fesm2022/forgeroute-ui-table-types.mjs +277 -0
  202. package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -0
  203. package/fesm2022/forgeroute-ui-text-input.mjs +1003 -0
  204. package/fesm2022/forgeroute-ui-text-input.mjs.map +1 -0
  205. package/fesm2022/forgeroute-ui-text-template-picker.mjs +356 -0
  206. package/fesm2022/forgeroute-ui-text-template-picker.mjs.map +1 -0
  207. package/fesm2022/forgeroute-ui-text.mjs +195 -0
  208. package/fesm2022/forgeroute-ui-text.mjs.map +1 -0
  209. package/fesm2022/forgeroute-ui-textarea-input.mjs +542 -0
  210. package/fesm2022/forgeroute-ui-textarea-input.mjs.map +1 -0
  211. package/fesm2022/forgeroute-ui-time-input.mjs +401 -0
  212. package/fesm2022/forgeroute-ui-time-input.mjs.map +1 -0
  213. package/fesm2022/forgeroute-ui-timeline.mjs +549 -0
  214. package/fesm2022/forgeroute-ui-timeline.mjs.map +1 -0
  215. package/fesm2022/forgeroute-ui-toast.mjs +507 -0
  216. package/fesm2022/forgeroute-ui-toast.mjs.map +1 -0
  217. package/fesm2022/forgeroute-ui-toggle-badge.mjs +177 -0
  218. package/fesm2022/forgeroute-ui-toggle-badge.mjs.map +1 -0
  219. package/fesm2022/forgeroute-ui-toggle.mjs +275 -0
  220. package/fesm2022/forgeroute-ui-toggle.mjs.map +1 -0
  221. package/fesm2022/forgeroute-ui-tooltip.mjs +155 -0
  222. package/fesm2022/forgeroute-ui-tooltip.mjs.map +1 -0
  223. package/fesm2022/forgeroute-ui-utils.mjs +1071 -0
  224. package/fesm2022/forgeroute-ui-utils.mjs.map +1 -0
  225. package/fesm2022/forgeroute-ui.mjs +105 -70663
  226. package/package.json +417 -1
  227. package/types/forgeroute-ui-action-bar.d.ts +74 -0
  228. package/types/forgeroute-ui-address-input.d.ts +354 -0
  229. package/types/forgeroute-ui-alert.d.ts +89 -0
  230. package/types/forgeroute-ui-avatar.d.ts +85 -0
  231. package/types/forgeroute-ui-badge.d.ts +45 -0
  232. package/types/forgeroute-ui-bar-row.d.ts +90 -0
  233. package/types/forgeroute-ui-boards.d.ts +575 -0
  234. package/types/forgeroute-ui-bulk-eligible.d.ts +53 -0
  235. package/types/forgeroute-ui-business-hours.d.ts +191 -0
  236. package/types/forgeroute-ui-calendar.d.ts +544 -0
  237. package/types/forgeroute-ui-card-list-item.d.ts +186 -0
  238. package/types/forgeroute-ui-charts.d.ts +1 -1
  239. package/types/forgeroute-ui-checkbox.d.ts +270 -0
  240. package/types/forgeroute-ui-chip.d.ts +125 -0
  241. package/types/forgeroute-ui-color-input.d.ts +160 -0
  242. package/types/forgeroute-ui-column-filter.d.ts +130 -0
  243. package/types/forgeroute-ui-columns.d.ts +150 -0
  244. package/types/forgeroute-ui-combobox.d.ts +252 -0
  245. package/types/forgeroute-ui-confirm.d.ts +34 -0
  246. package/types/forgeroute-ui-contact-picker.d.ts +173 -0
  247. package/types/forgeroute-ui-conversations.d.ts +993 -0
  248. package/types/forgeroute-ui-copy-field.d.ts +122 -0
  249. package/types/forgeroute-ui-data-table-core.d.ts +1221 -0
  250. package/types/forgeroute-ui-date-input.d.ts +101 -0
  251. package/types/forgeroute-ui-date-range-picker.d.ts +109 -0
  252. package/types/forgeroute-ui-datetime-input.d.ts +97 -0
  253. package/types/forgeroute-ui-detail-card.d.ts +252 -0
  254. package/types/forgeroute-ui-discount-selector.d.ts +57 -0
  255. package/types/forgeroute-ui-divider.d.ts +40 -0
  256. package/types/forgeroute-ui-dropdown.d.ts +156 -0
  257. package/types/forgeroute-ui-editor.d.ts +873 -0
  258. package/types/forgeroute-ui-empty-state.d.ts +29 -0
  259. package/types/forgeroute-ui-error-state.d.ts +38 -0
  260. package/types/forgeroute-ui-error.d.ts +29 -0
  261. package/types/forgeroute-ui-fade.d.ts +39 -0
  262. package/types/forgeroute-ui-file-input.d.ts +337 -0
  263. package/types/forgeroute-ui-fixed-footer.d.ts +53 -0
  264. package/types/forgeroute-ui-form-row.d.ts +30 -0
  265. package/types/forgeroute-ui-form-section.d.ts +18 -0
  266. package/types/forgeroute-ui-form.d.ts +68 -0
  267. package/types/forgeroute-ui-hint.d.ts +10 -0
  268. package/types/forgeroute-ui-icon-picker.d.ts +122 -0
  269. package/types/forgeroute-ui-icon.d.ts +95 -0
  270. package/types/forgeroute-ui-image-preview.d.ts +88 -0
  271. package/types/forgeroute-ui-keypad.d.ts +73 -0
  272. package/types/forgeroute-ui-kpi-card.d.ts +161 -0
  273. package/types/forgeroute-ui-language-switcher.d.ts +41 -0
  274. package/types/forgeroute-ui-layout.d.ts +13 -0
  275. package/types/forgeroute-ui-list-item.d.ts +253 -0
  276. package/types/forgeroute-ui-list.d.ts +282 -0
  277. package/types/forgeroute-ui-live-region.d.ts +49 -0
  278. package/types/forgeroute-ui-map.d.ts +1 -1
  279. package/types/forgeroute-ui-maps.d.ts +1 -1
  280. package/types/forgeroute-ui-media.d.ts +1221 -0
  281. package/types/forgeroute-ui-messaging.d.ts +6 -1
  282. package/types/forgeroute-ui-more-menu.d.ts +91 -0
  283. package/types/forgeroute-ui-multi-select.d.ts +119 -0
  284. package/types/forgeroute-ui-notes.d.ts +172 -0
  285. package/types/forgeroute-ui-notification-bell.d.ts +135 -0
  286. package/types/forgeroute-ui-offline-banner.d.ts +44 -0
  287. package/types/forgeroute-ui-option-card.d.ts +106 -0
  288. package/types/forgeroute-ui-page.d.ts +115 -0
  289. package/types/forgeroute-ui-pagination.d.ts +55 -0
  290. package/types/forgeroute-ui-panel-info-list.d.ts +147 -0
  291. package/types/forgeroute-ui-password-requirements.d.ts +89 -0
  292. package/types/forgeroute-ui-payments.d.ts +1818 -0
  293. package/types/forgeroute-ui-pdf.d.ts +1 -1
  294. package/types/forgeroute-ui-phone-number-picker.d.ts +199 -0
  295. package/types/forgeroute-ui-pill-tabs.d.ts +208 -0
  296. package/types/forgeroute-ui-print.d.ts +40 -0
  297. package/types/forgeroute-ui-progress-bar.d.ts +88 -0
  298. package/types/forgeroute-ui-progress-ring.d.ts +102 -0
  299. package/types/forgeroute-ui-quick-filter-tabs.d.ts +51 -0
  300. package/types/forgeroute-ui-quickbooks.d.ts +4 -1
  301. package/types/forgeroute-ui-radio-matrix.d.ts +131 -0
  302. package/types/forgeroute-ui-radio.d.ts +311 -0
  303. package/types/forgeroute-ui-read-only-mode.d.ts +26 -0
  304. package/types/forgeroute-ui-readonly-fieldset.d.ts +62 -0
  305. package/types/forgeroute-ui-reminder-alerts.d.ts +71 -0
  306. package/types/forgeroute-ui-search-input.d.ts +93 -0
  307. package/types/forgeroute-ui-section-header.d.ts +149 -0
  308. package/types/forgeroute-ui-select.d.ts +183 -0
  309. package/types/forgeroute-ui-setup.d.ts +775 -0
  310. package/types/forgeroute-ui-share-menu.d.ts +99 -0
  311. package/types/forgeroute-ui-shell.d.ts +173 -0
  312. package/types/forgeroute-ui-show.d.ts +40 -0
  313. package/types/forgeroute-ui-sidebar-layout.d.ts +161 -0
  314. package/types/forgeroute-ui-skeleton.d.ts +51 -0
  315. package/types/forgeroute-ui-skip-link.d.ts +51 -0
  316. package/types/forgeroute-ui-snackbar.d.ts +50 -0
  317. package/types/forgeroute-ui-square.d.ts +3 -1
  318. package/types/forgeroute-ui-stack.d.ts +99 -0
  319. package/types/forgeroute-ui-stacked-bar.d.ts +84 -0
  320. package/types/forgeroute-ui-stacking-plan.d.ts +116 -0
  321. package/types/forgeroute-ui-star-rating.d.ts +151 -0
  322. package/types/forgeroute-ui-star.d.ts +46 -0
  323. package/types/forgeroute-ui-stepper.d.ts +273 -0
  324. package/types/forgeroute-ui-stripe.d.ts +3 -1
  325. package/types/forgeroute-ui-swatch-picker.d.ts +118 -0
  326. package/types/forgeroute-ui-table-toolbar.d.ts +116 -0
  327. package/types/forgeroute-ui-table-types.d.ts +624 -0
  328. package/types/forgeroute-ui-text-input.d.ts +359 -0
  329. package/types/forgeroute-ui-text-template-picker.d.ts +100 -0
  330. package/types/forgeroute-ui-text.d.ts +76 -0
  331. package/types/forgeroute-ui-textarea-input.d.ts +174 -0
  332. package/types/forgeroute-ui-time-input.d.ts +105 -0
  333. package/types/forgeroute-ui-timeline.d.ts +196 -0
  334. package/types/forgeroute-ui-toast.d.ts +131 -0
  335. package/types/forgeroute-ui-toggle-badge.d.ts +64 -0
  336. package/types/forgeroute-ui-toggle.d.ts +92 -0
  337. package/types/forgeroute-ui-tooltip.d.ts +36 -0
  338. package/types/forgeroute-ui-utils.d.ts +210 -0
  339. package/types/forgeroute-ui.d.ts +106 -19539
  340. package/fesm2022/forgeroute-ui.mjs.map +0 -1
@@ -0,0 +1,4545 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, ElementRef, Injectable, Injector, afterEveryRender, afterNextRender, computed, effect, forwardRef, inject, input, output, signal, untracked, viewChild, viewChildren } from "@angular/core";
3
+ import * as i1 from "@angular/forms";
4
+ import { FormsModule, NG_VALUE_ACCESSOR } from "@angular/forms";
5
+ import { ButtonComponent, SidePanelComponent, UiLabelsService, createFieldReveal, uiText } from "@forgeroute/ui/core";
6
+ import { DomSanitizer } from "@angular/platform-browser";
7
+ import { CheckboxComponent } from "@forgeroute/ui/checkbox";
8
+ import { DividerComponent } from "@forgeroute/ui/divider";
9
+ import { DateInputComponent } from "@forgeroute/ui/date-input";
10
+ import { EmptyStateComponent } from "@forgeroute/ui/empty-state";
11
+ import { ErrorComponent } from "@forgeroute/ui/error";
12
+ import { PillTabsComponent } from "@forgeroute/ui/pill-tabs";
13
+ import { RadioGroupComponent } from "@forgeroute/ui/radio";
14
+ import { SearchInputComponent } from "@forgeroute/ui/search-input";
15
+ import { SelectComponent } from "@forgeroute/ui/select";
16
+ import { SkeletonComponent } from "@forgeroute/ui/skeleton";
17
+ import { TextInputComponent } from "@forgeroute/ui/text-input";
18
+ import { TooltipDirective } from "@forgeroute/ui/tooltip";
19
+ import { PrintService } from "@forgeroute/ui/print";
20
+ const ALLOWED_TAGS = /* @__PURE__ */ new Set([
21
+ "P",
22
+ "DIV",
23
+ "SPAN",
24
+ "BR",
25
+ "B",
26
+ "STRONG",
27
+ "I",
28
+ "EM",
29
+ "U",
30
+ "S",
31
+ "STRIKE",
32
+ "DEL",
33
+ "SUB",
34
+ "SUP",
35
+ "UL",
36
+ "OL",
37
+ "LI",
38
+ "BLOCKQUOTE",
39
+ "H1",
40
+ "H2",
41
+ "H3",
42
+ "H4",
43
+ "A",
44
+ "FONT"
45
+ ]);
46
+ const DROP_WITH_CONTENT = /* @__PURE__ */ new Set([
47
+ "SCRIPT",
48
+ "STYLE",
49
+ "NOSCRIPT",
50
+ "TEXTAREA",
51
+ "OPTION",
52
+ "SELECT",
53
+ "IFRAME",
54
+ "OBJECT",
55
+ "EMBED",
56
+ "TEMPLATE",
57
+ "HEAD",
58
+ "TITLE",
59
+ "META",
60
+ "LINK",
61
+ "SVG",
62
+ "MATH",
63
+ "CANVAS",
64
+ "AUDIO",
65
+ "VIDEO",
66
+ "INPUT",
67
+ "BUTTON",
68
+ "FORM",
69
+ "IMG",
70
+ "APPLET",
71
+ "FRAME",
72
+ "FRAMESET"
73
+ ]);
74
+ const BLOCK_TO_DIV = /* @__PURE__ */ new Set([
75
+ "SECTION",
76
+ "ARTICLE",
77
+ "HEADER",
78
+ "FOOTER",
79
+ "MAIN",
80
+ "ASIDE",
81
+ "NAV",
82
+ "PRE",
83
+ "H5",
84
+ "H6",
85
+ "CAPTION",
86
+ "FIGURE",
87
+ "DL",
88
+ "DT",
89
+ "DD",
90
+ "ADDRESS",
91
+ "FIELDSET",
92
+ "CENTER"
93
+ ]);
94
+ const COLOR = /^(#[0-9a-f]{3,8}|rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,\s*(0|1|0?\.\d+)\s*)?\)|[a-z]{3,20})$/i;
95
+ const LENGTH = /^-?\d+(\.\d+)?(px|pt|em|rem|%)?$/;
96
+ const STYLE_RULES = {
97
+ "text-align": [/^(left|right|center|justify)$/],
98
+ "font-size": [LENGTH, /^(x-small|small|medium|large|x-large|xx-large|xxx-large)$/],
99
+ "font-family": [/^[\w\s,'"-]+$/],
100
+ "font-weight": [/^(normal|bold|[1-9]00)$/],
101
+ "font-style": [/^(normal|italic)$/],
102
+ "text-decoration": [/^(none|underline|line-through)( (none|underline|line-through))*$/],
103
+ color: [COLOR],
104
+ "background-color": [COLOR],
105
+ margin: [/^(-?\d+(\.\d+)?(px|pt|em|rem|%)?\s*){1,4}$/],
106
+ "margin-left": [LENGTH],
107
+ "padding-left": [LENGTH]
108
+ };
109
+ const ALLOWED_SCHEMES = /^(https?|mailto|tel):/i;
110
+ function safeHref(raw) {
111
+ const cleaned = raw.replace(/[\u0000- \u007f-\u009f]/g, "");
112
+ if (!cleaned) return null;
113
+ if (ALLOWED_SCHEMES.test(cleaned)) return raw.trim();
114
+ if (/^[a-z][a-z0-9+.-]*:/i.test(cleaned) || /^[\/\\]{2}/.test(cleaned)) return null;
115
+ return raw.trim();
116
+ }
117
+ function parseStyle(style) {
118
+ return style.split(";").map((decl) => {
119
+ const i = decl.indexOf(":");
120
+ return i < 0 ? null : [decl.slice(0, i).trim().toLowerCase(), decl.slice(i + 1).trim()];
121
+ }).filter((d) => !!d && !!d[0] && !!d[1]);
122
+ }
123
+ function filterStyle(style) {
124
+ return parseStyle(style).filter(([prop, value]) => (STYLE_RULES[prop] ?? []).some((rule) => rule.test(value))).map(([prop, value]) => `${prop}: ${value}`).join("; ");
125
+ }
126
+ function resolveTag(el, ctx) {
127
+ let tag = el.tagName.toUpperCase();
128
+ if (BLOCK_TO_DIV.has(tag)) tag = "DIV";
129
+ if (!ALLOWED_TAGS.has(tag)) return null;
130
+ if (ctx.mode === "paste" && (tag === "SPAN" || tag === "FONT")) return null;
131
+ if (ctx.blocked.has(tag)) return ctx.replace[tag] ?? null;
132
+ return tag;
133
+ }
134
+ function impliedTags(el, ctx) {
135
+ const out = [];
136
+ const decls = new Map(parseStyle(el.getAttribute("style") ?? ""));
137
+ const weight = decls.get("font-weight");
138
+ if (weight && (weight === "bold" || /^\d+$/.test(weight) && Number(weight) >= 600)) out.push("B");
139
+ if (decls.get("font-style") === "italic") out.push("I");
140
+ const deco = decls.get("text-decoration") ?? "";
141
+ if (/\bunderline\b/.test(deco)) out.push("U");
142
+ if (/\bline-through\b/.test(deco)) out.push("S");
143
+ return out.filter((t) => !ctx.blocked.has(t));
144
+ }
145
+ function copyAttributes(src, dest, tag, ctx) {
146
+ if (ctx.mode === "paste") {
147
+ if (tag === "A") setLinkAttributes(src, dest);
148
+ return;
149
+ }
150
+ const style = filterStyle(src.getAttribute("style") ?? "");
151
+ if (style) dest.setAttribute("style", style);
152
+ const align = src.getAttribute("align")?.toLowerCase();
153
+ if (align && /^(left|right|center|justify)$/.test(align)) dest.setAttribute("align", align);
154
+ if (tag === "A") setLinkAttributes(src, dest);
155
+ if (tag === "FONT") {
156
+ const face = src.getAttribute("face");
157
+ if (face && /^[\w\s,'"-]+$/.test(face)) dest.setAttribute("face", face);
158
+ const size = src.getAttribute("size");
159
+ if (size && /^[+-]?\d$/.test(size)) dest.setAttribute("size", size);
160
+ const color = src.getAttribute("color");
161
+ if (color && COLOR.test(color)) dest.setAttribute("color", color);
162
+ }
163
+ }
164
+ function setLinkAttributes(src, dest) {
165
+ const href = safeHref(src.getAttribute("href") ?? "");
166
+ if (href) {
167
+ dest.setAttribute("href", href);
168
+ dest.setAttribute("target", "_blank");
169
+ dest.setAttribute("rel", "noopener noreferrer");
170
+ }
171
+ }
172
+ function walkChildren(src, dest, ctx) {
173
+ for (const child of Array.from(src.childNodes)) if (child.nodeType === Node.TEXT_NODE) dest.appendChild(ctx.doc.createTextNode(child.nodeValue ?? ""));
174
+ else if (child.nodeType === Node.ELEMENT_NODE) walkElement(child, dest, ctx);
175
+ }
176
+ function walkRow(el, dest, ctx) {
177
+ const rowTag = ctx.blocked.has("DIV") ? ctx.replace["DIV"] ?? null : "DIV";
178
+ const row = rowTag ? ctx.doc.createElement(rowTag) : ctx.doc.createDocumentFragment();
179
+ let first = true;
180
+ for (const cell of Array.from(el.children)) {
181
+ const t = cell.tagName.toUpperCase();
182
+ if (t !== "TD" && t !== "TH") {
183
+ walkElement(cell, row, ctx);
184
+ continue;
185
+ }
186
+ const holder = ctx.doc.createElement("div");
187
+ let target = holder;
188
+ if (ctx.mode === "paste") for (const wrap of impliedTags(cell, ctx)) {
189
+ const w = ctx.doc.createElement(wrap);
190
+ target.appendChild(w);
191
+ target = w;
192
+ }
193
+ walkChildren(cell, target, ctx);
194
+ if (holder.firstChild?.nodeType === Node.TEXT_NODE) holder.firstChild.nodeValue = (holder.firstChild.nodeValue ?? "").trimStart();
195
+ if (holder.lastChild?.nodeType === Node.TEXT_NODE) holder.lastChild.nodeValue = (holder.lastChild.nodeValue ?? "").trimEnd();
196
+ if (!(holder.textContent ?? "").trim()) continue;
197
+ if (!first) row.appendChild(ctx.doc.createTextNode(" "));
198
+ first = false;
199
+ while (holder.firstChild) row.appendChild(holder.firstChild);
200
+ }
201
+ if (!row.firstChild) return;
202
+ if (!rowTag) row.appendChild(ctx.doc.createElement("br"));
203
+ dest.appendChild(row);
204
+ }
205
+ function walkElement(el, dest, ctx) {
206
+ const original = el.tagName.toUpperCase();
207
+ if (DROP_WITH_CONTENT.has(original)) return;
208
+ if (original === "TR") {
209
+ walkRow(el, dest, ctx);
210
+ return;
211
+ }
212
+ let tag = resolveTag(el, ctx);
213
+ if (tag === "LI" && el.parentElement) {
214
+ const parent = el.parentElement.tagName.toUpperCase();
215
+ if ((parent === "UL" || parent === "OL") && ctx.blocked.has(parent)) tag = "DIV";
216
+ }
217
+ let target = dest;
218
+ if (ctx.mode === "paste") for (const wrap of impliedTags(el, ctx)) {
219
+ const w = ctx.doc.createElement(wrap);
220
+ target.appendChild(w);
221
+ target = w;
222
+ }
223
+ if (tag) {
224
+ const out = ctx.doc.createElement(tag);
225
+ copyAttributes(el, out, tag, ctx);
226
+ target.appendChild(out);
227
+ target = out;
228
+ }
229
+ if (tag === "BR") return;
230
+ walkChildren(el, target, ctx);
231
+ }
232
+ function sanitizeRichTextHtml(html, options = {}) {
233
+ if (!html) return "";
234
+ const parsed = new DOMParser().parseFromString(`<body>${html}</body>`, "text/html");
235
+ const ctx = {
236
+ doc: parsed,
237
+ mode: options.mode ?? "content",
238
+ blocked: options.blockedTags ?? /* @__PURE__ */ new Set(),
239
+ replace: options.replace ?? {}
240
+ };
241
+ const out = parsed.createElement("body");
242
+ walkChildren(parsed.body, out, ctx);
243
+ return out.innerHTML;
244
+ }
245
+ function normalizeLinkUrl(raw) {
246
+ const text = (raw ?? "").trim();
247
+ if (!text || /\s/.test(text)) return null;
248
+ if (/^(https?:\/\/|mailto:|tel:)\S+$/i.test(text)) return text;
249
+ if (/^[a-z][a-z0-9+.-]*:/i.test(text) || /^[\/\\]{2}/.test(text)) return null;
250
+ return /^[^\s/@]+\.[^\s/@]+/.test(text) ? `https://${text}` : null;
251
+ }
252
+ function plainTextToHtml(text) {
253
+ return text.replace(/\r\n?/g, "\n").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>");
254
+ }
255
+ const RICH_TEXT_OPTIONS = [
256
+ "bold",
257
+ "italic",
258
+ "underline",
259
+ "strikethrough",
260
+ "link",
261
+ "heading",
262
+ "fontSize",
263
+ "fontFamily",
264
+ "textColor",
265
+ "highlight",
266
+ "align",
267
+ "bulletList",
268
+ "numberedList",
269
+ "indent",
270
+ "outdent",
271
+ "clearFormat"
272
+ ];
273
+ const GROUPS = [
274
+ {
275
+ id: "inline",
276
+ options: [
277
+ "bold",
278
+ "italic",
279
+ "underline",
280
+ "strikethrough",
281
+ "link"
282
+ ]
283
+ },
284
+ {
285
+ id: "text",
286
+ options: [
287
+ "heading",
288
+ "fontSize",
289
+ "fontFamily"
290
+ ]
291
+ },
292
+ {
293
+ id: "color",
294
+ options: ["textColor", "highlight"]
295
+ },
296
+ {
297
+ id: "align",
298
+ options: ["align"]
299
+ },
300
+ {
301
+ id: "blocks",
302
+ options: [
303
+ "bulletList",
304
+ "numberedList",
305
+ "indent",
306
+ "outdent"
307
+ ]
308
+ },
309
+ {
310
+ id: "clear",
311
+ options: ["clearFormat"]
312
+ }
313
+ ];
314
+ const OPTION_TAGS = {
315
+ bold: ["B", "STRONG"],
316
+ italic: ["I", "EM"],
317
+ underline: ["U"],
318
+ strikethrough: [
319
+ "S",
320
+ "STRIKE",
321
+ "DEL"
322
+ ],
323
+ link: ["A"],
324
+ heading: [
325
+ "H1",
326
+ "H2",
327
+ "H3",
328
+ "H4"
329
+ ],
330
+ bulletList: ["UL"],
331
+ numberedList: ["OL"],
332
+ indent: ["BLOCKQUOTE"]
333
+ };
334
+ const BLOCK_REPLACEMENT = {
335
+ H1: "DIV",
336
+ H2: "DIV",
337
+ H3: "DIV",
338
+ H4: "DIV",
339
+ BLOCKQUOTE: "DIV"
340
+ };
341
+ const HEADINGS = [
342
+ {
343
+ tag: "p",
344
+ label: "Normal",
345
+ text: "Normal",
346
+ cls: ""
347
+ },
348
+ {
349
+ tag: "h1",
350
+ label: "H1",
351
+ text: "H1 — Heading 1",
352
+ cls: "di-h1"
353
+ },
354
+ {
355
+ tag: "h2",
356
+ label: "H2",
357
+ text: "H2 — Heading 2",
358
+ cls: "di-h2"
359
+ },
360
+ {
361
+ tag: "h3",
362
+ label: "H3",
363
+ text: "H3 — Heading 3",
364
+ cls: "di-h3"
365
+ }
366
+ ];
367
+ const SIZES = [
368
+ {
369
+ value: "1",
370
+ label: "Small",
371
+ px: 11
372
+ },
373
+ {
374
+ value: "3",
375
+ label: "Normal",
376
+ px: 13
377
+ },
378
+ {
379
+ value: "4",
380
+ label: "Medium",
381
+ px: 15
382
+ },
383
+ {
384
+ value: "5",
385
+ label: "Large",
386
+ px: 18
387
+ },
388
+ {
389
+ value: "6",
390
+ label: "X-Large",
391
+ px: 22
392
+ },
393
+ {
394
+ value: "7",
395
+ label: "Huge",
396
+ px: 26
397
+ }
398
+ ];
399
+ const FONT_GROUPS = [
400
+ {
401
+ label: "Default",
402
+ fonts: [{
403
+ value: "inherit",
404
+ label: "Default",
405
+ preview: "inherit"
406
+ }]
407
+ },
408
+ {
409
+ label: "Serif",
410
+ fonts: [
411
+ {
412
+ value: "Lora, Georgia, serif",
413
+ label: "Lora",
414
+ preview: "Georgia, serif"
415
+ },
416
+ {
417
+ value: "Cormorant Garamond, serif",
418
+ label: "Cormorant Garamond",
419
+ preview: "Georgia, serif"
420
+ },
421
+ {
422
+ value: "Georgia, serif",
423
+ label: "Georgia",
424
+ preview: "Georgia, serif"
425
+ },
426
+ {
427
+ value: "Palatino Linotype, Palatino, serif",
428
+ label: "Palatino",
429
+ preview: "Palatino, serif"
430
+ },
431
+ {
432
+ value: "Times New Roman, Times, serif",
433
+ label: "Times New Roman",
434
+ preview: "'Times New Roman', serif"
435
+ },
436
+ {
437
+ value: "Garamond, serif",
438
+ label: "Garamond",
439
+ preview: "Garamond, serif"
440
+ },
441
+ {
442
+ value: "Book Antiqua, Palatino, serif",
443
+ label: "Book Antiqua",
444
+ preview: "Palatino, serif"
445
+ }
446
+ ]
447
+ },
448
+ {
449
+ label: "Sans-Serif",
450
+ fonts: [
451
+ {
452
+ value: "Lato, sans-serif",
453
+ label: "Lato",
454
+ preview: "Arial, sans-serif"
455
+ },
456
+ {
457
+ value: "Inter, sans-serif",
458
+ label: "Inter",
459
+ preview: "Arial, sans-serif"
460
+ },
461
+ {
462
+ value: "Arial, Helvetica, sans-serif",
463
+ label: "Arial",
464
+ preview: "Arial, sans-serif"
465
+ },
466
+ {
467
+ value: "Helvetica Neue, Helvetica, sans-serif",
468
+ label: "Helvetica",
469
+ preview: "Helvetica, Arial, sans-serif"
470
+ },
471
+ {
472
+ value: "Open Sans, sans-serif",
473
+ label: "Open Sans",
474
+ preview: "Arial, sans-serif"
475
+ },
476
+ {
477
+ value: "Montserrat, sans-serif",
478
+ label: "Montserrat",
479
+ preview: "Arial, sans-serif"
480
+ },
481
+ {
482
+ value: "Raleway, sans-serif",
483
+ label: "Raleway",
484
+ preview: "Arial, sans-serif"
485
+ },
486
+ {
487
+ value: "Nunito, sans-serif",
488
+ label: "Nunito",
489
+ preview: "Arial, sans-serif"
490
+ },
491
+ {
492
+ value: "Poppins, sans-serif",
493
+ label: "Poppins",
494
+ preview: "Arial, sans-serif"
495
+ },
496
+ {
497
+ value: "Verdana, Geneva, sans-serif",
498
+ label: "Verdana",
499
+ preview: "Verdana, sans-serif"
500
+ },
501
+ {
502
+ value: "Tahoma, Geneva, sans-serif",
503
+ label: "Tahoma",
504
+ preview: "Tahoma, sans-serif"
505
+ },
506
+ {
507
+ value: "Trebuchet MS, Helvetica, sans-serif",
508
+ label: "Trebuchet MS",
509
+ preview: "'Trebuchet MS', sans-serif"
510
+ }
511
+ ]
512
+ },
513
+ {
514
+ label: "Monospace",
515
+ fonts: [{
516
+ value: "Courier New, Courier, monospace",
517
+ label: "Courier New",
518
+ preview: "'Courier New', monospace"
519
+ }, {
520
+ value: "Lucida Console, Monaco, monospace",
521
+ label: "Lucida Console",
522
+ preview: "Monaco, monospace"
523
+ }]
524
+ },
525
+ {
526
+ label: "Display",
527
+ fonts: [{
528
+ value: "Impact, Charcoal, sans-serif",
529
+ label: "Impact",
530
+ preview: "Impact, sans-serif"
531
+ }, {
532
+ value: "Comic Sans MS, cursive",
533
+ label: "Comic Sans",
534
+ preview: "'Comic Sans MS', cursive"
535
+ }]
536
+ }
537
+ ];
538
+ const STATE_COMMANDS = [
539
+ "bold",
540
+ "italic",
541
+ "underline",
542
+ "strikeThrough",
543
+ "insertUnorderedList",
544
+ "insertOrderedList",
545
+ "justifyLeft",
546
+ "justifyCenter",
547
+ "justifyRight"
548
+ ];
549
+ let nextId = 0;
550
+ var RichTextEditorComponent = class RichTextEditorComponent {
551
+ resetTouched() {
552
+ this._touched.set(false);
553
+ }
554
+ headingText(tag) {
555
+ return this.labels.t(`richTextEditor.heading.${tag}`);
556
+ }
557
+ sizeText(value) {
558
+ return this.labels.t(`richTextEditor.size.${value}`);
559
+ }
560
+ fontGroupText(label) {
561
+ return this.labels.t(`richTextEditor.fontGroup.${label}`);
562
+ }
563
+ fontText(font) {
564
+ return font.value === "inherit" ? this.labels.t("richTextEditor.fontDefault") : font.label;
565
+ }
566
+ constructor() {
567
+ this.labels = inject(UiLabelsService);
568
+ this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
569
+ this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
570
+ this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
571
+ this.required = input(false, ...ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []);
572
+ this.readonly = input(false, ...ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []);
573
+ this.hint = input("", ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
574
+ this.error = input("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
575
+ this.showErrors = input(false, ...ngDevMode ? [{ debugName: "showErrors" }] : /* istanbul ignore next */ []);
576
+ this._reveal = createFieldReveal(this.showErrors);
577
+ this._touched = this._reveal.touched;
578
+ this._activeError = computed(() => this._reveal.revealed() ? this.error() : "", ...ngDevMode ? [{ debugName: "_activeError" }] : /* istanbul ignore next */ []);
579
+ this.minHeight = input(200, ...ngDevMode ? [{ debugName: "minHeight" }] : /* istanbul ignore next */ []);
580
+ this.maxHeight = input(600, ...ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []);
581
+ this.hide = input([], ...ngDevMode ? [{ debugName: "hide" }] : /* istanbul ignore next */ []);
582
+ this._disabledInput = input(false, {
583
+ ...ngDevMode ? { debugName: "_disabledInput" } : /* istanbul ignore next */ {},
584
+ alias: "disabled"
585
+ });
586
+ this._cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "_cvaDisabled" }] : /* istanbul ignore next */ []);
587
+ this.disabled = computed(() => this._disabledInput() || this._cvaDisabled(), ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
588
+ this.inert = computed(() => this.disabled() || this.readonly(), ...ngDevMode ? [{ debugName: "inert" }] : /* istanbul ignore next */ []);
589
+ this.editor = viewChild("editor", ...ngDevMode ? [{ debugName: "editor" }] : /* istanbul ignore next */ []);
590
+ this._id = ++nextId;
591
+ this._editorId = `rte-${this._id}`;
592
+ this._labelId = `rte-${this._id}-label`;
593
+ this._errorId = `rte-${this._id}-error`;
594
+ this.headings = HEADINGS;
595
+ this.sizes = SIZES;
596
+ this.fontGroups = FONT_GROUPS;
597
+ this.openMenu = signal(null, ...ngDevMode ? [{ debugName: "openMenu" }] : /* istanbul ignore next */ []);
598
+ this.activeHeading = signal("Normal", ...ngDevMode ? [{ debugName: "activeHeading" }] : /* istanbul ignore next */ []);
599
+ this.activeFontSize = signal("Normal", ...ngDevMode ? [{ debugName: "activeFontSize" }] : /* istanbul ignore next */ []);
600
+ this.activeFont = signal("Default", ...ngDevMode ? [{ debugName: "activeFont" }] : /* istanbul ignore next */ []);
601
+ this.active = signal(Object.fromEntries(STATE_COMMANDS.map((c) => [c, false])), ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
602
+ this.empty = signal(true, ...ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []);
603
+ this.linkUrl = signal("", ...ngDevMode ? [{ debugName: "linkUrl" }] : /* istanbul ignore next */ []);
604
+ this.linkError = signal("", ...ngDevMode ? [{ debugName: "linkError" }] : /* istanbul ignore next */ []);
605
+ this.hasLink = signal(false, ...ngDevMode ? [{ debugName: "hasLink" }] : /* istanbul ignore next */ []);
606
+ this._linkId = `rte-${++nextId}-link`;
607
+ this.hidden = computed(() => new Set(this.hide()), ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
608
+ this.groupVisible = computed(() => {
609
+ const hidden = this.hidden();
610
+ const out = {};
611
+ for (const g of GROUPS) out[g.id] = g.options.some((o) => !hidden.has(o));
612
+ return out;
613
+ }, ...ngDevMode ? [{ debugName: "groupVisible" }] : /* istanbul ignore next */ []);
614
+ this.toolbarVisible = computed(() => Object.values(this.groupVisible()).some(Boolean), ...ngDevMode ? [{ debugName: "toolbarVisible" }] : /* istanbul ignore next */ []);
615
+ this.divider = computed(() => {
616
+ const visible = this.groupVisible();
617
+ const out = {};
618
+ let seen = false;
619
+ for (const g of GROUPS) {
620
+ out[g.id] = visible[g.id] && seen;
621
+ seen = seen || visible[g.id];
622
+ }
623
+ return out;
624
+ }, ...ngDevMode ? [{ debugName: "divider" }] : /* istanbul ignore next */ []);
625
+ this._lastEmitted = "";
626
+ this._pending = null;
627
+ this._savedRange = null;
628
+ this._onChange = (_) => {};
629
+ this._onTouched = () => {};
630
+ afterNextRender(() => {
631
+ if (this._pending !== null) {
632
+ this._setHtml(this._pending);
633
+ this._pending = null;
634
+ }
635
+ });
636
+ }
637
+ show(option) {
638
+ return !this.hidden().has(option);
639
+ }
640
+ writeValue(val) {
641
+ const html = val ?? "";
642
+ if (html === this._lastEmitted) return;
643
+ this._lastEmitted = html;
644
+ this._setHtml(html);
645
+ }
646
+ registerOnChange(fn) {
647
+ this._onChange = fn;
648
+ }
649
+ registerOnTouched(fn) {
650
+ this._onTouched = fn;
651
+ }
652
+ setDisabledState(d) {
653
+ this._cvaDisabled.set(d);
654
+ }
655
+ _setHtml(html) {
656
+ const el = this.editor()?.nativeElement;
657
+ if (!el) {
658
+ this._pending = html;
659
+ return;
660
+ }
661
+ const clean = sanitizeRichTextHtml(html);
662
+ if (el.innerHTML !== clean) el.innerHTML = clean;
663
+ this.empty.set(this._isEmpty(el));
664
+ }
665
+ _isEmpty(el) {
666
+ return !(el.textContent ?? "").trim() && !el.querySelector("li, hr, img");
667
+ }
668
+ focus() {
669
+ this.editor()?.nativeElement.focus();
670
+ }
671
+ onInput() {
672
+ const el = this.editor()?.nativeElement;
673
+ if (!el) return;
674
+ const isEmpty = this._isEmpty(el);
675
+ this.empty.set(isEmpty);
676
+ const html = isEmpty ? "" : el.innerHTML;
677
+ this._lastEmitted = html;
678
+ this._onChange(html);
679
+ }
680
+ onBlur() {
681
+ this._saveSelection();
682
+ this._touched.set(true);
683
+ this._onTouched();
684
+ }
685
+ onToolbarMouseDown(event) {
686
+ if (event.target.closest("button")) event.preventDefault();
687
+ }
688
+ onDocumentClick() {
689
+ if (this.openMenu()) this.openMenu.set(null);
690
+ }
691
+ onSelectionChange() {
692
+ const el = this.editor()?.nativeElement;
693
+ const sel = window.getSelection();
694
+ if (!el || !sel || sel.rangeCount === 0 || !el.contains(sel.anchorNode)) return;
695
+ this.refreshActive();
696
+ }
697
+ refreshActive() {
698
+ if (this.inert()) return;
699
+ const next = {};
700
+ for (const cmd of STATE_COMMANDS) try {
701
+ next[cmd] = document.queryCommandState(cmd);
702
+ } catch {
703
+ next[cmd] = false;
704
+ }
705
+ const prev = this.active();
706
+ if (STATE_COMMANDS.some((c) => prev[c] !== next[c])) this.active.set(next);
707
+ }
708
+ onKeydown(event) {
709
+ if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey) return;
710
+ const hit = {
711
+ b: {
712
+ option: "bold",
713
+ command: "bold"
714
+ },
715
+ i: {
716
+ option: "italic",
717
+ command: "italic"
718
+ },
719
+ u: {
720
+ option: "underline",
721
+ command: "underline"
722
+ }
723
+ }[event.key.toLowerCase()];
724
+ if (!hit) return;
725
+ event.preventDefault();
726
+ if (this.show(hit.option) && !this.inert()) this.exec(hit.command);
727
+ }
728
+ onPaste(event) {
729
+ event.preventDefault();
730
+ if (this.inert()) return;
731
+ const data = event.clipboardData;
732
+ if (!data) return;
733
+ const html = data.getData("text/html");
734
+ const text = data.getData("text/plain");
735
+ if (html) {
736
+ const clean = sanitizeRichTextHtml(html, {
737
+ mode: "paste",
738
+ blockedTags: this._blockedTags(),
739
+ replace: BLOCK_REPLACEMENT
740
+ });
741
+ document.execCommand("insertHTML", false, clean);
742
+ } else if (text) {
743
+ if (text.includes("\n") || text.includes("\r")) document.execCommand("insertHTML", false, plainTextToHtml(text));
744
+ else document.execCommand("insertText", false, text);
745
+ }
746
+ this.onInput();
747
+ }
748
+ _blockedTags() {
749
+ const blocked = /* @__PURE__ */ new Set();
750
+ for (const option of this.hidden()) for (const tag of OPTION_TAGS[option] ?? []) blocked.add(tag);
751
+ return blocked;
752
+ }
753
+ _saveSelection() {
754
+ const el = this.editor()?.nativeElement;
755
+ const sel = window.getSelection();
756
+ if (el && sel && sel.rangeCount > 0 && el.contains(sel.anchorNode)) this._savedRange = sel.getRangeAt(0).cloneRange();
757
+ }
758
+ _restoreSelection() {
759
+ const el = this.editor()?.nativeElement;
760
+ if (!el) return;
761
+ const sel = window.getSelection();
762
+ const inside = !!sel && sel.rangeCount > 0 && el.contains(sel.anchorNode);
763
+ el.focus();
764
+ if (!inside && this._savedRange && sel) {
765
+ sel.removeAllRanges();
766
+ sel.addRange(this._savedRange);
767
+ }
768
+ }
769
+ toggleMenu(menu) {
770
+ this.openMenu.set(this.openMenu() === menu ? null : menu);
771
+ }
772
+ selectHeading(tag, label) {
773
+ this.activeHeading.set(label);
774
+ this.openMenu.set(null);
775
+ this._restoreSelection();
776
+ document.execCommand("formatBlock", false, tag);
777
+ this.onInput();
778
+ }
779
+ selectSize(value, label) {
780
+ this.activeFontSize.set(label);
781
+ this.openMenu.set(null);
782
+ this.execWithArg("fontSize", value);
783
+ }
784
+ selectFont(value, label) {
785
+ this.activeFont.set(label);
786
+ this.openMenu.set(null);
787
+ this.execWithArg("fontName", value);
788
+ }
789
+ _anchorAtSelection() {
790
+ const el = this.editor()?.nativeElement;
791
+ const sel = window.getSelection();
792
+ const node = sel && sel.rangeCount > 0 && el?.contains(sel.anchorNode) ? sel.anchorNode : this._savedRange?.startContainer ?? null;
793
+ const a = (node && node.nodeType === Node.TEXT_NODE ? node.parentElement : node)?.closest("a") ?? null;
794
+ return a && el?.contains(a) ? a : null;
795
+ }
796
+ toggleLink() {
797
+ if (this.openMenu() === "link") {
798
+ this.openMenu.set(null);
799
+ return;
800
+ }
801
+ this._saveSelection();
802
+ const a = this._anchorAtSelection();
803
+ this.hasLink.set(!!a);
804
+ this.linkUrl.set(a?.getAttribute("href") ?? "");
805
+ this.linkError.set("");
806
+ this.openMenu.set("link");
807
+ }
808
+ closeLink() {
809
+ this.openMenu.set(null);
810
+ this._restoreSelection();
811
+ }
812
+ applyLink() {
813
+ if (this.inert()) return;
814
+ const url = normalizeLinkUrl(this.linkUrl());
815
+ if (!url) {
816
+ this.linkError.set(this.labels.t("richTextEditor.linkNeedsAddress"));
817
+ return;
818
+ }
819
+ this.openMenu.set(null);
820
+ this._restoreSelection();
821
+ const sel = window.getSelection();
822
+ const existing = this._anchorAtSelection();
823
+ if (existing) existing.setAttribute("href", url);
824
+ else if (!sel || sel.isCollapsed) {
825
+ const text = url.replace(/^(mailto:|tel:|https?:\/\/)/i, "");
826
+ document.execCommand("insertHTML", false, `<a href="${url.replace(/&/g, "&amp;").replace(/"/g, "&quot;")}">${plainTextToHtml(text)}</a>`);
827
+ } else document.execCommand("createLink", false, url);
828
+ this.onInput();
829
+ }
830
+ removeLink() {
831
+ if (this.inert()) return;
832
+ this.openMenu.set(null);
833
+ this._restoreSelection();
834
+ const a = this._anchorAtSelection();
835
+ if (a) {
836
+ const range = document.createRange();
837
+ range.selectNodeContents(a);
838
+ const sel = window.getSelection();
839
+ sel?.removeAllRanges();
840
+ sel?.addRange(range);
841
+ }
842
+ document.execCommand("unlink", false);
843
+ this.onInput();
844
+ }
845
+ exec(command) {
846
+ if (this.inert()) return;
847
+ this._restoreSelection();
848
+ document.execCommand(command, false);
849
+ this.onInput();
850
+ this.refreshActive();
851
+ }
852
+ execWithArg(command, value) {
853
+ if (!value || this.inert()) return;
854
+ this._restoreSelection();
855
+ document.execCommand(command, false, value);
856
+ this.onInput();
857
+ }
858
+ static {
859
+ this.ɵfac = i0.ɵɵngDeclareFactory({
860
+ minVersion: "12.0.0",
861
+ version: "22.2.2",
862
+ ngImport: i0,
863
+ type: RichTextEditorComponent,
864
+ deps: [],
865
+ target: i0.ɵɵFactoryTarget.Component
866
+ });
867
+ }
868
+ static {
869
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
870
+ minVersion: "17.0.0",
871
+ version: "22.2.2",
872
+ type: RichTextEditorComponent,
873
+ isStandalone: true,
874
+ selector: "ui-rich-text-editor",
875
+ inputs: {
876
+ label: {
877
+ classPropertyName: "label",
878
+ publicName: "label",
879
+ isSignal: true,
880
+ isRequired: false,
881
+ transformFunction: null
882
+ },
883
+ ariaLabel: {
884
+ classPropertyName: "ariaLabel",
885
+ publicName: "ariaLabel",
886
+ isSignal: true,
887
+ isRequired: false,
888
+ transformFunction: null
889
+ },
890
+ placeholder: {
891
+ classPropertyName: "placeholder",
892
+ publicName: "placeholder",
893
+ isSignal: true,
894
+ isRequired: false,
895
+ transformFunction: null
896
+ },
897
+ required: {
898
+ classPropertyName: "required",
899
+ publicName: "required",
900
+ isSignal: true,
901
+ isRequired: false,
902
+ transformFunction: null
903
+ },
904
+ readonly: {
905
+ classPropertyName: "readonly",
906
+ publicName: "readonly",
907
+ isSignal: true,
908
+ isRequired: false,
909
+ transformFunction: null
910
+ },
911
+ hint: {
912
+ classPropertyName: "hint",
913
+ publicName: "hint",
914
+ isSignal: true,
915
+ isRequired: false,
916
+ transformFunction: null
917
+ },
918
+ error: {
919
+ classPropertyName: "error",
920
+ publicName: "error",
921
+ isSignal: true,
922
+ isRequired: false,
923
+ transformFunction: null
924
+ },
925
+ showErrors: {
926
+ classPropertyName: "showErrors",
927
+ publicName: "showErrors",
928
+ isSignal: true,
929
+ isRequired: false,
930
+ transformFunction: null
931
+ },
932
+ minHeight: {
933
+ classPropertyName: "minHeight",
934
+ publicName: "minHeight",
935
+ isSignal: true,
936
+ isRequired: false,
937
+ transformFunction: null
938
+ },
939
+ maxHeight: {
940
+ classPropertyName: "maxHeight",
941
+ publicName: "maxHeight",
942
+ isSignal: true,
943
+ isRequired: false,
944
+ transformFunction: null
945
+ },
946
+ hide: {
947
+ classPropertyName: "hide",
948
+ publicName: "hide",
949
+ isSignal: true,
950
+ isRequired: false,
951
+ transformFunction: null
952
+ },
953
+ _disabledInput: {
954
+ classPropertyName: "_disabledInput",
955
+ publicName: "disabled",
956
+ isSignal: true,
957
+ isRequired: false,
958
+ transformFunction: null
959
+ }
960
+ },
961
+ host: { listeners: {
962
+ "document:click": "onDocumentClick()",
963
+ "document:selectionchange": "onSelectionChange()"
964
+ } },
965
+ providers: [{
966
+ provide: NG_VALUE_ACCESSOR,
967
+ useExisting: forwardRef(() => RichTextEditorComponent),
968
+ multi: true
969
+ }],
970
+ viewQueries: [{
971
+ propertyName: "editor",
972
+ first: true,
973
+ predicate: ["editor"],
974
+ descendants: true,
975
+ isSignal: true
976
+ }],
977
+ ngImport: i0,
978
+ template: `
979
+ <div class="rte-field" [class.rte-error]="_activeError()" [class.rte-disabled]="disabled()">
980
+ @if (label()) {
981
+ <label class="rte-label" [id]="_labelId" (click)="focus()">
982
+ {{ label() }}
983
+ @if (required()) { <span class="rte-required" aria-hidden="true">*</span> }
984
+ @if (hint()) { <span class="rte-hint-inline">({{ hint() }})</span> }
985
+ </label>
986
+ }
987
+
988
+ <div class="rte-box">
989
+ @if (toolbarVisible()) {
990
+ <div class="rte-toolbar" role="toolbar" [attr.aria-label]="labels.t('richTextEditor.textFormatting')" [attr.aria-controls]="_editorId"
991
+ (mousedown)="onToolbarMouseDown($event)">
992
+ @if (show('bold') || show('italic') || show('underline') || show('strikethrough') || show('link')) {
993
+ @if (show('bold')) {
994
+ <button type="button" class="rte-btn" data-option="bold" [class.active]="active()['bold']"
995
+ [attr.aria-pressed]="active()['bold']" [disabled]="inert()"
996
+ [attr.aria-label]="labels.t('richTextEditor.bold')" [attr.title]="labels.t('richTextEditor.boldCtrlB')" (click)="exec('bold')">
997
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"/><path d="M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"/></svg>
998
+ </button>
999
+ }
1000
+ @if (show('italic')) {
1001
+ <button type="button" class="rte-btn" data-option="italic" [class.active]="active()['italic']"
1002
+ [attr.aria-pressed]="active()['italic']" [disabled]="inert()"
1003
+ [attr.aria-label]="labels.t('richTextEditor.italic')" [attr.title]="labels.t('richTextEditor.italicCtrlI')" (click)="exec('italic')">
1004
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/></svg>
1005
+ </button>
1006
+ }
1007
+ @if (show('underline')) {
1008
+ <button type="button" class="rte-btn" data-option="underline" [class.active]="active()['underline']"
1009
+ [attr.aria-pressed]="active()['underline']" [disabled]="inert()"
1010
+ [attr.aria-label]="labels.t('richTextEditor.underline')" [attr.title]="labels.t('richTextEditor.underlineCtrlU')" (click)="exec('underline')">
1011
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 3v7a6 6 0 006 6 6 6 0 006-6V3"/><line x1="4" y1="21" x2="20" y2="21"/></svg>
1012
+ </button>
1013
+ }
1014
+ @if (show('strikethrough')) {
1015
+ <button type="button" class="rte-btn" data-option="strikethrough" [class.active]="active()['strikeThrough']"
1016
+ [attr.aria-pressed]="active()['strikeThrough']" [disabled]="inert()"
1017
+ [attr.aria-label]="labels.t('richTextEditor.strikethrough')" [attr.title]="labels.t('richTextEditor.strikethrough')" (click)="exec('strikeThrough')">
1018
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="4" y1="12" x2="20" y2="12"/><path d="M6 4h8a4 4 0 010 8H6"/><path d="M10 12v8"/></svg>
1019
+ </button>
1020
+ }
1021
+ @if (show('link')) {
1022
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1023
+ <button type="button" class="rte-btn rte-menu-btn" data-option="link" [class.active]="openMenu() === 'link'"
1024
+ [disabled]="inert()" [attr.aria-label]="labels.t('common.link')" [attr.title]="labels.t('common.link')"
1025
+ aria-haspopup="dialog" [attr.aria-expanded]="openMenu() === 'link'" (click)="toggleLink()">
1026
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/></svg>
1027
+ </button>
1028
+ @if (openMenu() === 'link') {
1029
+ <div class="rte-dropdown rte-link-panel" role="dialog" [attr.aria-label]="labels.t('common.link')" (keydown.escape)="closeLink()">
1030
+ <label class="rte-link-label" [for]="_linkId">{{ labels.t('richTextEditor.webAddress') }}</label>
1031
+ <input class="rte-link-input" type="url" inputmode="url" autocomplete="off" spellcheck="false" placeholder="example.com"
1032
+ [id]="_linkId" [value]="linkUrl()" [attr.aria-invalid]="linkError() ? 'true' : null"
1033
+ [attr.aria-describedby]="linkError() ? _linkId + '-error' : null"
1034
+ (input)="linkUrl.set($any($event.target).value); linkError.set('')" (keydown.enter)="$event.preventDefault(); applyLink()" />
1035
+ @if (linkError()) { <p class="rte-link-error" role="alert" [id]="_linkId + '-error'">{{ linkError() }}</p> }
1036
+ <div class="rte-link-actions">
1037
+ <button type="button" class="rte-link-btn rte-link-apply" data-testid="rte-link-apply" (click)="applyLink()">{{ labels.t('common.apply') }}</button>
1038
+ @if (hasLink()) { <button type="button" class="rte-link-btn" data-testid="rte-link-remove" (click)="removeLink()">{{ labels.t('richTextEditor.removeLink') }}</button> }
1039
+ </div>
1040
+ </div>
1041
+ }
1042
+ </span>
1043
+ }
1044
+ }
1045
+
1046
+ @if (divider()['text']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1047
+ @if (show('heading')) {
1048
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1049
+ <button type="button" class="rte-btn rte-menu-btn" data-option="heading" [class.active]="openMenu() === 'heading'"
1050
+ [disabled]="inert()" [attr.aria-label]="labels.t('richTextEditor.headingStyle')" [attr.title]="labels.t('richTextEditor.headingStyle2')"
1051
+ aria-haspopup="menu" [attr.aria-expanded]="openMenu() === 'heading'" (click)="toggleMenu('heading')">
1052
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M4 12h16M4 18h10"/></svg>
1053
+ <svg class="rte-chevron" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
1054
+ </button>
1055
+ @if (openMenu() === 'heading') {
1056
+ <div class="rte-dropdown" role="menu" [attr.aria-label]="labels.t('richTextEditor.headingStyle')" style="min-width:130px">
1057
+ @for (h of headings; track h.tag) {
1058
+ <button type="button" role="menuitemradio" class="rte-item" [class]="h.cls"
1059
+ [class.selected]="activeHeading() === h.label" [attr.aria-checked]="activeHeading() === h.label"
1060
+ (click)="selectHeading(h.tag, h.label)">{{ headingText(h.tag) }}</button>
1061
+ }
1062
+ </div>
1063
+ }
1064
+ </span>
1065
+ }
1066
+ @if (show('fontSize')) {
1067
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1068
+ <button type="button" class="rte-btn rte-menu-btn" data-option="fontSize" [class.active]="openMenu() === 'size'"
1069
+ [disabled]="inert()" [attr.aria-label]="labels.t('richTextEditor.fontSize')" [attr.title]="labels.t('richTextEditor.fontSize2')"
1070
+ aria-haspopup="menu" [attr.aria-expanded]="openMenu() === 'size'" (click)="toggleMenu('size')">
1071
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">T</text><text x="13" y="20" font-size="9" fill="currentColor" stroke="none">T</text></svg>
1072
+ <svg class="rte-chevron" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
1073
+ </button>
1074
+ @if (openMenu() === 'size') {
1075
+ <div class="rte-dropdown" role="menu" [attr.aria-label]="labels.t('richTextEditor.fontSize')" style="min-width:110px">
1076
+ @for (s of sizes; track s.value) {
1077
+ <button type="button" role="menuitemradio" class="rte-item"
1078
+ [class.selected]="activeFontSize() === s.label" [attr.aria-checked]="activeFontSize() === s.label"
1079
+ (click)="selectSize(s.value, s.label)"><span [style.font-size.px]="s.px">{{ sizeText(s.value) }}</span></button>
1080
+ }
1081
+ </div>
1082
+ }
1083
+ </span>
1084
+ }
1085
+ @if (show('fontFamily')) {
1086
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1087
+ <button type="button" class="rte-btn rte-menu-btn" data-option="fontFamily" [class.active]="openMenu() === 'font'"
1088
+ [disabled]="inert()" [attr.aria-label]="labels.t('richTextEditor.fontFamily')" [attr.title]="labels.t('richTextEditor.fontFamily2')"
1089
+ aria-haspopup="menu" [attr.aria-expanded]="openMenu() === 'font'" (click)="toggleMenu('font')">
1090
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="1" y="18" font-size="18" fill="currentColor" stroke="none" font-weight="600" font-style="italic">{{ labels.t('richTextEditor.aa') }}</text></svg>
1091
+ <svg class="rte-chevron" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
1092
+ </button>
1093
+ @if (openMenu() === 'font') {
1094
+ <div class="rte-dropdown rte-font-panel" role="menu" [attr.aria-label]="labels.t('richTextEditor.fontFamily')">
1095
+ @for (g of fontGroups; track g.label) {
1096
+ <div class="rte-group-label" role="presentation">{{ fontGroupText(g.label) }}</div>
1097
+ @for (f of g.fonts; track f.label) {
1098
+ <button type="button" role="menuitemradio" class="rte-item"
1099
+ [class.selected]="activeFont() === f.label" [attr.aria-checked]="activeFont() === f.label"
1100
+ [style.font-family]="f.preview" (click)="selectFont(f.value, f.label)">{{ fontText(f) }}</button>
1101
+ }
1102
+ }
1103
+ </div>
1104
+ }
1105
+ </span>
1106
+ }
1107
+
1108
+ @if (divider()['color']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1109
+ @if (show('textColor')) {
1110
+ <label class="rte-btn" data-option="textColor" [attr.title]="labels.t('richTextEditor.textColor')" [class.rte-btn-disabled]="inert()">
1111
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 20h16M12 4L6 18M12 4l6 14M8.5 13h7"/></svg>
1112
+ <input type="color" class="rte-color" [attr.aria-label]="labels.t('richTextEditor.textColor2')" value="#000000" [disabled]="inert()"
1113
+ (input)="execWithArg('foreColor', $any($event.target).value)" />
1114
+ </label>
1115
+ }
1116
+ @if (show('highlight')) {
1117
+ <label class="rte-btn" data-option="highlight" [attr.title]="labels.t('richTextEditor.highlightColor')" [class.rte-btn-disabled]="inert()">
1118
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor"><path d="M15.24 2.58a1 1 0 00-1.41 0L5.59 10.82a2 2 0 000 2.83l4.24 4.24L8.41 19.3a1 1 0 001.42 1.41l1.41-1.41 1.06 1.06a1 1 0 001.42 0l8-8a1 1 0 000-1.42l-6.48-6.36zM7 13.65l3.54-3.54 3.54 3.54-3.54 3.53L7 13.65z" opacity=".4"/><path d="M10.54 10.11l3.54-3.54 3.53 3.54-3.53 3.53-3.54-3.53z"/></svg>
1119
+ <input type="color" class="rte-color" [attr.aria-label]="labels.t('richTextEditor.highlightColor2')" value="#ffff00" [disabled]="inert()"
1120
+ (input)="execWithArg('hiliteColor', $any($event.target).value)" />
1121
+ </label>
1122
+ }
1123
+
1124
+ @if (divider()['align']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1125
+ @if (show('align')) {
1126
+ <button type="button" class="rte-btn" data-option="align-left" [class.active]="active()['justifyLeft']"
1127
+ [attr.aria-pressed]="active()['justifyLeft']" [disabled]="inert()"
1128
+ [attr.aria-label]="labels.t('richTextEditor.alignLeft')" [attr.title]="labels.t('richTextEditor.alignLeft2')" (click)="exec('justifyLeft')">
1129
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="18" y2="18"/></svg>
1130
+ </button>
1131
+ <button type="button" class="rte-btn" data-option="align-center" [class.active]="active()['justifyCenter']"
1132
+ [attr.aria-pressed]="active()['justifyCenter']" [disabled]="inert()"
1133
+ [attr.aria-label]="labels.t('richTextEditor.alignCenter')" [attr.title]="labels.t('richTextEditor.alignCenter2')" (click)="exec('justifyCenter')">
1134
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>
1135
+ </button>
1136
+ <button type="button" class="rte-btn" data-option="align-right" [class.active]="active()['justifyRight']"
1137
+ [attr.aria-pressed]="active()['justifyRight']" [disabled]="inert()"
1138
+ [attr.aria-label]="labels.t('richTextEditor.alignRight')" [attr.title]="labels.t('richTextEditor.alignRight2')" (click)="exec('justifyRight')">
1139
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="6" y1="18" x2="21" y2="18"/></svg>
1140
+ </button>
1141
+ }
1142
+
1143
+ @if (divider()['blocks']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1144
+ @if (show('bulletList')) {
1145
+ <button type="button" class="rte-btn" data-option="bulletList" [class.active]="active()['insertUnorderedList']"
1146
+ [attr.aria-pressed]="active()['insertUnorderedList']" [disabled]="inert()"
1147
+ [attr.aria-label]="labels.t('richTextEditor.bulletList')" [attr.title]="labels.t('richTextEditor.bulletList2')" (click)="exec('insertUnorderedList')">
1148
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="9" y1="6" x2="20" y2="6"/><line x1="9" y1="12" x2="20" y2="12"/><line x1="9" y1="18" x2="20" y2="18"/><circle cx="5" cy="6" r="1.5" fill="currentColor"/><circle cx="5" cy="12" r="1.5" fill="currentColor"/><circle cx="5" cy="18" r="1.5" fill="currentColor"/></svg>
1149
+ </button>
1150
+ }
1151
+ @if (show('numberedList')) {
1152
+ <button type="button" class="rte-btn" data-option="numberedList" [class.active]="active()['insertOrderedList']"
1153
+ [attr.aria-pressed]="active()['insertOrderedList']" [disabled]="inert()"
1154
+ [attr.aria-label]="labels.t('richTextEditor.numberedList')" [attr.title]="labels.t('richTextEditor.numberedList2')" (click)="exec('insertOrderedList')">
1155
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="10" y1="6" x2="20" y2="6"/><line x1="10" y1="12" x2="20" y2="12"/><line x1="10" y1="18" x2="20" y2="18"/><text x="3" y="8" font-size="8" fill="currentColor" stroke="none" font-weight="bold">1</text><text x="3" y="14" font-size="8" fill="currentColor" stroke="none" font-weight="bold">2</text><text x="3" y="20" font-size="8" fill="currentColor" stroke="none" font-weight="bold">3</text></svg>
1156
+ </button>
1157
+ }
1158
+ @if (show('indent')) {
1159
+ <button type="button" class="rte-btn" data-option="indent" [disabled]="inert()"
1160
+ [attr.aria-label]="labels.t('richTextEditor.indent')" [attr.title]="labels.t('richTextEditor.indent')" (click)="exec('indent')">
1161
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/><polyline points="9 8 13 12 9 16"/><line x1="3" y1="12" x2="13" y2="12"/></svg>
1162
+ </button>
1163
+ }
1164
+ @if (show('outdent')) {
1165
+ <button type="button" class="rte-btn" data-option="outdent" [disabled]="inert()"
1166
+ [attr.aria-label]="labels.t('richTextEditor.outdent')" [attr.title]="labels.t('richTextEditor.outdent')" (click)="exec('outdent')">
1167
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/><polyline points="7 8 3 12 7 16"/><line x1="3" y1="12" x2="21" y2="12"/></svg>
1168
+ </button>
1169
+ }
1170
+
1171
+ @if (divider()['clear']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1172
+ @if (show('clearFormat')) {
1173
+ <button type="button" class="rte-btn" data-option="clearFormat" [disabled]="inert()"
1174
+ [attr.aria-label]="labels.t('richTextEditor.clearFormatting')" [attr.title]="labels.t('richTextEditor.clearFormatting2')" (click)="exec('removeFormat')">
1175
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 7h16M6 4h8a2 2 0 012 2v0a2 2 0 01-2 2H6"/><line x1="4" y1="20" x2="20" y2="4" stroke-width="1.5"/></svg>
1176
+ </button>
1177
+ }
1178
+ </div>
1179
+ }
1180
+
1181
+ <div
1182
+ #editor
1183
+ class="rte-editor"
1184
+ [id]="_editorId"
1185
+ [attr.contenteditable]="inert() ? 'false' : 'true'"
1186
+ role="textbox"
1187
+ aria-multiline="true"
1188
+ [attr.aria-label]="label() ? null : (ariaLabel() || placeholder() || labels.t('richTextEditor.editorName'))"
1189
+ [attr.aria-labelledby]="label() ? _labelId : null"
1190
+ [attr.aria-required]="required() || null"
1191
+ [attr.aria-readonly]="readonly() || null"
1192
+ [attr.aria-disabled]="disabled() || null"
1193
+ [attr.aria-invalid]="_activeError() ? 'true' : null"
1194
+ [attr.aria-describedby]="_activeError() ? _errorId : null"
1195
+ [attr.data-placeholder]="placeholder()"
1196
+ [attr.data-empty]="empty() ? 'true' : null"
1197
+ [style.min-height.px]="minHeight()"
1198
+ [style.max-height.px]="maxHeight()"
1199
+ (input)="onInput()"
1200
+ (keydown)="onKeydown($event)"
1201
+ (paste)="onPaste($event)"
1202
+ (keyup)="refreshActive()"
1203
+ (mouseup)="refreshActive()"
1204
+ (blur)="onBlur()"
1205
+ ></div>
1206
+ </div>
1207
+
1208
+ @if (_activeError()) {
1209
+ <p class="rte-desc rte-desc-error" [id]="_errorId" role="alert">{{ _activeError() }}</p>
1210
+ }
1211
+ </div>
1212
+ `,
1213
+ isInline: true,
1214
+ styles: [":host{display:block}.rte-field{display:flex;flex-direction:column;gap:6px}.rte-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.rte-required{color:#dc2626;margin-left:2px}.rte-hint-inline{font-size:.75rem;color:#94a3b8;font-weight:400;margin-left:4px}.rte-box{border:1px solid #7c8ba1;border-radius:8px;background:#fff;transition:border-color .15s,box-shadow .15s}.rte-box:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.rte-error .rte-box{border-color:#ef4444}.rte-error .rte-box:focus-within{box-shadow:0 0 0 3px #ef44441f}.rte-disabled .rte-box{opacity:.5;cursor:not-allowed}.rte-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:6px 8px;background:#f8fafc;border-bottom:1px solid #e2e8f0;border-radius:8px 8px 0 0}.rte-divider{width:1px;height:20px;background:#cbd5e1;margin:0 4px}.rte-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:none;color:#64748b;cursor:pointer;transition:background .15s,color .15s}.rte-btn svg{width:16px;height:16px}.rte-btn:hover:not(:disabled){background:#e2e8f0;color:#1e293b}.rte-btn:focus-visible,.rte-btn:focus-within{outline:2px solid #3b82f6;outline-offset:1px}.rte-btn.active{background:#dbeafe;color:#2563eb}.rte-btn:disabled,.rte-btn-disabled{cursor:not-allowed;opacity:.5}.rte-menu-wrap{position:relative;display:inline-flex}.rte-menu-btn{width:auto;padding:0 6px;gap:3px}.rte-menu-btn .rte-chevron{width:10px;height:10px;color:#64748b;flex-shrink:0}.rte-dropdown{position:absolute;top:calc(100% + 4px);left:0;z-index:100;background:#fff;border:1px solid #e2e8f0;border-radius:6px;box-shadow:0 4px 12px #0000001f;padding:4px;overflow-y:auto;max-height:260px}.rte-font-panel{min-width:180px}.rte-link-panel{display:flex;flex-direction:column;gap:6px;min-width:240px;padding:10px;overflow:visible}.rte-link-label{font-size:12px;font-weight:600;color:#374151}.rte-link-input{box-sizing:border-box;width:100%;padding:6px 8px;font:inherit;font-size:14px;border:1px solid #cbd5e1;border-radius:6px}.rte-link-input:focus-visible{outline:2px solid #2563eb;outline-offset:1px}.rte-link-error{margin:0;font-size:12px;color:#dc2626}.rte-link-actions{display:flex;gap:6px}.rte-link-btn{padding:5px 10px;font-size:12px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#374151;cursor:pointer}.rte-link-apply{background:#2563eb;border-color:#2563eb;color:#fff}.rte-item{display:block;width:100%;text-align:left;padding:5px 10px;font-size:12px;color:#374151;border:none;background:none;border-radius:4px;cursor:pointer;white-space:nowrap}.rte-item:hover{background:#f1f5f9}.rte-item.selected{background:#dbeafe;color:#2563eb;font-weight:600}.rte-group-label{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:#94a3b8;padding:6px 10px 2px}.di-h1{font-size:18px;font-weight:700}.di-h2{font-size:15px;font-weight:600}.di-h3{font-size:13px;font-weight:600}.rte-color{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.rte-editor{padding:12px;outline:none;overflow-y:auto;box-sizing:border-box;font-size:.875rem;line-height:1.6;color:#1e293b;background:#fff;border-radius:0 0 8px 8px;word-break:break-word}.rte-editor[data-empty=true]:before{content:attr(data-placeholder);color:#64748b;pointer-events:none;float:left;height:0}.rte-editor ul,.rte-editor ol{padding-left:1.5em;margin:.25em 0}.rte-editor li{margin:.15em 0}.rte-editor h1{font-size:1.75em;font-weight:700;margin:.5em 0 .25em}.rte-editor h2{font-size:1.4em;font-weight:600;margin:.5em 0 .25em}.rte-editor h3{font-size:1.15em;font-weight:600;margin:.5em 0 .25em}.rte-editor a{color:#2563eb;text-decoration:underline}.rte-desc{margin:0;font-size:.75rem;line-height:1.4;color:#64748b}.rte-desc-error{color:#dc2626}@media(max-width:480px){.rte-editor{font-size:1rem}}@media(pointer:coarse),(max-width:480px){.rte-btn{width:44px;height:44px}.rte-menu-btn{width:auto;min-width:44px}.rte-divider{height:28px}}\n"],
1215
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1216
+ });
1217
+ }
1218
+ };
1219
+ i0.ɵɵngDeclareClassMetadata({
1220
+ minVersion: "12.0.0",
1221
+ version: "22.2.2",
1222
+ ngImport: i0,
1223
+ type: RichTextEditorComponent,
1224
+ decorators: [{
1225
+ type: Component,
1226
+ args: [{
1227
+ selector: "ui-rich-text-editor",
1228
+ standalone: true,
1229
+ changeDetection: ChangeDetectionStrategy.OnPush,
1230
+ providers: [{
1231
+ provide: NG_VALUE_ACCESSOR,
1232
+ useExisting: forwardRef(() => RichTextEditorComponent),
1233
+ multi: true
1234
+ }],
1235
+ host: {
1236
+ "(document:click)": "onDocumentClick()",
1237
+ "(document:selectionchange)": "onSelectionChange()"
1238
+ },
1239
+ template: `
1240
+ <div class="rte-field" [class.rte-error]="_activeError()" [class.rte-disabled]="disabled()">
1241
+ @if (label()) {
1242
+ <label class="rte-label" [id]="_labelId" (click)="focus()">
1243
+ {{ label() }}
1244
+ @if (required()) { <span class="rte-required" aria-hidden="true">*</span> }
1245
+ @if (hint()) { <span class="rte-hint-inline">({{ hint() }})</span> }
1246
+ </label>
1247
+ }
1248
+
1249
+ <div class="rte-box">
1250
+ @if (toolbarVisible()) {
1251
+ <div class="rte-toolbar" role="toolbar" [attr.aria-label]="labels.t('richTextEditor.textFormatting')" [attr.aria-controls]="_editorId"
1252
+ (mousedown)="onToolbarMouseDown($event)">
1253
+ @if (show('bold') || show('italic') || show('underline') || show('strikethrough') || show('link')) {
1254
+ @if (show('bold')) {
1255
+ <button type="button" class="rte-btn" data-option="bold" [class.active]="active()['bold']"
1256
+ [attr.aria-pressed]="active()['bold']" [disabled]="inert()"
1257
+ [attr.aria-label]="labels.t('richTextEditor.bold')" [attr.title]="labels.t('richTextEditor.boldCtrlB')" (click)="exec('bold')">
1258
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"/><path d="M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"/></svg>
1259
+ </button>
1260
+ }
1261
+ @if (show('italic')) {
1262
+ <button type="button" class="rte-btn" data-option="italic" [class.active]="active()['italic']"
1263
+ [attr.aria-pressed]="active()['italic']" [disabled]="inert()"
1264
+ [attr.aria-label]="labels.t('richTextEditor.italic')" [attr.title]="labels.t('richTextEditor.italicCtrlI')" (click)="exec('italic')">
1265
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/></svg>
1266
+ </button>
1267
+ }
1268
+ @if (show('underline')) {
1269
+ <button type="button" class="rte-btn" data-option="underline" [class.active]="active()['underline']"
1270
+ [attr.aria-pressed]="active()['underline']" [disabled]="inert()"
1271
+ [attr.aria-label]="labels.t('richTextEditor.underline')" [attr.title]="labels.t('richTextEditor.underlineCtrlU')" (click)="exec('underline')">
1272
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 3v7a6 6 0 006 6 6 6 0 006-6V3"/><line x1="4" y1="21" x2="20" y2="21"/></svg>
1273
+ </button>
1274
+ }
1275
+ @if (show('strikethrough')) {
1276
+ <button type="button" class="rte-btn" data-option="strikethrough" [class.active]="active()['strikeThrough']"
1277
+ [attr.aria-pressed]="active()['strikeThrough']" [disabled]="inert()"
1278
+ [attr.aria-label]="labels.t('richTextEditor.strikethrough')" [attr.title]="labels.t('richTextEditor.strikethrough')" (click)="exec('strikeThrough')">
1279
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="4" y1="12" x2="20" y2="12"/><path d="M6 4h8a4 4 0 010 8H6"/><path d="M10 12v8"/></svg>
1280
+ </button>
1281
+ }
1282
+ @if (show('link')) {
1283
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1284
+ <button type="button" class="rte-btn rte-menu-btn" data-option="link" [class.active]="openMenu() === 'link'"
1285
+ [disabled]="inert()" [attr.aria-label]="labels.t('common.link')" [attr.title]="labels.t('common.link')"
1286
+ aria-haspopup="dialog" [attr.aria-expanded]="openMenu() === 'link'" (click)="toggleLink()">
1287
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/></svg>
1288
+ </button>
1289
+ @if (openMenu() === 'link') {
1290
+ <div class="rte-dropdown rte-link-panel" role="dialog" [attr.aria-label]="labels.t('common.link')" (keydown.escape)="closeLink()">
1291
+ <label class="rte-link-label" [for]="_linkId">{{ labels.t('richTextEditor.webAddress') }}</label>
1292
+ <input class="rte-link-input" type="url" inputmode="url" autocomplete="off" spellcheck="false" placeholder="example.com"
1293
+ [id]="_linkId" [value]="linkUrl()" [attr.aria-invalid]="linkError() ? 'true' : null"
1294
+ [attr.aria-describedby]="linkError() ? _linkId + '-error' : null"
1295
+ (input)="linkUrl.set($any($event.target).value); linkError.set('')" (keydown.enter)="$event.preventDefault(); applyLink()" />
1296
+ @if (linkError()) { <p class="rte-link-error" role="alert" [id]="_linkId + '-error'">{{ linkError() }}</p> }
1297
+ <div class="rte-link-actions">
1298
+ <button type="button" class="rte-link-btn rte-link-apply" data-testid="rte-link-apply" (click)="applyLink()">{{ labels.t('common.apply') }}</button>
1299
+ @if (hasLink()) { <button type="button" class="rte-link-btn" data-testid="rte-link-remove" (click)="removeLink()">{{ labels.t('richTextEditor.removeLink') }}</button> }
1300
+ </div>
1301
+ </div>
1302
+ }
1303
+ </span>
1304
+ }
1305
+ }
1306
+
1307
+ @if (divider()['text']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1308
+ @if (show('heading')) {
1309
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1310
+ <button type="button" class="rte-btn rte-menu-btn" data-option="heading" [class.active]="openMenu() === 'heading'"
1311
+ [disabled]="inert()" [attr.aria-label]="labels.t('richTextEditor.headingStyle')" [attr.title]="labels.t('richTextEditor.headingStyle2')"
1312
+ aria-haspopup="menu" [attr.aria-expanded]="openMenu() === 'heading'" (click)="toggleMenu('heading')">
1313
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M4 12h16M4 18h10"/></svg>
1314
+ <svg class="rte-chevron" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
1315
+ </button>
1316
+ @if (openMenu() === 'heading') {
1317
+ <div class="rte-dropdown" role="menu" [attr.aria-label]="labels.t('richTextEditor.headingStyle')" style="min-width:130px">
1318
+ @for (h of headings; track h.tag) {
1319
+ <button type="button" role="menuitemradio" class="rte-item" [class]="h.cls"
1320
+ [class.selected]="activeHeading() === h.label" [attr.aria-checked]="activeHeading() === h.label"
1321
+ (click)="selectHeading(h.tag, h.label)">{{ headingText(h.tag) }}</button>
1322
+ }
1323
+ </div>
1324
+ }
1325
+ </span>
1326
+ }
1327
+ @if (show('fontSize')) {
1328
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1329
+ <button type="button" class="rte-btn rte-menu-btn" data-option="fontSize" [class.active]="openMenu() === 'size'"
1330
+ [disabled]="inert()" [attr.aria-label]="labels.t('richTextEditor.fontSize')" [attr.title]="labels.t('richTextEditor.fontSize2')"
1331
+ aria-haspopup="menu" [attr.aria-expanded]="openMenu() === 'size'" (click)="toggleMenu('size')">
1332
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="2" y="17" font-size="14" fill="currentColor" stroke="none" font-weight="bold">T</text><text x="13" y="20" font-size="9" fill="currentColor" stroke="none">T</text></svg>
1333
+ <svg class="rte-chevron" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
1334
+ </button>
1335
+ @if (openMenu() === 'size') {
1336
+ <div class="rte-dropdown" role="menu" [attr.aria-label]="labels.t('richTextEditor.fontSize')" style="min-width:110px">
1337
+ @for (s of sizes; track s.value) {
1338
+ <button type="button" role="menuitemradio" class="rte-item"
1339
+ [class.selected]="activeFontSize() === s.label" [attr.aria-checked]="activeFontSize() === s.label"
1340
+ (click)="selectSize(s.value, s.label)"><span [style.font-size.px]="s.px">{{ sizeText(s.value) }}</span></button>
1341
+ }
1342
+ </div>
1343
+ }
1344
+ </span>
1345
+ }
1346
+ @if (show('fontFamily')) {
1347
+ <span class="rte-menu-wrap" (click)="$event.stopPropagation()">
1348
+ <button type="button" class="rte-btn rte-menu-btn" data-option="fontFamily" [class.active]="openMenu() === 'font'"
1349
+ [disabled]="inert()" [attr.aria-label]="labels.t('richTextEditor.fontFamily')" [attr.title]="labels.t('richTextEditor.fontFamily2')"
1350
+ aria-haspopup="menu" [attr.aria-expanded]="openMenu() === 'font'" (click)="toggleMenu('font')">
1351
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><text x="1" y="18" font-size="18" fill="currentColor" stroke="none" font-weight="600" font-style="italic">{{ labels.t('richTextEditor.aa') }}</text></svg>
1352
+ <svg class="rte-chevron" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
1353
+ </button>
1354
+ @if (openMenu() === 'font') {
1355
+ <div class="rte-dropdown rte-font-panel" role="menu" [attr.aria-label]="labels.t('richTextEditor.fontFamily')">
1356
+ @for (g of fontGroups; track g.label) {
1357
+ <div class="rte-group-label" role="presentation">{{ fontGroupText(g.label) }}</div>
1358
+ @for (f of g.fonts; track f.label) {
1359
+ <button type="button" role="menuitemradio" class="rte-item"
1360
+ [class.selected]="activeFont() === f.label" [attr.aria-checked]="activeFont() === f.label"
1361
+ [style.font-family]="f.preview" (click)="selectFont(f.value, f.label)">{{ fontText(f) }}</button>
1362
+ }
1363
+ }
1364
+ </div>
1365
+ }
1366
+ </span>
1367
+ }
1368
+
1369
+ @if (divider()['color']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1370
+ @if (show('textColor')) {
1371
+ <label class="rte-btn" data-option="textColor" [attr.title]="labels.t('richTextEditor.textColor')" [class.rte-btn-disabled]="inert()">
1372
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 20h16M12 4L6 18M12 4l6 14M8.5 13h7"/></svg>
1373
+ <input type="color" class="rte-color" [attr.aria-label]="labels.t('richTextEditor.textColor2')" value="#000000" [disabled]="inert()"
1374
+ (input)="execWithArg('foreColor', $any($event.target).value)" />
1375
+ </label>
1376
+ }
1377
+ @if (show('highlight')) {
1378
+ <label class="rte-btn" data-option="highlight" [attr.title]="labels.t('richTextEditor.highlightColor')" [class.rte-btn-disabled]="inert()">
1379
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor"><path d="M15.24 2.58a1 1 0 00-1.41 0L5.59 10.82a2 2 0 000 2.83l4.24 4.24L8.41 19.3a1 1 0 001.42 1.41l1.41-1.41 1.06 1.06a1 1 0 001.42 0l8-8a1 1 0 000-1.42l-6.48-6.36zM7 13.65l3.54-3.54 3.54 3.54-3.54 3.53L7 13.65z" opacity=".4"/><path d="M10.54 10.11l3.54-3.54 3.53 3.54-3.53 3.53-3.54-3.53z"/></svg>
1380
+ <input type="color" class="rte-color" [attr.aria-label]="labels.t('richTextEditor.highlightColor2')" value="#ffff00" [disabled]="inert()"
1381
+ (input)="execWithArg('hiliteColor', $any($event.target).value)" />
1382
+ </label>
1383
+ }
1384
+
1385
+ @if (divider()['align']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1386
+ @if (show('align')) {
1387
+ <button type="button" class="rte-btn" data-option="align-left" [class.active]="active()['justifyLeft']"
1388
+ [attr.aria-pressed]="active()['justifyLeft']" [disabled]="inert()"
1389
+ [attr.aria-label]="labels.t('richTextEditor.alignLeft')" [attr.title]="labels.t('richTextEditor.alignLeft2')" (click)="exec('justifyLeft')">
1390
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="18" y2="18"/></svg>
1391
+ </button>
1392
+ <button type="button" class="rte-btn" data-option="align-center" [class.active]="active()['justifyCenter']"
1393
+ [attr.aria-pressed]="active()['justifyCenter']" [disabled]="inert()"
1394
+ [attr.aria-label]="labels.t('richTextEditor.alignCenter')" [attr.title]="labels.t('richTextEditor.alignCenter2')" (click)="exec('justifyCenter')">
1395
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>
1396
+ </button>
1397
+ <button type="button" class="rte-btn" data-option="align-right" [class.active]="active()['justifyRight']"
1398
+ [attr.aria-pressed]="active()['justifyRight']" [disabled]="inert()"
1399
+ [attr.aria-label]="labels.t('richTextEditor.alignRight')" [attr.title]="labels.t('richTextEditor.alignRight2')" (click)="exec('justifyRight')">
1400
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="6" y1="18" x2="21" y2="18"/></svg>
1401
+ </button>
1402
+ }
1403
+
1404
+ @if (divider()['blocks']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1405
+ @if (show('bulletList')) {
1406
+ <button type="button" class="rte-btn" data-option="bulletList" [class.active]="active()['insertUnorderedList']"
1407
+ [attr.aria-pressed]="active()['insertUnorderedList']" [disabled]="inert()"
1408
+ [attr.aria-label]="labels.t('richTextEditor.bulletList')" [attr.title]="labels.t('richTextEditor.bulletList2')" (click)="exec('insertUnorderedList')">
1409
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="9" y1="6" x2="20" y2="6"/><line x1="9" y1="12" x2="20" y2="12"/><line x1="9" y1="18" x2="20" y2="18"/><circle cx="5" cy="6" r="1.5" fill="currentColor"/><circle cx="5" cy="12" r="1.5" fill="currentColor"/><circle cx="5" cy="18" r="1.5" fill="currentColor"/></svg>
1410
+ </button>
1411
+ }
1412
+ @if (show('numberedList')) {
1413
+ <button type="button" class="rte-btn" data-option="numberedList" [class.active]="active()['insertOrderedList']"
1414
+ [attr.aria-pressed]="active()['insertOrderedList']" [disabled]="inert()"
1415
+ [attr.aria-label]="labels.t('richTextEditor.numberedList')" [attr.title]="labels.t('richTextEditor.numberedList2')" (click)="exec('insertOrderedList')">
1416
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="10" y1="6" x2="20" y2="6"/><line x1="10" y1="12" x2="20" y2="12"/><line x1="10" y1="18" x2="20" y2="18"/><text x="3" y="8" font-size="8" fill="currentColor" stroke="none" font-weight="bold">1</text><text x="3" y="14" font-size="8" fill="currentColor" stroke="none" font-weight="bold">2</text><text x="3" y="20" font-size="8" fill="currentColor" stroke="none" font-weight="bold">3</text></svg>
1417
+ </button>
1418
+ }
1419
+ @if (show('indent')) {
1420
+ <button type="button" class="rte-btn" data-option="indent" [disabled]="inert()"
1421
+ [attr.aria-label]="labels.t('richTextEditor.indent')" [attr.title]="labels.t('richTextEditor.indent')" (click)="exec('indent')">
1422
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/><polyline points="9 8 13 12 9 16"/><line x1="3" y1="12" x2="13" y2="12"/></svg>
1423
+ </button>
1424
+ }
1425
+ @if (show('outdent')) {
1426
+ <button type="button" class="rte-btn" data-option="outdent" [disabled]="inert()"
1427
+ [attr.aria-label]="labels.t('richTextEditor.outdent')" [attr.title]="labels.t('richTextEditor.outdent')" (click)="exec('outdent')">
1428
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/><polyline points="7 8 3 12 7 16"/><line x1="3" y1="12" x2="21" y2="12"/></svg>
1429
+ </button>
1430
+ }
1431
+
1432
+ @if (divider()['clear']) { <div class="rte-divider" role="separator" aria-orientation="vertical"></div> }
1433
+ @if (show('clearFormat')) {
1434
+ <button type="button" class="rte-btn" data-option="clearFormat" [disabled]="inert()"
1435
+ [attr.aria-label]="labels.t('richTextEditor.clearFormatting')" [attr.title]="labels.t('richTextEditor.clearFormatting2')" (click)="exec('removeFormat')">
1436
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 7h16M6 4h8a2 2 0 012 2v0a2 2 0 01-2 2H6"/><line x1="4" y1="20" x2="20" y2="4" stroke-width="1.5"/></svg>
1437
+ </button>
1438
+ }
1439
+ </div>
1440
+ }
1441
+
1442
+ <div
1443
+ #editor
1444
+ class="rte-editor"
1445
+ [id]="_editorId"
1446
+ [attr.contenteditable]="inert() ? 'false' : 'true'"
1447
+ role="textbox"
1448
+ aria-multiline="true"
1449
+ [attr.aria-label]="label() ? null : (ariaLabel() || placeholder() || labels.t('richTextEditor.editorName'))"
1450
+ [attr.aria-labelledby]="label() ? _labelId : null"
1451
+ [attr.aria-required]="required() || null"
1452
+ [attr.aria-readonly]="readonly() || null"
1453
+ [attr.aria-disabled]="disabled() || null"
1454
+ [attr.aria-invalid]="_activeError() ? 'true' : null"
1455
+ [attr.aria-describedby]="_activeError() ? _errorId : null"
1456
+ [attr.data-placeholder]="placeholder()"
1457
+ [attr.data-empty]="empty() ? 'true' : null"
1458
+ [style.min-height.px]="minHeight()"
1459
+ [style.max-height.px]="maxHeight()"
1460
+ (input)="onInput()"
1461
+ (keydown)="onKeydown($event)"
1462
+ (paste)="onPaste($event)"
1463
+ (keyup)="refreshActive()"
1464
+ (mouseup)="refreshActive()"
1465
+ (blur)="onBlur()"
1466
+ ></div>
1467
+ </div>
1468
+
1469
+ @if (_activeError()) {
1470
+ <p class="rte-desc rte-desc-error" [id]="_errorId" role="alert">{{ _activeError() }}</p>
1471
+ }
1472
+ </div>
1473
+ `,
1474
+ styles: [":host{display:block}.rte-field{display:flex;flex-direction:column;gap:6px}.rte-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.rte-required{color:#dc2626;margin-left:2px}.rte-hint-inline{font-size:.75rem;color:#94a3b8;font-weight:400;margin-left:4px}.rte-box{border:1px solid #7c8ba1;border-radius:8px;background:#fff;transition:border-color .15s,box-shadow .15s}.rte-box:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.rte-error .rte-box{border-color:#ef4444}.rte-error .rte-box:focus-within{box-shadow:0 0 0 3px #ef44441f}.rte-disabled .rte-box{opacity:.5;cursor:not-allowed}.rte-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:6px 8px;background:#f8fafc;border-bottom:1px solid #e2e8f0;border-radius:8px 8px 0 0}.rte-divider{width:1px;height:20px;background:#cbd5e1;margin:0 4px}.rte-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:none;color:#64748b;cursor:pointer;transition:background .15s,color .15s}.rte-btn svg{width:16px;height:16px}.rte-btn:hover:not(:disabled){background:#e2e8f0;color:#1e293b}.rte-btn:focus-visible,.rte-btn:focus-within{outline:2px solid #3b82f6;outline-offset:1px}.rte-btn.active{background:#dbeafe;color:#2563eb}.rte-btn:disabled,.rte-btn-disabled{cursor:not-allowed;opacity:.5}.rte-menu-wrap{position:relative;display:inline-flex}.rte-menu-btn{width:auto;padding:0 6px;gap:3px}.rte-menu-btn .rte-chevron{width:10px;height:10px;color:#64748b;flex-shrink:0}.rte-dropdown{position:absolute;top:calc(100% + 4px);left:0;z-index:100;background:#fff;border:1px solid #e2e8f0;border-radius:6px;box-shadow:0 4px 12px #0000001f;padding:4px;overflow-y:auto;max-height:260px}.rte-font-panel{min-width:180px}.rte-link-panel{display:flex;flex-direction:column;gap:6px;min-width:240px;padding:10px;overflow:visible}.rte-link-label{font-size:12px;font-weight:600;color:#374151}.rte-link-input{box-sizing:border-box;width:100%;padding:6px 8px;font:inherit;font-size:14px;border:1px solid #cbd5e1;border-radius:6px}.rte-link-input:focus-visible{outline:2px solid #2563eb;outline-offset:1px}.rte-link-error{margin:0;font-size:12px;color:#dc2626}.rte-link-actions{display:flex;gap:6px}.rte-link-btn{padding:5px 10px;font-size:12px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#374151;cursor:pointer}.rte-link-apply{background:#2563eb;border-color:#2563eb;color:#fff}.rte-item{display:block;width:100%;text-align:left;padding:5px 10px;font-size:12px;color:#374151;border:none;background:none;border-radius:4px;cursor:pointer;white-space:nowrap}.rte-item:hover{background:#f1f5f9}.rte-item.selected{background:#dbeafe;color:#2563eb;font-weight:600}.rte-group-label{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:#94a3b8;padding:6px 10px 2px}.di-h1{font-size:18px;font-weight:700}.di-h2{font-size:15px;font-weight:600}.di-h3{font-size:13px;font-weight:600}.rte-color{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.rte-editor{padding:12px;outline:none;overflow-y:auto;box-sizing:border-box;font-size:.875rem;line-height:1.6;color:#1e293b;background:#fff;border-radius:0 0 8px 8px;word-break:break-word}.rte-editor[data-empty=true]:before{content:attr(data-placeholder);color:#64748b;pointer-events:none;float:left;height:0}.rte-editor ul,.rte-editor ol{padding-left:1.5em;margin:.25em 0}.rte-editor li{margin:.15em 0}.rte-editor h1{font-size:1.75em;font-weight:700;margin:.5em 0 .25em}.rte-editor h2{font-size:1.4em;font-weight:600;margin:.5em 0 .25em}.rte-editor h3{font-size:1.15em;font-weight:600;margin:.5em 0 .25em}.rte-editor a{color:#2563eb;text-decoration:underline}.rte-desc{margin:0;font-size:.75rem;line-height:1.4;color:#64748b}.rte-desc-error{color:#dc2626}@media(max-width:480px){.rte-editor{font-size:1rem}}@media(pointer:coarse),(max-width:480px){.rte-btn{width:44px;height:44px}.rte-menu-btn{width:auto;min-width:44px}.rte-divider{height:28px}}\n"]
1475
+ }]
1476
+ }],
1477
+ ctorParameters: () => [],
1478
+ propDecorators: {
1479
+ label: [{
1480
+ type: i0.Input,
1481
+ args: [{
1482
+ isSignal: true,
1483
+ alias: "label",
1484
+ required: false
1485
+ }]
1486
+ }],
1487
+ ariaLabel: [{
1488
+ type: i0.Input,
1489
+ args: [{
1490
+ isSignal: true,
1491
+ alias: "ariaLabel",
1492
+ required: false
1493
+ }]
1494
+ }],
1495
+ placeholder: [{
1496
+ type: i0.Input,
1497
+ args: [{
1498
+ isSignal: true,
1499
+ alias: "placeholder",
1500
+ required: false
1501
+ }]
1502
+ }],
1503
+ required: [{
1504
+ type: i0.Input,
1505
+ args: [{
1506
+ isSignal: true,
1507
+ alias: "required",
1508
+ required: false
1509
+ }]
1510
+ }],
1511
+ readonly: [{
1512
+ type: i0.Input,
1513
+ args: [{
1514
+ isSignal: true,
1515
+ alias: "readonly",
1516
+ required: false
1517
+ }]
1518
+ }],
1519
+ hint: [{
1520
+ type: i0.Input,
1521
+ args: [{
1522
+ isSignal: true,
1523
+ alias: "hint",
1524
+ required: false
1525
+ }]
1526
+ }],
1527
+ error: [{
1528
+ type: i0.Input,
1529
+ args: [{
1530
+ isSignal: true,
1531
+ alias: "error",
1532
+ required: false
1533
+ }]
1534
+ }],
1535
+ showErrors: [{
1536
+ type: i0.Input,
1537
+ args: [{
1538
+ isSignal: true,
1539
+ alias: "showErrors",
1540
+ required: false
1541
+ }]
1542
+ }],
1543
+ minHeight: [{
1544
+ type: i0.Input,
1545
+ args: [{
1546
+ isSignal: true,
1547
+ alias: "minHeight",
1548
+ required: false
1549
+ }]
1550
+ }],
1551
+ maxHeight: [{
1552
+ type: i0.Input,
1553
+ args: [{
1554
+ isSignal: true,
1555
+ alias: "maxHeight",
1556
+ required: false
1557
+ }]
1558
+ }],
1559
+ hide: [{
1560
+ type: i0.Input,
1561
+ args: [{
1562
+ isSignal: true,
1563
+ alias: "hide",
1564
+ required: false
1565
+ }]
1566
+ }],
1567
+ _disabledInput: [{
1568
+ type: i0.Input,
1569
+ args: [{
1570
+ isSignal: true,
1571
+ alias: "disabled",
1572
+ required: false
1573
+ }]
1574
+ }],
1575
+ editor: [{
1576
+ type: i0.ViewChild,
1577
+ args: ["editor", { isSignal: true }]
1578
+ }]
1579
+ }
1580
+ });
1581
+ const EMAIL_TEMPLATE_START_TEXT = "Start writing your email...";
1582
+ const EMAIL_TEMPLATE_MAX_BODY = 9e3;
1583
+ const EMAIL_TEMPLATE_MAX_TEXT = 255;
1584
+ const MAX_EMAIL_ADDRESS_LENGTH = 254;
1585
+ const EMAIL_RE = /^[^\s@,;<>"]+@[^\s@,;<>"]+\.[^\s@,;<>"]+$/;
1586
+ const isValidEmailAddress = (address) => address.length <= 254 && EMAIL_RE.test(address);
1587
+ function isWebUrl(raw) {
1588
+ if (/[\s"<>]/.test(raw)) return false;
1589
+ try {
1590
+ const u = new URL(raw);
1591
+ return (u.protocol === "http:" || u.protocol === "https:") && (u.hostname.includes(".") || u.hostname === "localhost");
1592
+ } catch {
1593
+ return false;
1594
+ }
1595
+ }
1596
+ function serializedTextLength(text) {
1597
+ let n = 0;
1598
+ for (let i = 0; i < text.length; i++) {
1599
+ const ch = text[i];
1600
+ n += ch === "&" ? 5 : ch === "<" || ch === ">" ? 4 : ch === "\xA0" ? 6 : 1;
1601
+ }
1602
+ return n;
1603
+ }
1604
+ function escapeHtml(value) {
1605
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1606
+ }
1607
+ const CONTENT_MEMO = /* @__PURE__ */ new Map();
1608
+ function blockHasContent(html) {
1609
+ const hit = CONTENT_MEMO.get(html);
1610
+ if (hit !== void 0) return hit;
1611
+ const doc = new DOMParser().parseFromString(html, "text/html");
1612
+ let result;
1613
+ if (doc.querySelector("img, video, iframe")) result = true;
1614
+ else {
1615
+ const text = (doc.body.textContent ?? "").replace(/ /g, " ").trim();
1616
+ result = text !== "" && text !== "Start writing your email..." && text !== uiText("emailTemplateEditor.startWriting");
1617
+ }
1618
+ if (CONTENT_MEMO.size >= 200) CONTENT_MEMO.clear();
1619
+ CONTENT_MEMO.set(html, result);
1620
+ return result;
1621
+ }
1622
+ const EMAIL_BLOCK_DRAG_TYPE = "application/x-tpl-block";
1623
+ function isBlockDrag(event) {
1624
+ const types = event.dataTransfer?.types;
1625
+ return !!types && Array.from(types).includes("application/x-tpl-block");
1626
+ }
1627
+ function insideEditorBlock(node) {
1628
+ return !!(node instanceof Element ? node : node?.parentElement)?.closest(".block-content");
1629
+ }
1630
+ function formatVideoDuration(seconds) {
1631
+ if (!seconds) return "";
1632
+ return `${Math.floor(seconds / 60)}:${(seconds % 60).toString().padStart(2, "0")}`;
1633
+ }
1634
+ function formatCategoryLabel(cat) {
1635
+ return (cat ?? "").split("-").filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
1636
+ }
1637
+ function thumbnailSrc(video, origin) {
1638
+ const t = video.thumbnailUrl;
1639
+ if (!t) return null;
1640
+ return t.startsWith("http") ? t : `${origin}${t}`;
1641
+ }
1642
+ function buildVideoBlockHtml(video, link, caption, origin) {
1643
+ const title = escapeHtml(video.title);
1644
+ const href = escapeHtml(link);
1645
+ const thumb = thumbnailSrc(video, origin);
1646
+ return `<div style="max-width:560px;margin:16px auto;border:1px solid #e2e8f0;border-radius:12px;overflow:hidden;font-family:inherit"><a href="${href}" target="_blank" style="display:block;text-decoration:none;">${`<div style="position:relative;display:block;line-height:0;">${thumb ? `<img src="${escapeHtml(thumb)}" alt="${title}" style="width:100%;height:200px;object-fit:cover;display:block;border-radius:0;"/>` : `<div style="width:100%;height:200px;background:linear-gradient(135deg,#1e293b,#334155);display:flex;align-items:center;justify-content:center;"></div>`}<div style="position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.25);"><div style="width:64px;height:64px;background:rgba(0,0,0,0.65);border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 12px rgba(0,0,0,0.4);"><div style="width:0;height:0;border-style:solid;border-width:12px 0 12px 22px;border-color:transparent transparent transparent #ffffff;margin-left:5px;"></div></div></div></div>`}<div style="padding:14px 16px;background:#fff;display:flex;align-items:center;gap:10px;"><div style="width:32px;height:32px;background:#ef4444;border-radius:6px;flex-shrink:0;display:flex;align-items:center;justify-content:center;"><div style="width:0;height:0;border-style:solid;border-width:6px 0 6px 11px;border-color:transparent transparent transparent #ffffff;margin-left:2px;"></div></div><div><p style="font-size:14px;font-weight:600;color:#1e293b;margin:0 0 2px;">${title}</p><p style="font-size:12px;color:#64748b;margin:0;">${escapeHtml(caption)}</p></div></div></a></div>`;
1647
+ }
1648
+ const TH = "padding:8px 12px;text-align:left;background:#f8fafc;border:1px solid #e2e8f0";
1649
+ const TD = "padding:8px 12px;border:1px solid #e2e8f0";
1650
+ const DEFAULT_EMAIL_TEMPLATE_BLOCK_GROUPS = [
1651
+ {
1652
+ name: "Buttons",
1653
+ blocks: [
1654
+ {
1655
+ key: "btn-primary",
1656
+ label: "Primary Button",
1657
+ html: "<div style=\"text-align:center;margin:16px 0\"><a href=\"#\" style=\"display:inline-block;padding:12px 28px;background:#3B82F6;color:#fff;border-radius:6px;text-decoration:none;font-weight:600\">Button Text</a></div>"
1658
+ },
1659
+ {
1660
+ key: "btn-secondary",
1661
+ label: "Secondary Button",
1662
+ html: "<div style=\"text-align:center;margin:16px 0\"><a href=\"#\" style=\"display:inline-block;padding:12px 28px;background:#64748b;color:#fff;border-radius:6px;text-decoration:none;font-weight:600\">Button Text</a></div>"
1663
+ },
1664
+ {
1665
+ key: "btn-outline",
1666
+ label: "Outline Button",
1667
+ html: "<div style=\"text-align:center;margin:16px 0\"><a href=\"#\" style=\"display:inline-block;padding:12px 28px;border:2px solid #3B82F6;color:#3B82F6;border-radius:6px;text-decoration:none;font-weight:600\">Button Text</a></div>"
1668
+ },
1669
+ {
1670
+ key: "btn-link",
1671
+ label: "Link Button",
1672
+ html: "<div style=\"margin:8px 0\"><a href=\"#\" style=\"color:#3B82F6;text-decoration:underline\">Link Text</a></div>"
1673
+ }
1674
+ ]
1675
+ },
1676
+ {
1677
+ name: "Spacing",
1678
+ blocks: [
1679
+ {
1680
+ key: "spacer-sm",
1681
+ label: "Small Spacer",
1682
+ html: "<div style=\"height:8px\">&nbsp;</div>"
1683
+ },
1684
+ {
1685
+ key: "spacer-md",
1686
+ label: "Medium Spacer",
1687
+ html: "<div style=\"height:24px\">&nbsp;</div>"
1688
+ },
1689
+ {
1690
+ key: "spacer-lg",
1691
+ label: "Large Spacer",
1692
+ html: "<div style=\"height:48px\">&nbsp;</div>"
1693
+ },
1694
+ {
1695
+ key: "divider",
1696
+ label: "Divider Line",
1697
+ html: "<hr style=\"border:none;border-top:1px solid #e2e8f0;margin:16px 0\"/>"
1698
+ }
1699
+ ]
1700
+ },
1701
+ {
1702
+ name: "Layout",
1703
+ blocks: [{
1704
+ key: "layout-2col",
1705
+ label: "Two Columns",
1706
+ html: "<table style=\"width:100%;border-collapse:collapse\"><tr><td style=\"width:50%;padding:8px;vertical-align:top\"><p>Left column</p></td><td style=\"width:50%;padding:8px;vertical-align:top\"><p>Right column</p></td></tr></table>"
1707
+ }, {
1708
+ key: "layout-3col",
1709
+ label: "Three Columns",
1710
+ html: "<table style=\"width:100%;border-collapse:collapse\"><tr><td style=\"width:33%;padding:8px;vertical-align:top\"><p>Col 1</p></td><td style=\"width:33%;padding:8px;vertical-align:top\"><p>Col 2</p></td><td style=\"width:34%;padding:8px;vertical-align:top\"><p>Col 3</p></td></tr></table>"
1711
+ }]
1712
+ },
1713
+ {
1714
+ name: "Content",
1715
+ blocks: [{
1716
+ key: "text-block",
1717
+ label: "Text Block",
1718
+ html: "<p>Enter your text here...</p>"
1719
+ }, {
1720
+ key: "image-block",
1721
+ label: "Image Block",
1722
+ html: "<div style=\"text-align:center;margin:8px 0\"><img src=\"https://placehold.co/600x200/e2e8f0/94a3b8?text=Image\" alt=\"Image\" style=\"max-width:100%;border-radius:8px\"/></div>"
1723
+ }]
1724
+ },
1725
+ {
1726
+ name: "Tables",
1727
+ blocks: [{
1728
+ key: "table-2col",
1729
+ label: "Two-Column Table",
1730
+ html: `<table style="width:100%;border-collapse:collapse;border:1px solid #e2e8f0"><tr><th style="${TH}">Header 1</th><th style="${TH}">Header 2</th></tr><tr><td style="${TD}">Data</td><td style="${TD}">Data</td></tr></table>`
1731
+ }, {
1732
+ key: "table-3col",
1733
+ label: "Three-Column Table",
1734
+ html: `<table style="width:100%;border-collapse:collapse;border:1px solid #e2e8f0"><tr><th style="${TH}">Header 1</th><th style="${TH}">Header 2</th><th style="${TH}">Header 3</th></tr><tr><td style="${TD}">Data</td><td style="${TD}">Data</td><td style="${TD}">Data</td></tr></table>`
1735
+ }]
1736
+ }
1737
+ ];
1738
+ const GROUP_KEYS = {
1739
+ Buttons: "buttons",
1740
+ Spacing: "spacing",
1741
+ Layout: "layout",
1742
+ Content: "content",
1743
+ Tables: "tables"
1744
+ };
1745
+ function localizeBlockHtml(html) {
1746
+ return [
1747
+ [">Button Text<", `>${uiText("emailTemplateEditor.sample.buttonText")}<`],
1748
+ [">Link Text<", `>${uiText("emailTemplateEditor.sample.linkText")}<`],
1749
+ ["<p>Left column</p>", `<p>${uiText("emailTemplateEditor.sample.leftColumn")}</p>`],
1750
+ ["<p>Right column</p>", `<p>${uiText("emailTemplateEditor.sample.rightColumn")}</p>`],
1751
+ ["<p>Col 1</p>", `<p>${uiText("emailTemplateEditor.sample.column", { n: 1 })}</p>`],
1752
+ ["<p>Col 2</p>", `<p>${uiText("emailTemplateEditor.sample.column", { n: 2 })}</p>`],
1753
+ ["<p>Col 3</p>", `<p>${uiText("emailTemplateEditor.sample.column", { n: 3 })}</p>`],
1754
+ ["<p>Enter your text here...</p>", `<p>${uiText("emailTemplateEditor.sample.enterText")}</p>`],
1755
+ ["alt=\"Image\"", `alt="${uiText("emailTemplateEditor.sample.image")}"`],
1756
+ [">Header 1<", `>${uiText("emailTemplateEditor.sample.header", { n: 1 })}<`],
1757
+ [">Header 2<", `>${uiText("emailTemplateEditor.sample.header", { n: 2 })}<`],
1758
+ [">Header 3<", `>${uiText("emailTemplateEditor.sample.header", { n: 3 })}<`],
1759
+ [">Data<", `>${uiText("emailTemplateEditor.sample.data")}<`]
1760
+ ].reduce((out, [from, to]) => out.split(from).join(to), html);
1761
+ }
1762
+ function localizedEmailBlockGroups() {
1763
+ return DEFAULT_EMAIL_TEMPLATE_BLOCK_GROUPS.map((g) => ({
1764
+ ...g,
1765
+ name: uiText(`emailTemplateEditor.group.${GROUP_KEYS[g.name] ?? g.name}`),
1766
+ blocks: g.blocks.map((b) => ({
1767
+ ...b,
1768
+ label: uiText(`emailTemplateEditor.block.${b.key}`),
1769
+ html: localizeBlockHtml(b.html)
1770
+ }))
1771
+ }));
1772
+ }
1773
+ const DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS = [{
1774
+ name: "Contact",
1775
+ variables: [
1776
+ {
1777
+ key: "first_name",
1778
+ label: "First Name",
1779
+ example: "John"
1780
+ },
1781
+ {
1782
+ key: "last_name",
1783
+ label: "Last Name",
1784
+ example: "Smith"
1785
+ },
1786
+ {
1787
+ key: "full_name",
1788
+ label: "Full Name",
1789
+ example: "John Smith"
1790
+ },
1791
+ {
1792
+ key: "email",
1793
+ label: "Email",
1794
+ example: "john@example.com"
1795
+ },
1796
+ {
1797
+ key: "phone",
1798
+ label: "Phone",
1799
+ example: "(512) 555-0100"
1800
+ }
1801
+ ]
1802
+ }];
1803
+ function buildPreviewDocument(bodyHtml) {
1804
+ return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src * data:; style-src 'unsafe-inline'; font-src data:"><meta name="viewport" content="width=device-width, initial-scale=1"><style>html,body{margin:0}body{padding:24px 28px;font:15px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;color:#1e293b;overflow-wrap:anywhere}p{margin:0 0 8px}img{max-width:100%}table{max-width:100%}a{color:#3b82f6}</style></head><body>${bodyHtml}</body></html>`;
1805
+ }
1806
+ function localizedEmailVariableGroups() {
1807
+ const label = {
1808
+ first_name: "emailTemplateEditor.variable.firstName",
1809
+ last_name: "emailTemplateEditor.variable.lastName",
1810
+ full_name: "emailTemplateEditor.variable.fullName",
1811
+ email: "common.email",
1812
+ phone: "common.phone"
1813
+ };
1814
+ return DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS.map((g) => ({
1815
+ ...g,
1816
+ name: uiText("emailTemplateEditor.variableGroup.contact"),
1817
+ variables: g.variables.map((v) => ({
1818
+ ...v,
1819
+ label: label[v.key] ? uiText(label[v.key]) : v.label
1820
+ }))
1821
+ }));
1822
+ }
1823
+ const FONT_SIZE_OPTIONS = [
1824
+ "10",
1825
+ "12",
1826
+ "14",
1827
+ "16",
1828
+ "18",
1829
+ "20",
1830
+ "24",
1831
+ "28",
1832
+ "32",
1833
+ "36"
1834
+ ].map((n) => ({
1835
+ value: `${n}px`,
1836
+ label: `${n}px`
1837
+ }));
1838
+ const BLOCK_BASE_PADDING_PX = 12;
1839
+ function setEditorSpacing(el, spacing) {
1840
+ el.style.paddingTop = spacing ? `calc(${BLOCK_BASE_PADDING_PX}px + ${spacing})` : "";
1841
+ el.style.paddingBottom = spacing ? `calc(${BLOCK_BASE_PADDING_PX}px + ${spacing})` : "";
1842
+ }
1843
+ const DEFAULT_VIDEO_LINK = (video) => video.shareLink;
1844
+ const EMPTY_VIDEO_DEFAULTS = {
1845
+ autoplay: false,
1846
+ caption: "",
1847
+ ctaType: "",
1848
+ ctaUrl: "",
1849
+ ctaLabel: "",
1850
+ hideReactions: false
1851
+ };
1852
+ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
1853
+ get headingOptions() {
1854
+ return this._headingOptions();
1855
+ }
1856
+ get spacingTabs() {
1857
+ return this._spacingTabs();
1858
+ }
1859
+ get ctaTypeOptions() {
1860
+ return this._ctaTypeOptions();
1861
+ }
1862
+ get playbackOptions() {
1863
+ return this._playbackOptions();
1864
+ }
1865
+ constructor() {
1866
+ this.labels = inject(UiLabelsService);
1867
+ this.host = inject(ElementRef);
1868
+ this.injector = inject(Injector);
1869
+ this.template = input(null, ...ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []);
1870
+ this.categories = input([], ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
1871
+ this.categoryPlaceholderInput = input(null, {
1872
+ ...ngDevMode ? { debugName: "categoryPlaceholderInput" } : /* istanbul ignore next */ {},
1873
+ alias: "categoryPlaceholder"
1874
+ });
1875
+ this.categoryPlaceholder = computed(() => this.categoryPlaceholderInput() ?? this.labels.t("emailTemplateEditor.categoryPlaceholder"), ...ngDevMode ? [{ debugName: "categoryPlaceholder" }] : /* istanbul ignore next */ []);
1876
+ this.assignmentOptions = input([], ...ngDevMode ? [{ debugName: "assignmentOptions" }] : /* istanbul ignore next */ []);
1877
+ this.featuredAssignmentKey = input(null, ...ngDevMode ? [{ debugName: "featuredAssignmentKey" }] : /* istanbul ignore next */ []);
1878
+ this.assignmentsDescriptionInput = input(null, {
1879
+ ...ngDevMode ? { debugName: "assignmentsDescriptionInput" } : /* istanbul ignore next */ {},
1880
+ alias: "assignmentsDescription"
1881
+ });
1882
+ this.assignmentsDescription = computed(() => this.assignmentsDescriptionInput() ?? this.labels.t("emailTemplateEditor.assignmentsDescription"), ...ngDevMode ? [{ debugName: "assignmentsDescription" }] : /* istanbul ignore next */ []);
1883
+ this.variableGroupsInput = input(null, {
1884
+ ...ngDevMode ? { debugName: "variableGroupsInput" } : /* istanbul ignore next */ {},
1885
+ alias: "variableGroups"
1886
+ });
1887
+ this.variableGroups = computed(() => this.variableGroupsInput() ?? localizedEmailVariableGroups(), ...ngDevMode ? [{ debugName: "variableGroups" }] : /* istanbul ignore next */ []);
1888
+ this.blockGroupsInput = input(null, {
1889
+ ...ngDevMode ? { debugName: "blockGroupsInput" } : /* istanbul ignore next */ {},
1890
+ alias: "blockGroups"
1891
+ });
1892
+ this.blockGroups = computed(() => this.blockGroupsInput() ?? localizedEmailBlockGroups(), ...ngDevMode ? [{ debugName: "blockGroups" }] : /* istanbul ignore next */ []);
1893
+ this.heading = input("", ...ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []);
1894
+ this.namePlaceholderInput = input(null, {
1895
+ ...ngDevMode ? { debugName: "namePlaceholderInput" } : /* istanbul ignore next */ {},
1896
+ alias: "namePlaceholder"
1897
+ });
1898
+ this.namePlaceholder = computed(() => this.namePlaceholderInput() ?? this.labels.t("emailTemplateEditor.namePlaceholder"), ...ngDevMode ? [{ debugName: "namePlaceholder" }] : /* istanbul ignore next */ []);
1899
+ this.subjectPlaceholderInput = input(null, {
1900
+ ...ngDevMode ? { debugName: "subjectPlaceholderInput" } : /* istanbul ignore next */ {},
1901
+ alias: "subjectPlaceholder"
1902
+ });
1903
+ this.subjectPlaceholder = computed(() => this.subjectPlaceholderInput() ?? this.labels.t("emailTemplateEditor.subjectPlaceholder"), ...ngDevMode ? [{ debugName: "subjectPlaceholder" }] : /* istanbul ignore next */ []);
1904
+ this.systemNoteInput = input(null, {
1905
+ ...ngDevMode ? { debugName: "systemNoteInput" } : /* istanbul ignore next */ {},
1906
+ alias: "systemNote"
1907
+ });
1908
+ this.systemNote = computed(() => this.systemNoteInput() ?? this.labels.t("emailTemplateEditor.systemNote"), ...ngDevMode ? [{ debugName: "systemNote" }] : /* istanbul ignore next */ []);
1909
+ this.readOnlyNoteInput = input(null, {
1910
+ ...ngDevMode ? { debugName: "readOnlyNoteInput" } : /* istanbul ignore next */ {},
1911
+ alias: "readOnlyNote"
1912
+ });
1913
+ this.readOnlyNote = computed(() => this.readOnlyNoteInput() ?? this.labels.t("emailTemplateEditor.readOnlyNote"), ...ngDevMode ? [{ debugName: "readOnlyNote" }] : /* istanbul ignore next */ []);
1914
+ this.idPrefix = input("tpl", ...ngDevMode ? [{ debugName: "idPrefix" }] : /* istanbul ignore next */ []);
1915
+ this.maxBodyLength = input(EMAIL_TEMPLATE_MAX_BODY, ...ngDevMode ? [{ debugName: "maxBodyLength" }] : /* istanbul ignore next */ []);
1916
+ this.maxTextLength = input(255, ...ngDevMode ? [{ debugName: "maxTextLength" }] : /* istanbul ignore next */ []);
1917
+ this.fullAccess = input(true, ...ngDevMode ? [{ debugName: "fullAccess" }] : /* istanbul ignore next */ []);
1918
+ this.systemTemplate = input(false, ...ngDevMode ? [{ debugName: "systemTemplate" }] : /* istanbul ignore next */ []);
1919
+ this.testSendEnabled = input(true, ...ngDevMode ? [{ debugName: "testSendEnabled" }] : /* istanbul ignore next */ []);
1920
+ this.saving = input(false, ...ngDevMode ? [{ debugName: "saving" }] : /* istanbul ignore next */ []);
1921
+ this.testSending = input(false, ...ngDevMode ? [{ debugName: "testSending" }] : /* istanbul ignore next */ []);
1922
+ this.videos = input(null, ...ngDevMode ? [{ debugName: "videos" }] : /* istanbul ignore next */ []);
1923
+ this.hideVideos = input(false, ...ngDevMode ? [{ debugName: "hideVideos" }] : /* istanbul ignore next */ []);
1924
+ this.videosEnabled = computed(() => this.videos() !== null && !this.hideVideos(), ...ngDevMode ? [{ debugName: "videosEnabled" }] : /* istanbul ignore next */ []);
1925
+ this.videoList = computed(() => this.videos() ?? [], ...ngDevMode ? [{ debugName: "videoList" }] : /* istanbul ignore next */ []);
1926
+ this.videosLoading = input(false, ...ngDevMode ? [{ debugName: "videosLoading" }] : /* istanbul ignore next */ []);
1927
+ this.videoDefaults = input(EMPTY_VIDEO_DEFAULTS, ...ngDevMode ? [{ debugName: "videoDefaults" }] : /* istanbul ignore next */ []);
1928
+ this.videoLink = input(DEFAULT_VIDEO_LINK, ...ngDevMode ? [{ debugName: "videoLink" }] : /* istanbul ignore next */ []);
1929
+ this.noVideosHintInput = input(null, {
1930
+ ...ngDevMode ? { debugName: "noVideosHintInput" } : /* istanbul ignore next */ {},
1931
+ alias: "noVideosHint"
1932
+ });
1933
+ this.noVideosHint = computed(() => this.noVideosHintInput() ?? this.labels.t("emailTemplateEditor.noVideosHint"), ...ngDevMode ? [{ debugName: "noVideosHint" }] : /* istanbul ignore next */ []);
1934
+ this.save = output();
1935
+ this.testSend = output();
1936
+ this.videosRequested = output();
1937
+ this.useAsMine = output();
1938
+ this.editingId = signal(null, ...ngDevMode ? [{ debugName: "editingId" }] : /* istanbul ignore next */ []);
1939
+ this.isNew = computed(() => !this.editingId(), ...ngDevMode ? [{ debugName: "isNew" }] : /* istanbul ignore next */ []);
1940
+ this.name = signal("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
1941
+ this.subject = signal("", ...ngDevMode ? [{ debugName: "subject" }] : /* istanbul ignore next */ []);
1942
+ this.category = signal("", ...ngDevMode ? [{ debugName: "category" }] : /* istanbul ignore next */ []);
1943
+ this.useAllYear = signal(true, ...ngDevMode ? [{ debugName: "useAllYear" }] : /* istanbul ignore next */ []);
1944
+ this.activeFrom = signal("", ...ngDevMode ? [{ debugName: "activeFrom" }] : /* istanbul ignore next */ []);
1945
+ this.activeTo = signal("", ...ngDevMode ? [{ debugName: "activeTo" }] : /* istanbul ignore next */ []);
1946
+ this.videoId = signal(null, ...ngDevMode ? [{ debugName: "videoId" }] : /* istanbul ignore next */ []);
1947
+ this.videoTitle = signal(null, ...ngDevMode ? [{ debugName: "videoTitle" }] : /* istanbul ignore next */ []);
1948
+ this.assignedKeys = signal([], ...ngDevMode ? [{ debugName: "assignedKeys" }] : /* istanbul ignore next */ []);
1949
+ this.assignmentState = computed(() => this.assignmentOptions().map((o) => ({
1950
+ ...o,
1951
+ assigned: this.assignedKeys().includes(o.key)
1952
+ })), ...ngDevMode ? [{ debugName: "assignmentState" }] : /* istanbul ignore next */ []);
1953
+ this.blocks = signal([], ...ngDevMode ? [{ debugName: "blocks" }] : /* istanbul ignore next */ []);
1954
+ this.selectedBlockId = signal(null, ...ngDevMode ? [{ debugName: "selectedBlockId" }] : /* istanbul ignore next */ []);
1955
+ this.initializedBlockIds = /* @__PURE__ */ new Set();
1956
+ this.savedRange = null;
1957
+ this.blockEditors = viewChildren("blockEditor", ...ngDevMode ? [{ debugName: "blockEditors" }] : /* istanbul ignore next */ []);
1958
+ this.colorInputRef = viewChild("colorInput", ...ngDevMode ? [{ debugName: "colorInputRef" }] : /* istanbul ignore next */ []);
1959
+ this.loadedBody = signal(null, ...ngDevMode ? [{ debugName: "loadedBody" }] : /* istanbul ignore next */ []);
1960
+ this.bodyEdited = signal(false, ...ngDevMode ? [{ debugName: "bodyEdited" }] : /* istanbul ignore next */ []);
1961
+ this.savedSnapshot = signal(null, ...ngDevMode ? [{ debugName: "savedSnapshot" }] : /* istanbul ignore next */ []);
1962
+ this.dragFromPalette = null;
1963
+ this.dragFromCanvas = signal(null, ...ngDevMode ? [{ debugName: "dragFromCanvas" }] : /* istanbul ignore next */ []);
1964
+ this.dragOverIndex = signal(null, ...ngDevMode ? [{ debugName: "dragOverIndex" }] : /* istanbul ignore next */ []);
1965
+ this.currentColor = signal("#1e293b", ...ngDevMode ? [{ debugName: "currentColor" }] : /* istanbul ignore next */ []);
1966
+ this.blockSpacing = signal("", ...ngDevMode ? [{ debugName: "blockSpacing" }] : /* istanbul ignore next */ []);
1967
+ this.headingKey = signal(0, ...ngDevMode ? [{ debugName: "headingKey" }] : /* istanbul ignore next */ []);
1968
+ this.sizeKey = signal(0, ...ngDevMode ? [{ debugName: "sizeKey" }] : /* istanbul ignore next */ []);
1969
+ this._headingOptions = computed(() => [
1970
+ {
1971
+ value: "p",
1972
+ label: this.labels.t("emailTemplateEditor.heading.normal")
1973
+ },
1974
+ {
1975
+ value: "h1",
1976
+ label: this.labels.t("emailTemplateEditor.heading.h1")
1977
+ },
1978
+ {
1979
+ value: "h2",
1980
+ label: this.labels.t("emailTemplateEditor.heading.h2")
1981
+ },
1982
+ {
1983
+ value: "h3",
1984
+ label: this.labels.t("emailTemplateEditor.heading.h3")
1985
+ }
1986
+ ], ...ngDevMode ? [{ debugName: "_headingOptions" }] : /* istanbul ignore next */ []);
1987
+ this.fontSizeOptions = FONT_SIZE_OPTIONS;
1988
+ this._spacingTabs = computed(() => [
1989
+ {
1990
+ key: "none",
1991
+ label: this.labels.t("emailTemplateEditor.spacing.none")
1992
+ },
1993
+ {
1994
+ key: "8px",
1995
+ label: this.labels.t("emailTemplateEditor.spacing.small")
1996
+ },
1997
+ {
1998
+ key: "16px",
1999
+ label: this.labels.t("emailTemplateEditor.spacing.medium")
2000
+ },
2001
+ {
2002
+ key: "32px",
2003
+ label: this.labels.t("emailTemplateEditor.spacing.large")
2004
+ }
2005
+ ], ...ngDevMode ? [{ debugName: "_spacingTabs" }] : /* istanbul ignore next */ []);
2006
+ this.startPlaceholder = computed(() => this.labels.t("emailTemplateEditor.startWriting"), ...ngDevMode ? [{ debugName: "startPlaceholder" }] : /* istanbul ignore next */ []);
2007
+ this._ctaTypeOptions = computed(() => [
2008
+ {
2009
+ value: "",
2010
+ label: this.labels.t("emailTemplateEditor.cta.none")
2011
+ },
2012
+ {
2013
+ value: "schedule",
2014
+ label: this.labels.t("emailTemplateEditor.cta.schedule")
2015
+ },
2016
+ {
2017
+ value: "contact",
2018
+ label: this.labels.t("emailTemplateEditor.cta.contact")
2019
+ },
2020
+ {
2021
+ value: "custom",
2022
+ label: this.labels.t("emailTemplateEditor.cta.custom")
2023
+ }
2024
+ ], ...ngDevMode ? [{ debugName: "_ctaTypeOptions" }] : /* istanbul ignore next */ []);
2025
+ this._playbackOptions = computed(() => [{
2026
+ value: "click",
2027
+ label: this.labels.t("emailTemplateEditor.playback.click")
2028
+ }, {
2029
+ value: "autoplay",
2030
+ label: this.labels.t("emailTemplateEditor.playback.autoplay")
2031
+ }], ...ngDevMode ? [{ debugName: "_playbackOptions" }] : /* istanbul ignore next */ []);
2032
+ this.showLinkDialog = signal(false, ...ngDevMode ? [{ debugName: "showLinkDialog" }] : /* istanbul ignore next */ []);
2033
+ this.linkUrl = signal("", ...ngDevMode ? [{ debugName: "linkUrl" }] : /* istanbul ignore next */ []);
2034
+ this.linkText = signal("", ...ngDevMode ? [{ debugName: "linkText" }] : /* istanbul ignore next */ []);
2035
+ this.linkTextFromSelection = signal(false, ...ngDevMode ? [{ debugName: "linkTextFromSelection" }] : /* istanbul ignore next */ []);
2036
+ this.showImageDialog = signal(false, ...ngDevMode ? [{ debugName: "showImageDialog" }] : /* istanbul ignore next */ []);
2037
+ this.imageUrl = signal("", ...ngDevMode ? [{ debugName: "imageUrl" }] : /* istanbul ignore next */ []);
2038
+ this.imageAlt = signal("", ...ngDevMode ? [{ debugName: "imageAlt" }] : /* istanbul ignore next */ []);
2039
+ this.showTestSendDialog = signal(false, ...ngDevMode ? [{ debugName: "showTestSendDialog" }] : /* istanbul ignore next */ []);
2040
+ this.testSendEmail = signal("", ...ngDevMode ? [{ debugName: "testSendEmail" }] : /* istanbul ignore next */ []);
2041
+ this.activeEditorTab = signal("edit", ...ngDevMode ? [{ debugName: "activeEditorTab" }] : /* istanbul ignore next */ []);
2042
+ this.activeRightTab = signal("blocks", ...ngDevMode ? [{ debugName: "activeRightTab" }] : /* istanbul ignore next */ []);
2043
+ this.blockSearch = signal("", ...ngDevMode ? [{ debugName: "blockSearch" }] : /* istanbul ignore next */ []);
2044
+ this.assignmentSearch = signal("", ...ngDevMode ? [{ debugName: "assignmentSearch" }] : /* istanbul ignore next */ []);
2045
+ this.toggledGroups = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "toggledGroups" }] : /* istanbul ignore next */ []);
2046
+ this.videoAutoplay = signal(false, ...ngDevMode ? [{ debugName: "videoAutoplay" }] : /* istanbul ignore next */ []);
2047
+ this.videoCaption = signal("", ...ngDevMode ? [{ debugName: "videoCaption" }] : /* istanbul ignore next */ []);
2048
+ this.videoCtaType = signal("", ...ngDevMode ? [{ debugName: "videoCtaType" }] : /* istanbul ignore next */ []);
2049
+ this.videoCtaUrl = signal("", ...ngDevMode ? [{ debugName: "videoCtaUrl" }] : /* istanbul ignore next */ []);
2050
+ this.videoCtaLabel = signal("", ...ngDevMode ? [{ debugName: "videoCtaLabel" }] : /* istanbul ignore next */ []);
2051
+ this.videoHideReactions = signal(false, ...ngDevMode ? [{ debugName: "videoHideReactions" }] : /* istanbul ignore next */ []);
2052
+ this.canWrite = computed(() => this.fullAccess() && !this.systemTemplate(), ...ngDevMode ? [{ debugName: "canWrite" }] : /* istanbul ignore next */ []);
2053
+ this.canCopySystem = computed(() => this.fullAccess() && this.systemTemplate() && !!this.editingId(), ...ngDevMode ? [{ debugName: "canCopySystem" }] : /* istanbul ignore next */ []);
2054
+ this.filteredAssignments = computed(() => {
2055
+ const featured = this.featuredAssignmentKey();
2056
+ const all = this.assignmentState();
2057
+ const ordered = featured ? [...all.filter((a) => a.key === featured), ...all.filter((a) => a.key !== featured)] : all;
2058
+ const q = this.assignmentSearch().trim().toLowerCase();
2059
+ return q ? ordered.filter((a) => a.name.toLowerCase().includes(q) || a.description.toLowerCase().includes(q)) : ordered;
2060
+ }, ...ngDevMode ? [{ debugName: "filteredAssignments" }] : /* istanbul ignore next */ []);
2061
+ this.filteredBlockGroups = computed(() => {
2062
+ const q = this.blockSearch().trim().toLowerCase();
2063
+ const groups = this.blockGroups();
2064
+ if (!q) return groups;
2065
+ return groups.map((g) => ({
2066
+ ...g,
2067
+ blocks: g.blocks.filter((b) => b.label.toLowerCase().includes(q))
2068
+ })).filter((g) => g.blocks.length > 0);
2069
+ }, ...ngDevMode ? [{ debugName: "filteredBlockGroups" }] : /* istanbul ignore next */ []);
2070
+ this.serialized = computed(() => this.serialize(this.blocks()), ...ngDevMode ? [{ debugName: "serialized" }] : /* istanbul ignore next */ []);
2071
+ this.previewHtml = this.serialized;
2072
+ this.sanitizer = inject(DomSanitizer);
2073
+ this.previewDoc = computed(() => this.sanitizer.bypassSecurityTrustHtml(buildPreviewDocument(this.serialized())), ...ngDevMode ? [{ debugName: "previewDoc" }] : /* istanbul ignore next */ []);
2074
+ this.bodyLength = computed(() => this.serialized().trim().length, ...ngDevMode ? [{ debugName: "bodyLength" }] : /* istanbul ignore next */ []);
2075
+ this.bodyHasContent = computed(() => this.blocks().some((b) => blockHasContent(b.html)), ...ngDevMode ? [{ debugName: "bodyHasContent" }] : /* istanbul ignore next */ []);
2076
+ this.bodyUnchanged = computed(() => this.loadedBody() !== null && !this.bodyEdited(), ...ngDevMode ? [{ debugName: "bodyUnchanged" }] : /* istanbul ignore next */ []);
2077
+ this.nameError = computed(() => {
2078
+ const v = this.name().trim();
2079
+ if (!v) return this.labels.t("emailTemplateEditor.nameRequired");
2080
+ return v.length > this.maxTextLength() ? this.labels.t("emailTemplateEditor.nameTooLong", { max: this.maxTextLength() }) : "";
2081
+ }, ...ngDevMode ? [{ debugName: "nameError" }] : /* istanbul ignore next */ []);
2082
+ this.subjectError = computed(() => {
2083
+ const v = this.subject().trim();
2084
+ if (!v) return this.labels.t("emailTemplateEditor.subjectRequired");
2085
+ return v.length > this.maxTextLength() ? this.labels.t("emailTemplateEditor.subjectTooLong", { max: this.maxTextLength() }) : "";
2086
+ }, ...ngDevMode ? [{ debugName: "subjectError" }] : /* istanbul ignore next */ []);
2087
+ this.bodyError = computed(() => {
2088
+ if (!this.bodyHasContent()) return this.labels.t("emailTemplateEditor.bodyRequired");
2089
+ const n = this.bodyLength();
2090
+ const max = this.maxBodyLength();
2091
+ return n > max && !this.bodyUnchanged() ? this.labels.t("emailTemplateEditor.bodyTooLong", {
2092
+ max: this.labels.formatNumber(max),
2093
+ actual: this.labels.formatNumber(n)
2094
+ }) : "";
2095
+ }, ...ngDevMode ? [{ debugName: "bodyError" }] : /* istanbul ignore next */ []);
2096
+ this.datesError = computed(() => {
2097
+ if (this.useAllYear() || !this.activeFrom() || !this.activeTo()) return "";
2098
+ return this.activeTo() < this.activeFrom() ? this.labels.t("emailTemplateEditor.datesOrder") : "";
2099
+ }, ...ngDevMode ? [{ debugName: "datesError" }] : /* istanbul ignore next */ []);
2100
+ this.submitAttempted = signal(false, ...ngDevMode ? [{ debugName: "submitAttempted" }] : /* istanbul ignore next */ []);
2101
+ this.nameTouched = signal(false, ...ngDevMode ? [{ debugName: "nameTouched" }] : /* istanbul ignore next */ []);
2102
+ this.subjectTouched = signal(false, ...ngDevMode ? [{ debugName: "subjectTouched" }] : /* istanbul ignore next */ []);
2103
+ this.nameErrorShown = computed(() => this.nameTouched() ? this.nameError() : "", ...ngDevMode ? [{ debugName: "nameErrorShown" }] : /* istanbul ignore next */ []);
2104
+ this.subjectErrorShown = computed(() => this.subjectTouched() ? this.subjectError() : "", ...ngDevMode ? [{ debugName: "subjectErrorShown" }] : /* istanbul ignore next */ []);
2105
+ this.bodyBlurred = signal(false, ...ngDevMode ? [{ debugName: "bodyBlurred" }] : /* istanbul ignore next */ []);
2106
+ this.bodyErrorShown = computed(() => this.bodyEdited() || this.bodyBlurred() ? this.bodyError() : "", ...ngDevMode ? [{ debugName: "bodyErrorShown" }] : /* istanbul ignore next */ []);
2107
+ this.assignmentError = computed(() => this.assignmentOptions().length > 0 && !this.assignmentState().some((a) => a.assigned) ? this.labels.t("emailTemplateEditor.assignmentRequired") : "", ...ngDevMode ? [{ debugName: "assignmentError" }] : /* istanbul ignore next */ []);
2108
+ this.assignmentsTouched = signal(false, ...ngDevMode ? [{ debugName: "assignmentsTouched" }] : /* istanbul ignore next */ []);
2109
+ this.assignmentErrorShown = computed(() => this.assignmentsTouched() ? this.assignmentError() : "", ...ngDevMode ? [{ debugName: "assignmentErrorShown" }] : /* istanbul ignore next */ []);
2110
+ this.canSave = computed(() => !this.nameError() && !this.subjectError() && !this.bodyError() && !this.datesError() && !this.assignmentError(), ...ngDevMode ? [{ debugName: "canSave" }] : /* istanbul ignore next */ []);
2111
+ this.saveDisabled = computed(() => !this.canWrite() || !this.canSave(), ...ngDevMode ? [{ debugName: "saveDisabled" }] : /* istanbul ignore next */ []);
2112
+ this.saveHint = computed(() => {
2113
+ if (!this.canWrite() || this.canSave()) return "";
2114
+ const missing = [];
2115
+ if (this.nameError()) missing.push(this.name().trim() ? this.labels.t("emailTemplateEditor.missing.shorterName") : this.labels.t("emailTemplateEditor.missing.name"));
2116
+ if (this.subjectError()) missing.push(this.subject().trim() ? this.labels.t("emailTemplateEditor.missing.shorterSubject") : this.labels.t("emailTemplateEditor.missing.subject"));
2117
+ if (this.bodyError()) missing.push(this.bodyHasContent() ? this.labels.t("emailTemplateEditor.missing.shorterMessage") : this.labels.t("emailTemplateEditor.missing.message"));
2118
+ if (this.assignmentError()) missing.push(this.labels.t("emailTemplateEditor.missing.assignment"));
2119
+ return missing.length ? this.labels.t("emailTemplateEditor.saveHint", { items: missing.join(", ") }) : this.datesError();
2120
+ }, ...ngDevMode ? [{ debugName: "saveHint" }] : /* istanbul ignore next */ []);
2121
+ this.datesTouched = signal(false, ...ngDevMode ? [{ debugName: "datesTouched" }] : /* istanbul ignore next */ []);
2122
+ this.saveHintVisible = computed(() => {
2123
+ const hint = this.saveHint();
2124
+ return hint && hint === this.datesError() && !this.datesTouched() ? "" : hint;
2125
+ }, ...ngDevMode ? [{ debugName: "saveHintVisible" }] : /* istanbul ignore next */ []);
2126
+ this.normalizedLink = computed(() => {
2127
+ const url = this.linkUrl().trim();
2128
+ if (!url) return "";
2129
+ return url.startsWith("http://") || url.startsWith("https://") || url.startsWith("mailto:") ? url : "https://" + url;
2130
+ }, ...ngDevMode ? [{ debugName: "normalizedLink" }] : /* istanbul ignore next */ []);
2131
+ this.linkUrlError = computed(() => {
2132
+ const url = this.normalizedLink();
2133
+ if (!url) return "";
2134
+ if (url.startsWith("mailto:")) return /^mailto:[^\s@"<>]+@[^\s@"<>]+\.[^\s@"<>]+$/.test(url) ? "" : this.labels.t("emailTemplateEditor.validEmail");
2135
+ return isWebUrl(url) ? "" : this.labels.t("emailTemplateEditor.validWebAddress");
2136
+ }, ...ngDevMode ? [{ debugName: "linkUrlError" }] : /* istanbul ignore next */ []);
2137
+ this.canInsertLink = computed(() => !!this.linkUrl().trim() && !this.linkUrlError(), ...ngDevMode ? [{ debugName: "canInsertLink" }] : /* istanbul ignore next */ []);
2138
+ this.imageUrlError = computed(() => {
2139
+ const url = this.imageUrl().trim();
2140
+ return !url || isWebUrl(url) ? "" : this.labels.t("emailTemplateEditor.validImageAddress");
2141
+ }, ...ngDevMode ? [{ debugName: "imageUrlError" }] : /* istanbul ignore next */ []);
2142
+ this.canInsertImage = computed(() => !!this.imageUrl().trim() && !this.imageUrlError(), ...ngDevMode ? [{ debugName: "canInsertImage" }] : /* istanbul ignore next */ []);
2143
+ this.testEmailError = computed(() => {
2144
+ const email = this.testSendEmail().trim();
2145
+ return !email || isValidEmailAddress(email) ? "" : this.labels.t("emailTemplateEditor.validEmail");
2146
+ }, ...ngDevMode ? [{ debugName: "testEmailError" }] : /* istanbul ignore next */ []);
2147
+ this.canSendTest = computed(() => this.canWrite() && !!this.editingId() && !!this.testSendEmail().trim() && !this.testEmailError() && !this.testSending(), ...ngDevMode ? [{ debugName: "canSendTest" }] : /* istanbul ignore next */ []);
2148
+ this.hasUnsavedChanges = computed(() => !!this.editingId() && this.savedSnapshot() !== null && this.savedSnapshot() !== this.snapshot(), ...ngDevMode ? [{ debugName: "hasUnsavedChanges" }] : /* istanbul ignore next */ []);
2149
+ effect(() => {
2150
+ const t = this.template();
2151
+ untracked(() => this.applyTemplate(t));
2152
+ });
2153
+ effect(() => {
2154
+ const d = this.videoDefaults();
2155
+ untracked(() => {
2156
+ this.videoAutoplay.set(d.autoplay);
2157
+ this.videoCaption.set(d.caption);
2158
+ this.videoCtaType.set(d.ctaType);
2159
+ this.videoCtaUrl.set(d.ctaUrl);
2160
+ this.videoCtaLabel.set(d.ctaLabel);
2161
+ this.videoHideReactions.set(d.hideReactions);
2162
+ });
2163
+ });
2164
+ effect(() => {
2165
+ if (!this.videosEnabled() && this.activeRightTab() === "video") untracked(() => this.activeRightTab.set("blocks"));
2166
+ });
2167
+ effect(() => {
2168
+ if (this.showLinkDialog() || this.showImageDialog()) afterNextRender(() => this.host.nativeElement.querySelector(".link-dialog input")?.focus(), { injector: this.injector });
2169
+ });
2170
+ afterEveryRender(() => {
2171
+ const current = this.blocks();
2172
+ for (const ref of this.blockEditors()) {
2173
+ const el = ref.nativeElement;
2174
+ const blockId = el.dataset["blockId"];
2175
+ if (blockId && !this.initializedBlockIds.has(blockId)) {
2176
+ const block = current.find((b) => b.id === blockId);
2177
+ if (block !== void 0) {
2178
+ el.innerHTML = block.html;
2179
+ setEditorSpacing(el, block.spacing);
2180
+ this.initializedBlockIds.add(blockId);
2181
+ }
2182
+ }
2183
+ }
2184
+ });
2185
+ }
2186
+ markSaved(id = this.editingId()) {
2187
+ this.syncActiveBlockHtml();
2188
+ this.editingId.set(id);
2189
+ this.savedSnapshot.set(this.snapshot());
2190
+ }
2191
+ closeTestSend() {
2192
+ this.showTestSendDialog.set(false);
2193
+ }
2194
+ applyTemplate(t) {
2195
+ this.initializedBlockIds = /* @__PURE__ */ new Set();
2196
+ this.editingId.set(t?.id ?? null);
2197
+ this.name.set(t?.name ?? "");
2198
+ this.subject.set(t?.subject ?? "");
2199
+ this.category.set(t?.category ?? "");
2200
+ this.useAllYear.set(t?.useAllYear ?? true);
2201
+ this.activeFrom.set(t?.activeFrom ?? "");
2202
+ this.activeTo.set(t?.activeTo ?? "");
2203
+ this.videoId.set(t?.videoId ?? null);
2204
+ this.videoTitle.set(t?.videoTitle ?? null);
2205
+ this.blocks.set(!t || !t.id && !(t.body ?? "").trim() ? [{
2206
+ id: this.genId(),
2207
+ html: ""
2208
+ }] : this.htmlToBlocks(t.body ?? ""));
2209
+ this.selectedBlockId.set(this.blocks()[0]?.id ?? null);
2210
+ this.blockSpacing.set(this.blocks()[0]?.spacing ?? "");
2211
+ this.loadedBody.set(t?.id ? t.body ?? "" : null);
2212
+ this.bodyEdited.set(false);
2213
+ this.bodyBlurred.set(false);
2214
+ this.datesTouched.set(false);
2215
+ this.submitAttempted.set(false);
2216
+ this.nameTouched.set(false);
2217
+ this.subjectTouched.set(false);
2218
+ this.assignedKeys.set([...t?.assignments ?? []]);
2219
+ this.assignmentsTouched.set(false);
2220
+ this.savedSnapshot.set(t?.id ? this.snapshot() : null);
2221
+ }
2222
+ onBodyFocusOut(event) {
2223
+ const next = event.relatedTarget;
2224
+ if (next && event.currentTarget.contains(next)) return;
2225
+ this.bodyBlurred.set(true);
2226
+ }
2227
+ onAssignmentsFocusOut(event) {
2228
+ const next = event.relatedTarget;
2229
+ if (next && event.currentTarget.contains(next)) return;
2230
+ this.assignmentsTouched.set(true);
2231
+ }
2232
+ onSave() {
2233
+ if (this.saving() || !this.canWrite()) return;
2234
+ if (!this.canSave()) {
2235
+ this.submitAttempted.set(true);
2236
+ return;
2237
+ }
2238
+ const keepStoredBody = this.bodyUnchanged() && this.bodyLength() > this.maxBodyLength();
2239
+ this.syncActiveBlockHtml();
2240
+ this.save.emit({
2241
+ name: this.name(),
2242
+ subject: this.subject(),
2243
+ body: keepStoredBody ? this.loadedBody() ?? "" : this.serialized(),
2244
+ category: this.category(),
2245
+ useAllYear: this.useAllYear(),
2246
+ activeFrom: !this.useAllYear() && this.activeFrom() ? this.activeFrom() : null,
2247
+ activeTo: !this.useAllYear() && this.activeTo() ? this.activeTo() : null,
2248
+ videoId: this.videoId(),
2249
+ assignments: this.assignmentState().filter((a) => a.assigned).map((a) => a.key)
2250
+ });
2251
+ }
2252
+ snapshot() {
2253
+ return JSON.stringify([
2254
+ this.name(),
2255
+ this.subject(),
2256
+ this.category(),
2257
+ this.useAllYear(),
2258
+ this.activeFrom(),
2259
+ this.activeTo(),
2260
+ this.serialized()
2261
+ ]);
2262
+ }
2263
+ serialize(blocks) {
2264
+ return blocks.map((b) => {
2265
+ return `<div data-block="true">${b.spacing ? `<div data-spacing="true" style="padding:${b.spacing} 0">${b.html}</div>` : b.html}</div>`;
2266
+ }).join("");
2267
+ }
2268
+ htmlToBlocks(html) {
2269
+ if (!html || !html.trim()) return [{
2270
+ id: this.genId(),
2271
+ html: "<p></p>"
2272
+ }];
2273
+ const div = new DOMParser().parseFromString(html, "text/html").body;
2274
+ const blockDivs = Array.from(div.querySelectorAll(":scope > [data-block]"));
2275
+ if (blockDivs.length > 0) return blockDivs.map((el) => {
2276
+ const spacingEl = el.querySelector(":scope > [data-spacing]");
2277
+ if (spacingEl) {
2278
+ const spacing = spacingEl.style.padding?.split(" ")[0] || void 0;
2279
+ return {
2280
+ id: this.genId(),
2281
+ html: spacingEl.innerHTML,
2282
+ spacing
2283
+ };
2284
+ }
2285
+ return {
2286
+ id: this.genId(),
2287
+ html: el.innerHTML
2288
+ };
2289
+ });
2290
+ return [{
2291
+ id: this.genId(),
2292
+ html
2293
+ }];
2294
+ }
2295
+ genId() {
2296
+ return Math.random().toString(36).slice(2, 10);
2297
+ }
2298
+ editorFor(id) {
2299
+ return id ? this.blockEditors().find((r) => r.nativeElement.dataset["blockId"] === id) : void 0;
2300
+ }
2301
+ syncActiveBlockHtml() {
2302
+ const dom = /* @__PURE__ */ new Map();
2303
+ for (const ref of this.blockEditors()) {
2304
+ const id = ref.nativeElement.dataset["blockId"];
2305
+ if (id) dom.set(id, ref.nativeElement.innerHTML);
2306
+ }
2307
+ if (dom.size === 0) return;
2308
+ this.blocks.update((list) => list.map((b) => dom.has(b.id) && dom.get(b.id) !== b.html ? {
2309
+ ...b,
2310
+ html: dom.get(b.id)
2311
+ } : b));
2312
+ }
2313
+ syncBlock() {
2314
+ const id = this.selectedBlockId();
2315
+ const ref = this.editorFor(id);
2316
+ if (!id || !ref) return;
2317
+ const html = ref.nativeElement.innerHTML;
2318
+ this.blocks.update((list) => list.map((b) => b.id === id ? {
2319
+ ...b,
2320
+ html
2321
+ } : b));
2322
+ }
2323
+ setEditorTab(tab) {
2324
+ const previous = this.activeEditorTab();
2325
+ if (tab !== "edit") this.syncActiveBlockHtml();
2326
+ if (tab === "edit" && previous !== "edit") this.initializedBlockIds = /* @__PURE__ */ new Set();
2327
+ this.activeEditorTab.set(tab);
2328
+ }
2329
+ addBlock(blockKey = "text-block") {
2330
+ if (!this.canWrite()) return;
2331
+ this.addBlockHtml(this.blockHtml(blockKey));
2332
+ }
2333
+ addBlockHtml(html, at) {
2334
+ this.bodyEdited.set(true);
2335
+ const block = {
2336
+ id: this.genId(),
2337
+ html
2338
+ };
2339
+ this.blocks.update((list) => at === void 0 ? [...list, block] : [
2340
+ ...list.slice(0, at),
2341
+ block,
2342
+ ...list.slice(at)
2343
+ ]);
2344
+ this.selectedBlockId.set(block.id);
2345
+ return block;
2346
+ }
2347
+ deleteBlock(index) {
2348
+ if (!this.canWrite()) return;
2349
+ const list = this.blocks();
2350
+ if (index < 0 || index >= list.length) return;
2351
+ if (list.length === 1) return;
2352
+ this.bodyEdited.set(true);
2353
+ this.initializedBlockIds.delete(list[index].id);
2354
+ const next = list.filter((_, i) => i !== index);
2355
+ this.blocks.set(next);
2356
+ this.selectedBlockId.set(next[Math.min(index, next.length - 1)].id);
2357
+ }
2358
+ duplicateBlock(index) {
2359
+ if (!this.canWrite()) return;
2360
+ const list = this.blocks();
2361
+ if (index < 0 || index >= list.length) return;
2362
+ this.bodyEdited.set(true);
2363
+ const src = list[index];
2364
+ const html = this.editorFor(src.id)?.nativeElement.innerHTML ?? src.html;
2365
+ const copy = {
2366
+ id: this.genId(),
2367
+ html,
2368
+ spacing: src.spacing
2369
+ };
2370
+ this.blocks.set([
2371
+ ...list.slice(0, index + 1),
2372
+ copy,
2373
+ ...list.slice(index + 1)
2374
+ ]);
2375
+ this.selectedBlockId.set(copy.id);
2376
+ }
2377
+ moveBlock(index, direction) {
2378
+ if (!this.canWrite()) return;
2379
+ const list = this.blocks();
2380
+ const target = index + direction;
2381
+ if (index < 0 || index >= list.length || target < 0 || target >= list.length) return;
2382
+ this.bodyEdited.set(true);
2383
+ const next = [...list];
2384
+ [next[index], next[target]] = [next[target], next[index]];
2385
+ this.blocks.set(next);
2386
+ }
2387
+ onBlockInput(event, block) {
2388
+ if (!this.canWrite()) return;
2389
+ this.bodyEdited.set(true);
2390
+ const html = event.target.innerHTML;
2391
+ this.blocks.update((list) => list.map((b) => b.id === block.id ? {
2392
+ ...b,
2393
+ html
2394
+ } : b));
2395
+ }
2396
+ onBlockBeforeInput(event) {
2397
+ if (!this.canWrite()) {
2398
+ event.preventDefault();
2399
+ return;
2400
+ }
2401
+ if (event.inputType.startsWith("delete") || event.inputType.startsWith("history")) return;
2402
+ if (isBlockDrag(event)) {
2403
+ event.preventDefault();
2404
+ return;
2405
+ }
2406
+ const incoming = event.data ?? event.dataTransfer?.getData("text/plain") ?? "";
2407
+ if (!incoming) return;
2408
+ const sel = window.getSelection();
2409
+ const replaced = sel && !sel.isCollapsed && insideEditorBlock(sel.anchorNode) ? serializedTextLength(sel.toString()) : 0;
2410
+ if (this.bodyLength() - replaced + serializedTextLength(incoming) > this.maxBodyLength()) event.preventDefault();
2411
+ }
2412
+ onBlockFocus(block) {
2413
+ this.selectedBlockId.set(block.id);
2414
+ this.blockSpacing.set(block.spacing ?? "");
2415
+ }
2416
+ onPaletteDragStart(event, block) {
2417
+ if (!this.canWrite()) {
2418
+ event.preventDefault();
2419
+ return;
2420
+ }
2421
+ this.dragFromPalette = block;
2422
+ this.dragFromCanvas.set(null);
2423
+ event.dataTransfer.effectAllowed = "copy";
2424
+ event.dataTransfer.setData(EMAIL_BLOCK_DRAG_TYPE, block.key);
2425
+ }
2426
+ onBlockDragStart(event, index, wrapper) {
2427
+ if (!this.canWrite()) {
2428
+ event.preventDefault();
2429
+ return;
2430
+ }
2431
+ if (event.target !== event.currentTarget) return;
2432
+ this.dragFromCanvas.set(index);
2433
+ this.dragFromPalette = null;
2434
+ event.dataTransfer.effectAllowed = "move";
2435
+ event.dataTransfer.setData(EMAIL_BLOCK_DRAG_TYPE, String(index));
2436
+ if (wrapper) event.dataTransfer.setDragImage?.(wrapper, 0, 0);
2437
+ event.stopPropagation();
2438
+ }
2439
+ onBlockDragEnd() {
2440
+ this.dragFromCanvas.set(null);
2441
+ this.dragFromPalette = null;
2442
+ this.dragOverIndex.set(null);
2443
+ }
2444
+ onCanvasDragOver(event) {
2445
+ if (this.canWrite() && isBlockDrag(event)) event.preventDefault();
2446
+ }
2447
+ onDropZoneDragOver(event, index) {
2448
+ if (!this.canWrite() || !isBlockDrag(event)) return;
2449
+ event.preventDefault();
2450
+ event.dataTransfer.dropEffect = this.dragFromPalette ? "copy" : "move";
2451
+ if (this.dragOverIndex() !== index) this.dragOverIndex.set(index);
2452
+ }
2453
+ onDropZoneLeave() {
2454
+ this.dragOverIndex.set(null);
2455
+ }
2456
+ onDropZoneDrop(event, insertBefore) {
2457
+ if (!this.canWrite()) {
2458
+ event.preventDefault();
2459
+ return;
2460
+ }
2461
+ const fromCanvas = this.dragFromCanvas();
2462
+ if (this.dragFromPalette === null && fromCanvas === null) return;
2463
+ event.preventDefault();
2464
+ this.dragOverIndex.set(null);
2465
+ if (this.dragFromPalette) {
2466
+ const html = this.dragFromPalette.html;
2467
+ this.dragFromPalette = null;
2468
+ this.addBlockHtml(html, insertBefore);
2469
+ } else if (fromCanvas !== null) {
2470
+ const to = fromCanvas < insertBefore ? insertBefore - 1 : insertBefore;
2471
+ if (fromCanvas !== to) {
2472
+ const next = [...this.blocks()];
2473
+ const [moved] = next.splice(fromCanvas, 1);
2474
+ next.splice(to, 0, moved);
2475
+ this.blocks.set(next);
2476
+ this.bodyEdited.set(true);
2477
+ }
2478
+ this.dragFromCanvas.set(null);
2479
+ }
2480
+ }
2481
+ preventFocusLoss(event) {
2482
+ if (event.target?.closest?.("select, input")) return;
2483
+ event.preventDefault();
2484
+ }
2485
+ saveSelection() {
2486
+ const sel = window.getSelection();
2487
+ const range = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
2488
+ this.savedRange = range && insideEditorBlock(range.commonAncestorContainer) ? range.cloneRange() : null;
2489
+ }
2490
+ restoreSelection() {
2491
+ const saved = this.savedRange;
2492
+ this.savedRange = null;
2493
+ const sel = window.getSelection();
2494
+ if (!!sel && sel.rangeCount > 0 && insideEditorBlock(sel.getRangeAt(0).commonAncestorContainer) || !saved || !saved.commonAncestorContainer.isConnected || !insideEditorBlock(saved.commonAncestorContainer)) return;
2495
+ sel?.removeAllRanges();
2496
+ sel?.addRange(saved);
2497
+ }
2498
+ activeBlockHtml() {
2499
+ return this.editorFor(this.selectedBlockId())?.nativeElement.innerHTML ?? null;
2500
+ }
2501
+ runEditCommand(run) {
2502
+ this.restoreSelection();
2503
+ const sel = window.getSelection();
2504
+ const overSelection = !!sel && sel.rangeCount > 0 && !sel.isCollapsed && insideEditorBlock(sel.getRangeAt(0).commonAncestorContainer);
2505
+ const before = this.activeBlockHtml();
2506
+ run();
2507
+ if (overSelection || before === null || before !== this.activeBlockHtml()) this.bodyEdited.set(true);
2508
+ }
2509
+ execCommand(cmd, value) {
2510
+ if (!this.canWrite()) return;
2511
+ this.runEditCommand(() => {
2512
+ document.execCommand(cmd, false, value ?? void 0);
2513
+ });
2514
+ this.syncBlock();
2515
+ }
2516
+ onHeading(value) {
2517
+ this.execCommand("formatBlock", value);
2518
+ this.headingKey.update((k) => k + 1);
2519
+ }
2520
+ onFontSize(value) {
2521
+ this.applyFontSize(value);
2522
+ this.sizeKey.update((k) => k + 1);
2523
+ }
2524
+ applyFontSize(size) {
2525
+ if (!this.canWrite() || !size) return;
2526
+ this.restoreSelection();
2527
+ const sel = window.getSelection();
2528
+ if (!sel || sel.rangeCount === 0) return;
2529
+ const range = sel.getRangeAt(0);
2530
+ if (range.collapsed || !insideEditorBlock(range.commonAncestorContainer)) return;
2531
+ this.bodyEdited.set(true);
2532
+ try {
2533
+ const fragment = range.extractContents();
2534
+ const span = document.createElement("span");
2535
+ span.style.fontSize = size;
2536
+ span.appendChild(fragment);
2537
+ range.insertNode(span);
2538
+ sel.collapse(span, 1);
2539
+ } catch {
2540
+ document.execCommand("insertHTML", false, `<span style="font-size:${escapeHtml(size)}">${escapeHtml(sel.toString())}</span>`);
2541
+ }
2542
+ this.syncBlock();
2543
+ }
2544
+ applyTextColor(color) {
2545
+ if (!this.canWrite()) return;
2546
+ this.currentColor.set(color);
2547
+ this.runEditCommand(() => {
2548
+ document.execCommand("styleWithCSS", false, "true");
2549
+ document.execCommand("foreColor", false, color);
2550
+ });
2551
+ this.syncBlock();
2552
+ }
2553
+ openColorPicker() {
2554
+ this.saveSelection();
2555
+ this.colorInputRef()?.nativeElement.click();
2556
+ }
2557
+ applySpacing(value) {
2558
+ if (!this.canWrite()) return;
2559
+ this.blockSpacing.set(value);
2560
+ const id = this.selectedBlockId();
2561
+ if (!id) return;
2562
+ const ref = this.editorFor(id);
2563
+ if (ref) setEditorSpacing(ref.nativeElement, value);
2564
+ const block = this.blocks().find((b) => b.id === id);
2565
+ if (!block) return;
2566
+ const changed = (block.spacing ?? "") !== (value ?? "");
2567
+ this.blocks.update((list) => list.map((b) => b.id === id ? {
2568
+ ...b,
2569
+ spacing: value || void 0
2570
+ } : b));
2571
+ if (changed) this.bodyEdited.set(true);
2572
+ }
2573
+ openLinkDialog() {
2574
+ if (!this.canWrite()) return;
2575
+ this.saveSelection();
2576
+ const selected = window.getSelection()?.toString() || "";
2577
+ this.linkText.set(selected);
2578
+ this.linkTextFromSelection.set(!!selected);
2579
+ this.linkUrl.set("");
2580
+ this.showLinkDialog.set(true);
2581
+ }
2582
+ insertLink() {
2583
+ if (!this.canWrite() || !this.canInsertLink()) return;
2584
+ this.bodyEdited.set(true);
2585
+ const url = this.normalizedLink();
2586
+ this.restoreSelection();
2587
+ const sel = window.getSelection();
2588
+ if (sel && sel.rangeCount > 0 && !sel.isCollapsed) {
2589
+ document.execCommand("createLink", false, url);
2590
+ const node = sel.getRangeAt(0).commonAncestorContainer;
2591
+ (this.editorFor(this.selectedBlockId())?.nativeElement ?? (node instanceof Element ? node : node.parentElement)?.closest(".block-content") ?? null)?.querySelectorAll("a").forEach((l) => {
2592
+ if (l.getAttribute("href") === url) l.setAttribute("target", "_blank");
2593
+ });
2594
+ } else {
2595
+ const a = document.createElement("a");
2596
+ a.setAttribute("href", url);
2597
+ a.setAttribute("target", "_blank");
2598
+ a.textContent = this.linkText().trim() || url;
2599
+ document.execCommand("insertHTML", false, a.outerHTML);
2600
+ }
2601
+ this.syncBlock();
2602
+ this.showLinkDialog.set(false);
2603
+ this.linkUrl.set("");
2604
+ this.linkText.set("");
2605
+ }
2606
+ openImageDialog() {
2607
+ if (!this.canWrite()) return;
2608
+ this.saveSelection();
2609
+ this.imageUrl.set("");
2610
+ this.imageAlt.set("");
2611
+ this.showImageDialog.set(true);
2612
+ }
2613
+ insertImageFromUrl() {
2614
+ if (!this.canWrite() || !this.canInsertImage()) return;
2615
+ this.bodyEdited.set(true);
2616
+ this.restoreSelection();
2617
+ const img = document.createElement("img");
2618
+ img.setAttribute("src", this.imageUrl().trim());
2619
+ img.setAttribute("alt", this.imageAlt() || this.labels.t("emailTemplateEditor.imageAltDefault"));
2620
+ img.setAttribute("style", "max-width:100%;border-radius:8px;display:block;margin:8px 0");
2621
+ document.execCommand("insertHTML", false, img.outerHTML);
2622
+ this.syncBlock();
2623
+ this.showImageDialog.set(false);
2624
+ this.imageUrl.set("");
2625
+ this.imageAlt.set("");
2626
+ }
2627
+ openTestSendDialog() {
2628
+ if (!this.canWrite()) return;
2629
+ this.testSendEmail.set("");
2630
+ this.showTestSendDialog.set(true);
2631
+ }
2632
+ onTestSend() {
2633
+ if (!this.canSendTest()) return;
2634
+ this.testSend.emit(this.testSendEmail().trim());
2635
+ }
2636
+ openVideoTab() {
2637
+ this.activeRightTab.set("video");
2638
+ this.videosRequested.emit();
2639
+ }
2640
+ insertVideo(video) {
2641
+ if (!this.canWrite()) return;
2642
+ this.videoId.set(video.id);
2643
+ this.videoTitle.set(video.title);
2644
+ const link = this.videoLink()(video, {
2645
+ autoplay: this.videoAutoplay(),
2646
+ caption: this.videoCaption(),
2647
+ ctaType: this.videoCtaType(),
2648
+ ctaUrl: this.videoCtaUrl(),
2649
+ ctaLabel: this.videoCtaLabel(),
2650
+ hideReactions: this.videoHideReactions()
2651
+ });
2652
+ const caption = this.videoCaption() || (this.videoAutoplay() ? this.labels.t("emailTemplateEditor.videoWillAutoplay") : this.labels.t("emailTemplateEditor.clickToWatchVideo"));
2653
+ this.addBlockHtml(buildVideoBlockHtml(video, link, caption, window.location.origin));
2654
+ this.activeRightTab.set("blocks");
2655
+ }
2656
+ formatDuration(seconds) {
2657
+ return formatVideoDuration(seconds);
2658
+ }
2659
+ categoryLabel(cat) {
2660
+ return formatCategoryLabel(cat);
2661
+ }
2662
+ toggleAssignment(item) {
2663
+ if (!this.canWrite()) return;
2664
+ this.assignedKeys.update((keys) => keys.includes(item.key) ? keys.filter((k) => k !== item.key) : [...keys, item.key]);
2665
+ this.assignmentsTouched.set(true);
2666
+ }
2667
+ isOpen(id) {
2668
+ return id === "v:" + (this.variableGroups()[0]?.name ?? "") !== this.toggledGroups().has(id);
2669
+ }
2670
+ toggleGroup(id) {
2671
+ this.toggledGroups.update((s) => {
2672
+ const next = new Set(s);
2673
+ if (next.has(id)) next.delete(id);
2674
+ else next.add(id);
2675
+ return next;
2676
+ });
2677
+ }
2678
+ insertBlock(block) {
2679
+ if (!this.canWrite()) return;
2680
+ this.addBlockHtml(block.html);
2681
+ }
2682
+ insertVariable(variable) {
2683
+ if (!this.canWrite()) return;
2684
+ this.runEditCommand(() => {
2685
+ document.execCommand("insertText", false, `{{${variable.key}}}`);
2686
+ });
2687
+ this.syncBlock();
2688
+ }
2689
+ blockHtml(key) {
2690
+ for (const g of this.blockGroups()) {
2691
+ const found = g.blocks.find((b) => b.key === key);
2692
+ if (found) return found.html;
2693
+ }
2694
+ return `<p>${this.labels.t("emailTemplateEditor.blockFallback")}</p>`;
2695
+ }
2696
+ static {
2697
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2698
+ minVersion: "12.0.0",
2699
+ version: "22.2.2",
2700
+ ngImport: i0,
2701
+ type: EmailTemplateEditorComponent,
2702
+ deps: [],
2703
+ target: i0.ɵɵFactoryTarget.Component
2704
+ });
2705
+ }
2706
+ static {
2707
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
2708
+ minVersion: "17.0.0",
2709
+ version: "22.2.2",
2710
+ type: EmailTemplateEditorComponent,
2711
+ isStandalone: true,
2712
+ selector: "ui-email-template-editor",
2713
+ inputs: {
2714
+ template: {
2715
+ classPropertyName: "template",
2716
+ publicName: "template",
2717
+ isSignal: true,
2718
+ isRequired: false,
2719
+ transformFunction: null
2720
+ },
2721
+ categories: {
2722
+ classPropertyName: "categories",
2723
+ publicName: "categories",
2724
+ isSignal: true,
2725
+ isRequired: false,
2726
+ transformFunction: null
2727
+ },
2728
+ categoryPlaceholderInput: {
2729
+ classPropertyName: "categoryPlaceholderInput",
2730
+ publicName: "categoryPlaceholder",
2731
+ isSignal: true,
2732
+ isRequired: false,
2733
+ transformFunction: null
2734
+ },
2735
+ assignmentOptions: {
2736
+ classPropertyName: "assignmentOptions",
2737
+ publicName: "assignmentOptions",
2738
+ isSignal: true,
2739
+ isRequired: false,
2740
+ transformFunction: null
2741
+ },
2742
+ featuredAssignmentKey: {
2743
+ classPropertyName: "featuredAssignmentKey",
2744
+ publicName: "featuredAssignmentKey",
2745
+ isSignal: true,
2746
+ isRequired: false,
2747
+ transformFunction: null
2748
+ },
2749
+ assignmentsDescriptionInput: {
2750
+ classPropertyName: "assignmentsDescriptionInput",
2751
+ publicName: "assignmentsDescription",
2752
+ isSignal: true,
2753
+ isRequired: false,
2754
+ transformFunction: null
2755
+ },
2756
+ variableGroupsInput: {
2757
+ classPropertyName: "variableGroupsInput",
2758
+ publicName: "variableGroups",
2759
+ isSignal: true,
2760
+ isRequired: false,
2761
+ transformFunction: null
2762
+ },
2763
+ blockGroupsInput: {
2764
+ classPropertyName: "blockGroupsInput",
2765
+ publicName: "blockGroups",
2766
+ isSignal: true,
2767
+ isRequired: false,
2768
+ transformFunction: null
2769
+ },
2770
+ heading: {
2771
+ classPropertyName: "heading",
2772
+ publicName: "heading",
2773
+ isSignal: true,
2774
+ isRequired: false,
2775
+ transformFunction: null
2776
+ },
2777
+ namePlaceholderInput: {
2778
+ classPropertyName: "namePlaceholderInput",
2779
+ publicName: "namePlaceholder",
2780
+ isSignal: true,
2781
+ isRequired: false,
2782
+ transformFunction: null
2783
+ },
2784
+ subjectPlaceholderInput: {
2785
+ classPropertyName: "subjectPlaceholderInput",
2786
+ publicName: "subjectPlaceholder",
2787
+ isSignal: true,
2788
+ isRequired: false,
2789
+ transformFunction: null
2790
+ },
2791
+ systemNoteInput: {
2792
+ classPropertyName: "systemNoteInput",
2793
+ publicName: "systemNote",
2794
+ isSignal: true,
2795
+ isRequired: false,
2796
+ transformFunction: null
2797
+ },
2798
+ readOnlyNoteInput: {
2799
+ classPropertyName: "readOnlyNoteInput",
2800
+ publicName: "readOnlyNote",
2801
+ isSignal: true,
2802
+ isRequired: false,
2803
+ transformFunction: null
2804
+ },
2805
+ idPrefix: {
2806
+ classPropertyName: "idPrefix",
2807
+ publicName: "idPrefix",
2808
+ isSignal: true,
2809
+ isRequired: false,
2810
+ transformFunction: null
2811
+ },
2812
+ maxBodyLength: {
2813
+ classPropertyName: "maxBodyLength",
2814
+ publicName: "maxBodyLength",
2815
+ isSignal: true,
2816
+ isRequired: false,
2817
+ transformFunction: null
2818
+ },
2819
+ maxTextLength: {
2820
+ classPropertyName: "maxTextLength",
2821
+ publicName: "maxTextLength",
2822
+ isSignal: true,
2823
+ isRequired: false,
2824
+ transformFunction: null
2825
+ },
2826
+ fullAccess: {
2827
+ classPropertyName: "fullAccess",
2828
+ publicName: "fullAccess",
2829
+ isSignal: true,
2830
+ isRequired: false,
2831
+ transformFunction: null
2832
+ },
2833
+ systemTemplate: {
2834
+ classPropertyName: "systemTemplate",
2835
+ publicName: "systemTemplate",
2836
+ isSignal: true,
2837
+ isRequired: false,
2838
+ transformFunction: null
2839
+ },
2840
+ testSendEnabled: {
2841
+ classPropertyName: "testSendEnabled",
2842
+ publicName: "testSendEnabled",
2843
+ isSignal: true,
2844
+ isRequired: false,
2845
+ transformFunction: null
2846
+ },
2847
+ saving: {
2848
+ classPropertyName: "saving",
2849
+ publicName: "saving",
2850
+ isSignal: true,
2851
+ isRequired: false,
2852
+ transformFunction: null
2853
+ },
2854
+ testSending: {
2855
+ classPropertyName: "testSending",
2856
+ publicName: "testSending",
2857
+ isSignal: true,
2858
+ isRequired: false,
2859
+ transformFunction: null
2860
+ },
2861
+ videos: {
2862
+ classPropertyName: "videos",
2863
+ publicName: "videos",
2864
+ isSignal: true,
2865
+ isRequired: false,
2866
+ transformFunction: null
2867
+ },
2868
+ hideVideos: {
2869
+ classPropertyName: "hideVideos",
2870
+ publicName: "hideVideos",
2871
+ isSignal: true,
2872
+ isRequired: false,
2873
+ transformFunction: null
2874
+ },
2875
+ videosLoading: {
2876
+ classPropertyName: "videosLoading",
2877
+ publicName: "videosLoading",
2878
+ isSignal: true,
2879
+ isRequired: false,
2880
+ transformFunction: null
2881
+ },
2882
+ videoDefaults: {
2883
+ classPropertyName: "videoDefaults",
2884
+ publicName: "videoDefaults",
2885
+ isSignal: true,
2886
+ isRequired: false,
2887
+ transformFunction: null
2888
+ },
2889
+ videoLink: {
2890
+ classPropertyName: "videoLink",
2891
+ publicName: "videoLink",
2892
+ isSignal: true,
2893
+ isRequired: false,
2894
+ transformFunction: null
2895
+ },
2896
+ noVideosHintInput: {
2897
+ classPropertyName: "noVideosHintInput",
2898
+ publicName: "noVideosHint",
2899
+ isSignal: true,
2900
+ isRequired: false,
2901
+ transformFunction: null
2902
+ }
2903
+ },
2904
+ outputs: {
2905
+ save: "save",
2906
+ testSend: "testSend",
2907
+ videosRequested: "videosRequested",
2908
+ useAsMine: "useAsMine"
2909
+ },
2910
+ viewQueries: [{
2911
+ propertyName: "blockEditors",
2912
+ predicate: ["blockEditor"],
2913
+ descendants: true,
2914
+ isSignal: true
2915
+ }, {
2916
+ propertyName: "colorInputRef",
2917
+ first: true,
2918
+ predicate: ["colorInput"],
2919
+ descendants: true,
2920
+ isSignal: true
2921
+ }],
2922
+ ngImport: i0,
2923
+ template: `
2924
+ <div class="editor-page">
2925
+ <!-- Actions (outside the white panels) -->
2926
+ <div class="editor-actions">
2927
+ @if (heading()) {
2928
+ <h2 class="editor-heading" data-testid="editor-heading">{{ heading() }}</h2>
2929
+ }
2930
+ <div class="editor-actions-buttons">
2931
+ @if (canWrite() && testSendEnabled()) {
2932
+ <ui-button variant="secondary" size="sm" (click)="openTestSendDialog()">
2933
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>{{ labels.t('emailTemplateEditor.testSend') }}</ui-button>
2934
+ }
2935
+ <span class="save-wrap" [uiTooltip]="saveHint()">
2936
+ <ui-button variant="primary" size="sm" [loading]="saving()" [disabled]="saveDisabled()" (click)="onSave()">
2937
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>{{ labels.t('emailTemplateEditor.saveTemplate') }}</ui-button>
2938
+ </span>
2939
+ </div>
2940
+ @if (saveHintVisible(); as hint) {
2941
+ <!-- A blocked Save explains itself in visible text, not only in the tooltip. -->
2942
+ <p class="save-hint" role="status" data-testid="save-hint">{{ hint }}</p>
2943
+ }
2944
+ </div>
2945
+ <ui-divider />
2946
+
2947
+ @if (systemTemplate()) {
2948
+ <div class="readonly-note system-note" role="note" data-testid="editor-system-note">
2949
+ <span>{{ systemNote() }}</span>
2950
+ @if (canCopySystem()) {
2951
+ <ui-button variant="secondary" size="sm" data-testid="editor-use-as-mine" (click)="useAsMine.emit()">{{ labels.t('emailTemplateEditor.useAsMyTemplate') }}</ui-button>
2952
+ }
2953
+ </div>
2954
+ } @else if (!canWrite()) {
2955
+ <p class="readonly-note" role="note" data-testid="editor-readonly-note">{{ readOnlyNote() }}</p>
2956
+ }
2957
+
2958
+ <!-- 3-Column Layout -->
2959
+ <div class="editor-body">
2960
+ <!-- LEFT PANEL: Details -->
2961
+ <aside class="panel-left" [attr.aria-label]="labels.t('emailTemplateEditor.templateDetails')">
2962
+ <h3 class="panel-title">{{ labels.t('common.details') }}</h3>
2963
+
2964
+ <div class="form-field">
2965
+ <ui-text-input [label]="labels.t('common.name')" [required]="true" [(ngModel)]="name" [readonly]="!canWrite()" [maxlength]="maxTextLength()"
2966
+ [placeholder]="namePlaceholder()" [error]="nameErrorShown()" [showErrors]="nameTouched()" (blurred)="nameTouched.set(true)" />
2967
+ </div>
2968
+
2969
+ <div class="form-field">
2970
+ <ui-text-input [label]="labels.t('common.subject')" [required]="true" [(ngModel)]="subject" [readonly]="!canWrite()" [maxlength]="maxTextLength()"
2971
+ [placeholder]="subjectPlaceholder()" [error]="subjectErrorShown()" [showErrors]="subjectTouched()" (blurred)="subjectTouched.set(true)">
2972
+ </ui-text-input>
2973
+ </div>
2974
+
2975
+ <div class="form-field">
2976
+ <ui-select [label]="labels.t('emailTemplateEditor.category')" [options]="categories()" [placeholder]="categoryPlaceholder()" [(ngModel)]="category" [disabled]="!canWrite()" />
2977
+ </div>
2978
+
2979
+ <ui-checkbox [label]="labels.t('emailTemplateEditor.useThisTemplateAllYear')" [(checked)]="useAllYear" [disabled]="!canWrite()" />
2980
+
2981
+ @if (!useAllYear()) {
2982
+ <div class="form-row-dates" (focusout)="datesTouched.set(true)">
2983
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeFrom')" [(ngModel)]="activeFrom" [disabled]="!canWrite()" />
2984
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeTo')" [(ngModel)]="activeTo" [disabled]="!canWrite()" [min]="activeFrom()" [error]="datesError()" />
2985
+ </div>
2986
+ }
2987
+
2988
+ <!-- Assignments -->
2989
+ @if (assignmentOptions().length > 0) {
2990
+ <div class="assignments-section">
2991
+ <h4 class="section-title">{{ labels.t('emailTemplateEditor.assignments') }}<span class="required" aria-hidden="true">*</span></h4>
2992
+ <p class="section-desc">{{ assignmentsDescription() }}</p>
2993
+ <ui-error [errorId]="idPrefix() + '-assignments-error'" [message]="assignmentErrorShown()" />
2994
+ <ui-search-input [placeholder]="labels.t('common.searchellipsis')" [ariaLabel]="labels.t('emailTemplateEditor.searchAssignments')" [(value)]="assignmentSearch" />
2995
+ @if (filteredAssignments().length === 0) {
2996
+ <ui-empty-state iconType="search" [title]="labels.t('emailTemplateEditor.noAssignmentsFound')" [message]="labels.t('emailTemplateEditor.noAssignmentsMatchYourSearch')" />
2997
+ }
2998
+ <div class="assignment-list" [hidden]="filteredAssignments().length === 0" (focusout)="onAssignmentsFocusOut($event)">
2999
+ @for (item of filteredAssignments(); track item.key) {
3000
+ <div class="assignment-item" [class.assignment-readonly]="!canWrite()" [attr.role]="canWrite() ? 'switch' : null" [attr.tabindex]="canWrite() ? 0 : null"
3001
+ [attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null"
3002
+ (click)="toggleAssignment(item)" (keydown.enter)="toggleAssignment(item); $event.preventDefault()" (keydown.space)="toggleAssignment(item); $event.preventDefault()">
3003
+ <div class="assignment-text">
3004
+ <strong>{{ item.name }}</strong>
3005
+ <span>{{ item.description }}</span>
3006
+ </div>
3007
+ <div class="assignment-channels">
3008
+ <span class="channel-badge" [class.active]="item.assigned" role="img" [attr.aria-label]="item.assigned ? labels.t('emailTemplateEditor.emailOn') : labels.t('emailTemplateEditor.emailOff')">
3009
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/></svg>
3010
+ </span>
3011
+ </div>
3012
+ </div>
3013
+ }
3014
+ </div>
3015
+ </div>
3016
+ }
3017
+ </aside>
3018
+
3019
+ <!-- CENTER: Editor -->
3020
+ <section class="panel-center" [attr.aria-label]="labels.t('emailTemplateEditor.emailDesign')">
3021
+ <div class="editor-tabs" role="tablist" [attr.aria-label]="labels.t('emailTemplateEditor.editorView')">
3022
+ <button type="button" class="editor-tab" role="tab" [class.active]="activeEditorTab() === 'edit'" [attr.aria-selected]="activeEditorTab() === 'edit'" (click)="setEditorTab('edit')">
3023
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"/></svg>{{ labels.t('common.edit') }}</button>
3024
+ <button type="button" class="editor-tab" role="tab" [class.active]="activeEditorTab() === 'preview'" [attr.aria-selected]="activeEditorTab() === 'preview'" (click)="setEditorTab('preview')">
3025
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>{{ labels.t('common.preview') }}</button>
3026
+ <button type="button" class="editor-tab" role="tab" [class.active]="activeEditorTab() === 'mobile'" [attr.aria-selected]="activeEditorTab() === 'mobile'" (click)="setEditorTab('mobile')">
3027
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"/><line x1="12" y1="18" x2="12.01" y2="18"/></svg>{{ labels.t('common.mobile') }}</button>
3028
+ </div>
3029
+
3030
+ @if (activeEditorTab() === 'edit') {
3031
+ @if (canWrite()) {
3032
+ <!-- Toolbar row 1: mousedown preventDefault keeps focus (and the selection) in the editor -->
3033
+ <div class="editor-toolbar" role="toolbar" [attr.aria-label]="labels.t('emailTemplateEditor.textFormatting')" (mousedown)="preventFocusLoss($event)">
3034
+ <div class="toolbar-group">
3035
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bold')" [uiTooltip]="labels.t('emailTemplateEditor.tipBold')" (click)="execCommand('bold')"><strong>B</strong></ui-button>
3036
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.italic')" [uiTooltip]="labels.t('emailTemplateEditor.tipItalic')" (click)="execCommand('italic')"><em>I</em></ui-button>
3037
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.underline')" [uiTooltip]="labels.t('emailTemplateEditor.tipUnderline')" (click)="execCommand('underline')"><u>U</u></ui-button>
3038
+ </div>
3039
+ <div class="toolbar-group">
3040
+ @for (k of [headingKey()]; track k) {
3041
+ <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.headingLevel')" [options]="headingOptions" ngModel="p"
3042
+ (mousedown)="saveSelection()" (ngModelChange)="onHeading($event)" />
3043
+ }
3044
+ </div>
3045
+ <div class="toolbar-group">
3046
+ @for (k of [sizeKey()]; track k) {
3047
+ <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.fontSize')" [placeholder]="labels.t('emailTemplateEditor.size')" [options]="fontSizeOptions" ngModel=""
3048
+ (mousedown)="saveSelection()" (ngModelChange)="onFontSize($event)" />
3049
+ }
3050
+ </div>
3051
+ <div class="toolbar-group">
3052
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignLeft')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignLeft')" (click)="execCommand('justifyLeft')">
3053
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>
3054
+ </ui-button>
3055
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignCenter')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignCenter')" (click)="execCommand('justifyCenter')">
3056
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="18" y1="10" x2="6" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="18" y1="18" x2="6" y2="18"/></svg>
3057
+ </ui-button>
3058
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignRight')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignRight')" (click)="execCommand('justifyRight')">
3059
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="21" y1="10" x2="7" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="7" y2="18"/></svg>
3060
+ </ui-button>
3061
+ </div>
3062
+ <div class="toolbar-group">
3063
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bulletedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipBulletedList')" (click)="execCommand('insertUnorderedList')">
3064
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
3065
+ </ui-button>
3066
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.numberedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipNumberedList')" (click)="execCommand('insertOrderedList')">
3067
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>
3068
+ </ui-button>
3069
+ </div>
3070
+ <div class="toolbar-group">
3071
+ <!-- The browser's own colour dialog is the picker; a button opens it so the toolbar keeps one look. -->
3072
+ <input #colorInput type="color" class="hidden-color-input" [attr.aria-label]="labels.t('emailTemplateEditor.textColor')" tabindex="-1" [value]="currentColor()" (change)="applyTextColor($any($event.target).value)" (mousedown)="$event.stopPropagation()" />
3073
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.textColor')" [uiTooltip]="labels.t('emailTemplateEditor.tipTextColor')" (mousedown)="openColorPicker()">
3074
+ <span class="color-indicator">
3075
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><text y="20" font-size="20" font-weight="700">A</text></svg>
3076
+ <span class="color-bar" [style.background]="currentColor()"></span>
3077
+ </span>
3078
+ </ui-button>
3079
+ </div>
3080
+ <div class="toolbar-group">
3081
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertLink')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertLink')" (mousedown)="saveSelection()" (click)="openLinkDialog()">
3082
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
3083
+ </ui-button>
3084
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertImage')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertImage')" (mousedown)="saveSelection()" (click)="openImageDialog()">
3085
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
3086
+ </ui-button>
3087
+ </div>
3088
+ <div class="toolbar-group">
3089
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.undo')" [uiTooltip]="labels.t('emailTemplateEditor.tipUndo')" (click)="execCommand('undo')">
3090
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6.69 3L3 13"/></svg>
3091
+ </ui-button>
3092
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.redo')" [uiTooltip]="labels.t('emailTemplateEditor.tipRedo')" (click)="execCommand('redo')">
3093
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6.69 3L21 13"/></svg>
3094
+ </ui-button>
3095
+ </div>
3096
+ </div>
3097
+
3098
+ <!-- Toolbar row 2: block spacing -->
3099
+ <div class="toolbar-row-2">
3100
+ <div class="toolbar-group" (mousedown)="preventFocusLoss($event)">
3101
+ <span class="toolbar-label" id="tpl-spacing-label">{{ labels.t('emailTemplateEditor.blockSpacing') }}</span>
3102
+ <ui-pill-tabs [tabs]="spacingTabs" [activeKey]="blockSpacing() || 'none'" [ariaLabel]="labels.t('emailTemplateEditor.blockSpacing')" (tabChange)="applySpacing($event === 'none' ? '' : $event)" />
3103
+ </div>
3104
+ </div>
3105
+ }
3106
+
3107
+ <!-- Link dialog (inline popover) -->
3108
+ @if (canWrite() && showLinkDialog()) {
3109
+ <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertLink')">
3110
+ <div class="link-dialog-inner">
3111
+ <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.insertLink2') }}</span>
3112
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkAddress')" placeholder="https://example.com" [(ngModel)]="linkUrl" [error]="linkUrlError()" (keydown.enter)="insertLink()" />
3113
+ @if (!linkTextFromSelection()) {
3114
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkText')" [placeholder]="labels.t('emailTemplateEditor.linkTextOptional')" [(ngModel)]="linkText" (keydown.enter)="insertLink()" />
3115
+ }
3116
+ <div class="link-dialog-actions">
3117
+ <ui-button variant="secondary" size="sm" (click)="showLinkDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
3118
+ <ui-button variant="primary" size="sm" [disabled]="!canInsertLink()" (click)="insertLink()">{{ labels.t('common.insert') }}</ui-button>
3119
+ </div>
3120
+ </div>
3121
+ </div>
3122
+ }
3123
+
3124
+ <!-- Image URL dialog -->
3125
+ @if (canWrite() && showImageDialog()) {
3126
+ <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertImage')">
3127
+ <div class="link-dialog-inner">
3128
+ <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.insertImage2') }}</span>
3129
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAddress')" placeholder="https://example.com/image.jpg" [(ngModel)]="imageUrl" [error]="imageUrlError()" (keydown.enter)="insertImageFromUrl()" />
3130
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAltText')" [placeholder]="labels.t('emailTemplateEditor.altTextOptional')" [(ngModel)]="imageAlt" (keydown.enter)="insertImageFromUrl()" />
3131
+ <div class="link-dialog-actions">
3132
+ <ui-button variant="secondary" size="sm" (click)="showImageDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
3133
+ <ui-button variant="primary" size="sm" [disabled]="!canInsertImage()" (click)="insertImageFromUrl()">{{ labels.t('common.insert') }}</ui-button>
3134
+ </div>
3135
+ </div>
3136
+ </div>
3137
+ }
3138
+
3139
+ <ui-error [errorId]="idPrefix() + '-body-error'" [message]="bodyErrorShown()" />
3140
+
3141
+ <!-- Block Canvas with DnD -->
3142
+ <div class="blocks-canvas" (dragover)="onCanvasDragOver($event)" (drop)="onDropZoneDrop($event, blocks().length)" (focusout)="onBodyFocusOut($event)">
3143
+ <!-- Initial drop zone (before first block) -->
3144
+ <div class="drop-zone" [class.active]="dragOverIndex() === 0" (dragover)="onDropZoneDragOver($event, 0)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, 0)">
3145
+ <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
3146
+ </div>
3147
+
3148
+ @for (block of blocks(); track block.id; let i = $index) {
3149
+ <div class="block-wrapper" #blockWrapper [class.selected]="selectedBlockId() === block.id" [class.dragging]="dragFromCanvas() === i" (dragend)="onBlockDragEnd()">
3150
+ @if (canWrite()) {
3151
+ <!-- Only the handle is draggable: a draggable ancestor of the contenteditable breaks text selection in Firefox / Safari. Move up / down below are the keyboard and touch alternative. -->
3152
+ <div class="block-drag-handle" [attr.title]="labels.t('emailTemplateEditor.dragToReorder')" draggable="true" (dragstart)="onBlockDragStart($event, i, blockWrapper)">
3153
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
3154
+ </div>
3155
+ }
3156
+
3157
+ <!-- Block content (contenteditable, initialised ONCE after render so Angular never rewrites it and the caret never jumps) -->
3158
+ <div #blockEditor class="block-content" role="textbox" aria-multiline="true" [attr.aria-label]="labels.t('emailTemplateEditor.emailBlockN', { n: i + 1 })"
3159
+ [attr.data-block-id]="block.id" [attr.data-placeholder]="i === 0 ? startPlaceholder() : labels.t('emailTemplateEditor.clickToEdit')" [attr.contenteditable]="canWrite() ? 'true' : 'false'"
3160
+ (input)="onBlockInput($event, block)" (beforeinput)="onBlockBeforeInput($any($event))" (focus)="onBlockFocus(block)" (click)="selectedBlockId.set(block.id)"></div>
3161
+
3162
+ @if (canWrite()) {
3163
+ <div class="block-controls">
3164
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockUp')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveUp')" [disabled]="i === 0" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, -1)">
3165
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M18 15l-6-6-6 6"/></svg>
3166
+ </ui-button>
3167
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockDown')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveDown')" [disabled]="i === blocks().length - 1" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, 1)">
3168
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
3169
+ </ui-button>
3170
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.duplicateBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDuplicate')" (mousedown)="preventFocusLoss($event)" (click)="duplicateBlock(i)">
3171
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
3172
+ </ui-button>
3173
+ @if (blocks().length > 1) {
3174
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.deleteBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDeleteBlock')" (mousedown)="preventFocusLoss($event)" (click)="deleteBlock(i)">
3175
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6M14 11v6"/></svg>
3176
+ </ui-button>
3177
+ }
3178
+ </div>
3179
+ }
3180
+ </div>
3181
+
3182
+ <!-- Drop zone after each block -->
3183
+ <div class="drop-zone" [class.active]="dragOverIndex() === i + 1" (dragover)="onDropZoneDragOver($event, i + 1)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, i + 1)">
3184
+ <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
3185
+ </div>
3186
+ }
3187
+
3188
+ @if (canWrite()) {
3189
+ <button type="button" class="add-block-btn" (click)="addBlock('text-block')">
3190
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>{{ labels.t('emailTemplateEditor.addBlock') }}</button>
3191
+ }
3192
+ </div>
3193
+ }
3194
+
3195
+ @if (activeEditorTab() === 'preview') {
3196
+ <div class="preview-frame">
3197
+ <iframe class="preview-content" [attr.title]="labels.t('emailTemplateEditor.emailPreview')" sandbox="" referrerpolicy="no-referrer" [srcdoc]="previewDoc()"></iframe>
3198
+ </div>
3199
+ }
3200
+
3201
+ @if (activeEditorTab() === 'mobile') {
3202
+ <div class="preview-frame mobile">
3203
+ <div class="mobile-shell">
3204
+ <iframe class="preview-content" [attr.title]="labels.t('emailTemplateEditor.mobileEmailPreview')" sandbox="" referrerpolicy="no-referrer" [srcdoc]="previewDoc()"></iframe>
3205
+ </div>
3206
+ </div>
3207
+ }
3208
+ </section>
3209
+
3210
+ <!-- RIGHT PANEL: Blocks, Variables, Video (the word video appears only while the Video tab is on) -->
3211
+ <aside class="panel-right" [attr.aria-label]="videosEnabled() ? labels.t('emailTemplateEditor.rightPanelWithVideo') : labels.t('emailTemplateEditor.rightPanel')">
3212
+ @if (!canWrite()) {
3213
+ <div class="right-panel-body" data-testid="tpl-readonly-tools-note">
3214
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.readOnly') }}</h4>
3215
+ <p class="right-section-hint">{{ videosEnabled() ? labels.t('emailTemplateEditor.readOnlyToolsWithVideo') : labels.t('emailTemplateEditor.readOnlyTools') }}</p>
3216
+ </div>
3217
+ } @else {
3218
+ <div class="right-tabs" role="tablist" [attr.aria-label]="labels.t('emailTemplateEditor.rightPanelSections')">
3219
+ <button type="button" class="right-tab" role="tab" [class.active]="activeRightTab() === 'blocks'" [attr.aria-selected]="activeRightTab() === 'blocks'" (click)="activeRightTab.set('blocks')">
3220
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>{{ labels.t('emailTemplateEditor.blocks') }}</button>
3221
+ <button type="button" class="right-tab" role="tab" [class.active]="activeRightTab() === 'variables'" [attr.aria-selected]="activeRightTab() === 'variables'" (click)="activeRightTab.set('variables')">
3222
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 3v18M3 12h18"/></svg>{{ labels.t('emailTemplateEditor.variables') }}</button>
3223
+ @if (videosEnabled()) {
3224
+ <button type="button" class="right-tab" role="tab" [class.active]="activeRightTab() === 'video'" [attr.aria-selected]="activeRightTab() === 'video'" (click)="openVideoTab()">
3225
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg>{{ labels.t('common.video') }}</button>
3226
+ }
3227
+ </div>
3228
+
3229
+ @if (activeRightTab() === 'blocks') {
3230
+ <div class="right-panel-body">
3231
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.contentBlocks') }}</h4>
3232
+ <p class="right-section-desc">{{ labels.t('emailTemplateEditor.clickToInsertOrDrag') }}</p>
3233
+ <ui-search-input [placeholder]="labels.t('emailTemplateEditor.searchBlocks')" [ariaLabel]="labels.t('emailTemplateEditor.searchBlocks2')" [(value)]="blockSearch" />
3234
+
3235
+ @if (filteredBlockGroups().length === 0) {
3236
+ <ui-empty-state iconType="search" [title]="labels.t('emailTemplateEditor.noBlocksFound')" [message]="labels.t('emailTemplateEditor.noBlocksMatchYourSearch')" />
3237
+ }
3238
+ @for (group of filteredBlockGroups(); track group.name) {
3239
+ <div class="block-group">
3240
+ <button type="button" class="block-group-header" [attr.aria-expanded]="isOpen('b:' + group.name)" (click)="toggleGroup('b:' + group.name)">
3241
+ <svg class="chevron" [class.expanded]="isOpen('b:' + group.name)" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
3242
+ <span>{{ group.name }}</span>
3243
+ <span class="block-count">{{ group.blocks.length }}</span>
3244
+ </button>
3245
+ @if (isOpen('b:' + group.name)) {
3246
+ <div class="block-list">
3247
+ @for (block of group.blocks; track block.key) {
3248
+ <!-- A div, not a button: Firefox does not start a drag from a <button>. Role, tabindex and Enter / Space keep it a keyboard control; a click inserts the block. -->
3249
+ <div role="button" tabindex="0" class="block-item" draggable="true" [attr.aria-label]="labels.t('emailTemplateEditor.insertNamed', { name: block.label })"
3250
+ (dragstart)="onPaletteDragStart($event, block)" (dragend)="onBlockDragEnd()" (click)="insertBlock(block)"
3251
+ (keydown.enter)="insertBlock(block); $event.preventDefault()" (keydown.space)="insertBlock(block); $event.preventDefault()">
3252
+ <svg class="block-item-drag" width="10" height="10" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
3253
+ {{ block.label }}
3254
+ </div>
3255
+ }
3256
+ </div>
3257
+ }
3258
+ </div>
3259
+ }
3260
+ </div>
3261
+ }
3262
+
3263
+ @if (activeRightTab() === 'variables') {
3264
+ <div class="right-panel-body">
3265
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.templateVariables') }}</h4>
3266
+ <p class="right-section-desc">{{ labels.t('emailTemplateEditor.clickAVariableToInsert') }}</p>
3267
+
3268
+ @for (group of variableGroups(); track group.name) {
3269
+ <div class="block-group">
3270
+ <button type="button" class="block-group-header" [attr.aria-expanded]="isOpen('v:' + group.name)" (click)="toggleGroup('v:' + group.name)">
3271
+ <svg class="chevron" [class.expanded]="isOpen('v:' + group.name)" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
3272
+ <span>{{ group.name }}</span>
3273
+ <span class="block-count">{{ group.variables.length }}</span>
3274
+ </button>
3275
+ @if (isOpen('v:' + group.name)) {
3276
+ <div class="variable-list">
3277
+ @for (v of group.variables; track v.key) {
3278
+ <button type="button" class="variable-item" (mousedown)="saveSelection()" (click)="insertVariable(v)">
3279
+ <span class="var-tag">{{ '{{' + v.key + '}}' }}</span>
3280
+ <span class="var-example">{{ labels.t('emailTemplateEditor.example', { example: v.example }) }}</span>
3281
+ <!-- A very short explanation of what the variable is: the host's description, else its label. -->
3282
+ <span class="var-description">{{ v.description || v.label }}</span>
3283
+ </button>
3284
+ }
3285
+ </div>
3286
+ }
3287
+ </div>
3288
+ }
3289
+ </div>
3290
+ }
3291
+
3292
+ @if (activeRightTab() === 'video' && videosEnabled()) {
3293
+ <div class="right-panel-body video-library-panel">
3294
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.videoLibrary') }}</h4>
3295
+ <p class="right-section-hint">{{ labels.t('emailTemplateEditor.clickAVideoToAdd') }}</p>
3296
+
3297
+ <div class="video-config-section">
3298
+ <ui-radio-group [label]="labels.t('emailTemplateEditor.playback')" orientation="horizontal" [options]="playbackOptions" [ngModel]="videoAutoplay() ? 'autoplay' : 'click'" (ngModelChange)="videoAutoplay.set($event === 'autoplay')" />
3299
+ </div>
3300
+ <div class="video-config-section">
3301
+ <ui-text-input [label]="labels.t('emailTemplateEditor.caption')" [placeholder]="labels.t('emailTemplateEditor.eGClickToWatch')" [maxlength]="200" [(ngModel)]="videoCaption" />
3302
+ </div>
3303
+ <div class="video-config-section">
3304
+ <ui-select [label]="labels.t('emailTemplateEditor.callToAction')" [options]="ctaTypeOptions" [(ngModel)]="videoCtaType" />
3305
+ @if (videoCtaType()) {
3306
+ <ui-text-input [ariaLabel]="labels.t('emailTemplateEditor.callToActionAddress')" type="url" placeholder="https://..." [(ngModel)]="videoCtaUrl" />
3307
+ <ui-text-input [ariaLabel]="labels.t('emailTemplateEditor.callToActionButtonLabel')" [placeholder]="labels.t('emailTemplateEditor.buttonLabel')" [maxlength]="100" [(ngModel)]="videoCtaLabel" />
3308
+ }
3309
+ </div>
3310
+ <div class="video-config-section">
3311
+ <ui-checkbox [label]="labels.t('emailTemplateEditor.hideReactions')" [(checked)]="videoHideReactions" />
3312
+ </div>
3313
+
3314
+ @if (videosLoading()) {
3315
+ <div class="video-lib-loading" role="status" aria-busy="true" [attr.aria-label]="labels.t('emailTemplateEditor.loadingVideos')">
3316
+ @for (n of [1, 2, 3]; track n) {
3317
+ <div class="video-lib-skeleton">
3318
+ <ui-skeleton [height]="40" width="56px" [radius]="6" />
3319
+ <div class="vls-info"><ui-skeleton [height]="10" width="75%" [radius]="5" /><ui-skeleton [height]="10" width="45%" [radius]="5" /></div>
3320
+ </div>
3321
+ }
3322
+ </div>
3323
+ } @else if (videoList().length === 0) {
3324
+ <ui-empty-state iconType="video" [title]="labels.t('emailTemplateEditor.noVideosCreated')" [message]="noVideosHint()" />
3325
+ } @else {
3326
+ <div class="video-lib-list">
3327
+ @for (video of videoList(); track video.id) {
3328
+ <button type="button" class="video-lib-item" [class.selected]="video.id === videoId()" [attr.aria-pressed]="video.id === videoId()" (click)="insertVideo(video)">
3329
+ <span class="vli-thumb">
3330
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#94a3b8" stroke-width="1.5" aria-hidden="true"><polygon points="5 3 19 12 5 21 5 3"/></svg>
3331
+ @if (video.durationSeconds) {
3332
+ <span class="vli-dur">{{ formatDuration(video.durationSeconds) }}</span>
3333
+ }
3334
+ </span>
3335
+ <span class="vli-info">
3336
+ <span class="vli-title">{{ video.title }}</span>
3337
+ <span class="vli-cat">{{ categoryLabel(video.category) }}</span>
3338
+ </span>
3339
+ @if (video.id === videoId()) {
3340
+ <svg class="vli-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2.5" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>
3341
+ }
3342
+ </button>
3343
+ }
3344
+ </div>
3345
+ }
3346
+ </div>
3347
+ }
3348
+ }
3349
+ </aside>
3350
+ </div>
3351
+ </div>
3352
+
3353
+ <!-- Test Send -->
3354
+ <ui-side-panel [open]="showTestSendDialog()" [title]="labels.t('emailTemplateEditor.sendTestEmail')" [primaryLabel]="labels.t('emailTemplateEditor.sendTest')" [primaryLoading]="testSending()" [primaryDisabled]="!canSendTest()"
3355
+ (closed)="showTestSendDialog.set(false)" (primaryClick)="onTestSend()">
3356
+ <p class="config-desc">{{ labels.t('emailTemplateEditor.sendThisTemplateToAn') }}</p>
3357
+ @if (!editingId()) {
3358
+ <div class="test-save-note">
3359
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>{{ labels.t('emailTemplateEditor.saveTheTemplateFirstBefore') }}</div>
3360
+ }
3361
+ <div class="config-field config-field-mt">
3362
+ <ui-text-input [label]="labels.t('emailTemplateEditor.recipientEmail')" type="email" placeholder="you@example.com" [(ngModel)]="testSendEmail" [error]="testEmailError()" (keydown.enter)="onTestSend()" />
3363
+ </div>
3364
+ @if (hasUnsavedChanges()) {
3365
+ <div class="test-save-note" role="note" data-testid="test-unsaved-note">{{ labels.t('emailTemplateEditor.youHaveUnsavedChangesThe') }}</div>
3366
+ }
3367
+ </ui-side-panel>
3368
+
3369
+
3370
+ `,
3371
+ isInline: true,
3372
+ styles: [":host{display:flex;flex-direction:column;flex:1;min-height:0}.required{color:#ef4444;font-weight:400}.editor-page{display:flex;flex-direction:column;flex:1;min-height:0;background:#f8fafc;overflow:hidden}.editor-actions{display:flex;justify-content:space-between;align-items:center;gap:8px 16px;flex-wrap:wrap;padding:0 0 12px;flex-shrink:0}.editor-heading{margin:0;font-size:1.25rem;font-weight:700;color:#1e293b;line-height:1.3;min-width:0}.save-wrap{display:inline-flex}.save-hint{margin:0;font-size:12px;color:#475569;flex-basis:100%;text-align:right}.editor-actions-buttons{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-left:auto}.readonly-note{margin:0;padding:8px 16px;font-size:.8125rem;color:#92400e;background:#fffbeb;border-bottom:1px solid #fde68a}.readonly-note.system-note{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.editor-body{display:grid;grid-template-columns:340px minmax(0,1fr) 300px;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden}.panel-left{background:#fff;border-right:1px solid #e2e8f0;padding:24px;overflow-y:auto}.panel-title{font-size:1.0625rem;font-weight:700;color:#1e293b;margin:0 0 20px}.form-field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}.form-row-dates{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:16px}.assignments-section{border-top:1px solid #e2e8f0;padding-top:20px;margin-top:16px}.section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 6px}.section-desc{font-size:.8125rem;color:#64748b;line-height:1.5;margin:0 0 12px}.assignment-list{max-height:340px;overflow-y:auto;margin-top:12px;border:1px solid #e2e8f0;border-radius:8px}.assignment-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;cursor:pointer;border-bottom:1px solid #f1f5f9;transition:background .1s}.assignment-item:last-child{border-bottom:none}.assignment-item:hover{background:#f8fafc}.assignment-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.assignment-item.assignment-readonly{cursor:default}.assignment-item.assignment-readonly:hover{background:transparent}.assignment-text{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.assignment-text strong{font-size:.8125rem;color:#1e293b}.assignment-text span{font-size:.75rem;color:#64748b}.assignment-channels{display:flex;gap:4px;flex-shrink:0}.channel-badge{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;background:#f1f5f9;color:#64748b;transition:all .15s}.channel-badge.active{background:#3b82f6;color:#fff}.channel-badge.disabled{opacity:.4;cursor:not-allowed}.config-desc{font-size:.875rem;color:#64748b;line-height:1.5;margin:0}.config-divider{border:none;border-top:1px solid #e2e8f0;margin:20px 0}.config-section{display:flex;flex-direction:column;gap:12px}.config-section-label{font-size:.6875rem;font-weight:700;color:#3b82f6;text-transform:uppercase;letter-spacing:.04em}.config-field{display:flex;flex-direction:column;gap:6px}.config-field-mt{margin-top:16px}.config-label{font-size:.8125rem;font-weight:600;color:#1e293b}.config-readonly{padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:.875rem;color:#1e293b}.config-hint{font-size:.75rem;color:#64748b}.test-save-note{display:flex;align-items:center;gap:8px;padding:10px 14px;background:#fef3c7;border:1px solid #fcd34d;border-radius:8px;font-size:.8125rem;color:#92400e;margin-top:12px}.test-save-note svg{flex-shrink:0}.panel-center{display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}.editor-tabs{display:flex;gap:2px;padding:12px 20px 0;background:#fff;border-bottom:1px solid #e2e8f0;overflow-x:auto;-webkit-overflow-scrolling:touch}.editor-tab{display:flex;align-items:center;gap:6px;padding:10px 16px;border:1px solid #e2e8f0;border-bottom:none;border-radius:8px 8px 0 0;background:#f8fafc;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;white-space:nowrap}.editor-tab:hover{background:#fff;color:#1e293b}.editor-tab.active{background:#eff6ff;color:#1d4ed8;border-color:#93c5fd}.editor-tab:focus-visible,.right-tab:focus-visible,.block-group-header:focus-visible,.variable-item:focus-visible,.add-block-btn:focus-visible,.block-item:focus-visible,.video-lib-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.editor-toolbar{display:flex;align-items:center;gap:8px;padding:10px 20px;background:#fff;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}.toolbar-row-2{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 20px;background:#fff;border-bottom:1px solid #e2e8f0}.toolbar-group{display:flex;align-items:center;gap:2px;padding-right:8px;border-right:1px solid #e2e8f0}.toolbar-group:last-child{border-right:none;padding-right:0}.toolbar-select{display:block;min-width:96px}.toolbar-label{font-size:.75rem;font-weight:600;color:#64748b;white-space:nowrap;margin-right:6px}.hidden-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none;border:none;padding:0}.color-indicator{display:flex;flex-direction:column;align-items:center;gap:2px;color:#475569}.color-bar{display:block;width:16px;height:3px;border-radius:2px;border:1px solid rgba(0,0,0,.1)}.link-dialog{background:#fff;border-bottom:1px solid #e2e8f0;padding:12px 20px}.link-dialog-inner{display:flex;align-items:flex-start;gap:8px;flex-wrap:wrap}.link-dialog-title{font-size:.8125rem;font-weight:700;color:#1e293b;white-space:nowrap;padding-top:10px}.link-dialog-input{display:block;width:240px;max-width:100%}.link-dialog-actions{display:flex;gap:6px}.preview-frame{flex:1;display:flex;justify-content:center;align-items:stretch;padding:24px;overflow-y:auto;background:#f1f5f9}.preview-frame.mobile{align-items:flex-start}.preview-content{display:block;flex:1 1 auto;max-width:600px;width:100%;box-sizing:border-box;min-height:400px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.mobile-shell{width:375px;max-width:100%;box-sizing:border-box;min-height:600px;border:2px solid #1e293b;border-radius:24px;padding:40px 12px 24px;background:#fff;box-shadow:0 8px 32px #0000001f}.mobile-shell .preview-content{border:none;border-radius:0;max-width:100%;height:520px;min-height:0}.blocks-canvas{flex:1 1 0;min-height:0;padding:16px 20px 24px 56px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#f1f5f9;display:flex;flex-direction:column}.block-wrapper{flex-shrink:0;position:relative;display:flex;align-items:flex-start;background:#fff;border:2px solid transparent;border-radius:8px;transition:border-color .15s,box-shadow .15s}.block-wrapper:hover,.block-wrapper.selected,.block-wrapper:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.block-wrapper:hover .block-drag-handle,.block-wrapper.selected .block-drag-handle,.block-wrapper:focus-within .block-drag-handle{opacity:1}.block-wrapper:hover .block-controls,.block-wrapper.selected .block-controls,.block-wrapper:focus-within .block-controls{opacity:1;pointer-events:all}.block-wrapper.dragging{opacity:.4}.block-drag-handle{flex-shrink:0;width:28px;display:flex;align-items:flex-start;justify-content:center;padding-top:14px;opacity:0;transition:opacity .15s;cursor:grab;color:#94a3b8}.block-drag-handle:active{cursor:grabbing}.block-content{flex:1;min-width:0;padding:12px 16px;outline:none;font-size:.9375rem;color:#1e293b;line-height:1.6;min-height:48px;overflow-wrap:anywhere}.block-content:empty:before{content:attr(data-placeholder);color:#64748b;font-style:italic;pointer-events:none}.block-content p{margin:0 0 8px}.block-content p:last-child{margin:0}.block-content h1,.block-content h2,.block-content h3{margin:8px 0 6px;color:#1e293b}.block-content a{color:#3b82f6}.block-content img{max-width:100%;border-radius:6px}.block-content ul,.block-content ol{padding-left:20px;margin:0 0 8px}.block-controls{position:absolute;top:0;left:-48px;flex-direction:column;display:flex;gap:2px;opacity:0;pointer-events:none;transition:opacity .15s;background:#fff;border:1px solid #e2e8f0;border-radius:6px;padding:3px;box-shadow:0 2px 6px #00000014}@media(pointer:coarse){.editor-tab,.right-tab,.block-group-header{min-height:44px}}@media(hover:none){.block-wrapper.selected .block-controls{opacity:1;pointer-events:all}}.drop-zone{flex-shrink:0;height:8px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:height .15s,background .15s;position:relative}.drop-zone-label{font-size:.75rem;font-weight:600;color:#1d4ed8;opacity:0;transition:opacity .1s}.drop-zone.active{height:40px;background:#3b82f614;border:2px dashed #3b82f6}.drop-zone.active .drop-zone-label{opacity:1}.add-block-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:44px;padding:12px;margin-top:8px;border:2px dashed #e2e8f0;border-radius:8px;background:none;font-size:.875rem;font-weight:600;color:#475569;cursor:pointer;font-family:inherit;transition:border-color .15s,color .15s,background .15s}.add-block-btn:hover{border-color:#3b82f6;color:#3b82f6;background:#3b82f60a}.panel-right{background:#fff;border-left:1px solid #e2e8f0;display:flex;flex-direction:column;min-height:0;min-width:0}.right-tabs{display:flex;border-bottom:1px solid #e2e8f0}.right-tab{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:12px;min-height:44px;border:none;background:none;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;border-bottom:2px solid transparent}.right-tab:hover{color:#1e293b}.right-tab.active{color:#1d4ed8;background:#eff6ff;border-bottom-color:#3b82f6}.right-panel-body{flex:1;padding:20px;overflow-y:auto}.right-section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 12px}.right-section-desc{font-size:.8125rem;color:#64748b;margin:0 0 16px;line-height:1.5}.right-section-hint{font-size:.8125rem;color:#64748b;margin:0 0 12px;line-height:1.5}.block-group{border-bottom:1px solid #f1f5f9}.block-group-header{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:12px 0;border:none;background:none;font-size:.875rem;font-weight:600;color:#1e293b;cursor:pointer;font-family:inherit;text-align:left}.block-group-header .chevron{transition:transform .2s;color:#94a3b8}.block-group-header .chevron.expanded{transform:rotate(90deg)}.block-group-header span:nth-of-type(1){flex:1}.block-count{font-size:.75rem;font-weight:600;color:#475569;background:#f1f5f9;padding:2px 8px;border-radius:10px;margin-left:auto}.block-list{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}.variable-list{display:flex;flex-direction:column;padding-bottom:8px}.variable-item+.variable-item{border-top:1px solid #f1f5f9;border-radius:0}.block-item{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;min-height:44px;padding:8px 0;font-size:.8125rem;color:#64748b;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit;-webkit-user-select:none;user-select:none}.block-item:hover{background:#f8fafc;color:#1e293b}.block-item-drag{color:#cbd5e1;flex-shrink:0;cursor:grab}.variable-item{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-height:44px;padding:8px 0;min-width:0;width:100%;box-sizing:border-box;border:none;background:none;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit}.variable-item:hover{background:#f8fafc}.var-tag{max-width:100%;overflow-wrap:anywhere;font-size:.75rem;font-weight:600;color:#1d4ed8;background:#3b82f614;padding:2px 6px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.var-example{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.var-description{font-size:.75rem;color:#64748b;line-height:1.4;overflow-wrap:anywhere}.video-library-panel{padding:0}.video-library-panel .right-section-title,.video-library-panel .right-section-hint{padding:0 16px}.video-library-panel .right-section-title{padding-top:16px}.video-config-section{display:flex;flex-direction:column;gap:8px;padding:12px 16px;border-bottom:1px solid #f1f5f9}.video-config-section:last-of-type{border-bottom:none}.video-lib-list{display:flex;flex-direction:column;gap:2px;padding:8px 8px 16px}.video-lib-item{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:8px;border:1px solid transparent;border-radius:8px;background:none;cursor:pointer;text-align:left;font-family:inherit;transition:background .15s,border-color .15s}.video-lib-item:hover{background:#f8fafc;border-color:#e2e8f0}.video-lib-item.selected{background:#eff6ff;border-color:#93c5fd}.vli-thumb{position:relative;flex-shrink:0;width:56px;height:40px;border-radius:6px;background:linear-gradient(135deg,#f1f5f9,#e2e8f0);display:flex;align-items:center;justify-content:center}.vli-dur{position:absolute;bottom:2px;right:3px;font-size:.625rem;font-weight:600;color:#fff;background:#000000a6;padding:1px 4px;border-radius:3px}.vli-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.vli-title{font-size:.8125rem;font-weight:600;color:#1e293b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vli-cat{font-size:.75rem;color:#475569}.vli-check{flex-shrink:0}.video-lib-loading{padding:8px}.video-lib-skeleton{display:flex;align-items:center;gap:10px;padding:8px;margin-bottom:4px}.vls-info{flex:1;display:flex;flex-direction:column;gap:6px}@media(max-width:1200px){.editor-body{grid-template-columns:280px minmax(0,1fr) 260px}}@media(max-width:900px){:host{flex:none}.editor-page{flex:none;min-height:100vh;min-height:100dvh;overflow:visible}.editor-body{display:flex;flex-direction:column;flex:none;overflow:visible}.panel-left{border-right:none;border-bottom:1px solid #e2e8f0;overflow:visible;padding:16px}.panel-center{overflow:visible;min-height:480px}.blocks-canvas{overflow:visible;min-height:320px}.panel-right{border-left:none;border-top:1px solid #e2e8f0}.right-panel-body{overflow:visible}.editor-toolbar,.toolbar-row-2,.link-dialog,.editor-tabs{padding-left:12px;padding-right:12px}.preview-frame{padding:12px}.form-row-dates{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){*{transition:none!important}}\n"],
3373
+ dependencies: [
3374
+ {
3375
+ kind: "ngmodule",
3376
+ type: FormsModule
3377
+ },
3378
+ {
3379
+ kind: "directive",
3380
+ type: i1.NgControlStatus,
3381
+ selector: "[formControlName],[ngModel],[formControl]"
3382
+ },
3383
+ {
3384
+ kind: "directive",
3385
+ type: i1.RequiredValidator,
3386
+ selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
3387
+ inputs: ["required"]
3388
+ },
3389
+ {
3390
+ kind: "directive",
3391
+ type: i1.MaxLengthValidator,
3392
+ selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
3393
+ inputs: ["maxlength"]
3394
+ },
3395
+ {
3396
+ kind: "directive",
3397
+ type: i1.NgModel,
3398
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
3399
+ inputs: [
3400
+ "name",
3401
+ "disabled",
3402
+ "ngModel",
3403
+ "ngModelOptions"
3404
+ ],
3405
+ outputs: ["ngModelChange"],
3406
+ exportAs: ["ngModel"]
3407
+ },
3408
+ {
3409
+ kind: "component",
3410
+ type: ButtonComponent,
3411
+ selector: "ui-button",
3412
+ inputs: [
3413
+ "variant",
3414
+ "routerLink",
3415
+ "queryParams",
3416
+ "fragment",
3417
+ "state",
3418
+ "href",
3419
+ "target",
3420
+ "rel",
3421
+ "shortLabel",
3422
+ "shortBelow",
3423
+ "color",
3424
+ "active",
3425
+ "size",
3426
+ "type",
3427
+ "disabled",
3428
+ "loading",
3429
+ "fullWidth",
3430
+ "ariaLabel",
3431
+ "ariaExpanded",
3432
+ "ariaPressed",
3433
+ "ariaDescribedBy",
3434
+ "modal-footer-left",
3435
+ "modal-footer-right"
3436
+ ]
3437
+ },
3438
+ {
3439
+ kind: "component",
3440
+ type: CheckboxComponent,
3441
+ selector: "ui-checkbox, ui-checkbox-group",
3442
+ inputs: [
3443
+ "label",
3444
+ "ariaLabel",
3445
+ "testId",
3446
+ "labelTestId",
3447
+ "headingLevel",
3448
+ "indeterminate",
3449
+ "checked",
3450
+ "options",
3451
+ "legend",
3452
+ "orientation",
3453
+ "values",
3454
+ "labelLinks",
3455
+ "description",
3456
+ "indent",
3457
+ "required",
3458
+ "requiredMessage",
3459
+ "hint",
3460
+ "error",
3461
+ "showErrors",
3462
+ "disabled"
3463
+ ],
3464
+ outputs: [
3465
+ "checkedChange",
3466
+ "valuesChange",
3467
+ "invalidChange"
3468
+ ]
3469
+ },
3470
+ {
3471
+ kind: "component",
3472
+ type: DateInputComponent,
3473
+ selector: "ui-date-input",
3474
+ inputs: [
3475
+ "label",
3476
+ "required",
3477
+ "min",
3478
+ "max",
3479
+ "hint",
3480
+ "ariaDescribedBy",
3481
+ "error",
3482
+ "showErrors",
3483
+ "disabled"
3484
+ ],
3485
+ outputs: ["invalidChange", "valueChange"]
3486
+ },
3487
+ {
3488
+ kind: "component",
3489
+ type: DividerComponent,
3490
+ selector: "ui-divider",
3491
+ inputs: [
3492
+ "spaceAbove",
3493
+ "spaceBelow",
3494
+ "decorative"
3495
+ ]
3496
+ },
3497
+ {
3498
+ kind: "component",
3499
+ type: EmptyStateComponent,
3500
+ selector: "ui-empty-state",
3501
+ inputs: [
3502
+ "message",
3503
+ "title",
3504
+ "iconType"
3505
+ ]
3506
+ },
3507
+ {
3508
+ kind: "component",
3509
+ type: ErrorComponent,
3510
+ selector: "ui-error",
3511
+ inputs: ["message", "errorId"]
3512
+ },
3513
+ {
3514
+ kind: "component",
3515
+ type: PillTabsComponent,
3516
+ selector: "ui-pill-tabs",
3517
+ inputs: [
3518
+ "tabs",
3519
+ "activeKey",
3520
+ "ariaLabel",
3521
+ "name",
3522
+ "noWrap",
3523
+ "orientation",
3524
+ "controlsPanels",
3525
+ "showDescription",
3526
+ "headingLevel"
3527
+ ],
3528
+ outputs: ["tabChange"]
3529
+ },
3530
+ {
3531
+ kind: "component",
3532
+ type: RadioGroupComponent,
3533
+ selector: "ui-radio-group",
3534
+ inputs: [
3535
+ "label",
3536
+ "options",
3537
+ "required",
3538
+ "hint",
3539
+ "error",
3540
+ "showErrors",
3541
+ "orientation",
3542
+ "name",
3543
+ "disabled"
3544
+ ],
3545
+ outputs: ["invalidChange"]
3546
+ },
3547
+ {
3548
+ kind: "component",
3549
+ type: SearchInputComponent,
3550
+ selector: "ui-search-input",
3551
+ inputs: [
3552
+ "placeholder",
3553
+ "ariaLabel",
3554
+ "value",
3555
+ "maxlength",
3556
+ "endpoint",
3557
+ "loading",
3558
+ "collapseAt",
3559
+ "expanded"
3560
+ ],
3561
+ outputs: [
3562
+ "valueChange",
3563
+ "expandedChange",
3564
+ "searchChange",
3565
+ "filteredData"
3566
+ ]
3567
+ },
3568
+ {
3569
+ kind: "component",
3570
+ type: SelectComponent,
3571
+ selector: "ui-select",
3572
+ inputs: [
3573
+ "label",
3574
+ "ariaLabel",
3575
+ "labelHidden",
3576
+ "inputName",
3577
+ "placeholder",
3578
+ "options",
3579
+ "valueType",
3580
+ "required",
3581
+ "hint",
3582
+ "ariaDescribedBy",
3583
+ "error",
3584
+ "showErrors",
3585
+ "size",
3586
+ "disabled"
3587
+ ],
3588
+ outputs: ["invalidChange", "valueChange"]
3589
+ },
3590
+ {
3591
+ kind: "component",
3592
+ type: SidePanelComponent,
3593
+ selector: "ui-side-panel",
3594
+ inputs: [
3595
+ "open",
3596
+ "title",
3597
+ "subtitle",
3598
+ "wide",
3599
+ "extraWide",
3600
+ "cancelLabel",
3601
+ "primaryLabel",
3602
+ "primaryVariant",
3603
+ "primaryLoading",
3604
+ "primaryDisabled",
3605
+ "cancelTestId",
3606
+ "primaryTestId",
3607
+ "returnFocusTo"
3608
+ ],
3609
+ outputs: ["closed", "primaryClick"]
3610
+ },
3611
+ {
3612
+ kind: "component",
3613
+ type: SkeletonComponent,
3614
+ selector: "ui-skeleton",
3615
+ inputs: [
3616
+ "height",
3617
+ "width",
3618
+ "radius",
3619
+ "mb",
3620
+ "ariaLabel"
3621
+ ]
3622
+ },
3623
+ {
3624
+ kind: "component",
3625
+ type: TextInputComponent,
3626
+ selector: "ui-text-input",
3627
+ inputs: [
3628
+ "label",
3629
+ "ariaLabel",
3630
+ "inputTestId",
3631
+ "inputName",
3632
+ "placeholder",
3633
+ "prefix",
3634
+ "leadingIcon",
3635
+ "revealable",
3636
+ "passwordRequirements",
3637
+ "passwordRules",
3638
+ "type",
3639
+ "maxlength",
3640
+ "required",
3641
+ "autocomplete",
3642
+ "inputmode",
3643
+ "readonly",
3644
+ "hint",
3645
+ "ariaDescribedBy",
3646
+ "ariaInvalid",
3647
+ "error",
3648
+ "phoneFormat",
3649
+ "min",
3650
+ "max",
3651
+ "maxDecimals",
3652
+ "step",
3653
+ "valueType",
3654
+ "formatter",
3655
+ "integer",
3656
+ "showErrors",
3657
+ "disabled"
3658
+ ],
3659
+ outputs: [
3660
+ "valueChange",
3661
+ "focused",
3662
+ "blurred",
3663
+ "invalidChange"
3664
+ ]
3665
+ },
3666
+ {
3667
+ kind: "directive",
3668
+ type: TooltipDirective,
3669
+ selector: "[uiTooltip]",
3670
+ inputs: ["uiTooltip", "tooltipPosition"]
3671
+ }
3672
+ ],
3673
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
3674
+ });
3675
+ }
3676
+ };
3677
+ i0.ɵɵngDeclareClassMetadata({
3678
+ minVersion: "12.0.0",
3679
+ version: "22.2.2",
3680
+ ngImport: i0,
3681
+ type: EmailTemplateEditorComponent,
3682
+ decorators: [{
3683
+ type: Component,
3684
+ args: [{
3685
+ selector: "ui-email-template-editor",
3686
+ standalone: true,
3687
+ changeDetection: ChangeDetectionStrategy.OnPush,
3688
+ imports: [
3689
+ FormsModule,
3690
+ ButtonComponent,
3691
+ CheckboxComponent,
3692
+ DateInputComponent,
3693
+ DividerComponent,
3694
+ EmptyStateComponent,
3695
+ ErrorComponent,
3696
+ PillTabsComponent,
3697
+ RadioGroupComponent,
3698
+ SearchInputComponent,
3699
+ SelectComponent,
3700
+ SidePanelComponent,
3701
+ SkeletonComponent,
3702
+ TextInputComponent,
3703
+ TooltipDirective
3704
+ ],
3705
+ template: `
3706
+ <div class="editor-page">
3707
+ <!-- Actions (outside the white panels) -->
3708
+ <div class="editor-actions">
3709
+ @if (heading()) {
3710
+ <h2 class="editor-heading" data-testid="editor-heading">{{ heading() }}</h2>
3711
+ }
3712
+ <div class="editor-actions-buttons">
3713
+ @if (canWrite() && testSendEnabled()) {
3714
+ <ui-button variant="secondary" size="sm" (click)="openTestSendDialog()">
3715
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>{{ labels.t('emailTemplateEditor.testSend') }}</ui-button>
3716
+ }
3717
+ <span class="save-wrap" [uiTooltip]="saveHint()">
3718
+ <ui-button variant="primary" size="sm" [loading]="saving()" [disabled]="saveDisabled()" (click)="onSave()">
3719
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>{{ labels.t('emailTemplateEditor.saveTemplate') }}</ui-button>
3720
+ </span>
3721
+ </div>
3722
+ @if (saveHintVisible(); as hint) {
3723
+ <!-- A blocked Save explains itself in visible text, not only in the tooltip. -->
3724
+ <p class="save-hint" role="status" data-testid="save-hint">{{ hint }}</p>
3725
+ }
3726
+ </div>
3727
+ <ui-divider />
3728
+
3729
+ @if (systemTemplate()) {
3730
+ <div class="readonly-note system-note" role="note" data-testid="editor-system-note">
3731
+ <span>{{ systemNote() }}</span>
3732
+ @if (canCopySystem()) {
3733
+ <ui-button variant="secondary" size="sm" data-testid="editor-use-as-mine" (click)="useAsMine.emit()">{{ labels.t('emailTemplateEditor.useAsMyTemplate') }}</ui-button>
3734
+ }
3735
+ </div>
3736
+ } @else if (!canWrite()) {
3737
+ <p class="readonly-note" role="note" data-testid="editor-readonly-note">{{ readOnlyNote() }}</p>
3738
+ }
3739
+
3740
+ <!-- 3-Column Layout -->
3741
+ <div class="editor-body">
3742
+ <!-- LEFT PANEL: Details -->
3743
+ <aside class="panel-left" [attr.aria-label]="labels.t('emailTemplateEditor.templateDetails')">
3744
+ <h3 class="panel-title">{{ labels.t('common.details') }}</h3>
3745
+
3746
+ <div class="form-field">
3747
+ <ui-text-input [label]="labels.t('common.name')" [required]="true" [(ngModel)]="name" [readonly]="!canWrite()" [maxlength]="maxTextLength()"
3748
+ [placeholder]="namePlaceholder()" [error]="nameErrorShown()" [showErrors]="nameTouched()" (blurred)="nameTouched.set(true)" />
3749
+ </div>
3750
+
3751
+ <div class="form-field">
3752
+ <ui-text-input [label]="labels.t('common.subject')" [required]="true" [(ngModel)]="subject" [readonly]="!canWrite()" [maxlength]="maxTextLength()"
3753
+ [placeholder]="subjectPlaceholder()" [error]="subjectErrorShown()" [showErrors]="subjectTouched()" (blurred)="subjectTouched.set(true)">
3754
+ </ui-text-input>
3755
+ </div>
3756
+
3757
+ <div class="form-field">
3758
+ <ui-select [label]="labels.t('emailTemplateEditor.category')" [options]="categories()" [placeholder]="categoryPlaceholder()" [(ngModel)]="category" [disabled]="!canWrite()" />
3759
+ </div>
3760
+
3761
+ <ui-checkbox [label]="labels.t('emailTemplateEditor.useThisTemplateAllYear')" [(checked)]="useAllYear" [disabled]="!canWrite()" />
3762
+
3763
+ @if (!useAllYear()) {
3764
+ <div class="form-row-dates" (focusout)="datesTouched.set(true)">
3765
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeFrom')" [(ngModel)]="activeFrom" [disabled]="!canWrite()" />
3766
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeTo')" [(ngModel)]="activeTo" [disabled]="!canWrite()" [min]="activeFrom()" [error]="datesError()" />
3767
+ </div>
3768
+ }
3769
+
3770
+ <!-- Assignments -->
3771
+ @if (assignmentOptions().length > 0) {
3772
+ <div class="assignments-section">
3773
+ <h4 class="section-title">{{ labels.t('emailTemplateEditor.assignments') }}<span class="required" aria-hidden="true">*</span></h4>
3774
+ <p class="section-desc">{{ assignmentsDescription() }}</p>
3775
+ <ui-error [errorId]="idPrefix() + '-assignments-error'" [message]="assignmentErrorShown()" />
3776
+ <ui-search-input [placeholder]="labels.t('common.searchellipsis')" [ariaLabel]="labels.t('emailTemplateEditor.searchAssignments')" [(value)]="assignmentSearch" />
3777
+ @if (filteredAssignments().length === 0) {
3778
+ <ui-empty-state iconType="search" [title]="labels.t('emailTemplateEditor.noAssignmentsFound')" [message]="labels.t('emailTemplateEditor.noAssignmentsMatchYourSearch')" />
3779
+ }
3780
+ <div class="assignment-list" [hidden]="filteredAssignments().length === 0" (focusout)="onAssignmentsFocusOut($event)">
3781
+ @for (item of filteredAssignments(); track item.key) {
3782
+ <div class="assignment-item" [class.assignment-readonly]="!canWrite()" [attr.role]="canWrite() ? 'switch' : null" [attr.tabindex]="canWrite() ? 0 : null"
3783
+ [attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null"
3784
+ (click)="toggleAssignment(item)" (keydown.enter)="toggleAssignment(item); $event.preventDefault()" (keydown.space)="toggleAssignment(item); $event.preventDefault()">
3785
+ <div class="assignment-text">
3786
+ <strong>{{ item.name }}</strong>
3787
+ <span>{{ item.description }}</span>
3788
+ </div>
3789
+ <div class="assignment-channels">
3790
+ <span class="channel-badge" [class.active]="item.assigned" role="img" [attr.aria-label]="item.assigned ? labels.t('emailTemplateEditor.emailOn') : labels.t('emailTemplateEditor.emailOff')">
3791
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/></svg>
3792
+ </span>
3793
+ </div>
3794
+ </div>
3795
+ }
3796
+ </div>
3797
+ </div>
3798
+ }
3799
+ </aside>
3800
+
3801
+ <!-- CENTER: Editor -->
3802
+ <section class="panel-center" [attr.aria-label]="labels.t('emailTemplateEditor.emailDesign')">
3803
+ <div class="editor-tabs" role="tablist" [attr.aria-label]="labels.t('emailTemplateEditor.editorView')">
3804
+ <button type="button" class="editor-tab" role="tab" [class.active]="activeEditorTab() === 'edit'" [attr.aria-selected]="activeEditorTab() === 'edit'" (click)="setEditorTab('edit')">
3805
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"/></svg>{{ labels.t('common.edit') }}</button>
3806
+ <button type="button" class="editor-tab" role="tab" [class.active]="activeEditorTab() === 'preview'" [attr.aria-selected]="activeEditorTab() === 'preview'" (click)="setEditorTab('preview')">
3807
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>{{ labels.t('common.preview') }}</button>
3808
+ <button type="button" class="editor-tab" role="tab" [class.active]="activeEditorTab() === 'mobile'" [attr.aria-selected]="activeEditorTab() === 'mobile'" (click)="setEditorTab('mobile')">
3809
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"/><line x1="12" y1="18" x2="12.01" y2="18"/></svg>{{ labels.t('common.mobile') }}</button>
3810
+ </div>
3811
+
3812
+ @if (activeEditorTab() === 'edit') {
3813
+ @if (canWrite()) {
3814
+ <!-- Toolbar row 1: mousedown preventDefault keeps focus (and the selection) in the editor -->
3815
+ <div class="editor-toolbar" role="toolbar" [attr.aria-label]="labels.t('emailTemplateEditor.textFormatting')" (mousedown)="preventFocusLoss($event)">
3816
+ <div class="toolbar-group">
3817
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bold')" [uiTooltip]="labels.t('emailTemplateEditor.tipBold')" (click)="execCommand('bold')"><strong>B</strong></ui-button>
3818
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.italic')" [uiTooltip]="labels.t('emailTemplateEditor.tipItalic')" (click)="execCommand('italic')"><em>I</em></ui-button>
3819
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.underline')" [uiTooltip]="labels.t('emailTemplateEditor.tipUnderline')" (click)="execCommand('underline')"><u>U</u></ui-button>
3820
+ </div>
3821
+ <div class="toolbar-group">
3822
+ @for (k of [headingKey()]; track k) {
3823
+ <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.headingLevel')" [options]="headingOptions" ngModel="p"
3824
+ (mousedown)="saveSelection()" (ngModelChange)="onHeading($event)" />
3825
+ }
3826
+ </div>
3827
+ <div class="toolbar-group">
3828
+ @for (k of [sizeKey()]; track k) {
3829
+ <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.fontSize')" [placeholder]="labels.t('emailTemplateEditor.size')" [options]="fontSizeOptions" ngModel=""
3830
+ (mousedown)="saveSelection()" (ngModelChange)="onFontSize($event)" />
3831
+ }
3832
+ </div>
3833
+ <div class="toolbar-group">
3834
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignLeft')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignLeft')" (click)="execCommand('justifyLeft')">
3835
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>
3836
+ </ui-button>
3837
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignCenter')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignCenter')" (click)="execCommand('justifyCenter')">
3838
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="18" y1="10" x2="6" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="18" y1="18" x2="6" y2="18"/></svg>
3839
+ </ui-button>
3840
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignRight')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignRight')" (click)="execCommand('justifyRight')">
3841
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="21" y1="10" x2="7" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="7" y2="18"/></svg>
3842
+ </ui-button>
3843
+ </div>
3844
+ <div class="toolbar-group">
3845
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bulletedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipBulletedList')" (click)="execCommand('insertUnorderedList')">
3846
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
3847
+ </ui-button>
3848
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.numberedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipNumberedList')" (click)="execCommand('insertOrderedList')">
3849
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>
3850
+ </ui-button>
3851
+ </div>
3852
+ <div class="toolbar-group">
3853
+ <!-- The browser's own colour dialog is the picker; a button opens it so the toolbar keeps one look. -->
3854
+ <input #colorInput type="color" class="hidden-color-input" [attr.aria-label]="labels.t('emailTemplateEditor.textColor')" tabindex="-1" [value]="currentColor()" (change)="applyTextColor($any($event.target).value)" (mousedown)="$event.stopPropagation()" />
3855
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.textColor')" [uiTooltip]="labels.t('emailTemplateEditor.tipTextColor')" (mousedown)="openColorPicker()">
3856
+ <span class="color-indicator">
3857
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><text y="20" font-size="20" font-weight="700">A</text></svg>
3858
+ <span class="color-bar" [style.background]="currentColor()"></span>
3859
+ </span>
3860
+ </ui-button>
3861
+ </div>
3862
+ <div class="toolbar-group">
3863
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertLink')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertLink')" (mousedown)="saveSelection()" (click)="openLinkDialog()">
3864
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
3865
+ </ui-button>
3866
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertImage')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertImage')" (mousedown)="saveSelection()" (click)="openImageDialog()">
3867
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
3868
+ </ui-button>
3869
+ </div>
3870
+ <div class="toolbar-group">
3871
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.undo')" [uiTooltip]="labels.t('emailTemplateEditor.tipUndo')" (click)="execCommand('undo')">
3872
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6.69 3L3 13"/></svg>
3873
+ </ui-button>
3874
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.redo')" [uiTooltip]="labels.t('emailTemplateEditor.tipRedo')" (click)="execCommand('redo')">
3875
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6.69 3L21 13"/></svg>
3876
+ </ui-button>
3877
+ </div>
3878
+ </div>
3879
+
3880
+ <!-- Toolbar row 2: block spacing -->
3881
+ <div class="toolbar-row-2">
3882
+ <div class="toolbar-group" (mousedown)="preventFocusLoss($event)">
3883
+ <span class="toolbar-label" id="tpl-spacing-label">{{ labels.t('emailTemplateEditor.blockSpacing') }}</span>
3884
+ <ui-pill-tabs [tabs]="spacingTabs" [activeKey]="blockSpacing() || 'none'" [ariaLabel]="labels.t('emailTemplateEditor.blockSpacing')" (tabChange)="applySpacing($event === 'none' ? '' : $event)" />
3885
+ </div>
3886
+ </div>
3887
+ }
3888
+
3889
+ <!-- Link dialog (inline popover) -->
3890
+ @if (canWrite() && showLinkDialog()) {
3891
+ <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertLink')">
3892
+ <div class="link-dialog-inner">
3893
+ <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.insertLink2') }}</span>
3894
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkAddress')" placeholder="https://example.com" [(ngModel)]="linkUrl" [error]="linkUrlError()" (keydown.enter)="insertLink()" />
3895
+ @if (!linkTextFromSelection()) {
3896
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkText')" [placeholder]="labels.t('emailTemplateEditor.linkTextOptional')" [(ngModel)]="linkText" (keydown.enter)="insertLink()" />
3897
+ }
3898
+ <div class="link-dialog-actions">
3899
+ <ui-button variant="secondary" size="sm" (click)="showLinkDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
3900
+ <ui-button variant="primary" size="sm" [disabled]="!canInsertLink()" (click)="insertLink()">{{ labels.t('common.insert') }}</ui-button>
3901
+ </div>
3902
+ </div>
3903
+ </div>
3904
+ }
3905
+
3906
+ <!-- Image URL dialog -->
3907
+ @if (canWrite() && showImageDialog()) {
3908
+ <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertImage')">
3909
+ <div class="link-dialog-inner">
3910
+ <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.insertImage2') }}</span>
3911
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAddress')" placeholder="https://example.com/image.jpg" [(ngModel)]="imageUrl" [error]="imageUrlError()" (keydown.enter)="insertImageFromUrl()" />
3912
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAltText')" [placeholder]="labels.t('emailTemplateEditor.altTextOptional')" [(ngModel)]="imageAlt" (keydown.enter)="insertImageFromUrl()" />
3913
+ <div class="link-dialog-actions">
3914
+ <ui-button variant="secondary" size="sm" (click)="showImageDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
3915
+ <ui-button variant="primary" size="sm" [disabled]="!canInsertImage()" (click)="insertImageFromUrl()">{{ labels.t('common.insert') }}</ui-button>
3916
+ </div>
3917
+ </div>
3918
+ </div>
3919
+ }
3920
+
3921
+ <ui-error [errorId]="idPrefix() + '-body-error'" [message]="bodyErrorShown()" />
3922
+
3923
+ <!-- Block Canvas with DnD -->
3924
+ <div class="blocks-canvas" (dragover)="onCanvasDragOver($event)" (drop)="onDropZoneDrop($event, blocks().length)" (focusout)="onBodyFocusOut($event)">
3925
+ <!-- Initial drop zone (before first block) -->
3926
+ <div class="drop-zone" [class.active]="dragOverIndex() === 0" (dragover)="onDropZoneDragOver($event, 0)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, 0)">
3927
+ <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
3928
+ </div>
3929
+
3930
+ @for (block of blocks(); track block.id; let i = $index) {
3931
+ <div class="block-wrapper" #blockWrapper [class.selected]="selectedBlockId() === block.id" [class.dragging]="dragFromCanvas() === i" (dragend)="onBlockDragEnd()">
3932
+ @if (canWrite()) {
3933
+ <!-- Only the handle is draggable: a draggable ancestor of the contenteditable breaks text selection in Firefox / Safari. Move up / down below are the keyboard and touch alternative. -->
3934
+ <div class="block-drag-handle" [attr.title]="labels.t('emailTemplateEditor.dragToReorder')" draggable="true" (dragstart)="onBlockDragStart($event, i, blockWrapper)">
3935
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
3936
+ </div>
3937
+ }
3938
+
3939
+ <!-- Block content (contenteditable, initialised ONCE after render so Angular never rewrites it and the caret never jumps) -->
3940
+ <div #blockEditor class="block-content" role="textbox" aria-multiline="true" [attr.aria-label]="labels.t('emailTemplateEditor.emailBlockN', { n: i + 1 })"
3941
+ [attr.data-block-id]="block.id" [attr.data-placeholder]="i === 0 ? startPlaceholder() : labels.t('emailTemplateEditor.clickToEdit')" [attr.contenteditable]="canWrite() ? 'true' : 'false'"
3942
+ (input)="onBlockInput($event, block)" (beforeinput)="onBlockBeforeInput($any($event))" (focus)="onBlockFocus(block)" (click)="selectedBlockId.set(block.id)"></div>
3943
+
3944
+ @if (canWrite()) {
3945
+ <div class="block-controls">
3946
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockUp')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveUp')" [disabled]="i === 0" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, -1)">
3947
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M18 15l-6-6-6 6"/></svg>
3948
+ </ui-button>
3949
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockDown')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveDown')" [disabled]="i === blocks().length - 1" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, 1)">
3950
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
3951
+ </ui-button>
3952
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.duplicateBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDuplicate')" (mousedown)="preventFocusLoss($event)" (click)="duplicateBlock(i)">
3953
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
3954
+ </ui-button>
3955
+ @if (blocks().length > 1) {
3956
+ <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.deleteBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDeleteBlock')" (mousedown)="preventFocusLoss($event)" (click)="deleteBlock(i)">
3957
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6M14 11v6"/></svg>
3958
+ </ui-button>
3959
+ }
3960
+ </div>
3961
+ }
3962
+ </div>
3963
+
3964
+ <!-- Drop zone after each block -->
3965
+ <div class="drop-zone" [class.active]="dragOverIndex() === i + 1" (dragover)="onDropZoneDragOver($event, i + 1)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, i + 1)">
3966
+ <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
3967
+ </div>
3968
+ }
3969
+
3970
+ @if (canWrite()) {
3971
+ <button type="button" class="add-block-btn" (click)="addBlock('text-block')">
3972
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>{{ labels.t('emailTemplateEditor.addBlock') }}</button>
3973
+ }
3974
+ </div>
3975
+ }
3976
+
3977
+ @if (activeEditorTab() === 'preview') {
3978
+ <div class="preview-frame">
3979
+ <iframe class="preview-content" [attr.title]="labels.t('emailTemplateEditor.emailPreview')" sandbox="" referrerpolicy="no-referrer" [srcdoc]="previewDoc()"></iframe>
3980
+ </div>
3981
+ }
3982
+
3983
+ @if (activeEditorTab() === 'mobile') {
3984
+ <div class="preview-frame mobile">
3985
+ <div class="mobile-shell">
3986
+ <iframe class="preview-content" [attr.title]="labels.t('emailTemplateEditor.mobileEmailPreview')" sandbox="" referrerpolicy="no-referrer" [srcdoc]="previewDoc()"></iframe>
3987
+ </div>
3988
+ </div>
3989
+ }
3990
+ </section>
3991
+
3992
+ <!-- RIGHT PANEL: Blocks, Variables, Video (the word video appears only while the Video tab is on) -->
3993
+ <aside class="panel-right" [attr.aria-label]="videosEnabled() ? labels.t('emailTemplateEditor.rightPanelWithVideo') : labels.t('emailTemplateEditor.rightPanel')">
3994
+ @if (!canWrite()) {
3995
+ <div class="right-panel-body" data-testid="tpl-readonly-tools-note">
3996
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.readOnly') }}</h4>
3997
+ <p class="right-section-hint">{{ videosEnabled() ? labels.t('emailTemplateEditor.readOnlyToolsWithVideo') : labels.t('emailTemplateEditor.readOnlyTools') }}</p>
3998
+ </div>
3999
+ } @else {
4000
+ <div class="right-tabs" role="tablist" [attr.aria-label]="labels.t('emailTemplateEditor.rightPanelSections')">
4001
+ <button type="button" class="right-tab" role="tab" [class.active]="activeRightTab() === 'blocks'" [attr.aria-selected]="activeRightTab() === 'blocks'" (click)="activeRightTab.set('blocks')">
4002
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>{{ labels.t('emailTemplateEditor.blocks') }}</button>
4003
+ <button type="button" class="right-tab" role="tab" [class.active]="activeRightTab() === 'variables'" [attr.aria-selected]="activeRightTab() === 'variables'" (click)="activeRightTab.set('variables')">
4004
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 3v18M3 12h18"/></svg>{{ labels.t('emailTemplateEditor.variables') }}</button>
4005
+ @if (videosEnabled()) {
4006
+ <button type="button" class="right-tab" role="tab" [class.active]="activeRightTab() === 'video'" [attr.aria-selected]="activeRightTab() === 'video'" (click)="openVideoTab()">
4007
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg>{{ labels.t('common.video') }}</button>
4008
+ }
4009
+ </div>
4010
+
4011
+ @if (activeRightTab() === 'blocks') {
4012
+ <div class="right-panel-body">
4013
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.contentBlocks') }}</h4>
4014
+ <p class="right-section-desc">{{ labels.t('emailTemplateEditor.clickToInsertOrDrag') }}</p>
4015
+ <ui-search-input [placeholder]="labels.t('emailTemplateEditor.searchBlocks')" [ariaLabel]="labels.t('emailTemplateEditor.searchBlocks2')" [(value)]="blockSearch" />
4016
+
4017
+ @if (filteredBlockGroups().length === 0) {
4018
+ <ui-empty-state iconType="search" [title]="labels.t('emailTemplateEditor.noBlocksFound')" [message]="labels.t('emailTemplateEditor.noBlocksMatchYourSearch')" />
4019
+ }
4020
+ @for (group of filteredBlockGroups(); track group.name) {
4021
+ <div class="block-group">
4022
+ <button type="button" class="block-group-header" [attr.aria-expanded]="isOpen('b:' + group.name)" (click)="toggleGroup('b:' + group.name)">
4023
+ <svg class="chevron" [class.expanded]="isOpen('b:' + group.name)" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
4024
+ <span>{{ group.name }}</span>
4025
+ <span class="block-count">{{ group.blocks.length }}</span>
4026
+ </button>
4027
+ @if (isOpen('b:' + group.name)) {
4028
+ <div class="block-list">
4029
+ @for (block of group.blocks; track block.key) {
4030
+ <!-- A div, not a button: Firefox does not start a drag from a <button>. Role, tabindex and Enter / Space keep it a keyboard control; a click inserts the block. -->
4031
+ <div role="button" tabindex="0" class="block-item" draggable="true" [attr.aria-label]="labels.t('emailTemplateEditor.insertNamed', { name: block.label })"
4032
+ (dragstart)="onPaletteDragStart($event, block)" (dragend)="onBlockDragEnd()" (click)="insertBlock(block)"
4033
+ (keydown.enter)="insertBlock(block); $event.preventDefault()" (keydown.space)="insertBlock(block); $event.preventDefault()">
4034
+ <svg class="block-item-drag" width="10" height="10" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
4035
+ {{ block.label }}
4036
+ </div>
4037
+ }
4038
+ </div>
4039
+ }
4040
+ </div>
4041
+ }
4042
+ </div>
4043
+ }
4044
+
4045
+ @if (activeRightTab() === 'variables') {
4046
+ <div class="right-panel-body">
4047
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.templateVariables') }}</h4>
4048
+ <p class="right-section-desc">{{ labels.t('emailTemplateEditor.clickAVariableToInsert') }}</p>
4049
+
4050
+ @for (group of variableGroups(); track group.name) {
4051
+ <div class="block-group">
4052
+ <button type="button" class="block-group-header" [attr.aria-expanded]="isOpen('v:' + group.name)" (click)="toggleGroup('v:' + group.name)">
4053
+ <svg class="chevron" [class.expanded]="isOpen('v:' + group.name)" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
4054
+ <span>{{ group.name }}</span>
4055
+ <span class="block-count">{{ group.variables.length }}</span>
4056
+ </button>
4057
+ @if (isOpen('v:' + group.name)) {
4058
+ <div class="variable-list">
4059
+ @for (v of group.variables; track v.key) {
4060
+ <button type="button" class="variable-item" (mousedown)="saveSelection()" (click)="insertVariable(v)">
4061
+ <span class="var-tag">{{ '{{' + v.key + '}}' }}</span>
4062
+ <span class="var-example">{{ labels.t('emailTemplateEditor.example', { example: v.example }) }}</span>
4063
+ <!-- A very short explanation of what the variable is: the host's description, else its label. -->
4064
+ <span class="var-description">{{ v.description || v.label }}</span>
4065
+ </button>
4066
+ }
4067
+ </div>
4068
+ }
4069
+ </div>
4070
+ }
4071
+ </div>
4072
+ }
4073
+
4074
+ @if (activeRightTab() === 'video' && videosEnabled()) {
4075
+ <div class="right-panel-body video-library-panel">
4076
+ <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.videoLibrary') }}</h4>
4077
+ <p class="right-section-hint">{{ labels.t('emailTemplateEditor.clickAVideoToAdd') }}</p>
4078
+
4079
+ <div class="video-config-section">
4080
+ <ui-radio-group [label]="labels.t('emailTemplateEditor.playback')" orientation="horizontal" [options]="playbackOptions" [ngModel]="videoAutoplay() ? 'autoplay' : 'click'" (ngModelChange)="videoAutoplay.set($event === 'autoplay')" />
4081
+ </div>
4082
+ <div class="video-config-section">
4083
+ <ui-text-input [label]="labels.t('emailTemplateEditor.caption')" [placeholder]="labels.t('emailTemplateEditor.eGClickToWatch')" [maxlength]="200" [(ngModel)]="videoCaption" />
4084
+ </div>
4085
+ <div class="video-config-section">
4086
+ <ui-select [label]="labels.t('emailTemplateEditor.callToAction')" [options]="ctaTypeOptions" [(ngModel)]="videoCtaType" />
4087
+ @if (videoCtaType()) {
4088
+ <ui-text-input [ariaLabel]="labels.t('emailTemplateEditor.callToActionAddress')" type="url" placeholder="https://..." [(ngModel)]="videoCtaUrl" />
4089
+ <ui-text-input [ariaLabel]="labels.t('emailTemplateEditor.callToActionButtonLabel')" [placeholder]="labels.t('emailTemplateEditor.buttonLabel')" [maxlength]="100" [(ngModel)]="videoCtaLabel" />
4090
+ }
4091
+ </div>
4092
+ <div class="video-config-section">
4093
+ <ui-checkbox [label]="labels.t('emailTemplateEditor.hideReactions')" [(checked)]="videoHideReactions" />
4094
+ </div>
4095
+
4096
+ @if (videosLoading()) {
4097
+ <div class="video-lib-loading" role="status" aria-busy="true" [attr.aria-label]="labels.t('emailTemplateEditor.loadingVideos')">
4098
+ @for (n of [1, 2, 3]; track n) {
4099
+ <div class="video-lib-skeleton">
4100
+ <ui-skeleton [height]="40" width="56px" [radius]="6" />
4101
+ <div class="vls-info"><ui-skeleton [height]="10" width="75%" [radius]="5" /><ui-skeleton [height]="10" width="45%" [radius]="5" /></div>
4102
+ </div>
4103
+ }
4104
+ </div>
4105
+ } @else if (videoList().length === 0) {
4106
+ <ui-empty-state iconType="video" [title]="labels.t('emailTemplateEditor.noVideosCreated')" [message]="noVideosHint()" />
4107
+ } @else {
4108
+ <div class="video-lib-list">
4109
+ @for (video of videoList(); track video.id) {
4110
+ <button type="button" class="video-lib-item" [class.selected]="video.id === videoId()" [attr.aria-pressed]="video.id === videoId()" (click)="insertVideo(video)">
4111
+ <span class="vli-thumb">
4112
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#94a3b8" stroke-width="1.5" aria-hidden="true"><polygon points="5 3 19 12 5 21 5 3"/></svg>
4113
+ @if (video.durationSeconds) {
4114
+ <span class="vli-dur">{{ formatDuration(video.durationSeconds) }}</span>
4115
+ }
4116
+ </span>
4117
+ <span class="vli-info">
4118
+ <span class="vli-title">{{ video.title }}</span>
4119
+ <span class="vli-cat">{{ categoryLabel(video.category) }}</span>
4120
+ </span>
4121
+ @if (video.id === videoId()) {
4122
+ <svg class="vli-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2.5" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>
4123
+ }
4124
+ </button>
4125
+ }
4126
+ </div>
4127
+ }
4128
+ </div>
4129
+ }
4130
+ }
4131
+ </aside>
4132
+ </div>
4133
+ </div>
4134
+
4135
+ <!-- Test Send -->
4136
+ <ui-side-panel [open]="showTestSendDialog()" [title]="labels.t('emailTemplateEditor.sendTestEmail')" [primaryLabel]="labels.t('emailTemplateEditor.sendTest')" [primaryLoading]="testSending()" [primaryDisabled]="!canSendTest()"
4137
+ (closed)="showTestSendDialog.set(false)" (primaryClick)="onTestSend()">
4138
+ <p class="config-desc">{{ labels.t('emailTemplateEditor.sendThisTemplateToAn') }}</p>
4139
+ @if (!editingId()) {
4140
+ <div class="test-save-note">
4141
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>{{ labels.t('emailTemplateEditor.saveTheTemplateFirstBefore') }}</div>
4142
+ }
4143
+ <div class="config-field config-field-mt">
4144
+ <ui-text-input [label]="labels.t('emailTemplateEditor.recipientEmail')" type="email" placeholder="you@example.com" [(ngModel)]="testSendEmail" [error]="testEmailError()" (keydown.enter)="onTestSend()" />
4145
+ </div>
4146
+ @if (hasUnsavedChanges()) {
4147
+ <div class="test-save-note" role="note" data-testid="test-unsaved-note">{{ labels.t('emailTemplateEditor.youHaveUnsavedChangesThe') }}</div>
4148
+ }
4149
+ </ui-side-panel>
4150
+
4151
+
4152
+ `,
4153
+ styles: [":host{display:flex;flex-direction:column;flex:1;min-height:0}.required{color:#ef4444;font-weight:400}.editor-page{display:flex;flex-direction:column;flex:1;min-height:0;background:#f8fafc;overflow:hidden}.editor-actions{display:flex;justify-content:space-between;align-items:center;gap:8px 16px;flex-wrap:wrap;padding:0 0 12px;flex-shrink:0}.editor-heading{margin:0;font-size:1.25rem;font-weight:700;color:#1e293b;line-height:1.3;min-width:0}.save-wrap{display:inline-flex}.save-hint{margin:0;font-size:12px;color:#475569;flex-basis:100%;text-align:right}.editor-actions-buttons{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-left:auto}.readonly-note{margin:0;padding:8px 16px;font-size:.8125rem;color:#92400e;background:#fffbeb;border-bottom:1px solid #fde68a}.readonly-note.system-note{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.editor-body{display:grid;grid-template-columns:340px minmax(0,1fr) 300px;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden}.panel-left{background:#fff;border-right:1px solid #e2e8f0;padding:24px;overflow-y:auto}.panel-title{font-size:1.0625rem;font-weight:700;color:#1e293b;margin:0 0 20px}.form-field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}.form-row-dates{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:16px}.assignments-section{border-top:1px solid #e2e8f0;padding-top:20px;margin-top:16px}.section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 6px}.section-desc{font-size:.8125rem;color:#64748b;line-height:1.5;margin:0 0 12px}.assignment-list{max-height:340px;overflow-y:auto;margin-top:12px;border:1px solid #e2e8f0;border-radius:8px}.assignment-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;cursor:pointer;border-bottom:1px solid #f1f5f9;transition:background .1s}.assignment-item:last-child{border-bottom:none}.assignment-item:hover{background:#f8fafc}.assignment-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.assignment-item.assignment-readonly{cursor:default}.assignment-item.assignment-readonly:hover{background:transparent}.assignment-text{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.assignment-text strong{font-size:.8125rem;color:#1e293b}.assignment-text span{font-size:.75rem;color:#64748b}.assignment-channels{display:flex;gap:4px;flex-shrink:0}.channel-badge{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;background:#f1f5f9;color:#64748b;transition:all .15s}.channel-badge.active{background:#3b82f6;color:#fff}.channel-badge.disabled{opacity:.4;cursor:not-allowed}.config-desc{font-size:.875rem;color:#64748b;line-height:1.5;margin:0}.config-divider{border:none;border-top:1px solid #e2e8f0;margin:20px 0}.config-section{display:flex;flex-direction:column;gap:12px}.config-section-label{font-size:.6875rem;font-weight:700;color:#3b82f6;text-transform:uppercase;letter-spacing:.04em}.config-field{display:flex;flex-direction:column;gap:6px}.config-field-mt{margin-top:16px}.config-label{font-size:.8125rem;font-weight:600;color:#1e293b}.config-readonly{padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:.875rem;color:#1e293b}.config-hint{font-size:.75rem;color:#64748b}.test-save-note{display:flex;align-items:center;gap:8px;padding:10px 14px;background:#fef3c7;border:1px solid #fcd34d;border-radius:8px;font-size:.8125rem;color:#92400e;margin-top:12px}.test-save-note svg{flex-shrink:0}.panel-center{display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}.editor-tabs{display:flex;gap:2px;padding:12px 20px 0;background:#fff;border-bottom:1px solid #e2e8f0;overflow-x:auto;-webkit-overflow-scrolling:touch}.editor-tab{display:flex;align-items:center;gap:6px;padding:10px 16px;border:1px solid #e2e8f0;border-bottom:none;border-radius:8px 8px 0 0;background:#f8fafc;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;white-space:nowrap}.editor-tab:hover{background:#fff;color:#1e293b}.editor-tab.active{background:#eff6ff;color:#1d4ed8;border-color:#93c5fd}.editor-tab:focus-visible,.right-tab:focus-visible,.block-group-header:focus-visible,.variable-item:focus-visible,.add-block-btn:focus-visible,.block-item:focus-visible,.video-lib-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.editor-toolbar{display:flex;align-items:center;gap:8px;padding:10px 20px;background:#fff;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}.toolbar-row-2{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 20px;background:#fff;border-bottom:1px solid #e2e8f0}.toolbar-group{display:flex;align-items:center;gap:2px;padding-right:8px;border-right:1px solid #e2e8f0}.toolbar-group:last-child{border-right:none;padding-right:0}.toolbar-select{display:block;min-width:96px}.toolbar-label{font-size:.75rem;font-weight:600;color:#64748b;white-space:nowrap;margin-right:6px}.hidden-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none;border:none;padding:0}.color-indicator{display:flex;flex-direction:column;align-items:center;gap:2px;color:#475569}.color-bar{display:block;width:16px;height:3px;border-radius:2px;border:1px solid rgba(0,0,0,.1)}.link-dialog{background:#fff;border-bottom:1px solid #e2e8f0;padding:12px 20px}.link-dialog-inner{display:flex;align-items:flex-start;gap:8px;flex-wrap:wrap}.link-dialog-title{font-size:.8125rem;font-weight:700;color:#1e293b;white-space:nowrap;padding-top:10px}.link-dialog-input{display:block;width:240px;max-width:100%}.link-dialog-actions{display:flex;gap:6px}.preview-frame{flex:1;display:flex;justify-content:center;align-items:stretch;padding:24px;overflow-y:auto;background:#f1f5f9}.preview-frame.mobile{align-items:flex-start}.preview-content{display:block;flex:1 1 auto;max-width:600px;width:100%;box-sizing:border-box;min-height:400px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.mobile-shell{width:375px;max-width:100%;box-sizing:border-box;min-height:600px;border:2px solid #1e293b;border-radius:24px;padding:40px 12px 24px;background:#fff;box-shadow:0 8px 32px #0000001f}.mobile-shell .preview-content{border:none;border-radius:0;max-width:100%;height:520px;min-height:0}.blocks-canvas{flex:1 1 0;min-height:0;padding:16px 20px 24px 56px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#f1f5f9;display:flex;flex-direction:column}.block-wrapper{flex-shrink:0;position:relative;display:flex;align-items:flex-start;background:#fff;border:2px solid transparent;border-radius:8px;transition:border-color .15s,box-shadow .15s}.block-wrapper:hover,.block-wrapper.selected,.block-wrapper:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.block-wrapper:hover .block-drag-handle,.block-wrapper.selected .block-drag-handle,.block-wrapper:focus-within .block-drag-handle{opacity:1}.block-wrapper:hover .block-controls,.block-wrapper.selected .block-controls,.block-wrapper:focus-within .block-controls{opacity:1;pointer-events:all}.block-wrapper.dragging{opacity:.4}.block-drag-handle{flex-shrink:0;width:28px;display:flex;align-items:flex-start;justify-content:center;padding-top:14px;opacity:0;transition:opacity .15s;cursor:grab;color:#94a3b8}.block-drag-handle:active{cursor:grabbing}.block-content{flex:1;min-width:0;padding:12px 16px;outline:none;font-size:.9375rem;color:#1e293b;line-height:1.6;min-height:48px;overflow-wrap:anywhere}.block-content:empty:before{content:attr(data-placeholder);color:#64748b;font-style:italic;pointer-events:none}.block-content p{margin:0 0 8px}.block-content p:last-child{margin:0}.block-content h1,.block-content h2,.block-content h3{margin:8px 0 6px;color:#1e293b}.block-content a{color:#3b82f6}.block-content img{max-width:100%;border-radius:6px}.block-content ul,.block-content ol{padding-left:20px;margin:0 0 8px}.block-controls{position:absolute;top:0;left:-48px;flex-direction:column;display:flex;gap:2px;opacity:0;pointer-events:none;transition:opacity .15s;background:#fff;border:1px solid #e2e8f0;border-radius:6px;padding:3px;box-shadow:0 2px 6px #00000014}@media(pointer:coarse){.editor-tab,.right-tab,.block-group-header{min-height:44px}}@media(hover:none){.block-wrapper.selected .block-controls{opacity:1;pointer-events:all}}.drop-zone{flex-shrink:0;height:8px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:height .15s,background .15s;position:relative}.drop-zone-label{font-size:.75rem;font-weight:600;color:#1d4ed8;opacity:0;transition:opacity .1s}.drop-zone.active{height:40px;background:#3b82f614;border:2px dashed #3b82f6}.drop-zone.active .drop-zone-label{opacity:1}.add-block-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:44px;padding:12px;margin-top:8px;border:2px dashed #e2e8f0;border-radius:8px;background:none;font-size:.875rem;font-weight:600;color:#475569;cursor:pointer;font-family:inherit;transition:border-color .15s,color .15s,background .15s}.add-block-btn:hover{border-color:#3b82f6;color:#3b82f6;background:#3b82f60a}.panel-right{background:#fff;border-left:1px solid #e2e8f0;display:flex;flex-direction:column;min-height:0;min-width:0}.right-tabs{display:flex;border-bottom:1px solid #e2e8f0}.right-tab{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:12px;min-height:44px;border:none;background:none;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;border-bottom:2px solid transparent}.right-tab:hover{color:#1e293b}.right-tab.active{color:#1d4ed8;background:#eff6ff;border-bottom-color:#3b82f6}.right-panel-body{flex:1;padding:20px;overflow-y:auto}.right-section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 12px}.right-section-desc{font-size:.8125rem;color:#64748b;margin:0 0 16px;line-height:1.5}.right-section-hint{font-size:.8125rem;color:#64748b;margin:0 0 12px;line-height:1.5}.block-group{border-bottom:1px solid #f1f5f9}.block-group-header{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:12px 0;border:none;background:none;font-size:.875rem;font-weight:600;color:#1e293b;cursor:pointer;font-family:inherit;text-align:left}.block-group-header .chevron{transition:transform .2s;color:#94a3b8}.block-group-header .chevron.expanded{transform:rotate(90deg)}.block-group-header span:nth-of-type(1){flex:1}.block-count{font-size:.75rem;font-weight:600;color:#475569;background:#f1f5f9;padding:2px 8px;border-radius:10px;margin-left:auto}.block-list{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}.variable-list{display:flex;flex-direction:column;padding-bottom:8px}.variable-item+.variable-item{border-top:1px solid #f1f5f9;border-radius:0}.block-item{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;min-height:44px;padding:8px 0;font-size:.8125rem;color:#64748b;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit;-webkit-user-select:none;user-select:none}.block-item:hover{background:#f8fafc;color:#1e293b}.block-item-drag{color:#cbd5e1;flex-shrink:0;cursor:grab}.variable-item{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-height:44px;padding:8px 0;min-width:0;width:100%;box-sizing:border-box;border:none;background:none;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit}.variable-item:hover{background:#f8fafc}.var-tag{max-width:100%;overflow-wrap:anywhere;font-size:.75rem;font-weight:600;color:#1d4ed8;background:#3b82f614;padding:2px 6px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.var-example{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.var-description{font-size:.75rem;color:#64748b;line-height:1.4;overflow-wrap:anywhere}.video-library-panel{padding:0}.video-library-panel .right-section-title,.video-library-panel .right-section-hint{padding:0 16px}.video-library-panel .right-section-title{padding-top:16px}.video-config-section{display:flex;flex-direction:column;gap:8px;padding:12px 16px;border-bottom:1px solid #f1f5f9}.video-config-section:last-of-type{border-bottom:none}.video-lib-list{display:flex;flex-direction:column;gap:2px;padding:8px 8px 16px}.video-lib-item{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:8px;border:1px solid transparent;border-radius:8px;background:none;cursor:pointer;text-align:left;font-family:inherit;transition:background .15s,border-color .15s}.video-lib-item:hover{background:#f8fafc;border-color:#e2e8f0}.video-lib-item.selected{background:#eff6ff;border-color:#93c5fd}.vli-thumb{position:relative;flex-shrink:0;width:56px;height:40px;border-radius:6px;background:linear-gradient(135deg,#f1f5f9,#e2e8f0);display:flex;align-items:center;justify-content:center}.vli-dur{position:absolute;bottom:2px;right:3px;font-size:.625rem;font-weight:600;color:#fff;background:#000000a6;padding:1px 4px;border-radius:3px}.vli-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.vli-title{font-size:.8125rem;font-weight:600;color:#1e293b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vli-cat{font-size:.75rem;color:#475569}.vli-check{flex-shrink:0}.video-lib-loading{padding:8px}.video-lib-skeleton{display:flex;align-items:center;gap:10px;padding:8px;margin-bottom:4px}.vls-info{flex:1;display:flex;flex-direction:column;gap:6px}@media(max-width:1200px){.editor-body{grid-template-columns:280px minmax(0,1fr) 260px}}@media(max-width:900px){:host{flex:none}.editor-page{flex:none;min-height:100vh;min-height:100dvh;overflow:visible}.editor-body{display:flex;flex-direction:column;flex:none;overflow:visible}.panel-left{border-right:none;border-bottom:1px solid #e2e8f0;overflow:visible;padding:16px}.panel-center{overflow:visible;min-height:480px}.blocks-canvas{overflow:visible;min-height:320px}.panel-right{border-left:none;border-top:1px solid #e2e8f0}.right-panel-body{overflow:visible}.editor-toolbar,.toolbar-row-2,.link-dialog,.editor-tabs{padding-left:12px;padding-right:12px}.preview-frame{padding:12px}.form-row-dates{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){*{transition:none!important}}\n"]
4154
+ }]
4155
+ }],
4156
+ ctorParameters: () => [],
4157
+ propDecorators: {
4158
+ template: [{
4159
+ type: i0.Input,
4160
+ args: [{
4161
+ isSignal: true,
4162
+ alias: "template",
4163
+ required: false
4164
+ }]
4165
+ }],
4166
+ categories: [{
4167
+ type: i0.Input,
4168
+ args: [{
4169
+ isSignal: true,
4170
+ alias: "categories",
4171
+ required: false
4172
+ }]
4173
+ }],
4174
+ categoryPlaceholderInput: [{
4175
+ type: i0.Input,
4176
+ args: [{
4177
+ isSignal: true,
4178
+ alias: "categoryPlaceholder",
4179
+ required: false
4180
+ }]
4181
+ }],
4182
+ assignmentOptions: [{
4183
+ type: i0.Input,
4184
+ args: [{
4185
+ isSignal: true,
4186
+ alias: "assignmentOptions",
4187
+ required: false
4188
+ }]
4189
+ }],
4190
+ featuredAssignmentKey: [{
4191
+ type: i0.Input,
4192
+ args: [{
4193
+ isSignal: true,
4194
+ alias: "featuredAssignmentKey",
4195
+ required: false
4196
+ }]
4197
+ }],
4198
+ assignmentsDescriptionInput: [{
4199
+ type: i0.Input,
4200
+ args: [{
4201
+ isSignal: true,
4202
+ alias: "assignmentsDescription",
4203
+ required: false
4204
+ }]
4205
+ }],
4206
+ variableGroupsInput: [{
4207
+ type: i0.Input,
4208
+ args: [{
4209
+ isSignal: true,
4210
+ alias: "variableGroups",
4211
+ required: false
4212
+ }]
4213
+ }],
4214
+ blockGroupsInput: [{
4215
+ type: i0.Input,
4216
+ args: [{
4217
+ isSignal: true,
4218
+ alias: "blockGroups",
4219
+ required: false
4220
+ }]
4221
+ }],
4222
+ heading: [{
4223
+ type: i0.Input,
4224
+ args: [{
4225
+ isSignal: true,
4226
+ alias: "heading",
4227
+ required: false
4228
+ }]
4229
+ }],
4230
+ namePlaceholderInput: [{
4231
+ type: i0.Input,
4232
+ args: [{
4233
+ isSignal: true,
4234
+ alias: "namePlaceholder",
4235
+ required: false
4236
+ }]
4237
+ }],
4238
+ subjectPlaceholderInput: [{
4239
+ type: i0.Input,
4240
+ args: [{
4241
+ isSignal: true,
4242
+ alias: "subjectPlaceholder",
4243
+ required: false
4244
+ }]
4245
+ }],
4246
+ systemNoteInput: [{
4247
+ type: i0.Input,
4248
+ args: [{
4249
+ isSignal: true,
4250
+ alias: "systemNote",
4251
+ required: false
4252
+ }]
4253
+ }],
4254
+ readOnlyNoteInput: [{
4255
+ type: i0.Input,
4256
+ args: [{
4257
+ isSignal: true,
4258
+ alias: "readOnlyNote",
4259
+ required: false
4260
+ }]
4261
+ }],
4262
+ idPrefix: [{
4263
+ type: i0.Input,
4264
+ args: [{
4265
+ isSignal: true,
4266
+ alias: "idPrefix",
4267
+ required: false
4268
+ }]
4269
+ }],
4270
+ maxBodyLength: [{
4271
+ type: i0.Input,
4272
+ args: [{
4273
+ isSignal: true,
4274
+ alias: "maxBodyLength",
4275
+ required: false
4276
+ }]
4277
+ }],
4278
+ maxTextLength: [{
4279
+ type: i0.Input,
4280
+ args: [{
4281
+ isSignal: true,
4282
+ alias: "maxTextLength",
4283
+ required: false
4284
+ }]
4285
+ }],
4286
+ fullAccess: [{
4287
+ type: i0.Input,
4288
+ args: [{
4289
+ isSignal: true,
4290
+ alias: "fullAccess",
4291
+ required: false
4292
+ }]
4293
+ }],
4294
+ systemTemplate: [{
4295
+ type: i0.Input,
4296
+ args: [{
4297
+ isSignal: true,
4298
+ alias: "systemTemplate",
4299
+ required: false
4300
+ }]
4301
+ }],
4302
+ testSendEnabled: [{
4303
+ type: i0.Input,
4304
+ args: [{
4305
+ isSignal: true,
4306
+ alias: "testSendEnabled",
4307
+ required: false
4308
+ }]
4309
+ }],
4310
+ saving: [{
4311
+ type: i0.Input,
4312
+ args: [{
4313
+ isSignal: true,
4314
+ alias: "saving",
4315
+ required: false
4316
+ }]
4317
+ }],
4318
+ testSending: [{
4319
+ type: i0.Input,
4320
+ args: [{
4321
+ isSignal: true,
4322
+ alias: "testSending",
4323
+ required: false
4324
+ }]
4325
+ }],
4326
+ videos: [{
4327
+ type: i0.Input,
4328
+ args: [{
4329
+ isSignal: true,
4330
+ alias: "videos",
4331
+ required: false
4332
+ }]
4333
+ }],
4334
+ hideVideos: [{
4335
+ type: i0.Input,
4336
+ args: [{
4337
+ isSignal: true,
4338
+ alias: "hideVideos",
4339
+ required: false
4340
+ }]
4341
+ }],
4342
+ videosLoading: [{
4343
+ type: i0.Input,
4344
+ args: [{
4345
+ isSignal: true,
4346
+ alias: "videosLoading",
4347
+ required: false
4348
+ }]
4349
+ }],
4350
+ videoDefaults: [{
4351
+ type: i0.Input,
4352
+ args: [{
4353
+ isSignal: true,
4354
+ alias: "videoDefaults",
4355
+ required: false
4356
+ }]
4357
+ }],
4358
+ videoLink: [{
4359
+ type: i0.Input,
4360
+ args: [{
4361
+ isSignal: true,
4362
+ alias: "videoLink",
4363
+ required: false
4364
+ }]
4365
+ }],
4366
+ noVideosHintInput: [{
4367
+ type: i0.Input,
4368
+ args: [{
4369
+ isSignal: true,
4370
+ alias: "noVideosHint",
4371
+ required: false
4372
+ }]
4373
+ }],
4374
+ save: [{
4375
+ type: i0.Output,
4376
+ args: ["save"]
4377
+ }],
4378
+ testSend: [{
4379
+ type: i0.Output,
4380
+ args: ["testSend"]
4381
+ }],
4382
+ videosRequested: [{
4383
+ type: i0.Output,
4384
+ args: ["videosRequested"]
4385
+ }],
4386
+ useAsMine: [{
4387
+ type: i0.Output,
4388
+ args: ["useAsMine"]
4389
+ }],
4390
+ blockEditors: [{
4391
+ type: i0.ViewChildren,
4392
+ args: ["blockEditor", { isSignal: true }]
4393
+ }],
4394
+ colorInputRef: [{
4395
+ type: i0.ViewChild,
4396
+ args: ["colorInput", { isSignal: true }]
4397
+ }]
4398
+ }
4399
+ });
4400
+ const formatEnumWords = (s) => s.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
4401
+ function inspectionTemplateStatusLabel(tpl) {
4402
+ if (tpl.status) return tpl.status.charAt(0).toUpperCase() + tpl.status.slice(1).toLowerCase();
4403
+ return tpl.archived ? "Archived" : "Active";
4404
+ }
4405
+ function buildInspectionTemplateHtml(tpl, options = {}) {
4406
+ const accent = options.accentColor ?? "#1F3D2B";
4407
+ const today = (options.now ?? /* @__PURE__ */ new Date()).toLocaleDateString(options.locale ?? "en-US", {
4408
+ month: "long",
4409
+ day: "numeric",
4410
+ year: "numeric"
4411
+ });
4412
+ const type = escapeHtml(formatEnumWords(tpl.inspectionType));
4413
+ const count = tpl.items.length;
4414
+ const box = "<span style=\"display:inline-block;width:18px;height:18px;border:2px solid #d1d5db;border-radius:4px;\"></span>";
4415
+ const rows = count ? tpl.items.map((item, idx) => `<tr>
4416
+ <td style="width:36px;text-align:center;font-weight:600;color:#6b7280;padding:10px 8px;">${idx + 1}</td>
4417
+ <td style="padding:10px 8px;font-weight:500;">${escapeHtml(item.itemName)}${item.required ? " <span style=\"color:#d97706;font-size:0.75rem;font-weight:600;\">(Required)</span>" : ""}</td>
4418
+ <td style="width:60px;text-align:center;padding:10px 8px;">${box}</td>
4419
+ <td style="width:60px;text-align:center;padding:10px 8px;">${box}</td>
4420
+ <td style="width:140px;padding:10px 8px;border-bottom:1px dotted #e5e7eb;"></td>
4421
+ </tr>`).join("") : "<tr><td colspan=\"5\" style=\"padding:16px;color:#9ca3af;font-style:italic;\">No checklist items defined.</td></tr>";
4422
+ const fill = (label) => `<div class="fill-field"><p class="fill-label">${label}</p><p style="min-height:20px;"></p></div>`;
4423
+ const footer = options.appName ? `Generated from ${escapeHtml(options.appName)} — ${today}` : `Generated ${today}`;
4424
+ return `<!DOCTYPE html>
4425
+ <html lang="en">
4426
+ <head>
4427
+ <meta charset="utf-8">
4428
+ <title>${escapeHtml(tpl.name)} — Inspection Checklist</title>
4429
+ <style>
4430
+ * { margin: 0; padding: 0; box-sizing: border-box; }
4431
+ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #1e293b; padding: 32px; max-width: 800px; margin: 0 auto; }
4432
+ .header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid ${accent}; }
4433
+ .header h1 { font-size: 1.5rem; font-weight: 700; color: ${accent}; }
4434
+ .header-meta { text-align: right; font-size: 0.8125rem; color: #6b7280; }
4435
+ .details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-bottom: 24px; padding: 16px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; }
4436
+ .detail-row { display: flex; gap: 8px; font-size: 0.875rem; }
4437
+ .detail-label { font-weight: 600; color: #64748b; min-width: 100px; }
4438
+ .detail-value { color: #1e293b; }
4439
+ .section-title { font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: ${accent}; margin: 24px 0 12px; }
4440
+ .desc { font-size: 0.875rem; color: #475569; line-height: 1.6; margin-bottom: 16px; white-space: pre-wrap; }
4441
+ table { width: 100%; border-collapse: collapse; }
4442
+ thead th { text-align: left; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; padding: 8px; border-bottom: 2px solid #e2e8f0; }
4443
+ tbody td { border-bottom: 1px solid #f1f5f9; }
4444
+ .fill-fields { margin-top: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
4445
+ .fill-field { border-bottom: 1px solid #d1d5db; padding: 8px 0 4px; }
4446
+ .fill-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
4447
+ @media print {
4448
+ body { padding: 16px; }
4449
+ .no-print { display: none !important; }
4450
+ @page { margin: 0.5in; }
4451
+ }
4452
+ </style>
4453
+ </head>
4454
+ <body>
4455
+ <div class="header">
4456
+ <div>
4457
+ <h1>${escapeHtml(tpl.name)}</h1>
4458
+ <p style="font-size:0.875rem;color:#64748b;margin-top:4px;">${type} Inspection Template</p>
4459
+ </div>
4460
+ <div class="header-meta">
4461
+ <p>Printed: ${today}</p>
4462
+ <p>${count} checklist item${count !== 1 ? "s" : ""}</p>
4463
+ </div>
4464
+ </div>
4465
+
4466
+ <div class="details">
4467
+ <div class="detail-row"><span class="detail-label">Type</span><span class="detail-value">${type}</span></div>
4468
+ <div class="detail-row"><span class="detail-label">Status</span><span class="detail-value">${escapeHtml(inspectionTemplateStatusLabel(tpl))}</span></div>
4469
+ ${tpl.defaultInspectorName ? `<div class="detail-row"><span class="detail-label">Inspector</span><span class="detail-value">${escapeHtml(tpl.defaultInspectorName)}</span></div>` : ""}
4470
+ ${tpl.frequencyDays ? `<div class="detail-row"><span class="detail-label">Recurrence</span><span class="detail-value">Every ${tpl.frequencyDays} days</span></div>` : ""}
4471
+ </div>
4472
+
4473
+ ${tpl.description ? `<p class="section-title">Description</p><p class="desc">${escapeHtml(tpl.description)}</p>` : ""}
4474
+ ${tpl.defaultNotes ? `<p class="section-title">Default Notes</p><p class="desc">${escapeHtml(tpl.defaultNotes)}</p>` : ""}
4475
+
4476
+ <p class="section-title">Checklist</p>
4477
+ <table>
4478
+ <thead><tr><th style="width:36px;">#</th><th>Item</th><th style="width:60px;text-align:center;">Pass</th><th style="width:60px;text-align:center;">Fail</th><th style="width:140px;">Notes</th></tr></thead>
4479
+ <tbody>${rows}</tbody>
4480
+ </table>
4481
+
4482
+ <div class="fill-fields">
4483
+ ${fill("Unit Number")}
4484
+ ${fill("Inspection Date")}
4485
+ ${fill("Inspector Name")}
4486
+ ${fill("Inspector Signature")}
4487
+ </div>
4488
+
4489
+ <p style="margin-top:32px;font-size:0.75rem;color:#9ca3af;text-align:center;">${footer}</p>
4490
+ </body>
4491
+ </html>`;
4492
+ }
4493
+ var InspectionTemplatePrintService = class InspectionTemplatePrintService {
4494
+ constructor() {
4495
+ this.printer = inject(PrintService);
4496
+ this.options = {};
4497
+ }
4498
+ configure(options) {
4499
+ this.options = { ...options };
4500
+ }
4501
+ html(tpl) {
4502
+ return buildInspectionTemplateHtml(tpl, this.options);
4503
+ }
4504
+ openWindow() {
4505
+ return this.printer.openWindow();
4506
+ }
4507
+ print(tpl, existing) {
4508
+ return this.printer.print(this.html(tpl), existing);
4509
+ }
4510
+ download(tpl) {
4511
+ this.printer.printInFrame(this.html(tpl));
4512
+ }
4513
+ static {
4514
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4515
+ minVersion: "12.0.0",
4516
+ version: "22.2.2",
4517
+ ngImport: i0,
4518
+ type: InspectionTemplatePrintService,
4519
+ deps: [],
4520
+ target: i0.ɵɵFactoryTarget.Injectable
4521
+ });
4522
+ }
4523
+ static {
4524
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
4525
+ minVersion: "12.0.0",
4526
+ version: "22.2.2",
4527
+ ngImport: i0,
4528
+ type: InspectionTemplatePrintService,
4529
+ providedIn: "root"
4530
+ });
4531
+ }
4532
+ };
4533
+ i0.ɵɵngDeclareClassMetadata({
4534
+ minVersion: "12.0.0",
4535
+ version: "22.2.2",
4536
+ ngImport: i0,
4537
+ type: InspectionTemplatePrintService,
4538
+ decorators: [{
4539
+ type: Injectable,
4540
+ args: [{ providedIn: "root" }]
4541
+ }]
4542
+ });
4543
+ export { DEFAULT_EMAIL_TEMPLATE_BLOCK_GROUPS, DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS, EMAIL_BLOCK_DRAG_TYPE, EMAIL_TEMPLATE_MAX_BODY, EMAIL_TEMPLATE_MAX_TEXT, EMAIL_TEMPLATE_START_TEXT, EmailTemplateEditorComponent, InspectionTemplatePrintService, MAX_EMAIL_ADDRESS_LENGTH, RICH_TEXT_OPTIONS, RichTextEditorComponent, blockHasContent, buildInspectionTemplateHtml, buildPreviewDocument, buildVideoBlockHtml, escapeHtml, formatCategoryLabel, formatVideoDuration, insideEditorBlock, inspectionTemplateStatusLabel, isBlockDrag, isValidEmailAddress, isWebUrl, localizedEmailBlockGroups, localizedEmailVariableGroups, plainTextToHtml, sanitizeRichTextHtml, serializedTextLength };
4544
+
4545
+ //# sourceMappingURL=forgeroute-ui-editor.mjs.map