@webority/ui-elements 0.164.0 → 0.167.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 (446) hide show
  1. package/LICENSE +1 -1
  2. package/dist/WuiCarousel-CRx2-eKV.js +1 -0
  3. package/dist/WuiCodeBlock-DTckR_z3.js +1 -0
  4. package/dist/WuiCommandPalette-CSzl5yGf.js +2 -0
  5. package/dist/WuiCommentThread-AYovTYSA.js +1 -0
  6. package/dist/WuiConsentBanner-CWvXnwBH.js +1 -0
  7. package/dist/WuiContextMenu-CyejQsef.js +1 -0
  8. package/dist/WuiDataTable-BniN81KC.js +1 -0
  9. package/dist/WuiDatePicker-q0s8tL_E.js +31 -0
  10. package/dist/WuiDateRange-p2r5A9CY.js +25 -0
  11. package/dist/WuiDrawer-CQ7nRHUD.js +1 -0
  12. package/dist/WuiDropdown-BQC04Q48.js +1 -0
  13. package/dist/WuiEntryGrid-DPAYNu1v.js +3 -0
  14. package/dist/{WuiHoverCard-FL38ANLM.js → WuiHoverCard-DRZh88zM.js} +1 -1
  15. package/dist/WuiImageCrop-BTY59Qsm.js +17 -0
  16. package/dist/WuiInlineEdit-CEjs5Ruk.js +1 -0
  17. package/dist/WuiLeadPopup-L9UCTVA5.js +382 -0
  18. package/dist/WuiLightbox-DDQAOabU.js +1 -0
  19. package/dist/WuiMentionInput-CkhrCz_2.js +1 -0
  20. package/dist/{WuiModal-DvSt_466.js → WuiModal-BRILsSMq.js} +1 -1
  21. package/dist/{WuiNavigationMenu-Dlo-n-cL.js → WuiNavigationMenu-BCnqv7e-.js} +1 -1
  22. package/dist/WuiNotificationCenter-BCXT3Y7m.js +1 -0
  23. package/dist/WuiOrgTree-5v0vqPVk.js +1 -0
  24. package/dist/WuiOverflow-DtetLQHW.js +1 -0
  25. package/dist/WuiPhone-B6jgFRSi.js +16 -0
  26. package/dist/WuiPopover-BzVxNSs1.js +1 -0
  27. package/dist/WuiRecordPager-Dye7AfCS.js +1 -0
  28. package/dist/{WuiRelativeTime-CmlKD-97.js → WuiRelativeTime-DTGKGHbK.js} +1 -1
  29. package/dist/WuiSavedViews-BsAyuOzX.js +1 -0
  30. package/dist/WuiSelect-CMHoPHlx.js +9 -0
  31. package/dist/WuiShortcuts-DSjwaZx7.js +1 -0
  32. package/dist/WuiShowMore-CGhWrlmK.js +1 -0
  33. package/dist/WuiSlider-J9YPWu9e.js +51 -0
  34. package/dist/WuiSortable-BfOm57Mj.js +1 -0
  35. package/dist/WuiTimePicker-C5XouoR7.js +9 -0
  36. package/dist/WuiTour-BDOGWyNA.js +1 -0
  37. package/dist/WuiTree-CeYbyaCx.js +1 -0
  38. package/dist/{WuiWhatsNew-B2mM4MHE.js → WuiWhatsNew-DOo54GiH.js} +1 -1
  39. package/dist/WuiWizardStep-Ce6O_8oc.js +1 -0
  40. package/dist/calendarMath-CFjBxJYM.js +1 -0
  41. package/dist/carousel.g-Bw_pFDzc.js +1 -0
  42. package/dist/chips-CemguTKJ.js +2 -0
  43. package/dist/codeBlock.g-BCF2IlK-.js +1 -0
  44. package/dist/commandPalette.g-DFWnCufa.js +1 -0
  45. package/dist/commentText-NWsssKvj.js +1 -0
  46. package/dist/consentBanner.g-CZAb1BLJ.js +1 -0
  47. package/dist/country-B7jmc--B.js +1 -0
  48. package/dist/customRule-BXJdj57A.js +1 -0
  49. package/dist/customRule.g-Cfkl3_ZC.js +1 -0
  50. package/dist/dataTable-CKz4Oncc.js +1 -0
  51. package/dist/dataTable.g-BVxhub_d.js +1 -0
  52. package/dist/datePicker.g-CT9FBY21.js +1 -0
  53. package/dist/dateRangePicker.g-Pnc37vgX.js +1 -0
  54. package/dist/digitGrouping-CCPI3HK3.js +1 -0
  55. package/dist/drawer.g-B-zYKBfQ.js +1 -0
  56. package/dist/drawerDiscard-BjykHS_G.js +1 -0
  57. package/dist/elements/carousel.js +1 -1
  58. package/dist/elements/code-block.js +1 -1
  59. package/dist/elements/command-palette.js +1 -1
  60. package/dist/elements/comment-thread.js +1 -1
  61. package/dist/elements/consent-banner.js +1 -1
  62. package/dist/elements/context-menu.js +1 -1
  63. package/dist/elements/data-table.js +1 -1
  64. package/dist/elements/date-range.js +1 -1
  65. package/dist/elements/datepicker.js +1 -1
  66. package/dist/elements/drawer.js +1 -1
  67. package/dist/elements/dropdown.js +1 -1
  68. package/dist/elements/entry-grid.js +1 -0
  69. package/dist/elements/filter-popover.js +1 -1
  70. package/dist/elements/hover-card.js +1 -1
  71. package/dist/elements/image-crop.js +1 -1
  72. package/dist/elements/inline-edit.js +1 -1
  73. package/dist/elements/kanban.js +1 -1
  74. package/dist/elements/lead-popup.js +1 -1
  75. package/dist/elements/lightbox.js +1 -1
  76. package/dist/elements/mention-input.js +1 -1
  77. package/dist/elements/modal.js +1 -1
  78. package/dist/elements/navigation-menu.js +1 -1
  79. package/dist/elements/notification-center.js +1 -1
  80. package/dist/elements/org-tree.js +1 -1
  81. package/dist/elements/overflow.js +1 -1
  82. package/dist/elements/phone.js +1 -1
  83. package/dist/elements/popover.js +1 -1
  84. package/dist/elements/record-pager.js +1 -1
  85. package/dist/elements/relative-time.js +1 -1
  86. package/dist/elements/saved-views.js +1 -1
  87. package/dist/elements/select.js +1 -1
  88. package/dist/elements/shortcuts.js +1 -1
  89. package/dist/elements/show-more.js +1 -1
  90. package/dist/elements/slider.js +1 -1
  91. package/dist/elements/sortable.js +1 -1
  92. package/dist/elements/timepicker.js +1 -1
  93. package/dist/elements/tour.js +1 -1
  94. package/dist/elements/tree.js +1 -1
  95. package/dist/elements/whats-new.js +1 -1
  96. package/dist/elements/wizard.js +1 -1
  97. package/dist/fileViewer.g-B5XQ5WKr.js +1 -0
  98. package/dist/fileViewerImage-B0Q9zdgW.js +3 -0
  99. package/dist/fileViewerMedia-D3fdG-Ti.js +1 -0
  100. package/dist/fileViewerPdf-DeRWa1JE.js +20 -0
  101. package/dist/{filterPopover-CYzUbKN0.js → filterPopover-DmeVG4_N.js} +1 -1
  102. package/dist/formatters-Dy4kQQ_h.js +1 -0
  103. package/dist/formatters.g-BNAu1PMe.js +1 -0
  104. package/dist/helpers.js +1 -1
  105. package/dist/httpFailure.g-DBKzEpAf.js +1 -0
  106. package/dist/iconGlyphs.g-DxSJLQJ8.js +1 -0
  107. package/dist/imageCrop.g-BnbAeH2Q.js +1 -0
  108. package/dist/inlineEdit.g-ZxRNYq0t.js +1 -0
  109. package/dist/inlineEditText-BUO5sZxN.js +1 -0
  110. package/dist/isDrawn-BbF4phmB.js +1 -0
  111. package/dist/kanban-CEZmyYFY.js +1 -0
  112. package/dist/kanban.g-dtKYyIpr.js +1 -0
  113. package/dist/kanbanModel-Dp5c1rTs.js +1 -0
  114. package/dist/leadPopup.g-BfMPz9nH.js +1 -0
  115. package/dist/lightbox.g-DDrycPou.js +1 -0
  116. package/dist/loader-CQJFj96n.js +1 -0
  117. package/dist/mentionInput.g-DJo6d2Gm.js +1 -0
  118. package/dist/menuKeyNav-CstMzU08.js +1 -0
  119. package/dist/nativeOverlay-C1Rw2gIW.js +1 -0
  120. package/dist/notificationCentre.g-UsAurkUz.js +1 -0
  121. package/dist/notificationDays-B7cbYu4q.js +1 -0
  122. package/dist/{optionLabel-4xjXWy74.js → optionLabel-B2cU4Ax0.js} +1 -1
  123. package/dist/orgTree.g-CIg75quV.js +1 -0
  124. package/dist/overflow.g-BfcGEhwR.js +1 -0
  125. package/dist/passwordRules.g-CMYrohdd.js +1 -0
  126. package/dist/phone.g-P66U-SK5.js +1 -0
  127. package/dist/recents-BQ0fD7Y0.js +1 -0
  128. package/dist/relativeTime-CdFw-ekO.js +1 -0
  129. package/dist/relativeTime.g-BH90tjJM.js +1 -0
  130. package/dist/rowDrop.g-DQpB10Ey.js +1 -0
  131. package/dist/savedViews.g-CzzEliTR.js +1 -0
  132. package/dist/search-Cj1YQUwK.js +1 -0
  133. package/dist/search.g-B5d1s59A.js +1 -0
  134. package/dist/server.js +1 -1
  135. package/dist/shell.g-C2Ht5xl2.js +1 -0
  136. package/dist/shortcutKeys-DmPiY4T7.js +1 -0
  137. package/dist/shortcutKeys.g-C0TeAfYL.js +1 -0
  138. package/dist/showMore.g-BdQ5MUSd.js +1 -0
  139. package/dist/slider.g-BPNfxZEV.js +1 -0
  140. package/dist/sortable.g-BsTKys5-.js +1 -0
  141. package/dist/tableSelect.g-DKZqXQT_.js +1 -0
  142. package/dist/text/en.json +1278 -0
  143. package/dist/text.js +1 -0
  144. package/dist/textStore-opIEM4lu.js +1 -0
  145. package/dist/themeTransition-CDB0Mx61.js +1 -0
  146. package/dist/timePicker.g-DM61i-ZE.js +1 -0
  147. package/dist/tourAdvance.g-BJqDnqag.js +1 -0
  148. package/dist/tree.g-RId8xZSk.js +1 -0
  149. package/dist/ui-calendar.global.js +1 -1
  150. package/dist/ui-calendar.js +1 -1
  151. package/dist/ui-chart.global.js +2 -2
  152. package/dist/ui-chart.js +2 -2
  153. package/dist/ui-consent-banner.global.js +1 -1
  154. package/dist/ui-elements/carousel.global.js +1 -1
  155. package/dist/ui-elements/code-block.global.js +1 -1
  156. package/dist/ui-elements/command-palette.global.js +2 -2
  157. package/dist/ui-elements/comment-thread.global.js +1 -1
  158. package/dist/ui-elements/consent-banner.global.js +1 -1
  159. package/dist/ui-elements/context-menu.global.js +1 -1
  160. package/dist/ui-elements/date-range.global.js +12 -12
  161. package/dist/ui-elements/drawer.global.js +1 -1
  162. package/dist/ui-elements/dropdown.global.js +1 -1
  163. package/dist/ui-elements/entry-grid.global.js +3 -0
  164. package/dist/ui-elements/glyphs.global.js +1 -1
  165. package/dist/ui-elements/image-crop.global.js +8 -8
  166. package/dist/ui-elements/inline-edit.global.js +1 -1
  167. package/dist/ui-elements/kanban.global.js +1 -1
  168. package/dist/ui-elements/lead-popup.global.js +50 -50
  169. package/dist/ui-elements/lightbox.global.js +1 -1
  170. package/dist/ui-elements/markdown.global.js +1 -1
  171. package/dist/ui-elements/org-tree.global.js +1 -1
  172. package/dist/ui-elements/phone.global.js +9 -9
  173. package/dist/ui-elements/popover.global.js +1 -1
  174. package/dist/ui-elements/saved-views.global.js +1 -1
  175. package/dist/ui-elements/select-chips.global.js +2 -2
  176. package/dist/ui-elements/select-recents.global.js +1 -1
  177. package/dist/ui-elements/select-search.global.js +1 -1
  178. package/dist/ui-elements/slider.global.js +13 -13
  179. package/dist/ui-elements/sortable.global.js +1 -1
  180. package/dist/ui-elements/status-icon.global.js +1 -1
  181. package/dist/ui-elements/timepicker.global.js +4 -4
  182. package/dist/ui-elements/tour.global.js +1 -1
  183. package/dist/ui-elements/tree.global.js +1 -1
  184. package/dist/ui-elements/wizard.global.js +1 -1
  185. package/dist/ui-elements.global.js +21 -21
  186. package/dist/ui-elements.js +1 -1
  187. package/dist/ui-file-viewer.global.js +11 -11
  188. package/dist/ui-file-viewer.js +1 -1
  189. package/dist/ui-lead-popup.global.js +1 -1
  190. package/dist/ui-rich-text.global.js +8 -8
  191. package/dist/ui-rich-text.js +8 -8
  192. package/dist/ui-tour.global.js +1 -1
  193. package/dist/wizard.g-DOZSBUc5.js +1 -0
  194. package/package.json +15 -13
  195. package/types/WuiCarousel.d.ts +0 -8
  196. package/types/WuiChart.d.ts +1 -1
  197. package/types/WuiCommentThread.d.ts +1 -1
  198. package/types/WuiDateRange.d.ts +2 -0
  199. package/types/WuiDrawer.d.ts +1 -1
  200. package/types/WuiDropdown.d.ts +8 -1
  201. package/types/WuiEntryGrid.d.ts +29 -0
  202. package/types/WuiInlineEdit.d.ts +3 -2
  203. package/types/WuiMentionInput.d.ts +0 -10
  204. package/types/WuiPhone.d.ts +2 -0
  205. package/types/WuiPopover.d.ts +1 -0
  206. package/types/WuiSlider.d.ts +3 -0
  207. package/types/WuiTour.d.ts +1 -12
  208. package/types/avatarPicker.d.ts +0 -13
  209. package/types/calendarMath.d.ts +0 -2
  210. package/types/chartAdapter.d.ts +1 -0
  211. package/types/chartSpec.d.ts +0 -4
  212. package/types/commentText.d.ts +0 -35
  213. package/types/dataTable.d.ts +6 -8
  214. package/types/digitGrouping.d.ts +11 -0
  215. package/types/elements/comment-thread.d.ts +2 -2
  216. package/types/elements/data-table.d.ts +1 -1
  217. package/types/elements/entry-grid.d.ts +2 -0
  218. package/types/elements/inline-edit.d.ts +2 -2
  219. package/types/elements/mention-input.d.ts +2 -2
  220. package/types/formatters.d.ts +15 -3
  221. package/types/global/core.d.ts +9 -9
  222. package/types/global/shared.d.ts +10 -0
  223. package/types/globals.d.ts +6 -5
  224. package/types/helpers.d.ts +10 -9
  225. package/types/index.d.ts +2 -3
  226. package/types/inlineEditText.d.ts +2 -25
  227. package/types/isDrawn.d.ts +1 -0
  228. package/types/kanbanModel.d.ts +0 -32
  229. package/types/nativeOverlay.d.ts +2 -0
  230. package/types/notificationDays.d.ts +0 -19
  231. package/types/passwordRules.d.ts +0 -2
  232. package/types/razor-js/modules/fieldChecks.d.ts +1 -0
  233. package/types/razor-js/modules/serverRules.d.ts +9 -0
  234. package/types/razor-js/modules/validation.d.ts +7 -0
  235. package/types/server/drawerDiscard.d.ts +0 -5
  236. package/types/server/index.d.ts +3 -3
  237. package/types/server/remoteModal.d.ts +7 -5
  238. package/types/server/serverActions.d.ts +0 -9
  239. package/types/server/serverTable.d.ts +0 -11
  240. package/types/server/unsavedChanges.d.ts +0 -6
  241. package/types/shortcutKeys.d.ts +3 -3
  242. package/types/tableSelect.d.ts +0 -2
  243. package/types/text/index.d.ts +8 -0
  244. package/types/text/textStore.d.ts +19 -0
  245. package/types/text/web/accountSwitcher.g.d.ts +4 -0
  246. package/types/text/web/alert.g.d.ts +4 -0
  247. package/types/text/web/asyncBlock.g.d.ts +7 -0
  248. package/types/text/web/avatar.g.d.ts +4 -0
  249. package/types/text/web/avatarGroup.g.d.ts +4 -0
  250. package/types/text/web/banner.g.d.ts +4 -0
  251. package/types/text/web/breadcrumbs.g.d.ts +4 -0
  252. package/types/text/web/calendar.g.d.ts +20 -0
  253. package/types/text/web/card.g.d.ts +4 -0
  254. package/types/text/web/carousel.g.d.ts +13 -0
  255. package/types/text/web/catalogue.g.d.ts +266 -0
  256. package/types/text/web/chart.g.d.ts +102 -0
  257. package/types/text/web/chartCard.g.d.ts +13 -0
  258. package/types/text/web/check.g.d.ts +4 -0
  259. package/types/text/web/checkbox.g.d.ts +4 -0
  260. package/types/text/web/chip.g.d.ts +5 -0
  261. package/types/text/web/chipGroup.g.d.ts +4 -0
  262. package/types/text/web/choiceCard.g.d.ts +4 -0
  263. package/types/text/web/choiceChip.g.d.ts +4 -0
  264. package/types/text/web/codeBlock.g.d.ts +6 -0
  265. package/types/text/web/colourField.g.d.ts +7 -0
  266. package/types/text/web/columnMenu.g.d.ts +4 -0
  267. package/types/text/web/commandPalette.g.d.ts +12 -0
  268. package/types/text/web/commentThread.g.d.ts +35 -0
  269. package/types/text/web/compareTable.g.d.ts +7 -0
  270. package/types/text/web/confirmDialog.g.d.ts +10 -0
  271. package/types/text/web/confirmProvider.g.d.ts +4 -0
  272. package/types/text/web/consentBanner.g.d.ts +18 -0
  273. package/types/text/web/contextMenu.g.d.ts +5 -0
  274. package/types/text/web/copyButton.g.d.ts +5 -0
  275. package/types/text/web/customRule.g.d.ts +4 -0
  276. package/types/text/web/dataTable.g.d.ts +31 -0
  277. package/types/text/web/datePicker.g.d.ts +16 -0
  278. package/types/text/web/dateRangePicker.g.d.ts +22 -0
  279. package/types/text/web/drawer.g.d.ts +9 -0
  280. package/types/text/web/dropZone.g.d.ts +8 -0
  281. package/types/text/web/dropdown.g.d.ts +7 -0
  282. package/types/text/web/dueDate.g.d.ts +10 -0
  283. package/types/text/web/entryGrid.g.d.ts +16 -0
  284. package/types/text/web/errorBoundary.g.d.ts +4 -0
  285. package/types/text/web/errorSummary.g.d.ts +5 -0
  286. package/types/text/web/field.g.d.ts +4 -0
  287. package/types/text/web/fileAttachment.g.d.ts +18 -0
  288. package/types/text/web/filePicker.g.d.ts +20 -0
  289. package/types/text/web/fileValidation.g.d.ts +15 -0
  290. package/types/text/web/fileViewer.g.d.ts +55 -0
  291. package/types/text/web/filterBar.g.d.ts +15 -0
  292. package/types/text/web/floatingDock.g.d.ts +4 -0
  293. package/types/text/web/formatters.g.d.ts +49 -0
  294. package/types/text/web/formulaSteps.g.d.ts +9 -0
  295. package/types/text/web/hoverCard.g.d.ts +4 -0
  296. package/types/text/web/httpFailure.g.d.ts +4 -0
  297. package/types/text/web/imageCrop.g.d.ts +18 -0
  298. package/types/text/web/imagePicker.g.d.ts +22 -0
  299. package/types/text/web/index.g.d.ts +132 -0
  300. package/types/text/web/infoTip.g.d.ts +4 -0
  301. package/types/text/web/inlineEdit.g.d.ts +12 -0
  302. package/types/text/web/input.g.d.ts +11 -0
  303. package/types/text/web/inputMask.g.d.ts +12 -0
  304. package/types/text/web/kanban.g.d.ts +33 -0
  305. package/types/text/web/kbd.g.d.ts +6 -0
  306. package/types/text/web/kpiTile.g.d.ts +4 -0
  307. package/types/text/web/labelHelp.g.d.ts +4 -0
  308. package/types/text/web/leadPopup.g.d.ts +23 -0
  309. package/types/text/web/lightbox.g.d.ts +12 -0
  310. package/types/text/web/mentionInput.g.d.ts +11 -0
  311. package/types/text/web/modal.g.d.ts +14 -0
  312. package/types/text/web/modalCardRenderer.g.d.ts +5 -0
  313. package/types/text/web/modalContent.g.d.ts +4 -0
  314. package/types/text/web/modalForm.g.d.ts +5 -0
  315. package/types/text/web/navigationMenu.g.d.ts +4 -0
  316. package/types/text/web/notificationCentre.g.d.ts +24 -0
  317. package/types/text/web/numberInput.g.d.ts +7 -0
  318. package/types/text/web/onboardingChecklist.g.d.ts +10 -0
  319. package/types/text/web/orgTree.g.d.ts +10 -0
  320. package/types/text/web/otpInput.g.d.ts +5 -0
  321. package/types/text/web/overflow.g.d.ts +4 -0
  322. package/types/text/web/pageHeader.g.d.ts +5 -0
  323. package/types/text/web/passwordRules.g.d.ts +11 -0
  324. package/types/text/web/periodPicker.g.d.ts +13 -0
  325. package/types/text/web/person.g.d.ts +4 -0
  326. package/types/text/web/phone.g.d.ts +12 -0
  327. package/types/text/web/phoneNumberInput.g.d.ts +6 -0
  328. package/types/text/web/pricingCard.g.d.ts +4 -0
  329. package/types/text/web/qrCode.g.d.ts +4 -0
  330. package/types/text/web/radio.g.d.ts +4 -0
  331. package/types/text/web/radioGroup.g.d.ts +5 -0
  332. package/types/text/web/rating.g.d.ts +8 -0
  333. package/types/text/web/recordPager.g.d.ts +6 -0
  334. package/types/text/web/relativeTime.g.d.ts +16 -0
  335. package/types/text/web/repeater.g.d.ts +5 -0
  336. package/types/text/web/richText.g.d.ts +25 -0
  337. package/types/text/web/routeError.g.d.ts +12 -0
  338. package/types/text/web/rowActions.g.d.ts +4 -0
  339. package/types/text/web/rowDrop.g.d.ts +5 -0
  340. package/types/text/web/savedViews.g.d.ts +19 -0
  341. package/types/text/web/scoreScale.g.d.ts +4 -0
  342. package/types/text/web/search.g.d.ts +6 -0
  343. package/types/text/web/sectionLeadCapture.g.d.ts +12 -0
  344. package/types/text/web/segmented.g.d.ts +4 -0
  345. package/types/text/web/select.g.d.ts +26 -0
  346. package/types/text/web/shell.g.d.ts +36 -0
  347. package/types/text/web/shortcutKeys.g.d.ts +10 -0
  348. package/types/text/web/showMore.g.d.ts +5 -0
  349. package/types/text/web/skeletonShapes.g.d.ts +4 -0
  350. package/types/text/web/slider.g.d.ts +9 -0
  351. package/types/text/web/sortable.g.d.ts +12 -0
  352. package/types/text/web/sortableList.g.d.ts +4 -0
  353. package/types/text/web/sparkline.g.d.ts +7 -0
  354. package/types/text/web/spinner.g.d.ts +4 -0
  355. package/types/text/web/splash.g.d.ts +4 -0
  356. package/types/text/web/splitButton.g.d.ts +4 -0
  357. package/types/text/web/splitView.g.d.ts +19 -0
  358. package/types/text/web/stepper.g.d.ts +5 -0
  359. package/types/text/web/switch.g.d.ts +4 -0
  360. package/types/text/web/tablePagination.g.d.ts +11 -0
  361. package/types/text/web/tableRows.g.d.ts +4 -0
  362. package/types/text/web/tableSelect.g.d.ts +5 -0
  363. package/types/text/web/tableToolbar.g.d.ts +8 -0
  364. package/types/text/web/tabs.g.d.ts +6 -0
  365. package/types/text/web/textarea.g.d.ts +5 -0
  366. package/types/text/web/themeToggle.g.d.ts +10 -0
  367. package/types/text/web/timePicker.g.d.ts +15 -0
  368. package/types/text/web/timeline.g.d.ts +4 -0
  369. package/types/text/web/toast.g.d.ts +9 -0
  370. package/types/text/web/tour.g.d.ts +12 -0
  371. package/types/text/web/tourAdvance.g.d.ts +4 -0
  372. package/types/text/web/tree.g.d.ts +5 -0
  373. package/types/text/web/unsavedChanges.g.d.ts +6 -0
  374. package/types/text/web/updateBar.g.d.ts +6 -0
  375. package/types/text/web/value.g.d.ts +4 -0
  376. package/types/text/web/whatsNew.g.d.ts +7 -0
  377. package/types/text/web/wizard.g.d.ts +16 -0
  378. package/types/text/web/workspaceSwitcher.g.d.ts +8 -0
  379. package/dist/WuiCarousel-BdhJLo1m.js +0 -1
  380. package/dist/WuiCodeBlock-7O514Hqe.js +0 -1
  381. package/dist/WuiCommandPalette-rVScJ2Hy.js +0 -2
  382. package/dist/WuiCommentThread-5Uz83s1Y.js +0 -1
  383. package/dist/WuiConsentBanner-Bm7tT3_5.js +0 -1
  384. package/dist/WuiContextMenu-_ZeequGf.js +0 -1
  385. package/dist/WuiDataTable-Bb5hxTfn.js +0 -1
  386. package/dist/WuiDatePicker-BF_GVNaj.js +0 -31
  387. package/dist/WuiDateRange-B6xh25qZ.js +0 -25
  388. package/dist/WuiDrawer-BGuq6FAZ.js +0 -1
  389. package/dist/WuiDropdown-DVTtANwz.js +0 -1
  390. package/dist/WuiImageCrop-ChvH8GKb.js +0 -17
  391. package/dist/WuiInlineEdit-DMK1ESdx.js +0 -1
  392. package/dist/WuiLeadPopup-BmZG0Fk_.js +0 -382
  393. package/dist/WuiLightbox-BUD0uefB.js +0 -1
  394. package/dist/WuiMentionInput-Bo9bhe3U.js +0 -1
  395. package/dist/WuiNotificationCenter-DP-Sf4FQ.js +0 -1
  396. package/dist/WuiOrgTree-DzeLFQxy.js +0 -1
  397. package/dist/WuiOverflow-CV5y5zkM.js +0 -1
  398. package/dist/WuiPhone-BC0MQ6bf.js +0 -16
  399. package/dist/WuiPopover-CQJLfgm_.js +0 -1
  400. package/dist/WuiRecordPager-7HVGoFlP.js +0 -1
  401. package/dist/WuiResizable-KvfLtbCw.js +0 -1
  402. package/dist/WuiRollingNumber-sfgNzaP0.js +0 -1
  403. package/dist/WuiSavedViews-CdjavvPC.js +0 -1
  404. package/dist/WuiSelect-EquDxkz1.js +0 -9
  405. package/dist/WuiShortcuts-5PhCS5ri.js +0 -1
  406. package/dist/WuiShowMore-CvdNQXrA.js +0 -1
  407. package/dist/WuiSlider-D33Y3_t9.js +0 -51
  408. package/dist/WuiSortable-CBLMNRuZ.js +0 -1
  409. package/dist/WuiTimePicker-OAP_QRwV.js +0 -9
  410. package/dist/WuiTour-Dxyv9uNz.js +0 -1
  411. package/dist/WuiTree-BPT9EZuw.js +0 -1
  412. package/dist/WuiWizardStep-Cencr-mT.js +0 -1
  413. package/dist/calendarMath-D6UUgYTD.js +0 -1
  414. package/dist/chips-Dcf6_wuZ.js +0 -2
  415. package/dist/commentText-BnX7rA2-.js +0 -1
  416. package/dist/country-x5lqC5Xu.js +0 -1
  417. package/dist/customRule-Chp7YwFb.js +0 -1
  418. package/dist/dataTable-CcH1lBIM.js +0 -1
  419. package/dist/drawerDiscard-BtPeayNT.js +0 -1
  420. package/dist/elements/resizable.js +0 -1
  421. package/dist/elements/rolling-number.js +0 -1
  422. package/dist/fileViewerImage-XsUnEv6Z.js +0 -3
  423. package/dist/fileViewerMedia-DTDM69nT.js +0 -1
  424. package/dist/fileViewerPdf-vlVCKKyK.js +0 -20
  425. package/dist/fileViewerUi-CprJdtCB.js +0 -1
  426. package/dist/formatters-ljfITOZ3.js +0 -1
  427. package/dist/iconGlyphs.g-DPqoOoXy.js +0 -1
  428. package/dist/inlineEditText-_GFrdJ6F.js +0 -1
  429. package/dist/kanban-CDaks135.js +0 -1
  430. package/dist/kanbanModel-BaT75e-b.js +0 -1
  431. package/dist/loader-B7twHKUy.js +0 -1
  432. package/dist/menuKeyNav-COGecOjH.js +0 -1
  433. package/dist/nativeOverlay-BbkCnzFj.js +0 -1
  434. package/dist/notificationDays-BIWczft0.js +0 -1
  435. package/dist/recents-Dcw-b5cB.js +0 -1
  436. package/dist/relativeTime-BahImc8F.js +0 -1
  437. package/dist/search-C6r6xpep.js +0 -1
  438. package/dist/shortcutKeys-COVLox98.js +0 -1
  439. package/dist/themeTransition-Dt7Br1QT.js +0 -1
  440. package/dist/ui-elements/modal.global.js +0 -1
  441. package/dist/ui-elements/resizable.global.js +0 -1
  442. package/dist/zone-BR02ZkHF.js +0 -1
  443. package/types/WuiResizable.d.ts +0 -79
  444. package/types/WuiRollingNumber.d.ts +0 -27
  445. package/types/elements/resizable.d.ts +0 -2
  446. package/types/elements/rolling-number.d.ts +0 -2
@@ -1 +1 @@
1
- (function(){function e(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let i of Object.keys(r)){let a=Object.getOwnPropertyDescriptor(t.prototype,i);if(a&&(a.set||a.get)&&(n.push([r,i,Reflect.get(r,i)]),!Reflect.deleteProperty(r,i)))throw Error(`defineElement: could not clear the early "${i}" property on <${e}>.`)}customElements.define(e,t);for(let[t,r,i]of n)if(!Reflect.set(t,r,i))throw Error(`defineElement: could not restore the "${r}" property on <${e}>.`)}var t=`AppButton`,n=new Set([`primary`,`success`,`warning`,`danger`,`info`,`neutral`]),r={solid:e=>`btn-${e}`,soft:e=>`btn-soft-${e}`,outline:e=>`btn-outline-${e}`,ghost:e=>`btn-ghost-${e}`,link:e=>`btn-link-${e}`,glass:()=>`btn-glass`};function i(e){return Object.hasOwn(r,e)}function a(e=`primary`,t=`solid`,a=`md`){if(!n.has(e))throw RangeError(`buttonClass: unknown tone "${e}"`);if(!i(t))throw RangeError(`buttonClass: unknown variant "${t}"`);let o=r[t](e);return a===`md`?`btn ${o}`:`btn ${o} btn-${a}`}var o={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},s=e=>`var(${e}, ${o[e]})`,c=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${s(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${s(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${s(`--color-surface`)}; border: 1px solid ${s(`--color-border`)}; border-radius: ${s(`--wui-radius-lg`)}; box-shadow: ${s(`--wui-shadow-modal`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${s(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${s(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${s(`--color-primary-text`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${s(`--color-border`)}; border-bottom: 1px solid ${s(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${s(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${s(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${s(`--color-primary`)}; background: ${s(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${s(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${s(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${s(`--color-primary`)}; border-color: ${s(`--color-primary`)}; color: ${s(`--color-on-primary`)}; } .btn-primary:hover { background: ${s(`--color-primary-hover`)}; border-color: ${s(`--color-primary-hover`)}; } .btn-outline-neutral { border-color: ${s(`--color-text-muted`)}; color: ${s(`--color-text-muted`)}; } .btn-outline-neutral:hover { background: ${s(`--color-bg-muted`)}; color: ${s(`--color-text`)}; } .btn-link { font-weight: 400; color: ${s(`--color-primary-text`)}; text-decoration: underline; } .btn-link:hover { color: ${s(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } /* The actions are small buttons, which fall under the 44px touch target on touch screens. This sheet's .btn is inline-block, so it centres the label itself. */ @media (max-width: 575.98px), (pointer: coarse) { .wui-consent-banner-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } `;function l(e,...t){console.warn(e,...t)}var u=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(u);var d=HTMLElement,f=`data-wui-tour-open`,p=`wui-consent-save`,m=`[data-consent-settings]`,h=`tour-open`,g=`--wui-consent-banner-block`,_=`--wui-consent-banner-inline`,v={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},y=[`analytics`,`functional`,`marketing`],b={analytics:{label:v.analyticsLabel,description:`analyticsDescription`},functional:{label:v.functionalLabel,description:`functionalDescription`},marketing:{label:v.marketingLabel,description:`marketingDescription`}};function x(e){return y.some(t=>t===e)}var S=new Set;function C(e){S.has(e)||(S.add(e),l(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${y.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var w=0,T=null;function E(e){T||(T=new CSSStyleSheet,T.replaceSync(c)),e.adoptedStyleSheets=[T]}var D=class extends d{_uid;_preferences;_settings;_onDocumentClick;_tourWatch;_roomObserver;_onWindowResize;_rendered;static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),w+=1,this._uid=`wui-consent-${w}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(m)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get preview(){return this.hasAttribute(`preview`)}set preview(e){this.toggleAttribute(`preview`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||v.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||v.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||v.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||v.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||v.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||v.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...y];let t=e.split(/\s+/).filter(Boolean);for(let e of t)x(e)||C(e);let n=y.filter(e=>t.includes(e));return n.length?n:[...y]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(y.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[f]}),this.preview&&!this.isOpen&&this.open(),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(h,document.documentElement.hasAttribute(f))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,n=this._uid,r=this.policyHref?` <a class="wui-consent-banner-policy" href="${A(this.policyHref)}">${k(this.policyLabel)}</a>`:``,i=this._root();i instanceof ShadowRoot&&E(i),i.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${n}-heading" aria-describedby="${n}-description" hidden> <h2 class="wui-consent-banner-heading" id="${n}-heading">${k(this.heading)}</h2> <p class="wui-consent-banner-description" id="${n}-description">${k(this.description)}${r}</p> <div class="wui-consent-banner-settings" hidden> ${O(n,`essential`,v.essentialLabel,v.essentialDescription,!0)} ${this.categories.map(e=>O(n,e,b[e].label,this[b[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${v.settingsLabel}</button> <button type="button" class="${a(`neutral`,`outline`,`sm`)} wui-consent-banner-reject" data-wui="${t}">${v.rejectLabel}</button> <button type="button" class="${a(`primary`,`solid`,`sm`)} wui-consent-banner-accept" data-wui="${t}">${v.acceptLabel}</button> <button type="button" class="${a(`primary`,`solid`,`sm`)} wui-consent-banner-save" hidden data-wui="${t}">${v.saveLabel}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._requirePanel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){if(this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._requirePanel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t){let t=e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`);t instanceof HTMLElement&&t.focus()}}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&!this.preview&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(g),document.documentElement.style.removeProperty(_)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(g,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(_,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){let e=this._root().querySelector(`.wui-consent-banner-panel`);return e instanceof HTMLElement?e:null}_requirePanel(){let e=this._panel();if(!e)throw Error(`consent banner panel is missing`);return e}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(p,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return{analytics:e&&t.includes(`analytics`),functional:e&&t.includes(`functional`),marketing:e&&t.includes(`marketing`)}}_switchValues(){let e={analytics:!1,functional:!1,marketing:!1};for(let t of y){let n=this._root().querySelector(`input[data-category="${t}"]`);e[t]=n instanceof HTMLInputElement&&n.checked}return e}_applyPreferences(){for(let e of y){let t=this._root().querySelector(`input[data-category="${e}"]`);t instanceof HTMLInputElement&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!(n instanceof HTMLElement))return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r instanceof HTMLElement&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r instanceof HTMLElement&&(r.hidden=e)}}};function O(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${k(n)}</label> </div> <p class="wui-consent-banner-category-description">${k(r)}</p> </div>`}var k=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),A=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);e(`wui-consent-banner`,D)})();
1
+ (function(){function e(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let i of Object.keys(r)){let a=Object.getOwnPropertyDescriptor(t.prototype,i);if(a&&(a.set||a.get)&&(n.push([r,i,Reflect.get(r,i)]),!Reflect.deleteProperty(r,i)))throw Error(`defineElement: could not clear the early "${i}" property on <${e}>.`)}customElements.define(e,t);for(let[t,r,i]of n)if(!Reflect.set(t,r,i))throw Error(`defineElement: could not restore the "${r}" property on <${e}>.`)}var t=`AppButton`,n=new Set([`primary`,`success`,`warning`,`danger`,`info`,`neutral`]),r={solid:e=>`btn-${e}`,soft:e=>`btn-soft-${e}`,outline:e=>`btn-outline-${e}`,ghost:e=>`btn-ghost-${e}`,link:e=>`btn-link-${e}`,glass:()=>`btn-glass`};function i(e){return Object.hasOwn(r,e)}function a(e=`primary`,t=`solid`,a=`md`){if(!n.has(e))throw RangeError(`buttonClass: unknown tone "${e}"`);if(!i(t))throw RangeError(`buttonClass: unknown variant "${t}"`);let o=r[t](e);return a===`md`?`btn ${o}`:`btn ${o} btn-${a}`}var o={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},s=e=>`var(${e}, ${o[e]})`,c=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${s(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${s(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${s(`--color-surface`)}; border: 1px solid ${s(`--color-border`)}; border-radius: ${s(`--wui-radius-lg`)}; box-shadow: ${s(`--wui-shadow-modal`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${s(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${s(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${s(`--color-primary-text`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${s(`--color-border`)}; border-bottom: 1px solid ${s(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${s(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${s(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${s(`--color-primary`)}; background: ${s(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${s(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${s(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${s(`--color-primary`)}; border-color: ${s(`--color-primary`)}; color: ${s(`--color-on-primary`)}; } .btn-primary:hover { background: ${s(`--color-primary-hover`)}; border-color: ${s(`--color-primary-hover`)}; } .btn-outline-neutral { border-color: ${s(`--color-text-muted`)}; color: ${s(`--color-text-muted`)}; } .btn-outline-neutral:hover { background: ${s(`--color-bg-muted`)}; color: ${s(`--color-text`)}; } .btn-link { font-weight: 400; color: ${s(`--color-primary-text`)}; text-decoration: underline; } .btn-link:hover { color: ${s(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } /* The actions are small buttons, which fall under the 44px touch target on touch screens. This sheet's .btn is inline-block, so it centres the label itself. */ @media (max-width: 575.98px), (pointer: coarse) { .wui-consent-banner-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } `;function l(e,...t){console.warn(e,...t)}var u=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(u);var d=HTMLElement,f=/\{([A-Za-z0-9_]+)\}/g,p=new Map,m=0,h=new Map;function g(e,t){let n=p.get(e);if(n===void 0)return t;let r=h.get(e);if(r!==void 0&&r.version===m&&r.english===t&&v(r.merged,t))return r.merged;let i=_(e,n,t);return h.set(e,{version:m,english:t,merged:i}),i}function _(e,t,n){let r={};for(let[i,a]of Object.entries(t)){let t=Object.hasOwn(n,i)?n[i]:void 0;if(t===void 0)throw RangeError(`Text ${e}.${i} is not a key of the English text. Allowed keys: ${Object.keys(n).join(`, `)}.`);let o=y(t);for(let t of y(a))if(!o.includes(t))throw RangeError(`Text ${e}.${i} uses {${t}}, which the English text does not have. Allowed placeholders: ${o.length===0?`none`:o.map(e=>`{${e}}`).join(`, `)}.`);r[i]=a}return Object.assign({},n,r)}function v(e,t){let n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(t=>Object.hasOwn(e,t))}function y(e){return Array.from(e.matchAll(f),e=>e[1]??``)}var b={acceptLabel:`Accept all`,analyticsDescription:`Help us understand how visitors use the site.`,analyticsLabel:`Analytics cookies`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,essentialDescription:`Required for the site to work and stay secure. Always on.`,essentialLabel:`Essential cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,functionalLabel:`Functional cookies`,heading:`Cookies on this site`,marketingDescription:`Measure how well our campaigns work.`,marketingLabel:`Marketing cookies`,policyLabel:`Cookie policy`,rejectLabel:`Reject all`,saveLabel:`Save preferences`,settingsLabel:`Cookie settings`},x=`data-wui-tour-open`,S=`wui-consent-save`,C=`[data-consent-settings]`,w=`tour-open`,T=`--wui-consent-banner-block`,E=`--wui-consent-banner-inline`,D=()=>g(`consentBanner`,b),O=[`analytics`,`functional`,`marketing`],k={analytics:{label:`analyticsLabel`,description:`analyticsDescription`},functional:{label:`functionalLabel`,description:`functionalDescription`},marketing:{label:`marketingLabel`,description:`marketingDescription`}};function A(e){return O.some(t=>t===e)}var j=new Set;function M(e){j.has(e)||(j.add(e),l(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${O.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var N=0,P=null;function F(e){P||(P=new CSSStyleSheet,P.replaceSync(c)),e.adoptedStyleSheets=[P]}var I=class extends d{_uid;_preferences;_settings;_onDocumentClick;_tourWatch;_roomObserver;_onWindowResize;_rendered;static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),N+=1,this._uid=`wui-consent-${N}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(C)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get preview(){return this.hasAttribute(`preview`)}set preview(e){this.toggleAttribute(`preview`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||D().heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||D().description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||D().policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||D().analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||D().functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||D().marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...O];let t=e.split(/\s+/).filter(Boolean);for(let e of t)A(e)||M(e);let n=O.filter(e=>t.includes(e));return n.length?n:[...O]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(O.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[x]}),this.preview&&!this.isOpen&&this.open(),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(w,document.documentElement.hasAttribute(x))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,n=this._uid,r=this.policyHref?` <a class="wui-consent-banner-policy" href="${z(this.policyHref)}">${R(this.policyLabel)}</a>`:``,i=this._root();i instanceof ShadowRoot&&F(i),i.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${n}-heading" aria-describedby="${n}-description" hidden> <h2 class="wui-consent-banner-heading" id="${n}-heading">${R(this.heading)}</h2> <p class="wui-consent-banner-description" id="${n}-description">${R(this.description)}${r}</p> <div class="wui-consent-banner-settings" hidden> ${L(n,`essential`,D().essentialLabel,D().essentialDescription,!0)} ${this.categories.map(e=>L(n,e,D()[k[e].label],this[k[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${R(D().settingsLabel)}</button> <button type="button" class="${a(`neutral`,`outline`,`sm`)} wui-consent-banner-reject" data-wui="${t}">${R(D().rejectLabel)}</button> <button type="button" class="${a(`primary`,`solid`,`sm`)} wui-consent-banner-accept" data-wui="${t}">${R(D().acceptLabel)}</button> <button type="button" class="${a(`primary`,`solid`,`sm`)} wui-consent-banner-save" hidden data-wui="${t}">${R(D().saveLabel)}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._requirePanel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){if(this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._requirePanel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t){let t=e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`);t instanceof HTMLElement&&t.focus()}}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&!this.preview&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(T),document.documentElement.style.removeProperty(E)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(T,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(E,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){let e=this._root().querySelector(`.wui-consent-banner-panel`);return e instanceof HTMLElement?e:null}_requirePanel(){let e=this._panel();if(!e)throw Error(`consent banner panel is missing`);return e}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return{analytics:e&&t.includes(`analytics`),functional:e&&t.includes(`functional`),marketing:e&&t.includes(`marketing`)}}_switchValues(){let e={analytics:!1,functional:!1,marketing:!1};for(let t of O){let n=this._root().querySelector(`input[data-category="${t}"]`);e[t]=n instanceof HTMLInputElement&&n.checked}return e}_applyPreferences(){for(let e of O){let t=this._root().querySelector(`input[data-category="${e}"]`);t instanceof HTMLInputElement&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!(n instanceof HTMLElement))return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r instanceof HTMLElement&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r instanceof HTMLElement&&(r.hidden=e)}}};function L(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${R(n)}</label> </div> <p class="wui-consent-banner-category-description">${R(r)}</p> </div>`}var R=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),z=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);e(`wui-consent-banner`,I)})();
@@ -1 +1 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.164.0`)throw Error(`[webority-ui] carousel expects ui-elements 0.164.0 but the page loaded `+r+`.`);var i=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),a=120,o=class extends n.ElementBase{_page;_pages;_perView;_paused;_hover;_focus;_timer;_settleTimer;_status;_ready;_motion;_mutations;_resizer;_doc;_track;_onClick;_onKeyDown;_onScroll;_onEnter;_onLeave;_onFocusIn;_onFocusOut;_onVisibility;_onMotion;_tick;static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._track=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{this._settleTimer!==null&&clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),a)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){let e=this.querySelector(`.wui-carousel-track`);if(this._track=e instanceof HTMLElement?e:null,!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let t=this.getAttribute(`data-wui-style`);if(t){for(let e of t.split(`;`)){let t=e.indexOf(`:`);t>0&&this.style.setProperty(e.slice(0,t).trim(),e.slice(t+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,this._timer!==null&&clearTimeout(this._timer),this._settleTimer!==null&&clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return Math.max(e||0,0)}_slides(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=(e.target instanceof Element?e.target:null)?.closest(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`),n=t instanceof HTMLElement?t:null;if(!n||!this.contains(n))return;let r=this._track;if(!r)throw Error(`WuiCarousel used before it was connected`);r.contains(n)||(n.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):n.getAttribute(`aria-disabled`)===`true`?e.preventDefault():n.classList.contains(`wui-carousel-prev`)?this.prev():n.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(n.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=``;if(typeof window<`u`){let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);e=window.getComputedStyle(t).getPropertyValue(`--wui-carousel-view`)}return Math.max(Number.parseInt(e,10)||0,1)}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((t,n)=>{let r=i.slide(n+1,e.length);t.getAttribute(`aria-label`)!==r&&t.setAttribute(`aria-label`,r)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let t=Math.max(1,Math.ceil(e/this._perView)),n=this.querySelector(`.wui-carousel-dots`);if(n&&n.children.length!==t){let e=this.getAttribute(`dot-label`)||i.dot;n.replaceChildren(...Array.from({length:t},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=t,this._page=Math.min(this._page,t-1),this.toggleAttribute(`data-single`,t<=1),this._render(!1),this._sync()}_settle(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);let t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);let n=this._slides()[this._start(this._page)];if(n){let e=this._motion?.matches?`auto`:`smooth`;typeof t.scrollTo==`function`?t.scrollTo({left:n.offsetLeft,behavior:e}):t.scrollLeft=n.offsetLeft}this._render(!0),this._sync()}_render(e){let t=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))e instanceof HTMLElement&&(Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`));this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!t&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!t&&this._page===this._pages-1));let n=this._slides().length,r=this._start(this._page)+1,a=Math.min(n,r+this._perView-1),o=i.status(r,a,n);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){this._timer!==null&&clearTimeout(this._timer),this._timer=null;let e=this._interval(),t=this.querySelector(`.wui-carousel-pause`);if(t instanceof HTMLElement){t.hidden=e===0||this._pages<=1||!!this._motion?.matches;let n=this._paused?this.getAttribute(`play-label`)||i.play:this.getAttribute(`pause-label`)||i.pause,r=t.querySelector(`.wui-carousel-pause-text`);r&&r.textContent!==n&&(r.textContent=n),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};(0,t.defineElement)(`wui-carousel`,o),e.WuiCarousel=o})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.167.0`)throw Error(`[webority-ui] carousel expects ui-elements 0.167.0 but the page loaded `+i+`.`);var a={carouselLabel:`carousel`,dotLabel:`Go to slide`,nextLabel:`Next slide`,pauseLabel:`Pause`,playLabel:`Play`,previousLabel:`Previous slide`,slideLabel:`slide`,slideText:`{n} of {total}`,statusTextOne:`Slide {first} of {total}`,statusTextOther:`Slides {first} to {last} of {total}`},o=()=>(0,r.readText)(`carousel`,a),s=120,c=class extends n.ElementBase{_page;_pages;_perView;_paused;_hover;_focus;_timer;_settleTimer;_status;_ready;_motion;_mutations;_resizer;_doc;_track;_onClick;_onKeyDown;_onScroll;_onEnter;_onLeave;_onFocusIn;_onFocusOut;_onVisibility;_onMotion;_tick;static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._track=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{this._settleTimer!==null&&clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),s)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){let e=this.querySelector(`.wui-carousel-track`);if(this._track=e instanceof HTMLElement?e:null,!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let t=this.getAttribute(`data-wui-style`);if(t){for(let e of t.split(`;`)){let t=e.indexOf(`:`);t>0&&this.style.setProperty(e.slice(0,t).trim(),e.slice(t+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,this._timer!==null&&clearTimeout(this._timer),this._settleTimer!==null&&clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return Math.max(e||0,0)}_slides(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=(e.target instanceof Element?e.target:null)?.closest(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`),n=t instanceof HTMLElement?t:null;if(!n||!this.contains(n))return;let r=this._track;if(!r)throw Error(`WuiCarousel used before it was connected`);r.contains(n)||(n.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):n.getAttribute(`aria-disabled`)===`true`?e.preventDefault():n.classList.contains(`wui-carousel-prev`)?this.prev():n.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(n.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=``;if(typeof window<`u`){let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);e=window.getComputedStyle(t).getPropertyValue(`--wui-carousel-view`)}return Math.max(Number.parseInt(e,10)||0,1)}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((t,n)=>{let i=(0,r.fillText)(o().slideText,{n:n+1,total:e.length});t.getAttribute(`aria-label`)!==i&&t.setAttribute(`aria-label`,i)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let t=Math.max(1,Math.ceil(e/this._perView)),n=this.querySelector(`.wui-carousel-dots`);if(n&&n.children.length!==t){let e=this.getAttribute(`dot-label`)||o().dotLabel;n.replaceChildren(...Array.from({length:t},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=t,this._page=Math.min(this._page,t-1),this.toggleAttribute(`data-single`,t<=1),this._render(!1),this._sync()}_settle(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);let t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);let n=this._slides()[this._start(this._page)];if(n){let e=this._motion?.matches?`auto`:`smooth`;typeof t.scrollTo==`function`?t.scrollTo({left:n.offsetLeft,behavior:e}):t.scrollLeft=n.offsetLeft}this._render(!0),this._sync()}_render(e){let t=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))e instanceof HTMLElement&&(Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`));this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!t&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!t&&this._page===this._pages-1));let n=this._slides().length,i=this._start(this._page)+1,a=Math.min(n,i+this._perView-1),s=i===a?(0,r.fillText)(o().statusTextOne,{first:i,total:n}):(0,r.fillText)(o().statusTextOther,{first:i,last:a,total:n});if(s===this._status||(this._status=s,!e))return;let c=this.querySelector(`[data-wui-status]`);c&&!this._playing()&&(c.textContent=s),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){this._timer!==null&&clearTimeout(this._timer),this._timer=null;let e=this._interval(),t=this.querySelector(`.wui-carousel-pause`);if(t instanceof HTMLElement){t.hidden=e===0||this._pages<=1||!!this._motion?.matches;let n=this._paused?this.getAttribute(`play-label`)||o().playLabel:this.getAttribute(`pause-label`)||o().pauseLabel,r=t.querySelector(`.wui-carousel-pause-text`);r&&r.textContent!==n&&(r.textContent=n),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};(0,t.defineElement)(`wui-carousel`,c),e.WuiCarousel=c})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.textStore);
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.164.0`)throw Error(`[webority-ui] code-block expects ui-elements 0.164.0 but the page loaded `+o+`.`);Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`]);var s=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,razor:`Razor`,css:`CSS`}),c=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),l=`(?![\\s\\S])`,u=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${l})`).source,d=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,c([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],f=[[`comment`,RegExp(`//[^\\n]*|${u}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,c(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,c([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],p=[[`comment`,RegExp(`//[^\\n]*|${u}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,c(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,c([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],m=[[`comment`,RegExp(`--[^\\n]*|${u}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,c(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,c([`true`,`false`])],[`type`,c([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],h=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,c([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,c(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],g=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],_=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${l})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],v={json:d,js:f,cs:p,sql:m,bash:h,http:g,css:[[`comment`,new RegExp(u)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:_,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},y=e=>Object.hasOwn(v,e),b=new Map;function x(e){let t=b.get(e);if(!t){let n=v[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},b.set(e,t)}return t}function S(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function C(e,t,n=[]){let{re:r,types:i}=x(e),a=0;for(let o of t.matchAll(r)){let r=o[0];if(!r)continue;S(n,`plain`,t.slice(a,o.index));let s=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[s]===`tag`?C(`htmlTag`,r,n):S(n,i[s]??`plain`,r),a=o.index+r.length}return S(n,`plain`,t.slice(a)),n}function w(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return C(`http`,e);let n=t[0]??``,r=C(`http`,e.slice(0,t.index+n.length)),i=e.slice(t.index+n.length),a=i.trimStart()[0];return a===`{`||a===`[`?C(`json`,i,r):a===`<`?C(`html`,i,r):(S(r,`plain`,i),r)}function T(e,t){let n=String(e??``);if(!n||n.length>1e5)return n?[[`plain`,n]]:[];if(t===`http`)return w(n);let r=t===`razor`?`html`:t;return!y(r)||r===`htmlTag`?[[`plain`,n]]:C(r,n)}function E(e,t){let n=[],r=[n];for(let[i,a]of T(e,t))a.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&(n=[],r.push(n)),e&&n.push([i,e])});return r.length>1&&n.length===0&&r.pop(),r}function D(e){return Object.hasOwn(s,e)}var O=class extends i.ElementBase{_title;_view;_codeEl;_copyIcon;_copyText;_chrome=null;_copied=!1;_observer=null;_timer=0;_cancelFrame=null;constructor(){super();let e=this.ownerDocument;this._title=e.createElement(`span`),this._title.className=`wui-code-title`,this._view=e.createElement(`div`),this._codeEl=e.createElement(`code`),this._copyIcon=e.createElement(`span`),this._copyIcon.className=`wui-code-copy-icon`,this._copyText=e.createElement(`span`)}static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}connectedCallback(){this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._schedule()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._cancelPending()}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_code(){return(this._source()?.textContent??``).replace(/\r?\n$/,``)}_schedule(){if(this._cancelFrame)return;let e=()=>{this._cancelFrame=null,this._render()};if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(e);this._cancelFrame=()=>cancelAnimationFrame(t)}else{let t=!0;queueMicrotask(()=>{t&&e()}),this._cancelFrame=()=>{t=!1}}}_cancelPending(){this._cancelFrame?.(),this._cancelFrame=null}_render(){if(!this._source())return;this._cancelPending();let e=this.ownerDocument;this._chrome||this._build(e);let t=this.getAttribute(`language`),n=t!==null&&D(t)?t:`text`,r=this.getAttribute(`label`)||``,i=E(this._code(),n);this._title.textContent=r||s[n],this._view.setAttribute(`aria-label`,r||`Code`),this._view.style.setProperty(`--wui-code-digits`,String(String(i.length).length)),this._codeEl.replaceChildren(...i.map(t=>k(e,t))),this._copied||(this._copyText.textContent=this._copyLabel()),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_build(e){let t=e.createElement(`div`);t.className=`wui-code-chrome`,t.append(this._bar(e));let n=this._view;n.className=`wui-code-view`,n.setAttribute(`role`,`region`),n.tabIndex=0;let r=e.createElement(`pre`);r.className=`wui-code-pre`,r.append(this._codeEl),n.append(r),t.append(n),this._chrome=t,this.append(t)}_bar(e){let t=e.createElement(`div`);t.className=`wui-code-bar`;let i=e.createElement(`button`);return i.type=`button`,i.className=`${(0,n.buttonClass)(`primary`,`ghost`,`sm`)} wui-code-copy`,i.dataset.wui=n.APP_BUTTON_MARKER,i.setAttribute(`aria-live`,`polite`),this._setCopied(!1),i.append(this._copyIcon,this._copyText),i.addEventListener(`click`,async()=>{await(0,r.copyTextToClipboard)(this._code())&&(this._setCopied(!0),clearTimeout(this._timer),this._timer=window.setTimeout(()=>this._setCopied(!1),r.COPY_FEEDBACK_MS))}),t.append(this._title,i),t}_setCopied(e){this._copied=e,this._copyIcon.innerHTML=(0,a.glyphSvg)(e?`check`:`files`,{size:14}),this._copyText.textContent=this._copyLabel()}_copyLabel(){return this._copied?this.getAttribute(`copied-label`)||`Copied`:this.getAttribute(`copy-label`)||`Copy`}};function k(e,t){let n=e.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of t){if(r===`plain`){n.append(i);continue}let t=e.createElement(`span`);t.className=`wui-code-t-${r}`,t.textContent=i,n.append(t)}return n}(0,t.defineElement)(`wui-code-block`,O),e.WuiCodeBlock=O})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.copyText,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs);
1
+ (function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=globalThis.WeborityUiElementsInternal?.version;if(s!==`0.167.0`)throw Error(`[webority-ui] code-block expects ui-elements 0.167.0 but the page loaded `+s+`.`);Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`]);var c=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,razor:`Razor`,css:`CSS`}),l=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),u=`(?![\\s\\S])`,d=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${u})`).source,f=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,l([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],p=[[`comment`,RegExp(`//[^\\n]*|${d}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,l(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,l([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],m=[[`comment`,RegExp(`//[^\\n]*|${d}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,l(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,l([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],h=[[`comment`,RegExp(`--[^\\n]*|${d}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,l(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,l([`true`,`false`])],[`type`,l([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],g=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,l([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,l(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],_=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],v=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${u})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],y={json:f,js:p,cs:m,sql:h,bash:g,http:_,css:[[`comment`,new RegExp(d)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:v,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},b=e=>Object.hasOwn(y,e),x=new Map;function S(e){let t=x.get(e);if(!t){let n=y[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},x.set(e,t)}return t}function C(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function w(e,t,n=[]){let{re:r,types:i}=S(e),a=0;for(let o of t.matchAll(r)){let r=o[0];if(!r)continue;C(n,`plain`,t.slice(a,o.index));let s=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[s]===`tag`?w(`htmlTag`,r,n):C(n,i[s]??`plain`,r),a=o.index+r.length}return C(n,`plain`,t.slice(a)),n}function T(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return w(`http`,e);let n=t[0]??``,r=w(`http`,e.slice(0,t.index+n.length)),i=e.slice(t.index+n.length),a=i.trimStart()[0];return a===`{`||a===`[`?w(`json`,i,r):a===`<`?w(`html`,i,r):(C(r,`plain`,i),r)}function E(e,t){let n=String(e??``);if(!n||n.length>1e5)return n?[[`plain`,n]]:[];if(t===`http`)return T(n);let r=t===`razor`?`html`:t;return!b(r)||r===`htmlTag`?[[`plain`,n]]:w(r,n)}function D(e,t){let n=[],r=[n];for(let[i,a]of E(e,t))a.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&(n=[],r.push(n)),e&&n.push([i,e])});return r.length>1&&n.length===0&&r.pop(),r}var O={copiedLabel:`Copied`,copyLabel:`Copy`,label:`Code`},k=()=>(0,o.readText)(`codeBlock`,O);function A(e){return Object.hasOwn(c,e)}var j=class extends i.ElementBase{_title;_view;_codeEl;_copyIcon;_copyText;_chrome=null;_copied=!1;_observer=null;_timer=0;_cancelFrame=null;constructor(){super();let e=this.ownerDocument;this._title=e.createElement(`span`),this._title.className=`wui-code-title`,this._view=e.createElement(`div`),this._codeEl=e.createElement(`code`),this._copyIcon=e.createElement(`span`),this._copyIcon.className=`wui-code-copy-icon`,this._copyText=e.createElement(`span`)}static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}connectedCallback(){this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._schedule()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._cancelPending()}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_code(){return(this._source()?.textContent??``).replace(/\r?\n$/,``)}_schedule(){if(this._cancelFrame)return;let e=()=>{this._cancelFrame=null,this._render()};if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(e);this._cancelFrame=()=>cancelAnimationFrame(t)}else{let t=!0;queueMicrotask(()=>{t&&e()}),this._cancelFrame=()=>{t=!1}}}_cancelPending(){this._cancelFrame?.(),this._cancelFrame=null}_render(){if(!this._source())return;this._cancelPending();let e=this.ownerDocument;this._chrome||this._build(e);let t=this.getAttribute(`language`),n=t!==null&&A(t)?t:`text`,r=this.getAttribute(`label`)||``,i=D(this._code(),n);this._title.textContent=r||c[n],this._view.setAttribute(`aria-label`,r||k().label),this._view.style.setProperty(`--wui-code-digits`,String(String(i.length).length)),this._codeEl.replaceChildren(...i.map(t=>M(e,t))),this._copied||(this._copyText.textContent=this._copyLabel()),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_build(e){let t=e.createElement(`div`);t.className=`wui-code-chrome`,t.append(this._bar(e));let n=this._view;n.className=`wui-code-view`,n.setAttribute(`role`,`region`),n.tabIndex=0;let r=e.createElement(`pre`);r.className=`wui-code-pre`,r.append(this._codeEl),n.append(r),t.append(n),this._chrome=t,this.append(t)}_bar(e){let t=e.createElement(`div`);t.className=`wui-code-bar`;let i=e.createElement(`button`);return i.type=`button`,i.className=`${(0,n.buttonClass)(`primary`,`ghost`,`sm`)} wui-code-copy`,i.dataset.wui=n.APP_BUTTON_MARKER,i.setAttribute(`aria-live`,`polite`),this._setCopied(!1),i.append(this._copyIcon,this._copyText),i.addEventListener(`click`,async()=>{await(0,r.copyTextToClipboard)(this._code())&&(this._setCopied(!0),clearTimeout(this._timer),this._timer=window.setTimeout(()=>this._setCopied(!1),r.COPY_FEEDBACK_MS))}),t.append(this._title,i),t}_setCopied(e){this._copied=e,this._copyIcon.innerHTML=(0,a.glyphSvg)(e?`check`:`files`,{size:14}),this._copyText.textContent=this._copyLabel()}_copyLabel(){return this._copied?this.getAttribute(`copied-label`)||k().copiedLabel:this.getAttribute(`copy-label`)||k().copyLabel}};function M(e,t){let n=e.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of t){if(r===`plain`){n.append(i);continue}let t=e.createElement(`span`);t.className=`wui-code-t-${r}`,t.textContent=i,n.append(t)}return n}(0,t.defineElement)(`wui-code-block`,j),e.WuiCodeBlock=j})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.copyText,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.textStore);
@@ -1,2 +1,2 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.164.0`)throw Error(`[webority-ui] command-palette expects ui-elements 0.164.0 but the page loaded `+a+`.`);var o=`[role="option"]`,s=`No results`,c=`All`,l=`Recent`,u=5,d=20,f=`.wui-cmd-back, [data-depth]`,p=`[data-group-tab]`,m=0;function h(e,t){if(!(e instanceof Element))return null;let n=e.closest(t);return n instanceof HTMLElement?n:null}var g=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},_=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),v=class extends n.ElementBase{_path;_group;_crumbSig;_modal;_recentsId;_onModalClosed;_activeId;_lastQuery;_lastIds;_userChose;_onKeyDown;_onClick;_onMouseDown;_onMouseMove;_onInput;static get observedAttributes(){return[`filter`,`group-filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._group=null,this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++m}`,this._onModalClosed=()=>{this._setKeyboard(!1),this._reset(),this.hasAttribute(`path`)&&this._restart()},this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=h(e.target,f);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=h(e.target,p);if(n&&this.contains(n)){this._pickGroup(n.dataset.groupTab||null);return}let r=this._optionFrom(e.target);r&&this._select(r)},this._onMouseDown=e=>{let t=h(e.target,f),n=h(e.target,p);(t&&this.contains(t)||n&&this.contains(n)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._setKeyboard(!1),this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{this.hasAttribute(`filter`)&&e.target===this._input()&&(this._group=null,this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`wui-modal`),this._modal?.addEventListener(`wui-modal-closed`,this._onModalClosed),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??s}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs(),this._syncTabs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
2
- `),a=i!==this._lastIds;this._lastIds=i;let o=!n&&(this._userChose||!a)?r.find(e=>e.id===this._activeId):null;o||(this._userChose=!1,this._setKeyboard(!1)),this._setActive(o??r[0]??null,n)}_input(){let e=this.querySelector(`[role="combobox"]`);return e instanceof HTMLInputElement?e:null}_optionFrom(e,t=!1){let n=h(e,o);return n&&this.contains(n)&&!this._isHidden(n)&&(t||!this._isDisabled(n))?n:null}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_isHidden(e){return e.hidden!==!1||(h(e,`[role="group"]`)?.hidden??!1)!==!1}_selectableOptions(){return _(this,o,HTMLElement).filter(e=>!this._isHidden(e)&&!this._isDisabled(e))}_setActive(e,t){this._activeId=e?e.id:null;for(let t of _(this,o,HTMLElement))t.setAttribute(`aria-selected`,t===e?`true`:`false`);let n=this._input();n&&(e?n.setAttribute(`aria-activedescendant`,e.id):n.removeAttribute(`aria-activedescendant`)),e&&t&&e.scrollIntoView({block:`nearest`})}_move(e){let t=this._selectableOptions();if(!t.length)return;let n=t.findIndex(e=>e.id===this._activeId),r=n<0?e>0?0:t.length-1:(n+e+t.length)%t.length;this._userChose=!0,this._setKeyboard(!0),this._setActive(t[r]??null,!0)}_setKeyboard(e){this.toggleAttribute(`data-keyboard`,e)}_handleKeyDown(e){let t=this._input();if(t&&e.target===t){if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._move(e.key===`ArrowDown`?1:-1);else if(e.key===`Tab`&&this._groupActive()&&this._tabs().length)e.preventDefault(),this._cycleGroup(e.shiftKey?-1:1);else if(e.key===`Backspace`&&!e.isComposing&&this._path.length&&!t.value)e.preventDefault(),this._goTo(this._path.slice(0,-1));else if(e.key===`Enter`&&!e.isComposing){let t=this._selectableOptions().find(e=>e.id===this._activeId);if(!t)return;e.preventDefault(),this._select(t)}}}_select(e){this._remember(e),this.dispatchEvent(new CustomEvent(`wui-command-palette:select`,{bubbles:!0,cancelable:!0,detail:{key:e.dataset.key??null,groupKey:e.dataset.groupKey??null,id:e.id}}))&&(e.dataset.opens?this._open(e.dataset.opens):e.dataset.href&&this._navigate(e.dataset.href))}_open(e){let t=_(this,`.wui-cmd-page`,HTMLElement).find(t=>t.dataset.page===e);this._goTo([...this._path,{key:e,label:t?.dataset.label??e}])}_goTo(e){this._input()?.focus(),this.dispatchEvent(new CustomEvent(`wui-command-palette:navigate`,{bubbles:!0,cancelable:!0,detail:{path:e}}))&&(this._path=e,this._restart())}_tabs(){return _(this,p,HTMLElement)}_groupActive(){return this.hasAttribute(`group-filter`)&&this._path.length===0}_pickGroup(e){this._group=e,this._applyFilter(),this.refresh()}_cycleGroup(e){let t=this._tabs().map(e=>e.dataset.groupTab||null),n=Math.max(0,t.indexOf(this._group));this._pickGroup(t[(n+e+t.length)%t.length]??null)}_syncTabs(){if(!this.hasAttribute(`group-filter`))return;let e=g(this,`.wui-cmd-tabs`,HTMLElement);e&&(e.hidden=!this._groupActive());for(let e of this._tabs())e.setAttribute(`aria-selected`,String((e.dataset.groupTab||null)===this._group))}_restart(){this._group=null;let e=this._input();e&&(e.value=``),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}_reset(){this.hasAttribute(`path`)||(this._path=[],this._restart())}_readPath(){let e=this.getAttribute(`path`);if(e==null)return;let t=JSON.parse(e);this._path=Array.isArray(t)?t.filter(e=>e&&typeof e.key==`string`&&typeof e.label==`string`):[]}_renderCrumbs(){let e=g(this,`.wui-cmd-crumbs`,HTMLElement);if(!e)return;let t=this.getAttribute(`root-label`)??c,n=JSON.stringify([t,this._path]);if(e.hidden=this._path.length===0,n===this._crumbSig)return;this._crumbSig=n;let r=g(e,`.wui-cmd-trail`,HTMLElement);if(!r)return;let i=[t,...this._path.map(e=>e.label)];r.replaceChildren(...i.map((e,t)=>{let n=document.createElement(`li`),r=t===i.length-1,a=document.createElement(r?`span`:`button`);if(a.className=`wui-cmd-crumb`,a.textContent=e,r)a.setAttribute(`aria-current`,`page`);else{if(!(a instanceof HTMLButtonElement))throw Error(`breadcrumb button missing`);a.type=`button`,a.dataset.depth=String(t)}return n.append(a),n}))}_recentsHost(){return g(this,`.wui-cmd-recents`,HTMLElement)}_realOptions(){let e=this._recentsHost();return _(this,o,HTMLElement).filter(t=>!e?.contains(t))}_recentEntries(){let e=this.getAttribute(`recents-key`);if(!e)return[];let t;try{t=JSON.parse(globalThis.localStorage?.getItem(e)??`[]`)}catch{return[]}return Array.isArray(t)?t.filter(e=>e&&typeof e.g==`string`&&typeof e.k==`string`):[]}_recentsLimit(){let e=Number.parseInt(this.getAttribute(`recents-limit`)??``,10);return Number.isFinite(e)&&e>0?Math.min(e,d):u}_remember(e){let t=this.getAttribute(`recents-key`),{groupKey:n,key:r,opens:i}=e.dataset;if(!t||i||n==null||r==null)return;let a=[{g:n,k:r},...this._recentEntries().filter(e=>e.g!==n||e.k!==r)];try{globalThis.localStorage?.setItem(t,JSON.stringify(a.slice(0,this._recentsLimit())))}catch(e){if(!(e instanceof DOMException))throw e}}_renderRecents(){let e=this._recentsHost();if(!e)return;let t=this._input(),n=this._groupActive()?this._group:null,r=this._path.length===0&&!(t?.value??``).trim()?this._recentEntries().filter(e=>!n||e.g===n):[],i=this._realOptions(),a=[];for(let e of r){let t=i.find(t=>t.dataset.groupKey===e.g&&t.dataset.key===e.k);if(t&&!t.dataset.opens&&!this._isDisabled(t)&&a.push(t),a.length>=this._recentsLimit())break}if(!a.length){e.firstChild&&e.replaceChildren();return}let o=`${this._recentsId}-label`,s=document.createElement(`div`);s.className=`wui-cmd-group`,s.setAttribute(`role`,`group`),s.setAttribute(`aria-labelledby`,o);let c=document.createElement(`div`);c.className=`wui-cmd-group-label`,c.setAttribute(`role`,`presentation`),c.id=o,c.textContent=this.getAttribute(`recents-label`)??l,s.append(c);for(let e of a){let t=e.cloneNode(!0);if(!(t instanceof HTMLElement))throw Error(`recent option copy is not an element`);t.id=`${this._recentsId}-${e.id}`,t.hidden=!1,t.removeAttribute(`aria-selected`),s.append(t)}e.replaceChildren(s)}_inScope(e,t){return!t||(h(e,`.wui-cmd-page`)?.dataset.page??null)===(this._path.at(-1)?.key??null)}_navigate(e){window.location.assign(e)}_applyFilter(){let e=this._input(),t=(e?e.value:``).trim(),n=t.toLowerCase(),a=this.highlight,s=_(this,`.wui-cmd-page`,HTMLElement),c=s.length>0,l=this._path.at(-1)?.key??null;for(let e of s)e.hidden=e.dataset.page!==l;let u=this._groupActive()?this._group:null,d=0;for(let e of this._realOptions()){let o=g(e,`.wui-cmd-item-label`,HTMLElement),s=e.dataset.label??o?.textContent??``,l=(e.dataset.keywords??``).split(/\s+/).filter(Boolean),f=!n||s.toLowerCase().includes(n)||l.some(e=>e.toLowerCase().includes(n)),p=this._inScope(e,c)&&(!u||e.dataset.groupKey===u)&&f;e.hidden=!p,p&&d++,o&&(o.innerHTML=(0,i.matchSegments)(s,a?t:``).map(e=>e.match?`<mark class="wui-cmd-mark">${(0,r.escapeHtml)(e.text)}</mark>`:(0,r.escapeHtml)(e.text)).join(``))}let f=this._recentsHost();for(let e of _(this,`[role="group"]`,HTMLElement))f?.contains(e)||(e.hidden=!_(e,o,HTMLElement).some(e=>!e.hidden));let p=g(this,`[role="listbox"]`,HTMLElement);p&&(p.hidden=d===0);let m=g(this,`.wui-cmd-empty`,HTMLElement);m&&(m.textContent=n&&d===0?this.emptyText:``)}_teardown(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousedown`,this._onMouseDown),this.removeEventListener(`mousemove`,this._onMouseMove),this.removeEventListener(`input`,this._onInput),this._modal?.removeEventListener(`wui-modal-closed`,this._onModalClosed),this._modal=null}};(0,t.defineElement)(`wui-command-palette`,v),e.WuiCommandPalette=v})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.textMatch);
1
+ (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.167.0`)throw Error(`[webority-ui] command-palette expects ui-elements 0.167.0 but the page loaded `+o+`.`);var s={allCountText:`All ({count})`,ariaLabel:`Search`,backLabel:`Back`,emptyText:`No results`,placeholder:`Search…`,recentsLabel:`Recent`,resultGroupsLabel:`Result groups`,resultsLabel:`Results`,rootLabel:`All`},c=`[role="option"]`,l=()=>(0,i.readText)(`commandPalette`,s),u=5,d=20,f=`.wui-cmd-back, [data-depth]`,p=`[data-group-tab]`,m=0;function h(e,t){if(!(e instanceof Element))return null;let n=e.closest(t);return n instanceof HTMLElement?n:null}var g=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},_=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),v=class extends n.ElementBase{_path;_group;_crumbSig;_modal;_recentsId;_onModalClosed;_activeId;_lastQuery;_lastIds;_userChose;_onKeyDown;_onClick;_onMouseDown;_onMouseMove;_onInput;static get observedAttributes(){return[`filter`,`group-filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._group=null,this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++m}`,this._onModalClosed=()=>{this._setKeyboard(!1),this._reset(),this.hasAttribute(`path`)&&this._restart()},this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=h(e.target,f);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=h(e.target,p);if(n&&this.contains(n)){this._pickGroup(n.dataset.groupTab||null);return}let r=this._optionFrom(e.target);r&&this._select(r)},this._onMouseDown=e=>{let t=h(e.target,f),n=h(e.target,p);(t&&this.contains(t)||n&&this.contains(n)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._setKeyboard(!1),this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{this.hasAttribute(`filter`)&&e.target===this._input()&&(this._group=null,this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`wui-modal`),this._modal?.addEventListener(`wui-modal-closed`,this._onModalClosed),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??l().emptyText}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs(),this._syncTabs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
2
+ `),a=i!==this._lastIds;this._lastIds=i;let o=!n&&(this._userChose||!a)?r.find(e=>e.id===this._activeId):null;o||(this._userChose=!1,this._setKeyboard(!1)),this._setActive(o??r[0]??null,n)}_input(){let e=this.querySelector(`[role="combobox"]`);return e instanceof HTMLInputElement?e:null}_optionFrom(e,t=!1){let n=h(e,c);return n&&this.contains(n)&&!this._isHidden(n)&&(t||!this._isDisabled(n))?n:null}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_isHidden(e){return e.hidden!==!1||(h(e,`[role="group"]`)?.hidden??!1)!==!1}_selectableOptions(){return _(this,c,HTMLElement).filter(e=>!this._isHidden(e)&&!this._isDisabled(e))}_setActive(e,t){this._activeId=e?e.id:null;for(let t of _(this,c,HTMLElement))t.setAttribute(`aria-selected`,t===e?`true`:`false`);let n=this._input();n&&(e?n.setAttribute(`aria-activedescendant`,e.id):n.removeAttribute(`aria-activedescendant`)),e&&t&&e.scrollIntoView({block:`nearest`})}_move(e){let t=this._selectableOptions();if(!t.length)return;let n=t.findIndex(e=>e.id===this._activeId),r=n<0?e>0?0:t.length-1:(n+e+t.length)%t.length;this._userChose=!0,this._setKeyboard(!0),this._setActive(t[r]??null,!0)}_setKeyboard(e){this.toggleAttribute(`data-keyboard`,e)}_handleKeyDown(e){let t=this._input();if(t&&e.target===t){if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._move(e.key===`ArrowDown`?1:-1);else if(e.key===`Tab`&&this._groupActive()&&this._tabs().length)e.preventDefault(),this._cycleGroup(e.shiftKey?-1:1);else if(e.key===`Backspace`&&!e.isComposing&&this._path.length&&!t.value)e.preventDefault(),this._goTo(this._path.slice(0,-1));else if(e.key===`Enter`&&!e.isComposing){let t=this._selectableOptions().find(e=>e.id===this._activeId);if(!t)return;e.preventDefault(),this._select(t)}}}_select(e){this._remember(e),this.dispatchEvent(new CustomEvent(`wui-command-palette:select`,{bubbles:!0,cancelable:!0,detail:{key:e.dataset.key??null,groupKey:e.dataset.groupKey??null,id:e.id}}))&&(e.dataset.opens?this._open(e.dataset.opens):e.dataset.href&&this._navigate(e.dataset.href))}_open(e){let t=_(this,`.wui-cmd-page`,HTMLElement).find(t=>t.dataset.page===e);this._goTo([...this._path,{key:e,label:t?.dataset.label??e}])}_goTo(e){this._input()?.focus(),this.dispatchEvent(new CustomEvent(`wui-command-palette:navigate`,{bubbles:!0,cancelable:!0,detail:{path:e}}))&&(this._path=e,this._restart())}_tabs(){return _(this,p,HTMLElement)}_groupActive(){return this.hasAttribute(`group-filter`)&&this._path.length===0}_pickGroup(e){this._group=e,this._applyFilter(),this.refresh()}_cycleGroup(e){let t=this._tabs().map(e=>e.dataset.groupTab||null),n=Math.max(0,t.indexOf(this._group));this._pickGroup(t[(n+e+t.length)%t.length]??null)}_syncTabs(){if(!this.hasAttribute(`group-filter`))return;let e=g(this,`.wui-cmd-tabs`,HTMLElement);e&&(e.hidden=!this._groupActive());for(let e of this._tabs())e.setAttribute(`aria-selected`,String((e.dataset.groupTab||null)===this._group))}_restart(){this._group=null;let e=this._input();e&&(e.value=``),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}_reset(){this.hasAttribute(`path`)||(this._path=[],this._restart())}_readPath(){let e=this.getAttribute(`path`);if(e==null)return;let t=JSON.parse(e);this._path=Array.isArray(t)?t.filter(e=>e&&typeof e.key==`string`&&typeof e.label==`string`):[]}_renderCrumbs(){let e=g(this,`.wui-cmd-crumbs`,HTMLElement);if(!e)return;let t=this.getAttribute(`root-label`)??l().rootLabel,n=JSON.stringify([t,this._path]);if(e.hidden=this._path.length===0,n===this._crumbSig)return;this._crumbSig=n;let r=g(e,`.wui-cmd-trail`,HTMLElement);if(!r)return;let i=[t,...this._path.map(e=>e.label)];r.replaceChildren(...i.map((e,t)=>{let n=document.createElement(`li`),r=t===i.length-1,a=document.createElement(r?`span`:`button`);if(a.className=`wui-cmd-crumb`,a.textContent=e,r)a.setAttribute(`aria-current`,`page`);else{if(!(a instanceof HTMLButtonElement))throw Error(`breadcrumb button missing`);a.type=`button`,a.dataset.depth=String(t)}return n.append(a),n}))}_recentsHost(){return g(this,`.wui-cmd-recents`,HTMLElement)}_realOptions(){let e=this._recentsHost();return _(this,c,HTMLElement).filter(t=>!e?.contains(t))}_recentEntries(){let e=this.getAttribute(`recents-key`);if(!e)return[];let t;try{t=JSON.parse(globalThis.localStorage?.getItem(e)??`[]`)}catch{return[]}return Array.isArray(t)?t.filter(e=>e&&typeof e.g==`string`&&typeof e.k==`string`):[]}_recentsLimit(){let e=Number.parseInt(this.getAttribute(`recents-limit`)??``,10);return Number.isFinite(e)&&e>0?Math.min(e,d):u}_remember(e){let t=this.getAttribute(`recents-key`),{groupKey:n,key:r,opens:i}=e.dataset;if(!t||i||n==null||r==null)return;let a=[{g:n,k:r},...this._recentEntries().filter(e=>e.g!==n||e.k!==r)];try{globalThis.localStorage?.setItem(t,JSON.stringify(a.slice(0,this._recentsLimit())))}catch(e){if(!(e instanceof DOMException))throw e}}_renderRecents(){let e=this._recentsHost();if(!e)return;let t=this._input(),n=this._groupActive()?this._group:null,r=this._path.length===0&&!(t?.value??``).trim()?this._recentEntries().filter(e=>!n||e.g===n):[],i=this._realOptions(),a=[];for(let e of r){let t=i.find(t=>t.dataset.groupKey===e.g&&t.dataset.key===e.k);if(t&&!t.dataset.opens&&!this._isDisabled(t)&&a.push(t),a.length>=this._recentsLimit())break}if(!a.length){e.firstChild&&e.replaceChildren();return}let o=`${this._recentsId}-label`,s=document.createElement(`div`);s.className=`wui-cmd-group`,s.setAttribute(`role`,`group`),s.setAttribute(`aria-labelledby`,o);let c=document.createElement(`div`);c.className=`wui-cmd-group-label`,c.setAttribute(`role`,`presentation`),c.id=o,c.textContent=this.getAttribute(`recents-label`)??l().recentsLabel,s.append(c);for(let e of a){let t=e.cloneNode(!0);if(!(t instanceof HTMLElement))throw Error(`recent option copy is not an element`);t.id=`${this._recentsId}-${e.id}`,t.hidden=!1,t.removeAttribute(`aria-selected`),s.append(t)}e.replaceChildren(s)}_inScope(e,t){return!t||(h(e,`.wui-cmd-page`)?.dataset.page??null)===(this._path.at(-1)?.key??null)}_navigate(e){window.location.assign(e)}_applyFilter(){let e=this._input(),t=(e?e.value:``).trim(),n=t.toLowerCase(),i=this.highlight,o=_(this,`.wui-cmd-page`,HTMLElement),s=o.length>0,l=this._path.at(-1)?.key??null;for(let e of o)e.hidden=e.dataset.page!==l;let u=this._groupActive()?this._group:null,d=0;for(let e of this._realOptions()){let o=g(e,`.wui-cmd-item-label`,HTMLElement),c=e.dataset.label??o?.textContent??``,l=(e.dataset.keywords??``).split(/\s+/).filter(Boolean),f=!n||c.toLowerCase().includes(n)||l.some(e=>e.toLowerCase().includes(n)),p=this._inScope(e,s)&&(!u||e.dataset.groupKey===u)&&f;e.hidden=!p,p&&d++,o&&(o.innerHTML=(0,a.matchSegments)(c,i?t:``).map(e=>e.match?`<mark class="wui-cmd-mark">${(0,r.escapeHtml)(e.text)}</mark>`:(0,r.escapeHtml)(e.text)).join(``))}let f=this._recentsHost();for(let e of _(this,`[role="group"]`,HTMLElement))f?.contains(e)||(e.hidden=!_(e,c,HTMLElement).some(e=>!e.hidden));let p=g(this,`[role="listbox"]`,HTMLElement);p&&(p.hidden=d===0);let m=g(this,`.wui-cmd-empty`,HTMLElement);m&&(m.textContent=n&&d===0?this.emptyText:``)}_teardown(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousedown`,this._onMouseDown),this.removeEventListener(`mousemove`,this._onMouseMove),this.removeEventListener(`input`,this._onInput),this._modal?.removeEventListener(`wui-modal-closed`,this._onModalClosed),this._modal=null}};(0,t.defineElement)(`wui-command-palette`,v),e.WuiCommandPalette=v})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.textMatch);
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=globalThis.WeborityUiElementsInternal?.version;if(d!==`0.164.0`)throw Error(`[webority-ui] comment-thread expects ui-elements 0.164.0 but the page loaded `+d+`.`);var f=Object.freeze([`👍`,`❤️`,`🎉`,`😄`,`👀`,`🙏`]),p=Object.freeze([`post`,`reply`,`edit`,`delete`,`react`]),m=`This did not go through. Refresh the page and try again.`,h=`Something went wrong on our side. Try again in a moment.`,g=Object.freeze({forbidden:`You do not have permission to do this.`,client:m,validation:`This was not accepted. Check it and try again.`,server:h,network:`Could not reach the server. Check your connection and try again.`}),_=Object.freeze({listName:`Comments`,empty:`No comments yet.`,deleted:`This comment was deleted.`,edited:`Edited`,reply:`Reply`,edit:`Edit`,delete:`Delete`,cancel:`Cancel`,save:`Save`,post:`Comment`,confirmDelete:`Delete this comment?`,composerLabel:`Add a comment`,composerPlaceholder:`Write a comment. Type @ to mention someone.`,replyLabel:e=>`Reply to ${e}`,replyPlaceholder:`Write a reply`,editLabel:`Edit comment`,repliesName:e=>`Replies to ${e}`,reactions:`Reactions`,addReaction:`Add a reaction`,pickerName:`Choose a reaction`,emptyBody:`Write something first.`,done:Object.freeze({post:`Comment posted.`,reply:`Reply posted.`,edit:`Comment saved.`,delete:`Comment deleted.`,react:``}),failed:g}),v=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,searchFailed:`Couldn't load people. Keep typing to try again.`,found:e=>`${e===1?`1 person`:`${(0,s.formatNumber)(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),y=`[data-wui-control]`,b=`[data-wui-field]`,x=`[data-wui-menu]`,S=`[data-wui-live]`,C=0,w=e=>!!(e&&u.MENTION_ID_PATTERN.test(String(e.value??``))&&(0,u.mentionLabel)(e.label)!==``);function T(e,t){let n=e.getAttribute(`size`);t.classList.toggle(`input-sm`,n===`sm`),t.classList.toggle(`input-lg`,n===`lg`)}function E(e,t){t.readOnly=(0,o.isReadOnly)(e)||e.hasAttribute(`loading`)}function D(e){let t=e.ownerDocument;e.id||=`wui-mention-${++C}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),E(e,n),T(e,n),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,e.getAttribute(`people-label`)??v.listName),o.setAttribute(`data-wui-menu`,``),o.setAttribute(`popover`,`manual`),e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var O=class extends r.ElementBase{_wired;_pendingValue;_text;_mentions;_peopleProp;_declared;_loading;_searchFailed;_query;_results;_active;_timer;_searchSeq;_lastSearch;_abort;_onMenuDown;static get observedAttributes(){return[`disabled`,`readonly`,`loading`,`size`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._searchFailed=!1,this._query=null,this._results=[],this._active=-1,this._timer=void 0,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this)}connectedCallback(){for(let e of[`people`,`loading`,`searchFailed`,`value`])if(Object.hasOwn(this,e)){let t=Reflect.get(this,e);Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}if(this._wired)return;this._wired=!0,this.querySelector(y)||D(this);let e=this._requireControl(),t=this.querySelector(b)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,this._syncState(),e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._requireMenu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):e===`readonly`?(E(this,r),n!==null&&this._close(),this._syncState()):e===`loading`?(E(this,r),this._syncState(),this._query!==null&&this._renderMenu()):e===`size`?T(this,r):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return(0,u.mentionValueFromText)(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);this._wired?t!==this.value&&this._load(t):this._pendingValue=t}get mentions(){let e=new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(w):[],this._searchFailed=!1,(this._isOpen()||this._query!==null)&&this._refresh()}get searchFailed(){return this._searchFailed}set searchFailed(e){this._searchFailed=!!e,this._query!==null&&this._renderMenu()}get loading(){return this._loading||this.hasAttribute(`loading`)}set loading(e){this._loading=!!e,this.toggleAttribute(`loading`,this._loading),this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(y)}_menu(){return this.querySelector(x)}_requireControl(){let e=this._control();if(!e)throw Error(`<wui-mention-input> has no text box.`);return e}_requireMenu(){let e=this._menu();if(!e)throw Error(`<wui-mention-input> has no people list.`);return e}_load(e){let{text:t,mentions:n}=(0,u.mentionTextFromValue)(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(b);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._requireControl(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e instanceof KeyboardEvent&&e.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();t?this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh()):this._close()}_queryAtCaret(){let e=this._control();if(!e||(0,o.isInert)(this)||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n.charAt(r-1)))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>(0,u.mentionLabel)(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);n?this._fetchPeople(n,e,t):this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}))},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let i=`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,o=await(0,a.wuiFetch)(i,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!o.ok){this._peopleProp=[],this._searchFailed=!0,this.loading=!1,this._refresh();return}this._searchFailed=!1;let s=this.ownerDocument.createElement(`template`);s.innerHTML=o.html,this._peopleProp=[...s.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(w),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return e!==null&&(0,i.isPopoverOpen)(e)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;this._syncState();let n=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,r)=>{let i=n.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${r}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(r),t.src){let e=n.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let a=n.createElement(`span`);a.className=`wui-mention-option-text`;let o=n.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=(0,u.mentionLabel)(t.label),a.appendChild(o),t.description){let e=n.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),a.appendChild(e)}i.appendChild(a),e.appendChild(i)}),!this._results.length){let t=n.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this.loading?v.searching:this._searchFailed?v.searchFailed:`${v.noMatch} “${this._query.text}”`,e.appendChild(t)}(0,i.openAnchoredPopover)(t,e,{mode:`manual`}),this._setActive(this._results.length?0:-1),this.loading||this._announce(this._results.length?v.found(this._results.length):this._searchFailed?v.searchFailed:`${v.noMatch}.`)}_syncState(){let e=this._control();e&&(0,o.syncFieldState)(this,e)}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();if(e){let t=(0,i.isPopoverOpen)(e);(0,i.closeAnchoredPopover)(e),t&&e.replaceChildren()}this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`)}_setActive(e,{reveal:t=!0}={}){let n=this._requireMenu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]??null:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);(0,l.moveActiveRow)(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._requireControl().setAttribute(`aria-activedescendant`,i.id)):this._requireControl().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if(((0,c.isImeSafeEnter)(e)||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}(0,c.isImeSafeEnter)(e)&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}))):e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._requireControl();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=(0,u.mentionLabel)(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce(v.mentioned(t))}_replace(e,t,n,r){let i=this._requireControl(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(S);t&&(t.textContent=``,t.textContent=e)}},k=`[data-wui-items]`,A=`[data-wui-picker]`,j=`[data-wui-composer]`,M=`[data-wui-comment]`,N=`[data-wui-live]`,P=e=>{let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;return typeof t==`string`&&t?t:h},F=e=>e instanceof Element?e:null,I=e=>`disabled`in e&&e.disabled===!0,L=(e,t)=>{if(e==null)throw Error(`${t} missing`);return e},R=(e,t,n)=>{let r=e?.querySelector(t);return r instanceof n?r:null},z=(e,t,n)=>{let r=e?.closest(t);return r instanceof n?r:null},B=(e,t,n)=>e?[...e.querySelectorAll(t)].filter(e=>e instanceof n):[],V=class extends r.ElementBase{_wired;_busy;_peopleProp;_pickerFor;_openers;constructor(){super(),this._wired=!1,this._busy=!1,this._peopleProp=null,this._pickerFor=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSubmitKey=this._onSubmitKey.bind(this)}connectedCallback(){if(Object.hasOwn(this,`people`)){let e=this.people;Reflect.deleteProperty(this,`people`),this.people=e}if(this._wired)return;this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wui:mention-input:submit`,this._onSubmitKey),customElements.upgrade(this);let e=R(this,`${j} wui-mention-input`,O);this._handPeople(e),this._applyComposerPlaceholder(e)}disconnectedCallback(){this._closePicker(!1)}get people(){return this._peopleProp?this._peopleProp:B(this,`:scope > [data-wui-people] > wui-option`,HTMLElement).map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0}))}set people(e){this._peopleProp=Array.isArray(e)?e:[];for(let e of this.querySelectorAll(`wui-mention-input`))e.people=this._peopleProp}_handPeople(e){!e||this.hasAttribute(`remote`)||this.hasAttribute(`source`)||(e.people=this.people)}_applyComposerPlaceholder(e){let t=this.getAttribute(`composer-placeholder`);e&&t!=null&&e.setAttribute(`placeholder`,t)}_reactionChoices(){let e=this.getAttribute(`reaction-choices`),t=e?e.split(/\s+/).filter(Boolean):[];return t.length?t:f}_onClick(e){let t=z(F(e.target),`[data-wui-emoji]`,HTMLElement);if(t&&this.contains(t)&&!I(t)){let e=t.closest(A),n=e?this._pickerFor?.comment:t.closest(M);e&&this._closePicker(!0),n&&this._react(n,t.getAttribute(`data-wui-emoji`));return}let n=z(F(e.target),`[data-wui-action]`,HTMLElement);if(!n||!this.contains(n)||I(n))return;let r=n.closest(M);switch(n.getAttribute(`data-wui-action`)){case`reply`:this._openReply(r,n);break;case`edit`:this._openEditor(r,n);break;case`delete`:this._askDelete(r);break;case`cancel-delete`:this._closeConfirm(r,!0);break;case`confirm-delete`:{let e=L(r,`comment`);this._send(`delete`,{commentId:e.getAttribute(`data-wui-comment`)},{comment:e,scope:e});break}case`react-menu`:this._pickerFor?.button===n?this._closePicker(!0):this._openPicker(r,n);break;case`cancel`:this._closeSlot(z(n,`[data-wui-reply], [data-wui-editor]`,HTMLElement),!0);break;case`post`:case`send`:this._sendFrom(n)}}_onKeyDown(e){let t=R(this,A,HTMLElement),n=F(e.target);if(this._pickerFor&&t?.contains(n)){let r=B(t,`[data-wui-emoji]`,HTMLElement),i=n instanceof HTMLElement?r.indexOf(n):-1;e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closePicker(!0)):e.key===`ArrowRight`||e.key===`ArrowLeft`?(e.preventDefault(),r[(i+(e.key===`ArrowRight`?1:-1)+r.length)%r.length]?.focus()):e.key===`Tab`&&this._closePicker(!1);return}if(e.key!==`Escape`)return;let r=z(n,`[data-wui-reply], [data-wui-editor]`,HTMLElement);if(r&&this.contains(r)){e.preventDefault(),e.stopPropagation(),this._closeSlot(r,!0);return}let i=z(n,`[data-wui-confirm]`,HTMLElement);i&&(e.preventDefault(),e.stopPropagation(),this._closeConfirm(i.closest(M),!0))}_onSubmitKey(e){let t=R(z(F(e.target),`[data-wui-reply], [data-wui-editor], [data-wui-composer]`,HTMLElement),`[data-wui-action="send"], [data-wui-action="post"]`,HTMLElement);t&&!I(t)&&this._sendFrom(t)}_openReply(e,t){if(this.hasAttribute(`no-replies`))return;let n=R(e,`:scope > [data-wui-reply]`,HTMLElement);if(!n)return;if(!n.hidden){n.querySelector(`wui-mention-input`)?.focus();return}let r=e?.querySelector(`.wui-comment-author`)?.textContent?.trim()||``;this._fillSlot(n,{label:_.replyLabel(r),placeholder:_.replyPlaceholder,value:``,send:_.reply,opener:t})}_openEditor(e,t){let n=R(e,`:scope > .wui-comment-row [data-wui-editor]`,HTMLElement);if(!n?.hidden)return;let r=R(L(n.parentElement,`comment row`),`:scope > [data-wui-text]`,HTMLElement);r&&(r.hidden=!0),this._fillSlot(n,{label:_.editLabel,placeholder:``,value:e?.getAttribute(`data-value`)??``,send:_.save,opener:t})}_fillSlot(e,{label:t,placeholder:n,value:r,send:i,opener:a}){let o=this.ownerDocument,s=o.createElement(`wui-mention-input`);s.className=`wui-mention-input`,s.setAttribute(`label`,t),n&&s.setAttribute(`placeholder`,n),s.setAttribute(`rows`,`2`),s.setAttribute(`value`,r);for(let e of[`remote`,`source`,`min-chars`,`debounce`]){let t=this.getAttribute(e);t!=null&&s.setAttribute(e,t)}let c=o.createElement(`div`);c.className=`wui-comment-form-actions`,c.append(this._button(`primary`,`solid`,`sm`,`send`,i),this._button(`primary`,`ghost`,`sm`,`cancel`,_.cancel));let l=o.createElement(`div`);l.className=`wui-comment-error`,l.setAttribute(`data-wui-error`,``),l.hidden=!0,e.replaceChildren(s,c,l),this._handPeople(s),e.hidden=!1,this._openers??=new WeakMap,this._openers.set(e,a),s.focus();let u=s.querySelector(`textarea`);u?.setSelectionRange(u.value.length,u.value.length)}_button(e,t,r,i,a){let o=this.ownerDocument.createElement(`button`);return o.type=`button`,o.className=(0,n.buttonClass)(e,t,r),o.dataset.wui=n.APP_BUTTON_MARKER,o.setAttribute(`data-wui-action`,i),o.textContent=a,o}_closeSlot(e,t){if(!e||e.hidden)return;if(e.hidden=!0,e.replaceChildren(),e.hasAttribute(`data-wui-editor`)){let t=R(e.parentElement,`:scope > [data-wui-text]`,HTMLElement);t&&(t.hidden=!1)}let n=this._openers?.get(e);t&&n?.isConnected&&n.focus()}_askDelete(e){let t=R(e,`:scope > .wui-comment-row`,HTMLElement),n=R(t,`[data-wui-confirm]`,HTMLElement),r=R(t,`[data-wui-actions]`,HTMLElement);n&&(n.hidden=!1,r&&(r.hidden=!0),R(n,`[data-wui-action="cancel-delete"]`,HTMLElement)?.focus())}_closeConfirm(e,t){let n=R(e,`:scope > .wui-comment-row`,HTMLElement),r=R(n,`[data-wui-confirm]`,HTMLElement),i=R(n,`[data-wui-actions]`,HTMLElement);r&&(r.hidden=!0),i&&(i.hidden=!1),t&&R(i,`[data-wui-action="delete"]`,HTMLElement)?.focus()}_openPicker(e,t){let n=R(this,A,HTMLElement);n&&e&&!this.hasAttribute(`no-reactions`)&&(this._closePicker(!1),this._pickerFor={comment:e,button:t},t.setAttribute(`aria-expanded`,`true`),(0,i.openAnchoredPopover)(t,n,{mode:`auto`,onClosed:()=>this._pickerClosed()}),R(n,`[data-wui-emoji]`,HTMLElement)?.focus())}_closePicker(e){let t=this._pickerFor;if(!t)return;let n=R(this,A,HTMLElement);n&&(0,i.closeAnchoredPopover)(n),this._pickerClosed(),e&&t.button.isConnected&&t.button.focus()}_pickerClosed(){let e=R(this,A,HTMLElement),t=this._pickerFor;!t||e&&(0,i.isPopoverOpen)(e)||(this._pickerFor=null,t.button.setAttribute(`aria-expanded`,`false`))}_react(e,t){t&&!this.hasAttribute(`no-reactions`)&&this._send(`react`,{commentId:e.getAttribute(`data-wui-comment`),emoji:t},{comment:e,scope:e})}_sendFrom(e){let t=z(e,`[data-wui-reply], [data-wui-editor], [data-wui-composer]`,HTMLElement);if(!t)return;let n=t.querySelector(`wui-mention-input`),r=n?.value??``;if(!r.trim()){this._showError(t,_.emptyBody),n?.focus();return}let i=t.closest(M);t.hasAttribute(`data-wui-composer`)?this._send(`post`,{body:r},{scope:t,form:t}):t.hasAttribute(`data-wui-reply`)?this._send(`reply`,{parentId:L(i,`comment`).getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t}):this._send(`edit`,{commentId:L(i,`comment`).getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t})}async _send(e,t,{comment:n,scope:r,form:i}){if(this._busy)return;this._busy=!0,this.setAttribute(`aria-busy`,`true`);let a=i??R(n,`:scope > .wui-comment-row`,HTMLElement)??this;this._showError(a,null);let o=[...r.querySelectorAll(`button, textarea`)].filter(e=>e instanceof HTMLButtonElement||e instanceof HTMLTextAreaElement).filter(e=>!e.disabled);for(let e of o)e.disabled=!0;let s=await this._persist({intent:e,...t});for(let e of o)e.isConnected&&(e.disabled=!1);this._busy=!1,this.removeAttribute(`aria-busy`);let c=t.commentId??null,l=t.parentId??null;s.ok?(s.html!=null&&this._swapItems(s.html),e===`post`?i?.querySelector(`wui-mention-input`)?.clear():i?.isConnected&&this._closeSlot(i,!1),e===`delete`&&n?.isConnected&&this._closeConfirm(n,!1),this._restoreFocus(e,t,i),_.done[e]&&this._announce(_.done[e]),this.dispatchEvent(new CustomEvent(`wui:comment-thread:done`,{bubbles:!0,detail:{intent:e,commentId:c,parentId:l}}))):s.kind!==`session`&&s.kind!==`aborted`&&(this._showError(a.isConnected?a:this,s.message),this._announce(s.message),this.dispatchEvent(new CustomEvent(`wui:comment-thread:failed`,{bubbles:!0,detail:{intent:e,kind:s.kind,message:s.message}})))}async _persist(e){if(this.hasAttribute(`controlled`)){if(typeof this.submit!=`function`)return{ok:!0,html:null};try{return await this.submit(e),{ok:!0,html:null}}catch(e){return{ok:!1,kind:`server`,message:P(e)}}}let t=this.getAttribute(`action`);if(!t)return{ok:!1,kind:`client`,message:m};let n=new URLSearchParams;for(let[t,r]of Object.entries(e))r!=null&&n.set(t,r);let r=await(0,a.wuiFetch)(t,{method:`POST`,body:n});return r.ok?{ok:!0,html:r.html}:{ok:!1,kind:r.kind,message:r.message||_.failed[r.kind]||`Something went wrong on our side. Try again in a moment.`}}_swapItems(e){let t=R(this,k,HTMLElement);if(!t||!e.trim())return;let n=this.ownerDocument.createElement(`template`);n.innerHTML=e;let r=R(n.content,k,HTMLElement);t.replaceChildren(...r?r.childNodes:n.content.childNodes)}_restoreFocus(e,t,n){let r=this.ownerDocument,i=r.activeElement;if(i&&i!==r.body&&i.isConnected&&this.contains(i)&&!I(i))return;let a=e=>e?B(this,M,HTMLElement).find(t=>t.getAttribute(`data-wui-comment`)===e):null,o=e=>R(a(e),`:scope > .wui-comment-row`,HTMLElement),s=null;if(e===`post`)s=n?.querySelector(`textarea`);else if(e===`reply`)s=R(o(t.parentId),`[data-wui-action="reply"]`,HTMLElement);else if(e===`edit`)s=R(o(t.commentId),`[data-wui-action="edit"]`,HTMLElement);else if(e===`react`){let e=o(t.commentId);s=B(e,`button[data-wui-emoji]`,HTMLButtonElement).find(e=>e.getAttribute(`data-wui-emoji`)===t.emoji)??R(e,`[data-wui-action="react-menu"]`,HTMLElement)}s??=R(this,`${j} textarea`,HTMLTextAreaElement),s?.focus()}_showError(e,t){let n=R(e,`:scope > [data-wui-error], :scope > .wui-comment-main > [data-wui-error]`,HTMLElement);n&&(n.textContent=t||``,n.hidden=!t)}_announce(e){let t=R(this,`:scope > ${N}`,HTMLElement);t&&e&&(t.textContent=``,t.textContent=e)}};(0,t.defineElement)(`wui-mention-input`,O),(0,t.defineElement)(`wui-comment-thread`,V),e.COMMENT_INTENTS=p,e.COMMENT_REACTIONS=f,e.COMMENT_TEXT=_,e.WuiCommentThread=V})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.nativeOverlay,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.fieldState,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.listboxKeyNav,WeborityUiElementsInternal.modules.mentionText);
1
+ (function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=globalThis.WeborityUiElementsInternal?.version;if(f!==`0.167.0`)throw Error(`[webority-ui] comment-thread expects ui-elements 0.167.0 but the page loaded `+f+`.`);var p=Object.freeze([`👍`,`❤️`,`🎉`,`😄`,`👀`,`🙏`]),m=Object.freeze([`post`,`reply`,`edit`,`delete`,`react`]),h={addReactionLabel:`Add a reaction`,attachmentsLabel:`Attachments`,cancelLabel:`Cancel`,chooseReactionLabel:`Choose a reaction`,composerLabel:`Add a comment`,composerPlaceholder:`Write a comment. Type @ to mention someone.`,deleteConfirmText:`Delete this comment?`,deleteLabel:`Delete`,deletedText:`This comment was deleted.`,doneDeleteText:`Comment deleted.`,doneEditText:`Comment saved.`,donePostText:`Comment posted.`,doneReplyText:`Reply posted.`,editCommentLabel:`Edit comment`,editLabel:`Edit`,editedLabel:`Edited`,emptyBodyMessage:`Write something first.`,failedClientMessage:`This did not go through. Refresh the page and try again.`,failedServerMessage:`Something went wrong on our side. Try again in a moment.`,forbiddenMessage:`You do not have permission to do this.`,internalLabel:`Internal note`,label:`Comments`,noCommentsText:`No comments yet.`,peopleLabel:`People`,postLabel:`Comment`,reactionsLabel:`Reactions`,repliesToLabel:`Replies to {name}`,replyLabel:`Reply`,replyPlaceholder:`Write a reply`,replyToText:`Reply to {author}`,saveLabel:`Save`,validationMessage:`This was not accepted. Check it and try again.`},g={networkText:`Could not reach the server. Check your connection and try again.`},_={foundTextOne:`1 person. Up and down to choose, Enter to mention.`,foundTextOther:`{count} people. Up and down to choose, Enter to mention.`,helpLabel:`More information`,listNameLabel:`People`,mentioned:`Mentioned {label}.`,noMatchLabel:`No one matches`,searchFailedMessage:`Couldn't load people. Keep typing to try again.`,searchingLabel:`Searching…`},v=()=>(0,o.readText)(`mentionInput`,_),y=`[data-wui-control]`,b=`[data-wui-field]`,x=`[data-wui-menu]`,S=`[data-wui-live]`,C=0,w=e=>!!(e&&d.MENTION_ID_PATTERN.test(String(e.value??``))&&(0,d.mentionLabel)(e.label)!==``);function T(e,t){let n=e.getAttribute(`size`);t.classList.toggle(`wui-input-sm`,n===`sm`),t.classList.toggle(`wui-input-lg`,n===`lg`),t.classList.toggle(`wui-input-xl`,n===`xl`)}function E(e,t){t.readOnly=(0,s.isReadOnly)(e)||e.hasAttribute(`loading`)}function D(e){let t=e.ownerDocument;e.id||=`wui-mention-${++C}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),E(e,n),T(e,n),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,e.getAttribute(`people-label`)??v().listNameLabel),o.setAttribute(`data-wui-menu`,``),o.setAttribute(`popover`,`manual`),e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var O=class extends r.ElementBase{_wired;_pendingValue;_text;_mentions;_peopleProp;_declared;_loading;_searchFailed;_query;_results;_active;_timer;_searchSeq;_lastSearch;_abort;_onMenuDown;static get observedAttributes(){return[`disabled`,`readonly`,`loading`,`size`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._searchFailed=!1,this._query=null,this._results=[],this._active=-1,this._timer=void 0,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this)}connectedCallback(){for(let e of[`people`,`loading`,`searchFailed`,`value`])if(Object.hasOwn(this,e)){let t=Reflect.get(this,e);Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}if(this._wired)return;this._wired=!0,this.querySelector(y)||D(this);let e=this._requireControl(),t=this.querySelector(b)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,this._syncState(),e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._requireMenu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):e===`readonly`?(E(this,r),n!==null&&this._close(),this._syncState()):e===`loading`?(E(this,r),this._syncState(),this._query!==null&&this._renderMenu()):e===`size`?T(this,r):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return(0,d.mentionValueFromText)(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);this._wired?t!==this.value&&this._load(t):this._pendingValue=t}get mentions(){let e=new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(w):[],this._searchFailed=!1,(this._isOpen()||this._query!==null)&&this._refresh()}get searchFailed(){return this._searchFailed}set searchFailed(e){this._searchFailed=!!e,this._query!==null&&this._renderMenu()}get loading(){return this._loading||this.hasAttribute(`loading`)}set loading(e){this._loading=!!e,this.toggleAttribute(`loading`,this._loading),this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(y)}_menu(){return this.querySelector(x)}_requireControl(){let e=this._control();if(!e)throw Error(`<wui-mention-input> has no text box.`);return e}_requireMenu(){let e=this._menu();if(!e)throw Error(`<wui-mention-input> has no people list.`);return e}_load(e){let{text:t,mentions:n}=(0,d.mentionTextFromValue)(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(b);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._requireControl(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e instanceof KeyboardEvent&&e.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();t?this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh()):this._close()}_queryAtCaret(){let e=this._control();if(!e||(0,s.isInert)(this)||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n.charAt(r-1)))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>(0,d.mentionLabel)(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);n?this._fetchPeople(n,e,t):this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}))},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let i=`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,o=await(0,a.wuiFetch)(i,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!o.ok){this._peopleProp=[],this._searchFailed=!0,this.loading=!1,this._refresh();return}this._searchFailed=!1;let s=this.ownerDocument.createElement(`template`);s.innerHTML=o.html,this._peopleProp=[...s.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(w),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return e!==null&&(0,i.isPopoverOpen)(e)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;this._syncState();let n=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,r)=>{let i=n.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${r}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(r),t.src){let e=n.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let a=n.createElement(`span`);a.className=`wui-mention-option-text`;let o=n.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=(0,d.mentionLabel)(t.label),a.appendChild(o),t.description){let e=n.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),a.appendChild(e)}i.appendChild(a),e.appendChild(i)}),!this._results.length){let t=n.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this.loading?v().searchingLabel:this._searchFailed?v().searchFailedMessage:`${v().noMatchLabel} “${this._query.text}”`,e.appendChild(t)}(0,i.openAnchoredPopover)(t,e,{mode:`manual`}),this._setActive(this._results.length?0:-1),this.loading||this._announce(this._results.length?(0,o.pluralText)(v(),`foundText`,this._results.length,{count:(0,c.formatNumber)(this._results.length,{decimals:0})}):this._searchFailed?v().searchFailedMessage:`${v().noMatchLabel}.`)}_syncState(){let e=this._control();e&&(0,s.syncFieldState)(this,e)}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();if(e){let t=(0,i.isPopoverOpen)(e);(0,i.closeAnchoredPopover)(e),t&&e.replaceChildren()}this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`)}_setActive(e,{reveal:t=!0}={}){let n=this._requireMenu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]??null:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);(0,u.moveActiveRow)(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._requireControl().setAttribute(`aria-activedescendant`,i.id)):this._requireControl().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if(((0,l.isImeSafeEnter)(e)||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}(0,l.isImeSafeEnter)(e)&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}))):e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._requireControl();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=(0,d.mentionLabel)(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce((0,o.fillText)(v().mentioned,{label:t}))}_replace(e,t,n,r){let i=this._requireControl(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(S);t&&(t.textContent=``,t.textContent=e)}},k=`[data-wui-items]`,A=`[data-wui-picker]`,j=`[data-wui-composer]`,M=`[data-wui-comment]`,N=`[data-wui-live]`,P=()=>(0,o.readText)(`commentThread`,h),F=e=>({forbidden:P().forbiddenMessage,client:P().failedClientMessage,validation:P().validationMessage,server:P().failedServerMessage,network:(0,o.readText)(`httpFailure`,g).networkText})[e],I=e=>({post:P().donePostText,reply:P().doneReplyText,edit:P().doneEditText,delete:P().doneDeleteText,react:``})[e],L=e=>{let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;return typeof t==`string`&&t?t:P().failedServerMessage},R=e=>e instanceof Element?e:null,z=e=>`disabled`in e&&e.disabled===!0,B=(e,t)=>{if(e==null)throw Error(`${t} missing`);return e},V=(e,t,n)=>{let r=e?.querySelector(t);return r instanceof n?r:null},H=(e,t,n)=>{let r=e?.closest(t);return r instanceof n?r:null},U=(e,t,n)=>e?[...e.querySelectorAll(t)].filter(e=>e instanceof n):[],W=class extends r.ElementBase{_wired;_busy;_peopleProp;_pickerFor;_openers;constructor(){super(),this._wired=!1,this._busy=!1,this._peopleProp=null,this._pickerFor=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSubmitKey=this._onSubmitKey.bind(this)}connectedCallback(){if(Object.hasOwn(this,`people`)){let e=this.people;Reflect.deleteProperty(this,`people`),this.people=e}if(this._wired)return;this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wui:mention-input:submit`,this._onSubmitKey),customElements.upgrade(this);let e=V(this,`${j} wui-mention-input`,O);this._handPeople(e),this._applyComposerPlaceholder(e)}disconnectedCallback(){this._closePicker(!1)}get people(){return this._peopleProp?this._peopleProp:U(this,`:scope > [data-wui-people] > wui-option`,HTMLElement).map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0}))}set people(e){this._peopleProp=Array.isArray(e)?e:[];for(let e of this.querySelectorAll(`wui-mention-input`))e.people=this._peopleProp}_handPeople(e){!e||this.hasAttribute(`remote`)||this.hasAttribute(`source`)||(e.people=this.people)}_applyComposerPlaceholder(e){let t=this.getAttribute(`composer-placeholder`);e&&t!=null&&e.setAttribute(`placeholder`,t)}_reactionChoices(){let e=this.getAttribute(`reaction-choices`),t=e?e.split(/\s+/).filter(Boolean):[];return t.length?t:p}_onClick(e){let t=H(R(e.target),`[data-wui-emoji]`,HTMLElement);if(t&&this.contains(t)&&!z(t)){let e=t.closest(A),n=e?this._pickerFor?.comment:t.closest(M);e&&this._closePicker(!0),n&&this._react(n,t.getAttribute(`data-wui-emoji`));return}let n=H(R(e.target),`[data-wui-action]`,HTMLElement);if(!n||!this.contains(n)||z(n))return;let r=n.closest(M);switch(n.getAttribute(`data-wui-action`)){case`reply`:this._openReply(r,n);break;case`edit`:this._openEditor(r,n);break;case`delete`:this._askDelete(r);break;case`cancel-delete`:this._closeConfirm(r,!0);break;case`confirm-delete`:{let e=B(r,`comment`);this._send(`delete`,{commentId:e.getAttribute(`data-wui-comment`)},{comment:e,scope:e});break}case`react-menu`:this._pickerFor?.button===n?this._closePicker(!0):this._openPicker(r,n);break;case`cancel`:this._closeSlot(H(n,`[data-wui-reply], [data-wui-editor]`,HTMLElement),!0);break;case`post`:case`send`:this._sendFrom(n)}}_onKeyDown(e){let t=V(this,A,HTMLElement),n=R(e.target);if(this._pickerFor&&t?.contains(n)){let r=U(t,`[data-wui-emoji]`,HTMLElement),i=n instanceof HTMLElement?r.indexOf(n):-1;e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closePicker(!0)):e.key===`ArrowRight`||e.key===`ArrowLeft`?(e.preventDefault(),r[(i+(e.key===`ArrowRight`?1:-1)+r.length)%r.length]?.focus()):e.key===`Tab`&&this._closePicker(!1);return}if(e.key!==`Escape`)return;let r=H(n,`[data-wui-reply], [data-wui-editor]`,HTMLElement);if(r&&this.contains(r)){e.preventDefault(),e.stopPropagation(),this._closeSlot(r,!0);return}let i=H(n,`[data-wui-confirm]`,HTMLElement);i&&(e.preventDefault(),e.stopPropagation(),this._closeConfirm(i.closest(M),!0))}_onSubmitKey(e){let t=V(H(R(e.target),`[data-wui-reply], [data-wui-editor], [data-wui-composer]`,HTMLElement),`[data-wui-action="send"], [data-wui-action="post"]`,HTMLElement);t&&!z(t)&&this._sendFrom(t)}_openReply(e,t){if(this.hasAttribute(`no-replies`))return;let n=V(e,`:scope > [data-wui-reply]`,HTMLElement);if(!n)return;if(!n.hidden){n.querySelector(`wui-mention-input`)?.focus();return}let r=e?.querySelector(`.wui-comment-author`)?.textContent?.trim()||``;this._fillSlot(n,{label:(0,o.fillText)(P().replyToText,{author:r}),placeholder:P().replyPlaceholder,value:``,send:P().replyLabel,opener:t})}_openEditor(e,t){let n=V(e,`:scope > .wui-comment-row [data-wui-editor]`,HTMLElement);if(!n?.hidden)return;let r=V(B(n.parentElement,`comment row`),`:scope > [data-wui-text]`,HTMLElement);r&&(r.hidden=!0),this._fillSlot(n,{label:P().editCommentLabel,placeholder:``,value:e?.getAttribute(`data-value`)??``,send:P().saveLabel,opener:t})}_fillSlot(e,{label:t,placeholder:n,value:r,send:i,opener:a}){let o=this.ownerDocument,s=o.createElement(`wui-mention-input`);s.className=`wui-mention-input`,s.setAttribute(`label`,t),n&&s.setAttribute(`placeholder`,n),s.setAttribute(`rows`,`2`),s.setAttribute(`value`,r);for(let e of[`remote`,`source`,`min-chars`,`debounce`]){let t=this.getAttribute(e);t!=null&&s.setAttribute(e,t)}let c=o.createElement(`div`);c.className=`wui-comment-form-actions`,c.append(this._button(`primary`,`solid`,`sm`,`send`,i),this._button(`primary`,`ghost`,`sm`,`cancel`,P().cancelLabel));let l=o.createElement(`div`);l.className=`wui-comment-error`,l.setAttribute(`data-wui-error`,``),l.hidden=!0,e.replaceChildren(s,c,l),this._handPeople(s),e.hidden=!1,this._openers??=new WeakMap,this._openers.set(e,a),s.focus();let u=s.querySelector(`textarea`);u?.setSelectionRange(u.value.length,u.value.length)}_button(e,t,r,i,a){let o=this.ownerDocument.createElement(`button`);return o.type=`button`,o.className=(0,n.buttonClass)(e,t,r),o.dataset.wui=n.APP_BUTTON_MARKER,o.setAttribute(`data-wui-action`,i),o.textContent=a,o}_closeSlot(e,t){if(!e||e.hidden)return;if(e.hidden=!0,e.replaceChildren(),e.hasAttribute(`data-wui-editor`)){let t=V(e.parentElement,`:scope > [data-wui-text]`,HTMLElement);t&&(t.hidden=!1)}let n=this._openers?.get(e);t&&n?.isConnected&&n.focus()}_askDelete(e){let t=V(e,`:scope > .wui-comment-row`,HTMLElement),n=V(t,`[data-wui-confirm]`,HTMLElement),r=V(t,`[data-wui-actions]`,HTMLElement);n&&(n.hidden=!1,r&&(r.hidden=!0),V(n,`[data-wui-action="cancel-delete"]`,HTMLElement)?.focus())}_closeConfirm(e,t){let n=V(e,`:scope > .wui-comment-row`,HTMLElement),r=V(n,`[data-wui-confirm]`,HTMLElement),i=V(n,`[data-wui-actions]`,HTMLElement);r&&(r.hidden=!0),i&&(i.hidden=!1),t&&V(i,`[data-wui-action="delete"]`,HTMLElement)?.focus()}_openPicker(e,t){let n=V(this,A,HTMLElement);n&&e&&!this.hasAttribute(`no-reactions`)&&(this._closePicker(!1),this._pickerFor={comment:e,button:t},t.setAttribute(`aria-expanded`,`true`),(0,i.openAnchoredPopover)(t,n,{mode:`auto`,onClosed:()=>this._pickerClosed()}),V(n,`[data-wui-emoji]`,HTMLElement)?.focus())}_closePicker(e){let t=this._pickerFor;if(!t)return;let n=V(this,A,HTMLElement);n&&(0,i.closeAnchoredPopover)(n),this._pickerClosed(),e&&t.button.isConnected&&t.button.focus()}_pickerClosed(){let e=V(this,A,HTMLElement),t=this._pickerFor;!t||e&&(0,i.isPopoverOpen)(e)||(this._pickerFor=null,t.button.setAttribute(`aria-expanded`,`false`))}_react(e,t){t&&!this.hasAttribute(`no-reactions`)&&this._send(`react`,{commentId:e.getAttribute(`data-wui-comment`),emoji:t},{comment:e,scope:e})}_sendFrom(e){let t=H(e,`[data-wui-reply], [data-wui-editor], [data-wui-composer]`,HTMLElement);if(!t)return;let n=t.querySelector(`wui-mention-input`),r=n?.value??``;if(!r.trim()){this._showError(t,P().emptyBodyMessage),n?.focus();return}let i=t.closest(M);t.hasAttribute(`data-wui-composer`)?this._send(`post`,{body:r},{scope:t,form:t}):t.hasAttribute(`data-wui-reply`)?this._send(`reply`,{parentId:B(i,`comment`).getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t}):this._send(`edit`,{commentId:B(i,`comment`).getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t})}async _send(e,t,{comment:n,scope:r,form:i}){if(this._busy)return;this._busy=!0,this.setAttribute(`aria-busy`,`true`);let a=i??V(n,`:scope > .wui-comment-row`,HTMLElement)??this;this._showError(a,null);let o=[...r.querySelectorAll(`button, textarea`)].filter(e=>e instanceof HTMLButtonElement||e instanceof HTMLTextAreaElement).filter(e=>!e.disabled);for(let e of o)e.disabled=!0;let s=await this._persist({intent:e,...t});for(let e of o)e.isConnected&&(e.disabled=!1);this._busy=!1,this.removeAttribute(`aria-busy`);let c=t.commentId??null,l=t.parentId??null;s.ok?(s.html!=null&&this._swapItems(s.html),e===`post`?i?.querySelector(`wui-mention-input`)?.clear():i?.isConnected&&this._closeSlot(i,!1),e===`delete`&&n?.isConnected&&this._closeConfirm(n,!1),this._restoreFocus(e,t,i),I(e)&&this._announce(I(e)),this.dispatchEvent(new CustomEvent(`wui:comment-thread:done`,{bubbles:!0,detail:{intent:e,commentId:c,parentId:l}}))):s.kind!==`session`&&s.kind!==`aborted`&&(this._showError(a.isConnected?a:this,s.message),this._announce(s.message),this.dispatchEvent(new CustomEvent(`wui:comment-thread:failed`,{bubbles:!0,detail:{intent:e,kind:s.kind,message:s.message}})))}async _persist(e){if(this.hasAttribute(`controlled`)){if(typeof this.submit!=`function`)return{ok:!0,html:null};try{return await this.submit(e),{ok:!0,html:null}}catch(e){return{ok:!1,kind:`server`,message:L(e)}}}let t=this.getAttribute(`action`);if(!t)return{ok:!1,kind:`client`,message:P().failedClientMessage};let n=new URLSearchParams;for(let[t,r]of Object.entries(e))r!=null&&n.set(t,r);let r=await(0,a.wuiFetch)(t,{method:`POST`,body:n});return r.ok?{ok:!0,html:r.html}:{ok:!1,kind:r.kind,message:r.message||F(r.kind)||P().failedServerMessage}}_swapItems(e){let t=V(this,k,HTMLElement);if(!t||!e.trim())return;let n=this.ownerDocument.createElement(`template`);n.innerHTML=e;let r=V(n.content,k,HTMLElement);t.replaceChildren(...r?r.childNodes:n.content.childNodes)}_restoreFocus(e,t,n){let r=this.ownerDocument,i=r.activeElement;if(i&&i!==r.body&&i.isConnected&&this.contains(i)&&!z(i))return;let a=e=>e?U(this,M,HTMLElement).find(t=>t.getAttribute(`data-wui-comment`)===e):null,o=e=>V(a(e),`:scope > .wui-comment-row`,HTMLElement),s=null;if(e===`post`)s=n?.querySelector(`textarea`);else if(e===`reply`)s=V(o(t.parentId),`[data-wui-action="reply"]`,HTMLElement);else if(e===`edit`)s=V(o(t.commentId),`[data-wui-action="edit"]`,HTMLElement);else if(e===`react`){let e=o(t.commentId);s=U(e,`button[data-wui-emoji]`,HTMLButtonElement).find(e=>e.getAttribute(`data-wui-emoji`)===t.emoji)??V(e,`[data-wui-action="react-menu"]`,HTMLElement)}s??=V(this,`${j} textarea`,HTMLTextAreaElement),s?.focus()}_showError(e,t){let n=V(e,`:scope > [data-wui-error], :scope > .wui-comment-main > [data-wui-error]`,HTMLElement);n&&(n.textContent=t||``,n.hidden=!t)}_announce(e){let t=V(this,`:scope > ${N}`,HTMLElement);t&&e&&(t.textContent=``,t.textContent=e)}};(0,t.defineElement)(`wui-mention-input`,O),(0,t.defineElement)(`wui-comment-thread`,W),e.COMMENT_INTENTS=m,e.COMMENT_REACTIONS=p,e.WuiCommentThread=W})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.nativeOverlay,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.fieldState,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.listboxKeyNav,WeborityUiElementsInternal.modules.mentionText);
@@ -1 +1 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.164.0`)throw Error(`[webority-ui] consent-banner expects ui-elements 0.164.0 but the page loaded `+a+`.`);var o={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},s=e=>`var(${e}, ${o[e]})`,c=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${s(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${s(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${s(`--color-surface`)}; border: 1px solid ${s(`--color-border`)}; border-radius: ${s(`--wui-radius-lg`)}; box-shadow: ${s(`--wui-shadow-modal`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${s(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${s(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${s(`--color-primary-text`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${s(`--color-border`)}; border-bottom: 1px solid ${s(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${s(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${s(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${s(`--color-primary`)}; background: ${s(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${s(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${s(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${s(`--color-primary`)}; border-color: ${s(`--color-primary`)}; color: ${s(`--color-on-primary`)}; } .btn-primary:hover { background: ${s(`--color-primary-hover`)}; border-color: ${s(`--color-primary-hover`)}; } .btn-outline-neutral { border-color: ${s(`--color-text-muted`)}; color: ${s(`--color-text-muted`)}; } .btn-outline-neutral:hover { background: ${s(`--color-bg-muted`)}; color: ${s(`--color-text`)}; } .btn-link { font-weight: 400; color: ${s(`--color-primary-text`)}; text-decoration: underline; } .btn-link:hover { color: ${s(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } /* The actions are small buttons, which fall under the 44px touch target on touch screens. This sheet's .btn is inline-block, so it centres the label itself. */ @media (max-width: 575.98px), (pointer: coarse) { .wui-consent-banner-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } `,l=`data-wui-tour-open`,u=`wui-consent-save`,d=`[data-consent-settings]`,f=`tour-open`,p=`--wui-consent-banner-block`,m=`--wui-consent-banner-inline`,h={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},g=[`analytics`,`functional`,`marketing`],_={analytics:{label:h.analyticsLabel,description:`analyticsDescription`},functional:{label:h.functionalLabel,description:`functionalDescription`},marketing:{label:h.marketingLabel,description:`marketingDescription`}};function v(e){return g.some(t=>t===e)}var y=new Set;function b(e){y.has(e)||(y.add(e),(0,r.devWarn)(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${g.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var x=0,S=null;function C(e){S||(S=new CSSStyleSheet,S.replaceSync(c)),e.adoptedStyleSheets=[S]}var w=class extends i.ElementBase{_uid;_preferences;_settings;_onDocumentClick;_tourWatch;_roomObserver;_onWindowResize;_rendered;static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),x+=1,this._uid=`wui-consent-${x}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(d)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get preview(){return this.hasAttribute(`preview`)}set preview(e){this.toggleAttribute(`preview`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||h.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||h.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||h.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||h.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||h.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||h.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...g];let t=e.split(/\s+/).filter(Boolean);for(let e of t)v(e)||b(e);let n=g.filter(e=>t.includes(e));return n.length?n:[...g]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(g.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[l]}),this.preview&&!this.isOpen&&this.open(),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(f,document.documentElement.hasAttribute(l))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,t=this._uid,r=this.policyHref?` <a class="wui-consent-banner-policy" href="${D(this.policyHref)}">${E(this.policyLabel)}</a>`:``,i=this._root();i instanceof ShadowRoot&&C(i),i.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden> <h2 class="wui-consent-banner-heading" id="${t}-heading">${E(this.heading)}</h2> <p class="wui-consent-banner-description" id="${t}-description">${E(this.description)}${r}</p> <div class="wui-consent-banner-settings" hidden> ${T(t,`essential`,h.essentialLabel,h.essentialDescription,!0)} ${this.categories.map(e=>T(t,e,_[e].label,this[_[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${h.settingsLabel}</button> <button type="button" class="${(0,n.buttonClass)(`neutral`,`outline`,`sm`)} wui-consent-banner-reject" data-wui="${n.APP_BUTTON_MARKER}">${h.rejectLabel}</button> <button type="button" class="${(0,n.buttonClass)(`primary`,`solid`,`sm`)} wui-consent-banner-accept" data-wui="${n.APP_BUTTON_MARKER}">${h.acceptLabel}</button> <button type="button" class="${(0,n.buttonClass)(`primary`,`solid`,`sm`)} wui-consent-banner-save" hidden data-wui="${n.APP_BUTTON_MARKER}">${h.saveLabel}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._requirePanel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){if(this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._requirePanel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t){let t=e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`);t instanceof HTMLElement&&t.focus()}}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&!this.preview&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(p),document.documentElement.style.removeProperty(m)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(p,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(m,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){let e=this._root().querySelector(`.wui-consent-banner-panel`);return e instanceof HTMLElement?e:null}_requirePanel(){let e=this._panel();if(!e)throw Error(`consent banner panel is missing`);return e}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(u,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return{analytics:e&&t.includes(`analytics`),functional:e&&t.includes(`functional`),marketing:e&&t.includes(`marketing`)}}_switchValues(){let e={analytics:!1,functional:!1,marketing:!1};for(let t of g){let n=this._root().querySelector(`input[data-category="${t}"]`);e[t]=n instanceof HTMLInputElement&&n.checked}return e}_applyPreferences(){for(let e of g){let t=this._root().querySelector(`input[data-category="${e}"]`);t instanceof HTMLInputElement&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!(n instanceof HTMLElement))return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r instanceof HTMLElement&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r instanceof HTMLElement&&(r.hidden=e)}}};function T(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${E(n)}</label> </div> <p class="wui-consent-banner-category-description">${E(r)}</p> </div>`}var E=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),D=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-consent-banner`,w),e.WuiConsentBanner=w})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.167.0`)throw Error(`[webority-ui] consent-banner expects ui-elements 0.167.0 but the page loaded `+o+`.`);var s={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},c=e=>`var(${e}, ${s[e]})`,l=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${c(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${c(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${c(`--color-surface`)}; border: 1px solid ${c(`--color-border`)}; border-radius: ${c(`--wui-radius-lg`)}; box-shadow: ${c(`--wui-shadow-modal`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${c(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${c(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${c(`--color-primary-text`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${c(`--color-border`)}; border-bottom: 1px solid ${c(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${c(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${c(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${c(`--color-primary`)}; background: ${c(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${c(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${c(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${c(`--color-primary`)}; border-color: ${c(`--color-primary`)}; color: ${c(`--color-on-primary`)}; } .btn-primary:hover { background: ${c(`--color-primary-hover`)}; border-color: ${c(`--color-primary-hover`)}; } .btn-outline-neutral { border-color: ${c(`--color-text-muted`)}; color: ${c(`--color-text-muted`)}; } .btn-outline-neutral:hover { background: ${c(`--color-bg-muted`)}; color: ${c(`--color-text`)}; } .btn-link { font-weight: 400; color: ${c(`--color-primary-text`)}; text-decoration: underline; } .btn-link:hover { color: ${c(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } /* The actions are small buttons, which fall under the 44px touch target on touch screens. This sheet's .btn is inline-block, so it centres the label itself. */ @media (max-width: 575.98px), (pointer: coarse) { .wui-consent-banner-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } `,u={acceptLabel:`Accept all`,analyticsDescription:`Help us understand how visitors use the site.`,analyticsLabel:`Analytics cookies`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,essentialDescription:`Required for the site to work and stay secure. Always on.`,essentialLabel:`Essential cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,functionalLabel:`Functional cookies`,heading:`Cookies on this site`,marketingDescription:`Measure how well our campaigns work.`,marketingLabel:`Marketing cookies`,policyLabel:`Cookie policy`,rejectLabel:`Reject all`,saveLabel:`Save preferences`,settingsLabel:`Cookie settings`},d=`data-wui-tour-open`,f=`wui-consent-save`,p=`[data-consent-settings]`,m=`tour-open`,h=`--wui-consent-banner-block`,g=`--wui-consent-banner-inline`,_=()=>(0,a.readText)(`consentBanner`,u),v=[`analytics`,`functional`,`marketing`],y={analytics:{label:`analyticsLabel`,description:`analyticsDescription`},functional:{label:`functionalLabel`,description:`functionalDescription`},marketing:{label:`marketingLabel`,description:`marketingDescription`}};function b(e){return v.some(t=>t===e)}var x=new Set;function S(e){x.has(e)||(x.add(e),(0,r.devWarn)(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${v.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var C=0,w=null;function T(e){w||(w=new CSSStyleSheet,w.replaceSync(l)),e.adoptedStyleSheets=[w]}var E=class extends i.ElementBase{_uid;_preferences;_settings;_onDocumentClick;_tourWatch;_roomObserver;_onWindowResize;_rendered;static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),C+=1,this._uid=`wui-consent-${C}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(p)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get preview(){return this.hasAttribute(`preview`)}set preview(e){this.toggleAttribute(`preview`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||_().heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||_().description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||_().policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||_().analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||_().functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||_().marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...v];let t=e.split(/\s+/).filter(Boolean);for(let e of t)b(e)||S(e);let n=v.filter(e=>t.includes(e));return n.length?n:[...v]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(v.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[d]}),this.preview&&!this.isOpen&&this.open(),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(m,document.documentElement.hasAttribute(d))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,t=this._uid,r=this.policyHref?` <a class="wui-consent-banner-policy" href="${k(this.policyHref)}">${O(this.policyLabel)}</a>`:``,i=this._root();i instanceof ShadowRoot&&T(i),i.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden> <h2 class="wui-consent-banner-heading" id="${t}-heading">${O(this.heading)}</h2> <p class="wui-consent-banner-description" id="${t}-description">${O(this.description)}${r}</p> <div class="wui-consent-banner-settings" hidden> ${D(t,`essential`,_().essentialLabel,_().essentialDescription,!0)} ${this.categories.map(e=>D(t,e,_()[y[e].label],this[y[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${O(_().settingsLabel)}</button> <button type="button" class="${(0,n.buttonClass)(`neutral`,`outline`,`sm`)} wui-consent-banner-reject" data-wui="${n.APP_BUTTON_MARKER}">${O(_().rejectLabel)}</button> <button type="button" class="${(0,n.buttonClass)(`primary`,`solid`,`sm`)} wui-consent-banner-accept" data-wui="${n.APP_BUTTON_MARKER}">${O(_().acceptLabel)}</button> <button type="button" class="${(0,n.buttonClass)(`primary`,`solid`,`sm`)} wui-consent-banner-save" hidden data-wui="${n.APP_BUTTON_MARKER}">${O(_().saveLabel)}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._requirePanel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){if(this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._requirePanel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t){let t=e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`);t instanceof HTMLElement&&t.focus()}}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&!this.preview&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(h),document.documentElement.style.removeProperty(g)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(h,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(g,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){let e=this._root().querySelector(`.wui-consent-banner-panel`);return e instanceof HTMLElement?e:null}_requirePanel(){let e=this._panel();if(!e)throw Error(`consent banner panel is missing`);return e}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(f,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return{analytics:e&&t.includes(`analytics`),functional:e&&t.includes(`functional`),marketing:e&&t.includes(`marketing`)}}_switchValues(){let e={analytics:!1,functional:!1,marketing:!1};for(let t of v){let n=this._root().querySelector(`input[data-category="${t}"]`);e[t]=n instanceof HTMLInputElement&&n.checked}return e}_applyPreferences(){for(let e of v){let t=this._root().querySelector(`input[data-category="${e}"]`);t instanceof HTMLInputElement&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!(n instanceof HTMLElement))return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r instanceof HTMLElement&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r instanceof HTMLElement&&(r.hidden=e)}}};function D(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${O(n)}</label> </div> <p class="wui-consent-banner-category-description">${O(r)}</p> </div>`}var O=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),k=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-consent-banner`,E),e.WuiConsentBanner=E})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.textStore);
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.164.0`)throw Error(`[webority-ui] context-menu expects ui-elements 0.164.0 but the page loaded `+o+`.`);var s=`[role="menuitem"]`,c=`.wui-context-menu-sub`,l=`input.wui-context-menu-search`,u=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,d=500,f=10,p=400,m=null,h=null,g=0;function _(e,t,n){let r=document.createElement(`span`);return r.setAttribute(`aria-hidden`,`true`),r.style.cssText=n?`position:absolute;left:${e+window.scrollX}px;top:${t+window.scrollY}px;width:0;height:0;`:`position:fixed;left:${e}px;top:${t}px;width:0;height:0;`,document.body.append(r),r}var v=new WeakMap;function y(e,t,n){let r=v.get(e);if(r){if(r.region===t||t.contains(r.region))return!1;r.cancel()}return v.set(e,{region:t,cancel:n}),!0}var b=e=>e instanceof Element?e:e instanceof Node?e.parentElement:null,x=e=>`focus`in e,S=e=>[...e.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE||e instanceof Element&&!e.matches(`.wui-context-menu-hint, .wui-context-menu-tick`)).map(e=>e.textContent).join(``),C=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),w=e=>[...e.children].filter(e=>e instanceof HTMLElement),T=(e,t)=>{let n=e.children[t];if(!(n instanceof HTMLElement))throw Error(`a submenu holds its opener and then its panel`);return n},E=e=>T(e,0),D=e=>T(e,1),O=(e,t)=>{let n=e?.closest(t);return n instanceof HTMLElement?n:null},k=class extends n.ElementBase{_region;_origin;_returnFocus;_press;_swallowClick;_unbindKeys;_anchor;_closingByKey;_onContextMenu;_onContextMenuCapture;_onDocKeyDown;_onDocClick;_onPointerDown;_onPressMove;_onPressEnd;_onClickCapture;_onKeyDown;_onClick;_onInput;_onMouseMove;_onDismiss;_onPointerDownCapture;static get observedAttributes(){return[`disabled`,`open`]}constructor(){super(),this._region=null,this._origin=null,this._returnFocus=null,this._press=null,this._swallowClick=!1,this._unbindKeys=null,this._anchor=null,this._closingByKey=!1,this._onContextMenu=e=>this._handleContextMenu(e),this._onContextMenuCapture=e=>{this.isOpen&&!this._inPanel(e.target)&&!this._isKeyEcho()&&this.close()},this._onDocKeyDown=e=>this._handleDocKeyDown(e),this._onDocClick=e=>this._handleDocClick(e),this._onPointerDown=e=>this._handlePointerDown(e),this._onPressMove=e=>{this._press&&Math.hypot(e.clientX-this._press.x,e.clientY-this._press.y)>f&&this._cancelPress()},this._onPressEnd=()=>this._cancelPress(),this._onClickCapture=e=>{if(this._swallowClick&&this._region){if(!(e.target instanceof Node))throw Error(`a click target is always a node`);this._region.contains(e.target)&&(this._swallowClick=!1,e.preventDefault(),e.stopImmediatePropagation())}},this._onKeyDown=e=>{if(this.isOpen&&this._inPanel(e.target)){if(e.key===`Escape`){if(e.stopPropagation(),this.hasAttribute(`open`)&&O(b(e.target),`[role="menu"]`)===this._panel()){e.preventDefault(),this.close(!0);return}this._closingByKey=!0}this._handleMenuKey(e)}},this._onClick=e=>this._handleClick(e),this._onInput=e=>this._handleInput(e),this._onMouseMove=e=>{let t=O(b(e.target),s);t&&this._inPanel(t)&&!this._isDisabled(t)&&t!==document.activeElement&&t.focus({preventScroll:!0})},this._onDismiss=e=>{this.hasAttribute(`open`)||e.type===`scroll`&&this._inPanel(e.target)||this.close()},this._onPointerDownCapture=()=>{this._swallowClick=!1}}connectedCallback(){this._teardown(),document.addEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.addEventListener(`contextmenu`,this._onContextMenu),document.addEventListener(`keydown`,this._onDocKeyDown),document.addEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.addEventListener(`pointerdown`,this._onPointerDown),document.addEventListener(`click`,this._onClickCapture,!0),document.addEventListener(`click`,this._onDocClick),window.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick),this.addEventListener(`input`,this._onInput),this.addEventListener(`mousemove`,this._onMouseMove),this._syncOpen()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){e===`open`?this.isConnected&&this._syncOpen():this.disabled&&this.close()}get target(){return this.getAttribute(`target`)}set target(e){e==null||e===``?this.removeAttribute(`target`):this.setAttribute(`target`,String(e))}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get isOpen(){let e=this._panel();return!!e&&(0,a.isPopoverOpen)(e)}open(e,t,{region:n=this,origin:r=n,trigger:o=null,keyboard:s=!1}={}){let c=this._panel();if(!c)return!1;let l=new CustomEvent(`wui-context-menu:beforeopen`,{bubbles:!0,cancelable:!0,detail:{region:n,origin:r,trigger:o}});if(this.dispatchEvent(l),l.defaultPrevented)return!1;if(this._decorate(c),m&&m!==this&&m.close(!0),!this.isOpen){let e=document.activeElement;this._returnFocus=e&&e!==document.body&&!this._inPanel(e)&&x(e)?e:null}this._region=n,this._origin=r,h=null,m=this,this._unbindKeys?.(),this._unbindKeys=(0,i.bindMenuKeys)(c,{items:()=>this._menuRows()}),this._anchor?.remove();let u=this.hasAttribute(`open`);return this._anchor=_(e,t,u),(0,a.openAnchoredPopover)(this._anchor,c,{mode:u?`manual`:`auto`,keepOffscreen:u,clampHeight:!0,onClosed:()=>this._onPanelClosed()}),window.addEventListener(`scroll`,this._onDismiss,!0),window.addEventListener(`resize`,this._onDismiss),window.addEventListener(`blur`,this._onDismiss),((s?this._rowsOf(c)[0]:null)??c).focus({preventScroll:!0}),this.dispatchEvent(new CustomEvent(`wui-context-menu:open`,{bubbles:!0,detail:{region:n,origin:r,x:e,y:t}})),!0}_syncOpen(){if(!this.hasAttribute(`open`)){this.close(this._inPanel(document.activeElement));return}let e=this.target?document.querySelector(this.target):this,t=e&&this._regionRect(e);e&&t&&this.open(t.left,t.top,{region:e,origin:e})}_regionRect(e){if(e!==this)return e.getBoundingClientRect();let t=[...this.children].filter(e=>e!==this._panel()).map(e=>e.getBoundingClientRect());return t.length?{left:Math.min(...t.map(e=>e.left)),top:Math.min(...t.map(e=>e.top))}:null}close(e=!1){let t=this._panel();t&&(0,a.isPopoverOpen)(t)&&(e&&(this._closingByKey=!0),(0,a.closeAnchoredPopover)(t))}_finish(e){let t=this._panel();if(t)for(let e of C(t,c))this._setSub(e,!1);m===this&&(m=null),window.removeEventListener(`scroll`,this._onDismiss,!0),window.removeEventListener(`resize`,this._onDismiss),window.removeEventListener(`blur`,this._onDismiss),this._unbindKeys?.(),this._unbindKeys=null,this._anchor?.remove(),this._anchor=null;let n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&n.focus({preventScroll:!0})}_onPanelClosed(){let e=this._panel();if(!e||(0,a.isPopoverOpen)(e))return;let t=this._closingByKey;this._closingByKey=!1,this._finish(t)}_menuRows(){let e=b(document.activeElement);if(!e||e.matches(l))return[];let t=O(e,`[role="menu"]`);return t?this._rowsOf(t):[]}_panel(){return w(this).find(e=>e.getAttribute(`role`)===`menu`)??null}_inPanel(e){return e instanceof Node&&!!this._panel()?.contains(e)}_rowsOf(e){return e?C(e,s).filter(t=>t.closest(`[role="menu"]`)===e&&!this._isDisabled(t)&&!t.closest(`[hidden]`)):[]}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_regionFor(e){let t=b(e);if(!t||this.disabled||!this._panel()||this._inPanel(t)||t.closest(u))return null;let n=this.target;return n?t.closest(n):this.contains(t)?this:null}_triggerFor(e){let t=b(e),n=this.getAttribute(`trigger`);if(!t||!n||this._inPanel(t))return null;let r=O(t,n),i=r&&this._regionFor(r);return r&&i?{trigger:r,region:i}:null}_isKeyEcho(){return h?.menu===this&&this.isOpen&&performance.now()-h.at<p}_handleContextMenu(e){if(this._inPanel(e.target)){e.preventDefault();return}if(e.defaultPrevented&&!v.has(e))return;let t=this._regionFor(e.target);t&&(this._isKeyEcho()?e.preventDefault():e.shiftKey||y(e,t,()=>this.close(!0))&&this.open(e.clientX,e.clientY,{region:t,origin:b(e.target)})&&e.preventDefault())}_handleDocKeyDown(e){if(e.defaultPrevented&&!v.has(e))return;if((0,r.isImeSafeEnter)(e)){let t=this._triggerFor(e.target);if(!t||!y(e,t.region,()=>this.close(!0)))return;e.preventDefault(),t.trigger.click();return}if(!(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)||this._inPanel(e.target))return;let t=this._regionFor(e.target);if(!t||!y(e,t,()=>this.close(!0)))return;let n=b(e.target);if(!n)return;let i=n.getBoundingClientRect();this.open(i.left+Math.min(16,i.width/2),i.bottom,{region:t,origin:n,keyboard:!0})&&(e.preventDefault(),h={menu:this,at:performance.now()})}_handleDocClick(e){let t=this._triggerFor(e.target);if(!t||!y(e,t.region,()=>this.close(!0)))return;let n=t.trigger.getBoundingClientRect();this.open(n.left,n.bottom,{region:t.region,origin:t.trigger,trigger:t.trigger,keyboard:e.detail===0})}_handlePointerDown(e){if(e.pointerType!==`touch`)return;let t=this._regionFor(e.target);if(!t||!y(e,t,()=>this._cancelPress()))return;this._cancelPress();let{clientX:n,clientY:r}=e,i=b(e.target);this._press={x:n,y:r,timer:setTimeout(()=>{this._cancelPress(),this.open(n,r,{region:t,origin:i})&&(this._swallowClick=!0)},d)},document.addEventListener(`pointermove`,this._onPressMove,{passive:!0}),document.addEventListener(`pointerup`,this._onPressEnd),document.addEventListener(`pointercancel`,this._onPressEnd),window.addEventListener(`scroll`,this._onPressEnd,!0)}_cancelPress(){this._press&&(clearTimeout(this._press.timer),this._press=null,document.removeEventListener(`pointermove`,this._onPressMove),document.removeEventListener(`pointerup`,this._onPressEnd),document.removeEventListener(`pointercancel`,this._onPressEnd),window.removeEventListener(`scroll`,this._onPressEnd,!0))}_handleMenuKey(e){if(!this.isOpen)return;let t=b(e.target);if(!t)return;if(t.matches(l)){this._handleSearchKey(e,t);return}let n=O(t,`[role="menu"]`);if(!n)return;let i=O(t,s),a=n.matches(`.wui-context-menu-subpanel`)?n.parentElement:null;if(e.key===`Tab`)this.close(!0);else if(e.key===`ArrowRight`){let t=i&&this._subOf(i);if(!t)return;e.preventDefault(),this._openSub(t,!0)}else if(e.key===`ArrowLeft`){if(!a)return;e.preventDefault(),this._closeSubByKey(a)}else((0,r.isImeSafeEnter)(e)||e.key===` `)&&(e.preventDefault(),i?.click())}_handleSearchKey(e,t){let n=O(t,c);if(!n)return;let r=this._rowsOf(D(n));e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closeSubByKey(n)):e.key===`ArrowDown`?(e.preventDefault(),r[0]?.focus({preventScroll:!0})):e.key===`ArrowUp`?(e.preventDefault(),r[r.length-1]?.focus({preventScroll:!0})):e.key===`Tab`&&this.close(!0)}_subOf(e){return e.hasAttribute(`aria-haspopup`)&&e.parentElement?.matches(c)?e.parentElement:null}_openSub(e,t){let n=e.parentElement;if(!n)throw Error(`a submenu is always inside its menu panel`);for(let t of w(n))t!==e&&t.matches(c)&&this._closeSub(t);this._setSub(e,!0);let r=D(e).querySelector(`:scope > ${l}`),i=e.hasAttribute(`data-searchable`)&&r instanceof HTMLInputElement?r:null;i?(i.value=``,this._filter(e,``),i.focus({preventScroll:!0})):t&&this._rowsOf(D(e))[0]?.focus({preventScroll:!0})}_closeSub(e){for(let t of C(D(e),c))this._setSub(t,!1);this._setSub(e,!1)}_closeSubByKey(e){this._closeSub(e),E(e).focus({preventScroll:!0})}_setSub(e,t){let n=D(e);t?((0,a.openAnchoredPopover)(E(e),n,{mode:`auto`,beside:!0,onClosed:()=>this._onSubClosed(e)}),E(e).setAttribute(`aria-expanded`,String((0,a.isPopoverOpen)(n)))):(0,a.isPopoverOpen)(n)?(0,a.closeAnchoredPopover)(n):this._onSubClosed(e)}_onSubClosed(e){let t=D(e);if((0,a.isPopoverOpen)(t))return;let n=E(e);n.setAttribute(`aria-expanded`,`false`),t.removeAttribute(`data-side`);let r=this._closingByKey;this._closingByKey=!1,r&&n.focus({preventScroll:!0})}_filter(e,t){let n=t.trim().toLowerCase();for(let t of w(D(e)))t.tagName===`HR`?t.hidden=n!==``:t.matches(s)?t.hidden=n!==``&&!S(t).toLowerCase().includes(n):t.matches(c)&&(t.hidden=n!==``&&!S(E(t)).toLowerCase().includes(n))}_handleInput(e){let t=b(e.target)?.closest(l);if(!(t instanceof HTMLInputElement))return;let n=O(t,c);n?.hasAttribute(`data-searchable`)&&this._inPanel(n)&&this._filter(n,t.value)}_decorate(e){for(let t of C(e,s)){let e=t.getAttribute(`aria-checked`)===`true`,n=t.querySelector(`:scope > .wui-context-menu-tick`);if(e&&!n){let e=document.createElement(`span`);e.className=`wui-context-menu-tick`,e.setAttribute(`aria-hidden`,`true`),t.prepend(e)}else!e&&n&&n.remove();let r=t.querySelector(`:scope > .wui-context-menu-hint`),i=t.dataset.hint;if(i){let e=r??document.createElement(`span`);r||(e.className=`wui-context-menu-hint`,e.id=`wui-context-menu-hint-${++g}`,t.append(e)),e.textContent=i,t.setAttribute(`aria-describedby`,e.id)}else r&&(r.remove(),t.removeAttribute(`aria-describedby`))}}_handleClick(e){let t=O(b(e.target),s);if(!t||!this._inPanel(t))return;if(this._isDisabled(t)){e.preventDefault(),e.stopPropagation();return}let n=this._subOf(t);n?(e.preventDefault(),this._openSub(n,e.detail===0)):(this.close(!0),this.dispatchEvent(new CustomEvent(`wui-context-menu:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,region:this._region,origin:this._origin}})))}_teardown(){let e=this._panel();if(this._closingByKey=!1,e){for(let t of[...C(e,c)].reverse())(0,a.closeAnchoredPopover)(D(t));(0,a.closeAnchoredPopover)(e)}this._anchor&&this._finish(!1),this._cancelPress(),document.removeEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.removeEventListener(`contextmenu`,this._onContextMenu),document.removeEventListener(`keydown`,this._onDocKeyDown),document.removeEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.removeEventListener(`pointerdown`,this._onPointerDown),document.removeEventListener(`click`,this._onClickCapture,!0),document.removeEventListener(`click`,this._onDocClick),window.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`input`,this._onInput),this.removeEventListener(`mousemove`,this._onMouseMove)}};(0,t.defineElement)(`wui-context-menu`,k),e.WuiContextMenu=k})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.menuKeyNav,WeborityUiElementsInternal.modules.nativeOverlay);
1
+ (function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=globalThis.WeborityUiElementsInternal?.version;if(s!==`0.167.0`)throw Error(`[webority-ui] context-menu expects ui-elements 0.167.0 but the page loaded `+s+`.`);var c=`[role="menuitem"]`,l=`.wui-context-menu-sub`,u=`input.wui-context-menu-search`,d=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,f=500,p=10,m=400,h=null,g=null,_=0;function v(e,t,n){let r=document.createElement(`span`);return r.setAttribute(`aria-hidden`,`true`),r.style.cssText=n?`position:absolute;left:${e+window.scrollX}px;top:${t+window.scrollY}px;width:0;height:0;`:`position:fixed;left:${e}px;top:${t}px;width:0;height:0;`,document.body.append(r),r}var y=new WeakMap;function b(e,t,n){let r=y.get(e);if(r){if(r.region===t||t.contains(r.region))return!1;r.cancel()}return y.set(e,{region:t,cancel:n}),!0}var x=e=>e instanceof Element?e:e instanceof Node?e.parentElement:null,S=e=>`focus`in e,C=e=>[...e.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE||e instanceof Element&&!e.matches(`.wui-context-menu-hint, .wui-context-menu-tick`)).map(e=>e.textContent).join(``),w=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),T=e=>[...e.children].filter(e=>e instanceof HTMLElement),E=(e,t)=>{let n=e.children[t];if(!(n instanceof HTMLElement))throw Error(`a submenu holds its opener and then its panel`);return n},D=e=>E(e,0),O=e=>E(e,1),k=(e,t)=>{let n=e?.closest(t);return n instanceof HTMLElement?n:null},A=class extends n.ElementBase{_region;_origin;_returnFocus;_press;_swallowClick;_unbindKeys;_anchor;_closingByKey;_onContextMenu;_onContextMenuCapture;_onDocKeyDown;_onDocClick;_onPointerDown;_onPressMove;_onPressEnd;_onClickCapture;_onKeyDown;_onClick;_onInput;_onMouseMove;_onDismiss;_onPointerDownCapture;static get observedAttributes(){return[`disabled`,`open`]}constructor(){super(),this._region=null,this._origin=null,this._returnFocus=null,this._press=null,this._swallowClick=!1,this._unbindKeys=null,this._anchor=null,this._closingByKey=!1,this._onContextMenu=e=>this._handleContextMenu(e),this._onContextMenuCapture=e=>{this.isOpen&&!this._inPanel(e.target)&&!this._isKeyEcho()&&this.close()},this._onDocKeyDown=e=>this._handleDocKeyDown(e),this._onDocClick=e=>this._handleDocClick(e),this._onPointerDown=e=>this._handlePointerDown(e),this._onPressMove=e=>{this._press&&Math.hypot(e.clientX-this._press.x,e.clientY-this._press.y)>p&&this._cancelPress()},this._onPressEnd=()=>this._cancelPress(),this._onClickCapture=e=>{if(this._swallowClick&&this._region){if(!(e.target instanceof Node))throw Error(`a click target is always a node`);this._region.contains(e.target)&&(this._swallowClick=!1,e.preventDefault(),e.stopImmediatePropagation())}},this._onKeyDown=e=>{if(this.isOpen&&this._inPanel(e.target)){if(e.key===`Escape`){if(e.stopPropagation(),this.hasAttribute(`open`)&&k(x(e.target),`[role="menu"]`)===this._panel()){e.preventDefault(),this.close(!0);return}this._closingByKey=!0}this._handleMenuKey(e)}},this._onClick=e=>this._handleClick(e),this._onInput=e=>this._handleInput(e),this._onMouseMove=e=>{let t=k(x(e.target),c);t&&this._inPanel(t)&&!this._isDisabled(t)&&t!==document.activeElement&&t.focus({preventScroll:!0})},this._onDismiss=e=>{this.hasAttribute(`open`)||e.type===`scroll`&&this._inPanel(e.target)||this.close()},this._onPointerDownCapture=()=>{this._swallowClick=!1}}connectedCallback(){this._teardown(),document.addEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.addEventListener(`contextmenu`,this._onContextMenu),document.addEventListener(`keydown`,this._onDocKeyDown),document.addEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.addEventListener(`pointerdown`,this._onPointerDown),document.addEventListener(`click`,this._onClickCapture,!0),document.addEventListener(`click`,this._onDocClick),window.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick),this.addEventListener(`input`,this._onInput),this.addEventListener(`mousemove`,this._onMouseMove),this._syncOpen()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){e===`open`?this.isConnected&&this._syncOpen():this.disabled&&this.close()}get target(){return this.getAttribute(`target`)}set target(e){e==null||e===``?this.removeAttribute(`target`):this.setAttribute(`target`,String(e))}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get isOpen(){let e=this._panel();return!!e&&(0,o.isPopoverOpen)(e)}open(e,t,{region:n=this,origin:r=n,trigger:i=null,keyboard:s=!1}={}){let c=this._panel();if(!c)return!1;let l=new CustomEvent(`wui-context-menu:beforeopen`,{bubbles:!0,cancelable:!0,detail:{region:n,origin:r,trigger:i}});if(this.dispatchEvent(l),l.defaultPrevented)return!1;if(this._decorate(c),h&&h!==this&&h.close(!0),!this.isOpen){let e=document.activeElement;this._returnFocus=e&&e!==document.body&&!this._inPanel(e)&&S(e)?e:null}this._region=n,this._origin=r,g=null,h=this,this._unbindKeys?.(),this._unbindKeys=(0,a.bindMenuKeys)(c,{items:()=>this._menuRows()}),this._anchor?.remove();let u=this.hasAttribute(`open`);return this._anchor=v(e,t,u),(0,o.openAnchoredPopover)(this._anchor,c,{mode:u?`manual`:`auto`,keepOffscreen:u,clampHeight:!0,onClosed:()=>this._onPanelClosed()}),window.addEventListener(`scroll`,this._onDismiss,!0),window.addEventListener(`resize`,this._onDismiss),window.addEventListener(`blur`,this._onDismiss),queueMicrotask(()=>{(0,o.isPopoverOpen)(c)&&((s?this._rowsOf(c)[0]:null)??c).focus({preventScroll:!0})}),this.dispatchEvent(new CustomEvent(`wui-context-menu:open`,{bubbles:!0,detail:{region:n,origin:r,x:e,y:t}})),!0}_syncOpen(){if(!this.hasAttribute(`open`)){this.close(this._inPanel(document.activeElement));return}let e=this.target?document.querySelector(this.target):this,t=e&&this._regionRect(e);e&&t&&this.open(t.left,t.top,{region:e,origin:e})}_regionRect(e){if(e!==this)return e.getBoundingClientRect();let t=[...this.children].filter(e=>e!==this._panel()).map(e=>e.getBoundingClientRect());return t.length?{left:Math.min(...t.map(e=>e.left)),top:Math.min(...t.map(e=>e.top))}:null}close(e=!1){let t=this._panel();t&&(0,o.isPopoverOpen)(t)&&(e&&(this._closingByKey=!0),(0,o.closeAnchoredPopover)(t))}_finish(e){let t=this._panel();if(t)for(let e of w(t,l))this._setSub(e,!1);h===this&&(h=null),window.removeEventListener(`scroll`,this._onDismiss,!0),window.removeEventListener(`resize`,this._onDismiss),window.removeEventListener(`blur`,this._onDismiss),this._unbindKeys?.(),this._unbindKeys=null,this._anchor?.remove(),this._anchor=null;let n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&n.focus({preventScroll:!0})}_onPanelClosed(){let e=this._panel();if(!e||(0,o.isPopoverOpen)(e))return;let t=this._closingByKey;this._closingByKey=!1,this._finish(t)}_menuRows(){let e=x(document.activeElement);if(!e||e.matches(u))return[];let t=k(e,`[role="menu"]`);return t?this._rowsOf(t):[]}_panel(){return T(this).find(e=>e.getAttribute(`role`)===`menu`)??null}_inPanel(e){return e instanceof Node&&!!this._panel()?.contains(e)}_rowsOf(e){return e?w(e,c).filter(t=>t.closest(`[role="menu"]`)===e&&!this._isDisabled(t)&&(0,i.isDrawn)(t)):[]}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_regionFor(e){let t=x(e);if(!t||this.disabled||!this._panel()||this._inPanel(t)||t.closest(d))return null;let n=this.target;return n?t.closest(n):this.contains(t)?this:null}_triggerFor(e){let t=x(e),n=this.getAttribute(`trigger`);if(!t||!n||this._inPanel(t))return null;let r=k(t,n),i=r&&this._regionFor(r);return r&&i?{trigger:r,region:i}:null}_isKeyEcho(){return g?.menu===this&&this.isOpen&&performance.now()-g.at<m}_handleContextMenu(e){if(this._inPanel(e.target)){e.preventDefault();return}if(e.defaultPrevented&&!y.has(e))return;let t=this._regionFor(e.target);t&&(this._isKeyEcho()?e.preventDefault():e.shiftKey||b(e,t,()=>this.close(!0))&&this.open(e.clientX,e.clientY,{region:t,origin:x(e.target)})&&e.preventDefault())}_handleDocKeyDown(e){if(e.defaultPrevented&&!y.has(e))return;if((0,r.isImeSafeEnter)(e)){let t=this._triggerFor(e.target);if(!t||!b(e,t.region,()=>this.close(!0)))return;e.preventDefault(),t.trigger.click();return}if(!(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)||this._inPanel(e.target))return;let t=this._regionFor(e.target);if(!t||!b(e,t,()=>this.close(!0)))return;let n=x(e.target);if(!n)return;let i=n.getBoundingClientRect();this.open(i.left+Math.min(16,i.width/2),i.bottom,{region:t,origin:n,keyboard:!0})&&(e.preventDefault(),g={menu:this,at:performance.now()})}_handleDocClick(e){let t=this._triggerFor(e.target);if(!t||!b(e,t.region,()=>this.close(!0)))return;let n=t.trigger.getBoundingClientRect();this.open(n.left,n.bottom,{region:t.region,origin:t.trigger,trigger:t.trigger,keyboard:e.detail===0})}_handlePointerDown(e){if(e.pointerType!==`touch`)return;let t=this._regionFor(e.target);if(!t||!b(e,t,()=>this._cancelPress()))return;this._cancelPress();let{clientX:n,clientY:r}=e,i=x(e.target);this._press={x:n,y:r,timer:setTimeout(()=>{this._cancelPress(),this.open(n,r,{region:t,origin:i})&&(this._swallowClick=!0)},f)},document.addEventListener(`pointermove`,this._onPressMove,{passive:!0}),document.addEventListener(`pointerup`,this._onPressEnd),document.addEventListener(`pointercancel`,this._onPressEnd),window.addEventListener(`scroll`,this._onPressEnd,!0)}_cancelPress(){this._press&&(clearTimeout(this._press.timer),this._press=null,document.removeEventListener(`pointermove`,this._onPressMove),document.removeEventListener(`pointerup`,this._onPressEnd),document.removeEventListener(`pointercancel`,this._onPressEnd),window.removeEventListener(`scroll`,this._onPressEnd,!0))}_handleMenuKey(e){if(!this.isOpen)return;let t=x(e.target);if(!t)return;if(t.matches(u)){this._handleSearchKey(e,t);return}let n=k(t,`[role="menu"]`);if(!n)return;let i=k(t,c),a=n.matches(`.wui-context-menu-subpanel`)?n.parentElement:null;if(e.key===`Tab`)this.close(!0);else if(e.key===`ArrowRight`){let t=i&&this._subOf(i);if(!t)return;e.preventDefault(),this._openSub(t,!0)}else if(e.key===`ArrowLeft`){if(!a)return;e.preventDefault(),this._closeSubByKey(a)}else((0,r.isImeSafeEnter)(e)||e.key===` `)&&(e.preventDefault(),i?.click())}_handleSearchKey(e,t){let n=k(t,l);if(!n)return;let r=this._rowsOf(O(n));e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closeSubByKey(n)):e.key===`ArrowDown`?(e.preventDefault(),r[0]?.focus({preventScroll:!0})):e.key===`ArrowUp`?(e.preventDefault(),r[r.length-1]?.focus({preventScroll:!0})):e.key===`Tab`&&this.close(!0)}_subOf(e){return e.hasAttribute(`aria-haspopup`)&&e.parentElement?.matches(l)?e.parentElement:null}_openSub(e,t){let n=e.parentElement;if(!n)throw Error(`a submenu is always inside its menu panel`);for(let t of T(n))t!==e&&t.matches(l)&&this._closeSub(t);this._setSub(e,!0);let r=O(e).querySelector(`:scope > ${u}`),i=e.hasAttribute(`data-searchable`)&&r instanceof HTMLInputElement?r:null;i?(i.value=``,this._filter(e,``),i.focus({preventScroll:!0})):t&&this._rowsOf(O(e))[0]?.focus({preventScroll:!0})}_closeSub(e){for(let t of w(O(e),l))this._setSub(t,!1);this._setSub(e,!1)}_closeSubByKey(e){this._closeSub(e),D(e).focus({preventScroll:!0})}_setSub(e,t){let n=O(e);t?((0,o.openAnchoredPopover)(D(e),n,{mode:`auto`,beside:!0,onClosed:()=>this._onSubClosed(e)}),D(e).setAttribute(`aria-expanded`,String((0,o.isPopoverOpen)(n)))):(0,o.isPopoverOpen)(n)?(0,o.closeAnchoredPopover)(n):this._onSubClosed(e)}_onSubClosed(e){let t=O(e);if((0,o.isPopoverOpen)(t))return;let n=D(e);n.setAttribute(`aria-expanded`,`false`),t.removeAttribute(`data-side`);let r=this._closingByKey;this._closingByKey=!1,r&&n.focus({preventScroll:!0})}_filter(e,t){let n=t.trim().toLowerCase();for(let t of T(O(e)))t.tagName===`HR`?t.hidden=n!==``:t.matches(c)?t.hidden=n!==``&&!C(t).toLowerCase().includes(n):t.matches(l)&&(t.hidden=n!==``&&!C(D(t)).toLowerCase().includes(n))}_handleInput(e){let t=x(e.target)?.closest(u);if(!(t instanceof HTMLInputElement))return;let n=k(t,l);n?.hasAttribute(`data-searchable`)&&this._inPanel(n)&&this._filter(n,t.value)}_decorate(e){for(let t of w(e,c)){let e=t.getAttribute(`aria-checked`)===`true`,n=t.querySelector(`:scope > .wui-context-menu-tick`);if(e&&!n){let e=document.createElement(`span`);e.className=`wui-context-menu-tick`,e.setAttribute(`aria-hidden`,`true`),t.prepend(e)}else!e&&n&&n.remove();let r=t.querySelector(`:scope > .wui-context-menu-hint`),i=t.dataset.hint;if(i){let e=r??document.createElement(`span`);r||(e.className=`wui-context-menu-hint`,e.id=`wui-context-menu-hint-${++_}`,t.append(e)),e.textContent=i,t.setAttribute(`aria-describedby`,e.id)}else r&&(r.remove(),t.removeAttribute(`aria-describedby`))}}_handleClick(e){let t=k(x(e.target),c);if(!t||!this._inPanel(t))return;if(this._isDisabled(t)){e.preventDefault(),e.stopPropagation();return}let n=this._subOf(t);n?(e.preventDefault(),this._openSub(n,e.detail===0)):(this.close(!0),this.dispatchEvent(new CustomEvent(`wui-context-menu:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,region:this._region,origin:this._origin}})))}_teardown(){let e=this._panel();if(this._closingByKey=!1,e){for(let t of[...w(e,l)].reverse())(0,o.closeAnchoredPopover)(O(t));(0,o.closeAnchoredPopover)(e)}this._anchor&&this._finish(!1),this._cancelPress(),document.removeEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.removeEventListener(`contextmenu`,this._onContextMenu),document.removeEventListener(`keydown`,this._onDocKeyDown),document.removeEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.removeEventListener(`pointerdown`,this._onPointerDown),document.removeEventListener(`click`,this._onClickCapture,!0),document.removeEventListener(`click`,this._onDocClick),window.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`input`,this._onInput),this.removeEventListener(`mousemove`,this._onMouseMove)}};(0,t.defineElement)(`wui-context-menu`,A),e.WuiContextMenu=A})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.isDrawn,WeborityUiElementsInternal.modules.menuKeyNav,WeborityUiElementsInternal.modules.nativeOverlay);