@editora/ui-core 0.2.2 → 0.3.0

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 (365) hide show
  1. package/dist/{ElementBase-DxbvhLJs.js → ElementBase-CbUsP3D6.js} +1 -1
  2. package/dist/{ElementBase-BeZT54Hj.mjs → ElementBase-D5QsC5Vw.mjs} +10 -1
  3. package/dist/ElementBase.d.ts +7 -0
  4. package/dist/ElementBase.d.ts.map +1 -1
  5. package/dist/accordion.cjs.js +1 -1
  6. package/dist/accordion.esm.js +1 -1
  7. package/dist/add-icons-CVeHOsWl.js +1 -0
  8. package/dist/add-icons-DBUZJ0g7.mjs +14 -0
  9. package/dist/add-icons.cjs.js +1 -0
  10. package/dist/add-icons.d.ts +16 -0
  11. package/dist/add-icons.d.ts.map +1 -0
  12. package/dist/add-icons.esm.js +4 -0
  13. package/dist/alert-dialog.cjs.js +24 -24
  14. package/dist/alert-dialog.esm.js +112 -107
  15. package/dist/alert.cjs.js +8 -8
  16. package/dist/alert.esm.js +22 -22
  17. package/dist/animated-beam.cjs.js +1 -1
  18. package/dist/animated-beam.esm.js +1 -1
  19. package/dist/animated-list.cjs.js +1 -1
  20. package/dist/animated-list.esm.js +1 -1
  21. package/dist/animated-text.cjs.js +1 -1
  22. package/dist/animated-text.esm.js +1 -1
  23. package/dist/app-header.cjs.js +15 -3
  24. package/dist/app-header.esm.js +31 -4
  25. package/dist/aspect-ratio.cjs.js +1 -1
  26. package/dist/aspect-ratio.esm.js +1 -1
  27. package/dist/avatar.cjs.js +1 -1
  28. package/dist/avatar.esm.js +1 -1
  29. package/dist/badge.cjs.js +1 -1
  30. package/dist/badge.esm.js +1 -1
  31. package/dist/block-controls.cjs.js +1 -1
  32. package/dist/block-controls.esm.js +1 -1
  33. package/dist/box.cjs.js +1 -1
  34. package/dist/box.esm.js +1 -1
  35. package/dist/breadcrumb.cjs.js +4 -4
  36. package/dist/breadcrumb.esm.js +93 -84
  37. package/dist/button.cjs.js +520 -1
  38. package/dist/button.esm.js +682 -2
  39. package/dist/{calendar-CzpWDxLc.js → calendar-BsVqtpjM.js} +6 -6
  40. package/dist/{calendar-DkSDFg33.mjs → calendar-CFafqZVA.mjs} +6 -6
  41. package/dist/calendar.cjs.js +1 -1
  42. package/dist/calendar.esm.js +1 -1
  43. package/dist/card.cjs.js +6 -5
  44. package/dist/card.esm.js +52 -39
  45. package/dist/chart.cjs.js +2 -2
  46. package/dist/chart.esm.js +2 -2
  47. package/dist/checkbox.cjs.js +4 -4
  48. package/dist/checkbox.esm.js +36 -15
  49. package/dist/clone-source-BxK2pEVw.mjs +11 -0
  50. package/dist/clone-source-C7E_ri5f.js +1 -0
  51. package/dist/collapsible.cjs.js +1 -1
  52. package/dist/collapsible.esm.js +1 -1
  53. package/dist/color-picker.cjs.js +2 -2
  54. package/dist/color-picker.esm.js +3 -3
  55. package/dist/combobox.cjs.js +4 -4
  56. package/dist/combobox.esm.js +22 -19
  57. package/dist/command-palette.cjs.js +1 -1
  58. package/dist/command-palette.esm.js +1 -1
  59. package/dist/command.cjs.js +1 -1
  60. package/dist/command.esm.js +1 -1
  61. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  62. package/dist/components/ui-alert.d.ts.map +1 -1
  63. package/dist/components/ui-app-header.d.ts +1 -0
  64. package/dist/components/ui-app-header.d.ts.map +1 -1
  65. package/dist/components/ui-breadcrumb.d.ts.map +1 -1
  66. package/dist/components/ui-card.d.ts +7 -0
  67. package/dist/components/ui-card.d.ts.map +1 -1
  68. package/dist/components/ui-checkbox.d.ts +6 -0
  69. package/dist/components/ui-checkbox.d.ts.map +1 -1
  70. package/dist/components/ui-combobox.d.ts.map +1 -1
  71. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  72. package/dist/components/ui-dialog.d.ts +1 -0
  73. package/dist/components/ui-dialog.d.ts.map +1 -1
  74. package/dist/components/ui-drawer.d.ts.map +1 -1
  75. package/dist/components/ui-dropdown.d.ts.map +1 -1
  76. package/dist/components/ui-empty-state.d.ts.map +1 -1
  77. package/dist/components/ui-hover-card.d.ts.map +1 -1
  78. package/dist/components/ui-icon.d.ts +1 -0
  79. package/dist/components/ui-icon.d.ts.map +1 -1
  80. package/dist/components/ui-input.d.ts +16 -0
  81. package/dist/components/ui-input.d.ts.map +1 -1
  82. package/dist/components/ui-layout.d.ts +20 -0
  83. package/dist/components/ui-layout.d.ts.map +1 -1
  84. package/dist/components/ui-menu.d.ts +1 -0
  85. package/dist/components/ui-menu.d.ts.map +1 -1
  86. package/dist/components/ui-menubar.d.ts.map +1 -1
  87. package/dist/components/ui-multi-select.d.ts +6 -0
  88. package/dist/components/ui-multi-select.d.ts.map +1 -1
  89. package/dist/components/ui-number-field.d.ts +6 -0
  90. package/dist/components/ui-number-field.d.ts.map +1 -1
  91. package/dist/components/ui-pagination.d.ts.map +1 -1
  92. package/dist/components/ui-password-field.d.ts +11 -0
  93. package/dist/components/ui-password-field.d.ts.map +1 -1
  94. package/dist/components/ui-popover.d.ts.map +1 -1
  95. package/dist/components/ui-positioner.d.ts.map +1 -1
  96. package/dist/components/ui-radio-group.d.ts +6 -0
  97. package/dist/components/ui-radio-group.d.ts.map +1 -1
  98. package/dist/components/ui-rating.d.ts +1 -0
  99. package/dist/components/ui-rating.d.ts.map +1 -1
  100. package/dist/components/ui-select.d.ts +7 -0
  101. package/dist/components/ui-select.d.ts.map +1 -1
  102. package/dist/components/ui-sidebar.d.ts +1 -0
  103. package/dist/components/ui-sidebar.d.ts.map +1 -1
  104. package/dist/components/ui-slider.d.ts +6 -0
  105. package/dist/components/ui-slider.d.ts.map +1 -1
  106. package/dist/components/ui-sortable.d.ts +1 -0
  107. package/dist/components/ui-sortable.d.ts.map +1 -1
  108. package/dist/components/ui-switch.d.ts +6 -0
  109. package/dist/components/ui-switch.d.ts.map +1 -1
  110. package/dist/components/ui-tabs.d.ts +2 -0
  111. package/dist/components/ui-tabs.d.ts.map +1 -1
  112. package/dist/components/ui-textarea.d.ts +6 -0
  113. package/dist/components/ui-textarea.d.ts.map +1 -1
  114. package/dist/components/ui-toast.d.ts.map +1 -1
  115. package/dist/components/ui-tooltip.d.ts.map +1 -1
  116. package/dist/container.cjs.js +1 -1
  117. package/dist/container.esm.js +1 -1
  118. package/dist/context-menu.cjs.js +2 -2
  119. package/dist/context-menu.esm.js +2 -2
  120. package/dist/control-group.cjs.js +1 -1
  121. package/dist/control-group.esm.js +1 -1
  122. package/dist/data-table.cjs.js +5 -5
  123. package/dist/data-table.esm.js +7 -7
  124. package/dist/date-field.cjs.js +1 -1
  125. package/dist/date-field.esm.js +3 -3
  126. package/dist/date-picker.cjs.js +2 -2
  127. package/dist/date-picker.esm.js +17 -17
  128. package/dist/date-range-picker.cjs.js +2 -2
  129. package/dist/date-range-picker.esm.js +4 -4
  130. package/dist/date-range-time-picker.cjs.js +3 -3
  131. package/dist/date-range-time-picker.esm.js +16 -16
  132. package/dist/date-time-picker.cjs.js +26 -23
  133. package/dist/date-time-picker.esm.js +49 -46
  134. package/dist/{date-time-utils-zAx4ghvC.mjs → date-time-utils-CJUksWj3.mjs} +1 -1
  135. package/dist/{date-time-utils-C-4eHTyy.js → date-time-utils-D3hQQ5Om.js} +1 -1
  136. package/dist/description.cjs.js +1 -1
  137. package/dist/description.esm.js +1 -1
  138. package/dist/dialog.cjs.js +7 -7
  139. package/dist/dialog.esm.js +51 -47
  140. package/dist/direction-provider.cjs.js +1 -1
  141. package/dist/direction-provider.esm.js +1 -1
  142. package/dist/dismissable-layer.cjs.js +1 -1
  143. package/dist/dismissable-layer.esm.js +1 -1
  144. package/dist/dock.cjs.js +1 -1
  145. package/dist/dock.esm.js +1 -1
  146. package/dist/drawer.cjs.js +5 -5
  147. package/dist/drawer.esm.js +18 -17
  148. package/dist/dropdown.cjs.js +7 -7
  149. package/dist/dropdown.esm.js +39 -38
  150. package/dist/empty-state.cjs.js +12 -2
  151. package/dist/empty-state.esm.js +17 -7
  152. package/dist/field-error.cjs.js +1 -1
  153. package/dist/field-error.esm.js +1 -1
  154. package/dist/field.cjs.js +2 -2
  155. package/dist/field.esm.js +2 -2
  156. package/dist/fieldset.cjs.js +1 -1
  157. package/dist/fieldset.esm.js +1 -1
  158. package/dist/file-upload.cjs.js +1 -1
  159. package/dist/file-upload.esm.js +1 -1
  160. package/dist/flex.cjs.js +1 -1
  161. package/dist/flex.esm.js +1 -1
  162. package/dist/floating-toolbar.cjs.js +2 -2
  163. package/dist/floating-toolbar.esm.js +2 -2
  164. package/dist/focus-scope-Dl0qk5GP.mjs +177 -0
  165. package/dist/focus-scope-Doz0bnE1.js +1 -0
  166. package/dist/focus-scope.cjs.js +1 -1
  167. package/dist/focus-scope.esm.js +2 -2
  168. package/dist/form-control-B90_3kYN.js +1 -0
  169. package/dist/form-control-D9wWUMBl.mjs +86 -0
  170. package/dist/form.cjs.js +2 -2
  171. package/dist/form.esm.js +2 -2
  172. package/dist/gantt.cjs.js +2 -2
  173. package/dist/gantt.esm.js +2 -2
  174. package/dist/grid.cjs.js +1 -1
  175. package/dist/grid.esm.js +1 -1
  176. package/dist/hover-card.cjs.js +5 -5
  177. package/dist/hover-card.esm.js +19 -18
  178. package/dist/icon-cloud.cjs.js +1 -1
  179. package/dist/icon-cloud.esm.js +1 -1
  180. package/dist/icon.cjs.js +207 -1
  181. package/dist/icon.esm.js +294 -2
  182. package/dist/icons-CpCpPXV5.js +1 -0
  183. package/dist/icons-DWYbbhb0.mjs +115 -0
  184. package/dist/icons.d.ts +11 -1
  185. package/dist/icons.d.ts.map +1 -1
  186. package/dist/implicit-submit-B6M5Uc56.js +1 -0
  187. package/dist/implicit-submit-Lr0-q2LR.mjs +44 -0
  188. package/dist/index.cjs.js +1 -1
  189. package/dist/index.d.ts +1 -0
  190. package/dist/index.d.ts.map +1 -1
  191. package/dist/index.esm.js +309 -299
  192. package/dist/inline-edit.cjs.js +1 -1
  193. package/dist/inline-edit.esm.js +1 -1
  194. package/dist/input.cjs.js +62 -20
  195. package/dist/input.esm.js +164 -58
  196. package/dist/label.cjs.js +1 -1
  197. package/dist/label.esm.js +1 -1
  198. package/dist/layout.cjs.js +145 -4
  199. package/dist/layout.esm.js +278 -40
  200. package/dist/marquee.cjs.js +1 -1
  201. package/dist/marquee.esm.js +1 -1
  202. package/dist/masonry-grid.cjs.js +1 -1
  203. package/dist/masonry-grid.esm.js +1 -1
  204. package/dist/menu.cjs.js +8 -8
  205. package/dist/menu.esm.js +51 -47
  206. package/dist/menubar.cjs.js +9 -9
  207. package/dist/menubar.esm.js +41 -40
  208. package/dist/meter.cjs.js +1 -1
  209. package/dist/meter.esm.js +1 -1
  210. package/dist/multi-select.cjs.js +7 -7
  211. package/dist/multi-select.esm.js +55 -34
  212. package/dist/navigate-CXebafwF.mjs +18 -0
  213. package/dist/navigate-ChJVIIuS.js +1 -0
  214. package/dist/navigation-menu.cjs.js +1 -1
  215. package/dist/navigation-menu.esm.js +1 -1
  216. package/dist/number-attribute-BAF07JrU.mjs +8 -0
  217. package/dist/number-attribute-C4Rrl7d3.js +1 -0
  218. package/dist/number-field.cjs.js +8 -8
  219. package/dist/number-field.esm.js +90 -69
  220. package/dist/number-ticker.cjs.js +1 -1
  221. package/dist/number-ticker.esm.js +1 -1
  222. package/dist/odometer.cjs.js +1 -1
  223. package/dist/odometer.esm.js +1 -1
  224. package/dist/orbiter.cjs.js +1 -1
  225. package/dist/orbiter.esm.js +1 -1
  226. package/dist/pagination.cjs.js +24 -23
  227. package/dist/pagination.esm.js +61 -46
  228. package/dist/{panel-group-BVHJEdfx.js → panel-group-BIzzpQ5i.js} +1 -1
  229. package/dist/{panel-group-BxO_eNW6.mjs → panel-group-CFLjzRWI.mjs} +1 -1
  230. package/dist/panel-group.cjs.js +1 -1
  231. package/dist/panel-group.esm.js +1 -1
  232. package/dist/panel.cjs.js +1 -1
  233. package/dist/panel.esm.js +1 -1
  234. package/dist/password-field.cjs.js +36 -16
  235. package/dist/password-field.esm.js +113 -44
  236. package/dist/pin-input.cjs.js +1 -1
  237. package/dist/pin-input.esm.js +1 -1
  238. package/dist/placement-grid.cjs.js +1 -1
  239. package/dist/placement-grid.esm.js +1 -1
  240. package/dist/plugin-panel.cjs.js +1 -1
  241. package/dist/plugin-panel.esm.js +1 -1
  242. package/dist/popover.cjs.js +2 -2
  243. package/dist/popover.esm.js +28 -26
  244. package/dist/portal.cjs.js +1 -1
  245. package/dist/portal.esm.js +1 -1
  246. package/dist/positioner.cjs.js +2 -2
  247. package/dist/positioner.esm.js +35 -38
  248. package/dist/preload.cjs.js +221 -0
  249. package/dist/preload.css +220 -0
  250. package/dist/preload.d.ts +17 -0
  251. package/dist/preload.d.ts.map +1 -0
  252. package/dist/preload.esm.js +224 -0
  253. package/dist/presence.cjs.js +1 -1
  254. package/dist/presence.esm.js +1 -1
  255. package/dist/primitives/clone-source.d.ts +3 -0
  256. package/dist/primitives/clone-source.d.ts.map +1 -0
  257. package/dist/primitives/focus-scope.d.ts +6 -0
  258. package/dist/primitives/focus-scope.d.ts.map +1 -1
  259. package/dist/primitives/form-control.d.ts +68 -0
  260. package/dist/primitives/form-control.d.ts.map +1 -0
  261. package/dist/primitives/implicit-submit.d.ts +17 -0
  262. package/dist/primitives/implicit-submit.d.ts.map +1 -0
  263. package/dist/primitives/navigate.d.ts +27 -0
  264. package/dist/primitives/navigate.d.ts.map +1 -0
  265. package/dist/primitives/number-attribute.d.ts +7 -0
  266. package/dist/primitives/number-attribute.d.ts.map +1 -0
  267. package/dist/primitives/slotted-input.d.ts +19 -0
  268. package/dist/primitives/slotted-input.d.ts.map +1 -0
  269. package/dist/progress.cjs.js +3 -3
  270. package/dist/progress.esm.js +3 -3
  271. package/dist/quick-actions.cjs.js +5 -5
  272. package/dist/quick-actions.esm.js +3 -3
  273. package/dist/radio-group.cjs.js +9 -9
  274. package/dist/radio-group.esm.js +47 -24
  275. package/dist/radio.cjs.js +1 -1
  276. package/dist/radio.esm.js +1 -1
  277. package/dist/rating.cjs.js +6 -6
  278. package/dist/rating.esm.js +21 -10
  279. package/dist/{runtime-CJzoaC8Z.mjs → runtime-CORXjP7e.mjs} +366 -352
  280. package/dist/runtime-uCly3ECd.js +5 -0
  281. package/dist/runtime.cjs.js +1 -1
  282. package/dist/runtime.esm.js +1 -1
  283. package/dist/scroll-area.cjs.js +1 -1
  284. package/dist/scroll-area.esm.js +1 -1
  285. package/dist/section.cjs.js +1 -1
  286. package/dist/section.esm.js +1 -1
  287. package/dist/select.cjs.js +21 -21
  288. package/dist/select.esm.js +111 -71
  289. package/dist/selection-popup.cjs.js +2 -2
  290. package/dist/selection-popup.esm.js +2 -2
  291. package/dist/semantic-tokens.d.ts.map +1 -1
  292. package/dist/separator.cjs.js +1 -1
  293. package/dist/separator.esm.js +1 -1
  294. package/dist/sidebar.cjs.js +15 -15
  295. package/dist/sidebar.esm.js +48 -42
  296. package/dist/skeleton.cjs.js +1 -1
  297. package/dist/skeleton.esm.js +1 -1
  298. package/dist/slider.cjs.js +11 -11
  299. package/dist/slider.esm.js +40 -23
  300. package/dist/slot.cjs.js +1 -1
  301. package/dist/slot.esm.js +1 -1
  302. package/dist/slotted-input-BVq2QQg2.js +1 -0
  303. package/dist/slotted-input-atWznLfm.mjs +13 -0
  304. package/dist/sortable.cjs.js +25 -25
  305. package/dist/sortable.esm.js +29 -21
  306. package/dist/spinning-text.cjs.js +1 -1
  307. package/dist/spinning-text.esm.js +1 -1
  308. package/dist/split-button.cjs.js +1 -1
  309. package/dist/split-button.esm.js +1 -1
  310. package/dist/splitter.cjs.js +1 -1
  311. package/dist/splitter.esm.js +1 -1
  312. package/dist/standalone/add-icons.d.ts +2 -0
  313. package/dist/standalone/add-icons.d.ts.map +1 -0
  314. package/dist/standalone/preload.d.ts +2 -0
  315. package/dist/standalone/preload.d.ts.map +1 -0
  316. package/dist/stepper.cjs.js +3 -3
  317. package/dist/stepper.esm.js +3 -3
  318. package/dist/switch.cjs.js +9 -9
  319. package/dist/switch.esm.js +56 -35
  320. package/dist/table.cjs.js +1 -1
  321. package/dist/table.esm.js +1 -1
  322. package/dist/tabs.cjs.js +14 -14
  323. package/dist/tabs.esm.js +129 -115
  324. package/dist/tags-input.cjs.js +1 -1
  325. package/dist/tags-input.esm.js +1 -1
  326. package/dist/textarea.cjs.js +33 -11
  327. package/dist/textarea.esm.js +74 -35
  328. package/dist/theme.d.ts +6 -0
  329. package/dist/theme.d.ts.map +1 -1
  330. package/dist/time-field.cjs.js +1 -1
  331. package/dist/time-field.esm.js +2 -2
  332. package/dist/time-picker.cjs.js +1 -1
  333. package/dist/time-picker.esm.js +3 -3
  334. package/dist/timeline.cjs.js +2 -2
  335. package/dist/timeline.esm.js +2 -2
  336. package/dist/toast.cjs.js +4 -4
  337. package/dist/toast.esm.js +17 -16
  338. package/dist/toggle-group.cjs.js +1 -1
  339. package/dist/toggle-group.esm.js +1 -1
  340. package/dist/toggle.cjs.js +3 -3
  341. package/dist/toggle.esm.js +9 -9
  342. package/dist/toolbar.cjs.js +1 -1
  343. package/dist/toolbar.esm.js +1 -1
  344. package/dist/tooltip.cjs.js +2 -2
  345. package/dist/tooltip.esm.js +12 -14
  346. package/dist/transfer-list.cjs.js +1 -1
  347. package/dist/transfer-list.esm.js +1 -1
  348. package/dist/{tree-33fVNnaf.mjs → tree-CD2k2lIC.mjs} +1 -1
  349. package/dist/{tree-Dc02MChE.js → tree-ChQfhxya.js} +1 -1
  350. package/dist/tree-item.cjs.js +1 -1
  351. package/dist/tree-item.esm.js +1 -1
  352. package/dist/tree.cjs.js +1 -1
  353. package/dist/tree.esm.js +1 -1
  354. package/dist/visually-hidden.cjs.js +1 -1
  355. package/dist/visually-hidden.esm.js +1 -1
  356. package/dist/wizard.cjs.js +4 -4
  357. package/dist/wizard.esm.js +4 -4
  358. package/package.json +3 -2
  359. package/dist/focus-scope-Bwug2gDv.js +0 -1
  360. package/dist/focus-scope-CmEsG5UZ.mjs +0 -138
  361. package/dist/runtime-DYSIU3sR.js +0 -5
  362. package/dist/ui-button-C3OmI7Sn.mjs +0 -684
  363. package/dist/ui-button-CnLwXBnx.js +0 -520
  364. package/dist/ui-icon-D3avtxX_.js +0 -207
  365. package/dist/ui-icon-DLhB08Fo.mjs +0 -361
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("./ElementBase-DxbvhLJs.js"),C=require("./scroll-lock-BX6e3Ced.js"),I=require("./dismissable-layer-DNfrKA20.js"),R=require("./focus-scope-Bwug2gDv.js"),S=require("./overlay-motion-B56x1GoY.js"),P=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("./ElementBase-CbUsP3D6.js"),C=require("./scroll-lock-BX6e3Ced.js"),R=require("./dismissable-layer-DNfrKA20.js"),S=require("./focus-scope-Doz0bnE1.js"),E=require("./overlay-motion-B56x1GoY.js"),P=`
2
2
  :host {
3
3
  position: fixed;
4
4
  inset: 0;
@@ -388,7 +388,7 @@
388
388
  box-shadow: none;
389
389
  }
390
390
  }
391
- `,W='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function p(n,t){if(n==null)return t;const i=n.trim().toLowerCase();return i!=="false"&&i!=="0"&&i!=="off"}function a(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function E(){return typeof window<"u"&&typeof document<"u"}function L(n){return window.setTimeout(n,16)}function g(n){n&&window.clearTimeout(n)}const l=class l extends M.ElementBase{constructor(){super(),this._isActive=!1,this._uid=Math.random().toString(36).slice(2,10),this._dialogId=this._uid,this._lastFocused=null,this._terminalEmitted=!1,this._closeMeta=null,this._runtimeError="",this._config={},this._dismissableLayer=null,this._focusScope=null,this._disconnectCleanupFrame=0,this._restoreFocusFrame=0,this._presented=!1,this._finishClose=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onSubmit=this._onSubmit.bind(this)}static get observedAttributes(){return["open","headless","title","description","closable","dismissible","close-on-overlay","close-on-backdrop","close-on-esc","lock-while-loading","size","state","role","initial-focus","submit-text","cancel-text","loading-text","error-message","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this._disconnectCleanupFrame&&(g(this._disconnectCleanupFrame),this._disconnectCleanupFrame=0),super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.addEventListener("submit",this._onSubmit),this._syncFromAttributes(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("submit",this._onSubmit),this._disconnectCleanupFrame&&g(this._disconnectCleanupFrame),this._restoreFocusFrame&&(g(this._restoreFocusFrame),this._restoreFocusFrame=0),this._disconnectCleanupFrame=L(()=>{this._disconnectCleanupFrame=0,!this.isConnected&&(this._isActive&&!this._terminalEmitted?this.close("dismiss","unmount"):(this._destroyRuntimeControllers(),this._deactivate()),super.disconnectedCallback())})}attributeChangedCallback(t,i,e){if(i!==e){if(t==="open"){this._syncOpenState();return}t==="state"&&e!=="error"&&(this._runtimeError=""),this._syncFromAttributes(),this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.close("dismiss","programmatic")}get dismissible(){return p(this.getAttribute("dismissible")??this.getAttribute("closable"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t)),this.setAttribute("closable",String(t))}get closeOnOverlay(){return p(this.getAttribute("close-on-overlay")??this.getAttribute("close-on-backdrop"),!0)}set closeOnOverlay(t){this.setAttribute("close-on-overlay",String(t)),this.setAttribute("close-on-backdrop",String(t))}get closeOnEsc(){return p(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get lockWhileLoading(){return p(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnOverlay!=null&&(this.closeOnOverlay=!!this._config.closeOnOverlay),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.size&&this.setAttribute("size",this._config.size),this._config.role&&this.setAttribute("role",this._config.role),this._config.initialFocus&&this.setAttribute("initial-focus",this._config.initialFocus),this._config.ariaLabel&&this.setAttribute("aria-label",this._config.ariaLabel),this._config.ariaLabelledby&&this.setAttribute("aria-labelledby",this._config.ariaLabelledby),this._config.ariaDescribedby&&this.setAttribute("aria-describedby",this._config.ariaDescribedby),this._config.errorMessage&&(this._runtimeError=this._config.errorMessage),this.requestRender()}openDialog(){this.setAttribute("open","")}closeDialog(t="programmatic"){if(!this.hasAttribute("open"))return;const i=new CustomEvent("request-close",{detail:{reason:t},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i);const e=new CustomEvent("ui-request-close",{detail:{id:this.dialogId||this._uid,reason:t},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(e),!(i.defaultPrevented||e.defaultPrevented)){if(t==="submit"){this.close("submit");return}if(t==="cancel"){this.close("cancel");return}if(t==="overlay"){this.close("dismiss","overlay");return}if(t==="escape"){this.close("dismiss","esc");return}if(t==="button"){this.close("dismiss","close-icon");return}this.close("dismiss","programmatic")}}close(t="dismiss",i,e){this._terminalEmitted||(this._closeMeta={action:t,source:i,reason:e},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}_syncFromAttributes(){!this.hasAttribute("dismissible")&&this.hasAttribute("closable")&&this.setAttribute("dismissible",this.getAttribute("closable")||"true"),!this.hasAttribute("closable")&&this.hasAttribute("dismissible")&&this.setAttribute("closable",this.getAttribute("dismissible")||"true"),!this.hasAttribute("close-on-overlay")&&this.hasAttribute("close-on-backdrop")&&this.setAttribute("close-on-overlay",this.getAttribute("close-on-backdrop")||"true"),!this.hasAttribute("close-on-backdrop")&&this.hasAttribute("close-on-overlay")&&this.setAttribute("close-on-backdrop",this.getAttribute("close-on-overlay")||"true"),this.hasAttribute("role")||this.setAttribute("role","dialog")}_syncOpenState(){const t=this.hasAttribute("open");t&&!this._isActive?this._activate():!t&&this._isActive&&this._deactivate(),this._syncOpenUi()}_activate(){this._isActive=!0,this._terminalEmitted=!1,this._closeMeta=null,l._openStack.includes(this)||l._openStack.push(this),this._lastFocused=document.activeElement||null,C.acquireBodyScrollLock();const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this._syncOpenUi(),this._syncRuntimeControllers()}_deactivate(){if(!this._isActive)return;this._isActive=!1,this._destroyRuntimeControllers();const t=l._openStack.lastIndexOf(this);if(t>=0&&l._openStack.splice(t,1),C.releaseBodyScrollLock(),!this._terminalEmitted){const e=this._closeMeta||{action:"dismiss",source:"abort"},s=this.dialogId||this._uid;e.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:s}):this._dispatchWithLegacy("ui-dismiss","dismiss",{id:s,source:e.source||"abort",reason:e.reason}),this._dispatchWithLegacy("ui-close","close",{id:s,action:e.action,source:e.source,reason:e.reason}),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0})),this._terminalEmitted=!0,this._closeMeta=null}const i=this._lastFocused;this._lastFocused=null,i&&this._canRestoreFocus(i)&&(this._restoreFocusFrame&&g(this._restoreFocusFrame),this._restoreFocusFrame=L(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(i)&&i.focus()}catch{}})),this._syncOpenUi()}_dispatchWithLegacy(t,i,e,s=!1){const o=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:s});this.dispatchEvent(o);const r=new CustomEvent(i,{detail:e,bubbles:!0,composed:!0,cancelable:s});return this.dispatchEvent(r),o}_isTopMost(){if(!this._isActive)return!1;const t=l._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".panel")}_canRestoreFocus(t){if(!t||!t.isConnected||t.disabled||t.getAttribute("aria-hidden")==="true")return!1;if(!E())return!0;const i=window.getComputedStyle(t);return i.display!=="none"&&i.visibility!=="hidden"}_collectFocusable(t){return Array.from(t.querySelectorAll(W)).filter(i=>{if(i.disabled||i.getAttribute("aria-hidden")==="true")return!1;const s=E()?window.getComputedStyle(i):null;return!(s&&(s.display==="none"||s.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";if(i){const r=t.querySelector(i);if(r&&typeof r.focus=="function"){r.focus();return}}const e=this._collectFocusable(t),o=e.find(r=>r.hasAttribute("autofocus"))||e[0]||t;!o.hasAttribute("tabindex")&&o===t&&o.setAttribute("tabindex","-1");try{o.focus()}catch{}}_onFocusIn(t){!this.open||this._isTopMost()}_handleTab(t){t.key}_destroyRuntimeControllers(){this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._focusScope?.destroy(),this._focusScope=null}_syncOpenUi(){const t=this.root.querySelector(".overlay"),i=this._queryPanel(),e=this.open;if(!(!t||!i)){if(t.setAttribute("aria-hidden",e?"false":"true"),i.setAttribute("aria-hidden",e?"false":"true"),t.setAttribute("data-open",String(e)),e){this._finishClose?.(),this._finishClose=null,t.hidden=!1,t.setAttribute("data-state","open"),this._presented||t.removeAttribute("data-instant"),this._presented=!0,this.hasAttribute("headless")||S.liftToTopLayer(t,{resetBox:!1});return}if(this._presented&&!t.hidden){this._presented=!1,t.removeAttribute("data-instant"),this._finishClose=S.closeOverlay(t,()=>{this._finishClose=null,t.hidden=!0;try{t.matches(":popover-open")&&t.hidePopover()}catch{}});return}this._finishClose||(this._presented=!1,t.setAttribute("data-state","closed"),t.hidden=!0)}}_syncRuntimeControllers(){if(this._destroyRuntimeControllers(),!this.open||!this._isTopMost())return;const t=this._queryPanel();t&&(this._dismissableLayer=I.createDismissableLayer({node:t,closeOnEscape:this.closeOnEsc,closeOnPointerOutside:this.closeOnOverlay,closeOnFocusOutside:!1,onBeforeDismiss:(i,e)=>this._isInteractionLocked()?!1:i==="escape-key"?(this.closeDialog("escape"),!1):(i==="outside-pointer"&&this.closeDialog("overlay"),!1)}),this._focusScope=R.createFocusScope({node:t,trapped:!0,loop:!0,restoreFocus:!1,autoFocus:"first",initialFocus:()=>{const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";return i?t.querySelector(i):null}}))}_collectFormData(t){const i=this._queryPanel(),e=t||this.querySelector("form")||i?.querySelector("form")||null;if(!(e instanceof HTMLFormElement)||typeof FormData>"u")return;const s=new FormData(e),o={};for(const[r,h]of s.entries()){const c=String(h);if(o[r]==null){o[r]=c;continue}const d=o[r];Array.isArray(d)?d.push(c):o[r]=[d,c]}return Object.keys(o).length?o:void 0}_resolveSubmitForm(t){if(t){const s=t.closest("form");if(s instanceof HTMLFormElement&&this.contains(s))return s}const i=this.querySelector("form");if(i instanceof HTMLFormElement)return i;const e=this._queryPanel()?.querySelector("form");return e instanceof HTMLFormElement?e:null}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,i){if(!this._isInteractionLocked()){if(t==="overlay"){this.closeDialog("overlay");return}if(t==="esc"){this.closeDialog("escape");return}if(t==="close-icon"){this.closeDialog("button");return}this.close("dismiss",t,i)}}_handleSubmit(t){if(this._isInteractionLocked())return;const i=t??this._resolveSubmitForm();if(i&&typeof i.reportValidity=="function"&&!i.reportValidity())return;const e={id:this.dialogId||this._uid,formData:this._collectFormData(i)};this._dispatchWithLegacy("ui-submit","submit",e,!0).defaultPrevented||this.closeDialog("submit")}_handleCancel(){this._isInteractionLocked()||this.closeDialog("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const i=t.target;if(i){if(!i.closest(".panel")&&i.closest(".overlay")&&this.closeOnOverlay){this._requestDismiss("overlay");return}if(i.closest(".close")){this._requestDismiss("close-icon");return}if(i.closest(".btn-submit")){this._handleSubmit();return}i.closest(".btn-cancel")&&this._handleCancel()}}_onSubmit(t){if(!this.open||!this._isTopMost())return;const i=t.target;i&&i!==this&&this.contains(i)&&(t.preventDefault(),t.stopPropagation(),this._handleSubmit(i))}_onKeyDown(t){if(!(!this.open||!this._isTopMost())&&t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}}render(){const t=this._config.title??this.getAttribute("title")??"",i=this._config.description??this.getAttribute("description")??"",e=this._config.submitText??this.getAttribute("submit-text")??"Submit",s=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",o=this._config.loadingText??this.getAttribute("loading-text")??"Working...",r=t.trim(),h=i.trim(),c=!!this.querySelector('[slot="title"]'),d=!!this.querySelector('[slot="description"]'),m=!!(r||c),v=!!(h||d),O=!!this.querySelector('[slot="content"]'),q=!!this.querySelector('[slot="footer"]'),$=this._config.showCancel??!0,T=this._config.showClose??this.dismissible,_=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",b=this.state==="loading",x=`ui-dialog-title-${this._uid}`,k=`ui-dialog-description-${this._uid}`,A=`ui-dialog-error-${this._uid}`,D=this.getAttribute("aria-label")||"",z=this.getAttribute("aria-labelledby")||"",w=this.getAttribute("aria-describedby")||"",y=z||(m?x:""),F=D||(y?"":"Dialog"),u=[];w?u.push(w):(v&&u.push(k),_&&u.push(A));const B=m||v?`
391
+ `;function p(n,t){if(n==null)return t;const i=n.trim().toLowerCase();return i!=="false"&&i!=="0"&&i!=="off"}function a(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function L(){return typeof window<"u"&&typeof document<"u"}function O(n){return window.setTimeout(n,16)}function g(n){n&&window.clearTimeout(n)}const l=class l extends I.ElementBase{constructor(){super(),this._isActive=!1,this._uid=Math.random().toString(36).slice(2,10),this._dialogId=this._uid,this._lastFocused=null,this._terminalEmitted=!1,this._closeMeta=null,this._runtimeError="",this._config={},this._dismissableLayer=null,this._focusScope=null,this._disconnectCleanupFrame=0,this._restoreFocusFrame=0,this._presented=!1,this._finishClose=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onSubmit=this._onSubmit.bind(this)}static get observedAttributes(){return["open","headless","title","description","closable","dismissible","close-on-overlay","close-on-backdrop","close-on-esc","lock-while-loading","size","state","role","dialog-role","initial-focus","submit-text","cancel-text","loading-text","error-message","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this._disconnectCleanupFrame&&(g(this._disconnectCleanupFrame),this._disconnectCleanupFrame=0),super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.addEventListener("submit",this._onSubmit),this._syncFromAttributes(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("submit",this._onSubmit),this._disconnectCleanupFrame&&g(this._disconnectCleanupFrame),this._restoreFocusFrame&&(g(this._restoreFocusFrame),this._restoreFocusFrame=0),this._disconnectCleanupFrame=O(()=>{this._disconnectCleanupFrame=0,!this.isConnected&&(this._isActive&&!this._terminalEmitted?this.close("dismiss","unmount"):(this._destroyRuntimeControllers(),this._deactivate()),super.disconnectedCallback())})}attributeChangedCallback(t,i,e){if(i!==e){if(t==="open"){this._syncOpenState();return}t==="state"&&e!=="error"&&(this._runtimeError=""),this._syncFromAttributes(),this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.close("dismiss","programmatic")}get dismissible(){return p(this.getAttribute("dismissible")??this.getAttribute("closable"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t)),this.setAttribute("closable",String(t))}get closeOnOverlay(){return p(this.getAttribute("close-on-overlay")??this.getAttribute("close-on-backdrop"),!0)}set closeOnOverlay(t){this.setAttribute("close-on-overlay",String(t)),this.setAttribute("close-on-backdrop",String(t))}get closeOnEsc(){return p(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get lockWhileLoading(){return p(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnOverlay!=null&&(this.closeOnOverlay=!!this._config.closeOnOverlay),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.size&&this.setAttribute("size",this._config.size),this._config.role&&this.setAttribute("dialog-role",this._config.role),this._config.initialFocus&&this.setAttribute("initial-focus",this._config.initialFocus),this._config.ariaLabel&&this.setAttribute("aria-label",this._config.ariaLabel),this._config.ariaLabelledby&&this.setAttribute("aria-labelledby",this._config.ariaLabelledby),this._config.ariaDescribedby&&this.setAttribute("aria-describedby",this._config.ariaDescribedby),this._config.errorMessage&&(this._runtimeError=this._config.errorMessage),this.requestRender()}openDialog(){this.setAttribute("open","")}closeDialog(t="programmatic"){if(!this.hasAttribute("open"))return;const i=new CustomEvent("request-close",{detail:{reason:t},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i);const e=new CustomEvent("ui-request-close",{detail:{id:this.dialogId||this._uid,reason:t},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(e),!(i.defaultPrevented||e.defaultPrevented)){if(t==="submit"){this.close("submit");return}if(t==="cancel"){this.close("cancel");return}if(t==="overlay"){this.close("dismiss","overlay");return}if(t==="escape"){this.close("dismiss","esc");return}if(t==="button"){this.close("dismiss","close-icon");return}this.close("dismiss","programmatic")}}close(t="dismiss",i,e){this._terminalEmitted||(this._closeMeta={action:t,source:i,reason:e},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}_syncFromAttributes(){!this.hasAttribute("dismissible")&&this.hasAttribute("closable")&&this.setAttribute("dismissible",this.getAttribute("closable")||"true"),!this.hasAttribute("closable")&&this.hasAttribute("dismissible")&&this.setAttribute("closable",this.getAttribute("dismissible")||"true"),!this.hasAttribute("close-on-overlay")&&this.hasAttribute("close-on-backdrop")&&this.setAttribute("close-on-overlay",this.getAttribute("close-on-backdrop")||"true"),!this.hasAttribute("close-on-backdrop")&&this.hasAttribute("close-on-overlay")&&this.setAttribute("close-on-backdrop",this.getAttribute("close-on-overlay")||"true")}_panelRole(){return(this.getAttribute("dialog-role")||this.getAttribute("role")||"").trim()==="alertdialog"?"alertdialog":"dialog"}_syncOpenState(){const t=this.hasAttribute("open");t&&!this._isActive?this._activate():!t&&this._isActive&&this._deactivate(),this._syncOpenUi()}_activate(){this._isActive=!0,this._terminalEmitted=!1,this._closeMeta=null,l._openStack.includes(this)||l._openStack.push(this),this._lastFocused=document.activeElement||null,C.acquireBodyScrollLock();const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this._syncOpenUi(),this._syncRuntimeControllers()}_deactivate(){if(!this._isActive)return;this._isActive=!1,this._destroyRuntimeControllers();const t=l._openStack.lastIndexOf(this);if(t>=0&&l._openStack.splice(t,1),C.releaseBodyScrollLock(),!this._terminalEmitted){const e=this._closeMeta||{action:"dismiss",source:"abort"},o=this.dialogId||this._uid;e.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:o}):this._dispatchWithLegacy("ui-dismiss","dismiss",{id:o,source:e.source||"abort",reason:e.reason}),this._dispatchWithLegacy("ui-close","close",{id:o,action:e.action,source:e.source,reason:e.reason}),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0})),this._terminalEmitted=!0,this._closeMeta=null}const i=this._lastFocused;this._lastFocused=null,i&&this._canRestoreFocus(i)&&(this._restoreFocusFrame&&g(this._restoreFocusFrame),this._restoreFocusFrame=O(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(i)&&i.focus()}catch{}})),this._syncOpenUi()}_dispatchWithLegacy(t,i,e,o=!1){const s=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:o});this.dispatchEvent(s);const r=new CustomEvent(i,{detail:e,bubbles:!0,composed:!0,cancelable:o});return this.dispatchEvent(r),s}_isTopMost(){if(!this._isActive)return!1;const t=l._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".panel")}_canRestoreFocus(t){if(!t||!t.isConnected||t.disabled||t.getAttribute("aria-hidden")==="true")return!1;if(!L())return!0;const i=window.getComputedStyle(t);return i.display!=="none"&&i.visibility!=="hidden"}_collectFocusable(t){return S.getFocusable(t).filter(i=>{if(i.disabled||i.getAttribute("aria-hidden")==="true")return!1;const o=L()?window.getComputedStyle(i):null;return!(o&&(o.display==="none"||o.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";if(i){const r=t.querySelector(i);if(r&&typeof r.focus=="function"){r.focus();return}}const e=this._collectFocusable(t),s=e.find(r=>r.hasAttribute("autofocus"))||e[0]||t;!s.hasAttribute("tabindex")&&s===t&&s.setAttribute("tabindex","-1");try{s.focus()}catch{}}_onFocusIn(t){!this.open||this._isTopMost()}_handleTab(t){t.key}_destroyRuntimeControllers(){this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._focusScope?.destroy(),this._focusScope=null}_syncOpenUi(){const t=this.root.querySelector(".overlay"),i=this._queryPanel(),e=this.open;if(!(!t||!i)){if(t.setAttribute("aria-hidden",e?"false":"true"),i.setAttribute("aria-hidden",e?"false":"true"),t.setAttribute("data-open",String(e)),e){this._finishClose?.(),this._finishClose=null,t.hidden=!1,t.setAttribute("data-state","open"),this._presented||t.removeAttribute("data-instant"),this._presented=!0,this.hasAttribute("headless")||E.liftToTopLayer(t,{resetBox:!1});return}if(this._presented&&!t.hidden){this._presented=!1,t.removeAttribute("data-instant"),this._finishClose=E.closeOverlay(t,()=>{this._finishClose=null,t.hidden=!0;try{t.matches(":popover-open")&&t.hidePopover()}catch{}});return}this._finishClose||(this._presented=!1,t.setAttribute("data-state","closed"),t.hidden=!0)}}_syncRuntimeControllers(){if(this._destroyRuntimeControllers(),!this.open||!this._isTopMost())return;const t=this._queryPanel();t&&(this._dismissableLayer=R.createDismissableLayer({node:t,closeOnEscape:this.closeOnEsc,closeOnPointerOutside:this.closeOnOverlay,closeOnFocusOutside:!1,onBeforeDismiss:(i,e)=>this._isInteractionLocked()?!1:i==="escape-key"?(this.closeDialog("escape"),!1):(i==="outside-pointer"&&this.closeDialog("overlay"),!1)}),this._focusScope=S.createFocusScope({node:t,trapped:!0,loop:!0,restoreFocus:!1,autoFocus:"first",initialFocus:()=>{const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";return i?t.querySelector(i):null}}))}_collectFormData(t){const i=this._queryPanel(),e=t||this.querySelector("form")||i?.querySelector("form")||null;if(!(e instanceof HTMLFormElement)||typeof FormData>"u")return;const o=new FormData(e),s={};for(const[r,h]of o.entries()){const c=String(h);if(s[r]==null){s[r]=c;continue}const d=s[r];Array.isArray(d)?d.push(c):s[r]=[d,c]}return Object.keys(s).length?s:void 0}_resolveSubmitForm(t){if(t){const o=t.closest("form");if(o instanceof HTMLFormElement&&this.contains(o))return o}const i=this.querySelector("form");if(i instanceof HTMLFormElement)return i;const e=this._queryPanel()?.querySelector("form");return e instanceof HTMLFormElement?e:null}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,i){if(!this._isInteractionLocked()){if(t==="overlay"){this.closeDialog("overlay");return}if(t==="esc"){this.closeDialog("escape");return}if(t==="close-icon"){this.closeDialog("button");return}this.close("dismiss",t,i)}}_handleSubmit(t){if(this._isInteractionLocked())return;const i=t??this._resolveSubmitForm();if(i&&typeof i.reportValidity=="function"&&!i.reportValidity())return;const e={id:this.dialogId||this._uid,formData:this._collectFormData(i)};this._dispatchWithLegacy("ui-submit","submit",e,!0).defaultPrevented||this.closeDialog("submit")}_handleCancel(){this._isInteractionLocked()||this.closeDialog("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const i=t.target;if(i){if(!i.closest(".panel")&&i.closest(".overlay")&&this.closeOnOverlay){this._requestDismiss("overlay");return}if(i.closest(".close")){this._requestDismiss("close-icon");return}if(i.closest(".btn-submit")){this._handleSubmit();return}i.closest(".btn-cancel")&&this._handleCancel()}}_onSubmit(t){if(!this.open||!this._isTopMost())return;const i=t.target;i&&i!==this&&this.contains(i)&&(t.preventDefault(),t.stopPropagation(),this._handleSubmit(i))}_onKeyDown(t){if(!(!this.open||!this._isTopMost())&&t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}}render(){const t=this._config.title??this.getAttribute("title")??"",i=this._config.description??this.getAttribute("description")??"",e=this._config.submitText??this.getAttribute("submit-text")??"Submit",o=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",s=this._config.loadingText??this.getAttribute("loading-text")??"Working...",r=t.trim(),h=i.trim(),c=!!this.querySelector('[slot="title"]'),d=!!this.querySelector('[slot="description"]'),m=!!(r||c),v=!!(h||d),$=!!this.querySelector('[slot="content"]'),q=!!this.querySelector('[slot="footer"]'),D=this._config.showCancel??!0,T=this._config.showClose??this.dismissible,_=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",b=this.state==="loading",x=`ui-dialog-title-${this._uid}`,k=`ui-dialog-description-${this._uid}`,A=`ui-dialog-error-${this._uid}`,z=this.getAttribute("aria-label")||"",B=this.getAttribute("aria-labelledby")||"",w=this.getAttribute("aria-describedby")||"",y=B||(m?x:""),F=z||(y?"":"Dialog"),u=[];w?u.push(w):(v&&u.push(k),_&&u.push(A));const M=m||v?`
392
392
  <header class="header" part="header">
393
393
  ${m?`<h2 id="${x}" class="title" part="title"><slot name="title">${a(r)}</slot></h2>`:""}
394
394
  ${v?`<p id="${k}" class="description" part="description"><slot name="description">${a(h)}</slot></p>`:""}
@@ -399,7 +399,7 @@
399
399
  <section
400
400
  class="panel"
401
401
  part="panel"
402
- role="${a(this.getAttribute("role")||"dialog")}"
402
+ role="${a(this._panelRole())}"
403
403
  aria-modal="true"
404
404
  ${F?`aria-label="${a(F)}"`:""}
405
405
  ${y?`aria-labelledby="${a(y)}"`:""}
@@ -413,17 +413,17 @@
413
413
  <path d="M12.5 3.5L3.5 12.5"></path>
414
414
  </svg>
415
415
  </button>`:""}
416
- ${B}
416
+ ${M}
417
417
  <div class="body" part="body">
418
- ${O?'<slot name="content"></slot>':"<slot></slot>"}
418
+ ${$?'<slot name="content"></slot>':"<slot></slot>"}
419
419
  </div>
420
420
 
421
421
  <div class="error" id="${A}" part="error" aria-live="polite" data-empty="${String(!_)}">${a(_)}</div>
422
422
 
423
423
  <footer class="footer" part="footer">
424
- ${b?`<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${a(o)}</span></span>`:'<span aria-hidden="true"></span>'}
424
+ ${b?`<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${a(s)}</span></span>`:'<span aria-hidden="true"></span>'}
425
425
 
426
- ${q?'<slot name="footer"></slot>':`${$?`<button class="btn btn-cancel" part="cancel" type="button" ${b?"disabled":""}>${a(s)}</button>`:""}
426
+ ${q?'<slot name="footer"></slot>':`${D?`<button class="btn btn-cancel" part="cancel" type="button" ${b?"disabled":""}>${a(o)}</button>`:""}
427
427
  <button class="btn btn-submit" part="submit" type="button" ${b?"disabled":""}>${a(e)}</button>`}
428
428
  </footer>
429
429
  </section>
@@ -1,9 +1,9 @@
1
- import { E as z } from "./ElementBase-BeZT54Hj.mjs";
1
+ import { E as z } from "./ElementBase-D5QsC5Vw.mjs";
2
2
  import { a as B, r as I } from "./scroll-lock-LfqXXqsu.mjs";
3
3
  import { c as M } from "./dismissable-layer-BmPIoK80.mjs";
4
- import { c as R } from "./focus-scope-CmEsG5UZ.mjs";
5
- import { l as P, c as W } from "./overlay-motion-BX3dPLay.mjs";
6
- const H = `
4
+ import { g as R, a as P } from "./focus-scope-Dl0qk5GP.mjs";
5
+ import { l as W, c as H } from "./overlay-motion-BX3dPLay.mjs";
6
+ const K = `
7
7
  :host {
8
8
  position: fixed;
9
9
  inset: 0;
@@ -393,8 +393,8 @@ const H = `
393
393
  box-shadow: none;
394
394
  }
395
395
  }
396
- `, K = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
397
- function p(n, t) {
396
+ `;
397
+ function b(n, t) {
398
398
  if (n == null) return t;
399
399
  const i = n.trim().toLowerCase();
400
400
  return i !== "false" && i !== "0" && i !== "off";
@@ -430,6 +430,7 @@ const l = class l extends z {
430
430
  "size",
431
431
  "state",
432
432
  "role",
433
+ "dialog-role",
433
434
  "initial-focus",
434
435
  "submit-text",
435
436
  "cancel-text",
@@ -464,25 +465,25 @@ const l = class l extends z {
464
465
  t ? this.setAttribute("open", "") : this.close("dismiss", "programmatic");
465
466
  }
466
467
  get dismissible() {
467
- return p(this.getAttribute("dismissible") ?? this.getAttribute("closable"), !0);
468
+ return b(this.getAttribute("dismissible") ?? this.getAttribute("closable"), !0);
468
469
  }
469
470
  set dismissible(t) {
470
471
  this.setAttribute("dismissible", String(t)), this.setAttribute("closable", String(t));
471
472
  }
472
473
  get closeOnOverlay() {
473
- return p(this.getAttribute("close-on-overlay") ?? this.getAttribute("close-on-backdrop"), !0);
474
+ return b(this.getAttribute("close-on-overlay") ?? this.getAttribute("close-on-backdrop"), !0);
474
475
  }
475
476
  set closeOnOverlay(t) {
476
477
  this.setAttribute("close-on-overlay", String(t)), this.setAttribute("close-on-backdrop", String(t));
477
478
  }
478
479
  get closeOnEsc() {
479
- return p(this.getAttribute("close-on-esc"), !0);
480
+ return b(this.getAttribute("close-on-esc"), !0);
480
481
  }
481
482
  set closeOnEsc(t) {
482
483
  this.setAttribute("close-on-esc", String(t));
483
484
  }
484
485
  get lockWhileLoading() {
485
- return p(this.getAttribute("lock-while-loading"), !0);
486
+ return b(this.getAttribute("lock-while-loading"), !0);
486
487
  }
487
488
  set lockWhileLoading(t) {
488
489
  this.setAttribute("lock-while-loading", String(t));
@@ -508,7 +509,7 @@ const l = class l extends z {
508
509
  return this._config;
509
510
  }
510
511
  set config(t) {
511
- this._config = t || {}, this._config.id && (this._dialogId = this._config.id), this._config.dismissible != null && (this.dismissible = !!this._config.dismissible), this._config.closeOnOverlay != null && (this.closeOnOverlay = !!this._config.closeOnOverlay), this._config.closeOnEsc != null && (this.closeOnEsc = !!this._config.closeOnEsc), this._config.lockWhileLoading != null && (this.lockWhileLoading = !!this._config.lockWhileLoading), this._config.size && this.setAttribute("size", this._config.size), this._config.role && this.setAttribute("role", this._config.role), this._config.initialFocus && this.setAttribute("initial-focus", this._config.initialFocus), this._config.ariaLabel && this.setAttribute("aria-label", this._config.ariaLabel), this._config.ariaLabelledby && this.setAttribute("aria-labelledby", this._config.ariaLabelledby), this._config.ariaDescribedby && this.setAttribute("aria-describedby", this._config.ariaDescribedby), this._config.errorMessage && (this._runtimeError = this._config.errorMessage), this.requestRender();
512
+ this._config = t || {}, this._config.id && (this._dialogId = this._config.id), this._config.dismissible != null && (this.dismissible = !!this._config.dismissible), this._config.closeOnOverlay != null && (this.closeOnOverlay = !!this._config.closeOnOverlay), this._config.closeOnEsc != null && (this.closeOnEsc = !!this._config.closeOnEsc), this._config.lockWhileLoading != null && (this.lockWhileLoading = !!this._config.lockWhileLoading), this._config.size && this.setAttribute("size", this._config.size), this._config.role && this.setAttribute("dialog-role", this._config.role), this._config.initialFocus && this.setAttribute("initial-focus", this._config.initialFocus), this._config.ariaLabel && this.setAttribute("aria-label", this._config.ariaLabel), this._config.ariaLabelledby && this.setAttribute("aria-labelledby", this._config.ariaLabelledby), this._config.ariaDescribedby && this.setAttribute("aria-describedby", this._config.ariaDescribedby), this._config.errorMessage && (this._runtimeError = this._config.errorMessage), this.requestRender();
512
513
  }
513
514
  openDialog() {
514
515
  this.setAttribute("open", "");
@@ -562,7 +563,10 @@ const l = class l extends z {
562
563
  this._runtimeError = "", this.state === "error" && (this.state = "idle"), this.requestRender();
563
564
  }
564
565
  _syncFromAttributes() {
565
- !this.hasAttribute("dismissible") && this.hasAttribute("closable") && this.setAttribute("dismissible", this.getAttribute("closable") || "true"), !this.hasAttribute("closable") && this.hasAttribute("dismissible") && this.setAttribute("closable", this.getAttribute("dismissible") || "true"), !this.hasAttribute("close-on-overlay") && this.hasAttribute("close-on-backdrop") && this.setAttribute("close-on-overlay", this.getAttribute("close-on-backdrop") || "true"), !this.hasAttribute("close-on-backdrop") && this.hasAttribute("close-on-overlay") && this.setAttribute("close-on-backdrop", this.getAttribute("close-on-overlay") || "true"), this.hasAttribute("role") || this.setAttribute("role", "dialog");
566
+ !this.hasAttribute("dismissible") && this.hasAttribute("closable") && this.setAttribute("dismissible", this.getAttribute("closable") || "true"), !this.hasAttribute("closable") && this.hasAttribute("dismissible") && this.setAttribute("closable", this.getAttribute("dismissible") || "true"), !this.hasAttribute("close-on-overlay") && this.hasAttribute("close-on-backdrop") && this.setAttribute("close-on-overlay", this.getAttribute("close-on-backdrop") || "true"), !this.hasAttribute("close-on-backdrop") && this.hasAttribute("close-on-overlay") && this.setAttribute("close-on-backdrop", this.getAttribute("close-on-overlay") || "true");
567
+ }
568
+ _panelRole() {
569
+ return (this.getAttribute("dialog-role") || this.getAttribute("role") || "").trim() === "alertdialog" ? "alertdialog" : "dialog";
566
570
  }
567
571
  _syncOpenState() {
568
572
  const t = this.hasAttribute("open");
@@ -578,13 +582,13 @@ const l = class l extends z {
578
582
  this._isActive = !1, this._destroyRuntimeControllers();
579
583
  const t = l._openStack.lastIndexOf(this);
580
584
  if (t >= 0 && l._openStack.splice(t, 1), I(), !this._terminalEmitted) {
581
- const e = this._closeMeta || { action: "dismiss", source: "abort" }, s = this.dialogId || this._uid;
582
- e.action === "cancel" ? this._dispatchWithLegacy("ui-cancel", "cancel", { id: s }) : this._dispatchWithLegacy("ui-dismiss", "dismiss", {
583
- id: s,
585
+ const e = this._closeMeta || { action: "dismiss", source: "abort" }, o = this.dialogId || this._uid;
586
+ e.action === "cancel" ? this._dispatchWithLegacy("ui-cancel", "cancel", { id: o }) : this._dispatchWithLegacy("ui-dismiss", "dismiss", {
587
+ id: o,
584
588
  source: e.source || "abort",
585
589
  reason: e.reason
586
590
  }), this._dispatchWithLegacy("ui-close", "close", {
587
- id: s,
591
+ id: o,
588
592
  action: e.action,
589
593
  source: e.source,
590
594
  reason: e.reason
@@ -599,21 +603,21 @@ const l = class l extends z {
599
603
  }
600
604
  })), this._syncOpenUi();
601
605
  }
602
- _dispatchWithLegacy(t, i, e, s = !1) {
603
- const o = new CustomEvent(t, {
606
+ _dispatchWithLegacy(t, i, e, o = !1) {
607
+ const s = new CustomEvent(t, {
604
608
  detail: e,
605
609
  bubbles: !0,
606
610
  composed: !0,
607
- cancelable: s
611
+ cancelable: o
608
612
  });
609
- this.dispatchEvent(o);
613
+ this.dispatchEvent(s);
610
614
  const r = new CustomEvent(i, {
611
615
  detail: e,
612
616
  bubbles: !0,
613
617
  composed: !0,
614
- cancelable: s
618
+ cancelable: o
615
619
  });
616
- return this.dispatchEvent(r), o;
620
+ return this.dispatchEvent(r), s;
617
621
  }
618
622
  _isTopMost() {
619
623
  if (!this._isActive) return !1;
@@ -630,10 +634,10 @@ const l = class l extends z {
630
634
  return i.display !== "none" && i.visibility !== "hidden";
631
635
  }
632
636
  _collectFocusable(t) {
633
- return Array.from(t.querySelectorAll(K)).filter((i) => {
637
+ return R(t).filter((i) => {
634
638
  if (i.disabled || i.getAttribute("aria-hidden") === "true") return !1;
635
- const s = C() ? window.getComputedStyle(i) : null;
636
- return !(s && (s.display === "none" || s.visibility === "hidden"));
639
+ const o = C() ? window.getComputedStyle(i) : null;
640
+ return !(o && (o.display === "none" || o.visibility === "hidden"));
637
641
  });
638
642
  }
639
643
  _focusInitial() {
@@ -648,10 +652,10 @@ const l = class l extends z {
648
652
  return;
649
653
  }
650
654
  }
651
- const e = this._collectFocusable(t), o = e.find((r) => r.hasAttribute("autofocus")) || e[0] || t;
652
- !o.hasAttribute("tabindex") && o === t && o.setAttribute("tabindex", "-1");
655
+ const e = this._collectFocusable(t), s = e.find((r) => r.hasAttribute("autofocus")) || e[0] || t;
656
+ !s.hasAttribute("tabindex") && s === t && s.setAttribute("tabindex", "-1");
653
657
  try {
654
- o.focus();
658
+ s.focus();
655
659
  } catch {
656
660
  }
657
661
  }
@@ -668,11 +672,11 @@ const l = class l extends z {
668
672
  const t = this.root.querySelector(".overlay"), i = this._queryPanel(), e = this.open;
669
673
  if (!(!t || !i)) {
670
674
  if (t.setAttribute("aria-hidden", e ? "false" : "true"), i.setAttribute("aria-hidden", e ? "false" : "true"), t.setAttribute("data-open", String(e)), e) {
671
- this._finishClose?.(), this._finishClose = null, t.hidden = !1, t.setAttribute("data-state", "open"), this._presented || t.removeAttribute("data-instant"), this._presented = !0, this.hasAttribute("headless") || P(t, { resetBox: !1 });
675
+ this._finishClose?.(), this._finishClose = null, t.hidden = !1, t.setAttribute("data-state", "open"), this._presented || t.removeAttribute("data-instant"), this._presented = !0, this.hasAttribute("headless") || W(t, { resetBox: !1 });
672
676
  return;
673
677
  }
674
678
  if (this._presented && !t.hidden) {
675
- this._presented = !1, t.removeAttribute("data-instant"), this._finishClose = W(t, () => {
679
+ this._presented = !1, t.removeAttribute("data-instant"), this._finishClose = H(t, () => {
676
680
  this._finishClose = null, t.hidden = !0;
677
681
  try {
678
682
  t.matches(":popover-open") && t.hidePopover();
@@ -693,7 +697,7 @@ const l = class l extends z {
693
697
  closeOnPointerOutside: this.closeOnOverlay,
694
698
  closeOnFocusOutside: !1,
695
699
  onBeforeDismiss: (i, e) => this._isInteractionLocked() ? !1 : i === "escape-key" ? (this.closeDialog("escape"), !1) : (i === "outside-pointer" && this.closeDialog("overlay"), !1)
696
- }), this._focusScope = R({
700
+ }), this._focusScope = P({
697
701
  node: t,
698
702
  trapped: !0,
699
703
  loop: !0,
@@ -708,22 +712,22 @@ const l = class l extends z {
708
712
  _collectFormData(t) {
709
713
  const i = this._queryPanel(), e = t || this.querySelector("form") || i?.querySelector("form") || null;
710
714
  if (!(e instanceof HTMLFormElement) || typeof FormData > "u") return;
711
- const s = new FormData(e), o = {};
712
- for (const [r, h] of s.entries()) {
715
+ const o = new FormData(e), s = {};
716
+ for (const [r, h] of o.entries()) {
713
717
  const c = String(h);
714
- if (o[r] == null) {
715
- o[r] = c;
718
+ if (s[r] == null) {
719
+ s[r] = c;
716
720
  continue;
717
721
  }
718
- const d = o[r];
719
- Array.isArray(d) ? d.push(c) : o[r] = [d, c];
722
+ const d = s[r];
723
+ Array.isArray(d) ? d.push(c) : s[r] = [d, c];
720
724
  }
721
- return Object.keys(o).length ? o : void 0;
725
+ return Object.keys(s).length ? s : void 0;
722
726
  }
723
727
  _resolveSubmitForm(t) {
724
728
  if (t) {
725
- const s = t.closest("form");
726
- if (s instanceof HTMLFormElement && this.contains(s)) return s;
729
+ const o = t.closest("form");
730
+ if (o instanceof HTMLFormElement && this.contains(o)) return o;
727
731
  }
728
732
  const i = this.querySelector("form");
729
733
  if (i instanceof HTMLFormElement) return i;
@@ -796,7 +800,7 @@ const l = class l extends z {
796
800
  }
797
801
  }
798
802
  render() {
799
- const t = this._config.title ?? this.getAttribute("title") ?? "", i = this._config.description ?? this.getAttribute("description") ?? "", e = this._config.submitText ?? this.getAttribute("submit-text") ?? "Submit", s = this._config.cancelText ?? this.getAttribute("cancel-text") ?? "Cancel", o = this._config.loadingText ?? this.getAttribute("loading-text") ?? "Working...", r = t.trim(), h = i.trim(), c = !!this.querySelector('[slot="title"]'), d = !!this.querySelector('[slot="description"]'), f = !!(r || c), m = !!(h || d), E = !!this.querySelector('[slot="content"]'), L = !!this.querySelector('[slot="footer"]'), O = this._config.showCancel ?? !0, $ = this._config.showClose ?? this.dismissible, v = this._runtimeError || this._config.errorMessage || this.getAttribute("error-message") || "", b = this.state === "loading", x = `ui-dialog-title-${this._uid}`, k = `ui-dialog-description-${this._uid}`, A = `ui-dialog-error-${this._uid}`, T = this.getAttribute("aria-label") || "", D = this.getAttribute("aria-labelledby") || "", w = this.getAttribute("aria-describedby") || "", _ = D || (f ? x : ""), F = T || (_ ? "" : "Dialog"), u = [];
803
+ const t = this._config.title ?? this.getAttribute("title") ?? "", i = this._config.description ?? this.getAttribute("description") ?? "", e = this._config.submitText ?? this.getAttribute("submit-text") ?? "Submit", o = this._config.cancelText ?? this.getAttribute("cancel-text") ?? "Cancel", s = this._config.loadingText ?? this.getAttribute("loading-text") ?? "Working...", r = t.trim(), h = i.trim(), c = !!this.querySelector('[slot="title"]'), d = !!this.querySelector('[slot="description"]'), f = !!(r || c), m = !!(h || d), E = !!this.querySelector('[slot="content"]'), L = !!this.querySelector('[slot="footer"]'), O = this._config.showCancel ?? !0, $ = this._config.showClose ?? this.dismissible, v = this._runtimeError || this._config.errorMessage || this.getAttribute("error-message") || "", p = this.state === "loading", x = `ui-dialog-title-${this._uid}`, k = `ui-dialog-description-${this._uid}`, A = `ui-dialog-error-${this._uid}`, D = this.getAttribute("aria-label") || "", T = this.getAttribute("aria-labelledby") || "", w = this.getAttribute("aria-describedby") || "", _ = T || (f ? x : ""), F = D || (_ ? "" : "Dialog"), u = [];
800
804
  w ? u.push(w) : (m && u.push(k), v && u.push(A));
801
805
  const q = f || m ? `
802
806
  <header class="header" part="header">
@@ -805,12 +809,12 @@ const l = class l extends z {
805
809
  </header>
806
810
  ` : "";
807
811
  this._destroyRuntimeControllers(), this.setContent(`
808
- ${this.hasAttribute("headless") ? "" : `<style>${H}</style>`}
812
+ ${this.hasAttribute("headless") ? "" : `<style>${K}</style>`}
809
813
  <div class="overlay" part="overlay" data-open="${String(this.open)}" data-state="${this.open ? "open" : "closed"}" ${this.open ? "data-instant" : "hidden"} aria-hidden="${this.open ? "false" : "true"}">
810
814
  <section
811
815
  class="panel"
812
816
  part="panel"
813
- role="${a(this.getAttribute("role") || "dialog")}"
817
+ role="${a(this._panelRole())}"
814
818
  aria-modal="true"
815
819
  ${F ? `aria-label="${a(F)}"` : ""}
816
820
  ${_ ? `aria-labelledby="${a(_)}"` : ""}
@@ -818,7 +822,7 @@ const l = class l extends z {
818
822
  aria-hidden="${this.open ? "false" : "true"}"
819
823
  tabindex="-1"
820
824
  >
821
- ${$ ? `<button class="close" part="close" aria-label="Close dialog" type="button" ${b ? "disabled" : ""}>
825
+ ${$ ? `<button class="close" part="close" aria-label="Close dialog" type="button" ${p ? "disabled" : ""}>
822
826
  <svg class="close-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true">
823
827
  <path d="M3.5 3.5L12.5 12.5"></path>
824
828
  <path d="M12.5 3.5L3.5 12.5"></path>
@@ -832,10 +836,10 @@ const l = class l extends z {
832
836
  <div class="error" id="${A}" part="error" aria-live="polite" data-empty="${String(!v)}">${a(v)}</div>
833
837
 
834
838
  <footer class="footer" part="footer">
835
- ${b ? `<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${a(o)}</span></span>` : '<span aria-hidden="true"></span>'}
839
+ ${p ? `<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${a(s)}</span></span>` : '<span aria-hidden="true"></span>'}
836
840
 
837
- ${L ? '<slot name="footer"></slot>' : `${O ? `<button class="btn btn-cancel" part="cancel" type="button" ${b ? "disabled" : ""}>${a(s)}</button>` : ""}
838
- <button class="btn btn-submit" part="submit" type="button" ${b ? "disabled" : ""}>${a(e)}</button>`}
841
+ ${L ? '<slot name="footer"></slot>' : `${O ? `<button class="btn btn-cancel" part="cancel" type="button" ${p ? "disabled" : ""}>${a(o)}</button>` : ""}
842
+ <button class="btn btn-submit" part="submit" type="button" ${p ? "disabled" : ""}>${a(e)}</button>`}
839
843
  </footer>
840
844
  </section>
841
845
  </div>
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./ElementBase-DxbvhLJs.js"),n=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./ElementBase-CbUsP3D6.js"),n=`
2
2
  :host {
3
3
  display: contents;
4
4
  color-scheme: light dark;
@@ -1,4 +1,4 @@
1
- import { E as s } from "./ElementBase-BeZT54Hj.mjs";
1
+ import { E as s } from "./ElementBase-D5QsC5Vw.mjs";
2
2
  const o = `
3
3
  :host {
4
4
  display: contents;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./ElementBase-DxbvhLJs.js"),a=require("./dismissable-layer-DNfrKA20.js"),u=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./ElementBase-CbUsP3D6.js"),a=require("./dismissable-layer-DNfrKA20.js"),u=`
2
2
  :host {
3
3
  display: contents;
4
4
  color-scheme: light dark;
@@ -1,4 +1,4 @@
1
- import { E as n } from "./ElementBase-BeZT54Hj.mjs";
1
+ import { E as n } from "./ElementBase-D5QsC5Vw.mjs";
2
2
  import { c as l } from "./dismissable-layer-BmPIoK80.mjs";
3
3
  const a = `
4
4
  :host {
package/dist/dock.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-DxbvhLJs.js"),F=1.92,C=148,R=1,D=20,x=.18,_="12px",k="12px 14px",v="56px",O=56,z={xs:{gap:"8px",padding:"8px 10px",itemSize:40,iconSize:18,itemRadius:14},sm:{gap:"10px",padding:"10px 12px",itemSize:48,iconSize:20,itemRadius:16},md:{gap:_,padding:k,itemSize:56,iconSize:24,itemRadius:18},lg:{gap:"14px",padding:"14px 16px",itemSize:64,iconSize:28,itemRadius:20},xl:{gap:"18px",padding:"16px 20px",itemSize:74,iconSize:32,itemRadius:24}},P={calm:{response:.11,damping:.82,spread:.62,lift:.82},smooth:{response:.16,damping:.78,spread:.82,lift:1},snappy:{response:.22,damping:.74,spread:.92,lift:1.06},bouncy:{response:.24,damping:.66,spread:1,lift:1.12}},E=new Set(["gap","padding","radius","item-size","variant","tone","size","elevation"]),N=new Set(["orientation","magnification","distance","idle-scale","lift","smoothing","animation","gap","padding","item-size"]),I=new Set(["label-mode","label-placement"]),V=new Set(["none","sm","md","lg","full"]),q=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-CbUsP3D6.js"),F=1.92,C=148,R=1,D=20,x=.18,_="12px",k="12px 14px",v="56px",O=56,z={xs:{gap:"8px",padding:"8px 10px",itemSize:40,iconSize:18,itemRadius:14},sm:{gap:"10px",padding:"10px 12px",itemSize:48,iconSize:20,itemRadius:16},md:{gap:_,padding:k,itemSize:56,iconSize:24,itemRadius:18},lg:{gap:"14px",padding:"14px 16px",itemSize:64,iconSize:28,itemRadius:20},xl:{gap:"18px",padding:"16px 20px",itemSize:74,iconSize:32,itemRadius:24}},P={calm:{response:.11,damping:.82,spread:.62,lift:.82},smooth:{response:.16,damping:.78,spread:.82,lift:1},snappy:{response:.22,damping:.74,spread:.92,lift:1.06},bouncy:{response:.24,damping:.66,spread:1,lift:1.12}},E=new Set(["gap","padding","radius","item-size","variant","tone","size","elevation"]),N=new Set(["orientation","magnification","distance","idle-scale","lift","smoothing","animation","gap","padding","item-size"]),I=new Set(["label-mode","label-placement"]),V=new Set(["none","sm","md","lg","full"]),q=`
2
2
  :host {
3
3
  --ui-dock-gap: ${_};
4
4
  --ui-dock-padding: ${k};
package/dist/dock.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { E as M } from "./ElementBase-BeZT54Hj.mjs";
1
+ import { E as M } from "./ElementBase-D5QsC5Vw.mjs";
2
2
  const T = 1.92, F = 148, C = 1, R = 20, x = 0.18, _ = "12px", k = "12px 14px", v = "56px", D = 56, z = {
3
3
  xs: {
4
4
  gap: "8px",
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-DxbvhLJs.js"),w=require("./overlayManager-CSy3fJmJ.js");function k(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>i()):window.setTimeout(i,16)}function F(i){if(i){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(i);return}window.clearTimeout(i)}}const L='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',D=new Set(["side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","role","aria-label","aria-labelledby","aria-describedby","initial-focus"]),$=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-CbUsP3D6.js"),k=require("./focus-scope-Doz0bnE1.js"),w=require("./overlayManager-CSy3fJmJ.js");function C(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>i()):window.setTimeout(i,16)}function F(i){if(i){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(i);return}window.clearTimeout(i)}}const D='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',$=new Set(["side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","role","aria-label","aria-labelledby","aria-describedby","initial-focus"]),B=`
2
2
  :host {
3
3
  position: fixed;
4
4
  inset: 0;
@@ -355,7 +355,7 @@
355
355
  --ui-drawer-muted: #94a3b8;
356
356
  --ui-drawer-border-color: #334155;
357
357
  --ui-drawer-overlay: rgba(2, 6, 23, 0.78);
358
- --ui-drawer-focus-ring: #93c5fd;
358
+ --ui-drawer-focus-ring: var(--ui-color-accent-on-dark, #93c5fd);
359
359
  --ui-drawer-control-bg: #111827;
360
360
  --ui-drawer-control-bg-hover: color-mix(in srgb, #ffffff 14%, transparent);
361
361
  }
@@ -494,8 +494,8 @@
494
494
  display: none;
495
495
  }
496
496
  }
497
- `;function _(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function y(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function S(i,e){return i==="top"||i==="bottom"||i==="left"||i==="right"?i:i==="start"?e==="rtl"?"right":"left":i==="end"?e==="rtl"?"left":"right":"left"}function C(i,e){const t=i.querySelector(`[slot="${e}"]`);return t?t.textContent?.trim().length!==0||t.children.length>0:!1}function I(){return typeof window<"u"&&typeof document<"u"}class O extends T.ElementBase{constructor(){super(),this._uid=Math.random().toString(36).slice(2,10),this._isOpen=!1,this._restoreFocusEl=null,this._globalListenersBound=!1,this._closeReason="programmatic",this._focusInitialFrame=0,this._focusTrapFrame=0,this._restoreFocusFrame=0,this._onRootClick=this._onRootClick.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this),this._onDocumentFocusIn=this._onDocumentFocusIn.bind(this)}static get observedAttributes(){return["open","side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","title","description","aria-label","aria-labelledby","aria-describedby","initial-focus"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources(),this._restoreFocusEl=null,this._isOpen=!1,super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if(D.has(e)){this._syncLiveUi(),this._isOpen&&(e==="initial-focus"||e==="dismissible"||e==="show-close")&&this._scheduleEnsureFocusTrap();return}this.isConnected&&this.requestRender()}}open(){this.setAttribute("open","")}close(e="programmatic"){this._closeReason=e,this.removeAttribute("open")}closeDrawer(e="programmatic"){if(this.hasAttribute("open")){if(e==="programmatic"){this.close("programmatic");return}this._requestClose(e)}}toggle(){this.hasAttribute("open")?this.close("programmatic"):this.open()}get dismissible(){const e=this.getAttribute("dismissible");return e==null?!1:_(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return _(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return _(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return _(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?_(this.getAttribute("show-close"),!0):this.dismissible}set showClose(e){this.setAttribute("show-close",String(e))}get state(){const e=this.getAttribute("state");return e==="loading"||e==="error"||e==="success"?e:"idle"}set state(e){if(e==="idle"){this.removeAttribute("state");return}this.setAttribute("state",e)}get inset(){return this.hasAttribute("inset")}set inset(e){e?this.setAttribute("inset",""):this.removeAttribute("inset")}_getPanel(){return this.root.querySelector(".panel")}_getOverlay(){return this.root.querySelector(".overlay")}_getHeader(){return this.root.querySelector(".header")}_titleId(){return`ui-drawer-title-${this._uid}`}_descriptionId(){return`ui-drawer-description-${this._uid}`}_bodyId(){return`ui-drawer-body-${this._uid}`}_resolvedSide(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr";return S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=w.OverlayManager.top();return e?e===this:!0}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_isNodeInsideDrawer(e){if(!e)return!1;const t=this._getPanel();return t&&t.contains(e)?!0:this.contains(e)}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.matches('[inert], [aria-hidden="true"]')||e.closest('[inert], [aria-hidden="true"]'))return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_collectFocusable(){const e=this._getPanel(),t=[],r=s=>{this._isFocusable(s)&&(t.includes(s)||t.push(s))};return this.querySelectorAll(L).forEach(r),e&&e.querySelectorAll(L).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(F(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(F(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(F(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=k(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=k(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&F(this._restoreFocusFrame),this._restoreFocusFrame=k(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(e)&&e.focus({preventScroll:!0})}catch{try{this._canRestoreFocus(e)&&e.focus()}catch{}}}))}_syncLiveUi(){const e=this.hasAttribute("open"),t=this._getOverlay(),r=this._getPanel(),s=this._getHeader(),a=this.root.querySelector(".close-btn");if(t&&t.setAttribute("aria-hidden",e?"false":"true"),!r)return;const o=this._resolvedSide();r.classList.remove("side-left","side-right","side-top","side-bottom"),r.classList.add(`side-${o}`);const n=this.state==="loading";n?r.setAttribute("aria-busy","true"):r.removeAttribute("aria-busy");const A=this.getAttribute("role")||"dialog";r.setAttribute("role",A);const u=(this.getAttribute("title")||"").trim(),g=(this.getAttribute("description")||"").trim(),c=C(this,"header"),h=this.showClose,x=h||c||!!u||!!g;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!h,a.disabled=n&&this.lockWhileLoading);const b=this.getAttribute("aria-label")||"",m=this.getAttribute("aria-labelledby")||"",v=this.getAttribute("aria-describedby")||"",p=c?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",l=!b&&!m&&!!p,f=m||(!b&&!l&&(c||u)?this._titleId():""),d=[];v?d.push(v):(g&&d.push(this._descriptionId()),d.push(this._bodyId()));const E=b||(l?p:f?"":"Drawer");E?r.setAttribute("aria-label",E):r.removeAttribute("aria-label"),f?r.setAttribute("aria-labelledby",f):r.removeAttribute("aria-labelledby"),d.length?r.setAttribute("aria-describedby",d.join(" ")):r.removeAttribute("aria-describedby")}_focusInitial(){if(!this._isOpen)return;const e=this._getPanel();if(!e)return;const t=this.getAttribute("initial-focus")||"";if(t){const o=this.querySelector(t)||e.querySelector(t);if(o&&this._isFocusable(o))try{o.focus({preventScroll:!0});return}catch{try{o.focus();return}catch{}}}const r=this._collectFocusable(),a=r.find(o=>o.hasAttribute("autofocus"))||r[0]||e;a===e&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","-1");try{a.focus({preventScroll:!0})}catch{try{a.focus()}catch{}}}_ensureFocusTrap(){if(!this._isOpen||!this._isTopMost())return;const e=document.activeElement;this._isNodeInsideDrawer(e)||this._focusInitial()}_releaseOpenResources(){try{w.OverlayManager.unregister(this),w.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_syncOpenState(){const e=this.hasAttribute("open");if(this._syncLiveUi(),e===this._isOpen){e?(this._bindGlobalListeners(),this._scheduleEnsureFocusTrap()):(this._unbindGlobalListeners(),this._cancelScheduledFocusWork());return}if(this._isOpen=e,e){this._cancelScheduledFocusWork(),this._bindGlobalListeners(),this._restoreFocusEl=document.activeElement||null,this._closeReason="programmatic";try{w.OverlayManager.register(this),w.OverlayManager.acquireLock()}catch{}this._scheduleFocusInitial(),this._scheduleEnsureFocusTrap(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0,reason:"programmatic"}}));return}this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources();const t=this._closeReason;this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:t}}));const r=this._restoreFocusEl;this._restoreFocusEl=null,this._closeReason="programmatic",this._scheduleRestoreFocus(r)}_requestClose(e){if(!this._isOpen||this._isInteractionLocked())return;const t=new CustomEvent("request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t);const r=new CustomEvent("ui-request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r),!(t.defaultPrevented||r.defaultPrevented)&&this.close(e)}_onRootClick(e){const t=e.target;if(!t||!this._isOpen)return;if(t.closest(".close-btn")){this._requestClose("button");return}t.closest(".overlay")&&(!this.dismissible||!this.closeOnOverlay||this._isTopMost()&&this._requestClose("overlay"))}_handleTab(e){const t=this._getPanel();if(!t)return;const r=this._collectFocusable();if(!r.length){e.preventDefault(),t.focus();return}const s=r[0],a=r[r.length-1],o=document.activeElement,n=!!o&&this._isNodeInsideDrawer(o);if(e.shiftKey){if(!n||o===s){e.preventDefault();try{a.focus({preventScroll:!0})}catch{a.focus()}}return}if(!n||o===a){e.preventDefault();try{s.focus({preventScroll:!0})}catch{s.focus()}}}_onDocumentKeyDown(e){if(!(!this._isOpen||!this._isTopMost())){if(e.key==="Escape"){if(!this.dismissible||!this.closeOnEsc||this._isInteractionLocked())return;e.preventDefault(),e.stopPropagation(),this._requestClose("escape");return}e.key==="Tab"&&this._handleTab(e)}}_onDocumentFocusIn(e){if(!this._isOpen||!this._isTopMost())return;const t=e.target,r=this._getPanel(),s=typeof e.composedPath=="function"?e.composedPath():[];t&&this._isNodeInsideDrawer(t)||s.includes(this)||r&&s.includes(r)||this._scheduleFocusInitial()}render(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr",t=S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr"),r=this.showClose,s=C(this,"header"),a=C(this,"footer"),o=(this.getAttribute("title")||"").trim(),n=(this.getAttribute("description")||"").trim(),A=r||s||!!o||!!n,u=`ui-drawer-title-${this._uid}`,g=`ui-drawer-description-${this._uid}`,c=`ui-drawer-body-${this._uid}`,h=this.getAttribute("aria-label")||"",x=this.getAttribute("aria-labelledby")||"",b=this.getAttribute("aria-describedby")||"",m=s?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",v=!h&&!x&&!!m,p=x||(!h&&!v&&(s||o)?u:""),l=[];b?l.push(b):(n&&l.push(g),l.push(c));const f=h||(v?m:p?"":"Drawer"),d=this.state==="loading";this.setContent(`
498
- <style>${$}</style>
497
+ `;function _(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function y(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function S(i,e){return i==="top"||i==="bottom"||i==="left"||i==="right"?i:i==="start"?e==="rtl"?"right":"left":i==="end"?e==="rtl"?"left":"right":"left"}function E(i,e){const t=i.querySelector(`[slot="${e}"]`);return t?t.textContent?.trim().length!==0||t.children.length>0:!1}function I(){return typeof window<"u"&&typeof document<"u"}class O extends T.ElementBase{constructor(){super(),this._uid=Math.random().toString(36).slice(2,10),this._isOpen=!1,this._restoreFocusEl=null,this._globalListenersBound=!1,this._closeReason="programmatic",this._focusInitialFrame=0,this._focusTrapFrame=0,this._restoreFocusFrame=0,this._onRootClick=this._onRootClick.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this),this._onDocumentFocusIn=this._onDocumentFocusIn.bind(this)}static get observedAttributes(){return["open","side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","title","description","aria-label","aria-labelledby","aria-describedby","initial-focus"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources(),this._restoreFocusEl=null,this._isOpen=!1,super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if($.has(e)){this._syncLiveUi(),this._isOpen&&(e==="initial-focus"||e==="dismissible"||e==="show-close")&&this._scheduleEnsureFocusTrap();return}this.isConnected&&this.requestRender()}}open(){this.setAttribute("open","")}close(e="programmatic"){this._closeReason=e,this.removeAttribute("open")}closeDrawer(e="programmatic"){if(this.hasAttribute("open")){if(e==="programmatic"){this.close("programmatic");return}this._requestClose(e)}}toggle(){this.hasAttribute("open")?this.close("programmatic"):this.open()}get dismissible(){const e=this.getAttribute("dismissible");return e==null?!1:_(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return _(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return _(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return _(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?_(this.getAttribute("show-close"),!0):this.dismissible}set showClose(e){this.setAttribute("show-close",String(e))}get state(){const e=this.getAttribute("state");return e==="loading"||e==="error"||e==="success"?e:"idle"}set state(e){if(e==="idle"){this.removeAttribute("state");return}this.setAttribute("state",e)}get inset(){return this.hasAttribute("inset")}set inset(e){e?this.setAttribute("inset",""):this.removeAttribute("inset")}_getPanel(){return this.root.querySelector(".panel")}_getOverlay(){return this.root.querySelector(".overlay")}_getHeader(){return this.root.querySelector(".header")}_titleId(){return`ui-drawer-title-${this._uid}`}_descriptionId(){return`ui-drawer-description-${this._uid}`}_bodyId(){return`ui-drawer-body-${this._uid}`}_resolvedSide(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr";return S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=w.OverlayManager.top();return e?e===this:!0}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_isNodeInsideDrawer(e){if(!e)return!1;const t=this._getPanel();return t&&t.contains(e)?!0:this.contains(e)}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.matches('[inert], [aria-hidden="true"]')||e.closest('[inert], [aria-hidden="true"]'))return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_collectFocusable(){const e=this._getPanel(),t=[],r=s=>{this._isFocusable(s)&&(t.includes(s)||t.push(s))};return e?k.getFocusable(e).forEach(r):this.querySelectorAll(D).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(F(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(F(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(F(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=C(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=C(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&F(this._restoreFocusFrame),this._restoreFocusFrame=C(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(e)&&e.focus({preventScroll:!0})}catch{try{this._canRestoreFocus(e)&&e.focus()}catch{}}}))}_syncLiveUi(){const e=this.hasAttribute("open"),t=this._getOverlay(),r=this._getPanel(),s=this._getHeader(),a=this.root.querySelector(".close-btn");if(t&&t.setAttribute("aria-hidden",e?"false":"true"),!r)return;const o=this._resolvedSide();r.classList.remove("side-left","side-right","side-top","side-bottom"),r.classList.add(`side-${o}`);const n=this.state==="loading";n?r.setAttribute("aria-busy","true"):r.removeAttribute("aria-busy");const A=this.getAttribute("role")||"dialog";r.setAttribute("role",A);const u=(this.getAttribute("title")||"").trim(),g=(this.getAttribute("description")||"").trim(),c=E(this,"header"),h=this.showClose,x=h||c||!!u||!!g;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!h,a.disabled=n&&this.lockWhileLoading);const p=this.getAttribute("aria-label")||"",m=this.getAttribute("aria-labelledby")||"",v=this.getAttribute("aria-describedby")||"",b=c?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",l=!p&&!m&&!!b,f=m||(!p&&!l&&(c||u)?this._titleId():""),d=[];v?d.push(v):(g&&d.push(this._descriptionId()),d.push(this._bodyId()));const L=p||(l?b:f?"":"Drawer");L?r.setAttribute("aria-label",L):r.removeAttribute("aria-label"),f?r.setAttribute("aria-labelledby",f):r.removeAttribute("aria-labelledby"),d.length?r.setAttribute("aria-describedby",d.join(" ")):r.removeAttribute("aria-describedby")}_focusInitial(){if(!this._isOpen)return;const e=this._getPanel();if(!e)return;const t=this.getAttribute("initial-focus")||"";if(t){const o=this.querySelector(t)||e.querySelector(t);if(o&&this._isFocusable(o))try{o.focus({preventScroll:!0});return}catch{try{o.focus();return}catch{}}}const r=this._collectFocusable(),a=r.find(o=>o.hasAttribute("autofocus"))||r[0]||e;a===e&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","-1");try{a.focus({preventScroll:!0})}catch{try{a.focus()}catch{}}}_ensureFocusTrap(){if(!this._isOpen||!this._isTopMost())return;const e=document.activeElement;this._isNodeInsideDrawer(e)||this._focusInitial()}_releaseOpenResources(){try{w.OverlayManager.unregister(this),w.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_syncOpenState(){const e=this.hasAttribute("open");if(this._syncLiveUi(),e===this._isOpen){e?(this._bindGlobalListeners(),this._scheduleEnsureFocusTrap()):(this._unbindGlobalListeners(),this._cancelScheduledFocusWork());return}if(this._isOpen=e,e){this._cancelScheduledFocusWork(),this._bindGlobalListeners(),this._restoreFocusEl=document.activeElement||null,this._closeReason="programmatic";try{w.OverlayManager.register(this),w.OverlayManager.acquireLock()}catch{}this._scheduleFocusInitial(),this._scheduleEnsureFocusTrap(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0,reason:"programmatic"}}));return}this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources();const t=this._closeReason;this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:t}}));const r=this._restoreFocusEl;this._restoreFocusEl=null,this._closeReason="programmatic",this._scheduleRestoreFocus(r)}_requestClose(e){if(!this._isOpen||this._isInteractionLocked())return;const t=new CustomEvent("request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t);const r=new CustomEvent("ui-request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r),!(t.defaultPrevented||r.defaultPrevented)&&this.close(e)}_onRootClick(e){const t=e.target;if(!t||!this._isOpen)return;if(t.closest(".close-btn")){this._requestClose("button");return}t.closest(".overlay")&&(!this.dismissible||!this.closeOnOverlay||this._isTopMost()&&this._requestClose("overlay"))}_handleTab(e){const t=this._getPanel();if(!t)return;const r=this._collectFocusable();if(!r.length){e.preventDefault(),t.focus();return}const s=r[0],a=r[r.length-1],o=k.deepActiveElement(),n=!!o&&(this._isNodeInsideDrawer(o)||!!t&&k.composedContains(t,o));if(e.shiftKey){if(!n||o===s){e.preventDefault();try{a.focus({preventScroll:!0})}catch{a.focus()}}return}if(!n||o===a){e.preventDefault();try{s.focus({preventScroll:!0})}catch{s.focus()}}}_onDocumentKeyDown(e){if(!(!this._isOpen||!this._isTopMost())){if(e.key==="Escape"){if(!this.dismissible||!this.closeOnEsc||this._isInteractionLocked())return;e.preventDefault(),e.stopPropagation(),this._requestClose("escape");return}e.key==="Tab"&&this._handleTab(e)}}_onDocumentFocusIn(e){if(!this._isOpen||!this._isTopMost())return;const t=e.target,r=this._getPanel(),s=typeof e.composedPath=="function"?e.composedPath():[];t&&this._isNodeInsideDrawer(t)||s.includes(this)||r&&s.includes(r)||this._scheduleFocusInitial()}render(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr",t=S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr"),r=this.showClose,s=E(this,"header"),a=E(this,"footer"),o=(this.getAttribute("title")||"").trim(),n=(this.getAttribute("description")||"").trim(),A=r||s||!!o||!!n,u=`ui-drawer-title-${this._uid}`,g=`ui-drawer-description-${this._uid}`,c=`ui-drawer-body-${this._uid}`,h=this.getAttribute("aria-label")||"",x=this.getAttribute("aria-labelledby")||"",p=this.getAttribute("aria-describedby")||"",m=s?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",v=!h&&!x&&!!m,b=x||(!h&&!v&&(s||o)?u:""),l=[];p?l.push(p):(n&&l.push(g),l.push(c));const f=h||(v?m:b?"":"Drawer"),d=this.state==="loading";this.setContent(`
498
+ <style>${B}</style>
499
499
  <div class="overlay" part="overlay" aria-hidden="true"></div>
500
500
  <div
501
501
  class="panel side-${t}"
@@ -503,7 +503,7 @@
503
503
  role="dialog"
504
504
  aria-modal="true"
505
505
  ${f?`aria-label="${y(f)}"`:""}
506
- ${p?`aria-labelledby="${y(p)}"`:""}
506
+ ${b?`aria-labelledby="${y(b)}"`:""}
507
507
  ${l.length?`aria-describedby="${y(l.join(" "))}"`:""}
508
508
  ${d?'aria-busy="true"':""}
509
509
  tabindex="-1"