@nvidia-elements/core 2.23.4 → 2.23.6

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 (358) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/accordion/accordion2.js +49 -49
  3. package/dist/accordion/accordion2.js.map +1 -1
  4. package/dist/alert/alert-group2.js +22 -21
  5. package/dist/alert/alert-group2.js.map +1 -1
  6. package/dist/alert/alert2.js +29 -28
  7. package/dist/alert/alert2.js.map +1 -1
  8. package/dist/avatar/avatar-group2.js +9 -9
  9. package/dist/avatar/avatar-group2.js.map +1 -1
  10. package/dist/avatar/avatar2.js +12 -11
  11. package/dist/avatar/avatar2.js.map +1 -1
  12. package/dist/badge/badge2.js +27 -26
  13. package/dist/badge/badge2.js.map +1 -1
  14. package/dist/breadcrumb/breadcrumb2.js +17 -17
  15. package/dist/breadcrumb/breadcrumb2.js.map +1 -1
  16. package/dist/bundles/index.js +10 -10
  17. package/dist/button/button2.js +12 -12
  18. package/dist/button/button2.js.map +1 -1
  19. package/dist/button-group/button-group2.js +18 -18
  20. package/dist/button-group/button-group2.js.map +1 -1
  21. package/dist/card/card2.js +28 -28
  22. package/dist/card/card2.js.map +1 -1
  23. package/dist/chat-message/chat-message2.js +15 -14
  24. package/dist/chat-message/chat-message2.js.map +1 -1
  25. package/dist/checkbox/checkbox-group2.js +8 -8
  26. package/dist/checkbox/checkbox-group2.js.map +1 -1
  27. package/dist/checkbox/checkbox2.js +8 -8
  28. package/dist/checkbox/checkbox2.js.map +1 -1
  29. package/dist/color/color2.js +21 -21
  30. package/dist/color/color2.js.map +1 -1
  31. package/dist/combobox/combobox2.js +37 -37
  32. package/dist/combobox/combobox2.js.map +1 -1
  33. package/dist/copy-button/copy-button.d.ts +1 -1
  34. package/dist/copy-button/copy-button2.js +21 -21
  35. package/dist/copy-button/copy-button2.js.map +1 -1
  36. package/dist/custom-elements.json +1032 -337
  37. package/dist/date/date2.js +19 -19
  38. package/dist/date/date2.js.map +1 -1
  39. package/dist/datetime/datetime2.js +19 -19
  40. package/dist/datetime/datetime2.js.map +1 -1
  41. package/dist/dialog/dialog-footer2.js +7 -7
  42. package/dist/dialog/dialog-footer2.js.map +1 -1
  43. package/dist/dialog/dialog-header2.js +7 -7
  44. package/dist/dialog/dialog-header2.js.map +1 -1
  45. package/dist/dialog/dialog2.js +25 -25
  46. package/dist/dialog/dialog2.js.map +1 -1
  47. package/dist/divider/divider2.js +12 -12
  48. package/dist/divider/divider2.js.map +1 -1
  49. package/dist/dot/dot2.js +17 -16
  50. package/dist/dot/dot2.js.map +1 -1
  51. package/dist/drag-handle/drag-handle2.js +12 -12
  52. package/dist/drag-handle/drag-handle2.js.map +1 -1
  53. package/dist/drawer/drawer-content2.js +7 -7
  54. package/dist/drawer/drawer-content2.js.map +1 -1
  55. package/dist/drawer/drawer-footer2.js +7 -7
  56. package/dist/drawer/drawer-footer2.js.map +1 -1
  57. package/dist/drawer/drawer-header2.js +7 -7
  58. package/dist/drawer/drawer-header2.js.map +1 -1
  59. package/dist/drawer/drawer2.js +21 -21
  60. package/dist/drawer/drawer2.js.map +1 -1
  61. package/dist/dropdown/dropdown-footer2.js +7 -7
  62. package/dist/dropdown/dropdown-footer2.js.map +1 -1
  63. package/dist/dropdown/dropdown-header2.js +7 -7
  64. package/dist/dropdown/dropdown-header2.js.map +1 -1
  65. package/dist/dropdown/dropdown2.js +21 -21
  66. package/dist/dropdown/dropdown2.js.map +1 -1
  67. package/dist/dropdown-group/dropdown-group.js +10 -10
  68. package/dist/dropdown-group/dropdown-group.js.map +1 -1
  69. package/dist/dropzone/dropzone2.js +19 -19
  70. package/dist/dropzone/dropzone2.js.map +1 -1
  71. package/dist/file/file2.js +8 -8
  72. package/dist/file/file2.js.map +1 -1
  73. package/dist/format-bytes/format-bytes2.js +13 -13
  74. package/dist/format-bytes/format-bytes2.js.map +1 -1
  75. package/dist/format-datetime/format-datetime2.js +14 -14
  76. package/dist/format-datetime/format-datetime2.js.map +1 -1
  77. package/dist/format-number/format-number2.js +20 -20
  78. package/dist/format-number/format-number2.js.map +1 -1
  79. package/dist/format-relative-time/format-relative-time2.js +11 -11
  80. package/dist/format-relative-time/format-relative-time2.js.map +1 -1
  81. package/dist/format-truncate/format-truncate2.js +21 -21
  82. package/dist/format-truncate/format-truncate2.js.map +1 -1
  83. package/dist/forms/control/control2.js +30 -29
  84. package/dist/forms/control/control2.js.map +1 -1
  85. package/dist/forms/control-group/control-group2.js +19 -18
  86. package/dist/forms/control-group/control-group2.js.map +1 -1
  87. package/dist/forms/control-message/control-message2.js +15 -15
  88. package/dist/forms/control-message/control-message2.js.map +1 -1
  89. package/dist/gauge/gauge2.js +20 -20
  90. package/dist/gauge/gauge2.js.map +1 -1
  91. package/dist/ghost/ghost2.js +10 -10
  92. package/dist/ghost/ghost2.js.map +1 -1
  93. package/dist/grid/cell/cell2.js +9 -9
  94. package/dist/grid/cell/cell2.js.map +1 -1
  95. package/dist/grid/column/column2.js +16 -16
  96. package/dist/grid/column/column2.js.map +1 -1
  97. package/dist/grid/footer/footer2.js +12 -12
  98. package/dist/grid/footer/footer2.js.map +1 -1
  99. package/dist/grid/grid2.js +30 -30
  100. package/dist/grid/grid2.js.map +1 -1
  101. package/dist/grid/header/header2.js +20 -20
  102. package/dist/grid/header/header2.js.map +1 -1
  103. package/dist/grid/placeholder/placeholder2.js +9 -9
  104. package/dist/grid/placeholder/placeholder2.js.map +1 -1
  105. package/dist/grid/row/row2.js +15 -15
  106. package/dist/grid/row/row2.js.map +1 -1
  107. package/dist/icon/icon2.js +40 -40
  108. package/dist/icon/icon2.js.map +1 -1
  109. package/dist/icon-button/icon-button2.js +17 -17
  110. package/dist/icon-button/icon-button2.js.map +1 -1
  111. package/dist/iframe/iframe2.js +7 -7
  112. package/dist/iframe/iframe2.js.map +1 -1
  113. package/dist/index.js +1 -1
  114. package/dist/input/input-group2.js +8 -8
  115. package/dist/input/input-group2.js.map +1 -1
  116. package/dist/input/input2.js +10 -10
  117. package/dist/input/input2.js.map +1 -1
  118. package/dist/internal/controllers/state-expanded.controller.js +1 -1
  119. package/dist/internal/controllers/state-expanded.controller.js.map +1 -1
  120. package/dist/internal/controllers/state-highlighted.controller.js +1 -1
  121. package/dist/internal/controllers/state-highlighted.controller.js.map +1 -1
  122. package/dist/internal/controllers/state-scroll.controller.js +1 -1
  123. package/dist/internal/controllers/state-scroll.controller.js.map +1 -1
  124. package/dist/internal/controllers/state-selected.controller.js +1 -1
  125. package/dist/internal/controllers/state-selected.controller.js.map +1 -1
  126. package/dist/internal/controllers/type-anchor.controller.js +1 -1
  127. package/dist/internal/controllers/type-anchor.controller.js.map +1 -1
  128. package/dist/internal/controllers/type-closable.controller.js +1 -1
  129. package/dist/internal/controllers/type-closable.controller.js.map +1 -1
  130. package/dist/internal/controllers/type-expandable.controller.js +1 -1
  131. package/dist/internal/controllers/type-expandable.controller.js.map +1 -1
  132. package/dist/internal/controllers/type-native-popover.controller.js +6 -6
  133. package/dist/internal/controllers/type-native-popover.controller.js.map +1 -1
  134. package/dist/internal/controllers/type-popover.controller.examples.js.map +1 -1
  135. package/dist/internal/controllers/type-selectable.controller.js +1 -1
  136. package/dist/internal/controllers/type-selectable.controller.js.map +1 -1
  137. package/dist/internal/index.d.ts +0 -1
  138. package/dist/internal/index.js +57 -61
  139. package/dist/internal/index.js.map +1 -1
  140. package/dist/internal/styles/index.d.ts +0 -1
  141. package/dist/internal/styles/index.js +5 -15
  142. package/dist/internal/styles/index.js.map +1 -1
  143. package/dist/internal/utils/a11y.d.ts +0 -3
  144. package/dist/internal/utils/a11y.js +6 -9
  145. package/dist/internal/utils/a11y.js.map +1 -1
  146. package/dist/joystick/joystick2.js +19 -19
  147. package/dist/joystick/joystick2.js.map +1 -1
  148. package/dist/logo/logo2.js +14 -13
  149. package/dist/logo/logo2.js.map +1 -1
  150. package/dist/menu/menu-group2.js +20 -20
  151. package/dist/menu/menu-group2.js.map +1 -1
  152. package/dist/menu/menu-item2.js +11 -11
  153. package/dist/menu/menu-item2.js.map +1 -1
  154. package/dist/menu/menu2.js +14 -14
  155. package/dist/menu/menu2.js.map +1 -1
  156. package/dist/month/month2.js +19 -19
  157. package/dist/month/month2.js.map +1 -1
  158. package/dist/notification/notification-group2.js +13 -13
  159. package/dist/notification/notification-group2.js.map +1 -1
  160. package/dist/notification/notification2.js +31 -31
  161. package/dist/notification/notification2.js.map +1 -1
  162. package/dist/page/page-panel/page-panel-content2.js +7 -7
  163. package/dist/page/page-panel/page-panel-content2.js.map +1 -1
  164. package/dist/page/page-panel/page-panel-footer2.js +9 -9
  165. package/dist/page/page-panel/page-panel-footer2.js.map +1 -1
  166. package/dist/page/page-panel/page-panel-header2.js +9 -9
  167. package/dist/page/page-panel/page-panel-header2.js.map +1 -1
  168. package/dist/page/page-panel/page-panel2.js +15 -15
  169. package/dist/page/page-panel/page-panel2.js.map +1 -1
  170. package/dist/page/page2.js +13 -13
  171. package/dist/page/page2.js.map +1 -1
  172. package/dist/page-header/page-header2.js +10 -10
  173. package/dist/page-header/page-header2.js.map +1 -1
  174. package/dist/page-loader/page-loader2.js +13 -13
  175. package/dist/page-loader/page-loader2.js.map +1 -1
  176. package/dist/pagination/pagination2.js +34 -34
  177. package/dist/pagination/pagination2.js.map +1 -1
  178. package/dist/panel/panel2.js +36 -36
  179. package/dist/panel/panel2.js.map +1 -1
  180. package/dist/password/password2.js +19 -19
  181. package/dist/password/password2.js.map +1 -1
  182. package/dist/preferences-input/preferences-input.d.ts +1 -1
  183. package/dist/preferences-input/preferences-input2.js +25 -25
  184. package/dist/preferences-input/preferences-input2.js.map +1 -1
  185. package/dist/progress-bar/progress-bar2.js +13 -13
  186. package/dist/progress-bar/progress-bar2.js.map +1 -1
  187. package/dist/progress-dot/progress-dot2.js +15 -15
  188. package/dist/progress-dot/progress-dot2.js.map +1 -1
  189. package/dist/progress-ring/progress-ring2.js +20 -20
  190. package/dist/progress-ring/progress-ring2.js.map +1 -1
  191. package/dist/progressive-filter-chip/progressive-filter-chip2.js +28 -28
  192. package/dist/progressive-filter-chip/progressive-filter-chip2.js.map +1 -1
  193. package/dist/pulse/pulse2.js +15 -15
  194. package/dist/pulse/pulse2.js.map +1 -1
  195. package/dist/radio/radio-group2.js +8 -8
  196. package/dist/radio/radio-group2.js.map +1 -1
  197. package/dist/radio/radio2.js +8 -8
  198. package/dist/radio/radio2.js.map +1 -1
  199. package/dist/range/range2.js +16 -16
  200. package/dist/range/range2.js.map +1 -1
  201. package/dist/resize-handle/resize-handle2.js +17 -17
  202. package/dist/resize-handle/resize-handle2.js.map +1 -1
  203. package/dist/search/search2.js +20 -20
  204. package/dist/search/search2.js.map +1 -1
  205. package/dist/select/select2.js +32 -32
  206. package/dist/select/select2.js.map +1 -1
  207. package/dist/skeleton/skeleton2.js +14 -14
  208. package/dist/skeleton/skeleton2.js.map +1 -1
  209. package/dist/sort-button/sort-button.d.ts +1 -1
  210. package/dist/sort-button/sort-button2.js +16 -16
  211. package/dist/sort-button/sort-button2.js.map +1 -1
  212. package/dist/sparkline/sparkline2.js +45 -44
  213. package/dist/sparkline/sparkline2.js.map +1 -1
  214. package/dist/star-rating/star-rating2.js +14 -14
  215. package/dist/star-rating/star-rating2.js.map +1 -1
  216. package/dist/steps/steps2.js +32 -32
  217. package/dist/steps/steps2.js.map +1 -1
  218. package/dist/switch/switch-group2.js +8 -8
  219. package/dist/switch/switch-group2.js.map +1 -1
  220. package/dist/switch/switch2.js +8 -8
  221. package/dist/switch/switch2.js.map +1 -1
  222. package/dist/tabs/tabs-group2.js +18 -18
  223. package/dist/tabs/tabs-group2.js.map +1 -1
  224. package/dist/tabs/tabs-item-group2.js +9 -9
  225. package/dist/tabs/tabs-item-group2.js.map +1 -1
  226. package/dist/tabs/tabs2.js +28 -28
  227. package/dist/tabs/tabs2.js.map +1 -1
  228. package/dist/tag/tag2.js +19 -18
  229. package/dist/tag/tag2.js.map +1 -1
  230. package/dist/textarea/textarea2.js +9 -9
  231. package/dist/textarea/textarea2.js.map +1 -1
  232. package/dist/time/time2.js +19 -19
  233. package/dist/time/time2.js.map +1 -1
  234. package/dist/toast/toast2.js +28 -28
  235. package/dist/toast/toast2.js.map +1 -1
  236. package/dist/toggletip/toggletip-footer2.js +7 -7
  237. package/dist/toggletip/toggletip-footer2.js.map +1 -1
  238. package/dist/toggletip/toggletip-header2.js +7 -7
  239. package/dist/toggletip/toggletip-header2.js.map +1 -1
  240. package/dist/toggletip/toggletip2.js +23 -23
  241. package/dist/toggletip/toggletip2.js.map +1 -1
  242. package/dist/toolbar/toolbar2.js +20 -19
  243. package/dist/toolbar/toolbar2.js.map +1 -1
  244. package/dist/tooltip/tooltip2.js +20 -20
  245. package/dist/tooltip/tooltip2.js.map +1 -1
  246. package/dist/tree/tree-node2.js +39 -39
  247. package/dist/tree/tree-node2.js.map +1 -1
  248. package/dist/tree/tree2.js +20 -20
  249. package/dist/tree/tree2.js.map +1 -1
  250. package/dist/week/week2.js +19 -19
  251. package/dist/week/week2.js.map +1 -1
  252. package/dist/workspace/controllers/workspace-composition.controller.d.ts +4 -1
  253. package/dist/workspace/controllers/workspace-composition.controller.js +69 -39
  254. package/dist/workspace/controllers/workspace-composition.controller.js.map +1 -1
  255. package/dist/workspace/controllers/workspace-rearrange.controller.js +27 -27
  256. package/dist/workspace/controllers/workspace-rearrange.controller.js.map +1 -1
  257. package/dist/workspace/controllers/workspace-restoration.controller.js +2 -2
  258. package/dist/workspace/controllers/workspace-restoration.controller.js.map +1 -1
  259. package/dist/workspace/panel/panel2.js +15 -15
  260. package/dist/workspace/panel/panel2.js.map +1 -1
  261. package/dist/workspace/panel-content/panel-content2.js +7 -7
  262. package/dist/workspace/panel-content/panel-content2.js.map +1 -1
  263. package/dist/workspace/panel-footer/panel-footer2.js +9 -9
  264. package/dist/workspace/panel-footer/panel-footer2.js.map +1 -1
  265. package/dist/workspace/panel-header/panel-header2.js +16 -16
  266. package/dist/workspace/panel-header/panel-header2.js.map +1 -1
  267. package/dist/workspace/utils/comparison.utils.d.ts +3 -0
  268. package/dist/workspace/utils/comparison.utils.js +13 -0
  269. package/dist/workspace/utils/comparison.utils.js.map +1 -0
  270. package/dist/workspace/utils/evaluation.utils.d.ts +65 -6
  271. package/dist/workspace/utils/evaluation.utils.js +334 -99
  272. package/dist/workspace/utils/evaluation.utils.js.map +1 -1
  273. package/dist/workspace/utils/geometry/allocation.utils.js +15 -13
  274. package/dist/workspace/utils/geometry/allocation.utils.js.map +1 -1
  275. package/dist/workspace/utils/geometry/sizing.utils.d.ts +2 -0
  276. package/dist/workspace/utils/geometry/sizing.utils.js +37 -17
  277. package/dist/workspace/utils/geometry/sizing.utils.js.map +1 -1
  278. package/dist/workspace/utils/interaction/boundary.utils.d.ts +2 -2
  279. package/dist/workspace/utils/interaction/boundary.utils.js +2 -2
  280. package/dist/workspace/utils/interaction/boundary.utils.js.map +1 -1
  281. package/dist/workspace/utils/interaction/drag-preview.utils.d.ts +3 -3
  282. package/dist/workspace/utils/interaction/drag-preview.utils.js.map +1 -1
  283. package/dist/workspace/utils/interaction/insertion-offers.utils.d.ts +11 -9
  284. package/dist/workspace/utils/interaction/insertion-offers.utils.js +37 -43
  285. package/dist/workspace/utils/interaction/insertion-offers.utils.js.map +1 -1
  286. package/dist/workspace/utils/interaction/placement-decision.utils.d.ts +6 -1
  287. package/dist/workspace/utils/interaction/placement-decision.utils.js +94 -87
  288. package/dist/workspace/utils/interaction/placement-decision.utils.js.map +1 -1
  289. package/dist/workspace/utils/model/layout.utils.d.ts +2 -1
  290. package/dist/workspace/utils/model/layout.utils.js +12 -10
  291. package/dist/workspace/utils/model/layout.utils.js.map +1 -1
  292. package/dist/workspace/utils/model/membership.utils.d.ts +4 -0
  293. package/dist/workspace/utils/model/membership.utils.js +13 -4
  294. package/dist/workspace/utils/model/membership.utils.js.map +1 -1
  295. package/dist/workspace/utils/model/operations.utils.d.ts +1 -0
  296. package/dist/workspace/utils/model/operations.utils.js +51 -46
  297. package/dist/workspace/utils/model/operations.utils.js.map +1 -1
  298. package/dist/workspace/utils/model/projection.utils.d.ts +4 -2
  299. package/dist/workspace/utils/model/projection.utils.js +49 -40
  300. package/dist/workspace/utils/model/projection.utils.js.map +1 -1
  301. package/dist/workspace/utils/model/value.utils.d.ts +4 -3
  302. package/dist/workspace/utils/model/value.utils.js +15 -50
  303. package/dist/workspace/utils/model/value.utils.js.map +1 -1
  304. package/dist/workspace/utils/placement/acquisition-sizing.utils.d.ts +2 -0
  305. package/dist/workspace/utils/placement/acquisition-sizing.utils.js +30 -22
  306. package/dist/workspace/utils/placement/acquisition-sizing.utils.js.map +1 -1
  307. package/dist/workspace/utils/placement/group-insertion.utils.d.ts +19 -13
  308. package/dist/workspace/utils/placement/group-insertion.utils.js +50 -47
  309. package/dist/workspace/utils/placement/group-insertion.utils.js.map +1 -1
  310. package/dist/workspace/utils/placement/planner.utils.d.ts +13 -2
  311. package/dist/workspace/utils/placement/planner.utils.js +79 -73
  312. package/dist/workspace/utils/placement/planner.utils.js.map +1 -1
  313. package/dist/workspace/utils/placement/preparation.utils.d.ts +5 -2
  314. package/dist/workspace/utils/placement/preparation.utils.js +45 -41
  315. package/dist/workspace/utils/placement/preparation.utils.js.map +1 -1
  316. package/dist/workspace/utils/placement/region.utils.js +32 -32
  317. package/dist/workspace/utils/placement/region.utils.js.map +1 -1
  318. package/dist/workspace/utils/placement/scope.utils.d.ts +34 -0
  319. package/dist/workspace/utils/placement/scope.utils.js +155 -0
  320. package/dist/workspace/utils/placement/scope.utils.js.map +1 -0
  321. package/dist/workspace/utils/placement/session.utils.d.ts +11 -0
  322. package/dist/workspace/utils/placement/session.utils.js +78 -0
  323. package/dist/workspace/utils/placement/session.utils.js.map +1 -0
  324. package/dist/workspace/utils/placement/split-sizing.utils.d.ts +2 -2
  325. package/dist/workspace/utils/placement/split-sizing.utils.js +19 -19
  326. package/dist/workspace/utils/placement/split-sizing.utils.js.map +1 -1
  327. package/dist/workspace/utils/presentation/composition.utils.d.ts +1 -1
  328. package/dist/workspace/utils/presentation/composition.utils.js +4 -2
  329. package/dist/workspace/utils/presentation/composition.utils.js.map +1 -1
  330. package/dist/workspace/utils/presentation/groups.utils.d.ts +3 -3
  331. package/dist/workspace/utils/presentation/groups.utils.js +40 -30
  332. package/dist/workspace/utils/presentation/groups.utils.js.map +1 -1
  333. package/dist/workspace/utils/presentation/measurements.utils.d.ts +1 -0
  334. package/dist/workspace/utils/presentation/measurements.utils.js +6 -14
  335. package/dist/workspace/utils/presentation/measurements.utils.js.map +1 -1
  336. package/dist/workspace/utils/presentation/offers.utils.d.ts +1 -1
  337. package/dist/workspace/utils/presentation/offers.utils.js +3 -3
  338. package/dist/workspace/utils/presentation/offers.utils.js.map +1 -1
  339. package/dist/workspace/utils/presentation/preview.utils.d.ts +6 -0
  340. package/dist/workspace/utils/presentation/preview.utils.js +14 -3
  341. package/dist/workspace/utils/presentation/preview.utils.js.map +1 -1
  342. package/dist/workspace/workspace.examples.js.map +1 -1
  343. package/dist/workspace/workspace.examples.json +4 -4
  344. package/dist/workspace/workspace.js +1 -1
  345. package/dist/workspace/workspace.js.map +1 -1
  346. package/dist/workspace/workspace2.js +233 -239
  347. package/dist/workspace/workspace2.js.map +1 -1
  348. package/package.json +2 -2
  349. package/dist/internal/decorators/scoped-registry.d.ts +0 -2
  350. package/dist/internal/decorators/scoped-registry.js +0 -36
  351. package/dist/internal/decorators/scoped-registry.js.map +0 -1
  352. package/dist/internal/styles/base.js +0 -5
  353. package/dist/internal/styles/base.js.map +0 -1
  354. package/dist/internal/styles/interaction-state.js +0 -5
  355. package/dist/internal/styles/interaction-state.js.map +0 -1
  356. package/dist/workspace/utils/placement/context.utils.d.ts +0 -36
  357. package/dist/workspace/utils/placement/context.utils.js +0 -135
  358. package/dist/workspace/utils/placement/context.utils.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import { formatFileSize as e } from "../internal/utils/strings.js";
2
2
  import { removeEmptyTextNode as t } from "../internal/utils/dom.js";
3
- import { scopedRegistry as n } from "../internal/decorators/scoped-registry.js";
4
- import { useStyles as r } from "../internal/styles/index.js";
5
- import i from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
6
- import { Icon as a } from "../icon/icon2.js";
7
- import o from "./dropzone.js";
8
- import { fileSizeValidator as s, fileTypeValidator as c, getFileTypeSpecifiers as l } from "./dropzone.util.js";
9
- import { LitElement as u, html as d } from "lit";
10
- import { property as f } from "lit/decorators/property.js";
11
- import { I18nController as p } from "@nvidia-elements/foundations/internal/i18n";
3
+ import n from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
4
+ import { Icon as r } from "../icon/icon2.js";
5
+ import i from "./dropzone.js";
6
+ import { fileSizeValidator as a, fileTypeValidator as o, getFileTypeSpecifiers as s } from "./dropzone.util.js";
7
+ import { LitElement as c, html as l } from "lit";
8
+ import { property as u } from "lit/decorators/property.js";
9
+ import { I18nController as d } from "@nvidia-elements/foundations/internal/i18n";
10
+ import { scopedRegistry as f } from "@nvidia-elements/foundations/internal/decorators";
11
+ import { useStyles as p } from "@nvidia-elements/foundations/internal/styles";
12
12
  import { FormControlMixin as m } from "@nvidia-elements/forms/mixins";
13
13
  import { query as h } from "lit/decorators/query.js";
14
14
  // src/dropzone/dropzone.ts
@@ -18,16 +18,16 @@ var g = {
18
18
  dragAndDrop: "drag & drop",
19
19
  browseFiles: "browse files",
20
20
  maxFileSize: "max file size"
21
- }, _ = class extends m(u) {
21
+ }, _ = class extends m(c) {
22
22
  #e;
23
23
  static {
24
- this.styles = r([o]);
24
+ this.styles = p([i]);
25
25
  }
26
26
  static {
27
27
  this.metadata = {
28
28
  tag: "nve-dropzone",
29
- version: "2.23.4",
30
- validators: [c, s],
29
+ version: "2.23.6",
30
+ validators: [o, a],
31
31
  valueSchema: {
32
32
  type: "array",
33
33
  items: {
@@ -42,13 +42,13 @@ var g = {
42
42
  };
43
43
  }
44
44
  static {
45
- this.elementDefinitions = { [a.metadata.tag]: a };
45
+ this.elementDefinitions = { [r.metadata.tag]: r };
46
46
  }
47
47
  formResetCallback() {
48
48
  this.value = [], this.requestUpdate();
49
49
  }
50
50
  constructor() {
51
- super(), this.accept = "image/gif, image/jpeg, image/png, image/svg+xml", this.maxFileSize = 2 * 1024 ** 2, this.#e = new p(this, g), this.i18n = this.#e.i18n, this.value = [];
51
+ super(), this.accept = "image/gif, image/jpeg, image/png, image/svg+xml", this.maxFileSize = 2 * 1024 ** 2, this.#e = new d(this, g), this.i18n = this.#e.i18n, this.value = [];
52
52
  }
53
53
  connectedCallback() {
54
54
  super.connectedCallback(), this.setAttribute("nve-control", ""), globalThis.document.addEventListener("dragover", this.#t), globalThis.document.addEventListener("drop", this.#t);
@@ -85,7 +85,7 @@ var g = {
85
85
  this.value = [...this.value ?? [], ...e], this.dispatchChangeEvent();
86
86
  }
87
87
  #l(e) {
88
- let t = l(e);
88
+ let t = s(e);
89
89
  if (t.length === 1) return t[0].toUpperCase();
90
90
  let n = t.pop();
91
91
  return `${t.join(", ").toUpperCase()} or ${n.toUpperCase()}`;
@@ -97,13 +97,13 @@ var g = {
97
97
  e.target.assignedNodes().forEach((e) => t(e));
98
98
  }
99
99
  render() {
100
- return d`<div internal-host><div class="container" @click="${this.#n}" @dragenter="${this.#r}" @dragover="${this.#i}" @dragleave="${this.#a}" @drop="${this.#o}"><svg class="dropzone-border" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="none" rx="4" ry="4" stroke="currentColor" stroke-width="2" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/></svg><slot name="icon"><nve-icon part="icon" class="icon" name="upload"></nve-icon></slot><slot @slotchange="${this.#d}"><div class="dropzone-text-center"><div class="dropzone-text-bold">${this.i18n.dragAndDrop} ${this.i18n.files} ${this.i18n.or} <span class="text-emphasized">${this.i18n.browseFiles}</span></div><div class="text-muted">${this.#l(this.accept)} — ${this.i18n.maxFileSize} ${e(this.maxFileSize)}</div></div></slot><input id="dropzone-input" type="file" accept="${this.accept}" @change="${this.#s}" multiple="multiple" hidden></div></div>`;
100
+ return l`<div internal-host><div class="container" @click="${this.#n}" @dragenter="${this.#r}" @dragover="${this.#i}" @dragleave="${this.#a}" @drop="${this.#o}"><svg class="dropzone-border" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="none" rx="4" ry="4" stroke="currentColor" stroke-width="2" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/></svg><slot name="icon"><nve-icon part="icon" class="icon" name="upload"></nve-icon></slot><slot @slotchange="${this.#d}"><div class="dropzone-text-center"><div class="dropzone-text-bold">${this.i18n.dragAndDrop} ${this.i18n.files} ${this.i18n.or} <span class="text-emphasized">${this.i18n.browseFiles}</span></div><div class="text-muted">${this.#l(this.accept)} — ${this.i18n.maxFileSize} ${e(this.maxFileSize)}</div></div></slot><input id="dropzone-input" type="file" accept="${this.accept}" @change="${this.#s}" multiple="multiple" hidden></div></div>`;
101
101
  }
102
102
  };
103
- i([f()], _.prototype, "accept", void 0), i([f({
103
+ n([u()], _.prototype, "accept", void 0), n([u({
104
104
  attribute: "max-file-size",
105
105
  type: Number
106
- })], _.prototype, "maxFileSize", void 0), i([f({ type: Object })], _.prototype, "i18n", void 0), i([h("#dropzone-input")], _.prototype, "fileInput", void 0), _ = i([n()], _);
106
+ })], _.prototype, "maxFileSize", void 0), n([u({ type: Object })], _.prototype, "i18n", void 0), n([h("#dropzone-input")], _.prototype, "fileInput", void 0), _ = n([f()], _);
107
107
  export { _ as Dropzone };
108
108
 
109
109
  //# sourceMappingURL=dropzone2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone2.js","names":["styles","_decorate","__decorate","dropzone_default","i18nDefaults","Dropzone","FormControlMixin","LitElement","useStyles","fileTypeValidator","fileSizeValidator","Icon","#i18nController","I18nController","#preventDefaults","event","#toggleHighlighted","files","#addFiles","types","getFileTypeSpecifiers","acceptTypes","lastType","highlighted","removeEmptyTextNode","node","#handleClick","#handleDragEnter","#handleDragOver","#handleDragLeave","#handleDrop","#removeEmptyNodes","#formatFileTypeSpecifiers","formatFileSize","#handleFileInputChange","property","query","scopedRegistry"],"sources":["../../src/dropzone/dropzone.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { formatFileSize, useStyles, removeEmptyTextNode, scopedRegistry } from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport { Icon } from '@nvidia-elements/core/icon';\nimport styles from './dropzone.css?inline';\nimport { FormControlMixin } from '@nvidia-elements/forms/mixins';\nimport { fileTypeValidator, fileSizeValidator, getFileTypeSpecifiers } from './dropzone.util';\n\nconst i18nDefaults = {\n or: 'or',\n files: 'files',\n dragAndDrop: 'drag & drop',\n browseFiles: 'browse files',\n maxFileSize: 'max file size'\n} satisfies I18nDefaults;\n\n/* eslint-disable jsdoc/no-types */\n// Explicit JSDoc type because the CEM analyzer loses the inherited generic specialization.\n\n/**\n * @element nve-dropzone\n * @description A dropzone form control that enables users to drag and drop files onto it.\n * @documentation https://nvidia.github.io/elements/docs/elements/dropzone/\n * @since 1.29.0\n * @entrypoint \\@nvidia-elements/core/dropzone\n * @property {File[]} value - Files selected or dropped by the user. Assign files through the JavaScript property; the HTML `value` attribute is not supported.\n * @event change - Dispatched when the value has changed (files located in event.target)\n * @slot - Custom messaging that replaces the default upload instructions.\n * @cssprop --background\n * @cssprop --border-color\n * @cssprop --border-radius\n * @cssprop --padding\n * @cssprop --min-height\n * @cssprop --color\n * @slot icon - Custom icon that replaces the default upload icon.\n * @csspart icon - The upload icon element\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file\n */\n@scopedRegistry()\nexport class Dropzone extends FormControlMixin<typeof LitElement, File[]>(LitElement) {\n /** Comma-separated file extensions or MIME types accepted by the dropzone. */\n @property()\n accept: string = `image/gif, image/jpeg, image/png, image/svg+xml`;\n\n /** File size limit in bytes. */\n @property({ attribute: 'max-file-size', type: Number })\n maxFileSize: number = 2 * 1024 ** 2;\n\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n\n /**\n * Enables internal string values to update for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n @query('#dropzone-input')\n private fileInput: HTMLInputElement;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-dropzone',\n version: '0.0.0',\n validators: [fileTypeValidator, fileSizeValidator],\n valueSchema: {\n type: 'array' as const,\n items: {\n type: 'object' as const,\n properties: {\n name: { type: 'string' as const },\n size: { type: 'number' as const },\n type: { type: 'string' as const }\n }\n }\n }\n };\n\n static elementDefinitions = {\n [Icon.metadata.tag]: Icon\n };\n\n /** @protected */\n formResetCallback() {\n this.value = [];\n this.requestUpdate();\n }\n\n constructor() {\n super();\n this.value = [];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('nve-control', '');\n globalThis.document.addEventListener('dragover', this.#preventDefaults);\n globalThis.document.addEventListener('drop', this.#preventDefaults);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n globalThis.document.removeEventListener('dragover', this.#preventDefaults);\n globalThis.document.removeEventListener('drop', this.#preventDefaults);\n }\n\n #preventDefaults(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n #handleClick() {\n this.fileInput.click();\n }\n\n #handleDragEnter(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(true);\n }\n\n #handleDragOver(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(true);\n }\n\n #handleDragLeave(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(false);\n }\n\n #handleDrop(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(false);\n\n const files = Array.from(event.dataTransfer!.files);\n this.#addFiles(files);\n }\n\n #handleFileInputChange(event: Event) {\n this.#preventDefaults(event);\n\n const files = Array.from(this.fileInput.files!);\n this.#addFiles(files);\n\n this.fileInput.value = '';\n }\n\n #addFiles(files: File[]) {\n this.value = [...(this.value ?? []), ...files];\n this.dispatchChangeEvent();\n }\n\n #formatFileTypeSpecifiers(acceptTypes: string) {\n const types = getFileTypeSpecifiers(acceptTypes);\n\n if (types.length === 1) {\n return types[0]!.toUpperCase();\n }\n\n const lastType = types.pop();\n return `${types.join(', ').toUpperCase()} or ${lastType!.toUpperCase()}`;\n }\n\n #toggleHighlighted(highlighted: boolean) {\n this.toggleAttribute('highlighted', highlighted);\n }\n\n #removeEmptyNodes(e: Event) {\n (e.target as HTMLSlotElement).assignedNodes().forEach((node: Node) => removeEmptyTextNode(node));\n }\n\n render() {\n return html`<div internal-host>\n <div class=\"container\"\n @click=${this.#handleClick} \n @dragenter=${this.#handleDragEnter}\n @dragover=${this.#handleDragOver}\n @dragleave=${this.#handleDragLeave}\n @drop=${this.#handleDrop}>\n <svg class=\"dropzone-border\" width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"100%\" height=\"100%\" fill=\"none\" rx=\"4\" ry=\"4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-dasharray=\"6,6\" stroke-dashoffset=\"0\" stroke-linecap=\"square\" />\n </svg>\n <slot name=\"icon\"><nve-icon part=\"icon\" class=\"icon\" name=\"upload\"></nve-icon></slot>\n <slot @slotchange=${this.#removeEmptyNodes}>\n <div class=\"dropzone-text-center\">\n <div class=\"dropzone-text-bold\">${this.i18n.dragAndDrop} ${this.i18n.files} ${this.i18n.or} <span class=\"text-emphasized\">${this.i18n.browseFiles}</span></div>\n <div class=\"text-muted\">${this.#formatFileTypeSpecifiers(this.accept)} &mdash; ${this.i18n.maxFileSize} ${formatFileSize(this.maxFileSize)}</div>\n </div>\n </slot>\n <input id=\"dropzone-input\" type=\"file\" accept=${this.accept} @change=${this.#hand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AKC,GAAiB,WAC3B,KAAKC,GAAY,qXAKL,KAAKC,GAAkB,sEAEL,KAAK,KAAK,YAAY,GAAG,KAAK,KAAK,MAAM,GAAG,KAAK,KAAK,GAAG,iCAAiC,KAAK,KAAK,YAAY,uCACxH,KAAKC,GAA0B,KAAK,MAAM,EAAE,KAAW,KAAK,KAAK,YAAY,GAAGC,EAAe,KAAK,WAAW,EAAE,oEAG/F,KAAK,OAAO,aAAW,KAAKC,GAAuB;CAGzG;AACF;AAvJGjC,EAAA,CAAAkC,EAAS,CAAA,GAAA9B,EAAA,WAAA,UAAA,KAAA,CAAA,GAITJ,EAAA,CAAAkC,EAAS;CAAE,WAAW;CAAiB,MAAM;AAAO,CAAC,CAAA,GAAA9B,EAAA,WAAA,eAAA,KAAA,CAAA,GAQrDJ,EAAA,CAAAkC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA9B,EAAA,WAAA,QAAA,KAAA,CAAA,GAEzBJ,EAAA,CAAAmC,EAAM,iBAAiB,CAAA,GAAA/B,EAAA,WAAA,aAAA,KAAA,CAAA,GAjBzB,IAAAJ,EAAA,CAAAoC,EAAe,CAAA,GAAAhC,CAAA"}
1
+ {"version":3,"file":"dropzone2.js","names":["styles","_decorate","__decorate","dropzone_default","i18nDefaults","Dropzone","FormControlMixin","LitElement","useStyles","fileTypeValidator","fileSizeValidator","Icon","#i18nController","I18nController","#preventDefaults","event","#toggleHighlighted","files","#addFiles","types","getFileTypeSpecifiers","acceptTypes","lastType","highlighted","removeEmptyTextNode","node","#handleClick","#handleDragEnter","#handleDragOver","#handleDragLeave","#handleDrop","#removeEmptyNodes","#formatFileTypeSpecifiers","formatFileSize","#handleFileInputChange","property","query","scopedRegistry"],"sources":["../../src/dropzone/dropzone.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { formatFileSize, removeEmptyTextNode } from '@nvidia-elements/core/internal';\nimport { scopedRegistry } from '@nvidia-elements/foundations/internal/decorators';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport { Icon } from '@nvidia-elements/core/icon';\nimport styles from './dropzone.css?inline';\nimport { FormControlMixin } from '@nvidia-elements/forms/mixins';\nimport { fileTypeValidator, fileSizeValidator, getFileTypeSpecifiers } from './dropzone.util';\n\nconst i18nDefaults = {\n or: 'or',\n files: 'files',\n dragAndDrop: 'drag & drop',\n browseFiles: 'browse files',\n maxFileSize: 'max file size'\n} satisfies I18nDefaults;\n\n/* eslint-disable jsdoc/no-types */\n// Explicit JSDoc type because the CEM analyzer loses the inherited generic specialization.\n\n/**\n * @element nve-dropzone\n * @description A dropzone form control that enables users to drag and drop files onto it.\n * @documentation https://nvidia.github.io/elements/docs/elements/dropzone/\n * @since 1.29.0\n * @entrypoint \\@nvidia-elements/core/dropzone\n * @property {File[]} value - Files selected or dropped by the user. Assign files through the JavaScript property; the HTML `value` attribute is not supported.\n * @event change - Dispatched when the value has changed (files located in event.target)\n * @slot - Custom messaging that replaces the default upload instructions.\n * @cssprop --background\n * @cssprop --border-color\n * @cssprop --border-radius\n * @cssprop --padding\n * @cssprop --min-height\n * @cssprop --color\n * @slot icon - Custom icon that replaces the default upload icon.\n * @csspart icon - The upload icon element\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file\n */\n@scopedRegistry()\nexport class Dropzone extends FormControlMixin<typeof LitElement, File[]>(LitElement) {\n /** Comma-separated file extensions or MIME types accepted by the dropzone. */\n @property()\n accept: string = `image/gif, image/jpeg, image/png, image/svg+xml`;\n\n /** File size limit in bytes. */\n @property({ attribute: 'max-file-size', type: Number })\n maxFileSize: number = 2 * 1024 ** 2;\n\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n\n /**\n * Enables internal string values to update for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n @query('#dropzone-input')\n private fileInput: HTMLInputElement;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-dropzone',\n version: '0.0.0',\n validators: [fileTypeValidator, fileSizeValidator],\n valueSchema: {\n type: 'array' as const,\n items: {\n type: 'object' as const,\n properties: {\n name: { type: 'string' as const },\n size: { type: 'number' as const },\n type: { type: 'string' as const }\n }\n }\n }\n };\n\n static elementDefinitions = {\n [Icon.metadata.tag]: Icon\n };\n\n /** @protected */\n formResetCallback() {\n this.value = [];\n this.requestUpdate();\n }\n\n constructor() {\n super();\n this.value = [];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('nve-control', '');\n globalThis.document.addEventListener('dragover', this.#preventDefaults);\n globalThis.document.addEventListener('drop', this.#preventDefaults);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n globalThis.document.removeEventListener('dragover', this.#preventDefaults);\n globalThis.document.removeEventListener('drop', this.#preventDefaults);\n }\n\n #preventDefaults(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n #handleClick() {\n this.fileInput.click();\n }\n\n #handleDragEnter(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(true);\n }\n\n #handleDragOver(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(true);\n }\n\n #handleDragLeave(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(false);\n }\n\n #handleDrop(event: DragEvent) {\n this.#preventDefaults(event);\n this.#toggleHighlighted(false);\n\n const files = Array.from(event.dataTransfer!.files);\n this.#addFiles(files);\n }\n\n #handleFileInputChange(event: Event) {\n this.#preventDefaults(event);\n\n const files = Array.from(this.fileInput.files!);\n this.#addFiles(files);\n\n this.fileInput.value = '';\n }\n\n #addFiles(files: File[]) {\n this.value = [...(this.value ?? []), ...files];\n this.dispatchChangeEvent();\n }\n\n #formatFileTypeSpecifiers(acceptTypes: string) {\n const types = getFileTypeSpecifiers(acceptTypes);\n\n if (types.length === 1) {\n return types[0]!.toUpperCase();\n }\n\n const lastType = types.pop();\n return `${types.join(', ').toUpperCase()} or ${lastType!.toUpperCase()}`;\n }\n\n #toggleHighlighted(highlighted: boolean) {\n this.toggleAttribute('highlighted', highlighted);\n }\n\n #removeEmptyNodes(e: Event) {\n (e.target as HTMLSlotElement).assignedNodes().forEach((node: Node) => removeEmptyTextNode(node));\n }\n\n render() {\n return html`<div internal-host>\n <div class=\"container\"\n @click=${this.#handleClick} \n @dragenter=${this.#handleDragEnter}\n @dragover=${this.#handleDragOver}\n @dragleave=${this.#handleDragLeave}\n @drop=${this.#handleDrop}>\n <svg class=\"dropzone-border\" width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"100%\" height=\"100%\" fill=\"none\" rx=\"4\" ry=\"4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-dasharray=\"6,6\" stroke-dashoffset=\"0\" stroke-linecap=\"square\" />\n </svg>\n <slot name=\"icon\"><nve-icon part=\"icon\" class=\"icon\" name=\"upload\"></nve-icon></slot>\n <slot @slotchange=${this.#removeEmptyNodes}>\n <div class=\"dropzone-text-center\">\n <div class=\"dropzone-text-bold\">${this.i18n.dragAndDrop} ${this.i18n.files} ${this.i18n.or} <span class=\"text-emphasized\">${this.i18n.browseFiles}</span></div>\n <div class=\"text-muted\">${this.#formatFileTypeSpecifiers(this.accept)} &mdash; ${this.i18n.maxFileSize} ${formatFileSize(this.maxFileSize)}</div>\n </div>\n </slot>\n <input id=\"dropzone-input\" type=\"file\" accept=${this.accept} @change=${this.#handleFileInputChange} multiple hidden></input>\n </div>\n </div>`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAMI,IAAe;CACnB,IAAI;CACJ,OAAO;CACP,aAAa;CACb,aAAa;CACb,aAAa;AACf,GAyBaC,IAAN,cAAuBC,EAA4CC,CAAU,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EAAE,KAAW,KAAK,KAAK,YAAY,GAAGC,EAAe,KAAK,WAAW,EAAE,oEAG/F,KAAK,OAAO,aAAW,KAAKC,GAAuB;CAGzG;AACF;AAvJGjC,EAAA,CAAAkC,EAAS,CAAA,GAAA9B,EAAA,WAAA,UAAA,KAAA,CAAA,GAITJ,EAAA,CAAAkC,EAAS;CAAE,WAAW;CAAiB,MAAM;AAAO,CAAC,CAAA,GAAA9B,EAAA,WAAA,eAAA,KAAA,CAAA,GAQrDJ,EAAA,CAAAkC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA9B,EAAA,WAAA,QAAA,KAAA,CAAA,GAEzBJ,EAAA,CAAAmC,EAAM,iBAAiB,CAAA,GAAA/B,EAAA,WAAA,aAAA,KAAA,CAAA,GAjBzB,IAAAJ,EAAA,CAAAoC,EAAe,CAAA,GAAAhC,CAAA"}
@@ -1,21 +1,21 @@
1
1
  import { appendRootNodeStyle as e } from "../internal/utils/dom.js";
2
- import { useStyles as t } from "../internal/styles/index.js";
3
- import { Control as n } from "../forms/control/control2.js";
4
- import r from "./file.js";
5
- import i from "./file.global.js";
2
+ import { Control as t } from "../forms/control/control2.js";
3
+ import n from "./file.js";
4
+ import r from "./file.global.js";
5
+ import { useStyles as i } from "@nvidia-elements/foundations/internal/styles";
6
6
  // src/file/file.ts
7
- var a = class extends n {
7
+ var a = class extends t {
8
8
  static {
9
- this.styles = t([...n.styles, r]);
9
+ this.styles = i([...t.styles, n]);
10
10
  }
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-file",
14
- version: "2.23.4"
14
+ version: "2.23.6"
15
15
  };
16
16
  }
17
17
  connectedCallback() {
18
- super.connectedCallback(), e(this, i);
18
+ super.connectedCallback(), e(this, r);
19
19
  }
20
20
  };
21
21
  export { a as File };
@@ -1 +1 @@
1
- {"version":3,"file":"file2.js","names":["styles","globalStyles","file_default","file_global_default","File","Control","useStyles","appendRootNodeStyle"],"sources":["../../src/file/file.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { CSSResult } from 'lit';\nimport { appendRootNodeStyle, useStyles } from '@nvidia-elements/core/internal';\nimport { Control } from '@nvidia-elements/core/forms';\nimport styles from './file.css?inline';\nimport globalStyles from './file.global.css?inline';\n\n/**\n * @element nve-file\n * @description A file picker is a control that enables users to choose a file value.\n * @documentation https://nvidia.github.io/elements/docs/elements/file/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/file\n * @cssprop --background\n * @cssprop --padding\n * @cssprop --border-radius\n * @cssprop --border\n * @cssprop --font-weight\n * @cssprop --font-size\n * @cssprop --text-decoration\n * @cssprop --cursor\n * @cssprop --gap\n * @cssprop --height\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file\n */\nexport class File extends Control {\n static styles: CSSResult[] = useStyles([...Control.styles, styles]);\n\n static readonly metadata = {\n tag: 'nve-file',\n version: '0.0.0'\n };\n\n connectedCallback() {\n super.connectedCallback();\n appendRootNodeStyle(this, globalStyles);\n }\n}\n"],"mappings":";;;;;;AA2BA,IAAaI,IAAb,cAA0BC,EAAQ;;EACH,KAAA,SAAAC,EAAU,CAAC,GAAGD,EAAQ,QAAQL,CAAM,CAAC;;;EAEvC,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAEA,oBAAoB;EAElB,AADA,MAAM,kBAAkB,GACxBO,EAAoB,MAAMN,CAAY;CACxC;AACF"}
1
+ {"version":3,"file":"file2.js","names":["styles","globalStyles","file_default","file_global_default","File","Control","useStyles","appendRootNodeStyle"],"sources":["../../src/file/file.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { CSSResult } from 'lit';\nimport { appendRootNodeStyle } from '@nvidia-elements/core/internal';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport { Control } from '@nvidia-elements/core/forms';\nimport styles from './file.css?inline';\nimport globalStyles from './file.global.css?inline';\n\n/**\n * @element nve-file\n * @description A file picker is a control that enables users to choose a file value.\n * @documentation https://nvidia.github.io/elements/docs/elements/file/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/file\n * @cssprop --background\n * @cssprop --padding\n * @cssprop --border-radius\n * @cssprop --border\n * @cssprop --font-weight\n * @cssprop --font-size\n * @cssprop --text-decoration\n * @cssprop --cursor\n * @cssprop --gap\n * @cssprop --height\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file\n */\nexport class File extends Control {\n static styles: CSSResult[] = useStyles([...Control.styles, styles]);\n\n static readonly metadata = {\n tag: 'nve-file',\n version: '0.0.0'\n };\n\n connectedCallback() {\n super.connectedCallback();\n appendRootNodeStyle(this, globalStyles);\n }\n}\n"],"mappings":";;;;;;AA4BA,IAAaI,IAAb,cAA0BC,EAAQ;;EACH,KAAA,SAAAC,EAAU,CAAC,GAAGD,EAAQ,QAAQL,CAAM,CAAC;;;EAEvC,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAEA,oBAAoB;EAElB,AADA,MAAM,kBAAkB,GACxBO,EAAoB,MAAMN,CAAY;CACxC;AACF"}
@@ -1,9 +1,9 @@
1
1
  import { typeSSR as e } from "../internal/controllers/type-ssr.controller.js";
2
- import { useStyles as t } from "../internal/styles/index.js";
3
- import n from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
4
- import r from "./format-bytes.js";
5
- import { LitElement as i, html as a } from "lit";
6
- import { property as o } from "lit/decorators/property.js";
2
+ import t from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
3
+ import n from "./format-bytes.js";
4
+ import { LitElement as r, html as i } from "lit";
5
+ import { property as a } from "lit/decorators/property.js";
6
+ import { useStyles as o } from "@nvidia-elements/foundations/internal/styles";
7
7
  // src/format-bytes/format-bytes.ts
8
8
  var s = [
9
9
  "b",
@@ -84,17 +84,17 @@ function p(e) {
84
84
  function m(e) {
85
85
  return l.some((t) => t === e);
86
86
  }
87
- var h = class extends i {
87
+ var h = class extends r {
88
88
  constructor(...e) {
89
89
  super(...e), this.display = "decimal", this.unitDisplay = "short";
90
90
  }
91
91
  static {
92
- this.styles = t([r]);
92
+ this.styles = o([n]);
93
93
  }
94
94
  static {
95
95
  this.metadata = {
96
96
  tag: "nve-format-bytes",
97
- version: "2.23.4"
97
+ version: "2.23.6"
98
98
  };
99
99
  }
100
100
  get #e() {
@@ -155,22 +155,22 @@ var h = class extends i {
155
155
  }
156
156
  }
157
157
  render() {
158
- return a`<data internal-host value="${this.#e}">${this.#l}<slot @slotchange="${this.#u}" hidden></slot></data>`;
158
+ return i`<data internal-host value="${this.#e}">${this.#l}<slot @slotchange="${this.#u}" hidden></slot></data>`;
159
159
  }
160
160
  #u() {
161
161
  this.requestUpdate();
162
162
  }
163
163
  };
164
- n([o({ type: Number })], h.prototype, "value", void 0), n([o({ type: String })], h.prototype, "display", void 0), n([o({ type: String })], h.prototype, "unit", void 0), n([o({
164
+ t([a({ type: Number })], h.prototype, "value", void 0), t([a({ type: String })], h.prototype, "display", void 0), t([a({ type: String })], h.prototype, "unit", void 0), t([a({
165
165
  type: String,
166
166
  attribute: "unit-display"
167
- })], h.prototype, "unitDisplay", void 0), n([o({ type: String })], h.prototype, "locale", void 0), n([o({
167
+ })], h.prototype, "unitDisplay", void 0), t([a({ type: String })], h.prototype, "locale", void 0), t([a({
168
168
  type: Number,
169
169
  attribute: "minimum-fraction-digits"
170
- })], h.prototype, "minimumFractionDigits", void 0), n([o({
170
+ })], h.prototype, "minimumFractionDigits", void 0), t([a({
171
171
  type: Number,
172
172
  attribute: "maximum-fraction-digits"
173
- })], h.prototype, "maximumFractionDigits", void 0), h = n([e()], h);
173
+ })], h.prototype, "maximumFractionDigits", void 0), h = t([e()], h);
174
174
  export { h as FormatBytes };
175
175
 
176
176
  //# sourceMappingURL=format-bytes2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-bytes2.js","names":["styles","_decorate","__decorate","format_bytes_default","UNITS","DISPLAYS","UNIT_DISPLAYS","DECIMAL_LABELS","BINARY_LABELS","isDisplay","display","value","isUnit","unit","isUnitDisplay","unitDisplay","FormatBytes","LitElement","_args","useStyles","#rawValue","#resolvedLocale","#parsedValue","rawValue","numericValue","base","absoluteValue","index","labels","convertedValue","#numberFormatOptions","effectiveMaximumFractionDigits","#formattedBytes","#hasValidConfiguration","resolvedUnit","#resolveAutoUnit","unitIndex","roundedValue","#roundNumber","#formatNumber","#formatLabel","#onSlotChange","property","typeSSR"],"sources":["../../src/format-bytes/format-bytes.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { typeSSR, useStyles } from '@nvidia-elements/core/internal';\nimport styles from './format-bytes.css?inline';\n\nexport type FormatBytesDisplay = 'decimal' | 'binary';\nexport type FormatBytesUnit = 'b' | 'kb' | 'mb' | 'gb' | 'tb' | 'pb';\nexport type FormatBytesUnitDisplay = 'short' | 'long';\n\ninterface UnitLabels {\n short: string;\n singular: string;\n plural: string;\n}\n\nconst UNITS: readonly FormatBytesUnit[] = ['b', 'kb', 'mb', 'gb', 'tb', 'pb'];\nconst DISPLAYS: readonly FormatBytesDisplay[] = ['decimal', 'binary'];\nconst UNIT_DISPLAYS: readonly FormatBytesUnitDisplay[] = ['short', 'long'];\n\nconst DECIMAL_LABELS: Record<FormatBytesUnit, UnitLabels> = {\n b: { short: 'B', singular: 'byte', plural: 'bytes' },\n kb: { short: 'kB', singular: 'kilobyte', plural: 'kilobytes' },\n mb: { short: 'MB', singular: 'megabyte', plural: 'megabytes' },\n gb: { short: 'GB', singular: 'gigabyte', plural: 'gigabytes' },\n tb: { short: 'TB', singular: 'terabyte', plural: 'terabytes' },\n pb: { short: 'PB', singular: 'petabyte', plural: 'petabytes' }\n};\n\nconst BINARY_LABELS: Record<FormatBytesUnit, UnitLabels> = {\n b: { short: 'B', singular: 'byte', plural: 'bytes' },\n kb: { short: 'KiB', singular: 'kibibyte', plural: 'kibibytes' },\n mb: { short: 'MiB', singular: 'mebibyte', plural: 'mebibytes' },\n gb: { short: 'GiB', singular: 'gibibyte', plural: 'gibibytes' },\n tb: { short: 'TiB', singular: 'tebibyte', plural: 'tebibytes' },\n pb: { short: 'PiB', singular: 'pebibyte', plural: 'pebibytes' }\n};\n\nfunction isDisplay(value: unknown): value is FormatBytesDisplay {\n return DISPLAYS.some(display => display === value);\n}\n\nfunction isUnit(value: unknown): value is FormatBytesUnit {\n return UNITS.some(unit => unit === value);\n}\n\nfunction isUnitDisplay(value: unknown): value is FormatBytesUnitDisplay {\n return UNIT_DISPLAYS.some(unitDisplay => unitDisplay === value);\n}\n\n/**\n * @element nve-format-bytes\n * @description Formats a byte count as localized, human-readable decimal or binary units.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-bytes/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-bytes\n * @slot - Numeric byte count to format (such as 1048576). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data\n */\n@typeSSR()\nexport class FormatBytes extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-bytes',\n version: '0.0.0'\n };\n\n /**\n * Optional byte count for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: Number }) value?: number;\n\n /**\n * Unit system: 'decimal' uses powers of 1000 and 'binary' uses powers of 1024.\n */\n @property({ type: String }) display: FormatBytesDisplay = 'decimal';\n\n /**\n * Optional unit magnitude. When omitted, the component selects a unit from the byte count.\n */\n @property({ type: String }) unit?: FormatBytesUnit;\n\n /**\n * Unit label length: 'short' renders labels such as 'MB'; 'long' renders labels such as 'megabytes'.\n */\n @property({ type: String, attribute: 'unit-display' }) unitDisplay: FormatBytesUnitDisplay = 'short';\n\n /**\n * Language tag (such as en-US or de-DE) used to format the number.\n * Defaults to document.documentElement.lang or the runtime default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Pad fraction output to at least this many digits.\n */\n @property({ type: Number, attribute: 'minimum-fraction-digits' }) minimumFractionDigits?: number;\n\n /**\n * Round fraction output to at most this many digits. Defaults to two effective digits after the decimal point.\n */\n @property({ type: Number, attribute: 'maximum-fraction-digits' }) maximumFractionDigits?: number;\n\n get #rawValue(): string {\n const value = Number.isNaN(this.value) ? (this.getAttribute('value') ?? this.value) : this.value;\n return String(value ?? this.textContent?.trim() ?? '');\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #parsedValue(): number | null {\n const rawValue = this.#rawValue;\n if (!rawValue) return null;\n\n const numericValue = Number(rawValue);\n if (Number.isFinite(numericValue)) return numericValue;\n\n return null;\n }\n\n #resolveAutoUnit(value: number, display: FormatBytesDisplay): FormatBytesUnit {\n const base = display === 'binary' ? 1024 : 1000;\n const absoluteValue = Math.abs(value);\n\n for (let index = UNITS.length - 1; index > 0; index--) {\n const unit = UNITS[index];\n if (unit && absoluteValue >= base ** index) return unit;\n }\n\n return 'b';\n }\n\n #formatLabel(unit: FormatBytesUnit, convertedValue: number): string {\n const labels = this.display === 'binary' ? BINARY_LABELS[unit] : DECIMAL_LABELS[unit];\n if (this.unitDisplay === 'short') return labels.short;\n return Math.abs(convertedValue) === 1 ? labels.singular : labels.plural;\n }\n\n #hasValidConfiguration(): boolean {\n return isDisplay(this.display) && isUnitDisplay(this.unitDisplay) && (this.unit === undefined || isUnit(this.unit));\n }\n\n get #numberFormatOptions(): Intl.NumberFormatOptions {\n const effectiveMaximumFractionDigits = this.maximumFractionDigits ?? Math.max(this.minimumFractionDigits ?? 0, 2);\n return {\n minimumFractionDigits: this.minimumFractionDigits,\n maximumFractionDigits: effectiveMaximumFractionDigits\n };\n }\n\n #roundNumber(value: number): number {\n return Number(\n new Intl.NumberFormat('en-US-u-nu-latn', {\n ...this.#numberFormatOptions,\n useGrouping: false\n }).format(value)\n );\n }\n\n #formatNumber(value: number): string {\n return new Intl.NumberFormat(this.#resolvedLocale, this.#numberFormatOptions).format(value);\n }\n\n get #formattedBytes(): string {\n const rawValue = this.#rawValue;\n if (!rawValue) return '';\n\n const numericValue = this.#parsedValue;\n if (numericValue === null) return rawValue;\n if (!this.#hasValidConfiguration()) return rawValue;\n\n const resolvedUnit = this.unit ?? this.#resolveAutoUnit(numericValue, this.display);\n const unitIndex = UNITS.indexOf(resolvedUnit);\n const base = this.display === 'binary' ? 1024 : 1000;\n const convertedValue = numericValue / base ** unitIndex;\n\n try {\n const roundedValue = this.#roundNumber(convertedValue);\n return `${this.#formatNumber(roundedValue)} ${this.#formatLabel(resolvedUnit, roundedValue)}`;\n } catch {\n return rawValue;\n }\n }\n\n render() {\n return html`<data internal-host value=${this.#rawValue}>${this.#formattedBytes}<slot @slotchange=${this.#onSlotChange} hidden></slot></data>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],"mappings":";;;;;;;AAkBA,IAAMI,IAAoC;CAAC;CAAK;CAAM;CAAM;CAAM;CAAM;AAAI,GACtEC,IAA0C,CAAC,WAAW,QAAQ,GAC9DC,IAAmD,CAAC,SAAS,MAAM,GAEnEC,IAAsD;CAC1D,GAAG;EAAE,OAAO;EAAK,UAAU;EAAQ,QAAQ;CAAQ;CACnD,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU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es_default","UNITS","DISPLAYS","UNIT_DISPLAYS","DECIMAL_LABELS","BINARY_LABELS","isDisplay","display","value","isUnit","unit","isUnitDisplay","unitDisplay","FormatBytes","LitElement","_args","useStyles","#rawValue","#resolvedLocale","#parsedValue","rawValue","numericValue","base","absoluteValue","index","labels","convertedValue","#numberFormatOptions","effectiveMaximumFractionDigits","#formattedBytes","#hasValidConfiguration","resolvedUnit","#resolveAutoUnit","unitIndex","roundedValue","#roundNumber","#formatNumber","#formatLabel","#onSlotChange","property","typeSSR"],"sources":["../../src/format-bytes/format-bytes.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { typeSSR } from '@nvidia-elements/core/internal';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport styles from './format-bytes.css?inline';\n\nexport type FormatBytesDisplay = 'decimal' | 'binary';\nexport type FormatBytesUnit = 'b' | 'kb' | 'mb' | 'gb' | 'tb' | 'pb';\nexport type FormatBytesUnitDisplay = 'short' | 'long';\n\ninterface UnitLabels {\n short: string;\n singular: string;\n plural: string;\n}\n\nconst UNITS: readonly FormatBytesUnit[] = ['b', 'kb', 'mb', 'gb', 'tb', 'pb'];\nconst DISPLAYS: readonly FormatBytesDisplay[] = ['decimal', 'binary'];\nconst UNIT_DISPLAYS: readonly FormatBytesUnitDisplay[] = ['short', 'long'];\n\nconst DECIMAL_LABELS: Record<FormatBytesUnit, UnitLabels> = {\n b: { short: 'B', singular: 'byte', plural: 'bytes' },\n kb: { short: 'kB', singular: 'kilobyte', plural: 'kilobytes' },\n mb: { short: 'MB', singular: 'megabyte', plural: 'megabytes' },\n gb: { short: 'GB', singular: 'gigabyte', plural: 'gigabytes' },\n tb: { short: 'TB', singular: 'terabyte', plural: 'terabytes' },\n pb: { short: 'PB', singular: 'petabyte', plural: 'petabytes' }\n};\n\nconst BINARY_LABELS: Record<FormatBytesUnit, UnitLabels> = {\n b: { short: 'B', singular: 'byte', plural: 'bytes' },\n kb: { short: 'KiB', singular: 'kibibyte', plural: 'kibibytes' },\n mb: { short: 'MiB', singular: 'mebibyte', plural: 'mebibytes' },\n gb: { short: 'GiB', singular: 'gibibyte', plural: 'gibibytes' },\n tb: { short: 'TiB', singular: 'tebibyte', plural: 'tebibytes' },\n pb: { short: 'PiB', singular: 'pebibyte', plural: 'pebibytes' }\n};\n\nfunction isDisplay(value: unknown): value is FormatBytesDisplay {\n return DISPLAYS.some(display => display === value);\n}\n\nfunction isUnit(value: unknown): value is FormatBytesUnit {\n return UNITS.some(unit => unit === value);\n}\n\nfunction isUnitDisplay(value: unknown): value is FormatBytesUnitDisplay {\n return UNIT_DISPLAYS.some(unitDisplay => unitDisplay === value);\n}\n\n/**\n * @element nve-format-bytes\n * @description Formats a byte count as localized, human-readable decimal or binary units.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-bytes/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-bytes\n * @slot - Numeric byte count to format (such as 1048576). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data\n */\n@typeSSR()\nexport class FormatBytes extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-bytes',\n version: '0.0.0'\n };\n\n /**\n * Optional byte count for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: Number }) value?: number;\n\n /**\n * Unit system: 'decimal' uses powers of 1000 and 'binary' uses powers of 1024.\n */\n @property({ type: String }) display: FormatBytesDisplay = 'decimal';\n\n /**\n * Optional unit magnitude. When omitted, the component selects a unit from the byte count.\n */\n @property({ type: String }) unit?: FormatBytesUnit;\n\n /**\n * Unit label length: 'short' renders labels such as 'MB'; 'long' renders labels such as 'megabytes'.\n */\n @property({ type: String, attribute: 'unit-display' }) unitDisplay: FormatBytesUnitDisplay = 'short';\n\n /**\n * Language tag (such as en-US or de-DE) used to format the number.\n * Defaults to document.documentElement.lang or the runtime default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Pad fraction output to at least this many digits.\n */\n @property({ type: Number, attribute: 'minimum-fraction-digits' }) minimumFractionDigits?: number;\n\n /**\n * Round fraction output to at most this many digits. Defaults to two effective digits after the decimal point.\n */\n @property({ type: Number, attribute: 'maximum-fraction-digits' }) maximumFractionDigits?: number;\n\n get #rawValue(): string {\n const value = Number.isNaN(this.value) ? (this.getAttribute('value') ?? this.value) : this.value;\n return String(value ?? this.textContent?.trim() ?? '');\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #parsedValue(): number | null {\n const rawValue = this.#rawValue;\n if (!rawValue) return null;\n\n const numericValue = Number(rawValue);\n if (Number.isFinite(numericValue)) return numericValue;\n\n return null;\n }\n\n #resolveAutoUnit(value: number, display: FormatBytesDisplay): FormatBytesUnit {\n const base = display === 'binary' ? 1024 : 1000;\n const absoluteValue = Math.abs(value);\n\n for (let index = UNITS.length - 1; index > 0; index--) {\n const unit = UNITS[index];\n if (unit && absoluteValue >= base ** index) return unit;\n }\n\n return 'b';\n }\n\n #formatLabel(unit: FormatBytesUnit, convertedValue: number): string {\n const labels = this.display === 'binary' ? BINARY_LABELS[unit] : DECIMAL_LABELS[unit];\n if (this.unitDisplay === 'short') return labels.short;\n return Math.abs(convertedValue) === 1 ? labels.singular : labels.plural;\n }\n\n #hasValidConfiguration(): boolean {\n return isDisplay(this.display) && isUnitDisplay(this.unitDisplay) && (this.unit === undefined || isUnit(this.unit));\n }\n\n get #numberFormatOptions(): Intl.NumberFormatOptions {\n const effectiveMaximumFractionDigits = this.maximumFractionDigits ?? Math.max(this.minimumFractionDigits ?? 0, 2);\n return {\n minimumFractionDigits: this.minimumFractionDigits,\n maximumFractionDigits: effectiveMaximumFractionDigits\n };\n }\n\n #roundNumber(value: number): number {\n return Number(\n new Intl.NumberFormat('en-US-u-nu-latn', {\n ...this.#numberFormatOptions,\n useGrouping: false\n }).format(value)\n );\n }\n\n #formatNumber(value: number): string {\n return new Intl.NumberFormat(this.#resolvedLocale, this.#numberFormatOptions).format(value);\n }\n\n get #formattedBytes(): string {\n const rawValue = this.#rawValue;\n if (!rawValue) return '';\n\n const numericValue = this.#parsedValue;\n if (numericValue === null) return rawValue;\n if (!this.#hasValidConfiguration()) return rawValue;\n\n const resolvedUnit = this.unit ?? this.#resolveAutoUnit(numericValue, this.display);\n const unitIndex = UNITS.indexOf(resolvedUnit);\n const base = this.display === 'binary' ? 1024 : 1000;\n const convertedValue = numericValue / base ** unitIndex;\n\n try {\n const roundedValue = this.#roundNumber(convertedValue);\n return `${this.#formatNumber(roundedValue)} ${this.#formatLabel(resolvedUnit, roundedValue)}`;\n } catch {\n return rawValue;\n }\n }\n\n render() {\n return html`<data internal-host value=${this.#rawValue}>${this.#formattedBytes}<slot @slotchange=${this.#onSlotChange} hidden></slot></data>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],"mappings":";;;;;;;AAmBA,IAAMI,IAAoC;CAAC;CAAK;CAAM;CAAM;CAAM;CAAM;AAAI,GACtEC,IAA0C,CAAC,WAAW,QAAQ,GAC9DC,IAAmD,CAAC,SAAS,MAAM,GAEnEC,IAAsD;CAC1D,GAAG;EAAE,OAAO;EAAK,UAAU;EAAQ,QAAQ;CAAQ;CACnD,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;CAC7D,IAAI;EAAE,OAAO;EAAM,UAAU;EAAY,QAAQ;CAAY;AAC/D,GAEMC,IAAqD;CACzD,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BL,KADV,KAAK,YAAY,WAAW,OAAO,QACFY;EAE9C,IAAI;GACF,IAAMC,IAAe,KAAKC,GAAaT,CAAc;GACrD,OAAO,GAAG,KAAKU,GAAcF,CAAY,EAAE,GAAG,KAAKG,GAAaN,GAAcG,CAAY;EAC5F,QAAQ;GACN,OAAOd;EACT;CACF;CAEA,SAAS;EACP,OAAO,CAAI,8BAA6B,KAAKH,GAAU,IAAG,KAAKY,GAAgB,qBAAoB,KAAKS,GAAc;CACxH;CAEA,KAAgB;EACd,KAAK,cAAc;CACrB;AACF;AA3HGxC,EAAA,CAAAyC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA1B,EAAA,WAAA,SAAA,KAAA,CAAA,GAKzBf,EAAA,CAAAyC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA1B,EAAA,WAAA,WAAA,KAAA,CAAA,GAKzBf,EAAA,CAAAyC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA1B,EAAA,WAAA,QAAA,KAAA,CAAA,GAKzBf,EAAA,CAAAyC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAA1B,EAAA,WAAA,eAAA,KAAA,CAAA,GAMpDf,EAAA,CAAAyC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA1B,EAAA,WAAA,UAAA,KAAA,CAAA,GAKzBf,EAAA,CAAAyC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAA0B,CAAC,CAAA,GAAA1B,EAAA,WAAA,yBAAA,KAAA,CAAA,GAK/Df,EAAA,CAAAyC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAA0B,CAAC,CAAA,GAAA1B,EAAA,WAAA,yBAAA,KAAA,CAAA,GA7CjE,IAAAf,EAAA,CAAA0C,EAAQ,CAAA,GAAA3B,CAAA"}
@@ -1,18 +1,18 @@
1
1
  import { typeSSR as e } from "../internal/controllers/type-ssr.controller.js";
2
- import { useStyles as t } from "../internal/styles/index.js";
3
- import n from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
4
- import r from "./format-datetime.js";
5
- import { LitElement as i, html as a } from "lit";
6
- import { property as o } from "lit/decorators/property.js";
2
+ import t from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
3
+ import n from "./format-datetime.js";
4
+ import { LitElement as r, html as i } from "lit";
5
+ import { property as a } from "lit/decorators/property.js";
6
+ import { useStyles as o } from "@nvidia-elements/foundations/internal/styles";
7
7
  // src/format-datetime/format-datetime.ts
8
- var s = class extends i {
8
+ var s = class extends r {
9
9
  static {
10
- this.styles = t([r]);
10
+ this.styles = o([n]);
11
11
  }
12
12
  static {
13
13
  this.metadata = {
14
14
  tag: "nve-format-datetime",
15
- version: "2.23.4"
15
+ version: "2.23.6"
16
16
  };
17
17
  }
18
18
  get #e() {
@@ -51,25 +51,25 @@ var s = class extends i {
51
51
  return isNaN(t.getTime()) ? null : t;
52
52
  }
53
53
  render() {
54
- return a`<time internal-host datetime="${this.#e}">${this.#n}<slot @slotchange="${this.#c}" hidden></slot></time>`;
54
+ return i`<time internal-host datetime="${this.#e}">${this.#n}<slot @slotchange="${this.#c}" hidden></slot></time>`;
55
55
  }
56
56
  #c() {
57
57
  this.requestUpdate();
58
58
  }
59
59
  };
60
- n([o({ type: String })], s.prototype, "date", void 0), n([o({ type: String })], s.prototype, "locale", void 0), n([o({ type: String })], s.prototype, "weekday", void 0), n([o({ type: String })], s.prototype, "year", void 0), n([o({ type: String })], s.prototype, "month", void 0), n([o({ type: String })], s.prototype, "day", void 0), n([o({ type: String })], s.prototype, "hour", void 0), n([o({ type: String })], s.prototype, "minute", void 0), n([o({ type: String })], s.prototype, "second", void 0), n([o({
60
+ t([a({ type: String })], s.prototype, "date", void 0), t([a({ type: String })], s.prototype, "locale", void 0), t([a({ type: String })], s.prototype, "weekday", void 0), t([a({ type: String })], s.prototype, "year", void 0), t([a({ type: String })], s.prototype, "month", void 0), t([a({ type: String })], s.prototype, "day", void 0), t([a({ type: String })], s.prototype, "hour", void 0), t([a({ type: String })], s.prototype, "minute", void 0), t([a({ type: String })], s.prototype, "second", void 0), t([a({
61
61
  type: String,
62
62
  attribute: "date-style"
63
- })], s.prototype, "dateStyle", void 0), n([o({
63
+ })], s.prototype, "dateStyle", void 0), t([a({
64
64
  type: String,
65
65
  attribute: "time-style"
66
- })], s.prototype, "timeStyle", void 0), n([o({
66
+ })], s.prototype, "timeStyle", void 0), t([a({
67
67
  type: String,
68
68
  attribute: "time-zone-name"
69
- })], s.prototype, "timeZoneName", void 0), n([o({
69
+ })], s.prototype, "timeZoneName", void 0), t([a({
70
70
  type: String,
71
71
  attribute: "time-zone"
72
- })], s.prototype, "timeZone", void 0), s = n([e()], s);
72
+ })], s.prototype, "timeZone", void 0), s = t([e()], s);
73
73
  export { s as FormatDatetime };
74
74
 
75
75
  //# sourceMappingURL=format-datetime2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-datetime2.js","names":["styles","_decorate","__decorate","format_datetime_default","FormatDatetime","LitElement","useStyles","#dateValue","#resolvedLocale","#formattedDate","iso","date","#parseDate","#formatOptions","#hasPresetStyle","#presetFormatOptions","#granularFormatOptions","options","#onSlotChange","property","typeSSR"],"sources":["../../src/format-datetime/format-datetime.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { useStyles, typeSSR } from '@nvidia-elements/core/internal';\nimport styles from './format-datetime.css?inline';\n\n/**\n * @element nve-format-datetime\n * @description Formats a date/time value as localized text using the Intl.DateTimeFormat API. Renders inside a semantic time element.\n * Granular options (weekday, year, month, day, hour, minute, second) mirror the Intl.DateTimeFormat API. 'numeric' omits zero-padding, '2-digit' zero-pads.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-datetime/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-datetime\n * @slot - Date string to format (such as 2023-07-28T04:20:17.434Z). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time\n */\n@typeSSR()\nexport class FormatDatetime extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-datetime',\n version: '0.0.0'\n };\n\n /**\n * Optional date string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) date?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Weekday representation: 'long' | 'short' | 'narrow'.\n */\n @property({ type: String }) weekday?: 'long' | 'short' | 'narrow';\n\n /**\n * Year representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) year?: 'numeric' | '2-digit';\n\n /**\n * Month representation: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow'.\n */\n @property({ type: String }) month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';\n\n /**\n * Day representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) day?: 'numeric' | '2-digit';\n\n /**\n * Hour representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) hour?: 'numeric' | '2-digit';\n\n /**\n * Minute representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) minute?: 'numeric' | '2-digit';\n\n /**\n * Second representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) second?: 'numeric' | '2-digit';\n\n /**\n * Preset date formatting style: 'full' | 'long' | 'medium' | 'short'.\n * Preset styles take precedence over granular date and time part options.\n */\n @property({ type: String, attribute: 'date-style' }) dateStyle?: 'full' | 'long' | 'medium' | 'short';\n\n /**\n * Preset time formatting style: 'full' | 'long' | 'medium' | 'short'.\n * Preset styles take precedence over granular date and time part options.\n */\n @property({ type: String, attribute: 'time-style' }) timeStyle?: 'full' | 'long' | 'medium' | 'short';\n\n /**\n * Time zone name display: 'long' | 'short'. Use it with granular options only; preset styles ignore it.\n */\n @property({ type: String, attribute: 'time-zone-name' }) timeZoneName?: 'long' | 'short';\n\n /**\n * IANA time zone identifier (such as 'America/New_York', 'UTC').\n */\n @property({ type: String, attribute: 'time-zone' }) timeZone?: string;\n\n get #dateValue(): string {\n return this.date ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #formattedDate(): string {\n const iso = this.#dateValue;\n if (!iso) return '';\n\n const date = this.#parseDate(iso);\n if (!date) return iso;\n\n try {\n return new Intl.DateTimeFormat(this.#resolvedLocale, this.#formatOptions).format(date);\n } catch {\n return iso;\n }\n }\n\n get #formatOptions(): Intl.DateTimeFormatOptions {\n return this.#hasPresetStyle ? this.#presetFormatOptions : this.#granularFormatOptions;\n }\n\n get #hasPresetStyle(): boolean {\n return this.dateStyle !== undefined || this.timeStyle !== undefined;\n }\n\n get #presetFormatOptions(): Intl.DateTimeFormatOptions {\n const options: Intl.DateTimeFormatOptions = {};\n\n if (this.dateStyle) options.dateStyle = this.dateStyle;\n if (this.timeStyle) options.timeStyle = this.timeStyle;\n if (this.timeZone) options.timeZone = this.timeZone;\n\n return options;\n }\n\n get #granularFormatOptions(): Intl.DateTimeFormatOptions {\n const options: Intl.DateTimeFormatOptions = {};\n\n if (this.weekday) options.weekday = this.weekday;\n if (this.year) options.year = this.year;\n if (this.month) options.month = this.month;\n if (this.day) options.day = this.day;\n if (this.hour) options.hour = this.hour;\n if (this.minute) options.minute = this.minute;\n if (this.second) options.second = this.second;\n if (this.timeZoneName) options.timeZoneName = this.timeZoneName;\n if (this.timeZone) options.timeZone = this.timeZone;\n\n return options;\n }\n\n #parseDate(iso: string): Date | null {\n const date = new Date(iso);\n if (!isNaN(date.getTime())) return date;\n\n return null;\n }\n\n render() {\n return html`<time internal-host datetime=${this.#dateValue}>${this.#formattedDate}<slot @slotchange=${this.#onSlotChange}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AAO,CAAC,CAAA,GAAAf,EAAA,WAAA,UAAA,KAAA,CAAA,GAMzBH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAAf,EAAA,WAAA,aAAA,KAAA,CAAA,GAMlDH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAAf,EAAA,WAAA,aAAA,KAAA,CAAA,GAKlDH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAiB,CAAC,CAAA,GAAAf,EAAA,WAAA,gBAAA,KAAA,CAAA,GAKtDH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAY,CAAC,CAAA,GAAAf,EAAA,WAAA,YAAA,KAAA,CAAA,GA5EnD,IAAAH,EAAA,CAAAmB,EAAQ,CAAA,GAAAhB,CAAA"}
1
+ {"version":3,"file":"format-datetime2.js","names":["styles","_decorate","__decorate","format_datetime_default","FormatDatetime","LitElement","useStyles","#dateValue","#resolvedLocale","#formattedDate","iso","date","#parseDate","#formatOptions","#hasPresetStyle","#presetFormatOptions","#granularFormatOptions","options","#onSlotChange","property","typeSSR"],"sources":["../../src/format-datetime/format-datetime.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { typeSSR } from '@nvidia-elements/core/internal';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport styles from './format-datetime.css?inline';\n\n/**\n * @element nve-format-datetime\n * @description Formats a date/time value as localized text using the Intl.DateTimeFormat API. Renders inside a semantic time element.\n * Granular options (weekday, year, month, day, hour, minute, second) mirror the Intl.DateTimeFormat API. 'numeric' omits zero-padding, '2-digit' zero-pads.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-datetime/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-datetime\n * @slot - Date string to format (such as 2023-07-28T04:20:17.434Z). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time\n */\n@typeSSR()\nexport class FormatDatetime extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-datetime',\n version: '0.0.0'\n };\n\n /**\n * Optional date string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) date?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Weekday representation: 'long' | 'short' | 'narrow'.\n */\n @property({ type: String }) weekday?: 'long' | 'short' | 'narrow';\n\n /**\n * Year representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) year?: 'numeric' | '2-digit';\n\n /**\n * Month representation: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow'.\n */\n @property({ type: String }) month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';\n\n /**\n * Day representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) day?: 'numeric' | '2-digit';\n\n /**\n * Hour representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) hour?: 'numeric' | '2-digit';\n\n /**\n * Minute representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) minute?: 'numeric' | '2-digit';\n\n /**\n * Second representation: 'numeric' | '2-digit'.\n */\n @property({ type: String }) second?: 'numeric' | '2-digit';\n\n /**\n * Preset date formatting style: 'full' | 'long' | 'medium' | 'short'.\n * Preset styles take precedence over granular date and time part options.\n */\n @property({ type: String, attribute: 'date-style' }) dateStyle?: 'full' | 'long' | 'medium' | 'short';\n\n /**\n * Preset time formatting style: 'full' | 'long' | 'medium' | 'short'.\n * Preset styles take precedence over granular date and time part options.\n */\n @property({ type: String, attribute: 'time-style' }) timeStyle?: 'full' | 'long' | 'medium' | 'short';\n\n /**\n * Time zone name display: 'long' | 'short'. Use it with granular options only; preset styles ignore it.\n */\n @property({ type: String, attribute: 'time-zone-name' }) timeZoneName?: 'long' | 'short';\n\n /**\n * IANA time zone identifier (such as 'America/New_York', 'UTC').\n */\n @property({ type: String, attribute: 'time-zone' }) timeZone?: string;\n\n get #dateValue(): string {\n return this.date ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #formattedDate(): string {\n const iso = this.#dateValue;\n if (!iso) return '';\n\n const date = this.#parseDate(iso);\n if (!date) return iso;\n\n try {\n return new Intl.DateTimeFormat(this.#resolvedLocale, this.#formatOptions).format(date);\n } catch {\n return iso;\n }\n }\n\n get #formatOptions(): Intl.DateTimeFormatOptions {\n return this.#hasPresetStyle ? this.#presetFormatOptions : this.#granularFormatOptions;\n }\n\n get #hasPresetStyle(): boolean {\n return this.dateStyle !== undefined || this.timeStyle !== undefined;\n }\n\n get #presetFormatOptions(): Intl.DateTimeFormatOptions {\n const options: Intl.DateTimeFormatOptions = {};\n\n if (this.dateStyle) options.dateStyle = this.dateStyle;\n if (this.timeStyle) options.timeStyle = this.timeStyle;\n if (this.timeZone) options.timeZone = this.timeZone;\n\n return options;\n }\n\n get #granularFormatOptions(): Intl.DateTimeFormatOptions {\n const options: Intl.DateTimeFormatOptions = {};\n\n if (this.weekday) options.weekday = this.weekday;\n if (this.year) options.year = this.year;\n if (this.month) options.month = this.month;\n if (this.day) options.day = this.day;\n if (this.hour) options.hour = this.hour;\n if (this.minute) options.minute = this.minute;\n if (this.second) options.second = this.second;\n if (this.timeZoneName) options.timeZoneName = this.timeZoneName;\n if (this.timeZone) options.timeZone = this.timeZone;\n\n return options;\n }\n\n #parseDate(iso: string): Date | null {\n const date = new Date(iso);\n if (!isNaN(date.getTime())) return date;\n\n return null;\n }\n\n render() {\n return html`<time internal-host datetime=${this.#dateValue}>${this.#formattedDate}<slot @slot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AS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAf,EAAA,WAAA,UAAA,KAAA,CAAA,GAMzBH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAAf,EAAA,WAAA,aAAA,KAAA,CAAA,GAMlDH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAAf,EAAA,WAAA,aAAA,KAAA,CAAA,GAKlDH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAiB,CAAC,CAAA,GAAAf,EAAA,WAAA,gBAAA,KAAA,CAAA,GAKtDH,EAAA,CAAAkB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAY,CAAC,CAAA,GAAAf,EAAA,WAAA,YAAA,KAAA,CAAA,GA5EnD,IAAAH,EAAA,CAAAmB,EAAQ,CAAA,GAAAhB,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { typeSSR as e } from "../internal/controllers/type-ssr.controller.js";
2
- import { useStyles as t } from "../internal/styles/index.js";
3
- import n from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
4
- import r from "./format-number.js";
5
- import { LitElement as i, html as a } from "lit";
6
- import { property as o } from "lit/decorators/property.js";
2
+ import t from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
3
+ import n from "./format-number.js";
4
+ import { LitElement as r, html as i } from "lit";
5
+ import { property as a } from "lit/decorators/property.js";
6
+ import { useStyles as o } from "@nvidia-elements/foundations/internal/styles";
7
7
  // src/format-number/format-number.ts
8
8
  var s = [
9
9
  ["currency", "currency"],
@@ -18,17 +18,17 @@ var s = [
18
18
  ["minimumFractionDigits", "minimumFractionDigits"],
19
19
  ["maximumFractionDigits", "maximumFractionDigits"],
20
20
  ["minimumIntegerDigits", "minimumIntegerDigits"]
21
- ], l = class extends i {
21
+ ], l = class extends r {
22
22
  constructor(...e) {
23
23
  super(...e), this.formatStyle = "decimal";
24
24
  }
25
25
  static {
26
- this.styles = t([r]);
26
+ this.styles = o([n]);
27
27
  }
28
28
  static {
29
29
  this.metadata = {
30
30
  tag: "nve-format-number",
31
- version: "2.23.4"
31
+ version: "2.23.6"
32
32
  };
33
33
  }
34
34
  get #e() {
@@ -67,43 +67,43 @@ var s = [
67
67
  }
68
68
  }
69
69
  render() {
70
- return a`<data internal-host value="${this.#e}">${this.#i}<slot @slotchange="${this.#a}" hidden></slot></data>`;
70
+ return i`<data internal-host value="${this.#e}">${this.#i}<slot @slotchange="${this.#a}" hidden></slot></data>`;
71
71
  }
72
72
  #a() {
73
73
  this.requestUpdate();
74
74
  }
75
75
  };
76
- n([o({ type: String })], l.prototype, "number", void 0), n([o({ type: String })], l.prototype, "locale", void 0), n([o({
76
+ t([a({ type: String })], l.prototype, "number", void 0), t([a({ type: String })], l.prototype, "locale", void 0), t([a({
77
77
  type: String,
78
78
  attribute: "format-style"
79
- })], l.prototype, "formatStyle", void 0), n([o({ type: String })], l.prototype, "currency", void 0), n([o({
79
+ })], l.prototype, "formatStyle", void 0), t([a({ type: String })], l.prototype, "currency", void 0), t([a({
80
80
  type: String,
81
81
  attribute: "currency-sign"
82
- })], l.prototype, "currencySign", void 0), n([o({
82
+ })], l.prototype, "currencySign", void 0), t([a({
83
83
  type: String,
84
84
  attribute: "currency-display"
85
- })], l.prototype, "currencyDisplay", void 0), n([o({ type: String })], l.prototype, "unit", void 0), n([o({
85
+ })], l.prototype, "currencyDisplay", void 0), t([a({ type: String })], l.prototype, "unit", void 0), t([a({
86
86
  type: String,
87
87
  attribute: "unit-display"
88
- })], l.prototype, "unitDisplay", void 0), n([o({ type: String })], l.prototype, "notation", void 0), n([o({
88
+ })], l.prototype, "unitDisplay", void 0), t([a({ type: String })], l.prototype, "notation", void 0), t([a({
89
89
  type: String,
90
90
  attribute: "compact-display"
91
- })], l.prototype, "compactDisplay", void 0), n([o({
91
+ })], l.prototype, "compactDisplay", void 0), t([a({
92
92
  type: String,
93
93
  attribute: "sign-display"
94
- })], l.prototype, "signDisplay", void 0), n([o({
94
+ })], l.prototype, "signDisplay", void 0), t([a({
95
95
  type: String,
96
96
  attribute: "use-grouping"
97
- })], l.prototype, "useGrouping", void 0), n([o({
97
+ })], l.prototype, "useGrouping", void 0), t([a({
98
98
  type: Number,
99
99
  attribute: "minimum-fraction-digits"
100
- })], l.prototype, "minimumFractionDigits", void 0), n([o({
100
+ })], l.prototype, "minimumFractionDigits", void 0), t([a({
101
101
  type: Number,
102
102
  attribute: "maximum-fraction-digits"
103
- })], l.prototype, "maximumFractionDigits", void 0), n([o({
103
+ })], l.prototype, "maximumFractionDigits", void 0), t([a({
104
104
  type: Number,
105
105
  attribute: "minimum-integer-digits"
106
- })], l.prototype, "minimumIntegerDigits", void 0), l = n([e()], l);
106
+ })], l.prototype, "minimumIntegerDigits", void 0), l = t([e()], l);
107
107
  export { l as FormatNumber };
108
108
 
109
109
  //# sourceMappingURL=format-number2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-number2.js","names":["styles","_decorate","__decorate","format_number_default","STRING_KEYS","NUMBER_KEYS","FormatNumber","LitElement","_args","useStyles","#rawValue","#resolvedLocale","#parsedNumber","raw","numericValue","#formatOptions","options","prop","key","value","#formattedNumber","#onSlotChange","property","typeSSR"],"sources":["../../src/format-number/format-number.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { useStyles, typeSSR } from '@nvidia-elements/core/internal';\nimport styles from './format-number.css?inline';\n\nexport type FormatNumberStyle = 'decimal' | 'currency' | 'percent' | 'unit';\nexport type CurrencyDisplayOption = 'symbol' | 'code' | 'name' | 'narrowSymbol';\nexport type CurrencySignOption = 'standard' | 'accounting';\nexport type NotationOption = 'standard' | 'scientific' | 'engineering' | 'compact';\nexport type CompactDisplayOption = 'short' | 'long';\nexport type UnitDisplayOption = 'short' | 'long' | 'narrow';\nexport type SignDisplayOption = 'auto' | 'never' | 'always' | 'exceptZero';\n\nconst STRING_KEYS: [keyof FormatNumber, string][] = [\n ['currency', 'currency'],\n ['currencyDisplay', 'currencyDisplay'],\n ['currencySign', 'currencySign'],\n ['notation', 'notation'],\n ['compactDisplay', 'compactDisplay'],\n ['unit', 'unit'],\n ['unitDisplay', 'unitDisplay'],\n ['signDisplay', 'signDisplay']\n];\n\nconst NUMBER_KEYS: [keyof FormatNumber, string][] = [\n ['minimumFractionDigits', 'minimumFractionDigits'],\n ['maximumFractionDigits', 'maximumFractionDigits'],\n ['minimumIntegerDigits', 'minimumIntegerDigits']\n];\n\n/**\n * @element nve-format-number\n * @description A localized number formatter for currencies, percentages, units, and compact notation, backed by Intl.NumberFormat.\n * Provide a `currency` attribute when `formatStyle` is `currency`, and a `unit` attribute when `formatStyle` is `unit`.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-number/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-number\n * @slot - Numeric string to format (such as 1234567 or 1234.56). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data\n */\n@typeSSR()\nexport class FormatNumber extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-number',\n version: '0.0.0'\n };\n\n /**\n * Optional numeric string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) number?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Formatting style: 'decimal' | 'currency' | 'percent' | 'unit'.\n */\n @property({ type: String, attribute: 'format-style' }) formatStyle: FormatNumberStyle = 'decimal';\n\n /**\n * ISO 4217 currency code (such as USD or EUR). Required when formatStyle is currency.\n */\n @property({ type: String }) currency?: string;\n\n /**\n * Currency sign style: 'standard' | 'accounting'.\n */\n @property({ type: String, attribute: 'currency-sign' }) currencySign?: CurrencySignOption;\n\n /**\n * Currency display style: 'symbol' | 'code' | 'name' | 'narrowSymbol'.\n */\n @property({ type: String, attribute: 'currency-display' }) currencyDisplay?: CurrencyDisplayOption;\n\n /**\n * Unit identifier (such as kilometer or byte). Required when formatStyle is unit.\n */\n @property({ type: String }) unit?: string;\n\n /**\n * Unit display style: 'short' | 'long' | 'narrow'.\n */\n @property({ type: String, attribute: 'unit-display' }) unitDisplay?: UnitDisplayOption;\n\n /**\n * Number notation: 'standard' | 'scientific' | 'engineering' | 'compact'.\n */\n @property({ type: String }) notation?: NotationOption;\n\n /**\n * Compact notation display: 'short' | 'long'. Only applies when notation is compact.\n */\n @property({ type: String, attribute: 'compact-display' }) compactDisplay?: CompactDisplayOption;\n\n /**\n * Sign display: 'auto' | 'never' | 'always' | 'exceptZero'.\n */\n @property({ type: String, attribute: 'sign-display' }) signDisplay?: SignDisplayOption;\n\n /**\n * Grouping separators: 'auto' | 'always' | 'min2' | 'true' | 'false'.\n */\n @property({ type: String, attribute: 'use-grouping' })\n useGrouping?: 'auto' | 'always' | 'min2' | 'true' | 'false' | boolean;\n\n /**\n * Pad fraction output to at least this many digits (0-100).\n */\n @property({ type: Number, attribute: 'minimum-fraction-digits' }) minimumFractionDigits?: number;\n\n /**\n * Round fraction output to at most this many digits (0-100).\n */\n @property({ type: Number, attribute: 'maximum-fraction-digits' }) maximumFractionDigits?: number;\n\n /**\n * Pad integer output to at least this many digits (1-21).\n */\n @property({ type: Number, attribute: 'minimum-integer-digits' }) minimumIntegerDigits?: number;\n\n get #rawValue(): string {\n return this.number ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #parsedNumber(): number | null {\n const raw = this.#rawValue;\n if (!raw) return null;\n\n const numericValue = Number(raw);\n if (Number.isFinite(numericValue)) return numericValue;\n\n return null;\n }\n\n get #formatOptions(): Intl.NumberFormatOptions {\n const options: Intl.NumberFormatOptions = { style: this.formatStyle };\n\n for (const [prop, key] of STRING_KEYS) {\n const value = this[prop] as string | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n for (const [prop, key] of NUMBER_KEYS) {\n const value = this[prop] as number | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n if (this.useGrouping !== undefined) {\n const grouping = this.useGrouping === 'false' ? false : this.useGrouping === 'true' ? true : this.useGrouping;\n (options as Record<string, unknown>).useGrouping = grouping;\n }\n\n return options;\n }\n\n get #formattedNumber(): string {\n const raw = this.#rawValue;\n if (!raw) return '';\n\n const numericValue = this.#parsedNumber;\n if (numericValue === null) return raw;\n\n try {\n return new Intl.NumberFormat(this.#resolvedLocale, this.#formatOptions).format(numericValue);\n } catch {\n return raw;\n }\n }\n\n render() {\n return html`<data internal-host value=${this.#rawValue}>${this.#formattedNumber}<slot @slotchange=${this.#onSlotChange} hidden></slot></data>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],"mappings":";;;;;;;AAgBA,IAAMI,IAA8C;CAClD,CAAC,YAAY,UAAU;CACvB,CAAC,mBAAmB,iBAAiB;CACrC,CAAC,gBAAgB,cAAc;CAC/B,CAAC,YAAY,UAAU;CACvB,CAAC,kBAAkB,gBAAgB;CACnC,CAAC,QAAQ,MAAM;CACf,CAAC,eAAe,aAAa;CAC7B,CAAC,eAAe,aAAa;AAC/B,GAEMC,IAA8C;CAClD,CAAC,yBAAyB,uBAAuB;CACjD,CAAC,yBAAyB,uBAAuB;CACjD,CAAC,wBAAwB,sBAAsB;AACjD,GAaaC,IAAN,cAA2BC,EAAW;;EAuB6C,A,aAAA,KAAA,cAAA;;;EAtBxE,KAAA,SAAAE,EAAU,CAACT,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAgFA,IAAIU,KAAoB;EACtB,OAAO,K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CAAC,CAAA,GAAAhB,EAAA,WAAA,yBAAA,KAAA,CAAA,GAK/DL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAA0B,CAAC,CAAA,GAAAhB,EAAA,WAAA,yBAAA,KAAA,CAAA,GAK/DL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAyB,CAAC,CAAA,GAAAhB,EAAA,WAAA,wBAAA,KAAA,CAAA,GArFhE,IAAAL,EAAA,CAAAsB,EAAQ,CAAA,GAAAjB,CAAA"}
1
+ {"version":3,"file":"format-number2.js","names":["styles","_decorate","__decorate","format_number_default","STRING_KEYS","NUMBER_KEYS","FormatNumber","LitElement","_args","useStyles","#rawValue","#resolvedLocale","#parsedNumber","raw","numericValue","#formatOptions","options","prop","key","value","#formattedNumber","#onSlotChange","property","typeSSR"],"sources":["../../src/format-number/format-number.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { typeSSR } from '@nvidia-elements/core/internal';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport styles from './format-number.css?inline';\n\nexport type FormatNumberStyle = 'decimal' | 'currency' | 'percent' | 'unit';\nexport type CurrencyDisplayOption = 'symbol' | 'code' | 'name' | 'narrowSymbol';\nexport type CurrencySignOption = 'standard' | 'accounting';\nexport type NotationOption = 'standard' | 'scientific' | 'engineering' | 'compact';\nexport type CompactDisplayOption = 'short' | 'long';\nexport type UnitDisplayOption = 'short' | 'long' | 'narrow';\nexport type SignDisplayOption = 'auto' | 'never' | 'always' | 'exceptZero';\n\nconst STRING_KEYS: [keyof FormatNumber, string][] = [\n ['currency', 'currency'],\n ['currencyDisplay', 'currencyDisplay'],\n ['currencySign', 'currencySign'],\n ['notation', 'notation'],\n ['compactDisplay', 'compactDisplay'],\n ['unit', 'unit'],\n ['unitDisplay', 'unitDisplay'],\n ['signDisplay', 'signDisplay']\n];\n\nconst NUMBER_KEYS: [keyof FormatNumber, string][] = [\n ['minimumFractionDigits', 'minimumFractionDigits'],\n ['maximumFractionDigits', 'maximumFractionDigits'],\n ['minimumIntegerDigits', 'minimumIntegerDigits']\n];\n\n/**\n * @element nve-format-number\n * @description A localized number formatter for currencies, percentages, units, and compact notation, backed by Intl.NumberFormat.\n * Provide a `currency` attribute when `formatStyle` is `currency`, and a `unit` attribute when `formatStyle` is `unit`.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-number/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-number\n * @slot - Numeric string to format (such as 1234567 or 1234.56). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data\n */\n@typeSSR()\nexport class FormatNumber extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-number',\n version: '0.0.0'\n };\n\n /**\n * Optional numeric string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) number?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Formatting style: 'decimal' | 'currency' | 'percent' | 'unit'.\n */\n @property({ type: String, attribute: 'format-style' }) formatStyle: FormatNumberStyle = 'decimal';\n\n /**\n * ISO 4217 currency code (such as USD or EUR). Required when formatStyle is currency.\n */\n @property({ type: String }) currency?: string;\n\n /**\n * Currency sign style: 'standard' | 'accounting'.\n */\n @property({ type: String, attribute: 'currency-sign' }) currencySign?: CurrencySignOption;\n\n /**\n * Currency display style: 'symbol' | 'code' | 'name' | 'narrowSymbol'.\n */\n @property({ type: String, attribute: 'currency-display' }) currencyDisplay?: CurrencyDisplayOption;\n\n /**\n * Unit identifier (such as kilometer or byte). Required when formatStyle is unit.\n */\n @property({ type: String }) unit?: string;\n\n /**\n * Unit display style: 'short' | 'long' | 'narrow'.\n */\n @property({ type: String, attribute: 'unit-display' }) unitDisplay?: UnitDisplayOption;\n\n /**\n * Number notation: 'standard' | 'scientific' | 'engineering' | 'compact'.\n */\n @property({ type: String }) notation?: NotationOption;\n\n /**\n * Compact notation display: 'short' | 'long'. Only applies when notation is compact.\n */\n @property({ type: String, attribute: 'compact-display' }) compactDisplay?: CompactDisplayOption;\n\n /**\n * Sign display: 'auto' | 'never' | 'always' | 'exceptZero'.\n */\n @property({ type: String, attribute: 'sign-display' }) signDisplay?: SignDisplayOption;\n\n /**\n * Grouping separators: 'auto' | 'always' | 'min2' | 'true' | 'false'.\n */\n @property({ type: String, attribute: 'use-grouping' })\n useGrouping?: 'auto' | 'always' | 'min2' | 'true' | 'false' | boolean;\n\n /**\n * Pad fraction output to at least this many digits (0-100).\n */\n @property({ type: Number, attribute: 'minimum-fraction-digits' }) minimumFractionDigits?: number;\n\n /**\n * Round fraction output to at most this many digits (0-100).\n */\n @property({ type: Number, attribute: 'maximum-fraction-digits' }) maximumFractionDigits?: number;\n\n /**\n * Pad integer output to at least this many digits (1-21).\n */\n @property({ type: Number, attribute: 'minimum-integer-digits' }) minimumIntegerDigits?: number;\n\n get #rawValue(): string {\n return this.number ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #parsedNumber(): number | null {\n const raw = this.#rawValue;\n if (!raw) return null;\n\n const numericValue = Number(raw);\n if (Number.isFinite(numericValue)) return numericValue;\n\n return null;\n }\n\n get #formatOptions(): Intl.NumberFormatOptions {\n const options: Intl.NumberFormatOptions = { style: this.formatStyle };\n\n for (const [prop, key] of STRING_KEYS) {\n const value = this[prop] as string | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n for (const [prop, key] of NUMBER_KEYS) {\n const value = this[prop] as number | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n if (this.useGrouping !== undefined) {\n const grouping = this.useGrouping === 'false' ? false : this.useGrouping === 'true' ? true : this.useGrouping;\n (options as Record<string, unknown>).useGrouping = grouping;\n }\n\n return options;\n }\n\n get #formattedNumber(): string {\n const raw = this.#rawValue;\n if (!raw) return '';\n\n const numericValue = this.#parsedNumber;\n if (numericValue === null) return raw;\n\n try {\n return new Intl.NumberFormat(this.#resolvedLocale, this.#formatOptions).format(numericValue);\n } catch {\n return raw;\n }\n }\n\n render() {\n return html`<data internal-host value=${this.#rawValue}>${this.#formattedNumber}<slot @slotchange=${this.#onSlotChange} hidden></slot></data>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],"mappings":";;;;;;;AAiBA,IAAMI,IAA8C;CAClD,CAAC,YAAY,UAAU;CACvB,CAAC,mBAAmB,iBAAiB;CACrC,CAAC,gBAAgB,cAAc;CAC/B,CAAC,YAAY,UAAU;CACvB,CAAC,kBAAkB,gBAAgB;CACnC,CAAC,QAAQ,MAAM;CACf,CAAC,eAAe,aAAa;CAC7B,CAAC,eAAe,aAAa;AAC/B,GAEMC,IAA8C;CAClD,CAAC,yBAAyB,uBAAuB;CACjD,CAAC,yBAAyB,uBAAuB;CACjD,CAAC,wBAAwB,sBAAsB;AACjD,GAaaC,IAAN,cAA2BC,EAAW;;EAuB6C,A,aAAA,KAAA,cAAA;;;EAtBxE,KAAA,SAAAE,EAAU,CAACT,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAgFA,IAAIU,KAAoB;EACtB,OAAO,KAAK,UAAU,KAAK,aAAa,KAAK,KAAK;CACpD;CAEA,IAAIC,KAAsC;EACxC,OAAO,KAAK,WAAW,WAAW,UAAU,iBAAiB,QAAQ,KAAA;CACvE;CAEA,IAAIC,KAA+B;EACjC,IAAMC,IAAM,KAAKH;EACjB,IAAI,CAACG,GAAK,OAAO;EAEjB,IAAMC,IAAe,OAAOD,CAAG;EAG/B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