@molecule/app-ui-angular 1.0.6 → 1.1.1

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 (308) hide show
  1. package/README.md +11740 -1143
  2. package/dist/components/accordion.component.d.ts +114 -0
  3. package/dist/components/accordion.component.d.ts.map +1 -0
  4. package/dist/components/accordion.component.js +286 -0
  5. package/dist/components/accordion.component.js.map +1 -0
  6. package/dist/components/alert.component.d.ts +81 -37
  7. package/dist/components/alert.component.d.ts.map +1 -1
  8. package/dist/components/alert.component.js +232 -146
  9. package/dist/components/alert.component.js.map +1 -1
  10. package/dist/components/auth-guard.component.d.ts +94 -0
  11. package/dist/components/auth-guard.component.d.ts.map +1 -0
  12. package/dist/components/auth-guard.component.js +212 -0
  13. package/dist/components/auth-guard.component.js.map +1 -0
  14. package/dist/components/avatar.component.d.ts +97 -0
  15. package/dist/components/avatar.component.d.ts.map +1 -0
  16. package/dist/components/avatar.component.js +216 -0
  17. package/dist/components/avatar.component.js.map +1 -0
  18. package/dist/components/badge.component.d.ts +27 -12
  19. package/dist/components/badge.component.d.ts.map +1 -1
  20. package/dist/components/badge.component.js +47 -47
  21. package/dist/components/badge.component.js.map +1 -1
  22. package/dist/components/button.component.d.ts +96 -14
  23. package/dist/components/button.component.d.ts.map +1 -1
  24. package/dist/components/button.component.js +232 -87
  25. package/dist/components/button.component.js.map +1 -1
  26. package/dist/components/card.component.d.ts +135 -0
  27. package/dist/components/card.component.d.ts.map +1 -0
  28. package/dist/components/card.component.js +291 -0
  29. package/dist/components/card.component.js.map +1 -0
  30. package/dist/components/checkbox.component.d.ts +102 -29
  31. package/dist/components/checkbox.component.d.ts.map +1 -1
  32. package/dist/components/checkbox.component.js +222 -113
  33. package/dist/components/checkbox.component.js.map +1 -1
  34. package/dist/components/confirm-button.component.d.ts +130 -0
  35. package/dist/components/confirm-button.component.d.ts.map +1 -0
  36. package/dist/components/confirm-button.component.js +322 -0
  37. package/dist/components/confirm-button.component.js.map +1 -0
  38. package/dist/components/confirm-dialog.component.d.ts +60 -0
  39. package/dist/components/confirm-dialog.component.d.ts.map +1 -0
  40. package/dist/components/confirm-dialog.component.js +152 -0
  41. package/dist/components/confirm-dialog.component.js.map +1 -0
  42. package/dist/components/dropdown.component.d.ts +313 -0
  43. package/dist/components/dropdown.component.d.ts.map +1 -0
  44. package/dist/components/dropdown.component.js +919 -0
  45. package/dist/components/dropdown.component.js.map +1 -0
  46. package/dist/components/empty-state.component.d.ts +73 -0
  47. package/dist/components/empty-state.component.d.ts.map +1 -0
  48. package/dist/components/empty-state.component.js +180 -0
  49. package/dist/components/empty-state.component.js.map +1 -0
  50. package/dist/components/floating-input.component.d.ts +86 -0
  51. package/dist/components/floating-input.component.d.ts.map +1 -0
  52. package/dist/components/floating-input.component.js +167 -0
  53. package/dist/components/floating-input.component.js.map +1 -0
  54. package/dist/components/form-field.component.d.ts +111 -0
  55. package/dist/components/form-field.component.d.ts.map +1 -0
  56. package/dist/components/form-field.component.js +300 -0
  57. package/dist/components/form-field.component.js.map +1 -0
  58. package/dist/components/form.component.d.ts +77 -0
  59. package/dist/components/form.component.d.ts.map +1 -0
  60. package/dist/components/form.component.js +222 -0
  61. package/dist/components/form.component.js.map +1 -0
  62. package/dist/components/icon.component.d.ts +85 -0
  63. package/dist/components/icon.component.d.ts.map +1 -0
  64. package/dist/components/icon.component.js +187 -0
  65. package/dist/components/icon.component.js.map +1 -0
  66. package/dist/components/index.d.ts +49 -0
  67. package/dist/components/index.d.ts.map +1 -1
  68. package/dist/components/index.js +49 -0
  69. package/dist/components/index.js.map +1 -1
  70. package/dist/components/input.component.d.ts +157 -54
  71. package/dist/components/input.component.d.ts.map +1 -1
  72. package/dist/components/input.component.js +437 -222
  73. package/dist/components/input.component.js.map +1 -1
  74. package/dist/components/label.component.d.ts +29 -0
  75. package/dist/components/label.component.d.ts.map +1 -0
  76. package/dist/components/label.component.js +60 -0
  77. package/dist/components/label.component.js.map +1 -0
  78. package/dist/components/language-picker.component.d.ts +124 -0
  79. package/dist/components/language-picker.component.d.ts.map +1 -0
  80. package/dist/components/language-picker.component.js +305 -0
  81. package/dist/components/language-picker.component.js.map +1 -0
  82. package/dist/components/layout.component.d.ts +167 -0
  83. package/dist/components/layout.component.d.ts.map +1 -0
  84. package/dist/components/layout.component.js +364 -0
  85. package/dist/components/layout.component.js.map +1 -0
  86. package/dist/components/load-error-banner.component.d.ts +103 -0
  87. package/dist/components/load-error-banner.component.d.ts.map +1 -0
  88. package/dist/components/load-error-banner.component.js +263 -0
  89. package/dist/components/load-error-banner.component.js.map +1 -0
  90. package/dist/components/modal.component.d.ts +125 -95
  91. package/dist/components/modal.component.d.ts.map +1 -1
  92. package/dist/components/modal.component.js +458 -271
  93. package/dist/components/modal.component.js.map +1 -1
  94. package/dist/components/molecule/alert.component.d.ts +77 -0
  95. package/dist/components/molecule/alert.component.d.ts.map +1 -0
  96. package/dist/components/molecule/alert.component.js +229 -0
  97. package/dist/components/molecule/alert.component.js.map +1 -0
  98. package/dist/components/molecule/badge.component.d.ts +27 -0
  99. package/dist/components/molecule/badge.component.d.ts.map +1 -0
  100. package/dist/components/molecule/badge.component.js +79 -0
  101. package/dist/components/molecule/badge.component.js.map +1 -0
  102. package/dist/components/molecule/button.component.d.ts +38 -0
  103. package/dist/components/molecule/button.component.d.ts.map +1 -0
  104. package/dist/components/molecule/button.component.js +137 -0
  105. package/dist/components/molecule/button.component.js.map +1 -0
  106. package/dist/components/molecule/checkbox.component.d.ts +53 -0
  107. package/dist/components/molecule/checkbox.component.d.ts.map +1 -0
  108. package/dist/components/molecule/checkbox.component.js +166 -0
  109. package/dist/components/molecule/checkbox.component.js.map +1 -0
  110. package/dist/components/molecule/index.d.ts +18 -0
  111. package/dist/components/molecule/index.d.ts.map +1 -0
  112. package/dist/components/molecule/index.js +18 -0
  113. package/dist/components/molecule/index.js.map +1 -0
  114. package/dist/components/molecule/input.component.d.ts +93 -0
  115. package/dist/components/molecule/input.component.d.ts.map +1 -0
  116. package/dist/components/molecule/input.component.js +314 -0
  117. package/dist/components/molecule/input.component.js.map +1 -0
  118. package/dist/components/molecule/modal.component.d.ts +148 -0
  119. package/dist/components/molecule/modal.component.d.ts.map +1 -0
  120. package/dist/components/molecule/modal.component.js +382 -0
  121. package/dist/components/molecule/modal.component.js.map +1 -0
  122. package/dist/components/molecule/radio-group.component.d.ts +63 -0
  123. package/dist/components/molecule/radio-group.component.d.ts.map +1 -0
  124. package/dist/components/molecule/radio-group.component.js +208 -0
  125. package/dist/components/molecule/radio-group.component.js.map +1 -0
  126. package/dist/components/molecule/select.component.d.ts +72 -0
  127. package/dist/components/molecule/select.component.d.ts.map +1 -0
  128. package/dist/components/molecule/select.component.js +274 -0
  129. package/dist/components/molecule/select.component.js.map +1 -0
  130. package/dist/components/molecule/spinner.component.d.ts +42 -0
  131. package/dist/components/molecule/spinner.component.d.ts.map +1 -0
  132. package/dist/components/molecule/spinner.component.js +122 -0
  133. package/dist/components/molecule/spinner.component.js.map +1 -0
  134. package/dist/components/molecule/switch.component.d.ts +54 -0
  135. package/dist/components/molecule/switch.component.d.ts.map +1 -0
  136. package/dist/components/molecule/switch.component.js +148 -0
  137. package/dist/components/molecule/switch.component.js.map +1 -0
  138. package/dist/components/molecule/toast.component.d.ts +98 -0
  139. package/dist/components/molecule/toast.component.d.ts.map +1 -0
  140. package/dist/components/molecule/toast.component.js +305 -0
  141. package/dist/components/molecule/toast.component.js.map +1 -0
  142. package/dist/components/molecule/tooltip.component.d.ts +77 -0
  143. package/dist/components/molecule/tooltip.component.d.ts.map +1 -0
  144. package/dist/components/molecule/tooltip.component.js +316 -0
  145. package/dist/components/molecule/tooltip.component.js.map +1 -0
  146. package/dist/components/optimistic-toggle-button.component.d.ts +125 -0
  147. package/dist/components/optimistic-toggle-button.component.d.ts.map +1 -0
  148. package/dist/components/optimistic-toggle-button.component.js +296 -0
  149. package/dist/components/optimistic-toggle-button.component.js.map +1 -0
  150. package/dist/components/page-header.component.d.ts +77 -0
  151. package/dist/components/page-header.component.d.ts.map +1 -0
  152. package/dist/components/page-header.component.js +225 -0
  153. package/dist/components/page-header.component.js.map +1 -0
  154. package/dist/components/page-shell.component.d.ts +101 -0
  155. package/dist/components/page-shell.component.d.ts.map +1 -0
  156. package/dist/components/page-shell.component.js +221 -0
  157. package/dist/components/page-shell.component.js.map +1 -0
  158. package/dist/components/pagination.component.d.ts +137 -0
  159. package/dist/components/pagination.component.d.ts.map +1 -0
  160. package/dist/components/pagination.component.js +419 -0
  161. package/dist/components/pagination.component.js.map +1 -0
  162. package/dist/components/panel-close.component.d.ts +43 -0
  163. package/dist/components/panel-close.component.d.ts.map +1 -0
  164. package/dist/components/panel-close.component.js +75 -0
  165. package/dist/components/panel-close.component.js.map +1 -0
  166. package/dist/components/progress.component.d.ts +84 -0
  167. package/dist/components/progress.component.d.ts.map +1 -0
  168. package/dist/components/progress.component.js +219 -0
  169. package/dist/components/progress.component.js.map +1 -0
  170. package/dist/components/prompt-dialog.component.d.ts +121 -0
  171. package/dist/components/prompt-dialog.component.d.ts.map +1 -0
  172. package/dist/components/prompt-dialog.component.js +332 -0
  173. package/dist/components/prompt-dialog.component.js.map +1 -0
  174. package/dist/components/radio-group.component.d.ts +66 -34
  175. package/dist/components/radio-group.component.d.ts.map +1 -1
  176. package/dist/components/radio-group.component.js +146 -125
  177. package/dist/components/radio-group.component.js.map +1 -1
  178. package/dist/components/responsive-app-shell.component.d.ts +408 -0
  179. package/dist/components/responsive-app-shell.component.d.ts.map +1 -0
  180. package/dist/components/responsive-app-shell.component.js +1144 -0
  181. package/dist/components/responsive-app-shell.component.js.map +1 -0
  182. package/dist/components/select.component.d.ts +135 -38
  183. package/dist/components/select.component.d.ts.map +1 -1
  184. package/dist/components/select.component.js +373 -181
  185. package/dist/components/select.component.js.map +1 -1
  186. package/dist/components/separator.component.d.ts +39 -0
  187. package/dist/components/separator.component.d.ts.map +1 -0
  188. package/dist/components/separator.component.js +73 -0
  189. package/dist/components/separator.component.js.map +1 -0
  190. package/dist/components/sidebar-user-card.component.d.ts +106 -0
  191. package/dist/components/sidebar-user-card.component.d.ts.map +1 -0
  192. package/dist/components/sidebar-user-card.component.js +277 -0
  193. package/dist/components/sidebar-user-card.component.js.map +1 -0
  194. package/dist/components/skeleton.component.d.ts +100 -0
  195. package/dist/components/skeleton.component.d.ts.map +1 -0
  196. package/dist/components/skeleton.component.js +214 -0
  197. package/dist/components/skeleton.component.js.map +1 -0
  198. package/dist/components/spinner.component.d.ts +36 -19
  199. package/dist/components/spinner.component.d.ts.map +1 -1
  200. package/dist/components/spinner.component.js +69 -71
  201. package/dist/components/spinner.component.js.map +1 -1
  202. package/dist/components/switch.component.d.ts +72 -29
  203. package/dist/components/switch.component.d.ts.map +1 -1
  204. package/dist/components/switch.component.js +163 -91
  205. package/dist/components/switch.component.js.map +1 -1
  206. package/dist/components/table.component.d.ts +193 -0
  207. package/dist/components/table.component.d.ts.map +1 -0
  208. package/dist/components/table.component.js +550 -0
  209. package/dist/components/table.component.js.map +1 -0
  210. package/dist/components/tabs.component.d.ts +140 -0
  211. package/dist/components/tabs.component.d.ts.map +1 -0
  212. package/dist/components/tabs.component.js +390 -0
  213. package/dist/components/tabs.component.js.map +1 -0
  214. package/dist/components/template-outlet.directive.d.ts +50 -0
  215. package/dist/components/template-outlet.directive.d.ts.map +1 -0
  216. package/dist/components/template-outlet.directive.js +81 -0
  217. package/dist/components/template-outlet.directive.js.map +1 -0
  218. package/dist/components/textarea.component.d.ts +151 -0
  219. package/dist/components/textarea.component.d.ts.map +1 -0
  220. package/dist/components/textarea.component.js +340 -0
  221. package/dist/components/textarea.component.js.map +1 -0
  222. package/dist/components/theme-toggle.component.d.ts +58 -0
  223. package/dist/components/theme-toggle.component.d.ts.map +1 -0
  224. package/dist/components/theme-toggle.component.js +124 -0
  225. package/dist/components/theme-toggle.component.js.map +1 -0
  226. package/dist/components/toast.component.d.ts +237 -49
  227. package/dist/components/toast.component.d.ts.map +1 -1
  228. package/dist/components/toast.component.js +636 -201
  229. package/dist/components/toast.component.js.map +1 -1
  230. package/dist/components/tooltip.component.d.ts +95 -45
  231. package/dist/components/tooltip.component.d.ts.map +1 -1
  232. package/dist/components/tooltip.component.js +372 -221
  233. package/dist/components/tooltip.component.js.map +1 -1
  234. package/dist/components/user-menu-popover.component.d.ts +283 -0
  235. package/dist/components/user-menu-popover.component.d.ts.map +1 -0
  236. package/dist/components/user-menu-popover.component.js +646 -0
  237. package/dist/components/user-menu-popover.component.js.map +1 -0
  238. package/dist/components/user-menu.component.d.ts +95 -0
  239. package/dist/components/user-menu.component.d.ts.map +1 -0
  240. package/dist/components/user-menu.component.js +218 -0
  241. package/dist/components/user-menu.component.js.map +1 -0
  242. package/dist/hooks/index.d.ts +7 -0
  243. package/dist/hooks/index.d.ts.map +1 -0
  244. package/dist/hooks/index.js +7 -0
  245. package/dist/hooks/index.js.map +1 -0
  246. package/dist/hooks/use-is-desktop.d.ts +22 -0
  247. package/dist/hooks/use-is-desktop.d.ts.map +1 -0
  248. package/dist/hooks/use-is-desktop.js +37 -0
  249. package/dist/hooks/use-is-desktop.js.map +1 -0
  250. package/dist/index.d.ts +32 -17
  251. package/dist/index.d.ts.map +1 -1
  252. package/dist/index.js +32 -17
  253. package/dist/index.js.map +1 -1
  254. package/dist/types.d.ts +1 -1
  255. package/dist/types.d.ts.map +1 -1
  256. package/dist/utilities/dom-context.d.ts +42 -0
  257. package/dist/utilities/dom-context.d.ts.map +1 -0
  258. package/dist/utilities/dom-context.js +66 -0
  259. package/dist/utilities/dom-context.js.map +1 -0
  260. package/dist/utilities/focus.d.ts +32 -0
  261. package/dist/utilities/focus.d.ts.map +1 -0
  262. package/dist/utilities/focus.js +47 -0
  263. package/dist/utilities/focus.js.map +1 -0
  264. package/dist/utilities/form-field-context.d.ts +34 -0
  265. package/dist/utilities/form-field-context.d.ts.map +1 -0
  266. package/dist/utilities/form-field-context.js +28 -0
  267. package/dist/utilities/form-field-context.js.map +1 -0
  268. package/dist/utilities/form-submit-error.d.ts +17 -0
  269. package/dist/utilities/form-submit-error.d.ts.map +1 -0
  270. package/dist/utilities/form-submit-error.js +42 -0
  271. package/dist/utilities/form-submit-error.js.map +1 -0
  272. package/dist/utilities/icon-markup.d.ts +17 -0
  273. package/dist/utilities/icon-markup.d.ts.map +1 -0
  274. package/dist/utilities/icon-markup.js +46 -0
  275. package/dist/utilities/icon-markup.js.map +1 -0
  276. package/dist/utilities/ids.d.ts +15 -0
  277. package/dist/utilities/ids.d.ts.map +1 -0
  278. package/dist/utilities/ids.js +19 -0
  279. package/dist/utilities/ids.js.map +1 -0
  280. package/dist/utilities/index.d.ts +11 -0
  281. package/dist/utilities/index.d.ts.map +1 -1
  282. package/dist/utilities/index.js +11 -0
  283. package/dist/utilities/index.js.map +1 -1
  284. package/dist/utilities/initials.d.ts +13 -0
  285. package/dist/utilities/initials.d.ts.map +1 -0
  286. package/dist/utilities/initials.js +23 -0
  287. package/dist/utilities/initials.js.map +1 -0
  288. package/dist/utilities/node-value.d.ts +31 -0
  289. package/dist/utilities/node-value.d.ts.map +1 -0
  290. package/dist/utilities/node-value.js +37 -0
  291. package/dist/utilities/node-value.js.map +1 -0
  292. package/dist/utilities/optimistic-value.d.ts +81 -0
  293. package/dist/utilities/optimistic-value.d.ts.map +1 -0
  294. package/dist/utilities/optimistic-value.js +154 -0
  295. package/dist/utilities/optimistic-value.js.map +1 -0
  296. package/dist/utilities/render-icon.d.ts +77 -7
  297. package/dist/utilities/render-icon.d.ts.map +1 -1
  298. package/dist/utilities/render-icon.js +123 -33
  299. package/dist/utilities/render-icon.js.map +1 -1
  300. package/dist/utilities/rest-attrs.d.ts +21 -0
  301. package/dist/utilities/rest-attrs.d.ts.map +1 -0
  302. package/dist/utilities/rest-attrs.js +37 -0
  303. package/dist/utilities/rest-attrs.js.map +1 -0
  304. package/dist/utilities/style.d.ts +23 -0
  305. package/dist/utilities/style.d.ts.map +1 -0
  306. package/dist/utilities/style.js +86 -0
  307. package/dist/utilities/style.js.map +1 -0
  308. package/package.json +6 -4
@@ -0,0 +1,263 @@
1
+ /**
2
+ * LoadErrorBanner component (React parity): the shared "load failed" banner
3
+ * with a Retry button that owns its pending state.
4
+ *
5
+ * @module
6
+ */
7
+ import { Component, ElementRef, inject, Renderer2, signal, ViewChild, } from '@angular/core';
8
+ import { useTranslation } from '@molecule/app-angular';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { Alert } from './alert.component.js';
11
+ import { hasNodes, SlotWrapper } from './button.component.js';
12
+ import * as i0 from "@angular/core";
13
+ const _c0 = ["detailSlot"];
14
+ const _c1 = ["retrySlot"];
15
+ const _c2 = ["retryLabelSlot"];
16
+ const _c3 = [[["", "slot", "message"]], [["", "slot", "detail"]], "*", [["", "slot", "retrylabel"]]];
17
+ const _c4 = ["[slot=message]", "[slot=detail]", "*", "[slot=retryLabel]"];
18
+ const _c5 = () => ({ justify: "start" });
19
+ function LoadErrorBanner_Conditional_14_Template(rf, ctx) { if (rf & 1) {
20
+ i0.ɵɵtext(0);
21
+ } if (rf & 2) {
22
+ const ctx_r0 = i0.ɵɵnextContext();
23
+ i0.ɵɵtextInterpolate1(" ", ctx_r0.retryText(), " ");
24
+ } }
25
+ /**
26
+ * LoadErrorBanner component.
27
+ *
28
+ * The host is the root `<div>` (`div[mol-load-error-banner]`); rest props
29
+ * (`className`, `data-*`, `aria-*`, `id`) land on it exactly as React spreads
30
+ * them. `message`, `detail` and `retryLabel` are node-valued props, projected
31
+ * as `[slot=message]` / `[slot=detail]` / `[slot=retryLabel]`. The detail
32
+ * paragraph and the retry row render only when React would render them.
33
+ */
34
+ export class LoadErrorBanner {
35
+ /** The primary error line (node-valued prop). */
36
+ message;
37
+ /** Secondary line under the message (node-valued prop). */
38
+ detail;
39
+ /** Retry-button label (node-valued prop). */
40
+ retryLabel;
41
+ /** `data-mol-id` for the retry button (default `load-error-retry`). */
42
+ retryMolId = 'load-error-retry';
43
+ /** Called when Retry is clicked; a returned promise keeps the button pending. */
44
+ onRetry;
45
+ /** Extra classes for the root (React's rest `className`). */
46
+ className;
47
+ /** Whether a retry is in flight. */
48
+ pending = signal(false, /* @ts-ignore */
49
+ ...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
50
+ /** The detail paragraph (always in the template; detached when unused). */
51
+ detailSlot;
52
+ /** The retry row (always in the template; detached when no callback). */
53
+ retrySlot;
54
+ /** The retry label capture point. */
55
+ retryLabelSlot;
56
+ /**
57
+ * Reactive translation, read in the injection context. Its `t` reads the
58
+ * locale, so the view re-renders the text on a locale switch (the static `t`
59
+ * does not).
60
+ */
61
+ i18n = useTranslation();
62
+ sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
63
+ hasDetail = false;
64
+ /** Whether the projected retry label exists (a signal: it is read after view init). */
65
+ hasRetryLabel = signal(false, /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "hasRetryLabel" }] : /* istanbul ignore next */ []));
67
+ detailParent = null;
68
+ retryParent = null;
69
+ /**
70
+ * The current class map.
71
+ * @returns The UIClassMap.
72
+ */
73
+ cm() {
74
+ return getClassMap();
75
+ }
76
+ /**
77
+ * The detail paragraph classes.
78
+ * @returns The class string.
79
+ */
80
+ detailClasses() {
81
+ return this.cm().cn(this.cm().textSize('xs'), this.cm().textMuted);
82
+ }
83
+ /**
84
+ * The retry button classes (React renders `Button variant="outline" size="sm"`).
85
+ * @returns The class string.
86
+ */
87
+ retryClasses() {
88
+ return this.cm().button({ variant: 'outline', color: 'primary', size: 'sm' });
89
+ }
90
+ /**
91
+ * The retry button's text: the projected label, or the localized default.
92
+ * @returns The default text (empty while a projected label is shown).
93
+ */
94
+ retryText() {
95
+ return this.pending()
96
+ ? this.i18n.t('loadError.retrying', {}, { defaultValue: 'Retrying…' })
97
+ : this.i18n.t('loadError.retry', {}, { defaultValue: 'Retry' });
98
+ }
99
+ /**
100
+ * Runs the retry callback with React's pending semantics: disabled and
101
+ * "Retrying…" while the promise is unsettled; a rejection is not swallowed
102
+ * — the banner stays for the caller.
103
+ */
104
+ handleRetry() {
105
+ if (!this.onRetry || this.pending())
106
+ return;
107
+ this.pending.set(true);
108
+ void Promise.resolve(this.onRetry())
109
+ .catch((_error) => undefined)
110
+ .finally(() => this.pending.set(false));
111
+ }
112
+ /**
113
+ * Reads detail/label presence at view init (view queries resolve only then).
114
+ */
115
+ ngAfterViewInit() {
116
+ this.detailParent = this.detailSlot?.nativeElement.parentElement ?? null;
117
+ this.retryParent = this.retrySlot?.nativeElement.parentElement ?? null;
118
+ this.hasDetail = hasNodes(this.detailSlot?.nativeElement);
119
+ this.hasRetryLabel.set(hasNodes(this.retryLabelSlot?.nativeElement));
120
+ this.sync.sync(this.retryLabelSlot?.nativeElement, false, this.retryLabelSlot?.nativeElement.parentElement ?? undefined);
121
+ this.ngDoCheck();
122
+ }
123
+ /**
124
+ * Re-reconciles the conditional wrappers on later passes.
125
+ */
126
+ ngDoCheck() {
127
+ this.sync.sync(this.detailSlot?.nativeElement, this.hasDetail, this.detailParent ?? undefined);
128
+ // React renders the retry row exactly when `onRetry` is given.
129
+ this.sync.sync(this.retrySlot?.nativeElement, !!this.onRetry, this.retryParent ?? undefined);
130
+ this.showRetryLabel();
131
+ }
132
+ /** Restores the retry-label capture span on unmount. */
133
+ ngOnDestroy() {
134
+ this.visibleNodes = [];
135
+ this.visibleFrom = null;
136
+ }
137
+ /** Moves the projected retry label onto the retry button (React: no wrapper). */
138
+ showRetryLabel() {
139
+ const host = this.retrySlot?.nativeElement?.querySelector('button');
140
+ const span = this.retryLabelSlot?.nativeElement;
141
+ if (!host || !span)
142
+ return;
143
+ if (!this.hasRetryLabel()) {
144
+ this.showNodes(host, null);
145
+ return;
146
+ }
147
+ this.showNodes(host, span);
148
+ }
149
+ visibleNodes = [];
150
+ visibleFrom = null;
151
+ /**
152
+ * Shows one capture span's children inside a target element, parking any
153
+ * previously shown nodes back in their span.
154
+ *
155
+ * @param target - The element to show the nodes in.
156
+ * @param span - The capture span (null parks everything).
157
+ */
158
+ showNodes(target, span) {
159
+ if (span === this.visibleFrom)
160
+ return;
161
+ for (const node of this.visibleNodes) {
162
+ if (node.parentNode === target)
163
+ this.visibleFrom?.appendChild(node);
164
+ }
165
+ this.visibleNodes = [];
166
+ this.visibleFrom = null;
167
+ if (!span)
168
+ return;
169
+ const nodes = Array.from(span.childNodes);
170
+ for (const node of nodes)
171
+ target.appendChild(node);
172
+ this.visibleNodes = nodes;
173
+ this.visibleFrom = span;
174
+ }
175
+ static ɵfac = function LoadErrorBanner_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LoadErrorBanner)(); };
176
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LoadErrorBanner, selectors: [["div", "mol-load-error-banner", ""]], viewQuery: function LoadErrorBanner_Query(rf, ctx) { if (rf & 1) {
177
+ i0.ɵɵviewQuery(_c0, 5)(_c1, 5)(_c2, 5);
178
+ } if (rf & 2) {
179
+ let _t;
180
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.detailSlot = _t.first);
181
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.retrySlot = _t.first);
182
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.retryLabelSlot = _t.first);
183
+ } }, hostVars: 2, hostBindings: function LoadErrorBanner_HostBindings(rf, ctx) { if (rf & 2) {
184
+ i0.ɵɵclassMap(ctx.className);
185
+ } }, inputs: { message: "message", detail: "detail", retryLabel: "retryLabel", retryMolId: "retryMolId", onRetry: "onRetry" }, ngContentSelectors: _c4, decls: 15, vars: 17, consts: [["detailSlot", ""], ["retrySlot", ""], ["retryLabelSlot", ""], ["mol-alert", "", 3, "status", "live"], ["type", "button", 3, "click", "disabled"]], template: function LoadErrorBanner_Template(rf, ctx) { if (rf & 1) {
186
+ i0.ɵɵprojectionDef(_c3);
187
+ i0.ɵɵelementStart(0, "div", 3)(1, "div")(2, "p");
188
+ i0.ɵɵprojection(3);
189
+ i0.ɵɵelementEnd();
190
+ i0.ɵɵelementStart(4, "p", null, 0);
191
+ i0.ɵɵprojection(6, 1);
192
+ i0.ɵɵelementEnd();
193
+ i0.ɵɵprojection(7, 2);
194
+ i0.ɵɵelementStart(8, "div", null, 1)(10, "button", 4);
195
+ i0.ɵɵlistener("click", function LoadErrorBanner_Template_button_click_10_listener() { return ctx.handleRetry(); });
196
+ i0.ɵɵelementStart(11, "span", null, 2);
197
+ i0.ɵɵprojection(13, 3);
198
+ i0.ɵɵelementEnd();
199
+ i0.ɵɵconditionalCreate(14, LoadErrorBanner_Conditional_14_Template, 1, 1);
200
+ i0.ɵɵelementEnd()()()();
201
+ } if (rf & 2) {
202
+ i0.ɵɵproperty("status", "error")("live", false);
203
+ i0.ɵɵadvance();
204
+ i0.ɵɵclassMap(ctx.cm().stack(2));
205
+ i0.ɵɵadvance();
206
+ i0.ɵɵclassMap(ctx.cm().textSize("sm"));
207
+ i0.ɵɵadvance(2);
208
+ i0.ɵɵclassMap(ctx.detailClasses());
209
+ i0.ɵɵadvance(4);
210
+ i0.ɵɵclassMap(ctx.cm().flex(i0.ɵɵpureFunction0(16, _c5)));
211
+ i0.ɵɵadvance(2);
212
+ i0.ɵɵclassMap(ctx.retryClasses());
213
+ i0.ɵɵproperty("disabled", ctx.pending());
214
+ i0.ɵɵattribute("aria-busy", "false")("data-mol-id", ctx.retryMolId);
215
+ i0.ɵɵadvance(4);
216
+ i0.ɵɵconditional(!ctx.hasRetryLabel() ? 14 : -1);
217
+ } }, dependencies: [Alert], encapsulation: 2 });
218
+ }
219
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoadErrorBanner, [{
220
+ type: Component,
221
+ args: [{
222
+ selector: 'div[mol-load-error-banner]',
223
+ standalone: true,
224
+ imports: [Alert],
225
+ inputs: ['message', 'detail', 'retryLabel', 'retryMolId', 'onRetry'],
226
+ host: {
227
+ '[class]': 'className',
228
+ },
229
+ template: `<div mol-alert [status]="'error'" [live]="false">
230
+ <div [class]="cm().stack(2)">
231
+ <p [class]="cm().textSize('sm')"><ng-content select="[slot=message]"></ng-content></p>
232
+ <p #detailSlot [class]="detailClasses()"><ng-content select="[slot=detail]"></ng-content></p>
233
+ <ng-content></ng-content>
234
+ <div #retrySlot [class]="cm().flex({ justify: 'start' })">
235
+ <button
236
+ type="button"
237
+ [class]="retryClasses()"
238
+ [attr.aria-busy]="'false'"
239
+ [disabled]="pending()"
240
+ [attr.data-mol-id]="retryMolId"
241
+ (click)="handleRetry()"
242
+ >
243
+ <span #retryLabelSlot><ng-content select="[slot=retryLabel]"></ng-content></span>
244
+ @if (!hasRetryLabel()) {
245
+ {{ retryText() }}
246
+ }
247
+ </button>
248
+ </div>
249
+ </div>
250
+ </div>`,
251
+ }]
252
+ }], null, { detailSlot: [{
253
+ type: ViewChild,
254
+ args: ['detailSlot']
255
+ }], retrySlot: [{
256
+ type: ViewChild,
257
+ args: ['retrySlot']
258
+ }], retryLabelSlot: [{
259
+ type: ViewChild,
260
+ args: ['retryLabelSlot']
261
+ }] }); })();
262
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(LoadErrorBanner, { className: "LoadErrorBanner", filePath: "components/load-error-banner.component.ts", lineNumber: 67 }); })();
263
+ //# sourceMappingURL=load-error-banner.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-error-banner.component.js","sourceRoot":"","sources":["../../src/components/load-error-banner.component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,SAAS,EAET,UAAU,EACV,MAAM,EAEN,SAAS,EACT,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EA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,MAAM,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC;gBACpE,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;SAqBH;aACR;;kBAmBE,SAAS;mBAAC,YAAY;;kBAEtB,SAAS;mBAAC,WAAW;;kBAErB,SAAS;mBAAC,gBAAgB;;kFAtBhB,eAAe"}
@@ -1,142 +1,172 @@
1
1
  /**
2
- * Angular Modal UI component with UIClassMap-driven styling.
2
+ * Modal component (React parity): a `document.body` portal dialog.
3
3
  *
4
4
  * @module
5
5
  */
6
- import { EventEmitter, type OnChanges, type OnDestroy, type OnInit, type SimpleChanges } from '@angular/core';
7
- import { type SafeHtml } from '@angular/platform-browser';
6
+ import { type AfterViewInit, type DoCheck, ElementRef, EventEmitter, type OnDestroy } from '@angular/core';
8
7
  import type { ModalSize, UIClassMap } from '@molecule/app-ui';
8
+ import type { ResolvedIcon } from '../utilities/render-icon.js';
9
9
  import * as i0 from "@angular/core";
10
10
  /**
11
- * Get the inline style for the modal centering wrapper. `dialogWrapper` has
12
- * no dedicated ClassMap resolver option (it's a fixed token, not a
13
- * `{ centered }`-parameterized one), so a top-anchored (non-centered) layout
14
- * is expressed via the one inline-style exception the workspace styling rule
15
- * allows for values ClassMap genuinely cannot express.
11
+ * Modal component.
16
12
  *
17
- * A standalone function (rather than a class member) so it's unit-testable
18
- * without constructing `MoleculeModal` — the class can't be `new`'d outside
19
- * an Angular injection context (`sanitizer = inject(DomSanitizer)` runs at
20
- * field-initializer time).
21
- * @param centered - Whether the modal is vertically centered.
22
- * @returns An inline style object, or `undefined` when centered.
13
+ * React's root is a FRAGMENT portaled into `document.body` (an overlay
14
+ * `<div>` and a centering wrapper `<div>`), so the host is unwrapped
15
+ * (`data-parity-unwrap`, `display: contents`) and both elements are moved
16
+ * into the body. Implements the WAI-ARIA APG modal dialog pattern (focus
17
+ * into the dialog on open, trapped Tab, focus restored on close, Escape for
18
+ * the topmost dialog only, reference-counted body scroll lock).
23
19
  */
24
- export declare function getModalWrapperStyle(centered: boolean): Record<string, string> | undefined;
25
- /**
26
- * Angular Modal UI component with UIClassMap-driven styling.
27
- *
28
- * `centered` (default `true`) vertically centers the dialog; `centered:
29
- * false` top-anchors it instead, via `getModalWrapperStyle()`.
30
- */
31
- export declare class MoleculeModal implements OnInit, OnDestroy, OnChanges {
20
+ export declare class Modal implements AfterViewInit, DoCheck, OnDestroy {
21
+ /** Whether the dialog is open. */
32
22
  open: boolean;
23
+ /** The dialog title. */
33
24
  title?: string;
25
+ /** Dialog width preset. */
34
26
  size: ModalSize;
27
+ /** Whether the header/close button renders. */
35
28
  showCloseButton: boolean;
36
- closeLabel?: string;
29
+ /** Whether clicking the overlay closes the dialog. */
37
30
  closeOnOverlayClick: boolean;
31
+ /** Whether Escape closes the dialog. */
38
32
  closeOnEscape: boolean;
33
+ /** Footer content (node-valued prop). */
34
+ footer?: unknown;
35
+ /** Whether the dialog is vertically centered. */
39
36
  centered: boolean;
37
+ /** The close button's accessible label. */
38
+ closeLabel?: string;
39
+ /** Whether body scroll is locked while open. */
40
40
  preventScroll: boolean;
41
- hasFooter: boolean;
41
+ /** Extra classes for the dialog. */
42
42
  className?: string;
43
- style?: Record<string, string>;
43
+ /** Inline style object for the dialog (React camelCase). */
44
+ style?: Record<string, unknown>;
45
+ /** `data-testid` for the dialog. */
44
46
  testId?: string;
45
- close: EventEmitter<void>;
46
- /**
47
- * Retrieves the current UI class map.
48
- * @returns The UIClassMap instance for styling.
49
- */
50
- get cm(): UIClassMap;
51
- /**
52
- * Computes the accessible close button label.
53
- * @returns The localized aria-label for the close button.
54
- */
55
- get closeAriaLabel(): string;
56
- private boundEscapeHandler;
47
+ /** Fires when the dialog asks to close (React's `onClose`). */
48
+ readonly close: EventEmitter<MouseEvent | undefined>;
49
+ /** The overlay element (moved to `document.body`). */
50
+ overlay?: ElementRef<HTMLDivElement>;
51
+ /** The centering wrapper (moved to `document.body`). */
52
+ wrapper?: ElementRef<HTMLDivElement>;
53
+ /** The dialog element. */
54
+ dialog?: ElementRef<HTMLDivElement>;
55
+ /** The footer wrapper (detached when unused). */
56
+ footerSlot?: ElementRef<HTMLDivElement>;
57
+ /** The per-instance title id (the normalizer renumbers it). */
58
+ readonly titleId: string;
59
+ /** The instance's stack id. */
60
+ private readonly stackId;
61
+ private readonly host;
57
62
  /**
58
- * Retrieves the CSS class for the modal wrapper.
59
- * @returns The wrapper class name string.
63
+ * Reactive translation, read in the injection context. Its `t` reads the
64
+ * locale, so the view re-renders the text on a locale switch (the static `t`
65
+ * does not).
60
66
  */
61
- get wrapperClass(): string;
67
+ private readonly i18n;
68
+ private readonly sync;
69
+ private lastOpen;
70
+ private lastFooter;
71
+ private footerParent;
72
+ private previouslyFocused;
73
+ private listeners;
74
+ private locked;
75
+ private moved;
62
76
  /**
63
- * Retrieves the inline style for the modal centering wrapper.
64
- * @returns An inline style object, or `undefined` when centered.
77
+ * The current class map.
78
+ * @returns The UIClassMap.
65
79
  */
66
- get wrapperStyle(): Record<string, string> | undefined;
80
+ cm(): UIClassMap;
67
81
  /**
68
- * Retrieves the CSS class for the modal body.
69
- * @returns The body class name string.
82
+ * The dialog class list.
83
+ * @returns The class string.
70
84
  */
71
- get bodyClass(): string;
85
+ dialogClasses(): string;
72
86
  /**
73
- * Retrieves the CSS class for the modal overlay.
74
- * @returns The overlay class name string.
87
+ * Serializes the dialog's inline style.
88
+ * @returns The style attribute text.
75
89
  */
76
- get overlayClass(): string;
90
+ dialogStyle(): string | null;
77
91
  /**
78
- * Retrieves the CSS class for the modal header.
79
- * @returns The header class name string.
92
+ * The wrapper's inline style (top-anchored when not centered).
93
+ * @returns The style attribute text.
80
94
  */
81
- get headerClass(): string;
95
+ wrapperStyle(): string | null;
82
96
  /**
83
- * Retrieves the CSS class for the modal footer.
84
- * @returns The footer class name string.
97
+ * The close button's accessible label.
98
+ * @returns The label text.
85
99
  */
86
- get footerClass(): string;
100
+ closeText(): string;
87
101
  /**
88
- * Retrieves the CSS class for the modal title.
89
- * @returns The title class name string.
102
+ * The close button's X glyph.
103
+ * @returns The resolved icon.
90
104
  */
91
- get titleClass(): string;
105
+ closeIcon(): ResolvedIcon;
92
106
  /**
93
- * Retrieves the CSS class for the close button.
94
- * @returns The close button class name string.
107
+ * Stops a click inside the dialog from reaching the overlay handler.
108
+ *
109
+ * @param event - The click event.
95
110
  */
96
- get closeClass(): string;
97
- private sanitizer;
111
+ stopPropagation(event: MouseEvent): void;
98
112
  /**
99
- * Generates the SVG markup for the close button icon.
100
- * @returns The sanitized SVG for the close icon.
113
+ * Closes when the click is on the wrapper itself (not bubbled content).
114
+ *
115
+ * @param event - The click event.
101
116
  */
102
- get closeIconSvg(): SafeHtml;
117
+ handleOverlayClick(event: MouseEvent): void;
118
+ /** Emits the close request (React's `onClose`). */
119
+ requestClose(): void;
103
120
  /**
104
- * Computes the combined CSS classes for the modal content.
105
- * @returns The modal content class name string.
121
+ * Emits the close request from the close button — React's close button is
122
+ * `onClick={onClose}`, so the click event reaches the callback.
123
+ *
124
+ * @param event - The click event.
106
125
  */
107
- get contentClasses(): string;
126
+ requestCloseFromButton(event: MouseEvent): void;
108
127
  /**
109
- * Initializes event listeners on component creation.
128
+ * Reads the view queries (they resolve only at view init), moves the portal
129
+ * content into `document.body` and applies the initial open state.
110
130
  */
111
- ngOnInit(): void;
131
+ ngAfterViewInit(): void;
112
132
  /**
113
- * Handles input property changes.
114
- * @param changes - The changed input properties.
115
- */
116
- ngOnChanges(changes: SimpleChanges): void;
117
- /**
118
- * Cleans up event listeners and body scroll on component destruction.
133
+ * Reconciles the open state and the footer on later passes.
119
134
  */
135
+ ngDoCheck(): void;
136
+ /** Removes listeners, unlocks scroll and restores the portal nodes (unmount). */
120
137
  ngOnDestroy(): void;
121
138
  /**
122
- * Adds or removes the keyboard escape listener based on open state.
123
- */
124
- private updateListeners;
125
- /**
126
- * Updates the document body overflow based on open state.
127
- */
128
- private updateBodyScroll;
129
- /**
130
- * Handles escape key press to close the modal.
131
- * @param e - The keyboard event.
132
- */
133
- private handleEscape;
134
- /**
135
- * Handles overlay click to close the modal.
136
- * @param event - The mouse event from the overlay click.
137
- */
138
- onOverlayClick(event: MouseEvent): void;
139
- static ɵfac: i0.ɵɵFactoryDeclaration<MoleculeModal, never>;
140
- static ɵcmp: i0.ɵɵComponentDeclaration<MoleculeModal, "mol-modal", never, { "open": { "alias": "open"; "required": false; }; "title": { "alias": "title"; "required": false; }; "size": { "alias": "size"; "required": false; }; "showCloseButton": { "alias": "showCloseButton"; "required": false; }; "closeLabel": { "alias": "closeLabel"; "required": false; }; "closeOnOverlayClick": { "alias": "closeOnOverlayClick"; "required": false; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; }; "centered": { "alias": "centered"; "required": false; }; "preventScroll": { "alias": "preventScroll"; "required": false; }; "hasFooter": { "alias": "hasFooter"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, { "close": "close"; }, never, ["*", "[modal-footer]"], true, never>;
139
+ * Whether the footer slot carries nodes (read each pass so a later props
140
+ * step adding it still renders).
141
+ * @returns True when the footer wrapper should render.
142
+ */
143
+ private hasFooter;
144
+ /** Applies React's `{!!footer && <div className={dialogFooter}>…</div>}`. */
145
+ private syncFooter;
146
+ /**
147
+ * Applies an open/closed transition (React mounts/unmounts the portal and
148
+ * its effects).
149
+ *
150
+ * @param open - The new open state.
151
+ */
152
+ private transition;
153
+ /** Re-inserts the portal nodes into `document.body` (in React's order). */
154
+ private attachPortal;
155
+ /** Removes the portal nodes from the document (React renders null). */
156
+ private detachPortal;
157
+ /** Locks or unlocks body scroll for React's `open && preventScroll`. */
158
+ private syncScrollLock;
159
+ /** Adds Escape and the Tab focus trap while open (React's effect). */
160
+ private addListeners;
161
+ /** Removes the document listeners. */
162
+ private removeListeners;
163
+ /**
164
+ * Escape closes the topmost dialog; Tab wraps inside it.
165
+ *
166
+ * @param event - The key event.
167
+ */
168
+ private handleKeyDown;
169
+ static ɵfac: i0.ɵɵFactoryDeclaration<Modal, never>;
170
+ static ɵcmp: i0.ɵɵComponentDeclaration<Modal, "mol-modal", never, { "open": { "alias": "open"; "required": false; }; "title": { "alias": "title"; "required": false; }; "size": { "alias": "size"; "required": false; }; "showCloseButton": { "alias": "showCloseButton"; "required": false; }; "closeOnOverlayClick": { "alias": "closeOnOverlayClick"; "required": false; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; }; "footer": { "alias": "footer"; "required": false; }; "centered": { "alias": "centered"; "required": false; }; "closeLabel": { "alias": "closeLabel"; "required": false; }; "preventScroll": { "alias": "preventScroll"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, { "close": "close"; }, never, ["*", "[slot=footer]"], true, never>;
141
171
  }
142
172
  //# sourceMappingURL=modal.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal.component.d.ts","sourceRoot":"","sources":["../../src/components/modal.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,YAAY,EAGZ,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,MAAM,EAEX,KAAK,aAAa,EACnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAGvE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAK7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAE1F;AAED;;;;;GAKG;AACH,qBA0Da,aAAc,YAAW,MAAM,EAAE,SAAS,EAAE,SAAS;IACvD,IAAI,UAAQ;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;I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