monobill-mintui 0.6.612 → 0.6.613
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.
- package/README.md +76 -302
- package/bin/component-dependencies.json +131 -0
- package/bin/mint-ui.js +446 -0
- package/dist/alert.css +3 -0
- package/dist/back-button.css +3 -0
- package/dist/bottom-navigation.css +3 -0
- package/dist/button.css +3 -0
- package/dist/card.css +3 -0
- package/dist/chart.css +3 -0
- package/dist/checkbox.css +3 -0
- package/dist/chip.css +3 -0
- package/dist/choice.css +3 -0
- package/dist/clickable.css +3 -0
- package/dist/collapsible.css +3 -0
- package/dist/components/alert/Alert.d.ts +1 -32
- package/dist/components/alert/Alert.d.ts.map +10 -1
- package/dist/components/alert/browser.js +167 -0
- package/dist/components/alert/index.cjs +1 -0
- package/dist/components/alert/index.d.ts +1 -3
- package/dist/components/alert/index.d.ts.map +10 -1
- package/dist/components/alert/index.js +155 -0
- package/dist/components/back-button/BackButton.d.ts +1 -18
- package/dist/components/back-button/BackButton.d.ts.map +10 -1
- package/dist/components/back-button/browser.js +241 -0
- package/dist/components/back-button/index.cjs +1 -0
- package/dist/components/back-button/index.d.ts +1 -3
- package/dist/components/back-button/index.d.ts.map +10 -1
- package/dist/components/back-button/index.js +229 -0
- package/dist/components/bottom-navigation/BottomNavigation.d.ts +1 -10
- package/dist/components/bottom-navigation/BottomNavigation.d.ts.map +10 -1
- package/dist/components/bottom-navigation/browser.js +97 -0
- package/dist/components/bottom-navigation/index.cjs +1 -0
- package/dist/components/bottom-navigation/index.d.ts +2 -5
- package/dist/components/bottom-navigation/index.d.ts.map +10 -1
- package/dist/components/bottom-navigation/index.js +85 -0
- package/dist/components/button/Button.d.ts +1 -57
- package/dist/components/button/Button.d.ts.map +10 -1
- package/dist/components/button/browser.js +18 -0
- package/dist/components/button/index.cjs +1 -0
- package/dist/components/button/index.d.ts +1 -3
- package/dist/components/button/index.d.ts.map +10 -1
- package/dist/components/button/index.js +6 -0
- package/dist/components/card/Card.d.ts +1 -17
- package/dist/components/card/Card.d.ts.map +10 -1
- package/dist/components/card/browser.js +25 -0
- package/dist/components/card/index.cjs +1 -0
- package/dist/components/card/index.d.ts +1 -3
- package/dist/components/card/index.d.ts.map +10 -1
- package/dist/components/card/index.js +13 -0
- package/dist/components/chart/Chart.d.ts +1 -291
- package/dist/components/chart/Chart.d.ts.map +10 -1
- package/dist/components/chart/browser.js +1331 -0
- package/dist/components/chart/index.cjs +37 -0
- package/dist/components/chart/index.d.ts +1 -3
- package/dist/components/chart/index.d.ts.map +10 -1
- package/dist/components/chart/index.js +1319 -0
- package/dist/components/checkbox/Checkbox.d.ts +1 -41
- package/dist/components/checkbox/Checkbox.d.ts.map +10 -1
- package/dist/components/checkbox/browser.js +162 -0
- package/dist/components/checkbox/index.cjs +1 -0
- package/dist/components/checkbox/index.d.ts +1 -3
- package/dist/components/checkbox/index.d.ts.map +10 -1
- package/dist/components/checkbox/index.js +150 -0
- package/dist/components/chip/Chip.d.ts +1 -16
- package/dist/components/chip/Chip.d.ts.map +10 -1
- package/dist/components/chip/browser.js +17 -0
- package/dist/components/chip/index.cjs +1 -0
- package/dist/components/chip/index.d.ts +1 -3
- package/dist/components/chip/index.d.ts.map +10 -1
- package/dist/components/chip/index.js +5 -0
- package/dist/components/choice/Choice.d.ts +1 -27
- package/dist/components/choice/Choice.d.ts.map +10 -1
- package/dist/components/choice/browser.js +272 -0
- package/dist/components/choice/index.cjs +1 -0
- package/dist/components/choice/index.d.ts +1 -5
- package/dist/components/choice/index.d.ts.map +10 -1
- package/dist/components/choice/index.js +260 -0
- package/dist/components/chunks/button-B0Yt0MX1.js +380 -0
- package/dist/components/chunks/button-BlbLHMts.js +1 -0
- package/dist/components/chunks/caret-down-BN9cl4o4.js +1 -0
- package/dist/components/chunks/caret-down-Ch6IfR7r.js +9 -0
- package/dist/components/chunks/caret-right-CDUwqoen.js +1 -0
- package/dist/components/chunks/caret-right-CVOgr4nk.js +9 -0
- package/dist/components/chunks/caret-up-3XCuTXSE.js +1 -0
- package/dist/components/chunks/caret-up-D_6oa7o1.js +9 -0
- package/dist/components/chunks/chip-B04bJM4r.js +1 -0
- package/dist/components/chunks/chip-B9whjEvW.js +54 -0
- package/dist/components/chunks/close-5tYlQdkk.js +1 -0
- package/dist/components/chunks/close-Dg6U0IjZ.js +10 -0
- package/dist/components/chunks/icon-C0OLmjDY.js +1 -0
- package/dist/components/chunks/icon-CyzR9aVl.js +1 -0
- package/dist/components/chunks/icon-dG8sLTBn.js +27 -0
- package/dist/components/chunks/icon-gQAtsERy.js +1324 -0
- package/dist/components/chunks/input-8bbXzpa5.js +334 -0
- package/dist/components/chunks/input-BoiREc6Y.js +1 -0
- package/dist/components/chunks/link-BxhPnVaz.js +1 -0
- package/dist/components/chunks/link-DKgtBYK6.js +38 -0
- package/dist/components/chunks/modal-B8gNdwEl.js +153 -0
- package/dist/components/chunks/modal-WYWvk2lZ.js +1 -0
- package/dist/components/chunks/popover-BeaGf_JC.js +1 -0
- package/dist/components/chunks/popover-gviDCspV.js +188 -0
- package/dist/components/chunks/register-element-BFYmIynH.js +53 -0
- package/dist/components/chunks/register-element-tCL_F1YI.js +1 -0
- package/dist/components/chunks/search-ANUKQi0r.js +9 -0
- package/dist/components/chunks/search-B3egXuw4.js +1 -0
- package/dist/components/chunks/spinner-BsaFHuS6.js +108 -0
- package/dist/components/chunks/spinner-DbTohC6i.js +63 -0
- package/dist/components/chunks/stack-D1uh4L79.js +1 -0
- package/dist/components/chunks/stack-DyQfjPDh.js +53 -0
- package/dist/components/chunks/table-BgboosRK.js +65 -0
- package/dist/components/chunks/table-DDUNUwGd.js +1 -0
- package/dist/components/chunks/text-BHkEs8U5.js +67 -0
- package/dist/components/chunks/text-BmHZbBMo.js +1 -0
- package/dist/components/clickable/Clickable.d.ts +1 -14
- package/dist/components/clickable/Clickable.d.ts.map +10 -1
- package/dist/components/clickable/browser.js +78 -0
- package/dist/components/clickable/index.cjs +1 -0
- package/dist/components/clickable/index.d.ts +1 -3
- package/dist/components/clickable/index.d.ts.map +10 -1
- package/dist/components/clickable/index.js +66 -0
- package/dist/components/collapsible/Collapsible.d.ts +1 -28
- package/dist/components/collapsible/Collapsible.d.ts.map +10 -1
- package/dist/components/collapsible/browser.js +170 -0
- package/dist/components/collapsible/index.cjs +1 -0
- package/dist/components/collapsible/index.d.ts +1 -3
- package/dist/components/collapsible/index.d.ts.map +10 -1
- package/dist/components/collapsible/index.js +158 -0
- package/dist/components/confirm-action/ConfirmAction.d.ts +1 -27
- package/dist/components/confirm-action/ConfirmAction.d.ts.map +10 -1
- package/dist/components/confirm-action/browser.js +130 -0
- package/dist/components/confirm-action/index.cjs +1 -0
- package/dist/components/confirm-action/index.d.ts +2 -3
- package/dist/components/confirm-action/index.d.ts.map +10 -1
- package/dist/components/confirm-action/index.js +118 -0
- package/dist/components/date-picker/DatePicker.d.ts +1 -130
- package/dist/components/date-picker/DatePicker.d.ts.map +10 -1
- package/dist/components/date-picker/browser.js +1288 -0
- package/dist/components/date-picker/index.cjs +1 -0
- package/dist/components/date-picker/index.d.ts +1 -3
- package/dist/components/date-picker/index.d.ts.map +10 -1
- package/dist/components/date-picker/index.js +1276 -0
- package/dist/components/dropzone/Dropzone.d.ts +1 -59
- package/dist/components/dropzone/Dropzone.d.ts.map +10 -1
- package/dist/components/dropzone/browser.js +355 -0
- package/dist/components/dropzone/index.cjs +1 -0
- package/dist/components/dropzone/index.d.ts +1 -3
- package/dist/components/dropzone/index.d.ts.map +10 -1
- package/dist/components/dropzone/index.js +343 -0
- package/dist/components/form/Form.d.ts +1 -133
- package/dist/components/form/Form.d.ts.map +10 -1
- package/dist/components/form/browser.js +1002 -0
- package/dist/components/form/index.cjs +1 -0
- package/dist/components/form/index.d.ts +1 -3
- package/dist/components/form/index.d.ts.map +10 -1
- package/dist/components/form/index.js +990 -0
- package/dist/components/grid/Grid.d.ts +1 -16
- package/dist/components/grid/Grid.d.ts.map +10 -1
- package/dist/components/grid/browser.js +24 -0
- package/dist/components/grid/index.cjs +1 -0
- package/dist/components/grid/index.d.ts +1 -3
- package/dist/components/grid/index.d.ts.map +10 -1
- package/dist/components/grid/index.js +12 -0
- package/dist/components/icon/Icon.d.ts +1 -16
- package/dist/components/icon/Icon.d.ts.map +10 -1
- package/dist/components/icon/browser.js +16 -0
- package/dist/components/icon/index.cjs +1 -0
- package/dist/components/icon/index.d.ts +2 -3
- package/dist/components/icon/index.d.ts.map +10 -1
- package/dist/components/icon/index.js +4 -0
- package/dist/components/input/Input.d.ts +1 -68
- package/dist/components/input/Input.d.ts.map +10 -1
- package/dist/components/input/browser.js +17 -0
- package/dist/components/input/index.cjs +1 -0
- package/dist/components/input/index.d.ts +1 -3
- package/dist/components/input/index.d.ts.map +10 -1
- package/dist/components/input/index.js +5 -0
- package/dist/components/link/Link.d.ts +1 -16
- package/dist/components/link/Link.d.ts.map +10 -1
- package/dist/components/link/browser.js +16 -0
- package/dist/components/link/index.cjs +1 -0
- package/dist/components/link/index.d.ts +1 -3
- package/dist/components/link/index.d.ts.map +10 -1
- package/dist/components/link/index.js +4 -0
- package/dist/components/modal/Modal.d.ts +1 -38
- package/dist/components/modal/Modal.d.ts.map +10 -1
- package/dist/components/modal/browser.js +21 -0
- package/dist/components/modal/index.cjs +1 -0
- package/dist/components/modal/index.d.ts +1 -3
- package/dist/components/modal/index.d.ts.map +10 -1
- package/dist/components/modal/index.js +9 -0
- package/dist/components/navigation/Navigation.d.ts +1 -0
- package/dist/components/navigation/Navigation.d.ts.map +10 -0
- package/dist/components/navigation/browser.js +198 -0
- package/dist/components/navigation/index.cjs +1 -0
- package/dist/components/navigation/index.d.ts +1 -0
- package/dist/components/navigation/index.d.ts.map +10 -0
- package/dist/components/navigation/index.js +186 -0
- package/dist/components/off-canvas/OffCanvas.d.ts +1 -46
- package/dist/components/off-canvas/OffCanvas.d.ts.map +10 -1
- package/dist/components/off-canvas/browser.js +192 -0
- package/dist/components/off-canvas/index.cjs +1 -0
- package/dist/components/off-canvas/index.d.ts +1 -3
- package/dist/components/off-canvas/index.d.ts.map +10 -1
- package/dist/components/off-canvas/index.js +180 -0
- package/dist/components/page/Page.d.ts +1 -37
- package/dist/components/page/Page.d.ts.map +10 -1
- package/dist/components/page/browser.js +74 -0
- package/dist/components/page/index.cjs +16 -0
- package/dist/components/page/index.d.ts +1 -3
- package/dist/components/page/index.d.ts.map +10 -1
- package/dist/components/page/index.js +62 -0
- package/dist/components/popover/Popover.d.ts +1 -64
- package/dist/components/popover/Popover.d.ts.map +10 -1
- package/dist/components/popover/browser.js +17 -0
- package/dist/components/popover/index.cjs +1 -0
- package/dist/components/popover/index.d.ts +1 -3
- package/dist/components/popover/index.d.ts.map +10 -1
- package/dist/components/popover/index.js +5 -0
- package/dist/components/resource-table/ResourceTable.d.ts +1 -327
- package/dist/components/resource-table/ResourceTable.d.ts.map +10 -1
- package/dist/components/resource-table/browser.js +1457 -0
- package/dist/components/resource-table/index.cjs +2 -0
- package/dist/components/resource-table/index.d.ts +1 -4
- package/dist/components/resource-table/index.d.ts.map +10 -1
- package/dist/components/resource-table/index.js +1445 -0
- package/dist/components/search/Search.d.ts +1 -151
- package/dist/components/search/Search.d.ts.map +10 -1
- package/dist/components/search/browser.js +681 -0
- package/dist/components/search/index.cjs +1 -0
- package/dist/components/search/index.d.ts +1 -3
- package/dist/components/search/index.d.ts.map +10 -1
- package/dist/components/search/index.js +669 -0
- package/dist/components/select/Select.d.ts +1 -37
- package/dist/components/select/Select.d.ts.map +10 -1
- package/dist/components/select/browser.js +285 -0
- package/dist/components/select/index.cjs +1 -0
- package/dist/components/select/index.d.ts +1 -3
- package/dist/components/select/index.d.ts.map +10 -1
- package/dist/components/select/index.js +273 -0
- package/dist/components/side-navigation/SideNavigation.d.ts +1 -52
- package/dist/components/side-navigation/SideNavigation.d.ts.map +10 -1
- package/dist/components/side-navigation/browser.js +466 -0
- package/dist/components/side-navigation/index.cjs +1 -0
- package/dist/components/side-navigation/index.d.ts +5 -8
- package/dist/components/side-navigation/index.d.ts.map +10 -1
- package/dist/components/side-navigation/index.js +454 -0
- package/dist/components/sortable/Sortable.d.ts +1 -62
- package/dist/components/sortable/Sortable.d.ts.map +10 -1
- package/dist/components/sortable/browser.js +340 -0
- package/dist/components/sortable/index.cjs +1 -0
- package/dist/components/sortable/index.d.ts +1 -3
- package/dist/components/sortable/index.d.ts.map +10 -1
- package/dist/components/sortable/index.js +328 -0
- package/dist/components/spinner/Spinner.d.ts +1 -13
- package/dist/components/spinner/Spinner.d.ts.map +10 -1
- package/dist/components/spinner/browser.js +16 -0
- package/dist/components/spinner/index.cjs +1 -0
- package/dist/components/spinner/index.d.ts +1 -3
- package/dist/components/spinner/index.d.ts.map +10 -1
- package/dist/components/spinner/index.js +4 -0
- package/dist/components/stack/Stack.d.ts +1 -23
- package/dist/components/stack/Stack.d.ts.map +10 -1
- package/dist/components/stack/browser.js +16 -0
- package/dist/components/stack/index.cjs +1 -0
- package/dist/components/stack/index.d.ts +1 -3
- package/dist/components/stack/index.d.ts.map +10 -1
- package/dist/components/stack/index.js +4 -0
- package/dist/components/switch/Switch.d.ts +1 -33
- package/dist/components/switch/Switch.d.ts.map +10 -1
- package/dist/components/switch/browser.js +203 -0
- package/dist/components/switch/index.cjs +1 -0
- package/dist/components/switch/index.d.ts +1 -3
- package/dist/components/switch/index.d.ts.map +10 -1
- package/dist/components/switch/index.js +191 -0
- package/dist/components/table/Table.d.ts +1 -11
- package/dist/components/table/Table.d.ts.map +10 -1
- package/dist/components/table/browser.js +16 -0
- package/dist/components/table/index.cjs +1 -0
- package/dist/components/table/index.d.ts +1 -3
- package/dist/components/table/index.d.ts.map +10 -1
- package/dist/components/table/index.js +4 -0
- package/dist/components/tabs/Tabs.d.ts +1 -20
- package/dist/components/tabs/Tabs.d.ts.map +10 -1
- package/dist/components/tabs/browser.js +251 -0
- package/dist/components/tabs/index.cjs +1 -0
- package/dist/components/tabs/index.d.ts +4 -9
- package/dist/components/tabs/index.d.ts.map +10 -1
- package/dist/components/tabs/index.js +239 -0
- package/dist/components/tags/Tags.d.ts +1 -82
- package/dist/components/tags/Tags.d.ts.map +10 -1
- package/dist/components/tags/browser.js +416 -0
- package/dist/components/tags/index.cjs +1 -0
- package/dist/components/tags/index.d.ts +1 -3
- package/dist/components/tags/index.d.ts.map +10 -1
- package/dist/components/tags/index.js +404 -0
- package/dist/components/text/Text.d.ts +1 -25
- package/dist/components/text/Text.d.ts.map +10 -1
- package/dist/components/text/browser.js +16 -0
- package/dist/components/text/index.cjs +1 -0
- package/dist/components/text/index.d.ts +1 -3
- package/dist/components/text/index.d.ts.map +10 -1
- package/dist/components/text/index.js +4 -0
- package/dist/components/time-picker/TimePicker.d.ts +1 -61
- package/dist/components/time-picker/TimePicker.d.ts.map +10 -1
- package/dist/components/time-picker/browser.js +366 -0
- package/dist/components/time-picker/index.cjs +1 -0
- package/dist/components/time-picker/index.d.ts +1 -3
- package/dist/components/time-picker/index.d.ts.map +10 -1
- package/dist/components/time-picker/index.js +354 -0
- package/dist/components/toast/Toast.d.ts +1 -21
- package/dist/components/toast/Toast.d.ts.map +10 -1
- package/dist/components/toast/browser.js +147 -0
- package/dist/components/toast/index.cjs +3 -0
- package/dist/components/toast/index.d.ts +3 -3
- package/dist/components/toast/index.d.ts.map +10 -1
- package/dist/components/toast/index.js +135 -0
- package/dist/confirm-action.css +3 -0
- package/dist/date-picker.css +3 -0
- package/dist/dropzone.css +3 -0
- package/dist/form.css +3 -0
- package/dist/grid.css +3 -0
- package/dist/icon.css +3 -0
- package/dist/icons/ai.svg +5 -6
- package/dist/icons/bank.svg +1 -1
- package/dist/icons/barcode.svg +1 -1
- package/dist/icons/basket.svg +1 -1
- package/dist/icons/building.svg +1 -1
- package/dist/icons/buildings.svg +1 -1
- package/dist/icons/calendar.svg +1 -1
- package/dist/icons/cash.svg +3 -0
- package/dist/icons/check.svg +1 -1
- package/dist/icons/close.svg +1 -1
- package/dist/icons/coupon.svg +3 -0
- package/dist/icons/delivery-location.svg +3 -0
- package/dist/icons/desktop.svg +3 -0
- package/dist/icons/dollar-sign.svg +1 -1
- package/dist/icons/edit.svg +1 -1
- package/dist/icons/gift.svg +3 -0
- package/dist/icons/grip-lines.svg +2 -2
- package/dist/icons/heart.svg +3 -0
- package/dist/icons/installments.svg +3 -0
- package/dist/icons/inventory.svg +3 -0
- package/dist/icons/invoice.svg +3 -0
- package/dist/icons/loyalty-points.svg +3 -0
- package/dist/icons/membership.svg +3 -0
- package/dist/icons/mobile.svg +3 -0
- package/dist/icons/order-tracking.svg +7 -0
- package/dist/icons/out-of-stock.svg +3 -0
- package/dist/icons/package.svg +3 -0
- package/dist/icons/percent-discount.svg +3 -0
- package/dist/icons/pickup.svg +3 -0
- package/dist/icons/plus.svg +1 -1
- package/dist/icons/price-label.svg +3 -0
- package/dist/icons/product-review.svg +3 -0
- package/dist/icons/receipt.svg +3 -0
- package/dist/icons/refund.svg +3 -0
- package/dist/icons/remove.svg +1 -1
- package/dist/icons/return.svg +3 -0
- package/dist/icons/sale-burst.svg +3 -0
- package/dist/icons/secure-checkout.svg +3 -0
- package/dist/icons/shopping-bag.svg +3 -0
- package/dist/icons/shopping-cart.svg +3 -0
- package/dist/icons/storefront.svg +3 -0
- package/dist/icons/support.svg +3 -0
- package/dist/icons/tablet.svg +3 -0
- package/dist/icons/wallet.svg +3 -0
- package/dist/icons/warehouse.svg +3 -0
- package/dist/index.cjs +83 -79
- package/dist/index.css +253 -0
- package/dist/index.d.ts +94 -91
- package/dist/index.d.ts.map +10 -1
- package/dist/index.js +10695 -10239
- package/dist/input.css +3 -0
- package/dist/link.css +3 -0
- package/dist/mintui-elements.d.ts +156 -0
- package/dist/mintui-elements.d.ts.map +10 -0
- package/dist/modal.css +3 -0
- package/dist/navigation.css +3 -0
- package/dist/off-canvas.css +3 -0
- package/dist/page.css +3 -0
- package/dist/popover.css +3 -0
- package/dist/resource-table.css +3 -0
- package/dist/search.css +3 -0
- package/dist/select.css +3 -0
- package/dist/side-navigation.css +3 -0
- package/dist/sortable.css +3 -0
- package/dist/spinner.css +3 -0
- package/dist/stack.css +3 -0
- package/dist/switch.css +3 -0
- package/dist/table.css +3 -0
- package/dist/tabs.css +3 -0
- package/dist/tags.css +3 -0
- package/dist/text.css +3 -0
- package/dist/theme.css +101 -0
- package/dist/time-picker.css +3 -0
- package/dist/toast.css +3 -0
- package/package.json +379 -30
- package/dist/components/bottom-navigation/BottomNavItem.d.ts +0 -14
- package/dist/components/bottom-navigation/BottomNavItem.d.ts.map +0 -1
- package/dist/components/choice/ChoiceOption.d.ts +0 -30
- package/dist/components/choice/ChoiceOption.d.ts.map +0 -1
- package/dist/components/confirm-action/ConfirmActionApi.d.ts +0 -17
- package/dist/components/confirm-action/ConfirmActionApi.d.ts.map +0 -1
- package/dist/components/icon/build-icons.d.ts +0 -2
- package/dist/components/icon/build-icons.d.ts.map +0 -1
- package/dist/components/icon/icons/ai.d.ts +0 -3
- package/dist/components/icon/icons/ai.d.ts.map +0 -1
- package/dist/components/icon/icons/archive.d.ts +0 -3
- package/dist/components/icon/icons/archive.d.ts.map +0 -1
- package/dist/components/icon/icons/arrow-down.d.ts +0 -3
- package/dist/components/icon/icons/arrow-down.d.ts.map +0 -1
- package/dist/components/icon/icons/arrow-left.d.ts +0 -3
- package/dist/components/icon/icons/arrow-left.d.ts.map +0 -1
- package/dist/components/icon/icons/arrow-right.d.ts +0 -3
- package/dist/components/icon/icons/arrow-right.d.ts.map +0 -1
- package/dist/components/icon/icons/arrow-up.d.ts +0 -3
- package/dist/components/icon/icons/arrow-up.d.ts.map +0 -1
- package/dist/components/icon/icons/attach.d.ts +0 -3
- package/dist/components/icon/icons/attach.d.ts.map +0 -1
- package/dist/components/icon/icons/bank.d.ts +0 -3
- package/dist/components/icon/icons/bank.d.ts.map +0 -1
- package/dist/components/icon/icons/barcode.d.ts +0 -3
- package/dist/components/icon/icons/barcode.d.ts.map +0 -1
- package/dist/components/icon/icons/basket.d.ts +0 -3
- package/dist/components/icon/icons/basket.d.ts.map +0 -1
- package/dist/components/icon/icons/bookmark.d.ts +0 -3
- package/dist/components/icon/icons/bookmark.d.ts.map +0 -1
- package/dist/components/icon/icons/building.d.ts +0 -3
- package/dist/components/icon/icons/building.d.ts.map +0 -1
- package/dist/components/icon/icons/buildings.d.ts +0 -3
- package/dist/components/icon/icons/buildings.d.ts.map +0 -1
- package/dist/components/icon/icons/bullhorn.d.ts +0 -3
- package/dist/components/icon/icons/bullhorn.d.ts.map +0 -1
- package/dist/components/icon/icons/calendar-day.d.ts +0 -3
- package/dist/components/icon/icons/calendar-day.d.ts.map +0 -1
- package/dist/components/icon/icons/calendar-empty.d.ts +0 -3
- package/dist/components/icon/icons/calendar-empty.d.ts.map +0 -1
- package/dist/components/icon/icons/calendar-week.d.ts +0 -3
- package/dist/components/icon/icons/calendar-week.d.ts.map +0 -1
- package/dist/components/icon/icons/calendar.d.ts +0 -3
- package/dist/components/icon/icons/calendar.d.ts.map +0 -1
- package/dist/components/icon/icons/caret-down.d.ts +0 -3
- package/dist/components/icon/icons/caret-down.d.ts.map +0 -1
- package/dist/components/icon/icons/caret-left.d.ts +0 -3
- package/dist/components/icon/icons/caret-left.d.ts.map +0 -1
- package/dist/components/icon/icons/caret-right.d.ts +0 -3
- package/dist/components/icon/icons/caret-right.d.ts.map +0 -1
- package/dist/components/icon/icons/caret-up.d.ts +0 -3
- package/dist/components/icon/icons/caret-up.d.ts.map +0 -1
- package/dist/components/icon/icons/chart-bar.d.ts +0 -3
- package/dist/components/icon/icons/chart-bar.d.ts.map +0 -1
- package/dist/components/icon/icons/chart-line.d.ts +0 -3
- package/dist/components/icon/icons/chart-line.d.ts.map +0 -1
- package/dist/components/icon/icons/chat.d.ts +0 -3
- package/dist/components/icon/icons/chat.d.ts.map +0 -1
- package/dist/components/icon/icons/check.d.ts +0 -3
- package/dist/components/icon/icons/check.d.ts.map +0 -1
- package/dist/components/icon/icons/clock.d.ts +0 -3
- package/dist/components/icon/icons/clock.d.ts.map +0 -1
- package/dist/components/icon/icons/close.d.ts +0 -3
- package/dist/components/icon/icons/close.d.ts.map +0 -1
- package/dist/components/icon/icons/copy.d.ts +0 -3
- package/dist/components/icon/icons/copy.d.ts.map +0 -1
- package/dist/components/icon/icons/credit-card.d.ts +0 -3
- package/dist/components/icon/icons/credit-card.d.ts.map +0 -1
- package/dist/components/icon/icons/delete.d.ts +0 -3
- package/dist/components/icon/icons/delete.d.ts.map +0 -1
- package/dist/components/icon/icons/desktop-screen.d.ts +0 -3
- package/dist/components/icon/icons/desktop-screen.d.ts.map +0 -1
- package/dist/components/icon/icons/documentation.d.ts +0 -3
- package/dist/components/icon/icons/documentation.d.ts.map +0 -1
- package/dist/components/icon/icons/dollar-sign.d.ts +0 -3
- package/dist/components/icon/icons/dollar-sign.d.ts.map +0 -1
- package/dist/components/icon/icons/download.d.ts +0 -3
- package/dist/components/icon/icons/download.d.ts.map +0 -1
- package/dist/components/icon/icons/duplicate.d.ts +0 -3
- package/dist/components/icon/icons/duplicate.d.ts.map +0 -1
- package/dist/components/icon/icons/edit.d.ts +0 -3
- package/dist/components/icon/icons/edit.d.ts.map +0 -1
- package/dist/components/icon/icons/ellipsis.d.ts +0 -3
- package/dist/components/icon/icons/ellipsis.d.ts.map +0 -1
- package/dist/components/icon/icons/error.d.ts +0 -3
- package/dist/components/icon/icons/error.d.ts.map +0 -1
- package/dist/components/icon/icons/external-link.d.ts +0 -3
- package/dist/components/icon/icons/external-link.d.ts.map +0 -1
- package/dist/components/icon/icons/eye.d.ts +0 -3
- package/dist/components/icon/icons/eye.d.ts.map +0 -1
- package/dist/components/icon/icons/file.d.ts +0 -3
- package/dist/components/icon/icons/file.d.ts.map +0 -1
- package/dist/components/icon/icons/filter.d.ts +0 -3
- package/dist/components/icon/icons/filter.d.ts.map +0 -1
- package/dist/components/icon/icons/folder.d.ts +0 -3
- package/dist/components/icon/icons/folder.d.ts.map +0 -1
- package/dist/components/icon/icons/gavel.d.ts +0 -3
- package/dist/components/icon/icons/gavel.d.ts.map +0 -1
- package/dist/components/icon/icons/globe.d.ts +0 -3
- package/dist/components/icon/icons/globe.d.ts.map +0 -1
- package/dist/components/icon/icons/grid.d.ts +0 -3
- package/dist/components/icon/icons/grid.d.ts.map +0 -1
- package/dist/components/icon/icons/grip-lines.d.ts +0 -3
- package/dist/components/icon/icons/grip-lines.d.ts.map +0 -1
- package/dist/components/icon/icons/help.d.ts +0 -3
- package/dist/components/icon/icons/help.d.ts.map +0 -1
- package/dist/components/icon/icons/home.d.ts +0 -3
- package/dist/components/icon/icons/home.d.ts.map +0 -1
- package/dist/components/icon/icons/image.d.ts +0 -3
- package/dist/components/icon/icons/image.d.ts.map +0 -1
- package/dist/components/icon/icons/index.cjs +0 -34
- package/dist/components/icon/icons/index.d.ts +0 -92
- package/dist/components/icon/icons/index.d.ts.map +0 -1
- package/dist/components/icon/icons/index.js +0 -752
- package/dist/components/icon/icons/info.d.ts +0 -3
- package/dist/components/icon/icons/info.d.ts.map +0 -1
- package/dist/components/icon/icons/language.d.ts +0 -3
- package/dist/components/icon/icons/language.d.ts.map +0 -1
- package/dist/components/icon/icons/line-chart.d.ts +0 -3
- package/dist/components/icon/icons/line-chart.d.ts.map +0 -1
- package/dist/components/icon/icons/link.d.ts +0 -3
- package/dist/components/icon/icons/link.d.ts.map +0 -1
- package/dist/components/icon/icons/list.d.ts +0 -3
- package/dist/components/icon/icons/list.d.ts.map +0 -1
- package/dist/components/icon/icons/location.d.ts +0 -3
- package/dist/components/icon/icons/location.d.ts.map +0 -1
- package/dist/components/icon/icons/lock.d.ts +0 -3
- package/dist/components/icon/icons/lock.d.ts.map +0 -1
- package/dist/components/icon/icons/login.d.ts +0 -3
- package/dist/components/icon/icons/login.d.ts.map +0 -1
- package/dist/components/icon/icons/logout.d.ts +0 -3
- package/dist/components/icon/icons/logout.d.ts.map +0 -1
- package/dist/components/icon/icons/mail.d.ts +0 -3
- package/dist/components/icon/icons/mail.d.ts.map +0 -1
- package/dist/components/icon/icons/map.d.ts +0 -3
- package/dist/components/icon/icons/map.d.ts.map +0 -1
- package/dist/components/icon/icons/menu.d.ts +0 -3
- package/dist/components/icon/icons/menu.d.ts.map +0 -1
- package/dist/components/icon/icons/moon.d.ts +0 -3
- package/dist/components/icon/icons/moon.d.ts.map +0 -1
- package/dist/components/icon/icons/notifications.d.ts +0 -3
- package/dist/components/icon/icons/notifications.d.ts.map +0 -1
- package/dist/components/icon/icons/paste.d.ts +0 -3
- package/dist/components/icon/icons/paste.d.ts.map +0 -1
- package/dist/components/icon/icons/pin.d.ts +0 -3
- package/dist/components/icon/icons/pin.d.ts.map +0 -1
- package/dist/components/icon/icons/plus.d.ts +0 -3
- package/dist/components/icon/icons/plus.d.ts.map +0 -1
- package/dist/components/icon/icons/print.d.ts +0 -3
- package/dist/components/icon/icons/print.d.ts.map +0 -1
- package/dist/components/icon/icons/refresh.d.ts +0 -3
- package/dist/components/icon/icons/refresh.d.ts.map +0 -1
- package/dist/components/icon/icons/remove.d.ts +0 -3
- package/dist/components/icon/icons/remove.d.ts.map +0 -1
- package/dist/components/icon/icons/save.d.ts +0 -3
- package/dist/components/icon/icons/save.d.ts.map +0 -1
- package/dist/components/icon/icons/search.d.ts +0 -3
- package/dist/components/icon/icons/search.d.ts.map +0 -1
- package/dist/components/icon/icons/settings.d.ts +0 -3
- package/dist/components/icon/icons/settings.d.ts.map +0 -1
- package/dist/components/icon/icons/share.d.ts +0 -3
- package/dist/components/icon/icons/share.d.ts.map +0 -1
- package/dist/components/icon/icons/sort-arrows.d.ts +0 -3
- package/dist/components/icon/icons/sort-arrows.d.ts.map +0 -1
- package/dist/components/icon/icons/sort.d.ts +0 -3
- package/dist/components/icon/icons/sort.d.ts.map +0 -1
- package/dist/components/icon/icons/star.d.ts +0 -3
- package/dist/components/icon/icons/star.d.ts.map +0 -1
- package/dist/components/icon/icons/success.d.ts +0 -3
- package/dist/components/icon/icons/success.d.ts.map +0 -1
- package/dist/components/icon/icons/sun.d.ts +0 -3
- package/dist/components/icon/icons/sun.d.ts.map +0 -1
- package/dist/components/icon/icons/table.d.ts +0 -3
- package/dist/components/icon/icons/table.d.ts.map +0 -1
- package/dist/components/icon/icons/tag.d.ts +0 -3
- package/dist/components/icon/icons/tag.d.ts.map +0 -1
- package/dist/components/icon/icons/trash.d.ts +0 -3
- package/dist/components/icon/icons/trash.d.ts.map +0 -1
- package/dist/components/icon/icons/truck.d.ts +0 -3
- package/dist/components/icon/icons/truck.d.ts.map +0 -1
- package/dist/components/icon/icons/unlock.d.ts +0 -3
- package/dist/components/icon/icons/unlock.d.ts.map +0 -1
- package/dist/components/icon/icons/upload.d.ts +0 -3
- package/dist/components/icon/icons/upload.d.ts.map +0 -1
- package/dist/components/icon/icons/user-add.d.ts +0 -3
- package/dist/components/icon/icons/user-add.d.ts.map +0 -1
- package/dist/components/icon/icons/user.d.ts +0 -3
- package/dist/components/icon/icons/user.d.ts.map +0 -1
- package/dist/components/icon/icons/users.d.ts +0 -3
- package/dist/components/icon/icons/users.d.ts.map +0 -1
- package/dist/components/icon/icons/video.d.ts +0 -3
- package/dist/components/icon/icons/video.d.ts.map +0 -1
- package/dist/components/icon/icons/warning.d.ts +0 -3
- package/dist/components/icon/icons/warning.d.ts.map +0 -1
- package/dist/components/icon/registry.d.ts +0 -15
- package/dist/components/icon/registry.d.ts.map +0 -1
- package/dist/components/resource-table/ResourceTableContextMenu.d.ts +0 -40
- package/dist/components/resource-table/ResourceTableContextMenu.d.ts.map +0 -1
- package/dist/components/side-navigation/SideNavigationActionHeader.d.ts +0 -2
- package/dist/components/side-navigation/SideNavigationActionHeader.d.ts.map +0 -1
- package/dist/components/side-navigation/SideNavigationActionLinks.d.ts +0 -9
- package/dist/components/side-navigation/SideNavigationActionLinks.d.ts.map +0 -1
- package/dist/components/side-navigation/SideNavigationActionMenu.d.ts +0 -26
- package/dist/components/side-navigation/SideNavigationActionMenu.d.ts.map +0 -1
- package/dist/components/side-navigation/SideNavigationLink.d.ts +0 -38
- package/dist/components/side-navigation/SideNavigationLink.d.ts.map +0 -1
- package/dist/components/side-navigation/SideNavigationLinks.d.ts +0 -38
- package/dist/components/side-navigation/SideNavigationLinks.d.ts.map +0 -1
- package/dist/components/tabs/Tab.d.ts +0 -19
- package/dist/components/tabs/Tab.d.ts.map +0 -1
- package/dist/components/tabs/TabContent.d.ts +0 -13
- package/dist/components/tabs/TabContent.d.ts.map +0 -1
- package/dist/components/tabs/TabList.d.ts +0 -12
- package/dist/components/tabs/TabList.d.ts.map +0 -1
- package/dist/components/toast/ToastApi.d.ts +0 -21
- package/dist/components/toast/ToastApi.d.ts.map +0 -1
- package/dist/components/top-navigation/TopNavigation.d.ts +0 -65
- package/dist/components/top-navigation/TopNavigation.d.ts.map +0 -1
- package/dist/components/top-navigation/index.d.ts +0 -4
- package/dist/components/top-navigation/index.d.ts.map +0 -1
- package/dist/icons/truck.svg +0 -13
- package/dist/search-CM-OgatF.js +0 -179
- package/dist/search-C_vLUsm7.cjs +0 -1
- package/dist/styles.css +0 -3
- package/tailwind.preset.cjs +0 -75
- package/tailwind.preset.js +0 -97
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,68 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=!1,t=!1,n=null,r=null;function i(){if(e||typeof window>`u`||typeof document>`u`||!window.matchMedia)return;e=!0;let i=document.documentElement;if(t=!i.dataset.mintTheme&&!i.classList.contains(`dark`)&&!i.classList.contains(`light`),!t)return;n=window.matchMedia(`(prefers-color-scheme: dark)`);let a=()=>{if(!t)return;let e=n?.matches??!1;r=e,i.classList.toggle(`dark`,e),requestAnimationFrame(()=>{r=null})};a();let o=()=>a();n.addEventListener?n.addEventListener(`change`,o):n.addListener(o),new MutationObserver(e=>{if(!t)return;let a=e.some(e=>e.attributeName===`class`);if(e.some(e=>e.attributeName===`data-mint-theme`)&&i.dataset.mintTheme){t=!1;return}a&&i.classList.contains(`dark`)!==(n?.matches??!1)?t=!1:a&&r!==null&&(r=null)}).observe(i,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}function a(e,t){if(i(),customElements.get(e))return;let n=t.observedAttributes??[],r=t.prototype;for(let e of n){let t=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());t in r||Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get(){let t=this.getAttribute(e);return t===`true`?!0:t===`false`?!1:t},set(t){t==null||t===!1?this.removeAttribute(e):this.setAttribute(e,String(t))}})}customElements.define(e,t)}var o=new Map;function s(e){o.set(e.name,e)}function c(e){return o.get(e)}var l=class extends HTMLElement{static get observedAttributes(){return[`name`]}constructor(){super(),this._darkModeObserver=null}connectedCallback(){this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&[`class`,`data-mint-theme`].includes(t.attributeName)){this.render();break}}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}getName(){return this.getAttribute(`name`)||``}getIconDataUrl(e){let t=e.customSvg||`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="currentColor" stroke-width="2"${e.strokeLinecap?` stroke-linecap="${e.strokeLinecap}"`:``}${e.strokeLinejoin?` stroke-linejoin="${e.strokeLinejoin}"`:``}><path d="${e.path}" /></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(t)}")`}render(){let e=this.getName();if(!e){this.innerHTML=``,this.style.maskImage=``,this.style.webkitMaskImage=``;return}let t=c(e);if(!t){console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import 'mint-ui/icon/icons/${e}'`),this.innerHTML=``,this.style.maskImage=``,this.style.webkitMaskImage=``;return}let n=this.closest(`mint-button`)||this.parentElement?.closest(`mint-button`),r=this.closest(`mint-switch`)||this.parentElement?.closest(`mint-switch`);this.style.display=`inline-block`,this.style.width=r?`0.75rem`:n?`1rem`:`1.3em`,this.style.height=r?`0.75rem`:n?`1rem`:`1.3em`;let i=this.getIconDataUrl(t);this.style.maskImage=i,this.style.webkitMaskImage=i,this.style.maskSize=`contain`,this.style.webkitMaskSize=`contain`,this.style.maskRepeat=`no-repeat`,this.style.webkitMaskRepeat=`no-repeat`,this.style.maskPosition=`center`,this.style.webkitMaskPosition=`center`,this.style.aspectRatio=`1 / 1`,this.style.backgroundColor=`currentColor`,this.innerHTML=``}};typeof customElements<`u`&&!customElements.get(`mint-icon`)&&a(`mint-icon`,l);var u={name:`ai`,viewBox:`0 0 24 24`,path:`M13 3.5H7.5a4 4 0 00-4 4v9a4 4 0 004 4h9a4 4 0 004-4V12M7.6 15.5l2-6.2h1.2l2 6.2m-3.2-2h2.2m3.5-4.2v6.2`,customSvg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
|
|
2
|
+
<path d="M13 3.5H7.5a4 4 0 0 0-4 4v9a4 4 0 0 0 4 4h9a4 4 0 0 0 4-4V12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="m7.6 15.5 2-6.2h1.2l2 6.2m-3.2-2h2.2m3.5-4.2v6.2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M17 1.5c.5 2.3 1.2 3 3.5 3.5-2.3.5-3 1.2-3.5 3.5-.5-2.3-1.2-3-3.5-3.5 2.3-.5 3-1.2 3.5-3.5Z" fill="currentColor"/>
|
|
5
|
+
<path d="M21 4.2c.25 1.2.6 1.55 1.8 1.8-1.2.25-1.55.6-1.8 1.8-.25-1.2-.6-1.55-1.8-1.8 1.2-.25 1.55-.6 1.8-1.8Z" fill="currentColor"/>
|
|
6
|
+
<path d="M18.7 6.8c.3 1.5.8 2 2.3 2.3-1.5.3-2 .8-2.3 2.3-.3-1.5-.8-2-2.3-2.3 1.5-.3 2-.8 2.3-2.3Z" fill="currentColor"/>
|
|
7
|
+
</svg>`};s(u);var d={name:`archive`,viewBox:`0 0 24 24`,path:`M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(d);var f={name:`arrow-down`,viewBox:`0 0 24 24`,path:`M19 14l-7 7m0 0l-7-7m7 7V3`,strokeLinecap:`round`,strokeLinejoin:`round`};s(f);var p={name:`arrow-left`,viewBox:`0 0 24 24`,path:`M19 12H5m7-7l-7 7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`};s(p);var m={name:`arrow-right`,viewBox:`0 0 24 24`,path:`M14 5l7 7m0 0l-7 7m7-7H3`,strokeLinecap:`round`,strokeLinejoin:`round`};s(m);var h={name:`arrow-up`,viewBox:`0 0 24 24`,path:`M5 10l7-7m0 0l7 7m-7-7v18`,strokeLinecap:`round`,strokeLinejoin:`round`};s(h);var g={name:`attach`,viewBox:`0 0 24 24`,path:`M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13`,strokeLinecap:`round`,strokeLinejoin:`round`};s(g);var _={name:`bank`,viewBox:`0 0 24 24`,path:`M4.75 8.65 L12 3.2 L19.25 8.65 Z M4.75 8.65 H19.25 V10.15 H4.75 Z M5.2 10.15 H6.95 V17.65 H5.2 Z M11.125 10.15 H12.875 V17.65 H11.125 Z M17.05 10.15 H18.8 V17.65 H17.05 Z M3.5 17.65 H20.5 V21 H3.5 Z`,fill:`currentColor`};s(_);var v={name:`barcode`,viewBox:`0 0 24 24`,path:`M3 4h1.5v16H3V4zM7 4h1v16H7V4zM11 4h1.5v16H11V4zM15.5 4h1v16h-1V4zM19.5 4h1.5v16h-1.5V4z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(v);var y={name:`basket`,viewBox:`0 0 24 24`,path:`M4 9h16l-1.4 10.5a2 2 0 01-2 1.7H7.4a2 2 0 01-2-1.7L4 9zm4.5 0L12 4.5 15.5 9M10 13v3m4-3v3`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2.7`};s(y);var b={name:`bookmark`,viewBox:`0 0 24 24`,path:`M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(b);var x={name:`building`,viewBox:`0 0 24 24`,path:`M7 21V6l5-3 5 3v15M3 21h18M10 8h1M13 8h1M10 11h1M13 11h1M10 14h1M13 14h1M11 21v-3h2v3`,strokeLinecap:`square`,strokeLinejoin:`miter`,strokeWidth:`2.2`};s(x);var S={name:`buildings`,viewBox:`0 0 24 24`,path:`M2 21h20M4 21v-9l3-2v11M9 21V6l3-2 3 2v15M17 21V10l3 2v9M5 13h1M5 16h1M10 8h1M13 8h1M10 11h1M13 11h1M10 14h1M13 14h1M18 13h1M18 16h1M11 21v-3h2v3`,strokeLinecap:`square`,strokeLinejoin:`miter`,strokeWidth:`1.5`};s(S);var C={name:`bullhorn`,viewBox:`0 0 24 24`,path:`M3 11v2l9 3V8l-9 3zm9-3l7-3v14l-7-3M6 14.5V18a2 2 0 002 2h1`,strokeLinecap:`round`,strokeLinejoin:`round`};s(C);var w={name:`calendar`,viewBox:`0 0 24 24`,path:`M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(w);var T={name:`calendar-day`,viewBox:`0 0 24 24`,path:`M8 7V3m8 4V3M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z`,customSvg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
8
|
+
<path d="M8 7V3m8 4V3M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
|
9
|
+
<rect x="7" y="11" width="10" height="5" fill="currentColor"/>
|
|
10
|
+
</svg>`,strokeLinecap:`round`,strokeLinejoin:`round`};s(T);var E={name:`calendar-empty`,viewBox:`0 0 24 24`,path:`M8 7V3m8 4V3M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(E);var D={name:`calendar-week`,viewBox:`0 0 24 24`,path:`M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(D);var O={name:`caret-down`,viewBox:`0 0 24 24`,path:`M19 9l-7 7-7-7`,strokeLinecap:`round`,strokeLinejoin:`round`};s(O);var k={name:`caret-left`,viewBox:`0 0 24 24`,path:`M15 19l-7-7 7-7`,strokeLinecap:`round`,strokeLinejoin:`round`};s(k);var A={name:`caret-right`,viewBox:`0 0 24 24`,path:`M9 5l7 7-7 7`,strokeLinecap:`round`,strokeLinejoin:`round`};s(A);var j={name:`caret-up`,viewBox:`0 0 24 24`,path:`M5 15l7-7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`};s(j);var ee={name:`chart-bar`,viewBox:`0 0 24 24`,path:`M3 20h18M6 17v-5m4 5V7m4 10v-8m4 8v-3`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ee);var te={name:`chart-line`,viewBox:`0 0 24 24`,path:`M3 20h18M4 18V4m2 11l4-4 3 3 5-6m0 0h-4m4 0v4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(te);var ne={name:`chat`,viewBox:`0 0 24 24`,path:`M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ne);var re={name:`check`,viewBox:`0 0 24 24`,path:`M5 13l4 4L19 7`,strokeLinecap:`round`,strokeLinejoin:`round`};s(re);var ie={name:`clock`,viewBox:`0 0 24 24`,path:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ie);var ae={name:`close`,viewBox:`0 0 24 24`,path:`M6 18L18 6M6 6l12 12`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ae);var oe={name:`copy`,viewBox:`0 0 24 24`,path:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(oe);var se={name:`credit-card`,viewBox:`0 0 24 24`,path:`M3 7.5A2.5 2.5 0 0 1 5.5 5h13A2.5 2.5 0 0 1 21 7.5v9A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-9zM3 10h18M7 15h3`,strokeLinecap:`round`,strokeLinejoin:`round`};s(se);var ce={name:`delete`,viewBox:`0 0 24 24`,path:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ce);var le={name:`desktop`,viewBox:`0 0 24 24`,path:`M4 4h16a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1ZM12 17v3m-4 0h8`,strokeLinecap:`round`,strokeLinejoin:`round`};s(le);var ue={name:`desktop-screen`,viewBox:`0 0 24 24`,path:`M3 5a2 2 0 012-2h14a2 2 0 012 2v9a2 2 0 01-2 2h-5m-4 0H5a2 2 0 01-2-2V5m7 11v4m-2 0h8`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ue);var de={name:`documentation`,viewBox:`0 0 24 24`,path:`M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253`,strokeLinecap:`round`,strokeLinejoin:`round`};s(de);var fe={name:`dollar-sign`,viewBox:`0 0 24 24`,path:`M12 3v18M17 7c0-1.2-1.3-2-3-2h-4c-1.7 0-3 1-3 2.2 0 1.5 1.4 2.2 3 2.6l4 1c1.6.4 3 1.1 3 2.6 0 1.2-1.3 2.2-3 2.2h-4c-1.7 0-3-1-3-2`,strokeWidth:`2.75`,strokeLinecap:`butt`,strokeLinejoin:`miter`};s(fe);var pe={name:`download`,viewBox:`0 0 24 24`,path:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(pe);var M={name:`duplicate`,viewBox:`0 0 24 24`,path:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(M);var N={name:`edit`,viewBox:`0 0 24 24`,path:`M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(N);var P={name:`ellipsis`,viewBox:`0 0 24 24`,path:`M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(P);var F={name:`error`,viewBox:`0 0 24 24`,path:`M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(F);var I={name:`external-link`,viewBox:`0 0 24 24`,path:`M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14`,strokeLinecap:`round`,strokeLinejoin:`round`};s(I);var L={name:`eye`,viewBox:`0 0 24 24`,path:`M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6zm10 3.5a3.5 3.5 0 100-7 3.5 3.5 0 000 7z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(L);var R={name:`file`,viewBox:`0 0 24 24`,path:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(R);var z={name:`filter`,viewBox:`0 0 24 24`,path:`M3 6h18M3 12h18M3 18h18M6 6a2 2 0 11-4 0 2 2 0 014 0zM12 12a2 2 0 11-4 0 2 2 0 014 0zM16 18a2 2 0 11-4 0 2 2 0 014 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(z);var B={name:`folder`,viewBox:`0 0 24 24`,path:`M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(B);var me={name:`gavel`,viewBox:`0 0 24 24`,path:`M12 12`,customSvg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
11
|
+
<g transform="translate(12 12) rotate(45)">
|
|
12
|
+
<rect x="-5.52" y="-3.78" width="1.78" height="7.56" rx="0.55" ry="0.55"/>
|
|
13
|
+
<rect x="-3.74" y="-3.12" width="7.48" height="6.24" rx="0.46" ry="0.46"/>
|
|
14
|
+
<rect x="3.74" y="-3.78" width="1.78" height="7.56" rx="0.55" ry="0.55"/>
|
|
15
|
+
<rect x="-0.4" y="3.78" width="0.8" height="8.45" rx="0.4" ry="0.4"/>
|
|
16
|
+
<rect x="-1.18" y="12.21" width="2.36" height="2.55" rx="0.92" ry="0.92"/>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>`};s(me);var he={name:`globe`,viewBox:`0 0 24 24`,path:`M12 2a10 10 0 100 20 10 10 0 000-20zm0 0c2.5 2.4 4 6.2 4 10s-1.5 7.6-4 10m0-20c-2.5 2.4-4 6.2-4 10s1.5 7.6 4 10M2 12h20M4.5 7h15M4.5 17h15`,strokeLinecap:`round`,strokeLinejoin:`round`};s(he);var ge={name:`grid`,viewBox:`0 0 24 24`,path:`M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ge);var _e={name:`grip-lines`,viewBox:`0 0 24 24`,path:`M12 12`,customSvg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
19
|
+
<rect x="2" y="8" width="18" height="2" rx="1" />
|
|
20
|
+
<rect x="2" y="14" width="18" height="2" rx="1" />
|
|
21
|
+
</svg>`};s(_e);var ve={name:`help`,viewBox:`0 0 24 24`,path:`M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ve);var ye={name:`home`,viewBox:`0 0 24 24`,path:`M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ye);var be={name:`image`,viewBox:`0 0 24 24`,path:`M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(be);var xe={name:`info`,viewBox:`0 0 24 24`,path:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(xe);var Se={name:`language`,viewBox:`0 0 24 24`,path:`M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Se);var Ce={name:`line-chart`,viewBox:`0 0 24 24`,path:`M3 20h18M4 18V4m2 11l4-4 3 3 5-6m0 0h-4m4 0v4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ce);var we={name:`link`,viewBox:`0 0 24 24`,path:`M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1`,strokeLinecap:`round`,strokeLinejoin:`round`};s(we);var Te={name:`list`,viewBox:`0 0 24 24`,path:`M8 6h13M5 6h.01M8 12h13M5 12h.01M8 18h13M5 18h.01`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Te);var Ee={name:`location`,viewBox:`0 0 24 24`,path:`M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z M15 11a3 3 0 11-6 0 3 3 0 016 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ee);var De={name:`lock`,viewBox:`0 0 24 24`,path:`M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(De);var Oe={name:`login`,viewBox:`0 0 24 24`,path:`M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Oe);var ke={name:`logout`,viewBox:`0 0 24 24`,path:`M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ke);var Ae={name:`mail`,viewBox:`0 0 24 24`,path:`M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ae);var je={name:`map`,viewBox:`0 0 24 24`,path:`M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7`,strokeLinecap:`round`,strokeLinejoin:`round`};s(je);var Me={name:`menu`,viewBox:`0 0 24 24`,path:`M4 6h16M4 12h16M4 18h16`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Me);var Ne={name:`mobile`,viewBox:`0 0 24 24`,path:`M8 2h8a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm3 16h2`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ne);var Pe={name:`moon`,viewBox:`0 0 24 24`,path:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Pe);var Fe={name:`notifications`,viewBox:`0 0 24 24`,path:`M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Fe);var Ie={name:`paste`,viewBox:`0 0 24 24`,path:`M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ie);var Le={name:`pin`,viewBox:`0 0 24 24`,path:`M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Le);var Re={name:`plus`,viewBox:`0 0 24 24`,path:`M12 4v16m8-8H4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Re);var ze={name:`print`,viewBox:`0 0 24 24`,path:`M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ze);var Be={name:`qr-code`,viewBox:`0 0 24 24`,path:`M4 3H9C10.1 3 11 3.9 11 5V10C11 11.1 10.1 12 9 12H4C2.9 12 2 11.1 2 10V5C2 3.9 2.9 3 4 3ZM4.75 4.5C4.34 4.5 4 4.84 4 5.25V9.75C4 10.16 4.34 10.5 4.75 10.5H8.25C8.66 10.5 9 10.16 9 9.75V5.25C9 4.84 8.66 4.5 8.25 4.5H4.75ZM15 3H20C21.1 3 22 3.9 22 5V10C22 11.1 21.1 12 20 12H15C13.9 12 13 11.1 13 10V5C13 3.9 13.9 3 15 3ZM15.75 4.5C15.34 4.5 15 4.84 15 5.25V9.75C15 10.16 15.34 10.5 15.75 10.5H19.25C19.66 10.5 20 10.16 20 9.75V5.25C20 4.84 19.66 4.5 19.25 4.5H15.75ZM4 13H9C10.1 13 11 13.9 11 15V20C11 21.1 10.1 22 9 22H4C2.9 22 2 21.1 2 20V15C2 13.9 2.9 13 4 13ZM4.75 14.5C4.34 14.5 4 14.84 4 15.25V19.75C4 20.16 4.34 20.5 4.75 20.5H8.25C8.66 20.5 9 20.16 9 19.75V15.25C9 14.84 8.66 14.5 8.25 14.5H4.75ZM13 13H16V16H19V19H16V22H13V19H16V16H13V13Z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Be);var Ve={name:`refresh`,viewBox:`0 0 24 24`,path:`M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ve);var He={name:`remove`,viewBox:`0 0 24 24`,path:`M20 12H4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(He);var Ue={name:`save`,viewBox:`0 0 24 24`,path:`M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ue);var We={name:`search`,viewBox:`0 0 24 24`,path:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(We);var Ge={name:`settings`,viewBox:`0 0 24 24`,path:`M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ge);var Ke={name:`share`,viewBox:`0 0 24 24`,path:`M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ke);var qe={name:`sort`,viewBox:`0 0 24 24`,path:`M3 6h18M7 12h10m-7 6h4`,strokeLinecap:`round`,strokeLinejoin:`round`};s(qe);var Je={name:`sort-arrows`,viewBox:`0 0 24 24`,path:`M1 5l5-4m0 0l5 4m-5-4v22 M13 19l5 4m0 0l5-4m-5 4V1`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Je);var Ye={name:`star`,viewBox:`0 0 24 24`,path:`M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ye);var Xe={name:`success`,viewBox:`0 0 24 24`,path:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Xe);var Ze={name:`sun`,viewBox:`0 0 24 24`,path:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Ze);var Qe={name:`table`,viewBox:`0 0 24 24`,path:`M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(Qe);var $e={name:`tablet`,viewBox:`0 0 24 24`,path:`M6 3h12a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm5 15h2`,strokeLinecap:`round`,strokeLinejoin:`round`};s($e);var et={name:`tag`,viewBox:`0 0 24 24`,path:`M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(et);var tt={name:`trash`,viewBox:`0 0 24 24`,path:`M3 6h18m-2 0v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2`,strokeLinecap:`round`,strokeLinejoin:`round`};s(tt);var nt={name:`unlock`,viewBox:`0 0 24 24`,path:`M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(nt);var rt={name:`upload`,viewBox:`0 0 24 24`,path:`M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12`,strokeLinecap:`round`,strokeLinejoin:`round`};s(rt);var it={name:`user`,viewBox:`0 0 24 24`,path:`M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(it);var at={name:`user-add`,viewBox:`0 0 24 24`,path:`M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(at);var ot={name:`users`,viewBox:`0 0 24 24`,path:`M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ot);var st={name:`video`,viewBox:`0 0 24 24`,path:`M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(st);var ct={name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`};s(ct);var lt={name:`shopping-cart`,viewBox:`0 0 24 24`,path:`M3 4h2l2.2 11h10.9l2-7H6m3.2 7-.9 3h10.2M9 21h.01M17 21h.01`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(lt);var ut={name:`package`,viewBox:`0 0 24 24`,path:`M3 7l9-4 9 4-9 4-9-4zm0 0v10l9 4 9-4V7M12 11v10M7.5 5l9 4`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(ut);var dt={name:`storefront`,viewBox:`0 0 24 24`,path:`M3 10l2-6h14l2 6M4 10v10h16V10M3 10a3 3 0 006 0 3 3 0 006 0 3 3 0 006 0M10 15v5m4-5v5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(dt);var ft={name:`receipt`,viewBox:`0 0 24 24`,path:`M6 3l2 1.5L10 3l2 1.5L14 3l2 1.5L18 3v18l-2-1.5-2 1.5-2-1.5-2 1.5-2-1.5L6 21V3zm3 6h6m-6 4h6m-6 4h3`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(ft);var pt={name:`coupon`,viewBox:`0 0 24 24`,path:`M4 5h16v4a3 3 0 000 6v4H4v-4a3 3 0 000-6V5zm8 1v2m0 2v2m0 2v2`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(pt);var mt={name:`heart`,viewBox:`0 0 24 24`,path:`M20.8 8.8c0 5.2-8.8 11-8.8 11s-8.8-5.8-8.8-11a4.8 4.8 0 018.8-2.6 4.8 4.8 0 018.8 2.6z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(mt);var ht={name:`return`,viewBox:`0 0 24 24`,path:`M9 14l-5-5 5-5M4 9h10a6 6 0 010 12h-3`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(ht);var gt={name:`wallet`,viewBox:`0 0 24 24`,path:`M4 6.5A2.5 2.5 0 016.5 4H20v16H6a3 3 0 01-3-3V6.5A2.5 2.5 0 016 9h14m-4 4h.01`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(gt);var _t={name:`gift`,viewBox:`0 0 24 24`,path:`M3 9h18v12H3V9zm-1-3h20v3H2V6zm10 0v15m0-15C11 4.6 9.8 3 8 3a1.5 1.5 0 000 3m4 0c1-1.4 2.2-3 4-3a1.5 1.5 0 010 3`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(_t);var vt={name:`support`,viewBox:`0 0 24 24`,path:`M4 13v-2a8 8 0 0116 0v2m-16 0h3v6H6a2 2 0 01-2-2v-2a2 2 0 012-2zm16 0h-3v6h1a2 2 0 002-2v-2a2 2 0 00-2-2zm-3 8h-4`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(vt);var yt={name:`shopping-bag`,viewBox:`0 0 24 24`,path:`M5 8h14l1 13H4L5 8zm4 0V6a3 3 0 016 0v2`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(yt);var bt={name:`warehouse`,viewBox:`0 0 24 24`,path:`M3 10l9-6 9 6v10H3V10zm4 10v-7h10v7m-7-7v7m4-7v7`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(bt);var xt={name:`delivery-location`,viewBox:`0 0 24 24`,path:`M12 21s7-6.2 7-12a7 7 0 10-14 0c0 5.8 7 12 7 12zm0-9a3 3 0 110-6 3 3 0 010 6zm-9 9h18`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(xt);var St={name:`order-tracking`,viewBox:`0 0 24 24`,path:`M2.5 6.5H14v11H2.5v-11zm11.5 2.5h4l3.5 4v4.5H14V9zm-7 9a2 2 0 100 4 2 2 0 000-4zm9 0a2 2 0 100 4 2 2 0 000-4zM5 10h7m-7 3h5`,customSvg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
|
22
|
+
<path d="M2.5 6.5H14v11H2.5v-11z" />
|
|
23
|
+
<path d="M14 9h3.7l3.8 4v4.5H14" />
|
|
24
|
+
<path d="M15.5 10.5h1.7l2.5 2.5h-4.2z" stroke-width="1.5" />
|
|
25
|
+
<circle cx="7" cy="20" r="2" />
|
|
26
|
+
<circle cx="16" cy="20" r="2" />
|
|
27
|
+
</svg>`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(St);var Ct={name:`cash`,viewBox:`0 0 24 24`,path:`M3 6h18v12H3V6zm4 3h.01M17 9h.01M7 15h.01M17 15h.01M12 15a3 3 0 100-6 3 3 0 000 6z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Ct);var wt={name:`installments`,viewBox:`0 0 24 24`,path:`M4 4h16v16H4V4zm0 4h16m-12 4h2m4 0h2m-8 4h2m4 0h2`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(wt);var Tt={name:`invoice`,viewBox:`0 0 24 24`,path:`M6 3h12v18l-3-2-3 2-3-2-3 2V3zm3 5h6m-6 4h6m-6 4h3`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Tt);var Et={name:`price-label`,viewBox:`0 0 24 24`,path:`M3 5h10l8 8-8 8-10-10V5zm5 5h.01`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Et);var Dt={name:`sale-burst`,viewBox:`0 0 24 24`,path:`M12 1.5l1.63 2.31 2.39-1.51.62 2.76 2.78-.48-.48 2.78 2.76.62-1.51 2.39L22.5 12l-2.31 1.63 1.51 2.39-2.76.62.48 2.78-2.78-.48-.62 2.76-2.39-1.51L12 22.5l-1.63-2.31-2.39 1.51-.62-2.76-2.78.48.48-2.78-2.76-.62 1.51-2.39L1.5 12l2.31-1.63L2.3 7.98l2.76-.62-.48-2.78 2.78.48.62-2.76 2.39 1.51L12 1.5zm-3 6.2a1.7 1.7 0 100 3.4 1.7 1.7 0 000-3.4zm6 5.2a1.7 1.7 0 100 3.4 1.7 1.7 0 000-3.4M8 16l8-8`,strokeLinecap:`round`,strokeLinejoin:`miter`,strokeWidth:`1.8`};s(Dt);var Ot={name:`percent-discount`,viewBox:`0 0 24 24`,path:`M19 5L5 19M7 8a2 2 0 110-4 2 2 0 010 4zm10 12a2 2 0 110-4 2 2 0 010 4z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Ot);var kt={name:`product-review`,viewBox:`0 0 24 24`,path:`M12 3l2.7 5.5 6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1-4.4-4.3 6.1-.9L12 3z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(kt);var At={name:`loyalty-points`,viewBox:`0 0 24 24`,path:`M12 3l2.4 4.8 5.3.8-3.8 3.7.9 5.2-4.8-2.5-4.8 2.5.9-5.2-3.8-3.7 5.3-.8L12 3zm-3 13v5l3-1.7 3 1.7v-5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(At);var jt={name:`membership`,viewBox:`0 0 24 24`,path:`M5 3.5h14a2 2 0 012 2v13a2 2 0 01-2 2H5a2 2 0 01-2-2v-13a2 2 0 012-2zm-2 4h12m2-4v6l1.5-1.2L20 9.5v-6M8.5 11.5a1.3 1.3 0 100 2.6 1.3 1.3 0 000-2.6zm-2.3 5.1c.5-.9 1.3-1.3 2.3-1.3s1.8.4 2.3 1.3M13.5 12.5h4.5m-4.5 3h4.5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(jt);var Mt={name:`inventory`,viewBox:`0 0 24 24`,path:`M8 4h8a2 2 0 012 2v1h2v14H4V7h2V6a2 2 0 012-2zm1 0V3h6v1M8 11h8m-8 4h8`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Mt);var Nt={name:`out-of-stock`,viewBox:`0 0 24 24`,path:`M4 5h16v14H4V5zm3 3l10 8m0-8L7 16m-3 5h16`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Nt);var Pt={name:`pickup`,viewBox:`0 0 24 24`,path:`M5.5 2.8a1.6 1.6 0 100 3.2 1.6 1.6 0 000-3.2zm-.8 5.1-1 5.8 2.2 1.7 2.5 5.1m-4.7-6.8L2.5 20m2.2-12.1 3.8 2.8 3.2.1m-.2-5.1l4.5-2 4.5 2-4.5 2-4.5-2zm0 0v5l4.5 2 4.5-2v-5m-4.5 1v6.5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Pt);var Ft={name:`secure-checkout`,viewBox:`0 0 24 24`,path:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6l7-3zm-3 9l2 2 4-4`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.8`};s(Ft);var It={name:`refund`,viewBox:`0 0 24 24`,path:`M14 5.5a6.5 6.5 0 110 13 6.5 6.5 0 010-13zm0 2.5v8m2-6.2c-.4-.8-1.1-1.2-2-1.2-1.2 0-2 .6-2 1.5 0 2 4 1 4 3s-.8 1.6-2 1.6c-.9 0-1.7-.4-2.1-1.2M6.5 7H3m0 0l2-2M3 7l2 2`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`};s(It),s(u),s(d),s(f),s(p),s(m),s(h),s(g),s(_),s(v),s(y),s(b),s(x),s(S),s(C),s(w),s(T),s(E),s(D),s(O),s(k),s(A),s(j),s(ee),s(te),s(ne),s(re),s(ie),s(ae),s(oe),s(se),s(ce),s(le),s(ue),s(de),s(fe),s(pe),s(M),s(N),s(P),s(F),s(I),s(L),s(R),s(z),s(B),s(me),s(he),s(ge),s(_e),s(ve),s(ye),s(be),s(xe),s(Se),s(Ce),s(we),s(Te),s(Ee),s(De),s(Oe),s(ke),s(Ae),s(je),s(Me),s(Ne),s(Pe),s(Fe),s(Ie),s(Le),s(Re),s(ze),s(Be),s(Ve),s(He),s(Ue),s(We),s(Ge),s(Ke),s(qe),s(Je),s(Ye),s(Xe),s(Ze),s(Qe),s($e),s(et),s(tt),s(nt),s(rt),s(it),s(at),s(ot),s(st),s(ct),s(lt),s(ut),s(dt),s(ft),s(pt),s(mt),s(ht),s(gt),s(_t),s(vt),s(yt),s(bt),s(xt),s(St),s(Ct),s(wt),s(Tt),s(Et),s(Dt),s(Ot),s(kt),s(At),s(jt),s(Mt),s(Nt),s(Pt),s(Ft),s(It);var Lt=class extends HTMLElement{static get observedAttributes(){return[`size`,`data-button-variant`,`data-button-tone`]}constructor(){super(),this._darkModeObserver=null}connectedCallback(){this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]}))}getSize(){return(this.getAttribute(`size`)||`default`)===`large`?`large`:`default`}render(){let e=this.getSize(),t=this.getAttribute(`size`)||`default`,n=this.style.width&&this.style.height,r=this.getAttribute(`data-button-variant`),i=document.documentElement?.classList.contains(`dark`)||document.documentElement?.dataset.mintTheme===`dark`,a;if(n){let e=this.getAttribute(`data-button-tone`)||`neutral`;a=r===`solid`?e===`neutral`?i?`var(--mint-color-on-primary)`:`var(--mint-color-text)`:`var(--mint-color-on-primary)`:i?`var(--mint-color-on-primary)`:`var(--mint-color-text)`}else a=`var(--mint-color-text)`;let o=t===`large`?`2`:`4`;this.innerHTML=`
|
|
2
28
|
<svg
|
|
3
29
|
xmlns="http://www.w3.org/2000/svg"
|
|
4
30
|
fill="none"
|
|
5
31
|
viewBox="0 0 24 24"
|
|
6
|
-
class="
|
|
7
|
-
style="${
|
|
32
|
+
class="mint-spinner-rotate mint-spinner-size-${e}"
|
|
33
|
+
style="${this.style.width&&this.style.height?`width: ${this.style.width}; height: ${this.style.height};`:``} --mint-spinner-rotate-duration: 0.8s; --mint-spinner-dash-duration: 1.2s;"
|
|
8
34
|
>
|
|
35
|
+
<style>
|
|
36
|
+
@keyframes mint-spinner-rotate {
|
|
37
|
+
to { transform: rotate(360deg); }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes mint-spinner-dash-array {
|
|
41
|
+
0% { stroke-dasharray: 0 62.83; }
|
|
42
|
+
25% { stroke-dasharray: 15.7 47.13; }
|
|
43
|
+
50% { stroke-dasharray: 31.4 31.4; }
|
|
44
|
+
75% { stroke-dasharray: 15.7 47.13; }
|
|
45
|
+
100% { stroke-dasharray: 0 62.83; }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@keyframes mint-spinner-dash-offset {
|
|
49
|
+
0% { stroke-dashoffset: 0; }
|
|
50
|
+
100% { stroke-dashoffset: -62.83; }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.mint-spinner-rotate {
|
|
54
|
+
transform-origin: 50% 50%;
|
|
55
|
+
transform-box: fill-box;
|
|
56
|
+
animation: mint-spinner-rotate var(--mint-spinner-rotate-duration, 0.8s) linear infinite;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.mint-spinner-progress {
|
|
60
|
+
animation:
|
|
61
|
+
mint-spinner-dash-array var(--mint-spinner-dash-duration, 1.2s) ease-in-out infinite,
|
|
62
|
+
mint-spinner-dash-offset var(--mint-spinner-dash-duration, 1.2s) linear infinite;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
|
|
9
66
|
<circle
|
|
10
67
|
cx="12"
|
|
11
68
|
cy="12"
|
|
@@ -13,7 +70,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
13
70
|
stroke="${a}"
|
|
14
71
|
stroke-width="${o}"
|
|
15
72
|
opacity="0.25"
|
|
16
|
-
class="
|
|
73
|
+
class="mint-spinner-track"
|
|
17
74
|
></circle>
|
|
18
75
|
<circle
|
|
19
76
|
cx="12"
|
|
@@ -26,79 +83,25 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
26
83
|
opacity="0.75"
|
|
27
84
|
stroke-dasharray="0 62.83"
|
|
28
85
|
stroke-dashoffset="0"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
attributeName="stroke-dasharray"
|
|
32
|
-
values="0 62.83;15.7 47.13;31.4 31.4;15.7 47.13;0 62.83"
|
|
33
|
-
dur="1.2s"
|
|
34
|
-
repeatCount="indefinite"
|
|
35
|
-
></animate>
|
|
36
|
-
<animate
|
|
37
|
-
attributeName="stroke-dashoffset"
|
|
38
|
-
values="0;-62.83"
|
|
39
|
-
dur="1.2s"
|
|
40
|
-
repeatCount="indefinite"
|
|
41
|
-
></animate>
|
|
42
|
-
</circle>
|
|
86
|
+
class="mint-spinner-progress"
|
|
87
|
+
/>
|
|
43
88
|
</svg>
|
|
44
|
-
`.trim()}};customElements.get(`mint-spinner`)||customElements.define(`mint-spinner`,t);var n=class extends HTMLElement{static get observedAttributes(){return[`name`,`color`]}constructor(){super(),this._darkModeObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`inline-flex`,`items-center`,`leading-none`),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){this.render();break}}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}getName(){return this.getAttribute(`name`)||``}_normalizeColorValue(e){if(!e)return``;let t=e.trim();if(!t)return``;if(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(t)||/^rgba?\(\s*[\d.\s]+,\s*[\d.\s]+,\s*[\d.\s]+(?:,\s*[\d.\s]+)?\s*\)$/.test(t))return t;if(/^\(\s*[\d.\s]+,\s*[\d.\s]+,\s*[\d.\s]+(?:,\s*[\d.\s]+)?\s*\)$/.test(t)){let e=t.slice(1,-1).trim().split(`,`).map(e=>e.trim());if(e.length===3)return`rgb(${e.join(`, `)})`;if(e.length===4)return`rgba(${e.join(`, `)})`}return``}generateSVGMarkup(e){if(e.customSvg)return e.customSvg;let t;return t=e.fill&&e.strokeWidth?`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="currentColor" stroke-width="${e.strokeWidth}" stroke-linecap="${e.strokeLinecap||`round`}" stroke-linejoin="${e.strokeLinejoin||`round`}">
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</
|
|
53
|
-
|
|
54
|
-
</
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
`,document.head.appendChild(t),e._activeShadowStyleInjected=!0}this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add(`w-full`)}disconnectedCallback(){this._disconnectHostChildObserver(),this._hostRenderFromObserverRaf!==null&&(cancelAnimationFrame(this._hostRenderFromObserverRaf),this._hostRenderFromObserverRaf=null),this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-neutral-900`,`dark:!bg-neutral-700`,`hover:!bg-neutral-900`,`dark:hover:!bg-neutral-700`,`!border-t-neutral-900`,`!border-l-neutral-900`,`!border-r-neutral-600`,`!border-b-neutral-600`,`dark:!border-t-neutral-700`,`dark:!border-l-neutral-700`,`dark:!border-r-neutral-500`,`dark:!border-b-neutral-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-mint-divider`,`dark:!border-b-mint-divider`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"link-action":[`!text-neutral-900`,`dark:!text-neutral-300`,`hover:!text-neutral-900`,`dark:hover:!text-neutral-300`],"link-neutral":[`!text-gray-950`,`dark:!text-gray-200`,`hover:!text-gray-950`,`dark:hover:!text-gray-200`],"link-info":[`!text-blue-900`,`dark:!text-blue-200`,`hover:!text-blue-900`,`dark:hover:!text-blue-200`],"link-warning":[`!text-amber-900`,`dark:!text-amber-200`,`hover:!text-amber-900`,`dark:hover:!text-amber-200`],"link-danger":[`!text-red-900`,`dark:!text-red-200`,`hover:!text-red-900`,`dark:hover:!text-red-200`]}[e]||[]}_disconnectHostChildObserver(){this._hostChildObserver?.disconnect()}_connectHostChildObserver(){this.isConnected&&(this._hostChildObserver||=new MutationObserver(e=>{this._onLightDomMutation(e)}),this._hostChildObserver.disconnect(),this._hostChildObserver.observe(this,{childList:!0,subtree:!0,characterData:!0}))}_onLightDomMutation(e){if(this.isConnected){if(this._button&&!this._button.isConnected){this._button=null,this._scheduleRenderFromHostObserver();return}for(let t of e){let e=t.target;if(!(this._button&&(e===this._button||this._button.contains(e)))){this._scheduleRenderFromHostObserver();return}}}}_scheduleRenderFromHostObserver(){this._hostRenderFromObserverRaf===null&&(this._hostRenderFromObserverRaf=requestAnimationFrame(()=>{this._hostRenderFromObserverRaf=null,this.isConnected&&this.render()}))}getButtonClasses(){let e=this.isIconOnly(),t=this.getVariant(),n=this.getAlignment(),r=`justify-center`;n===`left`?r=`justify-start`:n===`right`&&(r=`justify-end`);let i=[`inline-flex`,`items-center`,r,`cursor-pointer`,`font-medium`,`rounded-lg`,`box-border`,...e?[`p-1.5`,`aspect-square`,`w-[2.25rem]`,`h-[2.25rem]`]:[`px-3.5`,`py-1.5`,`min-h-[2.25rem]`],`text-sm`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`[&.mint-button-active:not(:disabled):not([data-loading="true"]):not([data-variant="ghost"]):not([data-variant="link"])>*]:translate-y-[1px]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],a=this.getTone(),o={"solid-action":`bg-neutral-800.dark:bg-neutral-600.text-white.hover:bg-neutral-950.dark:hover:bg-neutral-700.active:bg-neutral-900.dark:active:bg-neutral-700.disabled:active:bg-neutral-800.dark:disabled:active:bg-neutral-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-neutral-600.border-l-neutral-600.border-r-neutral-900.border-b-neutral-900.dark:border-t-neutral-500.dark:border-l-neutral-500.dark:border-r-neutral-700.dark:border-b-neutral-700.active:border-t-neutral-900.active:border-l-neutral-900.active:border-r-neutral-600.active:border-b-neutral-600.dark:active:border-t-neutral-700.dark:active:border-l-neutral-700.dark:active:border-r-neutral-500.dark:active:border-b-neutral-500.disabled:active:border-t-neutral-600.disabled:active:border-l-neutral-600.disabled:active:border-r-neutral-900.disabled:active:border-b-neutral-900.dark:disabled:active:border-t-neutral-500.dark:disabled:active:border-l-neutral-500.dark:disabled:active:border-r-neutral-700.dark:disabled:active:border-b-neutral-700.[&[data-loading="true"]:active]:border-t-neutral-600.[&[data-loading="true"]:active]:border-l-neutral-600.[&[data-loading="true"]:active]:border-r-neutral-900.[&[data-loading="true"]:active]:border-b-neutral-900.[&[data-loading="true"]:active]:dark:border-t-neutral-500.[&[data-loading="true"]:active]:dark:border-l-neutral-500.[&[data-loading="true"]:active]:dark:border-r-neutral-700.[&[data-loading="true"]:active]:dark:border-b-neutral-700`.split(`.`),"solid-neutral":`bg-white.dark:bg-mint-canvas.text-gray-900.dark:text-white.hover:bg-gray-50.dark:hover:bg-mint-hover.active:bg-gray-100.dark:active:bg-mint-hover.disabled:active:bg-white.dark:disabled:active:bg-mint-canvas.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-gray-200.border-l-gray-200.border-r-gray-300.border-b-gray-300.dark:border-t-gray-600.dark:border-l-gray-600.dark:border-r-mint-divider.dark:border-b-mint-divider.active:border-t-gray-400.active:border-l-gray-400.active:border-r-gray-200.active:border-b-gray-200.dark:active:border-t-gray-950.dark:active:border-l-gray-950.dark:active:border-r-mint-divider.dark:active:border-b-mint-divider.disabled:active:border-t-gray-200.disabled:active:border-l-gray-200.disabled:active:border-r-gray-400.disabled:active:border-b-gray-400.dark:disabled:active:border-t-mint-divider.dark:disabled:active:border-l-mint-divider.dark:disabled:active:border-r-gray-950.dark:disabled:active:border-b-gray-950.[&[data-loading="true"]:active]:border-t-gray-200.[&[data-loading="true"]:active]:border-l-gray-200.[&[data-loading="true"]:active]:border-r-gray-400.[&[data-loading="true"]:active]:border-b-gray-400.[&[data-loading="true"]:active]:dark:border-t-mint-divider.[&[data-loading="true"]:active]:dark:border-l-mint-divider.[&[data-loading="true"]:active]:dark:border-r-gray-950.[&[data-loading="true"]:active]:dark:border-b-gray-950`.split(`.`),"solid-info":`bg-blue-800.dark:bg-blue-600.text-white.hover:bg-blue-950.dark:hover:bg-blue-700.active:bg-blue-900.dark:active:bg-blue-700.disabled:active:bg-blue-800.dark:disabled:active:bg-blue-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-blue-600.border-l-blue-600.border-r-blue-900.border-b-blue-900.dark:border-t-blue-500.dark:border-l-blue-500.dark:border-r-blue-700.dark:border-b-blue-700.active:border-t-blue-900.active:border-l-blue-900.active:border-r-blue-600.active:border-b-blue-600.dark:active:border-t-blue-700.dark:active:border-l-blue-700.dark:active:border-r-blue-500.dark:active:border-b-blue-500.disabled:active:border-t-blue-600.disabled:active:border-l-blue-600.disabled:active:border-r-blue-900.disabled:active:border-b-blue-900.dark:disabled:active:border-t-blue-500.dark:disabled:active:border-l-blue-500.dark:disabled:active:border-r-blue-700.dark:disabled:active:border-b-blue-700.[&[data-loading="true"]:active]:border-t-blue-600.[&[data-loading="true"]:active]:border-l-blue-600.[&[data-loading="true"]:active]:border-r-blue-900.[&[data-loading="true"]:active]:border-b-blue-900.[&[data-loading="true"]:active]:dark:border-t-blue-500.[&[data-loading="true"]:active]:dark:border-l-blue-500.[&[data-loading="true"]:active]:dark:border-r-blue-700.[&[data-loading="true"]:active]:dark:border-b-blue-700`.split(`.`),"solid-warning":`bg-amber-800.dark:bg-amber-600.text-white.hover:bg-amber-950.dark:hover:bg-amber-700.active:bg-amber-900.dark:active:bg-amber-700.disabled:active:bg-amber-800.dark:disabled:active:bg-amber-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-amber-600.border-l-amber-600.border-r-amber-900.border-b-amber-900.dark:border-t-amber-500.dark:border-l-amber-500.dark:border-r-amber-700.dark:border-b-amber-700.active:border-t-amber-900.active:border-l-amber-900.active:border-r-amber-600.active:border-b-amber-600.dark:active:border-t-amber-700.dark:active:border-l-amber-700.dark:active:border-r-amber-500.dark:active:border-b-amber-500.disabled:active:border-t-amber-600.disabled:active:border-l-amber-600.disabled:active:border-r-amber-900.disabled:active:border-b-amber-900.dark:disabled:active:border-t-amber-500.dark:disabled:active:border-l-amber-500.dark:disabled:active:border-r-amber-700.dark:disabled:active:border-b-amber-700.[&[data-loading="true"]:active]:border-t-amber-600.[&[data-loading="true"]:active]:border-l-amber-600.[&[data-loading="true"]:active]:border-r-amber-900.[&[data-loading="true"]:active]:border-b-amber-900.[&[data-loading="true"]:active]:dark:border-t-amber-500.[&[data-loading="true"]:active]:dark:border-l-amber-500.[&[data-loading="true"]:active]:dark:border-r-amber-700.[&[data-loading="true"]:active]:dark:border-b-amber-700`.split(`.`),"solid-danger":`bg-red-800.dark:bg-red-600.text-white.hover:bg-red-950.dark:hover:bg-red-700.active:bg-red-900.dark:active:bg-red-700.disabled:active:bg-red-800.dark:disabled:active:bg-red-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-red-600.border-l-red-600.border-r-red-900.border-b-red-900.dark:border-t-red-500.dark:border-l-red-500.dark:border-r-red-700.dark:border-b-red-700.active:border-t-red-900.active:border-l-red-900.active:border-r-red-600.active:border-b-red-600.dark:active:border-t-red-700.dark:active:border-l-red-700.dark:active:border-r-red-500.dark:active:border-b-red-500.disabled:active:border-t-red-600.disabled:active:border-l-red-600.disabled:active:border-r-red-900.disabled:active:border-b-red-900.dark:disabled:active:border-t-red-500.dark:disabled:active:border-l-red-500.dark:disabled:active:border-r-red-700.dark:disabled:active:border-b-red-700.[&[data-loading="true"]:active]:border-t-red-600.[&[data-loading="true"]:active]:border-l-red-600.[&[data-loading="true"]:active]:border-r-red-900.[&[data-loading="true"]:active]:border-b-red-900.[&[data-loading="true"]:active]:dark:border-t-red-500.[&[data-loading="true"]:active]:dark:border-l-red-500.[&[data-loading="true"]:active]:dark:border-r-red-700.[&[data-loading="true"]:active]:dark:border-b-red-700`.split(`.`),"ghost-action":[`bg-transparent`,`text-neutral-800`,`dark:text-neutral-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-200`,`active:bg-gray-50`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`active:text-gray-900`,`dark:active:text-white`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-action":[`bg-transparent`,`text-neutral-800`,`dark:text-neutral-400`,`hover:text-neutral-950`,`dark:hover:text-neutral-200`,`active:text-neutral-900`,`dark:active:text-neutral-300`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-300`,`hover:text-gray-900`,`dark:hover:text-gray-100`,`active:text-gray-950`,`dark:active:text-gray-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`hover:text-blue-950`,`dark:hover:text-blue-300`,`active:text-blue-900`,`dark:active:text-blue-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`hover:text-amber-950`,`dark:hover:text-amber-300`,`active:text-amber-900`,`dark:active:text-amber-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`hover:text-red-950`,`dark:hover:text-red-300`,`active:text-red-900`,`dark:active:text-red-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`]},s=o[`${t}-${a}`]||o[`solid-neutral`],c=[...i,...s];if(this.isActive()){let e=this.getActiveStateClasses();c.push(...e)}return this.isFullWidth()&&c.push(`w-full`),c.join(` `)}render(){this._disconnectHostChildObserver(),this._button&&!this._button.isConnected&&(this._button=null);try{let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`),r=this.isLoading();if(r)if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),`render`in n&&typeof n.render==`function`&&n.render();else{let e=document.createElement(`span`);e.className=`mr-2 inline-flex items-center`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.className===`mr-2`&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();if(a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),r?a.style.display=`none`:a.style.display=``,a.classList.remove(`mr-1.5`,`ml-1.5`),c?a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`)):o===`left`?a.classList.add(`mr-1.5`):a.classList.add(`ml-1.5`)),r){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(c?(e.classList.remove(`mr-2`),e.classList.add(`mr-0`)):e.classList.contains(`mr-2`)||(e.classList.remove(`mr-0`),e.classList.add(`mr-2`)))}let l=this.getButtonClasses();this._button.className=l,this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),r?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}finally{queueMicrotask(()=>{this.isConnected&&this._connectHostChildObserver()})}}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||customElements.define(`mint-button`,r);var i=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`icon`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._button=null,this._checked=!1,this._hasUserToggled=!1}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}_getSwitchContainer(){let e=this.querySelector(`.mint-switch-container`);return e||(e=document.createElement(`div`),e.className=`mint-switch-container flex items-center gap-2`,this.insertBefore(e,this.firstChild)),e}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this.render()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getIcon(){return this.getAttribute(`icon`)||``}hasIcon(){return!!this.getIcon()}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getSwitchClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`cursor-pointer`,`rounded-full`,`h-5`,`w-10`,`border`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-neutral-900`,`dark:bg-neutral-700`,e?`border-red-300 dark:border-red-300`:`border-neutral-800 dark:border-neutral-600`]:[`bg-neutral-200`,`dark:bg-neutral-600`,e?`border-red-300 dark:border-red-300`:`border-neutral-300 dark:border-neutral-500`];return[...t,...n].join(` `)}getThumbClasses(){let e=[`relative`,`inline-block`,`rounded-full`,`bg-white`,`dark:bg-gray-50`,`h-4`,`w-4`,`shadow-lg`,`transform`,this._hasUserToggled?`transition-transform duration-200 ease-in-out`:``,`pointer-events-none`,`overflow-hidden`],t=this._checked?`translate-x-5`:`translate-x-0.5`;return[...e,t].join(` `)}getIconClasses(){return[`absolute`,`inset-0`,`flex`,`items-center`,`justify-center`,`pointer-events-none`].join(` `)}render(){let e=this.isLoading(),t=this.getSwitchClasses(),n=this.getThumbClasses(),r=this.getLabel(),i=this.getInfo(),a=this.getIcon(),o=this.getAttribute(`id`)||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute(`id`)||this.setAttribute(`id`,o);let s=this._getSwitchContainer();this._button?this._button.parentElement!==s&&s.appendChild(this._button):(this._button=document.createElement(`button`),s.appendChild(this._button),this.setupEventListeners());let c=s.querySelector(`.mint-switch-label`);r?(c||(c=document.createElement(`label`),c.className=`mint-switch-label cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,this._button&&this._button.parentElement===s?s.insertBefore(c,this._button.nextSibling):s.appendChild(c)),c.textContent=r,c.setAttribute(`for`,o),this.isDisabled()?(c.classList.add(`opacity-40`,`cursor-not-allowed`),c.classList.remove(`cursor-pointer`)):(c.classList.remove(`opacity-40`,`cursor-not-allowed`),c.classList.add(`cursor-pointer`))):c&&c.remove(),this._button.className=t,this._button.disabled=this.isDisabled(),this._button.id=o,this._button.setAttribute(`aria-checked`,String(this._checked)),this._button.setAttribute(`aria-label`,r||`Toggle switch`),this._button.setAttribute(`role`,`switch`),this._button.type=`button`;let l=this._button.querySelector(`span`);l||(l=document.createElement(`span`),this._button.appendChild(l)),l.className=n;let u=l.querySelector(`span`);if(a){let e=u;e||(e=document.createElement(`span`),e.className=this.getIconClasses(),l.appendChild(e));let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a)}else u&&u.remove();let d=this.querySelector(`.mint-switch-info`);i?(d||(d=document.createElement(`span`),d.className=`mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block`,s&&s.parentElement===this?this.insertBefore(d,s.nextSibling):this.appendChild(d)),d.textContent=i,this.isDisabled()?d.classList.add(`opacity-40`):d.classList.remove(`opacity-40`)):d&&d.remove(),this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this._button&&this._button.addEventListener(`click`,this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener(`click`,this.handleToggle.bind(this))}handleToggle(e){if(!this.isDisabled()){this._hasUserToggled=!0,this.checked=!this._checked;let e=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(e){let t=this._getSwitchContainer(),n=this.getLabel(),r=this.getInfo(),i=t.querySelector(`.mint-switch-skeleton-container`),a=this.querySelector(`.mint-switch-info-skeleton`);if(e){t.classList.contains(`relative`)||t.classList.add(`relative`),i||(i=document.createElement(`div`),i.className=`mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,t.appendChild(i));let e=i.querySelector(`.mint-switch-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,i.appendChild(e)),n){let e=i.querySelector(`.mint-switch-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,i.appendChild(e))}else{let e=i.querySelector(`.mint-switch-skeleton-label`);e&&e.remove()}i.style.display=`flex`,this._button&&(this._button.style.visibility=`hidden`,this._button.style.pointerEvents=`none`);let o=t.querySelector(`.mint-switch-label`);if(o&&(o.style.visibility=`hidden`,o.style.pointerEvents=`none`),r){a||(a=document.createElement(`div`),a.className=`mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-mint-hover animate-pulse mt-2`,t&&t.parentElement===this?this.insertBefore(a,t.nextSibling):this.appendChild(a)),a.style.display=`block`;let e=this.querySelector(`.mint-switch-info`);e&&(e.style.display=`none`)}else a&&(a.style.display=`none`)}else{i&&(i.style.display=`none`),a&&(a.style.display=`none`),this._button&&(this._button.style.visibility=`visible`,this._button.style.pointerEvents=`auto`);let e=t.querySelector(`.mint-switch-label`);e&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`);let n=this.querySelector(`.mint-switch-info`);n&&(n.style.display=``)}}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-switch-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._button&&(this._button.className=this.getSwitchClasses())}};customElements.get(`mint-switch`)||customElements.define(`mint-switch`,i);var a=class extends HTMLElement{static get observedAttributes(){return[`variant`,`size`,`bold`,`underline`,`strike`,`italic`,`display`,`inline`]}constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(e=>this._userClasses.add(e))}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}getVariant(){return this.getAttribute(`variant`)||`default`}getSize(){return this.getAttribute(`size`)||`regular`}isBold(){return this.getAttribute(`bold`)===`true`}isUnderline(){return this.getAttribute(`underline`)===`true`}isStrike(){return this.getAttribute(`strike`)===`true`}isItalic(){return this.getAttribute(`italic`)===`true`}getDisplay(){return this.getAttribute(`display`)||(this.getAttribute(`inline`)===`true`?`inline-block`:`block`)}getTextClasses(){let e=this.getSize(),t=this.getVariant(),n=document.documentElement.classList.contains(`dark`),r={heading:[`font-semibold`],"sub-heading":[`font-medium`],regular:[]},i={default:n?[`text-gray-100`]:[`text-gray-900`],muted:[`text-gray-400`],danger:n?[`text-red-400`]:[`text-red-600`],success:n?[`text-green-400`]:[`text-green-600`]},a=[];this.isBold()&&a.push(`font-bold`),this.isUnderline()&&a.push(`underline`),this.isStrike()&&a.push(`line-through`),this.isItalic()&&a.push(`italic`);let o=this.getDisplay();return[o===`block`?`block`:o===`inline`?`inline`:`inline-block`,...r[e]||r.regular,...i[t]||i.default,...a].join(` `)}render(){let e=this.getSize(),t=[`text-gray-100`,`text-gray-900`,`text-gray-400`,`text-red-400`,`text-red-600`,`text-green-400`,`text-green-600`],n=[`text-2xl`,`text-lg`,`text-sm`];n.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)}),t.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)});let r=this.getTextClasses().split(` `).filter(e=>e.trim());Array.from(this.classList).forEach(e=>{!t.includes(e)&&!n.includes(e)&&this._userClasses.add(e)}),this.className=[...new Set([...r,...Array.from(this._userClasses)])].join(` `);let i={heading:`clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)`,"sub-heading":`clamp(1rem, 1.5vw + 0.5rem, 1.125rem)`,regular:`clamp(0.875rem, 1vw + 0.5rem, 0.875rem)`},a=i[e]||i.regular;this.style.setProperty(`font-size`,a)}};customElements.get(`mint-text`)||customElements.define(`mint-text`,a);var o=class extends HTMLElement{static get observedAttributes(){return[`direction`,`text-align`,`gap`,`align-content`]}constructor(){super(),this._childObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`text-align`&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{let e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&=(this._childObserver.disconnect(),null)}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`;return parseFloat(e)}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`start`||e===`end`||e===`middle`?e:``}getStackClasses(){let e=this.getDirection(),t=this.getTextAlign(),n=this.getGap(),r=this.getAlignContent(),i=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${n}`];return r&&(e===`horizontal`?r===`start`?i.push(`justify-start`):r===`end`?i.push(`justify-end`):i.push(`justify-center`):r===`start`?i.push(`items-start`):r===`end`?i.push(`items-end`):i.push(`items-center`)),t&&(i.push(`text-${t}`),i.push(`[&>*]:text-${t}`),i.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?(i.push(`[&>mint-button]:!justify-start`),i.push(`[&>mint-button>button]:!justify-start`)):t===`right`?(i.push(`[&>mint-button]:!justify-end`),i.push(`[&>mint-button>button]:!justify-end`)):t===`center`&&(i.push(`[&>mint-button]:!justify-center`),i.push(`[&>mint-button>button]:!justify-center`))),i.join(` `)}render(){let e=this.getStackClasses(),t=this.getTextAlign();`flex,flex-row,flex-col,gap-1,gap-2,gap-3,gap-4,gap-5,gap-6,gap-7,gap-8,gap-9,gap-10,gap-11,gap-12,items-start,items-end,items-center,justify-start,justify-end,justify-center,text-left,text-center,text-right,text-justify,[&>*]:text-left,[&>*]:text-center,[&>*]:text-right,[&>*]:text-justify,[&>*_.mint-button-content]:text-left,[&>*_.mint-button-content]:text-center,[&>*_.mint-button-content]:text-right,[&>*_.mint-button-content]:text-justify,[&>mint-button]:!justify-start,[&>mint-button]:!justify-center,[&>mint-button]:!justify-end,[&>mint-button>button]:!justify-start,[&>mint-button>button]:!justify-center,[&>mint-button>button]:!justify-end`.split(`,`).forEach(e=>this.classList.remove(e)),e.split(` `).forEach(e=>{e&&this.classList.add(e)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(t=>{if(t.tagName===`MINT-BUTTON`){let n=t.querySelector(`button`);if(n){n.classList.remove(`justify-start`,`justify-center`,`justify-end`),e===`left`?n.classList.add(`justify-start`):e===`right`?n.classList.add(`justify-end`):e===`center`&&n.classList.add(`justify-center`);let t=n.querySelector(`.mint-button-content`);t&&(t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`))}}else t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(e=>{if(e.tagName===`MINT-BUTTON`){let t=e.querySelector(`button`);if(t){t.classList.remove(`justify-start`,`justify-end`),t.classList.add(`justify-center`);let e=t.querySelector(`.mint-button-content`);e&&e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)}}else e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)})}};customElements.get(`mint-stack`)||customElements.define(`mint-stack`,o);var s=`mint-sortable-placeholder`,c=`mint-sortable-dragging`;function l(e,t,n,r){let i=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${Number.isFinite(n)?Math.min(12,Math.max(1,Math.round(n))):3}`,`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`min-w-0`];return r&&(e===`horizontal`?r===`left`?i.push(`justify-start`):r===`right`?i.push(`justify-end`):i.push(`justify-center`):r===`left`?i.push(`items-start`):r===`right`?i.push(`items-end`):i.push(`items-center`)),t&&(i.push(`text-${t}`),i.push(`[&>*]:text-${t}`),i.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?i.push(`[&>mint-button]:!justify-start`,`[&>mint-button>button]:!justify-start`):t===`right`?i.push(`[&>mint-button]:!justify-end`,`[&>mint-button>button]:!justify-end`):t===`center`&&i.push(`[&>mint-button]:!justify-center`,`[&>mint-button>button]:!justify-center`)),i}var u=class extends HTMLElement{static get observedAttributes(){return[`direction`,`gap`,`text-align`,`align-content`,`scroll-max-height`,`disabled`,`handle-selector`,`scroll-sensitivity`,`scroll-speed`,`animation-duration`,`item-key-attribute`]}constructor(){super(),this._pointerId=null,this._dragEl=null,this._placeholder=null,this._listRoot=this,this._startIndex=0,this._pointerStartX=0,this._pointerStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._scrollRaf=null,this._childObserver=null,this._pointerBoundRoot=null,this._restoreAfter=null,this._onListPointerDown=e=>{let t=e;if(this._isDisabled()||this._pointerId!==null||t.button!==0)return;let n=t.target;if(!n||!this.contains(n))return;let r=this._closestSortableItem(n);if(!r||!this._listRoot.contains(r)||r.hasAttribute(`data-sortable-disabled`))return;let i=this._getHandleSelector();if(i){let e=t.target.closest(i);if(!e||!r.contains(e))return}t.preventDefault(),this._startDrag(t,r)},this._boundPointerMove=this._onPointerMove.bind(this),this._boundPointerUp=this._onPointerUp.bind(this),this._boundPointerCancel=this._onPointerCancel.bind(this)}connectedCallback(){this.classList.add(`relative`,`block`),this._syncInnerStackAttributes(),this._applyHostScrollAndLayout(),this._observeInnerStack()}disconnectedCallback(){this._unobserveInnerStack(),this._teardownDrag(),this._pointerBoundRoot&&=(this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),null)}attributeChangedCallback(e,t,n){t!==n&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}_observeInnerStack(){this._childObserver||(this._childObserver=new MutationObserver(()=>{this._pointerId===null&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}),this._childObserver.observe(this,{childList:!0}))}_unobserveInnerStack(){this._childObserver&&=(this._childObserver.disconnect(),null)}_getInnerStack(){for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-STACK`)return t}return null}_resolveListRoot(){return this._getInnerStack()??this}_getItemKeyAttribute(){return this.getAttribute(`item-key-attribute`)?.trim()||`data-sortable-id`}_collectOrderedKeys(){let e=this._resolveListRoot(),t=this._getItemKeyAttribute(),n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r];if(i.nodeType!==Node.ELEMENT_NODE)continue;let a=i;a.classList.contains(s)||n.push(a.getAttribute(t)??``)}return n}_syncInnerStackAttributes(){let e=this._getInnerStack();if(!e)return;let t=this.getDirection(),n=this.getGap(),r=this.getTextAlign();e.setAttribute(`direction`,t),e.setAttribute(`gap`,String(n)),r?e.setAttribute(`text-align`,r):e.removeAttribute(`text-align`);let i=this.getAlignContent();i?e.setAttribute(`align-content`,i):e.removeAttribute(`align-content`)}_applyHostScrollAndLayout(){this._listRoot=this._resolveListRoot();let e=this.getAttribute(`scroll-max-height`);e?(this.style.maxHeight=e,this.style.overflowY=`auto`,this.style.overflowX=`hidden`,this.classList.add(`overscroll-y-contain`)):(this.style.maxHeight=``,this.style.overflowY=``,this.style.overflowX=``,this.classList.remove(`overscroll-y-contain`));let t=this._getInnerStack();this._stripHostLayoutClasses(),t||l(this.getDirection(),this.getTextAlign(),this.getGap(),this.getAlignContent()).forEach(e=>{e&&this.classList.add(e)}),this._ensureListPointerBinding()}_stripHostLayoutClasses(){Array.from(this.classList).filter(e=>e===`flex`||e===`flex-row`||e===`flex-col`||e.startsWith(`gap-`)||e===`items-start`||e===`items-end`||e===`items-center`||e===`justify-start`||e===`justify-end`||e===`justify-center`||e.startsWith(`text-`)||e.startsWith(`[&`)).forEach(e=>this.classList.remove(e))}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`,t=parseFloat(e);return Number.isFinite(t)?t:3}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`left`||e===`right`||e===`center`?e:``}_isDisabled(){return this.hasAttribute(`disabled`)&&this.getAttribute(`disabled`)!==`false`}_getHandleSelector(){let e=this.getAttribute(`handle-selector`);return e&&e.trim()?e.trim():null}_getScrollSensitivity(){let e=parseFloat(this.getAttribute(`scroll-sensitivity`)||`48`);return Number.isFinite(e)?e:48}_getScrollSpeed(){let e=parseFloat(this.getAttribute(`scroll-speed`)||`12`);return Number.isFinite(e)?e:12}_getAnimationDurationMs(){let e=parseFloat(this.getAttribute(`animation-duration`)||`220`);return Number.isFinite(e)?Math.max(0,e):220}_ensureListPointerBinding(){let e=this._resolveListRoot();this._pointerBoundRoot!==e&&(this._pointerBoundRoot&&this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),e.addEventListener(`pointerdown`,this._onListPointerDown),this._pointerBoundRoot=e,this._listRoot=e)}_closestSortableItem(e){let t=e;for(;t&&t!==this._listRoot;){if(t.nodeType===Node.ELEMENT_NODE){let e=t;if(e.classList.contains(s)||e.classList.contains(c))return null;if(t.parentElement===this._listRoot)return e}t=t.parentElement}return null}_startDrag(e,t){this._listRoot=this._resolveListRoot(),this._restoreAfter=t.nextElementSibling,this._dragEl=t,this._pointerId=e.pointerId,this._startIndex=this._indexOfItem(t);let n=t.getBoundingClientRect();this._pointerStartX=e.clientX,this._pointerStartY=e.clientY,this._dragStartLeft=n.left,this._dragStartTop=n.top;let r=document.createElement(`div`);r.className=[s,`box-border`,`shrink-0`,`rounded-lg`,`border-2`,`border-dashed`,`border-gray-300`,`bg-gray-50/80`,`dark:border-mint-divider`,`dark:bg-mint-hover/40`].join(` `),r.style.minHeight=`${n.height}px`,r.style.minWidth=`${n.width}px`,r.setAttribute(`aria-hidden`,`true`),this._placeholder=r,this._listRoot.insertBefore(r,t),t.classList.add(c),t.style.position=`fixed`,t.style.left=`${n.left}px`,t.style.top=`${n.top}px`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,t.style.margin=`0`,t.style.zIndex=`10000`,t.style.boxSizing=`border-box`,t.style.pointerEvents=`none`,t.style.touchAction=`none`,t.style.willChange=`transform, left, top`,t.setPointerCapture(e.pointerId);let i=this._collectOrderedKeys(),a={index:this._startIndex,keys:i};this.dispatchEvent(new CustomEvent(`mint-sortable-start`,{bubbles:!0,composed:!0,detail:a})),this.dispatchEvent(new CustomEvent(`sort-start`,{bubbles:!0,composed:!0,detail:a})),window.addEventListener(`pointermove`,this._boundPointerMove,{passive:!1}),window.addEventListener(`pointerup`,this._boundPointerUp),window.addEventListener(`pointercancel`,this._boundPointerCancel)}_indexOfItem(e){let t=0;for(let n=0;n<this._listRoot.children.length;n++){let r=this._listRoot.children[n];if(r.nodeType!==Node.ELEMENT_NODE)continue;let i=r;if(!i.classList.contains(s)){if(i===e)return t;t++}}return-1}_getLayoutChildren(){return Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE)}_onPointerMove(e){if(e.pointerId!==this._pointerId||!this._dragEl||!this._placeholder)return;e.preventDefault();let t=e.clientX-this._pointerStartX,n=e.clientY-this._pointerStartY;this._dragEl.style.left=`${this._dragStartLeft+t}px`,this._dragEl.style.top=`${this._dragStartTop+n}px`,this._autoScroll(e),this._maybeMovePlaceholder(e)}_autoScroll(e){let t=this;if(!t.style.maxHeight)return;let n=this._getScrollSensitivity(),r=this._getScrollSpeed(),i=t.getBoundingClientRect();this._scrollRaf!==null&&cancelAnimationFrame(this._scrollRaf),this._scrollRaf=requestAnimationFrame(()=>{this._scrollRaf=null;let a=0;e.clientY<i.top+n?a=-r:e.clientY>i.bottom-n&&(a=r),a!==0&&(t.scrollTop+=a,this._maybeMovePlaceholder(e))})}_maybeMovePlaceholder(e){let t=this._placeholder,n=this._dragEl;if(!t||!n)return;let r=this.getDirection()===`horizontal`,i=r?e.clientX:e.clientY,a=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n&&e!==t),o=null;for(let e of a){let t=e.getBoundingClientRect();if(i<(r?t.left+t.width/2:t.top+t.height/2)){o=e;break}}let s=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n),c=s.length>0&&s[s.length-1]===t;(o?!(t.nextSibling===o&&t.parentNode===this._listRoot):!c)&&this._flipAnimate(()=>{o?this._listRoot.insertBefore(t,o):this._listRoot.appendChild(t)})}_flipAnimate(e){let t=this._dragEl,n=this._getAnimationDurationMs(),r=this._getLayoutChildren().filter(e=>e!==t),i=new Map;r.forEach(e=>i.set(e,e.getBoundingClientRect())),e(),!(n<=0)&&r.forEach(e=>{let t=i.get(e);if(!t)return;let r=e.getBoundingClientRect(),a=t.left-r.left,o=t.top-r.top;Math.abs(a)<.5&&Math.abs(o)<.5||(e.style.transition=`none`,e.style.transform=`translate(${a}px, ${o}px)`,requestAnimationFrame(()=>{e.style.transition=`transform ${n}ms cubic-bezier(0.2, 0.8, 0.2, 1)`,e.style.transform=``;let t=()=>{e.removeEventListener(`transitionend`,t),e.style.transition=``,e.style.transform=``};e.addEventListener(`transitionend`,t,{once:!0}),setTimeout(t,n+40)}))})}_onPointerUp(e){e.pointerId===this._pointerId&&this._finishDrag(!1)}_onPointerCancel(e){e.pointerId===this._pointerId&&this._finishDrag(!0)}_finishDrag(e){let t=this._dragEl,n=this._placeholder;if(!t||this._pointerId===null){this._teardownDrag();return}try{t.releasePointerCapture(this._pointerId)}catch{}if(window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),e){let e=this._restoreAfter;e&&e.parentNode===this._listRoot?this._listRoot.insertBefore(t,e):this._listRoot.appendChild(t)}else n?.parentNode&&this._listRoot.insertBefore(t,n);n?.remove(),this._placeholder=null,t.classList.remove(c),t.style.cssText=``;let r=this._indexOfItem(t),i=this._startIndex;this._pointerId=null,this._dragEl=null,this._restoreAfter=null;let a=this._collectOrderedKeys(),o={oldIndex:i,newIndex:r,cancelled:e,keys:a};this.dispatchEvent(new CustomEvent(`mint-sortable-end`,{bubbles:!0,composed:!0,detail:o})),this.dispatchEvent(new CustomEvent(`sort-stop`,{bubbles:!0,composed:!0,detail:o})),!e&&r!==i&&(this.dispatchEvent(new CustomEvent(`mint-sortable-change`,{bubbles:!0,composed:!0,detail:{oldIndex:i,newIndex:r,keys:a}})),this.dispatchEvent(new CustomEvent(`mint-sortable-order`,{bubbles:!0,composed:!0,detail:{keys:a}})))}_teardownDrag(){if(this._scrollRaf!==null&&(cancelAnimationFrame(this._scrollRaf),this._scrollRaf=null),window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),this._dragEl){try{this._pointerId!==null&&this._dragEl.releasePointerCapture(this._pointerId)}catch{}this._dragEl.classList.remove(c),this._dragEl.style.cssText=``}this._placeholder?.remove(),this._placeholder=null,this._dragEl=null,this._pointerId=null,this._restoreAfter=null}};customElements.get(`mint-sortable`)||customElements.define(`mint-sortable`,u);var d=class extends HTMLElement{static get observedAttributes(){return[`heading`]}constructor(){super(),this._headingElement=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}hasPaddingClass(){return Array.from(this.classList).some(e=>/^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e))}render(){this.classList.add(`rounded-lg`,`shadow`,`bg-white`,`dark:bg-mint-elevated`,`border`,`border-gray-200`,`dark:border-mint-divider`),this.hasPaddingClass()||this.classList.add(`p-4`);let e=this.getHeading();e?(this._headingElement||(this._headingElement=document.createElement(`mint-text`),this._headingElement.setAttribute(`size`,`sub-heading`),this.insertBefore(this._headingElement,this.firstChild)),this._headingElement.textContent=e):this._headingElement&&this._headingElement.parentNode&&(this._headingElement.remove(),this._headingElement=null)}};customElements.get(`mint-card`)||customElements.define(`mint-card`,d);var f=class extends HTMLElement{static get observedAttributes(){return[`href`,`target`]}constructor(){super(),this._link=null,this._contentObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._observeContent()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHref(){return this.getAttribute(`href`)||`#`}getTarget(){return this.getAttribute(`target`)||``}hasIcon(){return!!(this.querySelector(`mint-icon`)||this._link?.querySelector(`mint-icon`))}render(){let e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement(`a`);this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t===`_blank`&&(this._link.rel=`noopener noreferrer`)):(this._link.removeAttribute(`target`),this._link.removeAttribute(`rel`));let n=this.hasIcon(),r=[`text-slate-800`,`dark:text-slate-200`,`underline`,`hover:text-slate-950`,`dark:hover:text-slate-100`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`rounded`];n&&r.push(`inline-flex`,`items-center`,`gap-2`),this._link.className=r.join(` `),this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)})}};customElements.get(`mint-link`)||customElements.define(`mint-link`,f);var p=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._button=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`,`flex`,`items-center`,`justify-center`),this.render()}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this.render()}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}_getTargetUrl(){let e=document.referrer,t=window.location.origin;if(e)try{let n=new URL(e);if(n.origin===t)return n.pathname+n.search}catch{}return this.getFallbackHref()}handleClick(e){e.preventDefault(),e.stopPropagation();let t=this._getTargetUrl(),n=document.referrer,r=n&&(()=>{try{return new URL(n).origin===window.location.origin}catch{return!1}})(),i=new CustomEvent(`back`,{detail:{url:t,isFromReferrer:r,referrer:n||null,fallbackHref:this.getFallbackHref()},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};customElements.get(`mint-back-button`)||customElements.define(`mint-back-button`,p);var m=class extends HTMLElement{static get observedAttributes(){return[`heading`,`fallback-href`,`show-back-button`,`containered`]}constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null,this._contentObserver=null,this._backButton=null,this._backButtonHandler=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this._observeDarkMode(),this._observeContentMutations(),this._setupBackButtonListener()}attributeChangedCallback(e,t,n){t!==n&&(e===`containered`&&this._applyContainerClasses(),this.render())}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._removeBackButtonListener()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}render(){let e=this.getHeading();this._pageContainer||(this._pageContainer=document.createElement(`div`),this.appendChild(this._pageContainer)),this._applyContainerClasses(),this._header||(this._header=document.createElement(`div`),this._header.className=`flex justify-between mb-8`,this._pageContainer.appendChild(this._header)),this._titleElement||(this._titleElement=document.createElement(`div`),this._titleElement.className=`flex gap-4 min-w-0 flex-1`,this._header.appendChild(this._titleElement));let t=this._titleElement.querySelector(`mint-back-button`);if(this.shouldShowBackButton()){t||(t=document.createElement(`mint-back-button`),this._titleElement.insertBefore(t,this._titleElement.firstChild));let e=this.getFallbackHref();t.setAttribute(`fallback-href`,e),this._backButton=t}else t&&(t.remove(),t=null,this._backButton=null);e?(this._headingText?(this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._headingText.previousSibling!==t&&this._titleElement.insertBefore(this._headingText,t.nextSibling):this._headingText.previousSibling&&this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)):(this._headingText=document.createElement(`mint-text`),this._headingText.setAttribute(`size`,`heading`),this._headingText.setAttribute(`bold`,`true`),this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,t.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=e):this._headingText&&=(this._headingText.remove(),null),this._actionsSlot?this._actionsSlot.classList.contains(`ml-4`)||this._actionsSlot.classList.add(`ml-4`):(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`flex gap-2 items-center ml-4`,this._actionsSlot.setAttribute(`slot`,`actions`),this._header.appendChild(this._actionsSlot)),Array.from(this.children).filter(e=>e!==this._pageContainer&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{this._actionsSlot&&e.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(e)}),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(e=>{e!==this._pageContainer&&e.getAttribute(`slot`)!==`actions`&&e!==this._actionsSlot&&e!==this._header&&e!==this._bodySlot&&e!==this._headingText&&e.parentElement!==this._bodySlot&&e.parentElement!==this._pageContainer&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add(`p-5`),this.getAttribute(`containered`)===`true`?this._pageContainer.classList.add(`max-w-6xl`,`mx-auto`,`w-full`):this._pageContainer.classList.remove(`max-w-6xl`,`mx-auto`,`w-full`))}_updateBackgroundColor(){this._pageContainer&&(document.documentElement.classList.contains(`dark`)?(this._pageContainer.classList.remove(`bg-gray-20`),this._pageContainer.classList.add(`bg-mint-canvas`)):(this._pageContainer.classList.remove(`bg-mint-canvas`),this._pageContainer.classList.add(`bg-gray-20`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_setupBackButtonListener(){this._backButtonHandler||=e=>{let t=e.target;if(t&&t.tagName===`MINT-BACK-BUTTON`){e.stopPropagation();let t=new CustomEvent(`back`,{detail:e.detail,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t)}},this.addEventListener(`back`,this._backButtonHandler,!0)}_removeBackButtonListener(){this._backButtonHandler&&=(this.removeEventListener(`back`,this._backButtonHandler,!0),null)}};customElements.get(`mint-page`)||customElements.define(`mint-page`,m);var h=class extends HTMLElement{static get observedAttributes(){return[`columns`,`sm`,`md`,`lg`,`xl`,`gap`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getColumns(){return this.getAttribute(`columns`)||`1`}getSm(){return this.getAttribute(`sm`)}getMd(){return this.getAttribute(`md`)}getLg(){return this.getAttribute(`lg`)}getXl(){return this.getAttribute(`xl`)}getGap(){return`3`}getGridClasses(){let e=[`grid`],t=this.getColumns();e.push(`grid-cols-${t}`);let n=this.getSm();n&&e.push(`sm:grid-cols-${n}`);let r=this.getMd();r&&e.push(`md:grid-cols-${r}`);let i=this.getLg();i&&e.push(`lg:grid-cols-${i}`);let a=this.getXl();a&&e.push(`xl:grid-cols-${a}`);let o=this.getGap();return e.push(`gap-${o}`),e}render(){Array.from(this.classList).filter(e=>e.startsWith(`grid-cols-`)||e.startsWith(`sm:grid-cols-`)||e.startsWith(`md:grid-cols-`)||e.startsWith(`lg:grid-cols-`)||e.startsWith(`xl:grid-cols-`)||e.startsWith(`gap-`)).forEach(e=>this.classList.remove(e)),this.classList.contains(`grid`)||this.classList.add(`grid`),this.getGridClasses().forEach(e=>{e&&e!==`grid`&&this.classList.add(e)})}};customElements.get(`mint-grid`)||customElements.define(`mint-grid`,h);var g=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`size`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null,this._contentObserver=null,this._renderFrame=null,this._exitTimer=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`inset-0`,`z-[120]`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._observeDarkMode(),this._observeContentMutations()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getSize(){return this.getAttribute(`size`)===`small`?`small`:`default`}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getSize()===`small`?`max-w-md`:`max-w-2xl`;if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`fixed inset-0 bg-black/50 transition-opacity duration-200 z-[120]`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-[130]`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg shadow-xl ${r} w-full max-h-[90vh] flex flex-col pointer-events-auto transform`,this._modal.appendChild(e)),this._animateEnter()}else this._animateExit();let i=this._modal.querySelector(`.modal-content`);i||(i=document.createElement(`div`),i.className=`modal-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg shadow-xl ${r} w-full max-h-[90vh] flex flex-col pointer-events-auto transform`,this._modal.appendChild(i)),i.classList.remove(`max-w-md`,`max-w-2xl`),i.classList.add(r),this._header||(this._header=document.createElement(`div`),this._header.className=`flex items-center justify-between p-4 border-b border-gray-200 dark:border-mint-divider`,i.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`flex-1`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let a=this._headingSlot.querySelector(`mint-text`);t?(a||(a=document.createElement(`mint-text`),a.setAttribute(`size`,`sub-heading`),a.setAttribute(`bold`,`true`),this._headingSlot.appendChild(a)),a.textContent=t):a&&a.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton));let o=Array.from(this.children),s=Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`),c=o.filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`),l=!!this._bodySlot&&this._bodySlot.childNodes.length>0;s.length>0||c.length>0||l?(this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`flex-1 overflow-y-auto p-4`,this._bodySlot.setAttribute(`slot`,`body`),i.appendChild(this._bodySlot)),s.forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),c.forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)})):this._bodySlot&&this._bodySlot.childNodes.length===0&&(this._bodySlot.remove(),this._bodySlot=null);let u=Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`),d=this._actionsSlot?.querySelector(`[data-mint-modal-actions-row]`),f=!!d&&Array.from(d.childNodes).some(e=>e.nodeType===Node.ELEMENT_NODE?!0:e.nodeType===Node.TEXT_NODE?!!e.textContent?.trim():!1);if(u.length>0||f){this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`p-4 border-t border-gray-200 dark:border-mint-divider`,this._actionsSlot.setAttribute(`slot`,`actions`),i.appendChild(this._actionsSlot));let e=this._actionsSlot.querySelector(`[data-mint-modal-actions-row]`);e||(e=document.createElement(`div`),e.setAttribute(`data-mint-modal-actions-row`,`true`),e.className=`flex w-full items-center justify-between gap-3`,this._actionsSlot.appendChild(e));let t=e.querySelector(`[data-mint-modal-actions-left]`);t||(t=document.createElement(`div`),t.setAttribute(`data-mint-modal-actions-left`,`true`),t.className=`flex min-w-0 items-center gap-2`,e.appendChild(t));let n=e.querySelector(`[data-mint-modal-actions-right]`);n||(n=document.createElement(`div`),n.setAttribute(`data-mint-modal-actions-right`,`true`),n.className=`ml-auto flex items-center justify-end gap-2`,e.appendChild(n)),u.forEach(e=>{let r=(e.getAttribute(`data-actions-align`)||e.getAttribute(`align`)||`end`).toLowerCase()===`start`?t:n;if(e.children.length>0){Array.from(e.children).forEach(e=>{e.parentElement!==r&&r.appendChild(e)}),e.remove();return}e.parentElement!==r&&(e.removeAttribute(`slot`),r.appendChild(e))})}else this._actionsSlot&&=(this._actionsSlot.remove(),null);this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;let e=document.documentElement.classList.contains(`dark`),t=this._modal.querySelector(`.modal-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-mint-elevated`,`border`,`border-mint-divider`)):(t.classList.remove(`bg-mint-elevated`,`border`,`border-mint-divider`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,this.classList.remove(`hidden`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})}))}_animateExit(){let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`hidden`);return}e.style.transition=`opacity 200ms ease-in, transform 200ms ease-in`,e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._exitTimer=window.setTimeout(()=>{this.classList.add(`hidden`),e.style.transform=``,e.style.opacity=``,e.style.transition=``,this._exitTimer=null},200)}};customElements.get(`mint-modal`)||customElements.define(`mint-modal`,g);var _=class e extends HTMLElement{static{this.VIEWPORT_EDGE_MARGIN=12}static{this.MAX_POPOVER_CONTENT_HEIGHT_PX=500}static{this.MIN_POPOVER_CONTENT_HEIGHT_PX=48}static get observedAttributes(){return[`id`,`direction`,`open`,`trigger-id`,`trigger-toggle`,`trigger-align`,`padding`,`hover`,`distance`]}constructor(){super(),this._overlay=null,this._popover=null,this._triggerElement=null,this._darkModeObserver=null,this._clickOutsideHandler=null,this._triggerClickHandler=null,this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._hoverCloseTimeout=null,this._scrollHandler=null,this._resizeHandler=null}connectedCallback(){let e=this._isInsideModal()?`z-[60]`:`z-50`;this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`top-0`,`left-0`,e,`pointer-events-none`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._setupTrigger(),this._observeDarkMode()}_ownsNode(e){return e?!!(this.contains(e)||this._triggerElement?.contains(e)):!1}_isInsideModal(){let e=this;for(;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}if(this._triggerElement)for(e=this._triggerElement;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}return!1}disconnectedCallback(){this._removeHoverListeners(),this._overlay?.remove(),this._popover?.remove(),this._overlay=null,this._popover=null,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&this._triggerElement.removeAttribute(`active`),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}attributeChangedCallback(e,t,n){if(t!==n){if(this.isConnected){let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this.classList.remove(`z-50`,`z-[60]`,`z-[80]`),this.classList.add(e)}this.render(),(e===`trigger-id`||e===`hover`||e===`trigger-toggle`)&&this._setupTrigger(),e===`open`&&this.isOpen()&&this._closeOtherPopovers()}}getId(){return this.getAttribute(`id`)||``}getPadding(){let e=this.getAttribute(`padding`)||`4`;return{0:`p-0`,"0.5":`p-0.5`,1:`p-1`,"1.5":`p-1.5`,2:`p-2`,"2.5":`p-2.5`,3:`p-3`,"3.5":`p-3.5`,4:`p-4`,5:`p-5`,6:`p-6`,8:`p-8`,10:`p-10`,12:`p-12`,16:`p-16`,20:`p-20`,24:`p-24`}[e]||`p-4`}getDirection(){return this.getAttribute(`direction`)||`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}getDistance(){return(this.getAttribute(`distance`)||``).trim()}_getDistancePx(){let e=this.getDistance();if(!e)return 8;let t=e.match(/^(-?\d*\.?\d+)\s*(px|rem)$/i);if(!t)return 8;let n=parseFloat(t[1]),r=t[2].toLowerCase();if(!Number.isFinite(n))return 8;let i=Math.max(0,n);if(r===`px`)return i;let a=parseFloat(getComputedStyle(document.documentElement).fontSize||`16`);return i*(Number.isFinite(a)?a:16)}isHoverEnabled(){return this.getAttribute(`hover`)===`true`}getTriggerAlign(){let e=(this.getAttribute(`trigger-align`)||`center`).toLowerCase();return e===`start`||e===`end`?e:`center`}isTriggerToggleEnabled(){return this.getAttribute(`trigger-toggle`)!==`false`}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_setupTrigger(){let e=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),e&&(this._triggerElement=document.getElementById(e),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{if(this._triggerElement=document.getElementById(e),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners(),this.isOpen()&&this._popover)){let e=this._popover.querySelector(`.popover-content`);e&&this._updatePosition(e)}},10))}_attachTriggerListener(){if(this.isTriggerToggleEnabled()&&this._triggerElement&&!this._triggerClickHandler){let e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.getAttribute(`open`)===`true`?e.removeAttribute(`open`):e.setAttribute(`open`,`true`)},this._triggerElement.addEventListener(`click`,this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();let e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._triggerElement.addEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement.addEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){e._cancelHoverClose()},this._popoverHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._popover.addEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover.addEventListener(`mouseleave`,this._popoverHoverLeaveHandler))}_removeHoverListeners(){this._triggerElement&&this._triggerHoverEnterHandler&&this._triggerElement.removeEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement&&this._triggerHoverLeaveHandler&&this._triggerElement.removeEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&this._popoverHoverEnterHandler&&this._popover.removeEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover&&this._popoverHoverLeaveHandler&&this._popover.removeEventListener(`mouseleave`,this._popoverHoverLeaveHandler),this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._cancelHoverClose()}_scheduleHoverClose(){this._cancelHoverClose(),this._hoverCloseTimeout=window.setTimeout(()=>{this._isHovering()||this.close()},120)}_cancelHoverClose(){this._hoverCloseTimeout!==null&&(clearTimeout(this._hoverCloseTimeout),this._hoverCloseTimeout=null)}_isHovering(){let e=this._triggerElement?this._triggerElement.matches(`:hover`):!1,t=this._popover?this._popover.matches(`:hover`):!1;return e||t}_setPopoverContentMaxHeightForMeasurement(t){let n=e.MAX_POPOVER_CONTENT_HEIGHT_PX;t.style.maxHeight=`${n}px`,t.style.overflowY=`auto`,t.style.overflowX=`hidden`,t.style.overscrollBehavior=`contain`}_calculatePosition(t={applyViewportMaxHeight:!0}){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:`down`};let n=this._triggerElement.getBoundingClientRect(),r=this._popover.querySelector(`.popover-content`);if(!r)return{top:0,left:0,direction:`down`};t.applyViewportMaxHeight&&this._setPopoverContentMaxHeightForMeasurement(r),this.classList.contains(`hidden`)&&(this.classList.remove(`hidden`),this._popover.style.visibility=`hidden`);let i=window.innerWidth,a=window.innerHeight,o=this._getDistancePx(),s=e.VIEWPORT_EDGE_MARGIN,c=this.getDirection(),l=0,u=0,d=this.getTriggerAlign();switch(c){case`down`:case`up`:{let f=a-n.bottom-o-s,p=n.top-o-s,m=e=>d===`start`?n.left:d===`end`?n.right-e:n.left+n.width/2-e/2,h=(e,t)=>{let n=e;return n<s&&(n=s),n+t>i-s&&(n=Math.max(s,i-t-s)),n+t>i&&(n=Math.max(0,i-t)),n},g=()=>{this._popover.offsetHeight;let e=this._popover.getBoundingClientRect(),t=r.getBoundingClientRect();return{width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}},_=g(),v=n.bottom+o,y=n.top-_.height-o,b=v+_.height<=a-s+.5,x=y>=s-.5,S=e=>({top:v,left:h(m(e),e),direction:`down`}),C=e=>({top:y,left:h(m(e),e),direction:`up`}),w=this.getDirection(),T=null;if(w===`down`?b?T=S(_.width):x&&(T=C(_.width)):x?T=C(_.width):b&&(T=S(_.width)),T||=b?S(_.width):x||p>=f?C(_.width):S(_.width),l=T.top,u=T.left,c=T.direction,t.applyViewportMaxHeight){let t=n.bottom+o,i=a-s-t,u=n.top-o-s,d=c===`up`?u:i,f=Math.min(e.MAX_POPOVER_CONTENT_HEIGHT_PX,Math.max(e.MIN_POPOVER_CONTENT_HEIGHT_PX,Math.floor(d)));r.style.maxHeight=`${f}px`,this._popover.offsetHeight;let p=g();c===`up`&&(l=n.top-p.height-o)}break}case`right`:{this._popover.offsetHeight;let e=r.getBoundingClientRect();if(l=d===`start`?n.top:d===`end`?n.bottom-e.height:n.top+n.height/2-e.height/2,u=n.right+o,u+e.width>i){let t=n.left-e.width-o;t>=0?(c=`left`,u=t):(u=Math.max(0,i-e.width-o),u+e.width>i&&(u=i-e.width))}l<0&&(l=o),l+e.height>a&&(l=Math.max(o,a-e.height-o),l+e.height>a&&(l=a-e.height));break}case`left`:{this._popover.offsetHeight;let e=r.getBoundingClientRect();if(l=d===`start`?n.top:d===`end`?n.bottom-e.height:n.top+n.height/2-e.height/2,u=n.left-e.width-o,u<0){let t=n.right+o;t+e.width<=i?(c=`right`,u=t):(u=Math.min(i-e.width-o,i-e.width),u<0&&(u=0))}l<0&&(l=o),l+e.height>a&&(l=Math.max(o,a-e.height-o),l+e.height>a&&(l=a-e.height));break}}return{top:l,left:u,direction:c}}render(){let e=this.getId(),t=this.isOpen(),n=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove(`hidden`),this.style.pointerEvents=`auto`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.setAttribute(`active`,`true`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),!this._clickOutsideHandler){let e=this;this._clickOutsideHandler=function(t){let n=t.composedPath(),r=n.some(t=>t===e?!0:t instanceof Node?e._ownsNode(t):!1);if(!(e._triggerElement&&n.includes(e._triggerElement))&&!r){e.close();return}},setTimeout(()=>{document.addEventListener(`click`,this._clickOutsideHandler,!1)},100)}}else this.classList.add(`hidden`),this.style.pointerEvents=`none`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.removeAttribute(`active`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null);if(this._overlay){let e=this._isInsideModal()?`z-[75]`:`z-[55]`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this._overlay.parentElement!==this&&this.appendChild(this._overlay)}else{this._overlay=document.createElement(`div`);let e=this._isInsideModal()?`z-[75]`:`z-[55]`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this.appendChild(this._overlay)}if(this._popover){let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this._popover.className=`fixed ${e} pointer-events-auto rounded-lg bg-white dark:bg-mint-elevated`,this._popover.parentElement!==this&&this.appendChild(this._popover)}else{this._popover=document.createElement(`div`);let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this._popover.className=`fixed ${e} pointer-events-auto rounded-lg bg-white dark:bg-mint-elevated`,this.appendChild(this._popover)}this.isHoverEnabled()&&this._attachHoverListeners();let r=this._popover.querySelector(`.popover-content`);if(!r)r=document.createElement(`div`),r.className=`popover-content min-h-0 bg-white dark:bg-mint-elevated border border-gray-200 dark:border-mint-divider rounded-lg shadow-xl ${n} transform`,this._popover.appendChild(r);else{let e=r.className.split(/\s+/).filter(Boolean),t=[`p-0`,`p-0.5`,`p-1`,`p-1.5`,`p-2`,`p-2.5`,`p-3`,`p-3.5`,`p-4`,`p-5`,`p-6`,`p-8`,`p-10`,`p-12`,`p-16`,`p-20`,`p-24`],i=e.filter(e=>!t.includes(e)),a=[`border`,`border-gray-200`,`dark:border-mint-divider`],o=[...i];for(let e of a)o.includes(e)||o.push(e);o.includes(`min-h-0`)||o.push(`min-h-0`),r.className=[...o,n].join(` `)}Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._popover&&e.parentElement===this&&r.appendChild(e)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(r):(this._popover.style.top=`50%`,this._popover.style.left=`50%`,this._popover.style.transform=`translate(-50%, -50%)`,this._popover.style.visibility=`visible`,this._popover.style.display=`block`,this._setPopoverContentMaxHeightForMeasurement(r),r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,r.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.transform=`scale(1) translateY(0)`,r.style.opacity=`1`})}))):!t&&r&&(this._removePositionListeners(),r.style.opacity!==`0`&&r.style.opacity!==``&&(r.style.transition=`opacity 200ms ease-in, transform 200ms ease-in`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,setTimeout(()=>{r.style.transform=``,r.style.opacity=``,r.style.transition=``,this._popover.style.visibility=``,this._popover.style.display=``},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;let e=document.documentElement.classList.contains(`dark`),t=this._popover.querySelector(`.popover-content`),n=e?`#454545`:`#ffffff`;e?(this._popover.classList.remove(`bg-white`),this._popover.classList.add(`bg-mint-elevated`)):(this._popover.classList.remove(`bg-mint-elevated`),this._popover.classList.add(`bg-white`)),this._popover.style.backgroundColor=n,t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-mint-elevated`)):(t.classList.remove(`bg-mint-elevated`),t.classList.add(`bg-white`)),t.style.backgroundColor=n)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_updatePosition(e,t={applyViewportMaxHeight:!0}){if(!this._triggerElement||!this._popover)return;this._popover.style.transform=``;let n=this._popover.style.visibility!==`hidden`;n||(this._popover.style.visibility=`hidden`,this._popover.style.display=`block`,this._popover.style.top=`0`,this._popover.style.left=`0`),this._popover.offsetHeight;let r=this._calculatePosition(t);this._popover.style.top=`${r.top}px`,this._popover.style.left=`${r.left}px`,n||(this._popover.style.visibility=`visible`,e&&(!e.style.opacity||e.style.opacity===``)&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){let e=this;this._scrollHandler=function(t){if(!e.isOpen()||!e._popover)return;let n=t.target;if(n instanceof Node&&e._popover.contains(n))return;let r=e._popover.querySelector(`.popover-content`);r&&e._updatePosition(r,{applyViewportMaxHeight:!1})},window.addEventListener(`scroll`,this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){let e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`resize`,this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_closeOtherPopovers(){Array.from(document.querySelectorAll(`mint-popover[open]`)).forEach(e=>{if(e!==this){let t=e;typeof t.close==`function`?t.close():e.removeAttribute(`open`)}})}};customElements.get(`mint-popover`)||customElements.define(`mint-popover`,_);var v=class extends HTMLElement{static get observedAttributes(){return[`id`,`open`,`trigger-id`,`trigger-toggle`,`disabled`]}constructor(){super(),this._triggerElement=null,this._triggerClickHandler=null,this._contentElement=null,this._contentId=``,this._initialRenderDone=!1,this._triggerRetryTimer=null,this._transitionEndHandler=null}connectedCallback(){this.classList.add(`block`,`box-border`),this._ensureStructure(),this._setupTrigger(),this.render()}disconnectedCallback(){this._teardownTrigger(),this._triggerRetryTimer!==null&&(clearTimeout(this._triggerRetryTimer),this._triggerRetryTimer=null),this._contentElement&&this._transitionEndHandler&&this._contentElement.removeEventListener(`transitionend`,this._transitionEndHandler),this._transitionEndHandler=null}attributeChangedCallback(e,t,n){if(t!==n){if((e===`trigger-id`||e===`trigger-toggle`)&&this._setupTrigger(),e===`open`){this._animateToState();return}this.render()}}isOpen(){return this.getAttribute(`open`)===`true`}isDisabled(){let e=this.getAttribute(`disabled`);return e!==null&&e!==`false`}open(){this.isDisabled()||(this.setAttribute(`open`,`true`),this.dispatchEvent(new CustomEvent(`open`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{open:!0},bubbles:!0})))}close(){let e=this.isOpen();this.removeAttribute(`open`),e&&(this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{open:!1},bubbles:!0})))}toggle(){this.isOpen()?this.close():this.open()}_ensureStructure(){this._contentId||=`mint-collapsible-content-${Math.random().toString(36).slice(2,10)}`;let e=this.querySelector(`[slot="content"]`);if(e){this._contentElement=e,this._contentElement.id=this._contentId;return}let t=document.createElement(`div`);t.setAttribute(`slot`,`content`),t.id=this._contentId,Array.from(this.children).filter(e=>e instanceof HTMLElement?e.getAttribute(`slot`)!==`trigger`:!1).forEach(e=>t.appendChild(e)),this.appendChild(t),this._contentElement=t}_getTriggerElement(){let e=(this.getAttribute(`trigger-id`)||``).trim();return e?document.getElementById(e):this.querySelector(`[slot="trigger"]`)}_teardownTrigger(){this._triggerRetryTimer!==null&&(clearTimeout(this._triggerRetryTimer),this._triggerRetryTimer=null),this._triggerClickHandler&&this._triggerElement&&this._triggerElement.removeEventListener(`click`,this._triggerClickHandler),this._triggerClickHandler=null,this._triggerElement=null}_setupTrigger(){let e=this._triggerElement,t=this._getTriggerElement();if(e&&t&&e===t&&this._triggerClickHandler&&this.getAttribute(`trigger-toggle`)!==`false`){this._syncTriggerA11y();return}if(this._teardownTrigger(),this._triggerElement=t,!this._triggerElement){this.getAttribute(`trigger-id`)&&(this._triggerRetryTimer=window.setTimeout(()=>{this._triggerRetryTimer=null,this._setupTrigger()},10));return}if(this.getAttribute(`trigger-toggle`)===`false`){this._syncTriggerA11y();return}this._triggerClickHandler=e=>{this.isDisabled()||(e.currentTarget instanceof HTMLAnchorElement&&e.preventDefault(),this.toggle())},this._triggerElement.addEventListener(`click`,this._triggerClickHandler),this._syncTriggerA11y()}_syncTriggerA11y(){this._triggerElement&&(this._triggerElement.setAttribute(`aria-expanded`,this.isOpen()?`true`:`false`),this._triggerElement.setAttribute(`aria-controls`,this._contentId),this._triggerElement.setAttribute(`aria-disabled`,this.isDisabled()?`true`:`false`))}render(){this._contentElement=this.querySelector(`[slot="content"]`),this._contentElement||=(this._ensureStructure(),this.querySelector(`[slot="content"]`));let e=this.isOpen(),t=this.isDisabled();this._contentElement&&(this._contentElement.id=this._contentId,this._contentElement.classList.add(`overflow-hidden`,`transition-[height,opacity,transform]`,`duration-200`,`ease-out`,`rounded-md`,`border`,`border-gray-200`,`dark:border-mint-divider`,`bg-white`,`dark:bg-mint-elevated`,`will-change-[height,opacity,transform]`),this._initialRenderDone||(this._contentElement.classList.toggle(`hidden`,!e),this._contentElement.style.height=e?`auto`:`0px`,this._contentElement.style.opacity=e?`1`:`0`,this._contentElement.style.transform=e?`translateY(0)`:`translateY(-4px)`));let n=this._getTriggerElement();n?(n!==this._triggerElement&&this._setupTrigger(),n.classList.toggle(`cursor-not-allowed`,t),n.classList.toggle(`opacity-60`,t),this._triggerElement=n,this._syncTriggerA11y()):this.getAttribute(`trigger-id`)&&this._setupTrigger(),this._initialRenderDone||=!0}_animateToState(){let e=this.querySelector(`[slot="content"]`);if(!e)return;if(this._transitionEndHandler&&=(e.removeEventListener(`transitionend`,this._transitionEndHandler),null),this.isOpen()){e.classList.remove(`hidden`),e.style.overflow=`hidden`,e.style.height=`0px`,e.style.opacity=`0`,e.style.transform=`translateY(-4px)`,e.offsetHeight;let t=e.scrollHeight;e.style.height=`${t}px`,e.style.opacity=`1`,e.style.transform=`translateY(0)`,this._transitionEndHandler=t=>{t.propertyName===`height`&&(e.style.height=`auto`,e.style.overflow=`visible`,e.removeEventListener(`transitionend`,this._transitionEndHandler),this._transitionEndHandler=null)},e.addEventListener(`transitionend`,this._transitionEndHandler);return}let t=e.scrollHeight;e.style.overflow=`hidden`,e.style.height=`${t}px`,e.style.opacity=`1`,e.style.transform=`translateY(0)`,e.offsetHeight,e.style.height=`0px`,e.style.opacity=`0`,e.style.transform=`translateY(-4px)`,this._transitionEndHandler=t=>{t.propertyName===`height`&&(e.classList.add(`hidden`),e.removeEventListener(`transitionend`,this._transitionEndHandler),this._transitionEndHandler=null)},e.addEventListener(`transitionend`,this._transitionEndHandler)}};customElements.get(`mint-collapsible`)||customElements.define(`mint-collapsible`,v);var y=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`error`,`error-message`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null,this._changeHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-flex`,`items-start`,`gap-2`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render(),e===`checked`&&this._checkbox&&this.updateVisualState()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this.getAttribute(`value`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getCheckboxClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`justify-center`,`flex-shrink-0`,`w-5`,`h-5`,`rounded`,`border-2`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`cursor-pointer`,`disabled:opacity-40`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-neutral-800`,`dark:bg-neutral-600`,e?`border-red-300 dark:border-red-300`:`border-neutral-800 dark:border-neutral-600`]:[`bg-white`,`dark:bg-mint-elevated`,e?`border-red-300 dark:border-red-300`:`border-gray-300 dark:border-gray-500`];return[...t,...n].join(` `)}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-container`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-container relative inline-flex items-start gap-2`,this.insertBefore(i,this.firstChild));let a=this.querySelector(`.mint-checkbox-wrapper`);a?a.parentElement!==i&&i.appendChild(a):(a=document.createElement(`div`),a.className=`mint-checkbox-wrapper`,i.appendChild(a)),this._checkbox?this._checkbox.parentElement!==a&&a.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,a.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._checkbox.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._checkbox.checked=this._checked,this._checkbox.disabled=r,this._changeHandler||this.setupEventListeners();let o=this.getId();o?this._checkbox.id=o:this._checkbox.removeAttribute(`id`);let s=this.getName();s?this._checkbox.name=s:this._checkbox.removeAttribute(`name`);let c=this.getValue();c?this._checkbox.value=c:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),a.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,a.style.cursor=`pointer`,a.style.pointerEvents=`auto`,this._checkbox.style.pointerEvents=`auto`;let l=a;l._wrapperClickHandler||(l._wrapperClickHandler=e=>{e.target===a&&!r&&(e.preventDefault(),e.stopPropagation(),this.toggle())},a.addEventListener(`click`,l._wrapperClickHandler));let u=a.querySelector(`mint-icon`);u||(u=document.createElement(`mint-icon`),u.setAttribute(`name`,`check`),u.className=`w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto`,u.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,u.style.zIndex=`1`,a.appendChild(u)),this.updateVisualState();let d=this.querySelector(`.mint-checkbox-label-container`),f=this.querySelector(`.mint-checkbox-container`);if(t||n){d?f&&d.parentElement!==f&&f.appendChild(d):(d=document.createElement(`div`),d.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,f?f.appendChild(d):this.appendChild(d));let e=d.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none`,d.insertBefore(e,d.firstChild)),e.textContent=t,r?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let i=d.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none`,d.appendChild(i)),i.textContent=n,r?i.classList.add(`opacity-40`):i.classList.remove(`opacity-40`)):i&&i.remove(),r)d.style.cursor=`default`,d._clickHandler&&(d.removeEventListener(`click`,d._clickHandler),d._clickHandler=null);else{d.style.cursor=`pointer`;let e=d._clickHandler;e&&d.removeEventListener(`click`,e),d._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},d.addEventListener(`click`,d._clickHandler)}}else d&&d.remove();this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState();let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0}));let n=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(n)},this._checkbox.addEventListener(`change`,this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`rgb(38 38 38)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(64 64 64)`:t.style.backgroundColor=`rgb(48 48 48)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`mousedown`,this._mousedownHandler),this._checkbox.addEventListener(`mouseup`,this._mouseupHandler),this._checkbox.addEventListener(`mouseleave`,this._mouseleaveHandler),this._focusHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(`:focus-visible`)&&t?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{let e=this.querySelector(`.mint-checkbox-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._checkbox.addEventListener(`focus`,this._focusHandler),this._checkbox.addEventListener(`blur`,this._blurHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`rgb(38 38 38)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(64 64 64)`:t.style.backgroundColor=`rgb(48 48 48)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`touchstart`,this._touchstartHandler),this._checkbox.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&=(this._checkbox.removeEventListener(`change`,this._changeHandler),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null),this._focusHandler&&=(this._checkbox.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._checkbox.removeEventListener(`blur`,this._blurHandler),null));let e=this.querySelector(`.mint-checkbox-wrapper`);if(e){let t=e;t._wrapperClickHandler&&=(e.removeEventListener(`click`,t._wrapperClickHandler),null)}}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=e?.querySelector(`mint-icon`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains(`mint-checkbox-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState(),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0}));let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}_renderSkeleton(e){let t=this.querySelector(`.mint-checkbox-skeleton-container`),n=this.querySelector(`.mint-checkbox-container`),r=this.querySelector(`.mint-checkbox-wrapper`),i=this.querySelector(`.mint-checkbox-label-container`);if(e){t||(t=document.createElement(`div`),t.className=`mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-checkbox-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e)),i){let e=t.querySelector(`.mint-checkbox-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e))}t.style.display=`flex`,r&&(r.style.visibility=`hidden`,r.style.pointerEvents=`none`),i&&(i.style.visibility=`hidden`,i.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.visibility=`visible`,r.style.pointerEvents=`auto`),i&&(i.style.visibility=`visible`,i.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-checkbox-label-container`);!n&&e&&t&&(n=document.createElement(`div`),n.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,this.appendChild(n));let r=this.querySelector(`.mint-checkbox-error`);e&&t?(r?(r.classList.add(`block`,`w-full`),r.style.display=`block`,(n&&r.parentElement!==n||n&&r.parentElement===n)&&n.appendChild(r)):(r=document.createElement(`div`),r.className=`mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full`,r.style.display=`block`,n?n.appendChild(r):this.appendChild(r)),r.textContent=t):r&&r.remove();let i=this.querySelector(`.mint-checkbox-wrapper`);i&&(i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`)}};customElements.get(`mint-checkbox`)||customElements.define(`mint-checkbox`,y);var b=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`,`loading`,`info`]}constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._clickHandler=null,this._focusHandler=null,this._blurHandler=null,this._keydownHandler=null}connectedCallback(){this.classList.add(`inline-flex`,`items-start`,`gap-2`,`cursor-pointer`,`select-none`);let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render(),this._setupClickHandler()}disconnectedCallback(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null),this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._focusHandler&&=(this._radio.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._radio.removeEventListener(`blur`,this._blurHandler),null),this._keydownHandler&&=(this._radio.removeEventListener(`keydown`,this._keydownHandler),null))}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._radio&&(this._radio.checked=this._checked),this._updateVisualState()),t!==n){if(e===`loading`){this.render();return}if(e===`info`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{this._checked=!!e,e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._radio&&(this._radio.checked=this._checked),this.isConnected?requestAnimationFrame(()=>{this._updateVisualState()}):this._updateVisualState()}catch{}}getValue(){return this.getAttribute(`value`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){let e=this.getAttribute(`disabled`)===`true`,t=this.closest(`mint-choice`)?.getAttribute(`disabled`)===`true`;return e||t}_setupClickHandler(){this._clickHandler||(this._clickHandler=e=>{e.target!==this._radio&&(this.isDisabled()||this._radio&&(this._radio.click(),requestAnimationFrame(()=>{if(this._radio&&this._radio.checked!==this._checked){this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let e=this.closest(`mint-choice`);e&&e.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))}})))},this.addEventListener(`click`,this._clickHandler))}render(){let e=this.isLoading(),t=this.isDisabled(),n=this.getValue(),r=this.closest(`mint-choice`)?.getAttribute(`name`)||``,i=``,a=this.querySelector(`.mint-choice-option-label`);if(a)i=a.textContent?.trim()||``;else{let e=this.querySelector(`.mint-choice-option-label-container`);Array.from(this.childNodes).forEach(t=>{if(t!==e&&t.nodeType===Node.TEXT_NODE){let e=t.textContent?.trim();e&&(i+=e)}})}let o=this.querySelectorAll(`.mint-choice-option-wrapper`),s=null;o.length>0&&(this._radio&&(s=Array.from(o).find(e=>e.contains(this._radio))),s||=o[0],o.forEach((e,t)=>{e!==s&&e.remove()})),s||(s=document.createElement(`div`),s.className=`mint-choice-option-wrapper`,s.style.position=`relative`,this.insertBefore(s,this.firstChild)),s.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`,s.style.position=`relative`,this.querySelectorAll(`input[type="radio"]`).forEach(e=>{e!==this._radio&&e.remove()}),this._radio?(this._radio.parentElement!==s&&s.appendChild(this._radio),this._radio&&this._changeHandler&&(this._radio.removeEventListener(`change`,this._changeHandler),this._radio.addEventListener(`change`,this._changeHandler)),this._radio&&(this._focusHandler||=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._blurHandler||=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._keydownHandler||=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.removeEventListener(`focus`,this._focusHandler),this._radio.removeEventListener(`blur`,this._blurHandler),this._radio.removeEventListener(`keydown`,this._keydownHandler),this._radio.addEventListener(`focus`,this._focusHandler),this._radio.addEventListener(`blur`,this._blurHandler),this._radio.addEventListener(`keydown`,this._keydownHandler))):(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`sr-only`,this._radio.style.position=`absolute`,this._radio.style.width=`1px`,this._radio.style.height=`1px`,this._radio.style.padding=`0`,this._radio.style.margin=`-1px`,this._radio.style.overflow=`hidden`,this._radio.style.clip=`rect(0, 0, 0, 0)`,this._radio.style.whiteSpace=`nowrap`,this._radio.style.border=`0`,s.appendChild(this._radio),this._changeHandler=e=>{let t=this._checked;this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let n=this.closest(`mint-choice`);t!==this._checked&&n&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))},0)},this._radio.addEventListener(`change`,this._changeHandler),this._radio.addEventListener(`click`,()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState())}),this._focusHandler=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`focus`,this._focusHandler),this._blurHandler=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`blur`,this._blurHandler),this._keydownHandler=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.addEventListener(`keydown`,this._keydownHandler)),this._radio.name=r,this._radio.value=n,this._radio.checked===this._checked?this._radio.checked=this._checked:(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`)),this._radio.disabled=t,t?this._radio.setAttribute(`tabindex`,`-1`):this._radio.removeAttribute(`tabindex`),i?this._radio.setAttribute(`aria-label`,i):this._radio.removeAttribute(`aria-label`),s.querySelectorAll(`.mint-choice-option-indicator`).forEach((e,t)=>{t>0&&e.remove()});let c=s.querySelector(`.mint-choice-option-indicator`);c||(c=document.createElement(`div`),c.className=`mint-choice-option-indicator`,s.appendChild(c)),c.className=`mint-choice-option-indicator w-2 h-2 rounded-full bg-white pointer-events-none`,c.style.position=`absolute`,c.style.top=`50%`,c.style.left=`50%`,c.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`,c.style.opacity=this._checked?`1`:`0`,this._updateVisualState(),this._renderSkeleton(e);let l=this.getInfo(),u=this.querySelector(`.mint-choice-option-label-container`);if(i||l){u||(u=document.createElement(`div`),u.className=`mint-choice-option-label-container flex flex-col gap-0.5`,this.appendChild(u),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.textContent?.trim()&&e!==u&&(e.textContent=``)}));let e=u.querySelector(`.mint-choice-option-label`);i?(e||(e=document.createElement(`span`),e.className=`mint-choice-option-label`,u.appendChild(e)),e.className=`mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t?`opacity-40`:``}`,e.textContent=i):e&&e.remove();let n=u.querySelector(`.mint-choice-option-info`);l?(n||(n=document.createElement(`span`),n.className=`mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none`,u.appendChild(n)),n.textContent=l,t?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else u&&u.remove();t?(this.classList.add(`cursor-not-allowed`),this.classList.remove(`cursor-pointer`)):(this.classList.add(`cursor-pointer`),this.classList.remove(`cursor-not-allowed`)),this._updateVisualState()}_getWrapperClasses(){let e=this.isDisabled(),t=[`inline-flex`,`items-center`,`justify-center`,`w-[1rem]`,`h-[1rem]`,`rounded-full`,`border-2`,`flex-shrink-0`,`mt-0.5`];return e&&t.push(`opacity-40`,`cursor-not-allowed`),this._checked?t.push(`bg-slate-800`,`dark:bg-slate-600`,`border-slate-800`,`dark:border-slate-600`):t.push(`bg-white`,`dark:bg-mint-elevated`,`border-gray-300`,`dark:border-gray-500`),t.join(` `)}_updateVisualState(){let e=this.querySelector(`.mint-choice-option-wrapper`);e&&(e.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`);let t=this.querySelector(`.mint-choice-option-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-option-skeleton-container`),n=this.querySelector(`.mint-choice-option-wrapper`);if(e){t||(t=document.createElement(`div`),t.className=`mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-choice-option-skeleton-radio`);if(e||(e=document.createElement(`div`),e.className=`mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e)),t.style.display=`flex`,n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`hidden`),t&&(t.style.visibility=`hidden`),n.style.pointerEvents=`none`}}else{if(t&&(t.style.display=`none`),n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`visible`),t&&(t.style.visibility=`visible`),n.style.pointerEvents=`auto`}let e=this.querySelector(`.mint-choice-option-label`);e&&!n?.contains(e)&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`)}}_updateGroupState(){this._radio?.name&&document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`).forEach(e=>{if(e===this._radio)return;let t=e.closest(`mint-choice-option`);t&&t!==this&&(t._checked=e.checked,e.checked?t.setAttribute(`checked`,`true`):t.removeAttribute(`checked`),t._updateVisualState())})}_focusNextOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>=0&&t<e.length-1?n=e[t+1]:e.length>0&&(n=e[0]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}_focusPreviousOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>0?n=e[t-1]:e.length>0&&(n=e[e.length-1]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}};customElements.get(`mint-choice-option`)||customElements.define(`mint-choice-option`,b);var x=class extends HTMLElement{static get observedAttributes(){return[`label`,`name`,`info`,`error`,`error-message`,`id`,`disabled`,`required`,`loading`]}constructor(){super(),this._optionsContainer=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.addEventListener(`choice-change`,e=>{let t=e.detail?.value||this.getValue();(this.getAttribute(`value`)||``)!==t&&(t?this.setAttribute(`value`,t):this.removeAttribute(`value`));let n=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0}))})}disconnectedCallback(){}isLoading(){return this.hasAttribute(`loading`)}attributeChangedCallback(e,t,n){t!==n&&(e===`error`||e===`error-message`?this._renderErrorState():e===`loading`?(this.render(),this.querySelectorAll(`mint-choice-option`).forEach(e=>{this.isLoading()?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`)})):(this.render(),e===`name`&&this.querySelectorAll(`mint-choice-option`).forEach(e=>{typeof e.render==`function`&&e.render()})))}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}getValue(){return this.querySelector(`input[type="radio"]:checked`)?.value||``}setValue(e){let t=this.querySelectorAll(`mint-choice-option`);t.forEach(t=>{if((t.getAttribute(`value`)||``)===e){let e=t;e.checked=!0;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!0,n.dispatchEvent(new Event(`change`,{bubbles:!0})))}else{let e=t;e.checked=!1;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!1)}}),requestAnimationFrame(()=>{t.forEach(e=>{typeof e._updateVisualState==`function`&&e._updateVisualState();let t=e.querySelector(`input[type="radio"]`);if(t){let n=e;t.checked!==n.checked&&(t.checked=n.checked)}})})}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getId()||`mint-choice-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute(`id`,r);let i=this.isDisabled(),a=this.querySelector(`.mint-choice-label-container`);if(t||n){a||(a=document.createElement(`div`),a.className=`mint-choice-label-container flex flex-col gap-0.5 mb-2`,this.insertBefore(a,this.firstChild));let e=a.querySelector(`.mint-choice-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,a.insertBefore(e,a.firstChild)),e.textContent=t,e.setAttribute(`for`,r),i?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let o=a.querySelector(`.mint-choice-info`);n?(o||(o=document.createElement(`span`),o.className=`mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none`,a.appendChild(o)),o.textContent=n,i?o.classList.add(`opacity-40`):o.classList.remove(`opacity-40`)):o&&o.remove()}else a&&a.remove();let o=this.querySelector(`.mint-choice-options-wrapper`);if(!o){o=document.createElement(`div`),o.className=`mint-choice-options-wrapper relative`;let e=this.querySelector(`.mint-choice-label-container`);e&&e.parentElement===this?this.insertBefore(o,e.nextSibling):this.insertBefore(o,this.firstChild)}this._optionsContainer?this._optionsContainer.parentElement!==o&&o.appendChild(this._optionsContainer):(this._optionsContainer=document.createElement(`div`),this._optionsContainer.className=`mint-choice-options-container flex flex-col gap-3`,o.appendChild(this._optionsContainer)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==this._optionsContainer).forEach(e=>{this._optionsContainer.appendChild(e)}),this._renderErrorState(),this._renderSkeleton(e)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-skeleton-container`),n=this.querySelector(`.mint-choice-options-wrapper`),r=this.querySelector(`.mint-choice-options-container`);if(e){if(t||(t=document.createElement(`div`),t.className=`mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t))),t.querySelectorAll(`.mint-choice-option-skeleton`).length===0)for(let e=0;e<3;e++){let e=document.createElement(`div`);e.className=`mint-choice-option-skeleton flex items-center gap-3`;let n=document.createElement(`div`);n.className=`flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,e.appendChild(n);let r=document.createElement(`div`);r.className=`h-4 w-20 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,e.appendChild(r),t.appendChild(e)}t.style.display=`flex`,r&&(r.style.opacity=`0`,r.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.opacity=`1`,r.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-choice-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}};customElements.get(`mint-choice`)||customElements.define(`mint-choice`,x);var S=class extends HTMLElement{static get observedAttributes(){return[`type`,`placeholder`,`value`,`disabled`,`id`,`name`,`required`,`readonly`,`rows`,`icon`,`label`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._prependSlotContainer=null,this._appendSlotContainer=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._slotResizeObserver=null,this._slotMutationObserver=null,this._contentObserver=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`,`w-full`),this.render(),this._observeContentMutations()}disconnectedCallback(){this.removeEventListeners(),this._slotResizeObserver&&=(this._slotResizeObserver.disconnect(),null),this._slotMutationObserver&&=(this._slotMutationObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(e===`loading`){this.render();return}this.render()}}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}getType(){return this.getAttribute(`type`)||`text`}getRows(){let e=this.getAttribute(`rows`);return e?parseInt(e,10):3}_getNormalizedType(){let e=this.getType();return e===`datetime`?`datetime-local`:e===`money`?`text`:e===`textarea`?`textarea`:e}_isTextarea(){return this.getType()===`textarea`}_isMoney(){return this.getType()===`money`}_isColor(){return this.getType()===`color`}_isNumber(){return this.getType()===`number`}getPlaceholder(){return this.getAttribute(`placeholder`)||``}getValue(){return this._isColor()?this._colorTextInput?this._colorTextInput.value:this._colorPicker?this._colorPicker.value:this.getAttribute(`value`)||`#000000`:this._element?this._element.value:this.getAttribute(`value`)||``}set value(e){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||`#000000`),this._colorTextInput&&(this._colorTextInput.value=e||`#000000`)):this._element&&(this._element.value=e),e?this.setAttribute(`value`,e):this.removeAttribute(`value`)}catch{}}get value(){try{return this.getValue()||``}catch{return``}}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getIcon(){return this.getAttribute(`icon`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getInputClasses(){let e=this._isTextarea(),t=!!this.getIcon(),n=this.querySelector(`[slot="prepend"]`)!==null,r=this.querySelector(`[slot="append"]`)!==null,i=this._isColor(),a=this._isNumber(),o=this.hasError(),s=[`w-full`,t||i||n?`pl-10`:`px-3.5`,r?`pr-10`:t||i?`pr-3.5`:a?`pr-10`:``,e?`py-2`:`py-1.5`,e?`min-h-[6rem]`:`min-h-[2rem]`,`text-base`,`min-[1100px]:text-sm`,`font-medium`,`rounded-lg`,`box-border`,`bg-white`,`dark:bg-mint-elevated`,`text-gray-900`,`dark:text-white`,`outline-none`,`focus:outline-none`,`disabled:opacity-40`,`disabled:cursor-not-allowed`,`readonly:cursor-default`,e?`resize-y`:``,a?`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`:``],c=[`border-2`,o?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`],l=[`focus-visible:ring-2`,`focus-visible:ring-offset-1`,o?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`];return[...s,...c,...l].filter(Boolean).join(` `)}_syncSlotAdornments(e,t){if(!this._wrapper||e||this._isColor()){this._prependSlotContainer&&=(this._prependSlotContainer.remove(),null),this._appendSlotContainer&&=(this._appendSlotContainer.remove(),null),this._clearAdornmentPadding();return}this._prependSlotContainer||(this._prependSlotContainer=document.createElement(`div`),this._prependSlotContainer.className=`mint-input-prepend-slot absolute top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto`,this._wrapper.appendChild(this._prependSlotContainer)),this._appendSlotContainer||(this._appendSlotContainer=document.createElement(`div`),this._appendSlotContainer.className=`mint-input-append-slot absolute right-3 top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto`,this._wrapper.appendChild(this._appendSlotContainer)),this._prependSlotContainer.classList.remove(`left-3`,`left-10`),this._prependSlotContainer.classList.add(t?`left-10`:`left-3`);let n=Array.from(this.querySelectorAll(`[slot="prepend"]`)),r=Array.from(this.querySelectorAll(`[slot="append"]`));this._prependSlotContainer.replaceChildren(),this._appendSlotContainer.replaceChildren(),n.forEach(e=>this._prependSlotContainer.appendChild(e)),r.forEach(e=>this._appendSlotContainer.appendChild(e)),this._prependSlotContainer.classList.toggle(`hidden`,n.length===0),this._appendSlotContainer.classList.toggle(`hidden`,r.length===0),this._ensureSlotObservers(),this._applyAdornmentPadding(t)}_clearAdornmentPadding(){this._element&&(this._element.style.removeProperty(`padding-left`),this._element.style.removeProperty(`padding-right`)),this._colorTextInput&&(this._colorTextInput.style.removeProperty(`padding-left`),this._colorTextInput.style.removeProperty(`padding-right`))}_applyAdornmentPadding(e){this._element&&requestAnimationFrame(()=>{if(this._element){if(this._prependSlotContainer&&!this._prependSlotContainer.classList.contains(`hidden`)){let t=(e?40:12)+this._prependSlotContainer.offsetWidth+8;this._element.style.paddingLeft=`${t}px`}else this._element.style.removeProperty(`padding-left`);if(this._appendSlotContainer&&!this._appendSlotContainer.classList.contains(`hidden`)){let e=12+this._appendSlotContainer.offsetWidth+8;this._element.style.paddingRight=`${e}px`}else this._element.style.removeProperty(`padding-right`)}})}_ensureSlotObservers(){!this._prependSlotContainer&&!this._appendSlotContainer||(this._slotResizeObserver||=new ResizeObserver(()=>{this._applyAdornmentPadding(!!this.getIcon())}),this._slotResizeObserver.disconnect(),this._prependSlotContainer&&this._slotResizeObserver.observe(this._prependSlotContainer),this._appendSlotContainer&&this._slotResizeObserver.observe(this._appendSlotContainer),this._slotMutationObserver||=new MutationObserver(()=>{this._applyAdornmentPadding(!!this.getIcon())}),this._slotMutationObserver.disconnect(),this._prependSlotContainer&&this._slotMutationObserver.observe(this._prependSlotContainer,{childList:!0,subtree:!0,characterData:!0}),this._appendSlotContainer&&this._slotMutationObserver.observe(this._appendSlotContainer,{childList:!0,subtree:!0,characterData:!0}))}isLoading(){return this.getAttribute(`loading`)===`true`}render(){this.getType();let e=this._getNormalizedType(),t=this._isTextarea(),n=this._isMoney(),r=this._isColor(),i=this.getPlaceholder(),a=this.isDisabled(),o=this.isReadonly(),s=this.isRequired(),c=this.getId(),l=this.getName(),u=this.getAttribute(`value`)||(r?`#000000`:``),d=this.getRows(),f=this.getIcon(),p=this.getLabel(),m=this.getInfo(),h=this.isLoading();if(r&&this._renderSkeleton(h),r){this._input&&=(this._input.remove(),null),this._textarea&&=(this._textarea.remove(),null),this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&=(this._colorContainer.remove(),null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement(`div`),this._colorPickerWrapper.className=`mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,this._colorPickerWrapper.style.backgroundColor=u||`#000000`,this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement(`input`),this._colorPicker.type=`color`,this._colorPicker.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._colorPicker.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;`,this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=e=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&requestAnimationFrame(()=>{this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&this._colorPickerWrapper?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._colorPicker.addEventListener(`focus`,this._focusHandler),this._colorPicker.addEventListener(`blur`,this._blurHandler),this._colorPicker.addEventListener(`input`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&(this._colorTextInput.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener(`change`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement(`input`),this._colorTextInput.type=`text`,this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=i||`#000000`,this._colorTextInput.pattern=`^#[0-9A-Fa-f]{6}$`,this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener(`input`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)&&(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener(`blur`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)?(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this._colorPicker?.value||`#000000`},bubbles:!0,cancelable:!0}))}));let e=u||`#000000`;if(this._colorPicker&&this._colorPicker.value!==e&&(this._colorPicker.value=e),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&this._colorTextInput.value!==e&&(this._colorTextInput.value=e),this._colorPicker&&(this._colorPicker.disabled=a),this._colorPickerWrapper&&(a?(this._colorPickerWrapper.classList.add(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.remove(`cursor-pointer`)):(this._colorPickerWrapper.classList.remove(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.add(`cursor-pointer`))),this._colorTextInput&&(this._colorTextInput.disabled=a,this._colorTextInput.readOnly=o,this._colorTextInput.required=s),this._colorTextInput){let e=this._colorTextInput;c?e.id=c:e.removeAttribute(`id`),l?e.name=l:e.removeAttribute(`name`),e.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._element=e}this._renderErrorState();let t=this.querySelector(`.mint-input-label-container`);if(p||m){t||(t=document.createElement(`div`),t.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(t,this._wrapper):this.insertBefore(t,this.firstChild));let e=t.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,t.insertBefore(e,t.firstChild)),e.textContent=p;let n=c||this._colorTextInput?.id;if(n)e.setAttribute(`for`,n);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._colorTextInput&&(this._colorTextInput.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let n=t.querySelector(`.mint-input-info`);m?(n||(n=document.createElement(`span`),n.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,t.appendChild(n)),n.textContent=m,a?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else t&&t.remove();return}if(this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),f&&!t?this._icon?this._icon.setAttribute(`name`,f):(this._icon=document.createElement(`mint-icon`),this._icon.setAttribute(`name`,f),this._icon.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none`,this._wrapper.appendChild(this._icon)):this._icon&&=(this._icon.remove(),null),this._syncSlotAdornments(t,!!f),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement(`div`),this._numberSpinnerContainer.className=`absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none`,this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement(`button`),this._numberIncrementButton.type=`button`,this._numberIncrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed pointer-events-auto bg-gray-100 dark:bg-mint-hover active:bg-gray-200 dark:active:bg-mint-elevated rounded`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`caret-up`),e.className=`w-[1rem] h-[1rem]`,this._numberIncrementButton.appendChild(e),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement(`button`),this._numberDecrementButton.type=`button`,this._numberDecrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed pointer-events-auto bg-gray-100 dark:bg-mint-hover active:bg-gray-200 dark:active:bg-mint-elevated rounded`;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`caret-down`),t.className=`w-[1rem] h-[1rem]`,this._numberDecrementButton.appendChild(t),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e+t;r!==void 0&&i>r&&(i=r),n!==void 0&&i<n&&(i=n),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}}),this._numberDecrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e-t;n!==void 0&&i<n&&(i=n),r!==void 0&&i>r&&(i=r),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=a||o),this._numberDecrementButton&&(this._numberDecrementButton.disabled=a||o)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&=(this._input.remove(),null),this._textarea||(this._textarea=document.createElement(`textarea`),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=i,this._textarea.disabled=a,this._textarea.readOnly=o,this._textarea.required=s,this._textarea.rows=d,this._textarea.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),u!==this._textarea.value&&(this._textarea.value=u),c?this._textarea.id=c:this._textarea.removeAttribute(`id`),l?this._textarea.name=l:this._textarea.removeAttribute(`name`),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._textarea.value&&(this._textarea.value=e.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&=(this._textarea.remove(),null),this._input||(this._input=document.createElement(`input`),this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=i,this._input.disabled=a,this._input.readOnly=o,this._input.required=s,this._input.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),n?(this._input.inputMode=`decimal`,this._input.pattern=`[0-9]*\\.?[0-9]*`):(this._input.removeAttribute(`inputmode`),this._input.removeAttribute(`pattern`)),u!==this._input.value&&(this._input.value=u),c?this._input.id=c:this._input.removeAttribute(`id`),l?this._input.name=l:this._input.removeAttribute(`name`),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._input.value&&(this._input.value=e.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(`.mint-input-label-container`);if(p||m){g||(g=document.createElement(`div`),g.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let e=g.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,g.insertBefore(e,g.firstChild)),e.textContent=p;let t=c||this._element?.id||this._colorTextInput?.id||this._input?.id||this._textarea?.id;if(t)e.setAttribute(`for`,t);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=t:this._colorTextInput?this._colorTextInput.id=t:this._input?this._input.id=t:this._textarea&&(this._textarea.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let t=g.querySelector(`.mint-input-info`);m?(t||(t=document.createElement(`span`),t.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,g.appendChild(t)),t.textContent=m,a?t.classList.add(`opacity-40`):t.classList.remove(`opacity-40`)):t&&t.remove()}else g&&g.remove();this._syncSlotAdornments(t,!!f),this._renderErrorState(),this._renderSkeleton(h)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-input-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-input-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}setupEventListeners(){this._element&&(this._element.addEventListener(`input`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`);let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener(`blur`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&=(this._colorPicker.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._colorPicker.removeEventListener(`blur`,this._blurHandler),null))}focus(){this._isColor()&&this._colorTextInput?this._colorTextInput.focus():this._element?.focus()}blur(){this._isColor()&&this._colorTextInput?this._colorTextInput.blur():this._element?.blur()}_renderSkeleton(e){let t=this.querySelector(`.mint-input-skeleton-container`),n=this._wrapper||this.querySelector(`.relative.w-full`);if(e){t||(t=document.createElement(`div`),t.className=`mint-input-skeleton-container absolute inset-0 z-10 pointer-events-none`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-input-skeleton`);if(e||(e=document.createElement(`div`),e.className=`mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e)),this._isTextarea()){let t=this._textarea?.offsetHeight;if(t&&t>0)e.style.height=`${t}px`;else{let t=this.getRows()*24+16;e.style.height=`${Math.max(96,t)}px`}}else e.style.height=`2.2rem`;e.parentElement||t.appendChild(e),t.style.display=`block`,this._element&&(this._element.style.opacity=`0`,this._element.style.pointerEvents=`none`),this._colorTextInput&&(this._colorTextInput.style.opacity=`0`,this._colorTextInput.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),this._element&&(this._element.style.opacity=`1`,this._element.style.pointerEvents=`auto`),this._colorTextInput&&(this._colorTextInput.style.opacity=`1`,this._colorTextInput.style.pointerEvents=`auto`)}};customElements.get(`mint-input`)||customElements.define(`mint-input`,S);var C=class extends HTMLElement{static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`format`,`min`,`max`,`range`,`shortcuts`,`display-format`,`error`,`error-message`,`loading`,`selection-mode`,`week-start-day`,`mode`,`disabled-dates`]}constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode=`calendar`,this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._hoveredDate=null,this._isHandlingClick=!1,this._touchStartDate=null,this._touchStartElement=null,this._isTouchActive=!1,this._resizeObserver=null,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._removeFocusTrap(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){let e=this.hasError(),t=this.getErrorMessage();this._applyErrorVisuals(e,t,this.isDisabled());return}if(e===`loading`){this.render();return}if(e===`mode`||e===`format`){let e=this.getMode();e===`month`?this._viewMode=`month`:e===`year`?this._viewMode=`year`:this._viewMode=`calendar`,this._popover&&this._calendarContainer&&this._buildCalendar()}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?(this.setAttribute(`value`,e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute(`value`),this._textInput&&(this._textInput.value=``),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}getFormat(){return this.getAttribute(`format`)||`mm/dd/yyyy`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isRange(){return this.getAttribute(`range`)===`true`}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getMin(){return this.getAttribute(`min`)||``}getMax(){return this.getAttribute(`max`)||``}getDisabledDates(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{let t=JSON.parse(e),n=this.getFormat();return t.map(e=>this._parseDateString(e,n)).filter(e=>e!==null)}catch{return[]}}getDisabledDateStrings(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{return JSON.parse(e)}catch{return[]}}disableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=this._parseDateString(e,t);if(r){let e=this._formatDate(r,t);n.includes(e)||i.push(e)}}if(i.length>0){let e=[...n,...i];this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}enableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);i.push(e)}}if(i.length>0){let e=n.filter(e=>!i.includes(e));e.length===0?this.removeAttribute(`disabled-dates`):this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}getSelectionMode(){let e=this.getAttribute(`selection-mode`);return e===`week`||e===`month`?e:`day`}getMode(){let e=this.getAttribute(`mode`);if(e===`month`||e===`year`)return e;let t=this.getFormat().toLowerCase(),n=t.includes(`d`),r=t.includes(`m`);return!n&&!r?`year`:!n&&r?`month`:`default`}getWeekStartDay(){return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[this.getAttribute(`week-start-day`)?.toLowerCase()||`sunday`]??0}getDisplayFormat(){return this.getAttribute(`display-format`)||`F j, Y`}getShortcuts(){let e=this.getAttribute(`shortcuts`);if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>({label:e.label,action:this._createShortcutAction(e.action)}))}catch{let t=e.trim();if(t&&typeof window[t]==`function`){let e=window[t]();if(Array.isArray(e))return e.map(e=>({label:e.label,action:typeof e.action==`function`?e.action:this._createShortcutAction(e.action)}))}}return[]}_createShortcutAction(e){return typeof e==`function`?e:typeof e==`string`&&typeof window[e]==`function`?window[e]:()=>null}_getDefaultShortcuts(){let e=[{label:`Today`,action:()=>new Date}];return this._isRange&&e.push({label:`This Week`,action:()=>{let e=new Date,t=e.getDay(),n=new Date(e);n.setDate(e.getDate()-t),n.setHours(0,0,0,0);let r=new Date(n);return r.setDate(n.getDate()+6),r.setHours(23,59,59,999),{start:n,end:r}}},{label:`This Month`,action:()=>{let e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return n.setHours(23,59,59,999),{start:t,end:n}}}),e}_getFormatTokens(e){let t=[],n=0,r=e.toLowerCase();for(;n<r.length;){let i=r[n];if(i===`d`||i===`m`||i===`y`){let e=1,a=n+1;for(;a<r.length&&r[a]===i;)e++,a++;t.push({type:`part`,part:i,len:e}),n=a}else t.push({type:`sep`,value:e[n]}),n++}return t}_createPartInput(e,t,n,r,i){let a=document.createElement(`input`);return a.type=`text`,a.inputMode=`numeric`,a.pattern=`\\d*`,a.maxLength=e,a.placeholder=t,a.className=`bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed`,a.disabled=n||r,a.readOnly=r,a.required=i,e===4?a.className+=` w-[40px]`:e===2&&(a.className+=` w-[30px]`),a}_buildValueFromParts(e,t){let n=0;return t.map(t=>{if(t.type===`sep`)return t.value;let r=e[n]?.value||``;return n++,r}).join(``)}_applyDateToParts(e,t,n,r){if(!t.length)return;if(!e){t.forEach(e=>e.value=``);return}let i=this._formatDate(e,r),a=0,o=0;n.forEach(e=>{if(e.type===`sep`)a+=e.value.length;else{let n=i.substr(a,e.len);t[o]&&(t[o].value=n),o++,a+=e.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;let e=this.getFormat(),t=this._getFormatTokens(e),n=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){let e=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=e?`${n} - ${e}`:n}else this._hiddenInput.value=n}_focusNext(e,t){if(t+1<e.length){let n=e[t+1];n.focus(),n.setSelectionRange(0,n.value.length)}}_focusPrev(e,t){if(t-1>=0){let n=e[t-1];n.focus(),n.setSelectionRange(n.value.length,n.value.length)}}_attachPartInputHandlers(e,t,n){e.forEach((t,n)=>{let r=t.maxLength||2;t.addEventListener(`input`,()=>{t.value=t.value.replace(/\D/g,``).slice(0,r),t.value.length>=r&&this._focusNext(e,n),this._syncHiddenInput()}),t.addEventListener(`keydown`,r=>{r.key===`Backspace`&&t.selectionStart===0&&t.selectionEnd===0&&this._focusPrev(e,n),r.key===`ArrowLeft`&&t.selectionStart===0&&t.selectionEnd===0&&(this._focusPrev(e,n),r.preventDefault()),r.key===`ArrowRight`&&t.selectionStart===t.value.length&&t.selectionEnd===t.value.length&&(this._focusNext(e,n),r.preventDefault())}),t.addEventListener(`blur`,e=>{this._syncHiddenInput();let t=e.relatedTarget,n=t&&(this._startPartInputs.includes(t)||this._endPartInputs.includes(t));setTimeout(()=>{if(!(this._startPartInputs.some(e=>e===document.activeElement)||this._endPartInputs.some(e=>e===document.activeElement))&&(n||this._handleBlur(this._hiddenInput?.value||``),this._exitInputMode(),!n&&this._hiddenInput)){let t=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:e.relatedTarget});this._hiddenInput.dispatchEvent(t)}},0)})})}_splitRangeInput(e,t){let n=e.split(/\s*-\s*/);return n.length>=2?[n[0],n.slice(1).join(`-`)]:[e]}_parseValue(e){let t=this.getFormat(),n=this._getFormatTokens(t),r=this.getSelectionMode();if(this._isRange||r===`week`||r===`month`){let[r,i]=this._splitRangeInput(e,t),a=r?this._parseDateString(r,t):null,o=i?this._parseDateString(i,t):null;if(a&&o){let[e,t]=a<=o?[a,o]:[o,a];this._selectedStartDate=e,this._selectedEndDate=t,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else a&&(this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,n,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,n,t)}else{let r=this._parseDateString(e,t);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,n,t)):this._applyDateToParts(null,this._startPartInputs,n,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){let n=/[\/\-\.\s]+/;if(n.test(e)){let r=e.split(n).filter(e=>e.length>0),i=t.split(/[\/\-\.\s]+/).filter(e=>e.length>0);if(r.length===i.length){let e=0,t=0,n=0;for(let a=0;a<i.length;a++){let o=i[a].toLowerCase(),s=r[a];if(o.includes(`d`))e=parseInt(s,10);else if(o.includes(`m`))t=parseInt(s,10)-1;else if(o.includes(`y`)){let e=parseInt(s,10),t=o.length,r=s.length;(r===2&&t===4||r===2&&t===2)&&(e=Math.floor(new Date().getFullYear()/100)*100+e),n=e}}let a=i.some(e=>e.toLowerCase().includes(`d`)),o=i.some(e=>e.toLowerCase().includes(`m`));if(a||(e=1),o||(t=0),t>=0&&t<=11&&n){let r=new Date(n,t,e);if(!isNaN(r.getTime()))return a&&r.getDate()!==e||r.getMonth()!==t||r.getFullYear()!==n?null:r}}}let r=e.replace(/[\/\-\.]/g,``),i=t.replace(/[\/\-\.]/g,``).toLowerCase(),a=i.indexOf(`d`),o=i.indexOf(`m`),s=i.indexOf(`y`),c=[{char:`d`,index:a},{char:`m`,index:o},{char:`y`,index:s}].sort((e,t)=>e.index-t.index),l=0,u=0,d=0,f=0;i.length,r.length;for(let e of c)if(e.char===`d`){let e=i.lastIndexOf(`d`)-i.indexOf(`d`)+1,t=r.substr(f,e);if(t.length===0)return null;l=parseInt(t,10),f+=t.length}else if(e.char===`m`){let e=i.lastIndexOf(`m`)-i.indexOf(`m`)+1,t=r.substr(f,e);if(t.length===0)return null;u=parseInt(t,10)-1,f+=t.length}else if(e.char===`y`){let e=i.lastIndexOf(`y`)-i.indexOf(`y`)+1,t=r.substr(f),n=Math.min(e,t.length),a=t.substr(0,n);if(a.length===0)return null;let o=parseInt(a,10);(n===2&&e===4||n===2&&e===2)&&(o=Math.floor(new Date().getFullYear()/100)*100+o),d=o,f+=n}let p=t.toLowerCase(),m=p.includes(`d`),h=p.includes(`m`);if(m||(l=1),h||(u=0),u<0||u>11||!d)return null;let g=new Date(d,u,l);return isNaN(g.getTime())||m&&g.getDate()!==l||g.getMonth()!==u||g.getFullYear()!==d?null:g}_formatDate(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=t.toLowerCase(),o=t;return a.includes(`dd`)?o=o.replace(/dd/gi,String(n).padStart(2,`0`)):a.includes(`d`)&&(o=o.replace(/d/gi,String(n))),a.includes(`mm`)?o=o.replace(/mm/gi,String(r).padStart(2,`0`)):a.includes(`m`)&&(o=o.replace(/m/gi,String(r))),a.includes(`yyyy`)?o=o.replace(/yyyy/gi,String(i)):a.includes(`yy`)&&(o=o.replace(/yy/gi,String(i).substr(2))),o}_formatDatePhp(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=(e,t=2)=>e.toString().padStart(t,`0`),u=e=>{let t=e%10,n=e%100;return t===1&&n!==11?`st`:t===2&&n!==12?`nd`:t===3&&n!==13?`rd`:`th`},d=``;for(let f=0;f<t.length;f++){let p=t[f];if(p===`\\`&&f+1<t.length){d+=t[f+1],f++;continue}switch(p){case`Y`:d+=i.toString();break;case`y`:d+=i.toString().slice(-2);break;case`m`:d+=l(r);break;case`n`:d+=r.toString();break;case`M`:d+=c[r-1];break;case`F`:d+=s[r-1];break;case`d`:d+=l(n);break;case`j`:d+=n.toString();break;case`D`:d+=o[e.getDay()];break;case`l`:d+=a[e.getDay()];break;case`S`:d+=u(n);break;default:d+=p;break}}return d}_validateDateString(e,t){let n=this._parseDateString(e,t);return n!==null&&!isNaN(n.getTime())}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getValue(),i=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),s=this.getId(),c=this.getName(),l=this.getFormat(),u=this.hasError(),d=this.getErrorMessage(),f=this.getSelectionMode();this._isRange=this.isRange()||f===`week`||f===`month`,this._input||(this._input=document.createElement(`div`),this._input.className=`relative w-full`,this.appendChild(this._input));let p=this.querySelector(`.mint-date-picker-label-container`);if(t||n){p||(p=document.createElement(`div`),p.className=`mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]`,this.contains(this._input)?this.insertBefore(p,this._input):this.appendChild(p));let e=p.querySelector(`.mint-date-picker-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,p.insertBefore(e,p.firstChild)),e.textContent=t,s&&this._textInput&&e.setAttribute(`for`,s)):e&&e.remove();let r=p.querySelector(`.mint-date-picker-info`);n?(r||(r=document.createElement(`span`),r.className=`mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none`,p.appendChild(r)),r.textContent=n):r&&r.remove()}else p&&p.remove();this._hiddenInput||(this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.value=r||``,this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),s&&(this._hiddenInput.id=s),c&&(this._hiddenInput.name=c),this._hiddenInput.value=r||``,this._hiddenInput.setAttribute(`aria-invalid`,u?`true`:`false`);let m=this._input.querySelector(`.mint-date-fields`);m||(m=document.createElement(`div`),this._input.appendChild(m)),this._fieldsContainer=m,this._applyErrorVisuals(u,d,i),m.innerHTML=``,this._displayEl=document.createElement(`div`);let h=a?`select-text`:`select-none`;this._displayEl.className=`flex-1 text-gray-900 dark:text-white ${a?`cursor-default`:`cursor-text`} ${h} focus:outline-none`,this._displayEl.tabIndex=i||a?-1:0,this._displayEl.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._displayEl.addEventListener(`keydown`,e=>{i||a||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement(`div`),this._isRange,this._inputsWrapperEl.className=`flex items-center gap-1 w-full`;let g=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];let _=e=>{let t=document.createDocumentFragment();return g.forEach(n=>{if(n.type===`sep`){let e=document.createElement(`span`);e.textContent=n.value,e.className=`text-gray-400 dark:text-gray-500 select-none`,t.appendChild(e)}else{let r=n.part===`d`?`dd`:n.part===`m`?`mm`:n.len===2?`yy`:`yyyy`,s=this._createPartInput(n.len,r,i,a,o);e===`start`?this._startPartInputs.push(s):this._endPartInputs.push(s),t.appendChild(s)}}),t};if(this._isRange){let e=document.createElement(`div`);e.className=`flex items-center gap-1 flex-shrink-0`,e.appendChild(_(`start`)),this._inputsWrapperEl.appendChild(e);let t=document.createElement(`span`);t.textContent=` - `,t.className=`text-gray-400 dark:text-gray-500 select-none flex-shrink-0`,this._inputsWrapperEl.appendChild(t);let n=document.createElement(`div`);n.className=`flex items-center gap-1 flex-shrink-0`,n.appendChild(_(`end`)),this._inputsWrapperEl.appendChild(n)}else this._inputsWrapperEl.appendChild(_(`start`));let v=document.createElement(`div`);if(v.className=`flex flex-col w-full`,this._displayEl.style.display=this._isInputMode?`none`:`flex`,this._inputsWrapperEl.style.display=this._isInputMode?`flex`:`none`,v.appendChild(this._displayEl),v.appendChild(this._inputsWrapperEl),m.appendChild(v),this._isRange&&this._inputsWrapperEl&&this._setupContainerObserver(),m.addEventListener(`click`,()=>{this._isInputMode||i||a||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,g,m),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,g,m),this._parseValue(r),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=i||a,!i&&!a?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement(`button`),this._iconButton.type=`button`,this._iconButton.tabIndex=0,this._iconButton.className=`absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm`;let e=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`calendar`),t.className=`w-4 h-4 pointer-events-none`,this._iconButton.appendChild(t),this._iconButton.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=i||a}this._renderErrorState(u,d),this._renderSkeleton(e)}_renderErrorState(e,t){let n=this.querySelector(`.mint-date-picker-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_applyErrorVisuals(e,t,n){if(this._renderErrorState(e,t),this._fieldsContainer){let t=this._getFieldContainerClass(e,n);this._fieldsContainer.className=t}this._hiddenInput&&this._hiddenInput.setAttribute(`aria-invalid`,e?`true`:`false`)}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(``),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,``,this.isDisabled())},e.addEventListener(`reset`,this._resetHandler))}_clearPartInputs(e){e.forEach(e=>{e.value=``})}_getFieldContainerClass(e,t){return[`mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider text-gray-900 dark:text-white`,`border-2`,e?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`,`outline-none focus-within:ring-2 focus-within:ring-offset-1`,e?`focus-within:ring-red-400 dark:focus-within:ring-red-500`:`focus-within:ring-gray-400 dark:focus-within:ring-gray-500`,`flex items-center gap-1`].join(` `)+(t?` opacity-40 cursor-not-allowed`:``)}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){let t=this.getFormat(),n=this.getSelectionMode(),r=this._isRange||n===`week`||n===`month`;if(!e){this.setValue(``),this._updateDisplayText();return}if(r){let[n,r]=this._splitRangeInput(e,t),i=n?this._parseDateString(n,t):null,a=r?this._parseDateString(r,t):null;if(i&&a){let[e,n]=i<=a?[i,a]:[a,i],r=`${this._formatDate(e,t)} - ${this._formatDate(n,t)}`;this.setValue(r),this._applyDateToParts(e,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(n,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=e,this._selectedEndDate=n,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else if(i){let e=this._formatDate(i,t);this.setValue(e),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);this.setValue(e),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}let t=this._iconButton.id;t&&this._iconButton.isConnected&&document.getElementById(t)?this._createPopover(t):e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(e){if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(this._popover){if(this._popover.getAttribute(`trigger-id`)!==e){this._popover.setAttribute(`trigger-id`,e);let t=this._popover;typeof t._setupTrigger==`function`&&t._setupTrigger()}this._buildCalendar()}else{this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`);let t=this.closest(`mint-modal`),n=this.closest(`mint-off-canvas`);t||n?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute(`trigger-id`,e),this._popoverObserver||(this._popoverObserver=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`open`)if(this._popover?.hasAttribute(`open`))requestAnimationFrame(()=>{this._buildCalendar();let e=this._popover;typeof e.render==`function`&&e.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{this._iconButton?.focus()}),this._viewMode=`calendar`,this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{let e=new Date;this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{let e=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:null});this._hiddenInput?.dispatchEvent(e)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]})),requestAnimationFrame(()=>{this._buildCalendar()}))})})}}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement(`div`),this._calendarContainer.className=`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]`;let e=this.getMode();e===`month`&&this._viewMode===`calendar`?this._viewMode=`month`:e===`year`&&this._viewMode===`calendar`?this._viewMode=`year`:e===`default`&&this._viewMode!==`month`&&this._viewMode!==`year`&&(this._viewMode=`calendar`),this._viewMode===`calendar`?this._buildCalendarView():this._viewMode===`month`?this._buildMonthView():this._viewMode===`year`&&this._buildYearView();let t=this._popover.querySelector(`.popover-content`);if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;let e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),n=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],r=this.getWeekStartDay(),i=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],a=[...i.slice(r),...i.slice(0,r)],o=this.getShortcuts(),s=o.length>0;this._calendarContainer.className=s?`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]`:`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[18rem] md:min-w-[18rem]`;let c=document.createElement(`div`);c.className=`flex flex-col md:flex-row md:gap-6 md:items-start`;let l=document.createElement(`div`);l.className=`flex-1 min-w-0`;let u=document.createElement(`div`);u.className=`flex items-center justify-between mb-4`;let d=document.createElement(`button`);d.type=`button`,d.tabIndex=0,d.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,d.setAttribute(`data-keep-popover-open`,`true`);let f=document.createElement(`mint-icon`);f.setAttribute(`name`,`caret-left`),f.className=`w-4 h-4`,d.appendChild(f),d.addEventListener(`click`,()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}),u.appendChild(d);let p=document.createElement(`div`);p.className=`flex items-center gap-2`;let m=document.createElement(`button`);m.type=`button`,m.tabIndex=0,m.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,m.setAttribute(`data-keep-popover-open`,`true`),m.textContent=n[this._currentMonth];let h=()=>{let e=this.getMode();e!==`month`&&e!==`year`&&(this._viewMode=`month`,this._buildCalendar())};m.addEventListener(`click`,h),m.addEventListener(`touchend`,e=>{e.preventDefault(),h()},{passive:!1}),p.appendChild(m);let g=document.createElement(`button`);g.type=`button`,g.tabIndex=0,g.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,g.setAttribute(`data-keep-popover-open`,`true`),g.textContent=String(this._currentYear),g.addEventListener(`click`,()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())}),p.appendChild(g),u.appendChild(p);let _=document.createElement(`button`);_.type=`button`,_.tabIndex=0,_.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_.setAttribute(`data-keep-popover-open`,`true`);let v=document.createElement(`mint-icon`);v.setAttribute(`name`,`caret-right`),v.className=`w-4 h-4`,_.appendChild(v);let y=()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};_.addEventListener(`click`,y),_.addEventListener(`touchend`,e=>{e.preventDefault(),y()},{passive:!1}),u.appendChild(_);let b=document.createElement(`div`);b.className=`grid grid-cols-7 mb-2`,a.forEach(e=>{let t=document.createElement(`div`);t.className=`text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1`,t.textContent=e,b.appendChild(t)});let x=document.createElement(`div`);x.className=`grid grid-cols-7`;let S=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,C=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;this.getDisabledDates();let w=this._currentMonth===0?11:this._currentMonth-1,T=this._currentMonth===0?this._currentYear-1:this._currentYear,E=this._getDaysInMonth(w,T),D=this._currentMonth===11?0:this._currentMonth+1,O=this._currentMonth===11?this._currentYear+1:this._currentYear,k=t+e,A=Math.ceil(k/7)*7-k,j=(e,t,n)=>{let r=this._isToday(e),i=this._isDateSelected(e),a=this._isDateInRange(e),o=S&&e<S||C&&e>C||this._isDateDisabled(e),s=`rounded-md`,c=this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate,l=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._selectedStartDate:c&&this._hoveredDate?this._hoveredDate:null,u=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._hoveredDate:c&&this._selectedStartDate?this._selectedStartDate:null,d=l!==null&&this._isSameDate(e,l),f=u!==null&&this._isSameDate(e,u),p=this._hoveredDate!==null&&this._isSameDate(e,this._hoveredDate),m=c&&this._hoveredDate&&this._selectedStartDate?!this._rangeIncludesDisabledDates(this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate):!1;if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){let t=this._isSameDate(e,this._selectedStartDate),n=this._isSameDate(e,this._selectedEndDate);t&&n?s=`rounded-md`:t?s=`rounded-l-md`:n?s=`rounded-r-md`:a&&(s=`rounded-none`)}else c&&(d||f)&&m?d&&f?s=`rounded-md`:d?s=`rounded-l-md`:f&&(s=`rounded-r-md`):i&&!this._isRange||i&&this._isRange&&!this._selectedEndDate?s=`rounded-md`:a&&c&&m&&(s=`rounded-none`);let h=document.createElement(`button`);h.type=`button`,h.disabled=!!o,h.tabIndex=o?-1:0;let g=`w-full h-8 ${s} border-0 text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_=i||c&&p&&m;return n?g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:r?` text-gray-900 dark:text-gray-100 font-semibold`:` text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-mint-hover`:g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:` text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-mint-hover`,g+=o?` opacity-40 cursor-not-allowed`:``,h.className=g,h.textContent=t.toString(),o||(h.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),this._handleDateClick(e)}),h.addEventListener(`touchstart`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive=!0,this._touchStartDate=e,this._touchStartElement=h,h.classList.add(`active`,`bg-gray-200`,`dark:bg-gray-600`)},{passive:!1}),h.addEventListener(`touchend`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive&&this._touchStartDate&&this._isSameDate(this._touchStartDate,e)&&this._handleDateClick(e),this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null},{passive:!1}),h.addEventListener(`touchcancel`,()=>{this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null}),this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&!o&&(h.addEventListener(`mouseenter`,()=>{this._isHandlingClick||this._isTouchActive||this._isDateDisabled(e)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,e))&&(this._hoveredDate=e,this._buildCalendar())}),h.addEventListener(`touchmove`,e=>{if(!this._isTouchActive||!this._touchStartDate)return;let t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);for(;n&&!n.classList.contains(`mint-date-picker-day`);)n=n.parentElement;if(n&&n!==h){let e=n.getAttribute(`data-date`);if(e){let t=new Date(e);this._isDateDisabled(t)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,t))&&(this._hoveredDate=t,this._buildCalendar())}}},{passive:!0}))),h};for(let e=t-1;e>=0;e--){let t=E-e,n=j(new Date(T,w,t),t,!1);x.appendChild(n)}for(let t=1;t<=e;t++){let e=j(new Date(this._currentYear,this._currentMonth,t),t,!0);x.appendChild(e)}for(let e=1;e<=A;e++){let t=j(new Date(O,D,e),e,!1);x.appendChild(t)}if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&(x.addEventListener(`mouseleave`,()=>{this._isTouchActive||(this._hoveredDate=null,this._buildCalendar())}),x.addEventListener(`touchend`,e=>{let t=e.changedTouches[0],n=document.elementFromPoint(t.clientX,t.clientY);n&&!x.contains(n)&&(this._hoveredDate=null,this._buildCalendar())},{passive:!0})),s){let e=document.createElement(`div`);e.className=`mb-4 pb-4 border-b border-gray-200 dark:border-mint-divider md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-mint-divider md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col`;let t=document.createElement(`div`);t.className=`relative md:relative md:flex-1 md:min-h-0`;let n=document.createElement(`div`);n.className=`flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2`,n.style.scrollbarWidth=`none`,n.style.msOverflowStyle=`none`,n.style.setProperty(`-webkit-overflow-scrolling`,`touch`);let r=document.createElement(`style`);r.textContent=`
|
|
59
|
-
.mint-date-shortcuts-row::-webkit-scrollbar {
|
|
60
|
-
display: none;
|
|
61
|
-
}
|
|
62
|
-
@media (min-width: 768px) {
|
|
63
|
-
.mint-date-shortcuts-row {
|
|
64
|
-
height: 17rem;
|
|
65
|
-
overflow-y: auto;
|
|
66
|
-
}
|
|
67
|
-
.mint-date-shortcuts-row::-webkit-scrollbar {
|
|
68
|
-
display: block;
|
|
69
|
-
width: 4px;
|
|
70
|
-
}
|
|
71
|
-
.mint-date-shortcuts-row::-webkit-scrollbar-track {
|
|
72
|
-
background: transparent;
|
|
73
|
-
}
|
|
74
|
-
.mint-date-shortcuts-row::-webkit-scrollbar-thumb {
|
|
75
|
-
background: rgba(0, 0, 0, 0.2);
|
|
76
|
-
border-radius: 2px;
|
|
77
|
-
}
|
|
78
|
-
.dark .mint-date-shortcuts-row::-webkit-scrollbar-thumb {
|
|
79
|
-
background: rgba(255, 255, 255, 0.2);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
`,n.classList.add(`mint-date-shortcuts-row`),document.head.querySelector(`style[data-mint-date-shortcuts]`)||(r.setAttribute(`data-mint-date-shortcuts`,`true`),document.head.appendChild(r));let i=document.createElement(`div`);i.className=`absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-mint-elevated to-transparent opacity-0 md:hidden`,t.appendChild(i);let a=document.createElement(`div`);a.className=`absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-mint-elevated to-transparent opacity-100 md:hidden`,t.appendChild(a);let s=document.createElement(`div`);s.className=`hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-mint-elevated to-transparent opacity-0`,t.appendChild(s);let l=document.createElement(`div`);l.className=`hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-mint-elevated to-transparent opacity-100`,t.appendChild(l);let u=()=>{if(window.innerWidth>=768){let e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;e>0?s.style.opacity=`1`:s.style.opacity=`0`,e+r<t-1?l.style.opacity=`1`:l.style.opacity=`0`,i.style.opacity=`0`,a.style.opacity=`0`}else{let e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;e>0?i.style.opacity=`1`:i.style.opacity=`0`,e+r<t-1?a.style.opacity=`1`:a.style.opacity=`0`,s.style.opacity=`0`,l.style.opacity=`0`}};n.addEventListener(`scroll`,u),window.addEventListener(`resize`,u),setTimeout(u,0),o.forEach(e=>{let t=document.createElement(`button`);t.type=`button`,t.tabIndex=0,t.className=`px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-mint-hover text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-mint-elevated whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,t.textContent=e.label,t.setAttribute(`data-keep-popover-open`,`true`);let r=()=>{let t=e.action();if(t){if(this._isRange&&`start`in t&&`end`in t){this._selectedStartDate=t.start,this._selectedEndDate=t.end;let e=this.getFormat(),n=`${this._formatDate(t.start,e)} - ${this._formatDate(t.end,e)}`;this.setValue(n),this._currentMonth=t.start.getMonth(),this._currentYear=t.start.getFullYear()}else if(t instanceof Date){this._selectedStartDate=t,this._selectedEndDate=null;let e=this.getFormat(),n=this._formatDate(t,e);this.setValue(n),this._currentMonth=t.getMonth(),this._currentYear=t.getFullYear()}this._buildCalendar(),this._popover&&typeof this._popover.close==`function`&&this._popover.close(),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0}))}};t.addEventListener(`click`,r),t.addEventListener(`touchend`,e=>{e.preventDefault(),r()},{passive:!1}),n.appendChild(t)}),t.appendChild(n),e.appendChild(t),c.appendChild(e)}l.appendChild(u),l.appendChild(b),l.appendChild(x),c.appendChild(l),this._calendarContainer.appendChild(c)}_buildMonthView(){if(!this._calendarContainer)return;let e=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],t=document.createElement(`div`);t.className=`flex items-center justify-between mb-4`;let n=document.createElement(`button`);n.type=`button`,n.tabIndex=0,n.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,n.setAttribute(`data-keep-popover-open`,`true`);let r=document.createElement(`mint-icon`);r.setAttribute(`name`,`caret-left`),r.className=`w-4 h-4`,n.appendChild(r);let i=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};n.addEventListener(`click`,i),n.addEventListener(`touchend`,e=>{e.preventDefault(),i()},{passive:!1}),t.appendChild(n);let a=document.createElement(`button`);a.type=`button`,a.tabIndex=0,a.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 rounded px-1`,a.setAttribute(`data-keep-popover-open`,`true`),a.textContent=String(this._currentYear);let o=()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())};a.addEventListener(`click`,o),a.addEventListener(`touchend`,e=>{e.preventDefault(),o()},{passive:!1}),t.appendChild(a);let s=document.createElement(`button`);s.type=`button`,s.tabIndex=0,s.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,s.setAttribute(`data-keep-popover-open`,`true`);let c=document.createElement(`mint-icon`);c.setAttribute(`name`,`caret-right`),c.className=`w-4 h-4`,s.appendChild(c);let l=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};s.addEventListener(`click`,l),s.addEventListener(`touchend`,e=>{e.preventDefault(),l()},{passive:!1}),t.appendChild(s);let u=document.createElement(`div`);u.className=`grid grid-cols-3 gap-2`,e.forEach((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.tabIndex=0,n.setAttribute(`data-keep-popover-open`,`true`),n.className=`p-2 rounded text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${this._currentMonth===t?`bg-slate-800 dark:bg-slate-600 text-white`:`text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-mint-hover`}`,n.textContent=e;let r=()=>{if(this.getMode()===`month`){let e=new Date(this._currentYear,t,1),n=this.getFormat(),r=this._formatDate(e,n);this.setValue(r),this._selectedStartDate=e,this._selectedEndDate=null;let i=this._currentMonth,a=this._currentYear;this._currentMonth=t,this._dispatchMonthChangeEvent(i,a,this._currentMonth,this._currentYear),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this._dispatchDateChangeEvent(),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else{let e=this._currentMonth,n=this._currentYear;this._currentMonth=t,this._viewMode=`calendar`,this._buildCalendar(),this._dispatchMonthChangeEvent(e,n,this._currentMonth,this._currentYear)}};n.addEventListener(`click`,r),n.addEventListener(`touchend`,e=>{e.preventDefault(),r()},{passive:!1}),u.appendChild(n)}),this._calendarContainer.appendChild(t),this._calendarContainer.appendChild(u)}_buildYearView(){if(!this._calendarContainer)return;let e=this._currentYear-6,t=this._currentYear+6,n=document.createElement(`div`);n.className=`flex items-center justify-between mb-4`;let r=document.createElement(`button`);r.type=`button`,r.tabIndex=0,r.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,r.setAttribute(`data-keep-popover-open`,`true`);let i=document.createElement(`mint-icon`);i.setAttribute(`name`,`caret-left`),i.className=`w-4 h-4`,r.appendChild(i);let a=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear-=12,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};r.addEventListener(`click`,a),r.addEventListener(`touchend`,e=>{e.preventDefault(),a()},{passive:!1}),n.appendChild(r);let o=document.createElement(`div`);o.className=`text-sm font-medium text-gray-900 dark:text-gray-100`,o.textContent=`${e} - ${t}`,n.appendChild(o);let s=document.createElement(`button`);s.type=`button`,s.tabIndex=0,s.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,s.setAttribute(`data-keep-popover-open`,`true`);let c=document.createElement(`mint-icon`);c.setAttribute(`name`,`caret-right`),c.className=`w-4 h-4`,s.appendChild(c);let l=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear+=12,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};s.addEventListener(`click`,l),s.addEventListener(`touchend`,e=>{e.preventDefault(),l()},{passive:!1}),n.appendChild(s);let u=document.createElement(`div`);u.className=`grid grid-cols-3 gap-2`;for(let n=e;n<=t;n++){let e=document.createElement(`button`);e.type=`button`,e.tabIndex=0,e.setAttribute(`data-keep-popover-open`,`true`),e.className=`p-2 rounded text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${this._currentYear===n?`bg-slate-800 dark:bg-slate-600 text-white`:`text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-mint-hover`}`,e.textContent=String(n),e.addEventListener(`click`,()=>{let e=this.getMode();if(e===`year`){let e=new Date(n,0,1),t=this.getFormat(),r=this._formatDate(e,t);this.setValue(r),this._selectedStartDate=e,this._selectedEndDate=null;let i=this._currentMonth,a=this._currentYear;this._currentYear=n,this._currentMonth=0,this._dispatchMonthChangeEvent(i,a,this._currentMonth,this._currentYear),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this._dispatchDateChangeEvent(),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else if(e===`month`){let e=this._currentMonth,t=this._currentYear;this._currentYear=n,this._viewMode=`month`,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}else{let e=this._currentMonth,t=this._currentYear;this._currentYear=n,this._viewMode=`calendar`,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}}),u.appendChild(e)}this._calendarContainer.appendChild(n),this._calendarContainer.appendChild(u)}_getDaysInMonth(e,t){return new Date(t,e+1,0).getDate()}_getFirstDayOfMonth(e,t){let n=this.getWeekStartDay(),r=new Date(t,e,1).getDay();return r>=n?r-n:7-(n-r)}_isToday(e){let t=new Date;return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isDateSelected(e){let t=this.getSelectionMode();return this._isRange||t===`week`||t===`month`?this._selectedStartDate&&this._selectedEndDate?this._isSameDate(e,this._selectedStartDate)||this._isSameDate(e,this._selectedEndDate):this._isRange&&this._selectedStartDate&&!this._selectedEndDate?this._isSameDate(e,this._selectedStartDate):!1:this._selectedStartDate!==null&&this._isSameDate(e,this._selectedStartDate)}_isDateInRange(e){let t=this.getSelectionMode();if((this._isRange||t===`week`||t===`month`)&&this._selectedStartDate&&this._selectedEndDate)return this._rangeIncludesDisabledDates(this._selectedStartDate,this._selectedEndDate)?!1:e>=this._selectedStartDate&&e<=this._selectedEndDate;if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate){let t=this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,n=this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate;if(this._rangeIncludesDisabledDates(t,n)){let r=this._findFirstDisabledDateInRange(t,n);return r?this._selectedStartDate<this._hoveredDate?e>=t&&e<r&&!this._isSameDate(e,t):e>r&&e<=n&&!this._isSameDate(e,n):!1}return e>=t&&e<=n&&!this._isSameDate(e,t)&&!this._isSameDate(e,n)}return!1}_rangeIncludesDisabledDates(e,t){let n=this.getDisabledDates(),r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate());return n.some(e=>{let t=new Date(e.getFullYear(),e.getMonth(),e.getDate());return t>=r&&t<=i})}_findFirstDisabledDateInRange(e,t){let n=this.getDisabledDates(),r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),a=n.map(e=>new Date(e.getFullYear(),e.getMonth(),e.getDate())).filter(e=>e>=r&&e<=i).sort((e,t)=>e.getTime()-t.getTime());return a.length>0?a[0]:null}_hasIncompleteRange(){return this._isRange&&this._selectedStartDate!==null&&this._selectedEndDate===null}_isSameDate(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isDateDisabled(e){return this.getDisabledDates().some(t=>this._isSameDate(e,t))}_dispatchMonthChangeEvent(e,t,n,r){(e!==n||t!==r)&&this.dispatchEvent(new CustomEvent(`month-change`,{detail:{month:n,year:r,oldMonth:e,oldYear:t},bubbles:!0,cancelable:!0,composed:!0}))}_dispatchDateChangeEvent(){let e=this.getFormat(),t={value:this.getValue()};this._selectedStartDate&&(t.startDate=this._selectedStartDate,t.startDateFormatted=this._formatDate(this._selectedStartDate,e)),this._selectedEndDate&&(t.endDate=this._selectedEndDate,t.endDateFormatted=this._formatDate(this._selectedEndDate,e)),this.dispatchEvent(new CustomEvent(`date-change`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}))}_setupContainerObserver(){if(this._resizeObserver&&=(this._resizeObserver.disconnect(),null),!this._inputsWrapperEl)return;let e=e=>{this._inputsWrapperEl&&(e<400?(this._inputsWrapperEl.classList.add(`flex-wrap`),this._inputsWrapperEl.classList.remove(`flex-nowrap`)):(this._inputsWrapperEl.classList.remove(`flex-wrap`),this._inputsWrapperEl.classList.add(`flex-nowrap`)))};e(this._inputsWrapperEl.offsetWidth||this.offsetWidth),this._resizeObserver=new ResizeObserver(t=>{for(let n of t){let t=n.contentRect.width;e(t)}}),this._resizeObserver.observe(this)}_getWeekStart(e){let t=this.getWeekStartDay(),n=e.getDay(),r;r=n>=t?n-t:7-(t-n);let i=new Date(e);return i.setDate(e.getDate()-r),i.setHours(0,0,0,0),i}_getWeekEnd(e){let t=this._getWeekStart(e),n=new Date(t);return n.setDate(t.getDate()+6),n.setHours(23,59,59,999),n}_getMonthStart(e){let t=new Date(e.getFullYear(),e.getMonth(),1);return t.setHours(0,0,0,0),t}_getMonthEnd(e){let t=new Date(e.getFullYear(),e.getMonth()+1,0);return t.setHours(23,59,59,999),t}_handleDateClick(e){this._isHandlingClick=!0;try{let t=this.getFormat(),n=this.getSelectionMode(),r,i;if(n===`week`?(r=this._getWeekStart(e),i=this._getWeekEnd(e)):n===`month`?(r=this._getMonthStart(e),i=this._getMonthEnd(e)):(r=e,i=e),this.isRange()||n===`week`||n===`month`)if(n===`week`||n===`month`){if(this._rangeIncludesDisabledDates(r,i)){this._buildCalendar();return}this._selectedStartDate=r,this._selectedEndDate=i;let e=`${this._formatDate(this._selectedStartDate,t)} - ${this._formatDate(this._selectedEndDate,t)}`;this.setValue(e),this._textInput&&(this._textInput.value=e),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else if(this._hoveredDate=null,this._selectedStartDate===null){if(this._isDateDisabled(r)){this._buildCalendar();return}this._selectedStartDate=new Date(r.getFullYear(),r.getMonth(),r.getDate()),this._selectedEndDate=null,this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear(),this._hoveredDate=null,this._buildCalendar()}else if(this._selectedEndDate===null){let n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=this._selectedStartDate?new Date(this._selectedStartDate.getFullYear(),this._selectedStartDate.getMonth(),this._selectedStartDate.getDate()):null,i,a;if(r&&n<r?(i=n,a=r):(i=r,a=n),this._rangeIncludesDisabledDates(i,a)){this._buildCalendar();return}r&&n<r?(this._selectedEndDate=r,this._selectedStartDate=n):(this._selectedEndDate=n,r&&(this._selectedStartDate=r)),this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();let o=`${this._formatDate(this._selectedStartDate,t)} - ${this._formatDate(this._selectedEndDate,t)}`;this.setAttribute(`value`,o),this._textInput&&(this._textInput.value=o),this._hiddenInput&&(this._hiddenInput.value=o),this._updateDisplayText(),this._buildCalendar(),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else this._selectedStartDate=r,this._selectedEndDate=null;else{this._selectedStartDate=r,this._selectedEndDate=null;let e=this._formatDate(r,t);this.setValue(e),this._textInput&&(this._textInput.value=e),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}this._buildCalendar(),this._updateDisplayText(),this._exitInputMode();let a=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0})),this._dispatchDateChangeEvent()}finally{this._isHandlingClick=!1}}_updateDisplayText(){if(!this._displayEl)return;let e=this.getDisplayFormat(),t=this.getSelectionMode(),n=this._isRange||t===`week`||t===`month`,r=``;n&&this._selectedStartDate&&this._selectedEndDate?r=`${this._formatDatePhp(this._selectedStartDate,e)} - ${this._formatDatePhp(this._selectedEndDate,e)}`:this._selectedStartDate&&(r=this._formatDatePhp(this._selectedStartDate,e)),r?(this._displayEl.textContent=r,this._displayEl.classList.remove(`text-gray-400`,`dark:text-gray-500`),this._displayEl.classList.add(`text-gray-900`,`dark:text-white`)):(this._displayEl.textContent=`Select date`,this._displayEl.classList.add(`text-gray-400`,`dark:text-gray-500`),this._displayEl.classList.remove(`text-gray-900`,`dark:text-white`)),this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display=this._isInputMode?`none`:`flex`,this._inputsWrapperEl.style.display=this._isInputMode?`flex`:`none`)}_enterInputMode(){if(!this._isInputMode&&!(this.isReadonly()||this.isDisabled())&&(this._isInputMode=!0,this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display=`none`,this._inputsWrapperEl.style.display=`flex`),this._startPartInputs.length>0)){let e=this._startPartInputs[0];requestAnimationFrame(()=>{e.focus();try{e.setSelectionRange(0,e.value.length)}catch{}})}}_exitInputMode(){this._isInputMode&&(this._isInputMode=!1,this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display=`flex`,this._inputsWrapperEl.style.display=`none`),this._updateDisplayText())}_renderSkeleton(e){let t=this.querySelector(`.mint-date-picker-skeleton-container`),n=this._fieldsContainer,r=this._input;if(e){t||(t=document.createElement(`div`),t.className=`mint-date-picker-skeleton-container absolute inset-0 z-10 pointer-events-none`,r?(r.classList.contains(`relative`)||r.classList.add(`relative`),r.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-date-picker-skeleton`);e||(e=document.createElement(`div`),e.className=`mint-date-picker-skeleton w-full rounded-lg bg-gray-200 dark:bg-mint-hover animate-pulse`,e.style.height=`2.25rem`,t.appendChild(e)),t.style.display=`block`,n&&(n.style.visibility=`hidden`,n.style.pointerEvents=`none`),this._displayEl&&(this._displayEl.style.visibility=`hidden`,this._displayEl.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),n&&(n.style.visibility=`visible`,n.style.pointerEvents=`auto`),this._displayEl&&(this._displayEl.style.visibility=`visible`,this._displayEl.style.pointerEvents=`auto`)}_getFocusableElements(){if(!this._calendarContainer)return[];let e=[`button:not([disabled])`,`a[href]`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `);return Array.from(this._calendarContainer.querySelectorAll(e)).filter(e=>{let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}_setupFocusTrap(){if(!this._popover||!this._popover.hasAttribute(`open`))return;this._removeFocusTrap();let e=this;this._focusTrapHandler=function(t){if(t.key!==`Tab`)return;if(!e._popover||!e._popover.hasAttribute(`open`)){e._removeFocusTrap();return}let n=e._getFocusableElements();if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;if(!e._calendarContainer?.contains(a)){t.preventDefault(),r.focus();return}if(t.shiftKey&&a===r){t.preventDefault(),i.focus();return}if(!t.shiftKey&&a===i){t.preventDefault(),r.focus();return}},this._escapeHandler=function(t){(t.key===`Escape`||t.key===`Esc`)&&e._popover&&e._popover.hasAttribute(`open`)&&(t.preventDefault(),t.stopPropagation(),typeof e._popover.close==`function`&&e._popover.close())},document.addEventListener(`keydown`,this._focusTrapHandler,!0),document.addEventListener(`keydown`,this._escapeHandler,!0),requestAnimationFrame(()=>{let e=this._getFocusableElements();e.length>0&&e[0].focus()})}_removeFocusTrap(){this._focusTrapHandler&&=(document.removeEventListener(`keydown`,this._focusTrapHandler,!0),null),this._escapeHandler&&=(document.removeEventListener(`keydown`,this._escapeHandler,!0),null)}};customElements.get(`mint-date-picker`)||customElements.define(`mint-date-picker`,C);var w=class extends HTMLElement{constructor(...e){super(...e),this._triggerId=`mint-time-picker-trigger-${Math.random().toString(36).slice(2,10)}`,this._popover=null,this._popoverObserver=null,this._inputEl=null,this._hiddenInput=null,this._single={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeStart={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeEnd={hour:5,minute:0,second:0,meridiem:`PM`},this._invalidFromInput=!1}static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`range`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._parseAndApplyValue(this.getAttribute(`value`)||``),this.render()}disconnectedCallback(){this._popoverObserver&&=(this._popoverObserver.disconnect(),null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`value`){if(this._parseAndApplyValue(n||``),this._syncHiddenInput(),this._syncInputValue(),this._popover){let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);e&&this._buildPopoverContent(e)}return}e!==`error`&&e!==`error-message`&&(this._invalidFromInput=!1),this.render()}}get value(){return this.getValue()}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._parseAndApplyValue(e||``),this._syncHiddenInput(),this._syncInputValue()}isRange(){return this.getAttribute(`range`)===`true`}isHoursEnabled(){let e=this.getAttribute(`hours`);return e===null?!0:e!==`false`}isMinutesEnabled(){let e=this.getAttribute(`minutes`);return e===null?!0:e!==`false`}isSecondsEnabled(){let e=this.getAttribute(`seconds`);return e===null?!1:e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasExternalError(){return this.getAttribute(`error`)===`true`}getExternalErrorMessage(){return this.getAttribute(`error-message`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}_getEffectiveError(){return{hasError:this.hasExternalError(),message:this.getExternalErrorMessage()}}_formatParts(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=[];return t&&i.push(e.hour.toString()),n&&i.push(e.minute.toString().padStart(2,`0`)),r&&i.push(e.second.toString().padStart(2,`0`)),t?`${i.join(`:`)} ${e.meridiem.toLowerCase()}`:i.join(`:`)}_to24Hour(e){let t=e.hour%12;return e.meridiem===`PM`&&(t+=12),{hour:t,minute:e.minute,second:e.second}}_formatParts24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=this._to24Hour(e),a=[];return t&&a.push(i.hour.toString().padStart(2,`0`)),n&&a.push(i.minute.toString().padStart(2,`0`)),r&&a.push(i.second.toString().padStart(2,`0`)),a.join(`:`)}_getDisplayValue(){return this.isRange()?`${this._formatParts(this._rangeStart)} - ${this._formatParts(this._rangeEnd)}`:this._formatParts(this._single)}_getOutputValue(){return this.isRange()?`${this._formatParts24(this._rangeStart)} - ${this._formatParts24(this._rangeEnd)}`:this._formatParts24(this._single)}_getExpectedFormat(){let e=this.isHoursEnabled(),t=this.isMinutesEnabled(),n=this.isSecondsEnabled(),r=[];e&&r.push(`h`),t&&r.push(`mm`),n&&r.push(`ss`);let i=e?`${r.join(`:`)} am/pm`:r.join(`:`);return this.isRange()?`${i} - ${i}`:i}_syncHiddenInput(){this._hiddenInput&&(this._hiddenInput.value=this.getValue()||this._getOutputValue())}_syncInputValue(){this._inputEl&&(this._inputEl.value=this._getDisplayValue(),typeof this._inputEl.render==`function`&&this._inputEl.render())}_emitChangeFromPicker(){let e=this._getOutputValue();this._invalidFromInput=!1,this.setAttribute(`value`,e),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_parseSingle(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*(am|pm)$/i);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0),s=e[4].toUpperCase();return t<1||t>12||n&&(a<0||a>59)||r&&(o<0||o>59)?null:{hour:t,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseSingleOutput24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{2})(?::(\d{2}))?(?::(\d{2}))?$/);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0);if(t<0||t>23||n&&(a<0||a>59)||r&&(o<0||o>59))return null;let s=t>=12?`PM`:`AM`;return{hour:t%12==0?12:t%12,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseAndApplyValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingleOutput24(t||``),i=this._parseSingleOutput24(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingleOutput24(e);return t?(this._single=t,!0):!1}_parseAndApplyDisplayValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingle(t||``),i=this._parseSingle(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingle(e);return t?(this._single=t,!0):!1}_handleTypedValue(e){let t=e.trim();if(!t){this._invalidFromInput=!1,this.removeAttribute(`value`),this._syncHiddenInput(),this._syncInputValue();return}if(!this._parseAndApplyDisplayValue(t)){this._invalidFromInput=!0,this.removeAttribute(`value`),this._inputEl&&(this._inputEl.value=``),this._syncHiddenInput(),this.render(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._invalidFromInput=!1;let n=this._getOutputValue();this.setAttribute(`value`,n),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_buildColumn(e,t,n,r=!0,i=`py-28`){let a=document.createElement(`div`);return a.className=`h-[15rem] overflow-y-auto ${i} ${r?`border-r border-gray-300 dark:border-mint-divider`:``}`,e.forEach(e=>{let r=document.createElement(`button`);r.type=`button`;let i=e===t;r.className=`block w-full py-2 text-center text-base leading-none ${i?`font-semibold text-brand-500 dark:text-white`:`font-normal text-gray-500 dark:text-gray-400`}`,r.dataset.selected=i?`true`:`false`,r.textContent=e,r.addEventListener(`click`,()=>n(e)),a.appendChild(r)}),a}_centerSelectedInColumn(e,t=0){let n=e.querySelector(`button[data-selected="true"]`);if(!n)return;let r=n.offsetTop-(e.clientHeight/2-n.clientHeight/2)-t;e.scrollTop=Math.max(0,r)}_centerAllColumnsInPopoverBody(){if(!this._popover)return;let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);if(!e)return;let t=Array.from(e.querySelectorAll(`.h-\\[15rem\\]`)),n=this.isRange()?20:0;t.forEach(e=>this._centerSelectedInColumn(e,n))}_setupPopoverOpenObserver(){this._popover&&(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._popoverObserver=new MutationObserver(()=>{this._popover?.getAttribute(`open`)===`true`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]}))}_buildPickerSet(e,t,n){let r=this.isHoursEnabled(),i=this.isMinutesEnabled(),a=this.isSecondsEnabled(),o=document.createElement(`div`),s=(r?1:0)+(i?1:0)+(a?1:0)+(r?1:0);o.className=`grid bg-white dark:bg-mint-elevated overflow-hidden`,o.style.gridTemplateColumns=`repeat(${Math.max(s,1)}, minmax(0, 1fr))`;let c=Array.from({length:12},(e,t)=>(t+1).toString().padStart(2,`0`)),l=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),u=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),d=[`AM`,`PM`],f=[];r&&f.push(this._buildColumn(c,t.hour.toString().padStart(2,`0`),e=>{n({...t,hour:Number(e)})},!0,`py-32`)),i&&f.push(this._buildColumn(l,t.minute.toString().padStart(2,`0`),e=>{n({...t,minute:Number(e)})},!0,`py-32`)),a&&f.push(this._buildColumn(u,t.second.toString().padStart(2,`0`),e=>{n({...t,second:Number(e)})},!0,`py-32`)),r&&f.push(this._buildColumn(d,t.meridiem,e=>{n({...t,meridiem:e})},!0,`py-20`)),f.forEach((e,t)=>{t===f.length-1&&e.classList.remove(`border-r`),o.appendChild(e)}),e.appendChild(o)}_buildPopoverContent(e){if(e.innerHTML=``,!this.isRange()){this._buildPickerSet(e,this._single,t=>{this._single=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});return}let t=document.createElement(`div`);t.className=`flex flex-col gap-3 min-[640px]:grid min-[640px]:grid-cols-2`;let n=document.createElement(`div`),r=document.createElement(`mint-text`);r.setAttribute(`variant`,`muted`),r.className=`mb-2 text-xs uppercase`,r.textContent=`Start`,n.appendChild(r),this._buildPickerSet(n,this._rangeStart,t=>{this._rangeStart=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});let i=document.createElement(`div`),a=document.createElement(`mint-text`);a.setAttribute(`variant`,`muted`),a.className=`mb-2 text-xs uppercase`,a.textContent=`End`,i.appendChild(a),this._buildPickerSet(i,this._rangeEnd,t=>{this._rangeEnd=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),t.appendChild(n),t.appendChild(i),e.appendChild(t),requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})}_syncInputIconDarkModeTone(){if(!this._inputEl)return;let e=this._inputEl.querySelector(`mint-icon`);e&&(e.classList.remove(`dark:text-gray-500`),e.classList.add(`dark:text-white`))}render(){let e=this.isDisabled(),t=this.isReadonly(),n=this._getEffectiveError();this.innerHTML=``;let r=document.createElement(`div`);r.className=`w-full`,this._inputEl=document.createElement(`mint-input`),this._inputEl.id=this._triggerId,this._inputEl.classList.add(`w-full`),this._inputEl.setAttribute(`type`,`text`),this._inputEl.setAttribute(`icon`,`clock`),this._inputEl.setAttribute(`placeholder`,this._getExpectedFormat()),this._inputEl.setAttribute(`label`,this.getLabel()),this._inputEl.setAttribute(`info`,this.getInfo()),this._inputEl.setAttribute(`value`,this._getDisplayValue()),this._inputEl.setAttribute(`error`,n.hasError?`true`:`false`),this._inputEl.setAttribute(`error-message`,n.message||``),e&&this._inputEl.setAttribute(`disabled`,`true`),t&&this._inputEl.setAttribute(`readonly`,`true`),this._inputEl.addEventListener(`change`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())}),this._inputEl.addEventListener(`blur`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())},!0),r.appendChild(this._inputEl),this._syncInputIconDarkModeTone(),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getName(),this._hiddenInput.required=this.isRequired(),r.appendChild(this._hiddenInput),this._syncHiddenInput(),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),(e||t)&&this._popover.setAttribute(`open`,`false`);let i=document.createElement(`div`);i.setAttribute(`data-mint-time-picker-body`,`true`),i.className=`min-w-[18rem] max-w-[56rem] p-3 bg-white dark:bg-mint-elevated`,this._buildPopoverContent(i),this._popover.appendChild(i),r.appendChild(this._popover),this._setupPopoverOpenObserver(),this.appendChild(r)}};customElements.get(`mint-time-picker`)||customElements.define(`mint-time-picker`,w);var T=`data-mint-select-part`,E=class e extends HTMLElement{static get observedAttributes(){return[`name`,`value`,`disabled`,`id`,`required`,`label`,`info`,`error`,`error-message`,`multiple`,`loading`]}static{this._lightDomOptionHideStylesInjected=!1}static _ensureLightDomOptionHideStyles(){if(e._lightDomOptionHideStylesInjected||typeof document>`u`)return;e._lightDomOptionHideStylesInjected=!0;let t=document.createElement(`style`);t.setAttribute(`data-mint-select-light-dom`,``),t.textContent=`/* Framework-driven <option>/<optgroup> stay on the host for DOM reconciliation; the visible control is the inner <select>. */
|
|
83
|
-
mint-select > option,
|
|
84
|
-
mint-select > optgroup {
|
|
85
|
-
display: none !important;
|
|
86
|
-
}`,document.head.appendChild(t)}constructor(){super(),this._select=null,this._wrapper=null,this._caretUpIcon=null,this._caretDownIcon=null,this._changeHandler=null,this._optionObserver=null,this._childrenObserver=null,this._hostOptionsObserverRaf=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`,`w-full`),this.getLabel()||console.error(`mint-select: The "label" attribute is required. Please provide a label for the select.`),e._ensureLightDomOptionHideStyles(),this.render(),this._childrenObserver&&this._childrenObserver.disconnect(),this._childrenObserver=new MutationObserver(e=>{if(e.some(e=>{let t=e.target;if(this._select&&(t===this._select||this._select.contains(t)))return!1;let n=Array.from(e.addedNodes).some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.tagName===`OPTION`||e.tagName===`OPTGROUP`))||Array.from(e.removedNodes).some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.tagName===`OPTION`||e.tagName===`OPTGROUP`)),r=e.type===`attributes`&&e.target.nodeType===Node.ELEMENT_NODE&&(e.target.tagName===`OPTION`||e.target.tagName===`OPTGROUP`);return n||r})){if(this._hostOptionsObserverRaf!==null)return;this._hostOptionsObserverRaf=requestAnimationFrame(()=>{this._hostOptionsObserverRaf=null,this.isConnected&&this.render()})}}),this._childrenObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`,`selected`,`disabled`]})}disconnectedCallback(){this._select&&this._changeHandler&&(this._select.removeEventListener(`change`,this._changeHandler),this._changeHandler=null),this._optionObserver&&=(this._optionObserver.disconnect(),null),this._childrenObserver&&=(this._childrenObserver.disconnect(),null),this._hostOptionsObserverRaf!==null&&(cancelAnimationFrame(this._hostOptionsObserverRaf),this._hostOptionsObserverRaf=null)}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._select&&(this._select.className=this.getSelectClasses(),this._select.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`));return}if(e===`loading`){this.render();return}if(e===`value`){if(this._select)if(this.isMultiple()){let e=[];try{let t=n?JSON.parse(n):[];e=Array.isArray(t)?t.map(e=>String(e)):[]}catch{e=n?[String(n)]:[]}Array.from(this._select.options).forEach(t=>{t.selected=e.includes(t.value)})}else this._select.value=n||``;return}this.render()}}getName(){return this.getAttribute(`name`)||``}getValue(){if(this.isMultiple()&&this._select){let e=Array.from(this._select.selectedOptions).map(e=>e.value);return JSON.stringify(e)}return this.hasAttribute(`value`)?this.getAttribute(`value`)||``:this._select?this._select.value:``}setValue(e){if(this.isMultiple()){let t=Array.isArray(e)?e.map(e=>String(e)):e==null||e===``?[]:[String(e)];this.setAttribute(`value`,JSON.stringify(t)),this._select&&Array.from(this._select.options).forEach(e=>{e.selected=t.includes(e.value)});return}let t=e==null?``:String(e);this.setAttribute(`value`,t),this._select&&(this._select.value=t)}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{if(this.isMultiple()){this.setValue(e);return}let t=e||``;(this.getAttribute(`value`)||``)!==t&&this.setAttribute(`value`,t),this._select&&requestAnimationFrame(()=>{this._select&&(t===``||Array.from(this._select.options).some(e=>e.value===t))&&this._select.value!==t&&(this._select.value=t)})}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}isMultiple(){return this.getAttribute(`multiple`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getSelectClasses(){let e=this.hasError(),t=this.isMultiple(),n=[`w-full`,`px-3.5`,t?`pr-3.5`:`pr-10`,t?`py-2`:`py-1.5`,t?`min-h-[6rem]`:`min-h-[2rem]`,`text-sm`,`font-medium`,`rounded-lg`,`box-border`,`bg-white`,`dark:bg-mint-elevated`,`text-gray-900`,`dark:text-white`,`outline-none`,`focus:outline-none`,`disabled:opacity-40`,`disabled:cursor-not-allowed`,`appearance-none`,`bg-no-repeat`,`bg-right`,`cursor-pointer`],r=[`border-2`,e?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`],i=[`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`];return[...n,...r,...i].filter(Boolean).join(` `)}render(){this._hostOptionsObserverRaf!==null&&(cancelAnimationFrame(this._hostOptionsObserverRaf),this._hostOptionsObserverRaf=null);let e=this.isLoading(),t=this.isMultiple(),n=this.getValue(),r=[];this._select&&Array.from(this._select.children).forEach(e=>{(e.tagName===`OPTION`||e.tagName===`OPTGROUP`)&&r.push(e.cloneNode(!0))}),Array.from(this.children).forEach(e=>{e instanceof HTMLElement&&e.hasAttribute(T)&&e.remove()}),this._wrapper=null,this._select=null;let i=Array.from(this.children).filter(e=>e.tagName===`OPTION`||e.tagName===`OPTGROUP`).map(e=>e.cloneNode(!0)),a=this.getLabel(),o=this.getInfo(),s=this.getId(),c=this.getName(),l=this.isDisabled(),u=this.hasError();if(a){let e=document.createElement(`label`);e.setAttribute(T,`label`),e.className=`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,s&&e.setAttribute(`for`,s);let t=document.createTextNode(a);e.appendChild(t),this.appendChild(e)}this._wrapper=document.createElement(`div`),this._wrapper.setAttribute(T,`wrapper`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper),this._select=document.createElement(`select`),this._select.className=this.getSelectClasses(),s&&(this._select.id=s),c&&(this._select.name=c),l&&(this._select.disabled=!0),t&&(this._select.multiple=!0),this._select.setAttribute(`aria-invalid`,u?`true`:`false`);let d=i.length>0?i:r;if(d.length>0&&d.forEach(e=>{this._select.appendChild(e)}),this._select.options.length===0){let e=document.createElement(`option`);e.value=``,e.textContent=`Select an option`,e.disabled=!0,e.selected=!0,this._select.appendChild(e)}if(t){let e=[];try{let t=n?JSON.parse(n):[];e=Array.isArray(t)?t.map(e=>String(e)):[]}catch{e=n?[String(n)]:[]}Array.from(this._select.options).forEach(t=>{t.selected=e.includes(t.value)})}else this._select.value=n||``;if(this._changeHandler&&this._select&&this._select.removeEventListener(`change`,this._changeHandler),this._changeHandler=e=>{let n=e.target,r=t?Array.from(n.selectedOptions).map(e=>e.value):n.value,i=t?JSON.stringify(r):String(r||``);(this.getAttribute(`value`)||``)!==i&&(i?this.setAttribute(`value`,i):this.removeAttribute(`value`));let a=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:r},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,cancelable:!0,composed:!0}))},this._select.addEventListener(`change`,this._changeHandler),this._optionObserver&&this._optionObserver.disconnect(),this._optionObserver=new MutationObserver(()=>{let e=this.getAttribute(`value`)||this.value||``;this._select&&e&&requestAnimationFrame(()=>{if(this._select)if(t){let t=[];try{let n=JSON.parse(e);t=Array.isArray(n)?n.map(e=>String(e)):[]}catch{t=[String(e)]}Array.from(this._select.options).forEach(e=>{e.selected=t.includes(e.value)})}else Array.from(this._select.options).some(t=>t.value===e)&&this._select.value!==e&&(this._select.value=e)})}),this._optionObserver.observe(this._select,{childList:!0,subtree:!0}),this._wrapper.appendChild(this._select),t)this._caretUpIcon=null,this._caretDownIcon=null;else{let e=document.createElement(`div`);e.className=`absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col`,this._caretUpIcon=document.createElement(`mint-icon`),this._caretUpIcon.setAttribute(`name`,`caret-up`),this._caretUpIcon.className=`w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]`,e.appendChild(this._caretUpIcon),this._caretDownIcon=document.createElement(`mint-icon`),this._caretDownIcon.setAttribute(`name`,`caret-down`),this._caretDownIcon.className=`w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]`,e.appendChild(this._caretDownIcon),this._wrapper.appendChild(e)}if(o){let e=document.createElement(`div`);e.setAttribute(T,`info`),e.className=`mt-1 text-xs text-gray-500 dark:text-gray-400`,e.textContent=o,this.appendChild(e)}this._renderErrorState(),this._renderSkeleton(e)}_renderSkeleton(e){let t=this.querySelector(`.mint-select-skeleton-container`),n=this._wrapper;if(e){t||(t=document.createElement(`div`),t.className=`mint-select-skeleton-container absolute inset-0 z-10 pointer-events-none`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-select-skeleton`);if(!e){e=document.createElement(`div`),e.className=`mint-select-skeleton w-full rounded-lg bg-gray-200 dark:bg-mint-hover animate-pulse`;let n=this.isMultiple();e.style.height=n?`6rem`:`2.25rem`,t.appendChild(e)}t.style.display=`block`,this._select&&(this._select.style.opacity=`0`,this._select.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),this._select&&(this._select.style.opacity=`1`,this._select.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-select-error`);e&&t?(n?n.hasAttribute(T)||n.setAttribute(T,`error`):(n=document.createElement(`div`),n.setAttribute(T,`error`),n.className=`mint-select-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}};customElements.get(`mint-select`)||customElements.define(`mint-select`,E);var D=class extends HTMLElement{static get observedAttributes(){return[`label`,`accept`,`multiple`,`width`,`height`,`disabled`,`name`,`error`,`error-message`,`loading`]}constructor(){super(),this._dropzone=null,this._fileInput=null,this._previewContainer=null,this._isDragging=!1,this._wasDragging=!1,this._isUpdatingFiles=!1,this._listenersInitialized=!1,this._selectedFiles=[],this._previewUrls=[],this._resetHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._attachFormResetListener()}disconnectedCallback(){if(this.removeEventListeners(),this._cleanupPreviewUrls(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._updateDragStateClass(),this._renderErrorState(this.hasError(),this.getErrorMessage());return}if(e===`loading`){this.render();return}this.render()}}getLabel(){return this.getAttribute(`label`)||``}getAccept(){return this.getAttribute(`accept`)||``}isMultiple(){return this.getAttribute(`multiple`)===`true`}getWidth(){return this.getAttribute(`width`)||`200px`}getHeight(){return this.getAttribute(`height`)||`200px`}_renderSkeleton(e){let t=this.querySelector(`.mint-dropzone-skeleton-container`),n=this._dropzone;if(e){t||(t=document.createElement(`div`),t.className=`mint-dropzone-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center justify-center`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-dropzone-skeleton`);if(e||(e=document.createElement(`div`),e.className=`mint-dropzone-skeleton rounded-lg border-2 border-dashed border-gray-300 dark:border-mint-divider bg-gray-200 dark:bg-mint-hover animate-pulse`,e.style.width=`100%`,e.style.height=`100%`,t.appendChild(e)),t.style.display=`flex`,n){let e=n.querySelector(`.mint-dropzone-icon`),t=n.querySelector(`.mint-dropzone-label`),r=n.querySelector(`.mint-dropzone-previews-wrapper`),i=this._fileInput;if(e){let t=e;t.style.visibility=`hidden`,t.style.pointerEvents=`none`}if(t){let e=t;e.style.visibility=`hidden`,e.style.pointerEvents=`none`}if(r){let e=r;e.style.visibility=`hidden`,e.style.pointerEvents=`none`}i&&(i.style.visibility=`hidden`,i.style.pointerEvents=`none`),n.style.pointerEvents=`none`}}else if(t&&(t.style.display=`none`),n){let e=n.querySelector(`.mint-dropzone-icon`),t=n.querySelector(`.mint-dropzone-label`),r=n.querySelector(`.mint-dropzone-previews-wrapper`),i=this._fileInput;if(e){let t=e;t.style.visibility=`visible`,t.style.pointerEvents=`auto`}if(t){let e=t;e.style.visibility=`visible`,e.style.pointerEvents=`auto`}if(r){let e=r;e.style.visibility=`visible`,e.style.pointerEvents=`auto`}i&&(i.style.visibility=`visible`,i.style.pointerEvents=`auto`),n.style.pointerEvents=`auto`}}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getAccept(),r=this.isMultiple(),i=this.isDisabled(),a=this.getWidth(),o=this.getHeight(),s=this.getName(),c=this.hasError(),l=this.getErrorMessage();this._dropzone||(this._dropzone=document.createElement(`div`),this.appendChild(this._dropzone)),this._updateDragStateClass(),this._dropzone.setAttribute(`aria-invalid`,c?`true`:`false`),i?(this._dropzone.setAttribute(`tabindex`,`-1`),this._dropzone.removeAttribute(`role`)):(this._dropzone.setAttribute(`tabindex`,`0`),this._dropzone.setAttribute(`role`,`button`),this._dropzone.setAttribute(`aria-label`,t||`File upload dropzone`)),this._dropzone.style.width=a,this._dropzone.style.height=o,this._dropzone.style.minWidth=a,this._dropzone.style.minHeight=o,this._fileInput||(this._fileInput=document.createElement(`input`),this._fileInput.type=`file`,this._fileInput.style.display=`none`,this._fileInput.setAttribute(`tabindex`,`-1`),this._fileInput.setAttribute(`aria-hidden`,`true`),this._dropzone.appendChild(this._fileInput)),this._fileInput.accept=n,this._fileInput.multiple=r,this._fileInput.disabled=i,s?this._fileInput.name=s:this._fileInput.removeAttribute(`name`),this._fileInput.setAttribute(`aria-invalid`,c?`true`:`false`);let u=this._dropzone.querySelector(`.mint-dropzone-icon`),d=this._dropzone.querySelector(`.mint-dropzone-label`);u&&u.remove(),d&&d.remove();let f=document.createElement(`div`);f.className=`mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0`;let p=document.createElement(`mint-icon`);if(p.setAttribute(`name`,`upload`),p.className=`w-12 h-12 text-gray-400 dark:text-gray-500`,f.appendChild(p),this._dropzone.appendChild(f),t){let e=document.createElement(`div`);e.className=`mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0`,e.textContent=t,this._dropzone.appendChild(e)}this.setupEventListeners(),this._renderErrorState(c,l),this._renderPreviews(),this._renderSkeleton(e)}_updateDragState(){this._dropzone&&this._updateDragStateClass()}_renderErrorState(e,t){let n=this.querySelector(`.mint-dropzone-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-dropzone-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_updateDragStateClass(){if(!this._dropzone)return;let e=this.isDisabled(),t=this.hasError(),n=`relative border-2 border-dashed rounded-lg flex flex-col items-center ${this._selectedFiles.length>0?`justify-start`:`justify-center`} cursor-pointer overflow-hidden`,r=this._isDragging?`border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-mint-elevated dark:border-mint-divider`:`border-gray-300 dark:border-mint-divider bg-white dark:bg-mint-elevated dark:border-mint-divider hover:border-gray-400 dark:hover:border-mint-divider`,i=t?`border-red-300 dark:border-red-300 bg-red-50/50 dark:bg-red-900/30`:``,a=e?`opacity-40 cursor-not-allowed`:``;this._dropzone.className=`${n} ${t?i:r} ${a} focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`.trim()}setupEventListeners(){this._listenersInitialized||(this._listenersInitialized=!0,this.removeEventListeners(),!(!this._dropzone||!this._fileInput||this.isDisabled())&&(this._onDropzoneClick||=e=>{if(!(this.isDisabled()||!this._fileInput)&&e.target!==this._fileInput&&(e.stopPropagation(),e.preventDefault(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onDragOver||=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||this._isDragging||(this._isDragging=!0,this._wasDragging=!0,this._updateDragState())},this._onDragLeave||=e=>{e.preventDefault(),e.stopPropagation();let t=this._dropzone?.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState())},this._onDrop||=e=>{if(e.preventDefault(),e.stopPropagation(),this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState()),this.isDisabled())return;let t=e.dataTransfer?.files;t&&t.length>0&&this._handleFiles(t)},this._onFileInputInput||=e=>{e.stopImmediatePropagation(),e.stopPropagation()},this._onKeyDown||=e=>{if(!(this.isDisabled()||!this._fileInput)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onFocus||=e=>{this._dropzone&&!this.isDisabled()&&this._dropzone.classList.add(`focus-visible:ring-2`)},this._onBlur||=e=>{this._dropzone},this._onFileInputChange||=e=>{if(e.stopImmediatePropagation(),e.stopPropagation(),this._isUpdatingFiles)return;let t=e.target.files;if(t&&t.length>0){let e=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<t.length;n++){let a=t[n];this._isFileAccepted(a,e)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}},this._dropzone.addEventListener(`click`,this._onDropzoneClick),this._dropzone.addEventListener(`dragover`,this._onDragOver),this._dropzone.addEventListener(`dragleave`,this._onDragLeave),this._dropzone.addEventListener(`drop`,this._onDrop),this._dropzone.addEventListener(`keydown`,this._onKeyDown),this._dropzone.addEventListener(`focus`,this._onFocus),this._dropzone.addEventListener(`blur`,this._onBlur),this._fileInput.addEventListener(`change`,this._onFileInputChange),this._fileInput.addEventListener(`input`,this._onFileInputInput,!0)))}removeEventListeners(){this._dropzone&&(this._onDropzoneClick&&this._dropzone.removeEventListener(`click`,this._onDropzoneClick),this._onDragOver&&this._dropzone.removeEventListener(`dragover`,this._onDragOver),this._onDragLeave&&this._dropzone.removeEventListener(`dragleave`,this._onDragLeave),this._onDrop&&this._dropzone.removeEventListener(`drop`,this._onDrop),this._onKeyDown&&this._dropzone.removeEventListener(`keydown`,this._onKeyDown),this._onFocus&&this._dropzone.removeEventListener(`focus`,this._onFocus),this._onBlur&&this._dropzone.removeEventListener(`blur`,this._onBlur)),this._fileInput&&(this._onFileInputChange&&this._fileInput.removeEventListener(`change`,this._onFileInputChange),this._onFileInputInput&&this._fileInput.removeEventListener(`input`,this._onFileInputInput,!0)),this._isDragging=!1,this._listenersInitialized=!1}_handleFiles(e){let t=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<e.length;n++){let a=e[n];this._isFileAccepted(a,t)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}_isFileAccepted(e,t){if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase());for(let t of n)if(t.startsWith(`.`)){if(`.`+e.name.split(`.`).pop()?.toLowerCase()===t)return!0}else if(t.includes(`/*`)){if(t.split(`/`)[0]===e.type.split(`/`)[0])return!0}else if(e.type===t)return!0;return!1}_dispatchEvent(e,t){let n=t.target,r=new CustomEvent(e,{detail:{files:n.files?Array.from(n.files):[],value:n.value||``},bubbles:!0,cancelable:!0});this.dispatchEvent(r)}_dispatchSelectionEvents(){let e={files:[...this._selectedFiles],value:``};this.dispatchEvent(new CustomEvent(`input`,{detail:e,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:e,bubbles:!0,cancelable:!0,composed:!0}))}_syncFileInputFromSelected(){if(!this._fileInput)return;let e=new DataTransfer;this._selectedFiles.forEach(t=>{try{e.items.add(t)}catch(e){console.warn(`Failed to add file to DataTransfer:`,e)}}),this._isUpdatingFiles=!0;try{this._fileInput.files=e.files}catch(e){console.warn(`Failed to set files on input:`,e)}setTimeout(()=>{this._isUpdatingFiles=!1},0)}get files(){return this._syncFileInputFromSelected(),this._fileInput?.files||null}syncFiles(){this._syncFileInputFromSelected()}_renderPreviews(){if(!this._dropzone)return;if(this._previewContainer&&(this._cleanupPreviewUrls(),this._previewContainer.remove()),this._selectedFiles.length===0){this._previewContainer=null,this._updateDragStateClass();return}let e=document.createElement(`div`);e.className=`mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48`;let t=document.createElement(`div`);t.className=`mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2`,this._selectedFiles.forEach((e,n)=>{let r=document.createElement(`div`);if(r.className=`flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-mint-divider bg-gray-50 dark:bg-mint-elevated`,e.type.startsWith(`image/`)){let t=document.createElement(`img`);t.className=`w-12 h-12 object-cover rounded border border-gray-200 dark:border-mint-divider`;let n=URL.createObjectURL(e);this._previewUrls.push(n),t.src=n,r.appendChild(t)}else{let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`attach`),e.className=`w-5 h-5 text-gray-500 dark:text-gray-300`,r.appendChild(e)}let i=document.createElement(`div`);i.className=`flex-1 text-sm text-gray-800 dark:text-gray-100 truncate`,i.textContent=e.name,r.appendChild(i);let a=document.createElement(`button`);a.type=`button`,a.className=`text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 flex items-center justify-center w-6 h-6 rounded-full`;let o=document.createElement(`mint-icon`);o.setAttribute(`name`,`close`),o.className=`w-4 h-4`,a.appendChild(o),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),this._removeFileAt(n)}),r.appendChild(a),t.appendChild(r)});let n=this.hasError(),r=this._isDragging,i=`from-white dark:from-mint-elevated`;n?i=`from-red-50 dark:from-red-900/30`:r&&(i=`from-gray-50 dark:from-mint-elevated`);let a=document.createElement(`div`);a.className=`absolute top-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-b ${i} to-transparent opacity-0`,e.appendChild(a);let o=document.createElement(`div`);o.className=`absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${i} to-transparent opacity-100`,e.appendChild(o);let s=()=>{let e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;e>0?a.style.opacity=`1`:a.style.opacity=`0`,e+r<n-1?o.style.opacity=`1`:o.style.opacity=`0`};s(),t.addEventListener(`scroll`,s),e.appendChild(t),this._previewContainer=e,this._dropzone.appendChild(e),this._updateDragStateClass()}_removeFileAt(e){if(e<0||e>=this._selectedFiles.length)return;let[t]=this._selectedFiles.splice(e,1);t&&this._cleanupPreviewUrls(),this._syncFileInputFromSelected(),this._renderPreviews(),this._dispatchSelectionEvents()}_cleanupPreviewUrls(){this._previewUrls.forEach(e=>URL.revokeObjectURL(e)),this._previewUrls=[]}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this._selectedFiles=[],this._syncFileInputFromSelected(),this._renderPreviews(),this._cleanupPreviewUrls()},e.addEventListener(`reset`,this._resetHandler))}_applyValidFiles(e){if(this.isMultiple()){let t=e.filter(e=>!this._isDuplicateFile(e));this._selectedFiles.push(...t)}else this._selectedFiles=[e[0]];this._syncFileInputFromSelected(),this._selectedFiles.length>0&&(this.removeAttribute(`error`),this.removeAttribute(`error-message`),this._fileInput&&this._fileInput.removeAttribute(`aria-invalid`)),this._renderPreviews(),this._dispatchSelectionEvents()}_isDuplicateFile(e){return this._selectedFiles.some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)}};customElements.get(`mint-dropzone`)||customElements.define(`mint-dropzone`,D);var O=class extends HTMLElement{static get observedAttributes(){return[`action`,`method`,`enctype`,`data-form-data`,`loading`,`headers`,`submitting`]}constructor(){super(),this._form=null,this._submitHandler=null,this._hostSubmitHandler=null,this._errors={},this._fieldBlurHandlers=new Map,this._fieldChangeHandlers=new Map,this._observer=null,this._formData=null,this._headers=null,this._buttonStates=new Map,this._attrSubmittingMintFields=new Map,this._attrSubmittingNativeFields=new Map,this._attrSubmittingMintButtons=new Map,this._attrSubmittingNativeButtons=new Map,this._reactiveDataProxy=null,this._reactiveDataObserver=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null}connectedCallback(){this._render(),this._ensureSubmitHandler(),this._setupBlurValidation();let e=this.getAttribute(`headers`);e&&this._parseHeaders(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this._formData)this._isReactiveObject(this._formData)?this._setupReactiveDataObserver(this._formData):this._lastDataSnapshot||=this._createDataSnapshot(this._formData),this._applyFormData();else{let e=this.getAttribute(`data-form-data`);e&&(this._parseFormData(e),this._applyFormData())}this._propagateLoadingState(),this._applySubmittingAttributeState()})})}disconnectedCallback(){this._form&&this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._hostSubmitHandler&&this.removeEventListener(`submit`,this._hostSubmitHandler),this._restoreSubmittingAttributeState(),this._cleanupBlurValidation(),this._stopReactiveDataObserver()}reset(){this._clearErrors(),this._formData?this._applyFormData():this.clear()}clear(){this._clearErrors(),this._form&&this._form.reset(),this._resetCustomFields()}submit(){if(this._form){if(typeof this._form.requestSubmit==`function`){this._form.requestSubmit();return}this._handleSubmit(new Event(`submit`,{bubbles:!0,cancelable:!0}))}}attributeChangedCallback(e,t,n){e===`form-data`?(this._parseFormData(n),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})):e===`headers`?this._parseHeaders(n):e===`loading`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._propagateLoadingState()}):this._propagateLoadingState():e===`submitting`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._applySubmittingAttributeState()}):this._applySubmittingAttributeState():this._applyFormAttributes()}get data(){return this._formData}set data(e){this._stopReactiveDataObserver(),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null,e&&typeof e==`object`&&!Array.isArray(e)?(this._formData=e,this._isReactiveObject(e)?this._setupReactiveDataObserver(e):this._lastDataSnapshot=this._createDataSnapshot(e)):e==null?this._formData=null:this._parseFormData(e),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})})}get headers(){return this._headers}set headers(e){if(e&&typeof e==`object`&&!Array.isArray(e))this._headers=e;else if(e==null)this._headers=null;else if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_render(){if(this.classList.add(`block`,`w-full`),!this._form){for(this._form=document.createElement(`form`),this._form.noValidate=!0;this.firstChild;)this._form.appendChild(this.firstChild);this.appendChild(this._form)}this._ensureSubmitHandler(),this._applyFormAttributes()}_ensureSubmitHandler(){this._form&&(this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._submitHandler=e=>{e.preventDefault(),e.stopImmediatePropagation(),this._handleSubmit(e)},this._form.addEventListener(`submit`,this._submitHandler,!0))}_applyFormAttributes(){if(!this._form)return;let e=this.getAttribute(`action`)||``,t=this.getAttribute(`method`)||``,n=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;e&&(this._form.action=e),t&&(this._form.method=t),this._form.enctype=n}async _handleSubmit(e){if(e.preventDefault(),!this._form)return;this._clearErrors(),this._syncDropzoneFiles();let t=this._collectValidationRules(),n=new FormData(this._form),r=this._formDataToValues(n);if(this._formData){let e=this._getReactiveValue(this._formData);e&&typeof e==`object`&&!Array.isArray(e)&&(r={...this._extractReactiveData(e),...r})}let i=this._collectLiveControlValues();if(r={...r,...i},!this._validate(r,t)){this.dispatchEvent(new CustomEvent(`invalid`,{detail:{errors:this._errors},bubbles:!0,cancelable:!0,composed:!0}));return}let a=new CustomEvent(`submit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),a.form=this;let o=new CustomEvent(`mintFormSubmit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});if(o.form=this,this.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented)return;let s=this.getAttribute(`action`),c=this.getAttribute(`method`);if(!(!s||!c)){this._setButtonsSubmitting();try{let e=await this._submitData(n,r);this.dispatchEvent(new CustomEvent(`submitsuccess`,{detail:e,bubbles:!0,cancelable:!0}))}catch(e){e?.status===422&&e?.data?.errors&&this._applyServerErrors(e.data.errors),this.dispatchEvent(new CustomEvent(`submiterror`,{detail:{error:e},bubbles:!0,cancelable:!0}))}finally{this._restoreButtonsState()}}}async _submitData(e,t){let n=this.getAttribute(`action`),r=this.getAttribute(`method`),i=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;if(!n)return{status:0,ok:!0,data:{values:t}};let a=Array.from(e.values()).some(e=>e instanceof File),o=null,s={},c=n;if(typeof window<`u`&&window.mintForm?.defaults?.headers?.common&&Object.assign(s,window.mintForm.defaults.headers.common),this._headers&&Object.assign(s,this._headers),r===`GET`){let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),c+=(n.includes(`?`)?`&`:`?`)+t.toString()}else if(i===`multipart/form-data`||a)o=e;else if(i===`application/json`)o=JSON.stringify(t),s[`Content-Type`]=`application/json`;else{let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),o=t,s[`Content-Type`]=`application/x-www-form-urlencoded`}if(typeof fetch==`function`)try{let e=await fetch(c,{method:r||`POST`,body:r===`GET`?null:o,headers:s}),t=await e.text().catch(()=>``),n=t;try{n=JSON.parse(t)}catch{}if(!e.ok){let t={status:e.status,data:n,response:{status:e.status,data:n}};throw await this._applyErrorInterceptors(t)}let i={status:e.status,ok:e.ok,data:n};return await this._applySuccessInterceptors(i)}catch(e){if(e.response)throw e;let t={status:e.status||0,data:e.data||e.message||`Network error`,response:{status:e.status||0,data:e.data||e.message||`Network error`}};throw await this._applyErrorInterceptors(t)}let l=this;return await new Promise(async(e,t)=>{let n=new XMLHttpRequest;n.open(r||`POST`,c,!0),Object.entries(s).forEach(([e,t])=>n.setRequestHeader(e,t)),n.onload=async function(){let{status:r,responseText:i}=n;if(r>=200&&r<300){let n=i;try{n=JSON.parse(i)}catch{}try{let t={status:r,ok:!0,data:n};e(await l._applySuccessInterceptors(t))}catch(e){t(e)}}else{let e=i;try{e=JSON.parse(i)}catch{}try{let n={status:r,data:e,response:{status:r,data:e}};t(await l._applyErrorInterceptors(n))}catch(e){t(e)}}},n.onerror=async function(){try{let e={status:n.status||0,data:n.responseText||`Network error`,response:{status:n.status||0,data:n.responseText||`Network error`}};t(await l._applyErrorInterceptors(e))}catch(e){t(e)}},n.send(r===`GET`?null:o)})}async _applySuccessInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return e;let t=e,n=window.mintForm.interceptors.response.handlers;for(let e of n)e.fulfilled&&(t=await e.fulfilled(t));return t}async _applyErrorInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return Promise.reject(e);let t=e,n=window.mintForm.interceptors.response.handlers;for(let e=n.length-1;e>=0;e--){let r=n[e];if(r.rejected)try{if(t=await r.rejected(t),t!==void 0)return t}catch(e){t=e}}return Promise.reject(t)}_formDataToValues(e){let t={};return e.forEach((e,n)=>{e instanceof File?(t[n]||(t[n]=[]),t[n].push(e)):n in t?Array.isArray(t[n])?(t[n].length>0&&t[n][0]instanceof File,t[n].push(e)):t[n]=[t[n],e]:t[n]=e}),this._form&&(Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n&&e.files!==void 0&&e.files){let r=e.files;if(r.length>0){let e=Array.from(r);t[n]&&Array.isArray(t[n])?e.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=e}}}),Array.from(this._form.querySelectorAll(`input[type="file"][name]`)).forEach(e=>{let n=e.name;if(n&&e.files&&e.files.length>0){let r=Array.from(e.files);t[n]&&Array.isArray(t[n])?r.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=r}}),Array.from(this._form.querySelectorAll(`mint-tags[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n){let r=[];e.tags===void 0?typeof e.getTags==`function`&&(r=e.getTags()):r=e.tags,Array.isArray(r)&&r.length>0?t[n]=r.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):t[n]=[]}})),t}_isControlDisabledForSubmit(e){let t=e;for(;t&&t!==this._form;){if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLButtonElement)&&t.disabled)return!0;let e=t.getAttribute(`disabled`);if(e!==null&&e!==`false`)return!0;t=t.parentElement}return!1}_collectLiveControlValues(){let e={};if(!this._form)return e;let t=new Set;for(let e of Array.from(this._form.querySelectorAll(`[name]`))){let n=e.getAttribute(`name`);!n||this._isControlDisabledForSubmit(e)||t.add(n)}for(let n of t){let t=this._getFieldElements(n).filter(e=>!this._isControlDisabledForSubmit(e));if(t.length!==0)try{e[n]=this._extractFieldValue(t)}catch{}}return e}_collectValidationRules(){let e={};return this._form&&Array.from(this._form.querySelectorAll(`[name][validation]`)).forEach(t=>{let n=t.getAttribute(`name`)||``,r=t.getAttribute(`validation`);if(!n||!r)return;let i=this._parseRules(r);i.length&&(e[n]=i)}),e}_parseRules(e){if(!e)return[];try{let t=e.replace(/'/g,`"`),n=JSON.parse(t);if(Array.isArray(n))return n.map(e=>String(e))}catch{}return e.split(`,`).map(e=>e.trim()).filter(Boolean)}_validate(e,t){let n=!0;return this._errors={},Object.entries(t||{}).forEach(([e,t])=>{let r=Array.isArray(t)?t:[t],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(n=!1,this._errors[e]=o,this._flagFieldError(i,o)):this._clearFieldError(i)}),n}_validateField(e){let t=this._collectValidationRules();if(!t[e])return;let n=t[e],r=Array.isArray(n)?n:[n],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(this._errors[e]=o,this._flagFieldError(i,o)):(this._clearFieldError(i),delete this._errors[e])}_validateRules(e,t){for(let n of t){let[t,r]=n.split(`:`);switch(t){case`required`:if(e==null||typeof e==`string`&&e.trim()===``||e instanceof FileList&&e.length===0||Array.isArray(e)&&e.length===0)return`This field is required.`;break;case`string`:if(typeof e!=`string`)return`Must be a string.`;break;case`email`:if(typeof e==`string`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()))return`Enter a valid email.`;break;case`number`:{let t=Number(e);if(Number.isNaN(t))return`Must be a number.`;break}case`min`:{let t=Number(r);if(Number.isNaN(t))break;if(typeof e==`string`&&e.trim().length<t)return`Must be at least ${t} characters.`;if(Array.isArray(e)&&e.length<t)return`Select at least ${t}.`;if(e instanceof FileList&&e.length<t)return`Upload at least ${t} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)<t)return`Must be at least ${t}.`;break}case`max`:{let t=Number(r);if(Number.isNaN(t))break;if(typeof e==`string`&&e.trim().length>t)return`Must be at most ${t} characters.`;if(Array.isArray(e)&&e.length>t)return`Select no more than ${t}.`;if(e instanceof FileList&&e.length>t)return`Upload no more than ${t} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)>t)return`Must be at most ${t}.`;break}default:break}}return null}_getFieldElements(e){if(!this._form)return[];let t=Array.from(this._form.querySelectorAll(`[name="${e}"]`)),n=t.filter(e=>e.tagName===`MINT-SELECT`);if(n.length>0){let r=[];return n.forEach(t=>{let n=t.querySelector(`select[name="`+e+`"]`);n&&r.push(n)}),t.filter(e=>e.tagName!==`MINT-SELECT`).concat(r)}if(t.filter(e=>e.tagName===`MINT-TAGS`).length>0)return t.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`));let r=t.filter(e=>e.tagName===`INPUT`&&e.closest(`mint-tags`));if(r.length>0){let e=[];return r.forEach(t=>{let n=t.closest(`mint-tags`);n&&!e.includes(n)&&e.push(n)}),t.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`)).concat(e)}return t}_extractFieldValue(e){if(e.length===0)return``;let t=e.find(e=>e instanceof HTMLSelectElement);if(t)return t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value;if(e.length>1){let t=e.filter(e=>e instanceof HTMLInputElement);if(t.length>0&&t.length===e.length){let e=t.filter(e=>e.checked);if(t.every(e=>e.type===`radio`))return e.length>0?e[0].value||`on`:``;if(t.every(e=>e.type===`checkbox`))return e.map(e=>e.value||`on`)}let n=e.filter(e=>e.tagName===`MINT-CHOICE`);if(n.length>0&&n.length===e.length){let e=n.find(e=>typeof e.getValue==`function`?e.getValue()!==``:e.querySelector(`mint-choice-option[checked]`)!==null);if(e){if(typeof e.getValue==`function`)return e.getValue();let t=e.querySelector(`mint-choice-option[checked]`);if(t)return t.getAttribute(`value`)||``}return``}let r=e.filter(e=>e.tagName===`MINT-CHECKBOX`);if(r.length>0&&r.length===e.length)return r.filter(e=>e.checked===void 0?e.hasAttribute(`checked`):e.checked).map(e=>e.getAttribute(`value`)||`on`)}let n=e[0];if(n instanceof HTMLInputElement)return n.type===`file`?n.files:n.type===`checkbox`||n.type===`radio`?n.checked?n.value||`on`:``:n.value;if(n instanceof HTMLTextAreaElement)return n.value;if(n.tagName===`MINT-SELECT`){let e=n.querySelector(`select`);if(e)return e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value;if(typeof n.getValue==`function`){let e=n.getValue();if(e!=null&&e!==``)return e}return n.getAttribute(`value`)||``}if(n.tagName===`MINT-DROPZONE`&&n.files!==void 0)return n.files;if(n.tagName===`MINT-TAGS`){let e=null;return n.tags===void 0?typeof n.getTags==`function`&&(e=n.getTags()):e=n.tags,Array.isArray(e)?e.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):[]}return n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`?(n.checked===void 0?n.hasAttribute(`checked`):n.checked)?n.getAttribute(`value`)||`on`:``:n.tagName===`MINT-CHOICE`?(typeof n.getValue==`function`?n.getValue():``)||``:n.value===void 0?n.getAttribute(`value`)||``:n.value}_flagFieldError(e,t){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.setAttribute(`aria-invalid`,`true`);let n=this._resolveHost(e);n&&(n.setAttribute(`error`,`true`),n.setAttribute(`error-message`,t),n.setAttribute(`data-mint-form-error`,`true`))})}_clearFieldError(e){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.removeAttribute(`aria-invalid`);let t=this._resolveHost(e);t&&(t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`))})}_clearErrors(){this.querySelectorAll(`[data-mint-form-error]`).forEach(e=>{let t=e;t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`)}),this._form&&this._form.querySelectorAll(`[aria-invalid="true"]`).forEach(e=>{e.removeAttribute(`aria-invalid`)}),this._errors={}}setFormErrors(e){this._applyServerErrors(e)}_applyServerErrors(e){this._clearErrors(),Object.entries(e).forEach(([e,t])=>{let n=Array.isArray(t)?t[0]||`Validation error`:t||`Validation error`,r=this._getFieldElements(e);r.length>0&&(this._errors[e]=n,this._flagFieldError(r,n))})}_parseFormData(e){if(!e){this._formData=null;return}if(typeof e==`object`&&!Array.isArray(e)){this._formData=e;return}if(typeof e==`string`)try{this._formData=JSON.parse(e)}catch{this._formData=null}else this._formData=null}_parseHeaders(e){if(!e){this._headers=null;return}if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_applyFormData(){if(!this._formData||!this._form)return;let e=this._getReactiveValue(this._formData);if(!e||typeof e!=`object`||Array.isArray(e))return;let t=this._extractReactiveData(e),n=this._createDataSnapshot(t),r=this._lastAppliedDataSnapshot,i=new Set;if(r?(Object.keys(n).forEach(e=>{let t=r[e],a=n[e];JSON.stringify(t)!==JSON.stringify(a)&&i.add(e)}),Object.keys(r).forEach(e=>{e in n||i.add(e)})):Object.keys(n).forEach(e=>i.add(e)),i.size===0)return;let a=()=>{i.forEach(e=>{let t=n[e],r=this._getFieldElements(e);if(r.length===0){setTimeout(()=>{let t=this._getFieldElements(e);if(t.length===0)return;let n=this._formData?this._getReactiveValue(this._formData):null;if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n[e];this._applyValueToField(t,e,r)},300);return}this._applyValueToField(r,e,t)}),this._lastAppliedDataSnapshot=n};requestAnimationFrame(()=>{requestAnimationFrame(()=>{a()})})}_applyValueToField(e,t,n){e.forEach(e=>{let r=e.tagName;try{if(r===`MINT-INPUT`)e.value!==void 0&&(e.value=n||``);else if(r===`MINT-DATE-PICKER`)typeof e.setValue==`function`&&e.setValue(n||``);else if(r===`MINT-SELECT`||r===`SELECT`)if(r===`SELECT`){let t=e,r=t.closest(`mint-select`);if(r&&typeof r.setValue==`function`)r.setValue(n);else if(t.multiple){let e=Array.isArray(n)?n.map(e=>String(e)):n==null||n===``?[]:[String(n)];Array.from(t.options).forEach(t=>{t.selected=e.includes(t.value)})}else t.value=n==null?``:String(n)}else typeof e.setValue==`function`&&e.setValue(n);else if(r===`MINT-CHOICE`)typeof e.setValue==`function`?e.setValue(n==null?``:String(n)):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=e.getAttribute(`value`)===n});else if(r===`MINT-CHECKBOX`||r===`MINT-SWITCH`){let t=n===!0||n===`true`||n===`on`||n===1||n===`1`;e.checked===void 0?t?e.setAttribute(`checked`,`true`):e.removeAttribute(`checked`):e.checked=t}else if(r===`MINT-TAGS`)if(Array.isArray(n)){let t=new Map;try{let n=e.getAttribute(`predefined-tags`);if(n){let e=JSON.parse(n);Array.isArray(e)&&(t=new Map(e.map(e=>{if(typeof e==`string`){let t=e.trim();return t?[t.toLowerCase(),t]:null}if(!e||typeof e!=`object`)return null;let t=String(e.value??``).trim();if(!t)return null;let n=String(e.label??t);return[t.toLowerCase(),n]}).filter(e=>e!==null)))}}catch{}e.tags!==void 0&&(e.tags=n.map(e=>{if(typeof e==`string`){let n=e.trim();return{value:n,label:t.get(n.toLowerCase())||n,dismissable:!0}}if(e&&typeof e==`object`){let n=String(e.value??``).trim(),r=t.get(n.toLowerCase())||String(e.label??n);return{...e,value:n,label:r,dismissable:e.dismissable!==!1}}return e}))}else e.tags!==void 0&&(e.tags=[]);else if(e instanceof HTMLInputElement){if(e.type===`file`)return;e.type===`checkbox`||e.type===`radio`?e.checked=n===!0||n===`true`||n===`on`||n===1||n===`1`:e.value=n||``}else (e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(e.value=n||``)}catch(e){console.warn(`Failed to set value for field ${t}:`,e)}})}_resetCustomFields(){this.querySelectorAll(`mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{e.removeAttribute(`error`),e.removeAttribute(`error-message`);let t=e.tagName;if(t===`MINT-INPUT`)try{e.value=``}catch{}else if(t===`MINT-DATE-PICKER`)try{e.setValue?.(``)}catch{}else if(t===`MINT-SELECT`)try{e.setValue?.(``)}catch{}else if(t===`MINT-DROPZONE`){let t=e.querySelector(`input[type="file"]`);t&&(t.value=``)}else if(t===`MINT-CHECKBOX`||t===`MINT-SWITCH`)try{if(e.checked!==void 0)e.checked=!1;else{e.removeAttribute(`checked`);let t=e.querySelector(`input[type="checkbox"], input[type="radio"]`);t&&(t.checked=!1)}}catch{}else if(t===`MINT-CHOICE`)try{typeof e.setValue==`function`?e.setValue(``):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=!1})}catch{}else if(t===`MINT-TAGS`)try{e.tags=[]}catch{}})}_resolveHost(e){if(e.tagName===`MINT-CHOICE-OPTION`){let t=e.closest(`mint-choice`);if(t)return t}return e.closest(`mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)||e}_setupBlurValidation(){if(!this._form)return;let e=e=>{let t=e.target;if(!t)return;let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);if(!r||!this._collectValidationRules()[r])return;let i=this._extractFieldValue([n]),a=i!=null&&(typeof i==`string`?i.trim()!==``:i instanceof FileList||Array.isArray(i)?i.length>0:!0),o=n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&(t.hasAttribute(`aria-invalid`)||t.closest(`[data-mint-form-error]`)),s=!!n.closest(`mint-tags`),c=n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`||n.tagName===`MINT-CHOICE`||t instanceof HTMLElement&&(t.closest(`mint-checkbox, mint-switch, mint-choice`)||t.closest(`mint-choice-option`)),l=n.tagName===`MINT-DATE-PICKER`||t instanceof HTMLElement&&t.closest(`mint-date-picker`);(a||o||s||c||l)&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`blur`,e,!0),this._fieldBlurHandlers.set(this._form,e);let t=e=>{let t=e.target;if(!t)return;if(!(t instanceof HTMLInputElement&&t.type===`file`)){let e=this._findFieldElement(t),n=e?this._getFieldName(e):null;e&&n&&this._syncFieldToReactiveData(e,n)}if(e.type===`tags-change`&&t.tagName===`MINT-TAGS`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLSelectElement||t.tagName===`MINT-SELECT`||t.closest(`mint-select`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(e.type===`choice-change`&&t.tagName===`MINT-CHOICE`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLInputElement&&t.type===`checkbox`||t.tagName===`MINT-CHECKBOX`||t.tagName===`MINT-SWITCH`||t.closest(`mint-checkbox, mint-switch`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);r&&this._collectValidationRules()[r]&&(n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&t.hasAttribute(`aria-invalid`))&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`change`,t,!0),this._form.addEventListener(`input`,t,!0),this._form.addEventListener(`tags-change`,t,!0),this._form.addEventListener(`choice-change`,t,!0),this._fieldChangeHandlers.set(this._form,t)}_findFieldElement(e){let t=e.closest(`mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`);if(t&&t.hasAttribute(`name`))return t;if(e.hasAttribute(`name`)&&(e.tagName.startsWith(`MINT-`)||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)||(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.hasAttribute(`name`))return e;let n=e;for(;n&&n!==this._form;){if(n.hasAttribute(`name`))return n;n=n.parentElement}return null}_getFieldName(e){return e.hasAttribute(`name`)||e.tagName.startsWith(`MINT-`)?e.getAttribute(`name`):(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.name||null}_syncFieldToReactiveData(e,t){if(!this._formData||!t)return;let n=this._getReactiveValue(this._formData);if(!n||typeof n!=`object`||Array.isArray(n))return;let r=this._getFieldElements(t),i=this._extractFieldValue(r.length?r:[e]);n[t]=this._normalizeReactiveValue(r,i),this._lastDataSnapshot=this._createDataSnapshot(n)}_normalizeReactiveValue(e,t){if(t instanceof FileList)return Array.from(t);if(Array.isArray(t))return t;let n=e[0];return e.length===1&&(n instanceof HTMLInputElement&&n.type===`checkbox`||n?.tagName===`MINT-CHECKBOX`||n?.tagName===`MINT-SWITCH`)?!!t:t??``}_cleanupBlurValidation(){if(this._form&&this._fieldBlurHandlers.has(this._form)){let e=this._fieldBlurHandlers.get(this._form);e&&this._form.removeEventListener(`blur`,e,!0),this._fieldBlurHandlers.delete(this._form)}if(this._form&&this._fieldChangeHandlers.has(this._form)){let e=this._fieldChangeHandlers.get(this._form);e&&(this._form.removeEventListener(`change`,e,!0),this._form.removeEventListener(`input`,e,!0),this._form.removeEventListener(`tags-change`,e,!0),this._form.removeEventListener(`choice-change`,e,!0)),this._fieldChangeHandlers.delete(this._form)}this._observer&&=(this._observer.disconnect(),null)}_syncDropzoneFiles(){this._form&&Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{typeof e.syncFiles==`function`&&e.syncFiles()})}_isSubmittingAttrActive(){let e=this.getAttribute(`submitting`);return e!==null&&e!==`false`}_applySubmittingAttributeState(){if(this._form){if(!this._isSubmittingAttrActive()){this._restoreSubmittingAttributeState();return}this._attrSubmittingMintFields.size>0||this._attrSubmittingNativeFields.size>0||this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0||(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`;this._attrSubmittingMintFields.set(e,t),t||e.setAttribute(`disabled`,`true`),typeof e.render==`function`&&e.render()}),this._form.querySelectorAll(`input, textarea, select`).forEach(e=>{if(e.closest(`mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags, mint-button`)||e instanceof HTMLInputElement&&e.type===`hidden`)return;let t=e.disabled;this._attrSubmittingNativeFields.set(e,t),t||(e.disabled=!0)}),Array.from(this.querySelectorAll(`mint-button`)).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._attrSubmittingMintButtons.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&!n&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),Array.from(this.querySelectorAll(`button`)).forEach(e=>{if(e.closest(`mint-button, mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`))return;let t=e.disabled;this._attrSubmittingNativeButtons.set(e,t),t||(e.disabled=!0)}))}}_restoreSubmittingAttributeState(){this._attrSubmittingMintFields.forEach((e,t)=>{e?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintFields.clear(),this._attrSubmittingNativeFields.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeFields.clear(),this._attrSubmittingMintButtons.forEach((e,t)=>{e.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),e.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintButtons.clear(),this._attrSubmittingNativeButtons.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeButtons.clear()}_propagateLoadingState(){if(!this._form)return;let e=this.getAttribute(`loading`),t=e!==null&&e!==`false`;Array.from(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)).forEach(e=>{t?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`),typeof e.render==`function`&&e.render()})}_setButtonsSubmitting(){if(!this._form)return;this._buttonStates.clear();let e=Array.from(this.querySelectorAll(`mint-button`)),t=Array.from(this.querySelectorAll(`button`));e.forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._buttonStates.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),t.forEach(e=>{if(e.closest(`mint-button`))return;let t=e.disabled;this._buttonStates.set(e,{disabled:t,loading:!1}),t||(e.disabled=!0)})}_restoreButtonsState(){if(!this._form)return;let e=this._isSubmittingAttrActive()&&(this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0),t=Array.from(this.querySelectorAll(`mint-button`)),n=Array.from(this.querySelectorAll(`button`));t.forEach(t=>{if(e&&this._attrSubmittingMintButtons.has(t))return;let n=this._buttonStates.get(t);n&&(n.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),n.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render())}),n.forEach(t=>{if(t.closest(`mint-button`)||e&&this._attrSubmittingNativeButtons.has(t))return;let n=this._buttonStates.get(t);n&&(t.disabled=n.disabled)}),this._buttonStates.clear()}_isReactiveObject(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;if(`__v_isRef`in e||`_value`in e||`__v_raw`in e||`__v_isReactive`in e||`__ob__`in e)return!0;try{let t=e.toString();if(t===`[object Object]`||t.includes(`Proxy`)){let t=Object.keys(e)[0];if(t){let n=Object.getOwnPropertyDescriptor(e,t);if(n&&(n.get||n.set))return!0}}}catch{return!0}return!0}_createDataSnapshot(e){try{let t=this._extractReactiveData(e);return JSON.parse(JSON.stringify(t))}catch{return{...this._extractReactiveData(e)}}}_extractReactiveData(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>this._extractReactiveData(e));let t=this._getReactiveValue(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=this._extractReactiveData(t[n]));return e}return t}_hasDataChanged(e,t){try{return JSON.stringify(e)!==JSON.stringify(t)}catch{return!0}}_getReactiveValue(e){if(!e||typeof e!=`object`)return e;if(`_value`in e||`__v_isRef`in e){if(e.value!==void 0)return e.value;if(`_value`in e)return e._value}return`__v_raw`in e||`__v_isReactive`in e||`__ob__`in e,e}_setupReactiveDataObserver(e){if(this._stopReactiveDataObserver(),!this.isConnected)return;let t=this._getReactiveValue(e);if(t&&typeof t==`object`&&!Array.isArray(t))this._lastDataSnapshot=this._createDataSnapshot(t);else{this._lastDataSnapshot=null;return}let n=()=>{if(!this._formData||!this._lastDataSnapshot){this._stopReactiveDataObserver();return}let e=this._getReactiveValue(this._formData);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=this._createDataSnapshot(e);this._hasDataChanged(t,this._lastDataSnapshot)&&(this._lastDataSnapshot=t,requestAnimationFrame(()=>{this._applyFormData()}))}this.isConnected&&this._formData?this._reactiveDataObserver=requestAnimationFrame(n):this._stopReactiveDataObserver()};this._reactiveDataObserver=requestAnimationFrame(n)}_stopReactiveDataObserver(){this._reactiveDataObserver!==null&&(cancelAnimationFrame(this._reactiveDataObserver),this._reactiveDataObserver=null),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null}};customElements.get(`mint-form`)||customElements.define(`mint-form`,O),typeof window<`u`&&(window.mintForm=window.mintForm||{defaults:{headers:{common:{}}},interceptors:{response:{handlers:[]}}},window.mintForm.interceptors.response.use||(window.mintForm.interceptors.response.use=function(e,t){return window.mintForm.interceptors.response.handlers.push({fulfilled:e,rejected:t}),window.mintForm.interceptors.response.handlers.length-1}));var k=class extends HTMLElement{constructor(...e){super(...e),this._observer=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`align-baseline`,`block`,`w-full`,`rounded-lg`,`border`,`border-gray-200`,`dark:border-mint-divider`),this.hasAttribute(`data-mint-rt-scroll-inner`)?this.classList.add(`min-w-0`,`overflow-x-visible`,`overflow-y-visible`):this.classList.add(`min-w-0`,`overflow-x-auto`),this._observeChanges(),this._applyStyles(),requestAnimationFrame(()=>{this._applyStyles(),setTimeout(()=>this._applyStyles(),0)})}disconnectedCallback(){this._observer&&=(this._observer.disconnect(),null)}_observeChanges(){this._observer=new MutationObserver(()=>this._applyStyles()),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!1})}_applyStyles(){this._observer&&this._observer.disconnect();let e=Array.from(this.querySelectorAll(`table`));if(e.length===0){this._observer&&this._observeChanges();return}let t=e.find(e=>e.querySelector(`thead`))??e[0],n=e.find(e=>e.querySelector(`tbody`))??e[0];e.forEach(e=>{let t=!!e.closest(`[id^="mint-rt-vscroll-"]`),n=!!e.closest(`mint-resource-table[data-mint-rt-fixed-header]`),r=t||n,i=[`w-full`,r?`border-separate border-spacing-0`:`border-collapse`,`text-sm`,`font-medium`,...r?[]:[`overflow-hidden`]];this._setClasses(e,i)});let r=t.querySelector(`thead`);if(r){r.classList.add(`bg-[#F7F7F7]`,`dark:bg-mint-nav`);let e=r.querySelectorAll(`th`);e.forEach((t,n)=>{let r=t.querySelector(`mint-icon`),i=r?.getAttribute(`name`)||``,a=t.hasAttribute(`data-mint-rt-sortable`)||r!==null&&i!==`ellipsis`;this._setClasses(t,[`text-left`,`font-semibold`,`text-gray-900`,`dark:text-white`,`px-3`,`py-2`,`border-b`,`border-gray-200`,`dark:border-mint-divider`,`bg-[#F7F7F7]`,`dark:bg-mint-nav`]),a&&t.classList.add(`cursor-pointer`,`hover:bg-gray-100`,`dark:hover:bg-mint-hover`),n===0&&t.classList.add(`pl-3`),n===e.length-1&&t.classList.add(`pr-3`);let o=t.closest(`table`),s=o?.closest(`mint-resource-table`),c=!!s?.hasAttribute(`data-mint-rt-fixed-header`),l=!!s?.hasAttribute(`data-mint-rt-fixed-controls`);if(o?.closest(`[id^="mint-rt-vscroll-"]`)||c){let e=c&&l?`top-[var(--mint-rt-fixed-controls-h,0px)]`:`top-0`;t.classList.add(`sticky`,e,`z-30`,`bg-[#F7F7F7]`,`dark:bg-mint-nav`,`shadow-sm`)}})}let i=n.querySelector(`tbody`);if(i){let e=Array.from(i.querySelectorAll(`tr`)),t=!!n.closest(`[id^="mint-rt-vscroll-"]`)||!!n.closest(`mint-resource-table`)?.hasAttribute(`data-mint-rt-fixed-header`),r=e.findIndex(e=>e.getAttribute(`data-mint-rt-spacer`)===`bottom`);e.forEach((n,i)=>{let a=n.hasAttribute(`data-mint-rt-spacer`),o=n.hasAttribute(`data-row-clickable`);a||t?this._setClasses(n,[`bg-white`,`dark:bg-mint-canvas`]):this._setClasses(n,[`bg-white`,`dark:bg-mint-canvas`,`border-b`,`border-gray-200`,`dark:border-mint-divider`]),o&&!a&&n.classList.add(`cursor-pointer`,`hover:bg-gray-50`,`dark:hover:bg-mint-elevated`),!t&&i===e.length-1&&n.classList.remove(`border-b`);let s=n.querySelectorAll(`td`);s.forEach((o,c)=>{let l=[`text-gray-900`,`dark:text-gray-100`,`px-3`,`py-2`];if(t&&!a){let t=n.hasAttribute(`data-mint-rt-last-row`),a=r===-1&&i===e.length-1;!t&&!a&&l.push(`border-b`,`border-gray-200`,`dark:border-mint-divider`)}this._setClasses(o,l),c===0&&o.classList.add(`pl-3`),c===s.length-1&&o.classList.add(`pr-3`),this._restoreCell(o)})})}let a=n.querySelector(`tfoot`);a&&(this._setClasses(a,[`bg-[#F7F7F7]`,`dark:bg-mint-nav`,`font-semibold`]),a.querySelectorAll(`td`).forEach(e=>{this._setClasses(e,[`text-gray-900`,`dark:text-gray-100`,`px-3`,`py-2`,`border-t`,`border-gray-200`,`dark:border-mint-divider`]),this._restoreCell(e)})),this._observer&&this._observeChanges()}_restoreCell(e){if(e.dataset.mtProcessed!==`true`)return;let t={};Array.from(e.attributes).forEach(e=>{e.name.startsWith(`data-`)&&e.name!==`data-original`&&e.name!==`data-mt-processed`&&(t[e.name]=e.value)});let n=e.getAttribute(`data-original`)||``;e.dataset.mtProcessed=``,e.innerHTML=n,Object.entries(t).forEach(([t,n])=>{e.setAttribute(t,n)})}_setClasses(e,t){e.className=``,t.filter(Boolean).forEach(t=>e.classList.add(...t.split(` `)))}};customElements.get(`mint-table`)||customElements.define(`mint-table`,k);var A=class extends HTMLElement{constructor(...e){super(...e),this._root=null,this._textWrap=null,this._dismissBtn=null,this._clickHandler=null}static get observedAttributes(){return[`dismissable`]}connectedCallback(){this._render()}disconnectedCallback(){this._dismissBtn&&this._clickHandler&&this._dismissBtn.removeEventListener(`click`,this._clickHandler)}attributeChangedCallback(){this._render()}_render(){if(this.classList.add(`inline-flex`,`items-center`,`gap-2`,`px-3`,`py-1`,`rounded-full`,`border`,`border-gray-200`,`dark:border-mint-divider`,`bg-gray-100`,`dark:bg-mint-elevated`,`text-gray-900`,`dark:text-gray-100`,`text-sm`,`font-medium`),!this._root){for(this._root=document.createElement(`div`),this._root.className=`flex items-center gap-2 w-full`,this._textWrap=document.createElement(`span`),this._textWrap.className=`inline-flex items-center min-w-[0.5rem]`,this._textWrap.setAttribute(`data-mt-chip-text`,``);this.firstChild;){let e=this.firstChild;if(e===this._root)break;this._textWrap.appendChild(e)}this._root.appendChild(this._textWrap),this.appendChild(this._root)}let e=this.getAttribute(`dismissable`);e===``||e===`true`||this.hasAttribute(`dismissable`)?(this._dismissBtn||this._createDismissBtn(),this._dismissBtn&&!this._dismissBtn.isConnected&&this._root?.appendChild(this._dismissBtn)):this._dismissBtn&&this._dismissBtn.parentElement===this._root&&this._dismissBtn.remove()}_createDismissBtn(){let e=document.createElement(`button`);e.type=`button`,e.setAttribute(`aria-label`,`Dismiss`),e.className=[`shrink-0`,`inline-flex`,`items-center`,`justify-center`,`w-5`,`h-5`,`rounded-full`,`text-gray-500`,`dark:text-gray-300`,`hover:text-gray-700`,`dark:hover:text-gray-100`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`border-none`,`bg-transparent`,`cursor-pointer`].join(` `);let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`close`),t.className=`w-3 h-3`,e.appendChild(t),this._clickHandler=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismiss`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},e.addEventListener(`click`,this._clickHandler),this._dismissBtn=e}};customElements.get(`mint-chip`)||customElements.define(`mint-chip`,A);var j=class extends HTMLElement{constructor(...e){super(...e),this._container=null,this._chipsWrap=null,this._input=null,this._tags=[],this._predefinedTags=[],this._placeholder=`Add tag`,this._predefinedPopoverOpenListenersAttached=!1,this._predefinedBlurCloseTimer=null,this._suppressNextPredefinedBlurClose=!1,this._dragIndex=null,this._dragChip=null,this._isPointerDragging=!1,this._pointerMoveHandler=null,this._pointerUpHandler=null,this._containerFocusRingListeners=!1,this._predefinedFieldResizeObserver=null,this._predefinedPopoverBodyEl=null}static get observedAttributes(){return[`tags`,`placeholder`,`predefined-tags`,`predefined-only`,`sortable`,`label`,`info`,`error`,`error-message`,`name`,`id`,`required`,`loading`]}connectedCallback(){this._parseAttrs(),this._render(),this._pointerMoveHandler||(this._pointerMoveHandler=e=>this._onPointerMove(e),window.addEventListener(`pointermove`,this._pointerMoveHandler)),this._pointerUpHandler||(this._pointerUpHandler=e=>this._onPointerUp(e),window.addEventListener(`pointerup`,this._pointerUpHandler),window.addEventListener(`pointercancel`,this._pointerUpHandler))}disconnectedCallback(){this._disconnectPredefinedFieldResizeObserver()}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){if(this._renderErrorState(),this._container){let e=this.hasError(),t=[`flex`,`flex-wrap`,`items-center`,`gap-2`,`w-full`,`px-2`,`py-1.5`,`min-h-[2rem]`,`rounded-lg`,`border-2`,e?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`,`bg-white`,`dark:bg-mint-elevated`,...this._containerRingClasses(e)];this._container.className=t.join(` `)}return}if(e===`loading`){this._parseAttrs(),this._render();return}this._parseAttrs(),this._render()}}set tags(e){this._tags=Array.isArray(e)?[...e]:[],this._syncAttr(),this._render()}get tags(){return[...this._tags]}_parseAttrs(){let e=this.getAttribute(`tags`);e&&(this._tags=this._parseTagItems(e,`tags`));let t=this.getAttribute(`placeholder`);t!==null&&(this._placeholder=t);let n=this.getAttribute(`predefined-tags`);this._predefinedTags=this._parseTagItems(n,`predefined-tags`)}_parseTagItems(e,t){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(e=>{if(typeof e==`string`){let t=e.trim();return t?{value:t,label:t,dismissable:!0}:null}if(!e||typeof e!=`object`)return null;let t=e,n=String(t.value??``).trim();return n?{value:n,label:String(t.label??n),dismissable:t.dismissable!==!1}:null}).filter(e=>e!==null):[]}catch(e){return console.warn(`mint-tags: failed to parse ${t} attribute`,e),[]}}_syncAttr(){this.setAttribute(`tags`,JSON.stringify(this._tags))}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}hasError(){return this.getAttribute(`error`)===`true`}_containerRingClasses(e){return e?[`focus-within:ring-2`,`focus-within:ring-offset-1`,`focus-within:ring-red-400`,`dark:focus-within:ring-red-500`,`data-[mint-tags-active=true]:ring-2`,`data-[mint-tags-active=true]:ring-offset-1`,`data-[mint-tags-active=true]:ring-red-400`,`dark:data-[mint-tags-active=true]:ring-red-500`]:[`focus-within:ring-2`,`focus-within:ring-offset-1`,`focus-within:ring-gray-400`,`dark:focus-within:ring-gray-500`,`data-[mint-tags-active=true]:ring-2`,`data-[mint-tags-active=true]:ring-offset-1`,`data-[mint-tags-active=true]:ring-gray-400`,`dark:data-[mint-tags-active=true]:ring-gray-500`]}_attachContainerFocusRingListeners(){!this._container||this._containerFocusRingListeners||(this._containerFocusRingListeners=!0,this._container.addEventListener(`focusin`,()=>{this._container?.setAttribute(`data-mint-tags-active`,`true`)}),this._container.addEventListener(`focusout`,()=>{requestAnimationFrame(()=>{this._container&&(this._container.contains(document.activeElement)||this._container.removeAttribute(`data-mint-tags-active`))})}))}getErrorMessage(){return this.getAttribute(`error-message`)||``}getName(){return this.getAttribute(`name`)||``}getId(){return this.getAttribute(`id`)||``}isRequired(){return this.getAttribute(`required`)===`true`}isLoading(){return this.hasAttribute(`loading`)}isPredefinedOnly(){return this.getAttribute(`predefined-only`)===`true`}_render(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`);let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.hasError(),i=this.getId()||`mint-tags-${Math.random().toString(36).substr(2,9)}`;if(this.getId()||this.setAttribute(`id`,i),this._container)this._input&&(this._input.placeholder=this._placeholder);else{this._container=document.createElement(`div`);let e=[`flex`,`flex-wrap`,`items-center`,`gap-2`,`w-full`,`px-2`,`py-1`,`min-h-[2rem]`,`rounded-lg`,`border-2`,r?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`,`bg-white`,`dark:bg-mint-elevated`,...this._containerRingClasses(r)];this._container.className=e.join(` `),this._container.addEventListener(`pointerdown`,e=>this._onContainerPointerDown(e)),this._attachContainerFocusRingListeners(),this._chipsWrap=document.createElement(`div`),this._chipsWrap.className=`flex flex-wrap items-center gap-2`,this._chipsWrap.addEventListener(`dragover`,e=>{this.hasAttribute(`sortable`)&&e.preventDefault()}),this._chipsWrap.addEventListener(`drop`,e=>{this.hasAttribute(`sortable`)&&e.preventDefault()}),this._input=document.createElement(`input`),this._input.type=`text`,this._input.placeholder=this._placeholder,this._input.className=[`min-w-[6rem]`,`flex-1`,`bg-transparent`,`border-none`,`outline-none`,`text-sm`,`text-gray-900`,`dark:text-gray-100`,`placeholder:text-gray-400`,`dark:placeholder:text-gray-500`,`p-1.5`].join(` `),this._input.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this._addFromInput())}),this._container.appendChild(this._chipsWrap),this.appendChild(this._container)}if(this._input&&(this.isPredefinedOnly()&&this._predefinedTags.length>0?this._input.setAttribute(`readonly`,`true`):this._input.removeAttribute(`readonly`)),this._container){let e=[`flex`,`flex-wrap`,`items-center`,`gap-2`,`w-full`,`px-2`,`py-1`,`min-h-[2rem]`,`rounded-lg`,`border-2`,r?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`,`bg-white`,`dark:bg-mint-elevated`,...this._containerRingClasses(r)];this._container.className=e.join(` `)}let a=this.querySelector(`.mint-tags-label-container`);if(t){a||(a=document.createElement(`div`),a.className=`mint-tags-label-container mb-[.25rem]`,this._container&&this._container.parentElement===this?this.insertBefore(a,this._container):this.insertBefore(a,this.firstChild));let e=a.querySelector(`.mint-tags-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-tags-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,a.appendChild(e)),e.textContent=t,e.setAttribute(`for`,i)):e&&e.remove()}else a&&a.remove();let o=this.querySelector(`.mint-tags-info`);n?(o||(o=document.createElement(`span`),o.className=`mint-tags-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block`,this._container&&this._container.parentElement===this?this.insertBefore(o,this._container.nextSibling):this.appendChild(o)),o.textContent=n):o&&o.remove();let s=this.getName();s?(this.setAttribute(`name`,s),this._input&&(this._input.name=s,this._input.id=i)):(this.removeAttribute(`name`),this._input&&(this._input.removeAttribute(`name`),this._input.id=i)),this._wireInputBackspace(),this._renderChips(),this._renderPredefinedPopover(),this._renderErrorState(),this._renderSkeleton(e)}_getAvailablePredefinedTags(){let e=new Set(this._tags.map(e=>e.value.toLowerCase()));return this._predefinedTags.filter(t=>!e.has(t.value.toLowerCase()))}_shouldShowInput(){return this._input?!this.isPredefinedOnly()||!this._predefinedTags.length?!0:this._getAvailablePredefinedTags().length>0:!1}_disconnectPredefinedFieldResizeObserver(){this._predefinedFieldResizeObserver&&=(this._predefinedFieldResizeObserver.disconnect(),null),this._predefinedPopoverBodyEl=null}_syncPredefinedPopoverBodyMinWidth(e){if(!this._container)return;let t=this._container.offsetWidth;t>0?e.style.minWidth=`${Math.max(t,200)}px`:e.style.minWidth=`12rem`}_attachPredefinedFieldResizeObserver(e){if(this._disconnectPredefinedFieldResizeObserver(),!this._container||typeof ResizeObserver>`u`){this._syncPredefinedPopoverBodyMinWidth(e);return}this._predefinedPopoverBodyEl=e,this._predefinedFieldResizeObserver=new ResizeObserver(()=>{!this._predefinedPopoverBodyEl||!this._container||this._syncPredefinedPopoverBodyMinWidth(this._predefinedPopoverBodyEl)}),this._predefinedFieldResizeObserver.observe(this._container),this._syncPredefinedPopoverBodyMinWidth(e)}_renderPredefinedPopover(){if(!this._container||!this._chipsWrap||(this._disconnectPredefinedFieldResizeObserver(),this.querySelectorAll(`[data-mint-tags-predefined="true"]`).forEach(e=>e.remove()),!this._predefinedTags.length)||!this._input||!this._input.id)return;let e=this._getAvailablePredefinedTags();if(this.isPredefinedOnly()&&e.length===0)return;let t=`${this.getAttribute(`id`)||this._input.id}-tags-field`;this._container.id=t;let n=document.createElement(`mint-popover`);n.setAttribute(`trigger-id`,t),n.setAttribute(`trigger-toggle`,`false`),n.setAttribute(`trigger-align`,`start`),n.setAttribute(`direction`,`down`),n.setAttribute(`padding`,`0`),n.setAttribute(`distance`,`6px`),n.dataset.mintTagsPredefined=`true`;let r=document.createElement(`div`);if(r.dataset.mintTagsPredefinedBody=`true`,r.className=`box-border flex w-full min-w-0 flex-col gap-0.5 bg-white p-1 dark:bg-mint-elevated`,r.addEventListener(`mousedown`,e=>{e.preventDefault()}),e.length)e.forEach(e=>{let t=document.createElement(`mint-button`);t.setAttribute(`type`,`button`),t.setAttribute(`variant`,`ghost`),t.setAttribute(`full-width`,`true`),t.setAttribute(`align`,`left`),t.className=`w-full justify-start`,t.textContent=e.label||e.value,t.addEventListener(`mousedown`,e=>{e.preventDefault()},!0),t.addEventListener(`click`,()=>{this._addTag(e),n.removeAttribute(`open`),requestAnimationFrame(()=>{this._input?.focus({preventScroll:!0}),this._container?.setAttribute(`data-mint-tags-active`,`true`)})}),r.appendChild(t)});else{let e=document.createElement(`div`);e.className=`px-2 py-1 text-xs text-gray-500 dark:text-gray-400`,e.textContent=`No tags available`,r.appendChild(e)}n.appendChild(r),this._container.appendChild(n),this._attachPredefinedPopoverOpenOnInputFocus(),this._attachPredefinedFieldResizeObserver(r)}_getPredefinedPopoverEl(){return this.querySelector(`mint-popover[data-mint-tags-predefined="true"]`)}_attachPredefinedPopoverOpenOnInputFocus(){!this._input||!this._predefinedTags.length||this._predefinedPopoverOpenListenersAttached||(this._predefinedPopoverOpenListenersAttached=!0,this._input.addEventListener(`focus`,()=>{if(this._predefinedBlurCloseTimer!==null&&(window.clearTimeout(this._predefinedBlurCloseTimer),this._predefinedBlurCloseTimer=null),this.isLoading())return;let e=this._getPredefinedPopoverEl();e&&e.setAttribute(`open`,`true`)}),this._input.addEventListener(`blur`,()=>{this._predefinedBlurCloseTimer!==null&&window.clearTimeout(this._predefinedBlurCloseTimer),this._predefinedBlurCloseTimer=window.setTimeout(()=>{if(this._predefinedBlurCloseTimer=null,this._suppressNextPredefinedBlurClose){this._suppressNextPredefinedBlurClose=!1;return}this._getPredefinedPopoverEl()?.removeAttribute(`open`)},150)}))}_renderSkeleton(e){let t=this._container;if(!t)return;t.classList.contains(`relative`)||t.classList.add(`relative`);let n=t.querySelector(`.mint-tags-skeleton`);e?(n||(n=document.createElement(`div`),n.className=`mint-tags-skeleton absolute inset-0 z-10 pointer-events-none rounded-lg bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(n)),n.style.display=`block`,this._chipsWrap&&(this._chipsWrap.style.visibility=`hidden`,this._chipsWrap.style.pointerEvents=`none`),this._input&&(this._input.style.visibility=`hidden`,this._input.style.pointerEvents=`none`)):(n&&(n.style.display=`none`),this._chipsWrap&&(this._chipsWrap.style.visibility=`visible`,this._chipsWrap.style.pointerEvents=`auto`),this._input&&(this._input.style.visibility=`visible`,this._input.style.pointerEvents=`auto`))}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-tags-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-tags-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_renderChips(){if(!this._chipsWrap)return;this._chipsWrap.innerHTML=``;let e=0;this._tags.forEach(t=>{let n=document.createElement(`mint-chip`);n.dataset.index=String(e++),n.dataset.value=t.value,n.draggable=this.hasAttribute(`sortable`),n.draggable&&n.classList.add(`cursor-move`),t.dismissable&&(n.setAttribute(`dismissable`,`true`),n.addEventListener(`dismissed`,()=>this._removeTag(t.value))),this._chipsWrap.appendChild(n);let r=n.querySelector(`[data-mt-chip-text]`);r&&(r.textContent=t.label||t.value),this._setupChipEvents(n,t),n.draggable&&(n.addEventListener(`dragstart`,e=>this._onDragStart(e,n)),n.addEventListener(`dragover`,e=>this._onDragOverChip(e,n)),n.addEventListener(`drop`,e=>this._onDrop(e)),n.addEventListener(`dragend`,()=>this._onDragEnd())),this.hasAttribute(`sortable`)&&n.addEventListener(`pointerdown`,e=>this._onPointerDown(e,n))}),this._input&&this._shouldShowInput()&&(this.hasAttribute(`sortable`)&&(this._input.addEventListener(`dragover`,e=>this._onDragOverInput(e)),this._input.addEventListener(`drop`,e=>this._onDrop(e)),this._input.addEventListener(`dragend`,()=>this._onDragEnd())),this._chipsWrap.appendChild(this._input))}_addFromInput(){if(!this._input)return;let e=this._input.value.trim();if(!e)return;if(this._tags.some(t=>t.value.toLowerCase()===e.toLowerCase())){this._input.value=``;return}let t=this._predefinedTags.find(t=>t.value.toLowerCase()===e.toLowerCase());if(this.isPredefinedOnly()){if(!t){this._input.value=``;return}this._addTag(t)}else this._addTag(t||{value:e,label:e,dismissable:!0});this._input.value=``,setTimeout(()=>{this._input?.focus()},10)}_addTag(e){this._tags.some(t=>t.value.toLowerCase()===e.value.toLowerCase())||(this._tags.push({value:e.value,label:e.label||e.value,dismissable:e.dismissable!==!1}),this._syncAttr(),this._renderChips(),this._renderPredefinedPopover(),this._emitChange())}_removeTag(e){this._tags=this._tags.filter(t=>t.value!==e),this._syncAttr(),this._renderChips(),this._renderPredefinedPopover(),this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent(`tags-change`,{bubbles:!0,composed:!0,detail:{tags:this.tags}}))}_focusLastChip(){let e=this._chipsWrap?.querySelectorAll(`mint-chip`);e&&e.length>0&&e[e.length-1].focus({preventScroll:!0})}_focusInput(){setTimeout(()=>{this._input?.focus({preventScroll:!0})},10)}_wireInputBackspace(){this._input&&this._input.addEventListener(`keydown`,e=>{e.key===`Backspace`&&this._input?.value===``&&(e.preventDefault(),this._focusLastChip())})}_setupChipEvents(e,t){e.tabIndex=0,e.addEventListener(`keydown`,e=>{(e.key===`Backspace`||e.key===`Delete`)&&t.dismissable&&(e.preventDefault(),this._removeTag(t.value),this._focusInput())})}_onContainerPointerDown(e){if(!this._input||!this._input.isConnected||this._input.parentElement!==this._chipsWrap||e.button!==0||e.defaultPrevented)return;let t=e.composedPath();if(!t.some(e=>e===this._input)&&!t.some(e=>e instanceof Element&&e.closest(`mint-chip`)!=null)){this._predefinedBlurCloseTimer!==null&&(window.clearTimeout(this._predefinedBlurCloseTimer),this._predefinedBlurCloseTimer=null),this._suppressNextPredefinedBlurClose=!0,e.preventDefault();try{this._input.focus({preventScroll:!0})}catch{}this._predefinedTags.length>0&&this._getPredefinedPopoverEl()?.setAttribute(`open`,`true`)}}_onDragStart(e,t){this.hasAttribute(`sortable`)&&(this._dragChip=t,this._dragIndex=Number(t.dataset.index),e.dataTransfer?.setData(`text/plain`,t.dataset.index||``),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`),t.classList.add(`opacity-60`))}_reorderTags(e,t){if(e<0||t<0||e>=this._tags.length||t>=this._tags.length)return;let n=[...this._tags],[r]=n.splice(e,1);n.splice(t,0,r),this._tags=n,this._syncAttr(),this._renderChips(),this._emitChange()}_onDragOverInput(e){this.hasAttribute(`sortable`)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),this._dragChip&&this._chipsWrap&&this._input&&this._chipsWrap.insertBefore(this._dragChip,this._input))}_onDragOverChip(e,t){if(!this.hasAttribute(`sortable`)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),!this._dragChip||!this._chipsWrap)||t===this._dragChip)return;let n=t.getBoundingClientRect();if(e.clientX<n.left+n.width*.5){if(this._dragChip.nextSibling===t)return;this._chipsWrap.insertBefore(this._dragChip,t)}else{if(t.nextSibling===this._dragChip)return;let e=t.nextSibling;e?this._chipsWrap.insertBefore(this._dragChip,e):this._chipsWrap.appendChild(this._dragChip)}}_onDrop(e){this.hasAttribute(`sortable`)&&e.preventDefault()}_onDragEnd(){this._dragChip&&this._dragChip.classList.remove(`opacity-60`),this._syncOrderFromDom(),this._dragChip=null,this._dragIndex=null}_syncOrderFromDom(){if(!this._chipsWrap)return;let e=Array.from(this._chipsWrap.querySelectorAll(`mint-chip`));if(e.length===0)return;let t=[];e.forEach(e=>{let n=e.dataset.value;if(!n)return;let r=this._tags.find(e=>e.value===n);r&&t.push(r)}),t.length===this._tags.length&&(this._tags=t,this._syncAttr(),this._renderChips(),this._emitChange())}_onPointerDown(e,t){if(this.hasAttribute(`sortable`)&&e.pointerType!==`mouse`){this._isPointerDragging=!0,this._dragChip=t,this._dragIndex=Number(t.dataset.index);try{t.setPointerCapture(e.pointerId)}catch{}t.classList.add(`opacity-60`,`select-none`),e.preventDefault()}}_onPointerMove(e){if(!this._isPointerDragging||!this._dragChip||!this._chipsWrap||e.pointerType===`mouse`)return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return;let n=t.closest(`mint-chip`);if(n&&n!==this._dragChip){let t=n.getBoundingClientRect();if(e.clientX<t.left+t.width*.5)this._dragChip.nextSibling!==n&&this._chipsWrap.insertBefore(this._dragChip,n);else if(n.nextSibling!==this._dragChip){let e=n.nextSibling;e?this._chipsWrap.insertBefore(this._dragChip,e):this._chipsWrap.appendChild(this._dragChip)}return}this._input&&t.closest(`input`)===this._input&&this._chipsWrap.insertBefore(this._dragChip,this._input)}_onPointerUp(e){if(this._isPointerDragging){if(this._isPointerDragging=!1,this._dragChip){try{this._dragChip.releasePointerCapture(e.pointerId)}catch{}this._dragChip.classList.remove(`opacity-60`,`select-none`)}this._syncOrderFromDom(),this._dragChip=null,this._dragIndex=null}}};customElements.get(`mint-tags`)||customElements.define(`mint-tags`,j);var ee=class extends HTMLElement{constructor(...e){super(...e),this._clickHandler=null,this._keydownHandler=null}connectedCallback(){this._render(),this._setupEventListeners()}disconnectedCallback(){this._cleanupEventListeners()}_render(){this.classList.add(`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`rounded`),this.getAttribute(`disabled`)===`true`?this.classList.add(`cursor-not-allowed`,`opacity-50`):this.classList.add(`cursor-pointer`),this.getAttribute(`role`)||this.setAttribute(`role`,`button`),this.getAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`)}_setupEventListeners(){this._clickHandler=e=>{if(this.getAttribute(`disabled`)===`true`){e.preventDefault(),e.stopPropagation();return}this._handleClick(e)},this._keydownHandler=e=>{if(e.key===`Enter`||e.key===` `){if(this.getAttribute(`disabled`)===`true`){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),this._handleClick(e)}},this.addEventListener(`click`,this._clickHandler),this.addEventListener(`keydown`,this._keydownHandler)}_cleanupEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null),this._keydownHandler&&=(this.removeEventListener(`keydown`,this._keydownHandler),null)}_handleClick(e){this.dispatchEvent(new CustomEvent(`clickable-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}static get observedAttributes(){return[`disabled`]}attributeChangedCallback(e,t,n){e===`disabled`&&(n===`true`?(this.classList.remove(`cursor-pointer`),this.classList.add(`opacity-50`,`cursor-not-allowed`),this.setAttribute(`aria-disabled`,`true`)):(this.classList.remove(`opacity-50`,`cursor-not-allowed`),this.classList.add(`cursor-pointer`),this.removeAttribute(`aria-disabled`)))}};customElements.get(`mint-clickable`)||customElements.define(`mint-clickable`,ee);var M=class extends HTMLElement{static get observedAttributes(){return[`heading`,`dismissable`,`tone`]}constructor(){super(),this._headingElement=null,this._iconElement=null,this._dismissButton=null,this._headerWrapper=null,this._bodyWrapper=null,this._dismissHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render()}disconnectedCallback(){this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler)}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getTone(){let e=this.getAttribute(`tone`);return e===`info`||e===`success`||e===`warning`||e===`danger`?e:`info`}isDismissable(){return this.getAttribute(`dismissable`)===`true`}getIconName(){switch(this.getTone()){case`info`:return`info`;case`success`:return`success`;case`warning`:return`warning`;case`danger`:return`error`;default:return`info`}}getIconColorClasses(){switch(this.getTone()){case`info`:return`text-gray-700 dark:text-gray-300`;case`success`:return`text-green-600 dark:text-green-400`;case`warning`:return`text-yellow-600 dark:text-yellow-400`;case`danger`:return`text-red-600 dark:text-red-400`;default:return`text-gray-700 dark:text-gray-300`}}getHeadingColorClasses(){return`text-gray-900 dark:text-gray-100`}getHeaderBackgroundClasses(){switch(this.getTone()){case`info`:return`bg-gray-100 dark:bg-white/5`;case`success`:return`bg-green-100 dark:bg-green-900/30`;case`warning`:return`bg-yellow-100 dark:bg-yellow-900/30`;case`danger`:return`bg-red-100 dark:bg-red-900/30`;default:return`bg-gray-100 dark:bg-white/5`}}getBorderClasses(){switch(this.getTone()){case`info`:return`border-gray-200 dark:border-mint-divider`;case`success`:return`border-green-200 dark:border-green-800`;case`warning`:return`border-yellow-200 dark:border-yellow-800`;case`danger`:return`border-red-200 dark:border-red-800`;default:return`border-gray-200 dark:border-mint-divider`}}getAriaLive(){return this.getTone()===`danger`?`assertive`:`polite`}render(){let e=this.getTone(),t=this.getHeading(),n=this.isDismissable();this.className=`box-border m-0 p-0 border-0 align-baseline block rounded-lg border shadow-sm overflow-hidden ${this.getBorderClasses()}`;let r=this.getAriaLive();this.setAttribute(`role`,`alert`),this.setAttribute(`aria-live`,r),e===`danger`?this.setAttribute(`aria-atomic`,`true`):this.removeAttribute(`aria-atomic`);let i=[];for(this._bodyWrapper?Array.from(this._bodyWrapper.childNodes).forEach(e=>{i.push(e)}):Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&e!==this._iconElement&&e!==this._headingElement&&e!==this._dismissButton&&i.push(e)}),this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler);this.firstChild;)this.removeChild(this.firstChild);if(this._headerWrapper=null,this._bodyWrapper=null,this._iconElement=null,this._headingElement=null,this._dismissButton=null,this._headerWrapper=document.createElement(`div`),this._headerWrapper.className=`px-4 py-3 flex items-center gap-3 ${this.getHeaderBackgroundClasses()}`,this._iconElement=document.createElement(`mint-icon`),this._iconElement.setAttribute(`name`,this.getIconName()),this._iconElement.className=`flex-shrink-0 w-5 h-5 ${this.getIconColorClasses()}`,this._headerWrapper.appendChild(this._iconElement),this._headingElement=document.createElement(`mint-text`),this._headingElement.className=`font-semibold flex-1 ${this.getHeadingColorClasses()}`,this._headingElement.textContent=t||``,this._headerWrapper.appendChild(this._headingElement),n){this._dismissButton=document.createElement(`button`),this._dismissButton.className=`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10`,this._dismissButton.setAttribute(`aria-label`,`Dismiss alert`),this._dismissButton.setAttribute(`type`,`button`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`close`),e.className=`w-4 h-4 text-gray-700 dark:text-gray-300`,this._dismissButton.appendChild(e),this._dismissHandler=e=>{e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},this._dismissButton.addEventListener(`click`,this._dismissHandler),this._headerWrapper.appendChild(this._dismissButton)}this._bodyWrapper=document.createElement(`div`),this._bodyWrapper.className=`px-4 py-3 bg-white dark:bg-mint-elevated`,i.forEach(e=>{this._bodyWrapper.appendChild(e)}),this.appendChild(this._headerWrapper),this.appendChild(this._bodyWrapper)}};customElements.get(`mint-alert`)||customElements.define(`mint-alert`,M);var te=class extends HTMLElement{static get observedAttributes(){return[`configuration`,`loading`,`virtual-scroll`,`virtual-scroll-root`,`virtual-row-height`,`virtual-max-height`,`fixed-header`,`fixed-controls`]}_isExternalLoading(){let e=this.getAttribute(`loading`);return e!==null&&e!==`false`}constructor(){super(),this._configuration=null,this._rows=[],this._search=``,this._currentPage=1,this._perPage=15,this._totalRows=0,this._lastPage=0,this._offset=0,this._loaded=!1,this._fetching=!1,this._loading=!1,this._loadingPage=null,this._fetchError=null,this._searching=!1,this._sorting=!1,this._sortingColumn=null,this._type=`provided`,this._searchTimeoutId=null,this._sortTimeoutId=null,this._searchColumns=[],this._exportColumns={},this._columns=[],this._tableId=``,this._searchInput=null,this._tableContainer=null,this._paginationContainer=null,this._skeletonContainer=null,this._inMintCard=!1,this._virtualBodyScrollEl=null,this._virtualScrollHandler=null,this._virtualWindowRaf=null,this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``,this._virtualResizeObserver=null,this._virtualWindowResizeHandler=null,this._virtualRowCache=new Map,this._virtualRangeFetching=!1,this._mobileListMql=null,this._boundMobileListMqlListener=null,this._virtualFetchGeneration=0,this._virtualAjaxPrefetchTimer=null,this._fixedChromeResizeObserver=null}get inMintCard(){return this._inMintCard}get configuration(){return this._configuration}set configuration(e){e&&typeof e==`object`&&!Array.isArray(e)?(this._configuration=e,this._tableId=this._configuration.id||`mint-resource-table-${Date.now()}`,this._perPage=this._configuration.perPage||15,this._type=typeof this._configuration.data==`string`?`ajax`:`provided`,this._loaded=!1,this._currentPage=1,this._offset=0,this._type===`provided`&&Array.isArray(this._configuration.data)&&(this._rows=[...this._configuration.data],this._totalRows=this._configuration.data.length),this._initializeColumns(),this.isConnected&&this.render()):e==null?this._configuration=null:this._parseConfiguration()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._inMintCard=this.parentElement?.tagName?.toLowerCase()===`mint-card`,this._configuration||this._parseConfiguration(),this._initializeColumns(),this._loadPageFromUrl(),this._attachRowClickHandler(),this.render()}disconnectedCallback(){this._searchTimeoutId&&clearTimeout(this._searchTimeoutId),this._detachVirtualScroll(),this._detachFixedChromeResize(),this._detachMobileListMql(),this._rowClickHandler&&=(this.removeEventListener(`click`,this._rowClickHandler,!0),null),this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}attributeChangedCallback(e,t,n){e===`configuration`&&t!==n?(!this._configuration||typeof n==`string`)&&(this._parseConfiguration(),this.render()):t!==n&&(e===`loading`||e===`virtual-scroll`||e===`virtual-scroll-root`||e===`virtual-row-height`||e===`virtual-max-height`||e===`fixed-header`||e===`fixed-controls`)&&this._configuration&&this.isConnected&&this.render()}refresh(){this._configuration&&(this._type===`ajax`?this._fetchData(void 0,!0,this._perPage,this._offset):(Array.isArray(this._configuration.data)&&(this._rows=[...this._configuration.data],this._totalRows=this._rows.length),this.render()))}setData(e){if(this._configuration){if(this._configuration.data=e,this._type=typeof e==`string`?`ajax`:`provided`,this._currentPage=1,this._offset=0,this._fetchError=null,this._searching=!1,this._loadingPage=null,this._sortTimeoutId&&=(clearTimeout(this._sortTimeoutId),null),this._searchTimeoutId&&=(clearTimeout(this._searchTimeoutId),null),this._virtualScrollActive()&&(this._virtualRowCache.clear(),this._virtualInvalidate()),this._type===`ajax`){this._rows=[],this._totalRows=0,this._lastPage=0,this._loaded=!1,this._fetching=!1,this._loading=!1,this._fetchData(void 0,!0,this._perPage,0);return}this._rows=Array.isArray(e)?[...e]:[],this._totalRows=this._rows.length,this._lastPage=Math.max(1,Math.ceil(this._totalRows/this._perPage)),this._loaded=!0,this._fetching=!1,this._loading=!1,this.render()}}_parseConfiguration(){let e=this.getAttribute(`configuration`);if(!e){console.error(`mint-resource-table: configuration attribute is required`);return}try{this._configuration=JSON.parse(e),this._tableId=this._configuration.id||`mint-resource-table-${Date.now()}`,this._perPage=this._configuration.perPage||15,this._type=typeof this._configuration.data==`string`?`ajax`:`provided`,this._loaded=!1,this._currentPage=this._getPageFromUrl()||1,this._offset=(this._currentPage-1)*this._perPage,this._type===`provided`&&Array.isArray(this._configuration.data)&&(this._rows=[...this._configuration.data],this._totalRows=this._configuration.data.length),this._initializeColumns()}catch(e){console.error(`mint-resource-table: Invalid configuration JSON`,e)}}_initializeColumns(){this._configuration&&(this._searchColumns=[],this._exportColumns={},this._columns=[],this._configuration.columns.forEach(e=>{e.searchable&&e.data&&this._searchColumns.push(e.data),e.export&&e.data&&(this._exportColumns[e.data]=e.label),e.data&&this._columns.push(e.data)}),this._configuration.sortBy||(this._configuration.sortBy=`id`),this._configuration.sort||(this._configuration.sort=`asc`))}async _fetchData(e,t=!0,n,r){if(!this._configuration)return;let i=e||(typeof this._configuration.data==`string`?this._configuration.data:null);if(!i||this._fetching||this._loading)return;t&&(this._fetching=!0,this._loaded?this._updatePagination():this.render()),this._loading=!0;let a=n||this._perPage,o=r===void 0?this._offset:r;this._virtualScrollActive()&&this._type===`ajax`&&o===0&&(this._virtualFetchGeneration++,this._virtualRowCache.clear(),this._virtualInvalidate());try{let e=new URLSearchParams({perPage:a.toString(),offset:o.toString(),search:this._search,sortBy:this._configuration.sortBy||`id`,sort:this._configuration.sort||`asc`,searchColumns:this._searchColumns.join(`,`),columns:this._columns.join(`,`)}),t={};this._configuration.headers&&(t.headers=this._configuration.headers);let n=await fetch(`${i}?${e.toString()}`,t);if(!n.ok)throw Error(`HTTP error! status: ${n.status}`);let r=await n.json(),s=r.content?.rows||[],c=r.content?.total||0,l=s;this._configuration.predefinedData?(l=[...this._configuration.predefinedData,...s],this._totalRows=c+this._configuration.predefinedData.length):this._totalRows=c,this._rows=l;let u=Math.floor(o/a)+1;r.content?.current_page!==void 0&&r.content.current_page===u?this._currentPage=r.content.current_page:this._currentPage=u,this._offset=(this._currentPage-1)*a,this._lastPage=r.content?.last_page||1,this._fetching=!1,this._loaded=!0,this._loading=!1,this._fetchError=null,this._searching=!1;let d=this._sorting;d&&this._updateSortIcons(),this._sorting=!1,this._sortingColumn=null,d&&this._updateSortIcons(),this.dispatchEvent(new CustomEvent(`loaded`,{detail:{rows:this._rows}})),this._updateSearchIcon();let f=`tbody[data-mint-rt-tbody="${this._tableId}"]`,p=!!this.querySelector(f);if(this._virtualScrollActive()&&this._type===`ajax`)p||this.render(),s.forEach((e,t)=>{this._virtualRowCache.set(o+t,e)}),this._virtualInvalidate(),o===0?queueMicrotask(()=>this._scrollVirtualTableTopIntoView()):this._scheduleVirtualWindowSync(),this._loadingPage,this._loadingPage=null,this._updatePagination(),setTimeout(()=>{let e=this._paginationMountedRoot();e&&e.querySelectorAll(`mint-button[data-action="page"]`).forEach(e=>{`render`in e&&typeof e.render==`function`&&e.render()})},0);else if(this.querySelector(`#${this._tableId}`)?.closest(`table`)?.querySelector(`tbody`)){if(d){let e=this._loading,t=this._fetching;this._loading=!1,this._fetching=!1,this._updateTableBody(),this._loading=e,this._fetching=t}else this._updateTableBody();this._loadingPage,this._loadingPage=null,this._updatePagination(),setTimeout(()=>{let e=this._paginationMountedRoot();e&&e.querySelectorAll(`mint-button[data-action="page"]`).forEach(e=>{`render`in e&&typeof e.render==`function`&&e.render()})},0)}else this.render()}catch(e){this._fetching=!1,this._loading=!1,this._loadingPage=null,this._loaded=!0,this._searching=!1,this._fetchError=e instanceof Error?e.message:`Failed to fetch data`,console.error(`mint-resource-table: Error fetching data`,e),this._updateSearchIcon(),this.querySelector(`#${this._tableId}`)?.closest(`table`)?.querySelector(`tbody`)?(this._updateTableBody(),this._loadingPage=null,this._updatePagination()):this.render()}}_getRows(){if(!this._configuration)return[];if(this._type===`ajax`)return this._rows;let e=[...this._rows],t=this._configuration.sortBy||`id`,n=this._configuration.sort||`asc`;if(this._search){let t=this._search.toLowerCase().trim().split(/\s+/);e=e.filter(e=>{let n=Object.values(e).map(e=>String(e).toLowerCase()).join(` `);return t.every(e=>n.includes(e))})}if(e.sort((e,r)=>{let i=e[t],a=r[t];if(i==null&&a==null)return 0;if(i==null)return 1;if(a==null)return-1;let o=typeof i==`number`?i:typeof i==`string`&&!isNaN(Number(i))&&i.trim()!==``?Number(i):null,s=typeof a==`number`?a:typeof a==`string`&&!isNaN(Number(a))&&a.trim()!==``?Number(a):null;if(o!==null&&s!==null){let e=o-s;return n===`asc`?e:-e}let c=i instanceof Date?i:typeof i==`string`?new Date(i):null,l=a instanceof Date?a:typeof a==`string`?new Date(a):null;if(c&&l&&!isNaN(c.getTime())&&!isNaN(l.getTime())){let e=c.getTime()-l.getTime();return n===`asc`?e:-e}let u=String(i).localeCompare(String(a),void 0,{numeric:!0,sensitivity:`base`});return n===`asc`?u:-u}),this._perPage){let t=Math.ceil(e.length/this._perPage);this._lastPage=t,e.forEach((e,t)=>{e.page=Math.ceil((t+1)/this._perPage)}),this._currentPage>t&&t>0&&(this._currentPage=t)}return e.filter(e=>!this._perPage||e.page===this._currentPage)}_getAllFilteredRowsSorted(){if(!this._configuration||this._type!==`provided`)return[];let e=[...this._rows],t=this._configuration.sortBy||`id`,n=this._configuration.sort||`asc`;if(this._search){let t=this._search.toLowerCase().trim().split(/\s+/);e=e.filter(e=>{let n=Object.values(e).map(e=>String(e).toLowerCase()).join(` `);return t.every(e=>n.includes(e))})}if(e.sort((e,r)=>{let i=e[t],a=r[t];if(i==null&&a==null)return 0;if(i==null)return 1;if(a==null)return-1;let o=typeof i==`number`?i:typeof i==`string`&&!isNaN(Number(i))&&i.trim()!==``?Number(i):null,s=typeof a==`number`?a:typeof a==`string`&&!isNaN(Number(a))&&a.trim()!==``?Number(a):null;if(o!==null&&s!==null){let e=o-s;return n===`asc`?e:-e}let c=i instanceof Date?i:typeof i==`string`?new Date(i):null,l=a instanceof Date?a:typeof a==`string`?new Date(a):null;if(c&&l&&!isNaN(c.getTime())&&!isNaN(l.getTime())){let e=c.getTime()-l.getTime();return n===`asc`?e:-e}let u=String(i).localeCompare(String(a),void 0,{numeric:!0,sensitivity:`base`});return n===`asc`?u:-u}),this._perPage){let t=Math.ceil(e.length/this._perPage);this._lastPage=t,e.forEach((e,t)=>{e.page=Math.ceil((t+1)/this._perPage)}),this._currentPage>t&&t>0&&(this._currentPage=t)}return e.filter(e=>!this._perPage||e.page===this._currentPage)}_virtualInvalidate(){this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``}_getRowDataForEventIndex(e){if(this._configuration){if(!this._virtualScrollActive())return this._getRows()[e];if(this._type===`provided`)return this._getAllFilteredRowsSorted()[e];if(this._type===`ajax`)return this._virtualRowCache.get(e)}}getRowByIndex(e){return this._getRowDataForEventIndex(e)}_virtualScrollActive(){return this._configuration?(this.getAttribute(`virtual-scroll`)||``).toLowerCase().trim()===`true`:!1}_virtualScrollRoot(){let e=(this.getAttribute(`virtual-scroll-root`)||``).toLowerCase().trim();return e===`table-body`||e===`body`||this._configuration?.virtualScrollRoot===`table-body`?`table-body`:`document`}_virtualBodyScrollDisablesDocumentFixedChrome(){return this._virtualScrollActive()&&this._virtualScrollRoot()===`table-body`}_fixedHeader(){if(this._virtualBodyScrollDisablesDocumentFixedChrome()||!this.hasAttribute(`fixed-header`))return!1;let e=(this.getAttribute(`fixed-header`)||``).toLowerCase().trim();return e!==`false`&&e!==`0`}_fixedControls(){if(this._virtualBodyScrollDisablesDocumentFixedChrome()||!this.hasAttribute(`fixed-controls`))return!1;let e=(this.getAttribute(`fixed-controls`)||``).toLowerCase().trim();return e!==`false`&&e!==`0`}_virtualRowHeightPx(){let e=parseInt(this.getAttribute(`virtual-row-height`)||``,10);if(!isNaN(e)&&e>0)return e;let t=this._configuration?.virtualRowHeight;return typeof t==`number`&&t>0?t:48}_virtualRowHeightPxForSync(e){let t=this._virtualRowHeightPx();if(!this._configuration)return t;if(e){let e=this._mobileThumbnailColumn();if(e){let n=this._thumbnailMobilePx(e);return Math.max(t,n+36)}return Math.max(t,80)}let n=this._mobileThumbnailColumn();if(n){let e=this._thumbnailDesktopPx(n);return Math.max(t,e+28)}return t}_virtualMaxHeightCss(){let e=this.getAttribute(`virtual-max-height`);if(e&&e.trim())return e.trim();let t=this._configuration?.virtualMaxHeight;return t&&String(t).trim()?String(t).trim():`min(70dvh, 28rem)`}_virtualColspan(){return this._configuration?Math.max(1,this._configuration.columns.filter(e=>!e.hidden).length):1}_ensureMobileListMql(){typeof window>`u`||!window.matchMedia||this._mobileListMql||(this._mobileListMql=window.matchMedia(`(max-width: 767px)`),this._boundMobileListMqlListener=()=>{this._configuration&&this.isConnected&&this.render()},this._mobileListMql.addEventListener(`change`,this._boundMobileListMqlListener))}_detachMobileListMql(){this._mobileListMql&&this._boundMobileListMqlListener&&this._mobileListMql.removeEventListener(`change`,this._boundMobileListMqlListener),this._mobileListMql=null,this._boundMobileListMqlListener=null}_useMobileListLayout(){return!!this._mobileListMql?.matches}_paginationHostPlaceholderHtml(){if(!this._configuration?.perPage||this._virtualScrollActive())return``;let e=this._lastPage||Math.ceil(this._rows.length/this._perPage);if((this._lastPage>0?this._lastPage:e)<=1)return``;let t=[`mint-rt-pagination-host`,`w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain`,`flex justify-center [-webkit-overflow-scrolling:touch] md:justify-end`,this._inMintCard?`border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider md:border-t-0 md:pt-0`:`border-t border-gray-200 px-2 py-3 dark:border-mint-divider md:border-t-0 md:py-0 md:mt-4`].join(` `);return`<div id="mint-rt-pagination-host-${this._tableId}" data-mint-rt-pagination-wrap="" class="${t}"></div>`}_getPaginationHostEl(){return this.querySelector(`#mint-rt-pagination-host-${this._tableId}`)}_paginationMountedRoot(){return this._getPaginationHostEl()||this.querySelector(`nav[data-mint-rt-pagination-nav]`)?.parentElement||this.querySelector(`nav`)?.closest(`.flex.justify-end`)}_paginationPageButtonLi(e){let t=this._currentPage===e,n=this._loadingPage===e;return`<li class="shrink-0"><mint-button variant="solid" size="sm"${t?` active="true"`:``}${this._loading||this._fetching?` disabled="true"`:``}${n?` loading="true"`:``} data-action="page" data-page="${e}">${n?``:`${e}`}</mint-button></li>`}_paginationHtmlCompactMiddle(e){let t=``,n=this._currentPage;if(e<=5){for(let n=1;n<=e;n++)t+=this._paginationPageButtonLi(n);return t}let r=[...new Set([1,e,n-1,n,n+1].map(t=>Math.min(e,Math.max(1,t))))].sort((e,t)=>e-t),i=0;for(let e of r)i>0&&e-i>1&&(t+=`<li class="shrink-0"><span class="px-1 text-gray-500 dark:text-gray-400" aria-hidden="true">…</span></li>`),t+=this._paginationPageButtonLi(e),i=e;return t}_paginationHtmlDesktopMiddle(e){let t=``,n=e>=10,r=Math.max(1,this._currentPage-1),i=Math.min(e,this._currentPage+1);if(n){for(let e=1;e<=3;e++)t+=this._paginationPageButtonLi(e);let n=i<=3,a=r>=e-2;if(!n&&!a){r>4&&(t+=`<li class="shrink-0"><span class="px-2">...</span></li>`);for(let e=r;e<=i;e++)e<=3||(t+=this._paginationPageButtonLi(e));i<e-3&&(t+=`<li class="shrink-0"><span class="px-2">...</span></li>`)}else (n&&!a||!n&&a&&e-2>4)&&(t+=`<li class="shrink-0"><span class="px-2">...</span></li>`);for(let o=e-2;o<=e;o++)o<=3||!n&&!a&&o>=r&&o<=i||(t+=this._paginationPageButtonLi(o))}else for(let n=1;n<=e;n++)t+=this._paginationPageButtonLi(n);return t}_buildPaginationNavMarkup(e){let t=this._currentPage===1||this._loading||this._fetching,n=`<nav data-mint-rt-pagination-nav="" class="w-max max-w-none shrink-0" aria-label="Pagination">`;n+=`<ul class="flex flex-nowrap items-center gap-1">`,n+=`<li class="shrink-0"><mint-button variant="solid" size="sm" icon="caret-left" ${t?`disabled="true"`:``} data-action="page-prev"></mint-button></li>`,n+=this._useMobileListLayout()?this._paginationHtmlCompactMiddle(e):this._paginationHtmlDesktopMiddle(e);let r=this._currentPage>=e||this._loading||this._fetching;return n+=`<li class="shrink-0"><mint-button variant="solid" size="sm" icon="caret-right" ${r?`disabled="true"`:``} data-action="page-next"></mint-button></li>`,n+=`</ul></nav>`,n}_hasSortableColumns(){return!!this._configuration?.columns.some(e=>!e.hidden&&e.sortable&&e.data)}_getMobileSortTriggerIconName(){return`sort-arrows`}_mobileSortPopoverAffordanceInnerHtml(e){return e===`spinner`?`<span class="inline-block h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700 dark:border-gray-600 dark:border-t-gray-200" aria-hidden="true"></span>`:e===`caret-up`||e===`caret-down`?`<mint-icon name="${e}" class="h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400"></mint-icon>`:``}_buildMobileSortPopoverInnerHtml(){if(!this._configuration)return``;let e=`<div class="flex w-full min-w-[11rem] flex-col gap-0.5 p-1">`;return this._configuration.columns.forEach((t,n)=>{if(t.hidden||!t.sortable||!t.data)return;let r=t.raw?t.label:this._escapeHtml(t.label),i=this._getSortClass(t),a=this._mobileSortPopoverAffordanceInnerHtml(i),o=` type="button" variant="ghost" tone="neutral" size="sm" full-width="true" align="left" data-action="mobile-sort" data-column-key="${n}"`;e+=`<mint-button${o}>`,e+=`<span class="flex w-full min-w-0 flex-1 items-center justify-between gap-2">`,e+=`<span class="min-w-0 flex-1 truncate text-left">${r}</span>`,e+=`<span class="inline-flex shrink-0 items-center justify-end" data-mint-rt-mobile-sort-affordance="">${a}</span>`,e+=`</span></mint-button>`}),e+=`</div>`,e}_syncMobileSortPopoverIcons(){if(!this._configuration)return;let e=this.querySelector(`#mint-rt-mobile-sort-popover-${this._tableId}`);e&&this._configuration.columns.forEach((t,n)=>{if(t.hidden||!t.sortable||!t.data)return;let r=e.querySelector(`[data-action="mobile-sort"][data-column-key="${n}"]`);if(!r||r.tagName!==`MINT-BUTTON`)return;let i=r.querySelector(`[data-mint-rt-mobile-sort-affordance]`);if(!i)return;let a=this._getSortClass(t);i.innerHTML=this._mobileSortPopoverAffordanceInnerHtml(a),i.querySelectorAll(`mint-icon`).forEach(e=>{let t=e;typeof t.render==`function`&&t.render()})})}_closeMobileSortPopover(){let e=this.querySelector(`#mint-rt-mobile-sort-popover-${this._tableId}`);e&&typeof e.close==`function`?e.close():e&&e.removeAttribute(`open`)}_buildMobileSortToolbarHtml(){if(!this._hasSortableColumns())return``;let e=`mint-rt-mobile-sort-btn-${this._tableId}`,t=`mint-rt-mobile-sort-popover-${this._tableId}`,n=this._sorting?` loading="true"`:``,r=` icon="${this._escapeHtml(this._getMobileSortTriggerIconName())}"`,i=`<div class="flex shrink-0 items-center md:hidden">`;return i+=`<mint-button id="${e}" data-mint-rt-toolbar="mobile-sort" variant="solid" tone="neutral" size="sm"${n}${r}></mint-button>`,i+=`<mint-popover id="${t}" trigger-id="${e}" direction="down" padding="0">`,i+=this._buildMobileSortPopoverInnerHtml(),i+=`</mint-popover></div>`,i}_stripHtml(e){if(!e)return``;let t=document.createElement(`div`);return t.innerHTML=e,(t.textContent||t.innerText||``).replace(/\s+/g,` `).trim()}_visibleDataColumns(){return this._configuration?this._configuration.columns.filter(e=>!e.hidden):[]}_mobileThumbnailColumn(){return this._visibleDataColumns().find(e=>e.thumbnail)||null}_thumbnailDesktopPx(e){let t=typeof e.thumbnailDesktopPx==`number`&&e.thumbnailDesktopPx>0?e.thumbnailDesktopPx:void 0,n=this._configuration,r=n&&typeof n.thumbnailDesktopPx==`number`&&n.thumbnailDesktopPx>0?n.thumbnailDesktopPx:void 0;return Math.round(t??r??40)}_thumbnailMobilePx(e){let t=typeof e.thumbnailMobilePx==`number`&&e.thumbnailMobilePx>0?e.thumbnailMobilePx:void 0,n=this._configuration,r=n&&typeof n.thumbnailMobilePx==`number`&&n.thumbnailMobilePx>0?n.thumbnailMobilePx:void 0;return Math.round(t??r??56)}_wrapThumbnailDesktopBox(e,t){let n=this._thumbnailDesktopPx(t);return`<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${`width:${n}px;height:${n}px;min-width:${n}px;min-height:${n}px`}">${e}</div>`}_mobilePrimaryColumn(){let e=this._visibleDataColumns();return e.find(e=>e.primary)||e.find(e=>(e.data||typeof e.format==`function`)&&!e.thumbnail&&!e.actions)||e[0]||null}_mobileActionsDropdownColumn(){return this._visibleDataColumns().find(e=>e.actions&&e.actionStyle!==`buttons`)||null}_columnPlainSummaryText(e,t){if(!(!e.show||e.show(this,t))||e.actions||e.action)return``;try{if(e.raw){if(typeof e.format==`function`)return this._stripHtml(e.format(this,t));if(e.data)return String(t[e.data]??``)}else{if(typeof e.format==`function`)return this._stripHtml(e.format(this,t));if(e.data)return String(t[e.data]??``)}}catch{return``}return``}_buildTableCellInnerHtml(e,t,n,r=`table`){if(!this._configuration)return``;let i=n,a=``;if(!(!e.show||e.show(this,t)))return``;if(e.raw)if(e.action){if(!e.action.show||e.action.show(this,t)){let n=typeof e.action.label==`function`?e.action.label(this,t):e.action.label;a+=`<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(n))}</mint-button>`}}else if(e.actions)if(e.actionStyle!==`buttons`){let n=`actions-popover-${this._tableId}-${i}`,r=`actions-button-${this._tableId}-${i}`;a+=`<mint-button id="${r}" variant="link" icon="ellipsis">`,a+=`</mint-button>`,a+=`<mint-popover id="${n}" trigger-id="${r}" direction="down">`,e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=typeof n.label==`function`?n.label(this,t):n.label;a+=`<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(o))}</div>`}}),a+=`</mint-popover>`}else e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=n.label?typeof n.label==`function`?n.label(this,t):n.label:``,s=n.icon?` icon="${this._escapeHtml(n.icon)}"`:``,c=n.variant?` variant="${this._escapeHtml(n.variant)}"`:` variant="link"`,l=n.tone?` tone="${this._escapeHtml(n.tone)}"`:``;a+=`<mint-button${c} class="${n.classes||``}" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${l}>`,o&&(a+=this._escapeHtml(String(o))),a+=`</mint-button>`}});else typeof e.format==`function`?a+=e.format(this,t):e.data&&(a+=this._escapeHtml(String(t[e.data]||``)));else if(e.action)(!e.action.show||e.action.show(this,t))&&(a+=`<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${e.action.label}</mint-button>`);else if(e.actions)if(e.actionStyle!==`buttons`){let n=`actions-popover-${this._tableId}-${i}`,r=`actions-button-${this._tableId}-${i}`;a+=`<mint-button id="${r}" variant="link" icon="ellipsis">`,a+=`</mint-button>`,a+=`<mint-popover id="${n}" trigger-id="${r}" direction="down">`,e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=typeof n.label==`function`?n.label(this,t):n.label;a+=`<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(o))}</div>`}}),a+=`</mint-popover>`}else e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=n.label?typeof n.label==`function`?n.label(this,t):n.label:``,s=n.icon?` icon="${this._escapeHtml(n.icon)}"`:``,c=n.variant?` variant="${this._escapeHtml(n.variant)}"`:` variant="link"`,l=n.tone?` tone="${this._escapeHtml(n.tone)}"`:``;a+=`<mint-button${c} class="${n.classes||``}" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${l}>`,o&&(a+=this._escapeHtml(String(o))),a+=`</mint-button>`}});else typeof e.format==`function`?a+=this._escapeHtml(e.format(this,t)):e.data&&(a+=this._escapeHtml(String(t[e.data]||``)));return r===`table`&&e.thumbnail&&a&&!e.actions&&!e.action?this._wrapThumbnailDesktopBox(a,e):a}_buildMobileListItemHtml(e,t,n,r=!1){if(!this._configuration)return``;let i=t,a=typeof this._configuration.onRowClick==`function`,o=this._mobileThumbnailColumn(),s=this._mobilePrimaryColumn(),c=this._mobileActionsDropdownColumn(),l=o?this._buildTableCellInnerHtml(o,e,i,`mobile`):``,u=s?this._buildTableCellInnerHtml(s,e,i,`mobile`):``,d=c?this._buildTableCellInnerHtml(c,e,i,`mobile`):``,f=[],p=this._configuration.mobileShowLabels===!0;for(let t of this._configuration.columns){if(t.hidden||o&&t===o||s&&t===s||c&&t===c)continue;let n=this._columnPlainSummaryText(t,e);if(n)if(p){let e=this._stripHtml(String(t.label||``)).trim();e?f.push(`${this._escapeHtml(e)}: ${this._escapeHtml(n)}`):f.push(this._escapeHtml(n))}else f.push(this._escapeHtml(n))}let m=f.join(`<span class="text-gray-300 dark:text-gray-600" aria-hidden="true"> · </span>`),h=[`list-none`,...r?[]:[`border-b`,`border-gray-200`,`dark:border-mint-divider`],`bg-white`,`dark:bg-mint-canvas`,a?`cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated`:``].filter(Boolean).join(` `),g=`<div class="flex items-center gap-3 py-3 pr-4${o?` pl-0`:` pl-4`}">`;if(o){let e=this._thumbnailMobilePx(o),t=`width:${e}px;height:${e}px;min-width:${e}px;min-height:${e}px`;g+=`<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${t}">${l}</div>`}g+=`<div class="flex min-w-0 flex-1 flex-col justify-center gap-1">`,g+=`<div class="flex items-start justify-between gap-2">`,g+=`<div class="min-w-0 text-sm font-semibold leading-snug text-gray-900 dark:text-white">${u}</div>`,d&&(g+=`<div class="shrink-0 -mr-1">${d}</div>`),g+=`</div>`,m&&(g+=`<div class="text-xs font-normal leading-snug text-gray-500 dark:text-gray-400">${m}</div>`),g+=`</div></div>`;let _=typeof n==`number`&&n>0?` style="box-sizing:border-box;min-height:${n}px;max-height:${n}px;height:${n}px;overflow:hidden"`:``;return`<li data-row-index="${i}" ${a?`data-row-clickable="true" `:``}class="${h}"${_}>${g}</li>`}_buildMobileListPlaceholderLi(e,t,n=!1){let r=this._mobileThumbnailColumn(),i=r?this._thumbnailMobilePx(r):56,a=`width:${i}px;height:${i}px;min-width:${i}px;min-height:${i}px`;return`<li data-row-index="${e}" data-mint-rt-placeholder="true" class="list-none${n?``:` border-b border-gray-200 dark:border-mint-divider`} bg-white dark:bg-mint-canvas" style="box-sizing:border-box;min-height:${t}px;max-height:${t}px;height:${t}px;overflow:hidden"><div class="flex h-full min-h-0 items-center gap-3 py-3 pl-0 pr-4"><div class="shrink-0 overflow-hidden rounded-md bg-gray-200 dark:bg-white/15" style="${a}"></div><div class="flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 py-0.5"><div class="h-4 w-40 rounded bg-gray-200 dark:bg-white/15"></div><div class="h-3 w-full max-w-xs rounded bg-gray-200 dark:bg-white/15"></div></div></div></li>`}_renderColgroupHtml(){if(!this._configuration)return``;let e=this._configuration.columns.filter(e=>!e.hidden),t=[],n=0;for(let r of e){let e=r.width==null?``:String(r.width).trim();e?/^\d+(\.\d+)?$/.test(e)?(n+=parseFloat(e),t.push(`px`)):t.push(`lit`):t.push(`flex`)}let r=t.filter(e=>e===`flex`).length,i=t.includes(`lit`),a=``;r>0&&!i&&(a=n>0?`width:calc((100% - ${n}px) / ${r});min-width:0`:`width:${100/r}%;min-width:0`);let o=`<colgroup>`;return e.forEach((e,n)=>{let r=e.width==null?``:String(e.width).trim(),i=t[n],s=``;i===`px`?s=` style="width:${r}px;min-width:0"`:i===`lit`?s=` style="width:${this._escapeHtml(r)};min-width:0"`:a&&(s=` style="${a}"`),o+=`<col${s} />`}),o+=`</colgroup>`,o}_buildDataRowHtml(e,t,n,r=!1){if(!this._configuration)return``;let i=t,a=n,o=`box-sizing:border-box;min-height:${a}px;max-height:${a}px;height:${a}px;overflow:hidden`,s=``,c=typeof this._configuration.onRowClick==`function`,l=c?`cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800`:``,u=c?` data-row-clickable="true"`:``,d=l?` class="${l}"`:``;return s+=`<tr data-row-index="${i}"${r?` data-mint-rt-last-row=""`:``}${u}${d} style="${o}">`,this._configuration.columns.forEach(t=>{if(t.hidden)return;let n=!t.show||t.show(this,e),r=`${this._getStyle(t)}box-sizing:border-box;max-height:${a}px;overflow:hidden;vertical-align:middle;`;s+=`<td style="${r}" class="${this._getClasses(t,!0)}">`,s+=n?this._buildTableCellInnerHtml(t,e,i):``,s+=`</td>`}),s+=`</tr>`,s}_getVirtualRowCount(){return!this._virtualScrollActive()||!this._configuration?0:this._type===`provided`?this._getAllFilteredRowsSorted().length:this._type===`ajax`?this._totalRows:0}_getVirtualRowAt(e){return this._type===`provided`?this._getAllFilteredRowsSorted()[e]??null:this._type===`ajax`&&this._virtualRowCache.has(e)?this._virtualRowCache.get(e):null}_buildVirtualPlaceholderRowHtml(e,t,n=!1){if(!this._configuration)return``;let r=t,i=`box-sizing:border-box;min-height:${r}px;max-height:${r}px;height:${r}px;overflow:hidden`,a=`<tr data-row-index="${e}" data-mint-rt-placeholder="true"${n?` data-mint-rt-last-row=""`:``} class="bg-white dark:bg-mint-canvas" style="${i}">`;return this._configuration.columns.forEach(e=>{if(e.hidden)return;let t=`${this._getStyle(e)}box-sizing:border-box;max-height:${r}px;height:${r}px;overflow:hidden;vertical-align:middle;line-height:0;`;if(a+=`<td style="${t}" class="${this._getClasses(e,!0)}">`,e.thumbnail){let t=this._thumbnailDesktopPx(e);a+=`<div class="rounded-md bg-gray-200 dark:bg-white/15" style="width:${t}px;height:${t}px;max-width:100%;box-sizing:border-box"></div>`}else a+=`<div class="h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15"></div>`;a+=`</td>`}),a+=`</tr>`,a}_virtualScrollStickyOverlapPx(e){let t=0;if(this._fixedControls()){let e=this.querySelector(`#mint-rt-fixed-controls-${this._tableId}`);if(e)t+=Math.ceil(e.getBoundingClientRect().height);else{let e=getComputedStyle(this).getPropertyValue(`--mint-rt-fixed-controls-h`).trim(),n=parseFloat(e);isNaN(n)||(t+=Math.ceil(n))}}if(this._fixedHeader()&&e){let n=e.querySelector(`thead`);n&&(t+=Math.ceil(n.getBoundingClientRect().height))}return t}_scrollVirtualTableTopIntoView(){if(!(!this._virtualScrollActive()||!this.isConnected)){if(this._virtualScrollRoot()===`table-body`){let e=this._virtualBodyScrollEl?.isConnected?this._virtualBodyScrollEl:this.querySelector(`#mint-rt-vscroll-${this._tableId}`);this._useMobileListLayout()&&e&&e.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`);let t=e?.querySelector(`mint-table.table-section`)||e?.querySelector(`mint-table`),n=t?.querySelector(`#${this._tableId}`)?.closest(`table`)||t?.querySelector(`table`);this._virtualScrollStickyOverlapPx(n),e&&(e.scrollTop=0,this._virtualBodyScrollEl=e,this._virtualInvalidate(),this._scheduleVirtualWindowSync());return}this._virtualInvalidate(),this._scheduleVirtualWindowSync()}}_scheduleVirtualWindowSync(){this._virtualScrollActive()&&this._virtualWindowRaf===null&&(this._virtualWindowRaf=window.requestAnimationFrame(()=>{this._virtualWindowRaf=null,this._syncVirtualWindow()}))}_syncVirtualWindow(){if(!this._virtualScrollActive()||!this._configuration)return;let e=this._useMobileListLayout(),t=this.querySelector(`tbody[data-mint-rt-tbody="${this._tableId}"]`),n=this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`),r=e?n:t;if(!r)return;let i=this._getVirtualRowCount(),a=this._virtualRowHeightPxForSync(e),o=this._virtualColspan();if(i===0){e?this._fetchError?r.innerHTML=`<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`:r.innerHTML=`<li class="list-none px-4 py-8 text-center text-sm">No records found.</li>`:this._fetchError?r.innerHTML=`<tr><td colspan="${o}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`:r.innerHTML=`<tr><td colspan="${o}" class="text-center py-8">No records found.</td></tr>`,this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``;return}let s=0,c=window.innerHeight;if(this._virtualScrollRoot()===`table-body`){let e=this._virtualBodyScrollEl;if((!e||!e.isConnected)&&(e=this.querySelector(`#mint-rt-vscroll-${this._tableId}`),this._virtualBodyScrollEl=e),!e)return;s=e.scrollTop,c=e.clientHeight||400}else{let e=r.getBoundingClientRect();s=Math.max(0,-e.top)}let l=Math.min(Math.max(0,Math.floor(s/a)),Math.max(0,i-1)),u=Math.ceil(c/a)+16,d=Math.max(0,l-8),f=Math.min(i,l+u),p=``;if(this._type===`ajax`)for(let e=d;e<f;e++)p+=this._virtualRowCache.has(e)?`1`:`0`;if(d===this._virtualLastRangeStart&&f===this._virtualLastRangeEnd&&(this._type!==`ajax`||p===this._virtualLastRangeCacheSig))return;this._virtualLastRangeStart=d,this._virtualLastRangeEnd=f,this._virtualLastRangeCacheSig=p;let m=d*a,h=Math.max(0,(i-f)*a),g=``;if(e){g+=`<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${m}px"></li>`;for(let e=d;e<f;e++){let t=this._getVirtualRowAt(e),n=i>0&&e===i-1;t?g+=this._buildMobileListItemHtml(t,e,a,n):g+=this._buildMobileListPlaceholderLi(e,a,n)}g+=`<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${h}px"></li>`}else{g+=`<tr data-mint-rt-spacer="top" aria-hidden="true"><td colspan="${o}" style="height:${m}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`;for(let e=d;e<f;e++){let t=this._getVirtualRowAt(e),n=i>0&&e===i-1;t?g+=this._buildDataRowHtml(t,e,a,n):g+=this._buildVirtualPlaceholderRowHtml(e,a,n)}g+=`<tr data-mint-rt-spacer="bottom" aria-hidden="true"><td colspan="${o}" style="height:${h}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`}if(r.innerHTML=g,this.querySelectorAll(`tbody[data-mint-rt-tbody="${this._tableId}"] mint-button[data-action], ul[data-mint-rt-mobile-list="${this._tableId}"] mint-button[data-action]`).forEach(e=>{e.render&&e.render()}),this._attachTableEventListeners(),this._attachRowClickHandler(),this._type===`ajax`&&this._virtualScrollActive()&&this._scheduleVirtualAjaxPrefetch(d,f),this._virtualScrollRoot()===`table-body`&&!e){let e=this._virtualBodyScrollEl;e?.isConnected&&requestAnimationFrame(()=>{if(!e.isConnected)return;let t=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop>t&&(e.scrollTop=t)})}}_detachVirtualScroll(){this._virtualScrollHandler&&=(window.removeEventListener(`scroll`,this._virtualScrollHandler),this._virtualBodyScrollEl?.removeEventListener(`scroll`,this._virtualScrollHandler),null),this._virtualWindowResizeHandler&&=(window.removeEventListener(`resize`,this._virtualWindowResizeHandler),null),this._virtualResizeObserver&&=(this._virtualResizeObserver.disconnect(),null),this._virtualBodyScrollEl=null,this._virtualWindowRaf!==null&&(window.cancelAnimationFrame(this._virtualWindowRaf),this._virtualWindowRaf=null),this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``,this._virtualAjaxPrefetchTimer!==null&&(window.clearTimeout(this._virtualAjaxPrefetchTimer),this._virtualAjaxPrefetchTimer=null),this._virtualRangeFetching=!1}_scheduleVirtualAjaxPrefetch(e,t){if(this._type!==`ajax`||!this._virtualScrollActive()||!this._configuration)return;let n=!1;for(let r=e;r<t;r++)if(!this._virtualRowCache.has(r)){n=!0;break}if(!n)return;this._virtualAjaxPrefetchTimer!==null&&window.clearTimeout(this._virtualAjaxPrefetchTimer);let r=e,i=t;this._virtualAjaxPrefetchTimer=window.setTimeout(()=>{this._virtualAjaxPrefetchTimer=null,this._fetchVirtualAjaxRange(r,i-r)},60)}async _fetchVirtualAjaxRange(e,t){if(!this._configuration||this._type!==`ajax`||!this._virtualScrollActive())return;let n=typeof this._configuration.data==`string`?this._configuration.data:null;if(!n||t<=0||this._virtualRangeFetching||e<0||e>=this._totalRows)return;this._virtualRangeFetching=!0;let r=this._virtualFetchGeneration,i=Math.min(e,Math.max(0,this._totalRows-1)),a=Math.min(150,Math.max(this._perPage,t,15),Math.max(1,this._totalRows-i));try{let e=new URLSearchParams({perPage:a.toString(),offset:i.toString(),search:this._search,sortBy:this._configuration.sortBy||`id`,sort:this._configuration.sort||`asc`,searchColumns:this._searchColumns.join(`,`),columns:this._columns.join(`,`)}),t={};this._configuration.headers&&(t.headers=this._configuration.headers);let o=await fetch(`${n}?${e.toString()}`,t);if(!o.ok)throw Error(`HTTP error! status: ${o.status}`);let s=await o.json();if(r!==this._virtualFetchGeneration)return;(s.content?.rows||[]).forEach((e,t)=>{let n=i+t;n<this._totalRows&&this._virtualRowCache.set(n,e)})}catch(e){console.error(`mint-resource-table: virtual range fetch failed`,e)}finally{this._virtualRangeFetching=!1,r===this._virtualFetchGeneration&&(this._virtualInvalidate(),this._scheduleVirtualWindowSync())}}_detachFixedChromeResize(){this._fixedChromeResizeObserver?.disconnect(),this._fixedChromeResizeObserver=null,this.style.removeProperty(`--mint-rt-fixed-controls-h`)}_syncFixedControlsChromeHeight(){if(!this._fixedHeader()||!this._fixedControls())return;this._fixedChromeResizeObserver?.disconnect(),this._fixedChromeResizeObserver=null;let e=this.querySelector(`#mint-rt-fixed-controls-${this._tableId}`);if(!e)return;let t=()=>{let t=Math.ceil(e.getBoundingClientRect().height);this.style.setProperty(`--mint-rt-fixed-controls-h`,`${t}px`)};t(),this._fixedChromeResizeObserver=new ResizeObserver(t),this._fixedChromeResizeObserver.observe(e)}_attachVirtualScrollListeners(){if(this._detachVirtualScroll(),!this._virtualScrollActive())return;let e=()=>{this._scheduleVirtualWindowSync()};this._virtualScrollHandler=e,this._virtualScrollRoot()===`table-body`?(this._virtualBodyScrollEl=this.querySelector(`#mint-rt-vscroll-${this._tableId}`),this._virtualBodyScrollEl?.addEventListener(`scroll`,e,{passive:!0}),this._virtualBodyScrollEl&&typeof ResizeObserver<`u`&&(this._virtualResizeObserver=new ResizeObserver(()=>this._scheduleVirtualWindowSync()),this._virtualResizeObserver.observe(this._virtualBodyScrollEl))):window.addEventListener(`scroll`,e,{passive:!0}),this._virtualWindowResizeHandler=()=>this._scheduleVirtualWindowSync(),window.addEventListener(`resize`,this._virtualWindowResizeHandler,{passive:!0}),this._scheduleVirtualWindowSync()}_toggleSort(e){if(!this._configuration||!e.data||!e.sortable)return;let t=e.data;if(this._sortTimeoutId!==null&&(clearTimeout(this._sortTimeoutId),this._sortTimeoutId=null),this._sorting=!0,this._sortingColumn=e,this._updateSortIcons(),this._type===`ajax`)this._sortTimeoutId=window.setTimeout(()=>{if(this._sortTimeoutId=null,!this._configuration||!t||!e.sortable)return;let n=this._configuration.sort||`asc`;this._configuration.sortBy?.toLowerCase()===t.toLowerCase()&&(n=n===`desc`?`asc`:`desc`),this._configuration.sort=n,this._configuration.sortBy=t,this._updateSortIcons(),this._offset=0,this._currentPage=1,this._fetching=!1,this._loading=!1,this._fetchData(void 0,!1,this._perPage,0)},10);else{let e=this._configuration.sort||`asc`;this._configuration.sortBy?.toLowerCase()===t.toLowerCase()&&(e=e===`desc`?`asc`:`desc`),this._configuration.sort=e,this._configuration.sortBy=t,this._currentPage=1,this._sorting=!1,this._sortingColumn=null,this._updateSortIcons(),this.render(),this._virtualScrollActive()&&queueMicrotask(()=>this._scrollVirtualTableTopIntoView())}}_getSortClass(e){return this._sorting&&this._sortingColumn===e?`spinner`:this._configuration?.sortBy?.toLowerCase()===e.data?.toLowerCase()?this._configuration?.sort?.toLowerCase()===`desc`?`caret-down`:`caret-up`:``}_updateSortIcons(){if(!this._configuration)return;this._configuration.columns.forEach((e,t)=>{if(!e.sortable||e.hidden)return;let n=this.querySelector(`th[data-column-key="${t}"]`);if(!n)return;let r=n.querySelector(`:scope > div.flex.items-center`);if(!r)return;let i=r.querySelector(`:scope > div.ml-2.flex.items-center`),a=this._getSortClass(e),o=()=>{if(!i){let e=document.createElement(`div`);e.className=`ml-2 flex items-center`,r.appendChild(e),i=e}return i},s=()=>{i&&=(i.remove(),null)};if(a===`spinner`){let e=o();if(e.querySelector(`mint-icon`)?.remove(),!e.querySelector(`mint-spinner`)){let t=document.createElement(`mint-spinner`);t.className=`w-4 h-4`,e.appendChild(t)}}else if(a===`caret-up`||a===`caret-down`){let e=o();e.querySelector(`mint-spinner`)?.remove();let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a),t.className=`w-4 h-4`}else s()}),this._syncMobileSortPopoverIcons();let e=this.querySelector(`#mint-rt-mobile-sort-btn-${this._tableId}`);e&&(e.setAttribute(`icon`,this._getMobileSortTriggerIconName()),this._sorting?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`),typeof e.render==`function`&&e.render())}_showFetchingState(){}_triggerSearch(){this._searchTimeoutId&&clearTimeout(this._searchTimeoutId),this._searching=!0,this._type===`ajax`&&this._updateSearchIcon(),this._type!==`ajax`&&(this._currentPage=1),this._updateTableBody(),this._type!==`ajax`&&this._updatePagination(),this._searchTimeoutId=window.setTimeout(()=>{this._type===`ajax`?(this._offset=0,this._fetchData(void 0,!1,this._perPage,0)):(this._searching=!1,this._virtualScrollActive()&&queueMicrotask(()=>this._scrollVirtualTableTopIntoView()))},400)}_updateSearchIcon(){let e=this.querySelector(`#search-${this._tableId}`);if(!e)return;let t=this._type===`ajax`&&(this._searching||this._fetching);setTimeout(()=>{let n=e.querySelector(`.relative`)||e.querySelector(`div`);if(!n)return;let r=n.querySelector(`mint-icon`),i=n.querySelector(`mint-spinner`);if(t){if(r&&!i){let e=document.createElement(`mint-spinner`);e.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none`,r.replaceWith(e)}else if(!r&&!i){let e=document.createElement(`mint-spinner`);e.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none`,n.appendChild(e)}}else if(i){e.getAttribute(`icon`)||e.setAttribute(`icon`,`search`);let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`search`),t.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none`,i.replaceWith(t)}},0)}_updateTableBody(){if(!this._configuration)return;let e=this.querySelector(`tbody[data-mint-rt-tbody="${this._tableId}"]`),t=this.querySelector(`#${this._tableId}`)?.closest(`table`)?.querySelector(`tbody`);if(this._virtualScrollActive()&&(this._type===`provided`||this._type===`ajax`)){if(!(e||t)){this.render();return}let n=this.querySelector(`#search-${this._tableId}`),r=document.activeElement===n||n?.querySelector(`input`)===document.activeElement,i=this._search;if((this._fetching||this._loading)&&!this._loaded&&!this._sorting)return;if(this._virtualInvalidate(),this._syncVirtualWindow(),r&&n){let e=n.querySelector(`input`)||n._element;e?(e.value=i,setTimeout(()=>{e.focus(),e.setSelectionRange(i.length,i.length)},0)):n.value!==void 0&&(n.value=i,setTimeout(()=>{n.focus()},0))}return}let n=this._getRows(),r=t;if(!r){this.render();return}let i=this.querySelector(`#search-${this._tableId}`),a=document.activeElement===i||i?.querySelector(`input`)===document.activeElement,o=this._search,s=``,c=``;if((this._fetching||this._loading)&&!this._loaded&&!this._sorting)return;n.forEach((e,t)=>{c+=this._buildMobileListItemHtml(e,t,void 0,t===n.length-1);let r=typeof this._configuration.onRowClick==`function`,i=r?`cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800`:``;s+=`<tr data-row-index="${t}" ${r?`data-row-clickable="true"`:``}${i?` class="${i}"`:``}>`,this._configuration.columns.forEach(n=>{if(n.hidden)return;let r=!n.show||n.show(this,e);s+=`<td style="${this._getStyle(n)}" class="${this._getClasses(n,!0)}">`,r&&(s+=this._buildTableCellInnerHtml(n,e,t,`table`)),s+=`</td>`}),s+=`</tr>`}),n.length===0&&(this._fetchError?(s+=`<tr><td colspan="${this._configuration.columns.filter(e=>!e.hidden).length}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`,c+=`<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`):(s+=`<tr><td colspan="${this._configuration.columns.filter(e=>!e.hidden).length}" class="text-center py-8">No records found.</td></tr>`,c+=`<li class="list-none px-4 py-8 text-center text-sm">No records found.</li>`)),r.innerHTML=s;let l=this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`);if(l&&(l.innerHTML=c),this._attachTableEventListeners(),this._attachRowClickHandler(),a&&i){let e=i.querySelector(`input`)||i._element;e?(e.value=o,setTimeout(()=>{e.focus(),e.setSelectionRange(o.length,o.length)},0)):i.value!==void 0&&(i.value=o,setTimeout(()=>{i.focus()},0))}}_updatePagination(){if(!this._configuration)return;let e=this._lastPage||Math.ceil(this._rows.length/this._perPage),t=()=>{let e=this.querySelector(`mint-table`),t=e?.nextElementSibling;e&&t&&t.id!==`mint-rt-pagination-host-${this._tableId}`&&!t.classList.contains(`mint-rt-pagination-host`)&&t.querySelector?.(`[data-action="page"]`)&&t.remove()};if(!this._configuration.perPage||e<=1||this._virtualScrollActive()){this._getPaginationHostEl()?.replaceChildren(),t();return}let n=this._getPaginationHostEl();if(!n){let e=this.querySelector(`[data-mint-rt-mobile-list="${this._tableId}"]`)||this.querySelector(`mint-table`);if(!e){this.render();return}n=document.createElement(`div`),n.id=`mint-rt-pagination-host-${this._tableId}`,n.setAttribute(`data-mint-rt-pagination-wrap`,``),n.className=`mint-rt-pagination-host w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain flex justify-center [-webkit-overflow-scrolling:touch] md:justify-end `+(this._inMintCard?`border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider md:border-t-0 md:pt-0`:`border-t border-gray-200 px-2 py-3 dark:border-mint-divider md:border-t-0 md:py-0 md:mt-4`),e.insertAdjacentElement(`afterend`,n)}let r=this._buildPaginationNavMarkup(e);n.innerHTML=r,setTimeout(()=>{this._attachPaginationListeners(),n.querySelectorAll(`mint-button[data-action="page"]`).forEach(e=>{let t=e.getAttribute(`data-page`),n=t&&this._loadingPage===parseInt(t),r=e._button||e.querySelector(`button`);if(r)if(n){let e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null),n;for(;n=t.nextNode();)e.push(n);e.forEach(e=>e.parentNode?.removeChild(e));let i=r.querySelector(`.mint-button-content`);if(i){let e=i.textContent?.trim();e&&/^\d+$/.test(e)&&i.remove()}let a=r.querySelector(`span.mr-2`);a&&a.querySelector(`mint-spinner`)&&(a.classList.remove(`mr-2`),a.classList.add(`mr-0`))}else{let e=r.textContent?.trim();if(!e||!/^\d+$/.test(e)){let e=t||``,n=r.querySelector(`mint-spinner`);r.innerHTML=``,n&&r.appendChild(n),r.appendChild(document.createTextNode(e))}}if(`render`in e&&typeof e.render==`function`&&(e.render(),n&&r)){let e=r.querySelector(`span.mr-2`);e&&e.querySelector(`mint-spinner`)&&(e.classList.remove(`mr-2`),e.classList.add(`mr-0`))}}),n.querySelectorAll(`mint-button[data-action="page-prev"], mint-button[data-action="page-next"]`).forEach(e=>{`render`in e&&typeof e.render==`function`&&e.render()}),this._loadingPage!==null&&!this._loading&&!this._fetching&&this._updatePagination()},0)}_goToPage(e){let t=this._lastPage||Math.ceil(this._rows.length/this._perPage);e>t&&(e=t),e<1&&(e=1),e!==this._currentPage&&(this._currentPage=e,this._offset=(e-1)*this._perPage,this._updatePageInUrl(e),this._type===`ajax`?(this._loadingPage=e,this._updatePagination(),this._fetchData()):this.render())}_handleButtonClick(e){if(this._configuration)switch(e.type){case`export`:break;case`print`:window.print();break;case`csv`:this._downloadCSV();break;default:e.onClick&&e.onClick(this);break}}_downloadCSV(){if(!this._configuration)return;let e=this.querySelector(`#${this._tableId}`)||this.querySelector(`table`);if(!e)return;let t=`data:text/csv;charset=utf-8,`,n=e=>{let n=[];e.querySelectorAll(`th, td`).forEach(e=>{let t=e.getAttribute(`colspan`);if(t)for(let e=0;e<parseInt(t,10)-1;e++)n.push(``);n.push(`"`+e.textContent?.trim().replace(/"/g,`""`)+`"`)}),t+=n.join(`,`)+`
|
|
87
|
-
`};e.querySelectorAll(`tr`).forEach(e=>n(e));let r=encodeURI(t),i=document.createElement(`a`);i.setAttribute(`href`,r),i.setAttribute(`download`,`${this._configuration.export_name||this._tableId}.csv`),document.body.appendChild(i),i.click(),document.body.removeChild(i)}_getStyle(e){let t=``;return(e.nowrap||e.actions)&&(t+=`white-space: nowrap;`),e.offsetLeft&&(t+=`left: ${e.offsetLeft} !important;`),e.offsetRight&&(t+=`right: ${e.offsetRight} !important;`),e.width&&(t+=`min-width: ${e.width}px; max-width: ${e.width}px;`),t}_getClasses(e,t=!1){let n=[];return e.class&&n.push(e.class.trim()),e.sortable&&!t&&n.push(`cursor-pointer`),e.stickLeft&&n.push(`sticky-left`),e.stickRight&&n.push(`sticky-right`),n.join(` `)}_renderTheadHtml(e,t,n=!1,r=!1){if(!this._configuration)return``;let i=[`bg-white`,`dark:bg-mint-nav`];e&&(i.push(`sticky`,`z-30`),r?i.push(`top-[var(--mint-rt-fixed-controls-h,0px)]`):i.push(`top-0`)),t&&i.push(`border-b`,`border-gray-200`,`dark:border-mint-divider`);let a=`<thead class="${i.join(` `)}"><tr>`;return this._configuration.columns.forEach((e,t)=>{if(e.hidden)return;let r=n?``:` width="${e.width||``}"`,i=e.sortable?` data-mint-rt-sortable=""`:``;if(a+=`<th${r} style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${i}>`,e.showLabel!==!1){if(a+=`<div class="flex items-center">`,a+=`<div class="flex-1">${e.raw?e.label:this._escapeHtml(e.label)}</div>`,e.sortable){let t=this._getSortClass(e);t===`spinner`?a+=`<div class="ml-2 flex items-center"><mint-spinner class="w-4 h-4"></mint-spinner></div>`:(t===`caret-up`||t===`caret-down`)&&(a+=`<div class="ml-2 flex items-center"><mint-icon name="${t}" class="w-4 h-4"></mint-icon></div>`)}a+=`</div>`}a+=`</th>`}),a+=`</tr></thead>`,a}render(){if(!this._configuration){this.innerHTML=`<div class="p-4 text-red-500">Error: Invalid configuration</div>`;return}this._ensureMobileListMql();let e=String(this._configuration.id||``).trim();e&&(this.id=e),this._detachVirtualScroll(),this._detachFixedChromeResize(),this._virtualScrollActive()||this._virtualRowCache.clear();let t=!this._loaded||this._rows.length>0||this._search.length>0||this._searching,n=this._getRows();this._lastPage||Math.ceil(this._rows.length/this._perPage);let r=this._isExternalLoading(),i=``;if(t){let e=this._fixedControls(),t=[`flex`,`items-center`,`min-w-0`,this._inMintCard?`p-3.5`:`mb-3`,e?`sticky top-0 z-20 bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider`:``].filter(Boolean).join(` `);if(i+=`<div id="mint-rt-fixed-controls-${this._tableId}" class="${t}">`,i+=`<div class="flex min-w-0 flex-1 items-center gap-2">`,i+=this._buildMobileSortToolbarHtml(),this._configuration.showSearch!==!1){let e=`search-${this._tableId}`,t=this._escapeHtml(this._configuration.searchPlaceholder||`Search...`);i+=`<mint-input id="${e}" type="search" label="" placeholder="${t}" class="min-w-0 flex-1" icon="search" value="${this._escapeHtml(this._search)}"></mint-input>`}i+=`<div class="hidden shrink-0 items-center gap-2 md:flex">`,this._configuration.buttons&&this._configuration.buttons.forEach(e=>{let t=e.icon?` icon="${this._escapeHtml(e.icon)}"`:``,n=e.tone?` tone="${this._escapeHtml(e.tone)}"`:``;i+=`<mint-button variant="solid" class="${e.class||``}" data-button-type="${e.type||`custom`}"${t}${n}>`,e.label&&(i+=this._escapeHtml(e.label)),i+=`</mint-button>`}),i+=`</div>`,i+=`</div>`,i+=`</div>`}if((this._type===`ajax`&&!this._loaded||this._type===`provided`&&r)&&!this._fetchError&&!this._sorting){let e=this._fixedHeader()?` data-mint-rt-scroll-inner=""`:``,t=this._fixedHeader()&&this._fixedControls(),n=this._fixedHeader()?t?`sticky top-[var(--mint-rt-fixed-controls-h,0px)] z-30 `:`sticky top-0 z-30 `:`sticky top-0 z-10 `;i+=`<div class="min-w-0">`,i+=`<mint-table class="table-section`+(this._inMintCard?` rounded-t-none`:``)+`"`+e+`>`,i+=`<table id="${this._tableId}">`,i+=`<thead class="`+n+`bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider"><tr>`,this._configuration.columns.forEach((e,t)=>{if(e.hidden)return;let n=e.sortable?` data-mint-rt-sortable=""`:``;if(i+=`<th width="${e.width||``}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${n}>`,e.showLabel!==!1){if(i+=`<div class="flex items-center">`,i+=`<div class="flex-1">${e.raw?e.label:this._escapeHtml(e.label)}</div>`,e.sortable){let t=this._getSortClass(e);t===`spinner`?i+=`<div class="ml-2 flex items-center"><mint-spinner class="w-4 h-4"></mint-spinner></div>`:(t===`caret-up`||t===`caret-down`)&&(i+=`<div class="ml-2 flex items-center"><mint-icon name="${t}" class="w-4 h-4"></mint-icon></div>`)}i+=`</div>`}i+=`</th>`}),i+=`</tr></thead>`,i+=`<tbody>`;for(let e=0;e<4;e++)i+=`<tr>`,this._configuration.columns.forEach(e=>{if(!e.hidden){if(i+=`<td style="${this._getStyle(e)}" class="${this._getClasses(e,!0)}">`,e.thumbnail){let t=this._thumbnailDesktopPx(e);i+=`<div class="rounded-md bg-gray-200 dark:bg-white/15 animate-pulse" style="width:${t}px;height:${t}px;box-sizing:border-box"></div>`}else i+=`<div class="h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15 animate-pulse"></div>`;i+=`</td>`}}),i+=`</tr>`;i+=`</tbody>`,i+=`</table>`,i+=`</mint-table>`,i+=`</div>`,i+=this._paginationHostPlaceholderHtml()}else if(n.length>0||this._search.length>0||this._searching||this._fetchError){let e=this._virtualScrollActive()&&(this._type===`provided`||this._type===`ajax`&&this._loaded&&!this._fetchError),t=e&&this._virtualScrollRoot()===`table-body`,a=this._escapeHtml(this._virtualMaxHeightCss()),o=t||this._fixedHeader(),s=this._fixedHeader()&&this._fixedControls(),c=o?` data-mint-rt-scroll-inner=""`:``,l=`table-section`+(this._inMintCard?` rounded-t-none`:``),u=`m-0 min-h-0 w-full list-none border-collapse overflow-x-hidden bg-white ${this._inMintCard?`px-3.5 py-3.5`:`py-3`} dark:bg-mint-canvas md:hidden`,d=``;if(t){let e=this._renderColgroupHtml();i+=`<div id="mint-rt-vscroll-${this._tableId}" class="overflow-y-auto overflow-x-auto min-h-0 w-full" style="max-height: ${a}; scrollbar-gutter: stable; overscroll-behavior-x: contain; overscroll-behavior-y: none; overflow-anchor: none;">`,i+=`<div class="hidden min-h-0 min-w-0 md:block">`,i+=`<mint-table class="${l}"${c}>`,i+=`<table id="${this._tableId}" class="w-full min-w-0 table-fixed">`,i+=e,i+=this._renderTheadHtml(!0,!0,!0,s)}else i+=`<div class="hidden min-h-0 min-w-0 md:block">`,i+=`<mint-table class="${l}"${c}>`,i+=`<table id="${this._tableId}">`,e&&(i+=this._renderColgroupHtml()),i+=this._renderTheadHtml(!0,!0,!!e,s);if(i+=`<tbody`+(e?` data-mint-rt-tbody="${this._tableId}"`:``)+`>`,!this._fetching&&!this._loading&&!r&&!e&&n.forEach((e,t)=>{d+=this._buildMobileListItemHtml(e,t,void 0,t===n.length-1);let r=typeof this._configuration.onRowClick==`function`,a=r?`cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated`:``;i+=`<tr data-row-index="${t}" ${r?`data-row-clickable="true"`:``}${a?` class="${a}"`:``}>`,this._configuration.columns.forEach(n=>{if(n.hidden)return;let r=!n.show||n.show(this,e);i+=`<td style="${this._getStyle(n)}" class="${this._getClasses(n,!0)}">`,r&&(i+=this._buildTableCellInnerHtml(n,e,t,`table`)),i+=`</td>`}),i+=`</tr>`}),!this._fetching&&!this._loading&&!r&&n.length===0&&!e)if(this._fetchError){let e=this._configuration.columns.filter(e=>!e.hidden).length;i+=`<tr><td colspan="${e}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`,d+=`<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`}else{let e=this._configuration.columns.filter(e=>!e.hidden).length;i+=`<tr><td colspan="${e}" class="text-center py-8">No records found.</td></tr>`,d+=`<li class="list-none px-4 py-8 text-center text-sm">No records found.</li>`}i+=`</tbody>`,i+=`</table>`,i+=`</mint-table>`,i+=`</div>`,i+=`<ul class="${u}" data-mint-rt-mobile-list="${this._tableId}">${e?``:d}</ul>`,e||(i+=this._paginationHostPlaceholderHtml()),t&&(i+=`</div>`)}else i+=`<slot name="empty"></slot>`;this._fixedHeader()?this.setAttribute(`data-mint-rt-fixed-header`,``):this.removeAttribute(`data-mint-rt-fixed-header`),this._fixedControls()?this.setAttribute(`data-mint-rt-fixed-controls`,``):this.removeAttribute(`data-mint-rt-fixed-controls`),this.innerHTML=i,this._updatePagination(),this.querySelectorAll(`mint-button[data-action]`).forEach(e=>{e.render&&e.render()}),this.querySelectorAll(`mint-button[data-mint-rt-toolbar]`).forEach(e=>{e.render&&e.render()}),this.querySelectorAll(`mint-button[data-button-type]`).forEach(e=>{e.render&&e.render()}),this._attachEventListeners(),this._type===`ajax`&&!this._loaded&&!this._fetching&&!this._loading&&this._fetchData()}_attachRowClickHandler(){this._rowClickHandler&&this.removeEventListener(`click`,this._rowClickHandler,!0);let e=e=>{let t=e.target;if(t.tagName===`MINT-BUTTON`||t.tagName===`BUTTON`||t.closest(`mint-button`)||t.closest(`button`)||t.closest(`mint-popover`)||t.closest(`[data-action]`))return;let n=t.closest(`tr[data-row-clickable="true"]`)||t.closest(`li[data-row-clickable="true"]`);if(!n)return;let r=n.getAttribute(`data-row-index`);if(!r)return;let i=parseInt(r),a=this._getRowDataForEventIndex(i);!a||!this._configuration?.onRowClick||(this._configuration.onRowClick.length===1?this._configuration.onRowClick(a):this._configuration.onRowClick(this,a))};this.addEventListener(`click`,e,!0),this._rowClickHandler=e}_attachPaginationListeners(){this.querySelectorAll(`[data-action="page"]`).forEach(e=>{e.addEventListener(`click`,()=>{if(e.getAttribute(`active`)===`true`)return;let t=parseInt(e.getAttribute(`data-page`)||`1`);t!==this._currentPage&&this._goToPage(t)})}),this.querySelectorAll(`[data-action="page-prev"]`).forEach(e=>{e.addEventListener(`click`,()=>{this._goToPage(this._currentPage-1)})}),this.querySelectorAll(`[data-action="page-next"]`).forEach(e=>{e.addEventListener(`click`,()=>{this._goToPage(this._currentPage+1)})})}_attachTableEventListeners(){this.querySelectorAll(`[data-action="row-action"]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=parseInt(e.getAttribute(`data-row-index`)||`0`),n=parseInt(e.getAttribute(`data-action-index`)||`0`),r=parseInt(e.getAttribute(`data-column-key`)||`0`),i=this._getRowDataForEventIndex(t),a=this._configuration?.columns[r];a&&a.actions&&a.actions[n]&&i!==void 0&&a.actions[n].onClick(this,i)})}),this.querySelectorAll(`[data-action="column-action"]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=parseInt(e.getAttribute(`data-row-index`)||`0`),n=parseInt(e.getAttribute(`data-column-key`)||`0`),r=this._getRowDataForEventIndex(t),i=this._configuration?.columns[n];i&&i.action&&r!==void 0&&i.action.onClick(this,r)})})}_attachEventListeners(){let e=this.querySelector(`#search-${this._tableId}`);if(e){let t=e.querySelector(`input`)||e._element;t?t.addEventListener(`input`,e=>{this._search=e.target.value,this._triggerSearch()}):e.addEventListener(`input`,t=>{this._search=e.value||t.target.value||``,this._triggerSearch()})}this._attachTableEventListeners(),this._attachRowClickHandler(),this.querySelectorAll(`th[data-column-key]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=parseInt(e.getAttribute(`data-column-key`)||`0`),n=this._configuration?.columns[t];n&&this._toggleSort(n)})}),this.querySelectorAll(`[data-action="mobile-sort"]`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation();let n=parseInt(e.getAttribute(`data-column-key`)||`0`,10),r=this._configuration?.columns[n];r&&(this._closeMobileSortPopover(),this._toggleSort(r))})}),this.querySelectorAll(`[data-button-type]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-button-type`),n=this._configuration?.buttons?.find(e=>(e.type||`custom`)===t);n&&this._handleButtonClick(n)})}),this._attachPaginationListeners(),this._virtualScrollActive()&&(this._type===`provided`||this._type===`ajax`)&&this._attachVirtualScrollListeners(),this._fixedHeader()&&this._fixedControls()&&queueMicrotask(()=>{this._syncFixedControlsChromeHeight(),requestAnimationFrame(()=>this._syncFixedControlsChromeHeight())})}_escapeHtml(e){let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}_getPageFromUrl(){if(!this._tableId)return null;let e=new URLSearchParams(window.location.search).get(`mui.${this._tableId}`);if(!e)return null;let t=parseInt(e,10);return isNaN(t)||t<1?null:t}_updatePageInUrl(e){if(!this._tableId)return;let t=new URL(window.location.href),n=t.searchParams;n.set(`mui.${this._tableId}`,e.toString()),e===1&&n.set(`mui.${this._tableId}`,`1`),window.history.replaceState({},``,t.toString())}_loadPageFromUrl(){if(!this._configuration||!this._tableId)return;let e=this._getPageFromUrl();e!==null&&(this._currentPage=e,this._offset=(this._currentPage-1)*this._perPage)}};customElements.get(`mint-resource-table`)||customElements.define(`mint-resource-table`,te);var ne=550,re=12,ie={passive:!0},ae=class extends HTMLElement{constructor(...e){super(...e),this._table=null,this._anchor=null,this._popover=null,this._menuRoot=null,this._baseId=``,this._touchTimer=null,this._touchStart=null,this._slotObserver=null,this._scrollCloseTargets=[],this._onScrollClose=()=>{this._closePopover()},this._onContextMenu=e=>{let t=e,n=this._rowTargetFromEventTarget(t.target);n&&(t.preventDefault(),this._openAtRowIndex(n.index,t.clientX,t.clientY))},this._onTouchStart=e=>{let t=e;if(!t.touches.length)return;let n=this._rowTargetFromEventTarget(t.target);if(!n)return;let r=t.touches[0];this._touchStart={x:r.clientX,y:r.clientY,rowIndex:n.index},this._touchTimer!==null&&(window.clearTimeout(this._touchTimer),this._touchTimer=null);let i=this._longPressMs();this._touchTimer=window.setTimeout(()=>{this._touchTimer=null,this._touchStart&&=(this._openAtRowIndex(this._touchStart.rowIndex,this._touchStart.x,this._touchStart.y),null)},i)},this._onTouchMove=e=>{if(!this._touchStart||this._touchTimer===null)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this._touchStart.x,r=t.clientY-this._touchStart.y;n*n+r*r>re*re&&(this._clearTouchTimer(),this._touchStart=null)},this._onTouchEnd=()=>{this._clearTouchTimer(),this._touchStart=null}}static get observedAttributes(){return[`for`,`long-press-ms`]}connectedCallback(){this.classList.add(`contents`),this._baseId=this.id?.trim()||`mint-rt-ctx-${Math.random().toString(36).slice(2,10)}`,this._anchor=document.createElement(`div`),this._anchor.id=`${this._baseId}-anchor`,this._anchor.setAttribute(`aria-hidden`,`true`),this._anchor.className=`pointer-events-none fixed z-0 h-px w-px overflow-hidden p-0 m-0 border-0 opacity-0`,document.body.appendChild(this._anchor),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`data-mint-rt-ctx-internal`,``),this._popover.id=`${this._baseId}-popover`,this._popover.setAttribute(`trigger-id`,this._anchor.id),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),this._menuRoot=document.createElement(`div`),this._menuRoot.className=`flex min-w-[11rem] flex-col gap-0.5 py-1`,this._popover.appendChild(this._menuRoot),this.appendChild(this._popover),this._slotObserver=new MutationObserver(()=>{this._hideMenuSlotSources()}),this._slotObserver.observe(this,{childList:!0}),queueMicrotask(()=>{this._hideMenuSlotSources(),this._bindTable()})}disconnectedCallback(){this._slotObserver?.disconnect(),this._slotObserver=null,this._unbindTable(),this._anchor?.remove(),this._anchor=null,this._popover?.remove(),this._popover=null,this._menuRoot=null}attributeChangedCallback(){this.isConnected&&this._bindTable()}_longPressMs(){let e=parseInt(this.getAttribute(`long-press-ms`)||``,10);return!Number.isNaN(e)&&e>100?e:ne}_resolveTable(){let e=this.getAttribute(`for`)?.trim();if(e){let t=document.getElementById(e);return t&&t.tagName===`MINT-RESOURCE-TABLE`?t:null}let t=this.previousElementSibling;return t&&t.tagName===`MINT-RESOURCE-TABLE`?t:this.parentElement?.querySelector?.(`mint-resource-table`)??null}_hideMenuSlotSources(){for(let e of Array.from(this.children))e===this._popover||e.hasAttribute(`data-mint-rt-ctx-internal`)||e.setAttribute(`hidden`,``)}_bindTable(){this._unbindTable(),this._table=this._resolveTable(),this._table&&(this._table.addEventListener(`contextmenu`,this._onContextMenu,!0),this._table.addEventListener(`touchstart`,this._onTouchStart,{passive:!0}),this._table.addEventListener(`touchmove`,this._onTouchMove,{passive:!0}),this._table.addEventListener(`touchend`,this._onTouchEnd,{passive:!0}),this._table.addEventListener(`touchcancel`,this._onTouchEnd,{passive:!0}))}_unbindTable(){this._closePopover(),this._table&&=(this._table.removeEventListener(`contextmenu`,this._onContextMenu,!0),this._table.removeEventListener(`touchstart`,this._onTouchStart),this._table.removeEventListener(`touchmove`,this._onTouchMove),this._table.removeEventListener(`touchend`,this._onTouchEnd),this._table.removeEventListener(`touchcancel`,this._onTouchEnd),null)}_rowTargetFromEventTarget(e){if(!e||!this._table)return null;let t=e.closest?.(`tr[data-row-index], li[data-row-index]`);if(!t||!this._table.contains(t)||t.hasAttribute(`data-mint-rt-spacer`)||t.getAttribute(`data-mint-rt-placeholder`)===`true`)return null;let n=t.getAttribute(`data-row-index`);if(n==null)return null;let r=parseInt(n,10);return Number.isNaN(r)?null:{index:r}}_clearTouchTimer(){this._touchTimer!==null&&(window.clearTimeout(this._touchTimer),this._touchTimer=null)}_positionAnchor(e,t){this._anchor&&(this._anchor.style.left=`${Math.round(e)}px`,this._anchor.style.top=`${Math.round(t)}px`)}_slotTemplateElements(){return Array.from(this.children).filter(e=>e!==this._popover&&e instanceof HTMLElement&&!e.hasAttribute(`data-mint-rt-ctx-internal`))}_elementIsScrollContainer(e){let t=getComputedStyle(e);return t.overflowX===`auto`||t.overflowX===`scroll`||t.overflowY===`auto`||t.overflowY===`scroll`}_collectScrollCloseTargets(e){let t=[],n=new Set,r=e=>{!e||n.has(e)||(n.add(e),t.push(e))};r(window),e.querySelectorAll(`[id^="mint-rt-vscroll-"]`).forEach(e=>{this._elementIsScrollContainer(e)&&r(e)});let i=e.querySelector(`mint-table`);for(;i&&i!==e;)this._elementIsScrollContainer(i)&&r(i),i=i.parentElement;return this._elementIsScrollContainer(e)&&r(e),t}_detachScrollCloseListeners(){for(let e of this._scrollCloseTargets)e.removeEventListener(`scroll`,this._onScrollClose,ie);this._scrollCloseTargets=[]}_attachScrollCloseListeners(e){this._detachScrollCloseListeners(),this._scrollCloseTargets=this._collectScrollCloseTargets(e);for(let e of this._scrollCloseTargets)e.addEventListener(`scroll`,this._onScrollClose,ie)}_closePopover(){if(this._detachScrollCloseListeners(),!this._popover?.hasAttribute(`open`))return;let e=this._popover;typeof e.close==`function`?e.close():this._popover.removeAttribute(`open`)}_openAtRowIndex(e,t,n){this._closePopover();let r=this._resolveTable();if(!r||typeof r.getRowByIndex!=`function`||!this._popover||!this._menuRoot)return;let i=this._popover,a=this._menuRoot,o=r.getRowByIndex(e);if(o===void 0)return;let s=this._slotTemplateElements();if(!s.length)return;this._positionAnchor(t,n),a.innerHTML=``,s.forEach(t=>{if(t.hasAttribute(`data-mint-rt-ctx-if-selection`)&&!(window.getSelection?.()?.toString?.()?.trim()??``))return;let n=t.cloneNode(!0);n.removeAttribute(`hidden`),n.addEventListener(`click`,t=>{t.stopPropagation();let r=n.getAttribute(`data-context-action`)||n.querySelector?.(`[data-context-action]`)?.getAttribute(`data-context-action`)||``,i=window.getSelection?.()?.toString?.()?.trim()??``;this.dispatchEvent(new CustomEvent(`context-action`,{bubbles:!0,composed:!0,detail:{action:r,row:o,rowIndex:e,selectedText:i}})),this._closePopover()}),a.appendChild(n);let r=n;typeof r.render==`function`&&queueMicrotask(()=>r.render())}),i.removeAttribute(`open`),i.offsetHeight,i.setAttribute(`open`,`true`);let c=i;typeof c.render==`function`&&queueMicrotask(()=>c.render());let l=this._resolveTable();l&&this._attachScrollCloseListeners(l)}};customElements.get(`mint-resource-table-context-menu`)||customElements.define(`mint-resource-table-context-menu`,ae);var oe=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`position`,`full-page`,`width`,`height`]}constructor(){super(),this._overlay=null,this._offCanvas=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null,this._contentObserver=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`inset-0`,`z-50`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._observeDarkMode(),this._observeContentMutations()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getPosition(){let e=this.getAttribute(`position`)?.toLowerCase();return e===`top`||e===`bottom`||e===`left`||e===`right`?e:`right`}isFullPage(){return this.getAttribute(`full-page`)===`true`}getWidth(){return this.getAttribute(`width`)||`320px`}getHeight(){return this.getAttribute(`height`)||``}_normalizeCssValue(e){return/^\d+(\.\d+)?$/.test(e.trim())?`${e.trim()}px`:e.trim()}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getPosition(),i=this.isFullPage(),a=this.getHeight();e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`fixed inset-0 bg-black/50 transition-opacity duration-200 z-40`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._offCanvas||(this._offCanvas=document.createElement(`div`),this.appendChild(this._offCanvas));let o=this._getPositionClasses(r,i);this._offCanvas.className=o;let s=this._offCanvas.querySelector(`.off-canvas-content`);if(s||(s=document.createElement(`div`),s.className=`off-canvas-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider shadow-xl flex flex-col pointer-events-auto`,s.style.transform=this._getTransformValue(r,!1),this._offCanvas.appendChild(s)),n?this._animateEnter():this._animateExit(),Array.from(s.classList).forEach(e=>{(e.startsWith(`w-`)||e.startsWith(`max-w-`)||e.startsWith(`md:w-`)||e.startsWith(`md:max-w-`)||e.startsWith(`sm:w-`)||e.startsWith(`sm:max-w-`))&&s.classList.remove(e)}),s.classList.remove(`h-full`,`max-h-[90vh]`,`max-h-screen`,`md:h-full`,`md:max-h-[90vh]`,`md:max-h-screen`,`sm:h-full`,`sm:max-h-[90vh]`),s.classList.remove(`has-custom-width`,`has-custom-height`),s.style.removeProperty(`--off-canvas-width`),s.style.removeProperty(`--off-canvas-height`),i)s.classList.add(`w-full`,`h-full`,`max-w-none`);else if(r===`top`||r===`bottom`)if(s.classList.add(`w-full`,`h-full`,`max-w-none`),a){let e=this._normalizeCssValue(a);s.style.setProperty(`--off-canvas-height`,e),s.classList.add(`has-custom-height`),this._ensureHeightStyle()}else s.classList.add(`md:max-h-[90vh]`,`md:h-auto`);else{s.classList.add(`w-full`,`h-full`,`max-w-none`);let e=this.getWidth(),t=this._normalizeCssValue(e);s.style.setProperty(`--off-canvas-width`,t),s.classList.add(`has-custom-width`),this._ensureWidthStyle()}this._header||(this._header=document.createElement(`div`),this._header.className=`flex items-center justify-between p-4 border-b border-gray-200 dark:border-mint-divider flex-shrink-0`,s.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`flex-1`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let c=this._headingSlot.querySelector(`mint-text`);t?(c||(c=document.createElement(`mint-text`),c.setAttribute(`size`,`sub-heading`),c.setAttribute(`bold`,`true`),this._headingSlot.appendChild(c)),c.textContent=t):c&&c.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`flex-1 overflow-y-auto p-4`,this._bodySlot.setAttribute(`slot`,`body`),s.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`p-4 border-t border-gray-200 dark:border-mint-divider flex-shrink-0`,this._actionsSlot.setAttribute(`slot`,`actions`),s.appendChild(this._actionsSlot));let l=this._actionsSlot.querySelector(`mint-stack`);l||(l=document.createElement(`mint-stack`),l.setAttribute(`direction`,`horizontal`),l.className=`justify-end`,this._actionsSlot.appendChild(l)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==l&&l.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._offCanvas&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_getPositionClasses(e,t){let n=`fixed z-50 pointer-events-none`;switch(e){case`top`:return`${n} inset-0 md:inset-x-0 md:top-0 md:bottom-auto ${t?`md:h-full`:`md:h-auto`}`;case`bottom`:return`${n} inset-0 md:inset-x-0 md:bottom-0 md:top-auto ${t?`md:h-full`:`md:h-auto`}`;case`left`:return`${n} inset-0 md:inset-y-0 md:left-0 md:right-auto ${t?`md:w-full`:`md:w-auto`}`;case`right`:return`${n} inset-0 md:inset-y-0 md:right-0 md:left-auto ${t?`md:w-full`:`md:w-auto`}`;default:return`${n} inset-0 md:inset-y-0 md:right-0 md:left-auto ${t?`md:w-full`:`md:w-auto`}`}}_getTransformValue(e,t){if(t)switch(e){case`top`:return`translateY(0)`;case`bottom`:return`translateY(0)`;case`left`:return`translateX(0)`;case`right`:return`translateX(0)`;default:return`translateX(0)`}else switch(e){case`top`:return`translateY(-100%)`;case`bottom`:return`translateY(100%)`;case`left`:return`translateX(-100%)`;case`right`:return`translateX(100%)`;default:return`translateX(100%)`}}_updateBackgroundColor(){if(!this._offCanvas)return;let e=document.documentElement.classList.contains(`dark`),t=this._offCanvas.querySelector(`.off-canvas-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-mint-elevated`,`border`,`border-mint-divider`)):(t.classList.remove(`bg-mint-elevated`,`border`,`border-mint-divider`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_animateEnter(){let e=this._offCanvas?.querySelector(`.off-canvas-content`);if(!e)return;let t=this.getPosition();e.style.transform=this._getTransformValue(t,!1),e.style.transition=`transform 300ms ease-out`,this.classList.remove(`hidden`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=this._getTransformValue(t,!0)})})}_animateExit(){let e=this._offCanvas?.querySelector(`.off-canvas-content`);if(!e){this.classList.add(`hidden`);return}let t=this.getPosition();e.style.transition=`transform 300ms ease-in`,e.style.transform=this._getTransformValue(t,!1),setTimeout(()=>{this.classList.add(`hidden`),e.style.transform=``,e.style.transition=``},300)}_ensureWidthStyle(){if(!document.getElementById(`off-canvas-width-style`)){let e=document.createElement(`style`);e.id=`off-canvas-width-style`,e.textContent=`
|
|
88
|
-
@media (min-width: 768px) {
|
|
89
|
-
.off-canvas-content.has-custom-width {
|
|
90
|
-
width: min(var(--off-canvas-width), 100vw) !important;
|
|
91
|
-
max-width: 100% !important;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
`,document.head.appendChild(e)}}_ensureHeightStyle(){if(!document.getElementById(`off-canvas-height-style`)){let e=document.createElement(`style`);e.id=`off-canvas-height-style`,e.textContent=`
|
|
95
|
-
@media (min-width: 768px) {
|
|
96
|
-
.off-canvas-content.has-custom-height {
|
|
97
|
-
height: min(var(--off-canvas-height), 100vh) !important;
|
|
98
|
-
max-height: 100% !important;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
`,document.head.appendChild(e)}}};customElements.get(`mint-off-canvas`)||customElements.define(`mint-off-canvas`,oe);var N=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null}connectedCallback(){this.render(),this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){let e=this.isActive(),t=this.isDisabled();this.className=``,this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`inline-block`,`cursor-pointer`,`px-4`,`py-1.5`,`text-sm`,`font-medium`,`rounded-lg`,`border`,`text-gray-700`,`dark:text-gray-300`);let n=this.closest(`mint-tab-list`)?.getAttribute(`position`)||`top`,r=n===`left`||n===`right`;t?(this.classList.add(`opacity-60`,`cursor-not-allowed`,`pointer-events-none`,`bg-gray-50`,`dark:bg-mint-elevated`,`border-gray-300`,`dark:border-mint-divider`,`text-gray-400`,`dark:text-gray-500`),this.classList.remove(`cursor-pointer`)):e?(this.classList.add(`bg-white`,`dark:bg-mint-elevated`,`border-gray-200`,`dark:border-mint-divider`,`text-gray-900`,`dark:text-gray-100`,`shadow-sm`,`relative`,`z-10`),r?n===`left`?this.classList.add(`mr-[-1px]`):this.classList.add(`ml-[-1px]`):this.classList.add(`mb-[-1px]`)):this.classList.add(`bg-gray-100`,`dark:bg-mint-elevated`,`border-gray-200`,`dark:border-mint-divider`,`text-gray-600`,`dark:text-gray-400`,`hover:bg-gray-50`,`dark:hover:bg-mint-hover`)}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}e.__mintTabsSynthetic||(e.stopPropagation(),this.dispatchEvent(new CustomEvent(`tab-click`,{detail:{tab:this,target:this.getTarget()},bubbles:!0,cancelable:!0,composed:!0})))}};customElements.get(`mint-tab`)||customElements.define(`mint-tab`,N);var P=class extends HTMLElement{static get observedAttributes(){return[`position`]}constructor(){super()}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getPosition(){return this.getAttribute(`position`)||`top`}render(){let e=this.getPosition();this.classList.remove(`flex`,`inline-flex`,`flex-row`,`flex-col`,`gap-1`,`gap-2`,`pb-0`,`pr-0`,`pl-0`,`mb-0`,`mr-0`,`ml-0`,`self-start`),this.classList.add(`box-border`,`m-0`,`p-1`,`border`,`bg-gray-100`,`dark:bg-mint-elevated`,`dark:border-mint-divider`,`border-gray-200`,`w-auto`,`rounded-lg`,`gap-2`),e===`top`?this.classList.add(`inline-flex`,`flex-row`,`mb-0`,`self-start`):e===`left`?this.classList.add(`flex`,`flex-col`,`mr-0`):e===`right`&&this.classList.add(`flex`,`flex-col`,`ml-0`)}};customElements.get(`mint-tab-list`)||customElements.define(`mint-tab-list`,P);var F=class extends HTMLElement{static get observedAttributes(){return[`id`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.checkInitialVisibility()}attributeChangedCallback(e,t,n){t!==n&&e===`id`&&(this.render(),this.checkInitialVisibility())}getId(){return this.getAttribute(`id`)||``}show(){this.style.display=`block`}hide(){this.style.display=`none`}checkInitialVisibility(){let e=this.closest(`mint-tabs`);if(!e){this.style.display=`none`;return}let t=e.querySelectorAll(`mint-tab`),n=!1;t.forEach(e=>{let t=e.getAttribute(`active`),r=e.getAttribute(`target`),i=this.getId();t===`true`&&r===i&&(n=!0)}),!n&&t.length>0&&t[0].getAttribute(`target`)===this.getId()&&!e.querySelector(`mint-tab[active="true"]`)&&(n=!0),n?this.style.display=`block`:this.style.display=`none`}render(){}};customElements.get(`mint-tab-content`)||customElements.define(`mint-tab-content`,F);var I=class extends HTMLElement{constructor(){super(),this._tabClickHandler=null,this._mutationObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`),this.render(),this.setupEventListeners(),this.setupMutationObserver(),this.initializeActiveTab()}disconnectedCallback(){this.removeEventListeners(),this._mutationObserver&&=(this._mutationObserver.disconnect(),null)}render(){let e=this.querySelector(`mint-tab-list`);if(this.querySelectorAll(`mint-tab-content`),!e){console.warn(`mint-tabs: mint-tab-list is required`);return}let t=e.getAttribute(`position`)||`top`;this.classList.remove(`flex`,`flex-row`,`flex-col`,`gap-4`,`gap-6`),t===`left`||t===`right`?(this.classList.add(`flex`,`flex-row`,`items-start`),t===`left`?(e.classList.add(`mr-4`,`flex-shrink-0`),e.classList.remove(`ml-4`)):(e.classList.add(`ml-4`,`flex-shrink-0`,`order-2`),e.classList.remove(`mr-4`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.add(`order-1`)}))):(this.classList.add(`flex`,`flex-col`),e.classList.remove(`mr-4`,`ml-4`,`flex-shrink-0`,`order-2`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.remove(`order-1`)}))}initializeActiveTab(){requestAnimationFrame(()=>{let e=this.querySelectorAll(`mint-tab`),t=null;if(e.forEach(e=>{e.getAttribute(`active`)===`true`&&(t=e)}),!t&&e.length>0&&(t=e[0],t.setAttribute(`active`,`true`)),t){let e=t.getAttribute(`target`);e?this.showContent(e):this.hideAllContent()}else this.hideAllContent();this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.checkInitialVisibility&&t.checkInitialVisibility()})})}hideAllContent(){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`})}showContent(e){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`});let t=this.querySelector(`mint-tab-content[id="${e}"]`);t&&(t.show?t.show():t.style.display=`block`)}setupEventListeners(){this._tabClickHandler||(this._tabClickHandler=this.handleTabClick.bind(this),this.addEventListener(`tab-click`,this._tabClickHandler))}removeEventListeners(){this._tabClickHandler&&=(this.removeEventListener(`tab-click`,this._tabClickHandler),null)}setupMutationObserver(){this._mutationObserver=new MutationObserver(()=>{this.render()});let e=this.querySelector(`mint-tab-list`);e&&this._mutationObserver.observe(e,{attributes:!0,attributeFilter:[`position`]})}handleTabClick(e){let t=e.detail?.tab,n=e.detail?.target;if(!t)return;let r=t.closest(`mint-tab-list`);r&&(r.querySelectorAll(`mint-tab`).forEach(e=>{let n=e;e===t?n.active=!0:n.active=!1}),n&&this.showContent(n))}};customElements.get(`mint-tabs`)||customElements.define(`mint-tabs`,I);var L=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.5,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`);let e=this._getReactiveValue(this.data);e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_getReactiveValue(e){if(!e||typeof e!=`object`)return e;if(`_value`in e||`__v_isRef`in e){if(e.value!==void 0)return e.value;if(`_value`in e)return e._value}return`__v_raw`in e||`__v_isReactive`in e||`__ob__`in e,e}_setupDataObserver(){let e=null,t=0,n=()=>{if(!this.isConnected)return;let t=this._getReactiveValue(this.data),n=null;t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(n=t),n!==e&&n&&(e=n,this._chartData=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n()})});let r=setInterval(()=>{if(!this.isConnected){clearInterval(r);return}if(n(),t++,t>50){clearInterval(r);let e=setInterval(()=>{if(!this.isConnected){clearInterval(e);return}n()},1e3);this._dataCheckInterval=e}},100);this._dataCheckInterval=r}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){t!==n&&(e===`data`&&this.data&&typeof this.data==`object`&&(this._chartData=this.data),(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()}))}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._renderScheduled||(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let e=this._getReactiveValue(this.data);if(e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let t=this.getBoundingClientRect(),n=t.width||this.parentElement?.clientWidth||800,r=t.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,n,n),this._height=this._calculateDimension(this._heightValue,r,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let i=this.getAttribute(`curve-tension`);if(i!==null){let e=parseFloat(i);this._curveTension=isNaN(e)?.5:Math.max(0,Math.min(1,e))}else this._curveTension=.5;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}switch(this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._chartContainer&&this._svg&&this._chartContainer.appendChild(this._svg),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine()}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
89
|
+
`.trim()}};typeof customElements<`u`&&!customElements.get(`mint-spinner`)&&a(`mint-spinner`,Lt);var V=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`,`active`,`align`,`aria-label`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1,this._hostChildObserver=null,this._hostRenderFromObserverRaf=null,this._handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)},this._handleMouseUp=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))},this._handleMouseLeave=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))},this._handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)},this._handleTouchEnd=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))},this._handleTouchCancel=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))}}_getGeneratedIcon(){return this._button?this._button.querySelector(`:scope > [data-generated-icon="true"]`):null}_getContentWrapperClass(e){return`mint-button-content`}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this._disconnectHostChildObserver(),this._hostRenderFromObserverRaf!==null&&(cancelAnimationFrame(this._hostRenderFromObserverRaf),this._hostRenderFromObserverRaf=null),this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){let e=this.getAttribute(`variant`);return e===`ghost`||e===`outline`?e:`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.classList.contains(`mint-button-spinner-wrap`)&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-neutral-900`,`dark:!bg-neutral-700`,`hover:!bg-neutral-900`,`dark:hover:!bg-neutral-700`,`!border-t-neutral-900`,`!border-l-neutral-900`,`!border-r-neutral-600`,`!border-b-neutral-600`,`dark:!border-t-neutral-700`,`dark:!border-l-neutral-700`,`dark:!border-r-neutral-500`,`dark:!border-b-neutral-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-mint-divider`,`dark:!border-b-mint-divider`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`]}[e]||[]}_disconnectHostChildObserver(){this._hostChildObserver?.disconnect()}_connectHostChildObserver(){this.isConnected&&(this._hostChildObserver||=new MutationObserver(e=>{this._onLightDomMutation(e)}),this._hostChildObserver.disconnect(),this._hostChildObserver.observe(this,{childList:!0,subtree:!0,characterData:!0}))}_onLightDomMutation(e){if(this.isConnected){if(this._button&&!this._button.isConnected){this._button=null,this._scheduleRenderFromHostObserver();return}for(let t of e){let e=t.target;if(!(this._button&&(e===this._button||this._button.contains(e)))){this._scheduleRenderFromHostObserver();return}}}}_scheduleRenderFromHostObserver(){this._hostRenderFromObserverRaf===null&&(this._hostRenderFromObserverRaf=requestAnimationFrame(()=>{this._hostRenderFromObserverRaf=null,this.isConnected&&this.render()}))}getButtonClasses(){let e=[`mint-button-core`,`mint-button-${this.getVariant()}`,`mint-button-tone-${this.getTone()}`];return this.isIconOnly()&&e.push(`mint-button-icon-only`),this.isFullWidth()&&e.push(`mint-button-full-width`),e.join(` `)}render(){this._disconnectHostChildObserver(),this._button&&!this._button.isConnected&&(this._button=null);try{let e=this.isLoading(),t=this.isDisabled()||e,n=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=n,this._button.disabled=t,this._button.setAttribute(`aria-busy`,String(e));let r=this._button.querySelector(`mint-spinner`);if(e)if(r)r.setAttribute(`data-button-variant`,this.getVariant()),r.setAttribute(`data-button-tone`,this.getTone()),`render`in r&&typeof r.render==`function`&&r.render();else{let e=document.createElement(`span`);e.className=`mint-button-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else r&&r.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.classList.contains(`mint-button-spinner-wrap`)&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();if(a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),e?a.style.display=`none`:a.style.display=``,a.setAttribute(`data-position`,o),a.toggleAttribute(`data-icon-only`,c),c&&(a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`)))),e){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(c?e.setAttribute(`data-icon-only`,`true`):e.removeAttribute(`data-icon-only`))}let l=this.getButtonClasses();this._button.className=l;let u=this.getAttribute(`aria-label`)?.trim();if(u)this._button.setAttribute(`aria-label`,u);else if(this.isIconOnly()){let e=this.getIcon().split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);this._button.setAttribute(`aria-label`,e||`Action`)}else this._button.removeAttribute(`aria-label`);this.hasAttribute(`active`)?this._button.setAttribute(`aria-pressed`,String(this.isActive())):this._button.removeAttribute(`aria-pressed`),this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),this._button.setAttribute(`data-align`,this.getAlignment()),this._button.toggleAttribute(`data-icon-only`,c),e?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}finally{queueMicrotask(()=>{this.isConnected&&this._connectHostChildObserver()})}}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||a(`mint-button`,V);var Rt=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`icon`,`info`,`error`,`error-message`,`loading`]}_button=null;_checked=!1;_hasUserToggled=!1;constructor(){super()}connectedCallback(){this.classList.add(`mint-switch`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}_getSwitchContainer(){let e=this.querySelector(`.mint-switch-container`);return e||(e=document.createElement(`div`),e.className=`mint-switch-container`,this.insertBefore(e,this.firstChild)),e}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._syncSwitchAccessibility();return}if(e===`loading`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this.render()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getIcon(){return this.getAttribute(`icon`)||``}hasIcon(){return!!this.getIcon()}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getSwitchClasses(){return`mint-switch-control`}getThumbClasses(){return[`mint-switch-thumb`,this._checked?`mint-switch-thumb-checked`:``,this._hasUserToggled?`mint-switch-thumb-animated`:``].filter(Boolean).join(` `)}getIconClasses(){return`mint-switch-icon`}render(){let e=this.isLoading();this.setAttribute(`aria-busy`,String(e));let t=this.getSwitchClasses(),n=this.getThumbClasses(),r=this.getLabel(),i=this.getInfo(),a=this.getIcon(),o=this.getAttribute(`id`)||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute(`id`)||this.setAttribute(`id`,o);let s=this._getSwitchContainer();this._button?this._button.parentElement!==s&&s.appendChild(this._button):(this._button=document.createElement(`button`),s.appendChild(this._button),this.setupEventListeners());let c=s.querySelector(`.mint-switch-label`);r?(c||(c=document.createElement(`label`),c.className=`mint-switch-label`,this._button&&this._button.parentElement===s?s.insertBefore(c,this._button.nextSibling):s.appendChild(c)),c.textContent=r,c.setAttribute(`for`,`${o}-control`),this.isDisabled()?c.classList.add(`mint-switch-disabled`):c.classList.remove(`mint-switch-disabled`)):c&&c.remove(),this._button.className=t,this._button.disabled=this.isDisabled(),this._button.id=`${o}-control`,this._button.setAttribute(`aria-checked`,String(this._checked)),this._button.setAttribute(`aria-label`,r||`Toggle switch`),this._button.setAttribute(`role`,`switch`),this._button.type=`button`;let l=this._button.querySelector(`span`);l||(l=document.createElement(`span`),this._button.appendChild(l)),l.className=n;let u=l.querySelector(`span`);if(a){let e=u;e||(e=document.createElement(`span`),e.className=this.getIconClasses(),l.appendChild(e));let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a)}else u&&u.remove();let d=this.querySelector(`.mint-switch-info`);i?(d||(d=document.createElement(`span`),d.className=`mint-switch-info`,s&&s.parentElement===this?this.insertBefore(d,s.nextSibling):this.appendChild(d)),d.textContent=i,this.isDisabled()?d.classList.add(`mint-switch-disabled`):d.classList.remove(`mint-switch-disabled`)):d&&d.remove(),this._renderErrorState(),this._syncSwitchAccessibility(),this._renderSkeleton(e)}setupEventListeners(){this._button&&this._button.addEventListener(`click`,this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener(`click`,this.handleToggle.bind(this))}handleToggle(e){if(!this.isDisabled()){this._hasUserToggled=!0,this.checked=!this._checked;let e=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(e){let t=this._getSwitchContainer(),n=this.getLabel(),r=this.getInfo(),i=t.querySelector(`.mint-switch-skeleton-container`),a=this.querySelector(`.mint-switch-info-skeleton`);if(e){t.classList.add(`mint-switch-container-loading`),i||(i=document.createElement(`div`),i.className=`mint-switch-skeleton-container`,t.appendChild(i));let e=i.querySelector(`.mint-switch-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-box`,i.appendChild(e)),n){let e=i.querySelector(`.mint-switch-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-label`,i.appendChild(e))}else{let e=i.querySelector(`.mint-switch-skeleton-label`);e&&e.remove()}i.style.display=`flex`,this._button&&(this._button.style.visibility=`hidden`,this._button.style.pointerEvents=`none`);let o=t.querySelector(`.mint-switch-label`);if(o&&(o.style.visibility=`hidden`,o.style.pointerEvents=`none`),r){a||(a=document.createElement(`div`),a.className=`mint-switch-info-skeleton`,t&&t.parentElement===this?this.insertBefore(a,t.nextSibling):this.appendChild(a)),a.style.display=`block`;let e=this.querySelector(`.mint-switch-info`);e&&(e.style.display=`none`)}else a&&(a.style.display=`none`)}else{i&&(i.style.display=`none`),t.classList.remove(`mint-switch-container-loading`),a&&(a.style.display=`none`),this._button&&(this._button.style.visibility=`visible`,this._button.style.pointerEvents=`auto`);let e=t.querySelector(`.mint-switch-label`);e&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`);let n=this.querySelector(`.mint-switch-info`);n&&(n.style.display=``)}}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-switch-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-switch-error`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._button&&(this._button.className=this.getSwitchClasses()),this._syncSwitchAccessibility()}_syncSwitchAccessibility(){if(!this._button)return;let e=this.getAttribute(`id`)||`mint-switch-${Math.random().toString(36).slice(2,10)}`;this.getAttribute(`id`)||this.setAttribute(`id`,e),this._button.id=`${e}-control`,this._button.setAttribute(`aria-invalid`,String(this.hasError()));let t=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),n=this.querySelector(`.mint-switch-info`),r=this.querySelector(`.mint-switch-error`);n&&(n.id=`${e}-info`,t.push(n.id)),r&&(r.id=`${e}-error`,t.push(r.id)),t.length?this._button.setAttribute(`aria-describedby`,Array.from(new Set(t)).join(` `)):this._button.removeAttribute(`aria-describedby`)}};customElements.get(`mint-switch`)||a(`mint-switch`,Rt);var zt=class extends HTMLElement{static get observedAttributes(){return[`variant`,`size`,`bold`,`underline`,`strike`,`italic`,`display`,`inline`]}constructor(){super(),this._darkModeObserver=null}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(()=>{this.render()}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}getVariant(){return this.getAttribute(`variant`)||`default`}getSize(){return this.getAttribute(`size`)||`regular`}isBold(){return this.hasAttribute(`bold`)}isUnderline(){return this.hasAttribute(`underline`)}isStrike(){return this.hasAttribute(`strike`)}isItalic(){return this.hasAttribute(`italic`)}getDisplay(){return this.hasAttribute(`display`)?this.getAttribute(`display`):this.getSize()===`regular`?`inline-block`:`block`}getTextClasses(){return this.className}render(){}};typeof customElements<`u`&&!customElements.get(`mint-text`)&&a(`mint-text`,zt);var Bt=class extends HTMLElement{static get observedAttributes(){return[`direction`,`text-align`,`gap`,`align-content`]}connectedCallback(){this.classList.add(`mint-stack`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getDirection(){return this.getAttribute(`direction`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=Number.parseFloat(this.getAttribute(`gap`)||`3`);return Number.isFinite(e)?Math.min(12,Math.max(1,Math.round(e))):3}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`left`||e===`start`?`left`:e===`right`||e===`end`?`right`:e===`center`||e===`middle`?`center`:``}render(){let e=this.getDirection(),t=this.getAlignContent(),n=this.getTextAlign();this.classList.add(`mint-stack`),this.style.setProperty(`--mint-stack-direction`,e===`horizontal`?`row`:`column`),this.style.setProperty(`--mint-stack-gap`,`${this.getGap()*.25}rem`),this.style.setProperty(`--mint-stack-align-items`,e===`vertical`&&t?{left:`flex-start`,right:`flex-end`,center:`center`}[t]:`stretch`),this.style.setProperty(`--mint-stack-justify-content`,e===`horizontal`&&t?{left:`flex-start`,right:`flex-end`,center:`center`}[t]:`flex-start`),this.style.setProperty(`--mint-stack-text-align`,n||`initial`)}};typeof customElements<`u`&&!customElements.get(`mint-stack`)&&a(`mint-stack`,Bt);var Vt=class extends HTMLElement{constructor(){super()}};typeof customElements<`u`&&!customElements.get(`mint-card`)&&a(`mint-card`,Vt);var Ht=class extends HTMLElement{static get observedAttributes(){return[`href`,`target`]}constructor(){super(),this._link=null}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHref(){return this.getAttribute(`href`)||`#`}getTarget(){return this.getAttribute(`target`)||``}hasIcon(){return!!this.querySelector(`mint-icon`)||!!this._link?.querySelector(`mint-icon`)}render(){let e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement(`a`);this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t===`_blank`&&(this._link.rel=`noopener noreferrer`)):(this._link.removeAttribute(`target`),this._link.removeAttribute(`rel`));let n=[`mint-link-anchor`,this.hasIcon()?`mint-link-with-icon`:``];this._link.className=n.filter(Boolean).join(` `)}};typeof customElements<`u`&&!customElements.get(`mint-link`)&&a(`mint-link`,Ht);var Ut=class extends HTMLElement{static get observedAttributes(){return[`heading`,`fallback-href`,`show-back-button`,`containered`]}constructor(){super(),this._root=this.attachShadow({mode:`open`}),this._root.innerHTML=`
|
|
90
|
+
<div part="container" class="mint-page-container">
|
|
91
|
+
<header part="header" class="mint-page-header">
|
|
92
|
+
<div part="title" class="mint-page-title">
|
|
93
|
+
<button part="back-button" class="mint-page-back" type="button" aria-label="Go back" hidden>
|
|
94
|
+
<svg part="back-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
95
|
+
<path d="M19 12H5m7 7-7-7 7-7" />
|
|
96
|
+
</svg>
|
|
97
|
+
</button>
|
|
98
|
+
<h1 part="heading" class="mint-page-heading"></h1>
|
|
99
|
+
</div>
|
|
100
|
+
<div part="actions" class="mint-page-actions"><slot name="actions"></slot></div>
|
|
101
|
+
</header>
|
|
102
|
+
<main part="body" class="mint-page-body"><slot></slot></main>
|
|
103
|
+
</div>
|
|
104
|
+
`,this._headingElement=this._root.querySelector(`.mint-page-heading`),this._backButton=this._root.querySelector(`.mint-page-back`),this._backButton.addEventListener(`click`,e=>this._handleBack(e))}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}isContainered(){return this.hasAttribute(`containered`)&&this.getAttribute(`containered`)!==`false`}render(){this._headingElement.textContent=this.getHeading(),this._backButton.hidden=!this.shouldShowBackButton()}_handleBack(e){e.preventDefault();let t=document.referrer,n=!!(t&&(()=>{try{return new URL(t).origin===window.location.origin}catch{return!1}})()),r={url:n?t:this.getFallbackHref(),isFromReferrer:n,referrer:t||null,fallbackHref:this.getFallbackHref()},i=new CustomEvent(`back`,{detail:r,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)&&(n&&window.history.length>1?window.history.back():window.location.href=this.getFallbackHref())}};typeof customElements<`u`&&!customElements.get(`mint-page`)&&a(`mint-page`,Ut);var Wt=class extends HTMLElement{constructor(){super()}};typeof customElements<`u`&&!customElements.get(`mint-grid`)&&a(`mint-grid`,Wt);var Gt=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._triggerElement=null,this._triggerPoint=null,this._renderedOpen=!1,this._lastPointerPoint=null,this._pointerDownHandler=null,this._darkModeObserver=null,this._exitTimer=null,this._backdropTimer=null}connectedCallback(){this.isOpen()||this.classList.add(`mint-hidden`),this.render(),this._observeDarkMode(),this._pointerDownHandler=e=>{this._lastPointerPoint={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()}},document.addEventListener(`pointerdown`,this._pointerDownHandler,!0)}disconnectedCallback(){this._pointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._pointerDownHandler,!0),null),this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&(e===`open`&&n!==null&&!this._triggerElement&&(this._triggerElement=this._findTriggerElement(),this._triggerPoint=this._findTriggerPoint(this._triggerElement)),this.render())}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}isOpen(){return this.hasAttribute(`open`)}open(e){this._triggerElement=this._findTriggerElement(e),this._triggerPoint=this._findTriggerPoint(this._triggerElement),this.setAttribute(`open`,``)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-modal-overlay`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`mint-modal-shell`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content`,this._modal.appendChild(e)),this._renderedOpen||(this._renderedOpen=!0,this._animateEnter())}else this._renderedOpen&&(this._renderedOpen=!1,this._animateExit());let r=this._modal.querySelector(`.modal-content`);r||(r=document.createElement(`div`),r.className=`modal-content`,this._modal.appendChild(r)),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-modal-header`,r.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-modal-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let i=this._headingSlot.querySelector(`mint-text`);t?(i||(i=document.createElement(`mint-text`),i.setAttribute(`size`,`sub-heading`),i.setAttribute(`bold`,``),this._headingSlot.appendChild(i)),i.textContent=t):i&&i.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-modal-body`,this._bodySlot.setAttribute(`slot`,`body`),r.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-modal-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),r.appendChild(this._actionsSlot));let a=this._actionsSlot.querySelector(`mint-stack`);a||(a=document.createElement(`mint-stack`),a.setAttribute(`direction`,`horizontal`),a.className=`mint-actions-stack`,this._actionsSlot.appendChild(a)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==a&&a.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._modal&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;document.documentElement?.classList.contains(`dark`)||document.documentElement?.dataset.mintTheme;let e=this._modal.querySelector(`.modal-content`);e&&(e.style.background=`var(--mint-color-surface-raised)`)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this.classList.remove(`mint-modal-closing`),this.classList.remove(`mint-modal-open`),this.classList.add(`mint-modal-open`),this.classList.remove(`mint-hidden`),e.style.transform=`none`,e.style.opacity=`0`,e.style.transition=`none`,requestAnimationFrame(()=>{if(!this.isOpen())return;let t=window.getComputedStyle(e).borderRadius;this._setTransformOrigin(e),e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,e.getBoundingClientRect(),e.style.transition=`opacity 320ms ease-out, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 360ms cubic-bezier(0.2, 0.8, 0.2, 1)`,requestAnimationFrame(()=>{this.isOpen()&&(e.style.transform=`scale(1)`,e.style.opacity=`1`,e.style.borderRadius=t)})}))}_findTriggerElement(e){if(typeof e==`string`){let t=document.getElementById(e);return t&&!this.contains(t)?t:null}if(e instanceof HTMLElement)return e.isConnected&&!this.contains(e)?e:null;let t=this.getAttribute(`trigger-id`);if(t){let e=document.getElementById(t);if(e&&!this.contains(e))return e}let n=document.activeElement;return n instanceof HTMLElement&&n.isConnected&&n!==document.body&&!this.contains(n)?n:null}_findTriggerPoint(e){if(!e)return null;let t=this._lastPointerPoint;if(!t||Date.now()-t.time>1e3)return null;let n=t.target instanceof Node?t.target:null;return n===e||n&&e.contains(n)?{x:t.x,y:t.y}:null}_setTransformOrigin(e){let t=this._findTriggerElement(this._triggerElement);this._triggerElement=t;let n=this._findTriggerPoint(t);if(n){let t=e.getBoundingClientRect();e.style.transformOrigin=`${n.x-t.left}px ${n.y-t.top}px`,this._triggerPoint=n;return}this._triggerPoint={x:window.innerWidth/2,y:0};let r=e.getBoundingClientRect();e.style.transformOrigin=`${this._triggerPoint.x-r.left}px ${this._triggerPoint.y-r.top}px`}_animateExit(){this.classList.remove(`mint-modal-open`),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null);let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`);return}this._exitTimer&&clearTimeout(this._exitTimer),this.classList.add(`mint-modal-closing`),e.style.transition=`opacity 220ms ease-in, transform 260ms cubic-bezier(0.4, 0, 1, 1), border-radius 260ms cubic-bezier(0.4, 0, 1, 1)`,e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,this._exitTimer=setTimeout(()=>{this._exitTimer=null,!this.isOpen()&&(this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`),e.style.transform=``,e.style.opacity=``,e.style.borderRadius=``,e.style.transition=``)},280)}};typeof customElements<`u`&&!customElements.get(`mint-modal`)&&a(`mint-modal`,Gt);var Kt=new Set([`up`,`down`,`left`,`right`]),qt=class extends HTMLElement{static get observedAttributes(){return[`direction`,`open`,`trigger-id`,`trigger-toggle`,`trigger-align`,`padding`,`hover`,`distance`]}constructor(){super(),this._trigger=null,this._triggerLookupTimer=null,this._clickHandler=null,this._hoverEnterHandler=null,this._hoverLeaveHandler=null,this._outsideHandler=null,this._escapeHandler=null,this._positionHandler=null,this._scrollHandler=null,this._resizeObserver=null,this._hoverCloseTimer=null,this._closeAnimationTimer=null,this._blobAnimation=null}connectedCallback(){this.render(),this._setupTrigger()}disconnectedCallback(){this._removeTrigger(),this._removeOpenListeners(),clearTimeout(this._hoverCloseTimer),clearTimeout(this._closeAnimationTimer),this._blobAnimation?.cancel()}attributeChangedCallback(e,t,n){t===n||!this.isConnected||((e===`trigger-id`||e===`trigger-toggle`||e===`hover`)&&this._setupTrigger(),this.render())}getDirection(){let e=this.getAttribute(`direction`)||`down`;return Kt.has(e)?e:`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}isOpen(){return this.hasAttribute(`open`)&&this.getAttribute(`open`)!==`false`}isHoverEnabled(){return this.hasAttribute(`hover`)&&this.getAttribute(`hover`)!==`false`}isTriggerToggleEnabled(){return this.getAttribute(`trigger-toggle`)!==`false`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_removeTrigger(){clearTimeout(this._triggerLookupTimer),this._triggerLookupTimer=null,this._trigger&&(this._clickHandler&&this._trigger.removeEventListener(`click`,this._clickHandler),this._hoverEnterHandler&&this._trigger.removeEventListener(`mouseenter`,this._hoverEnterHandler),this._hoverLeaveHandler&&this._trigger.removeEventListener(`mouseleave`,this._hoverLeaveHandler),this._hoverEnterHandler&&this.removeEventListener(`mouseenter`,this._hoverEnterHandler),this._hoverLeaveHandler&&this.removeEventListener(`mouseleave`,this._hoverLeaveHandler),this._trigger.removeAttribute(`aria-haspopup`),this._trigger.removeAttribute(`aria-expanded`),this._trigger=null,this._clickHandler=this._hoverEnterHandler=this._hoverLeaveHandler=null)}_setupTrigger(){this._removeTrigger();let e=this.getTriggerId();if(e){if(this._trigger=document.getElementById(e),!this._trigger){this._triggerLookupTimer=setTimeout(()=>{this.isConnected&&this.getTriggerId()===e&&!this._trigger&&this._setupTrigger()},40);return}this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,String(this.isOpen())),this.isTriggerToggleEnabled()&&(this._clickHandler=e=>{this._trigger?.tagName===`A`&&e.preventDefault(),this.isOpen()?this.close():this.open()},this._trigger.addEventListener(`click`,this._clickHandler)),this.isHoverEnabled()&&(this._hoverEnterHandler=()=>{clearTimeout(this._hoverCloseTimer),this.open()},this._hoverLeaveHandler=()=>this._scheduleHoverClose(),this._trigger.addEventListener(`mouseenter`,this._hoverEnterHandler),this._trigger.addEventListener(`mouseleave`,this._hoverLeaveHandler),this.addEventListener(`mouseenter`,this._hoverEnterHandler),this.addEventListener(`mouseleave`,this._hoverLeaveHandler))}}_scheduleHoverClose(){clearTimeout(this._hoverCloseTimer),this._hoverCloseTimer=setTimeout(()=>{!this._trigger?.matches(`:hover`)&&!this.matches(`:hover`)&&this.close()},140)}_removeOpenListeners(){this._outsideHandler&&document.removeEventListener(`click`,this._outsideHandler),this._escapeHandler&&document.removeEventListener(`keydown`,this._escapeHandler),this._positionHandler&&window.removeEventListener(`resize`,this._positionHandler),this._scrollHandler&&window.removeEventListener(`scroll`,this._scrollHandler,!0),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._outsideHandler=this._escapeHandler=this._positionHandler=this._scrollHandler=null}_setOpenListeners(){if(!this._outsideHandler){if(this._outsideHandler=e=>{let t=e.composedPath();t.includes(this)||t.includes(this._trigger)||(e.target instanceof Element?e.target:null)?.closest(`[data-keep-popover-open]`)||this.close()},this._escapeHandler=e=>{e.key===`Escape`&&(this.close(),this._trigger?.focus?.())},this._positionHandler=()=>{this.isOpen()&&this._position()},this._scrollHandler=()=>{this.isOpen()&&this._position({allowViewportFlip:!1,clampToViewport:!1})},typeof ResizeObserver<`u`&&this._trigger){this._resizeObserver=new ResizeObserver(()=>{this.isOpen()&&this._position()}),this._resizeObserver.observe(this);let e=this._trigger,t=0;for(;e&&e!==document.documentElement&&t<8;)this._resizeObserver.observe(e),e=e.parentElement,t+=1}setTimeout(()=>{this.isOpen()&&this._outsideHandler&&document.addEventListener(`click`,this._outsideHandler)},0),document.addEventListener(`keydown`,this._escapeHandler),window.addEventListener(`resize`,this._positionHandler),window.addEventListener(`scroll`,this._scrollHandler,!0)}}_position({allowViewportFlip:e=!0,clampToViewport:t=!0}={}){let n=document.getElementById(this.getTriggerId());n&&n!==this._trigger&&this._setupTrigger();let r=n||this._trigger;if(!r)return;let i=r.getBoundingClientRect(),a={width:this.offsetWidth,height:this.offsetHeight},o=this._distancePx(),s=e?this.getDirection():this.dataset.direction||this.getDirection(),c=0,l=0,u=this.getAttribute(`trigger-align`)||`center`;if(s===`down`||s===`up`){let t=i.bottom+o,n=i.top-a.height-o;e&&s===`down`&&t+a.height>innerHeight-12&&n>=12?s=`up`:e&&s===`up`&&n<12&&t+a.height<=innerHeight-12&&(s=`down`),c=s===`down`?t:n,l=u===`start`?i.left:u===`end`?i.right-a.width:i.left+(i.width-a.width)/2}else{let t=i.right+o,n=i.left-a.width-o;e&&s===`right`&&t+a.width>innerWidth-12&&n>=12?s=`left`:e&&s===`left`&&n<12&&t+a.width<=innerWidth-12&&(s=`right`),l=s===`right`?t:n,c=u===`start`?i.top:u===`end`?i.bottom-a.height:i.top+(i.height-a.height)/2}let d=t?Math.max(12,Math.min(c,innerHeight-a.height-12)):c,f=t?Math.max(12,Math.min(l,innerWidth-a.width-12)):l;this.style.top=`${d}px`,this.style.left=`${f}px`,this.dataset.direction=s,this.style.setProperty(`--mint-popover-origin-x`,`${i.left+i.width/2-f}px`),this.style.setProperty(`--mint-popover-origin-y`,`${i.top+i.height/2-d}px`)}_distancePx(){let e=(this.getAttribute(`distance`)||`8px`).trim(),t=Number.parseFloat(e);return Number.isFinite(t)?e.endsWith(`rem`)?t*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):Math.max(0,t):8}_animateBlob(e){if(this._blobAnimation?.cancel(),this._blobAnimation=null,typeof this.animate!=`function`)return 0;let t=getComputedStyle(this).borderRadius||`.75rem`;if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return 0;let n=e?380:280,r=[{transform:`scale(.035, .035)`,borderRadius:`50%`,opacity:.94,offset:0},{transform:`scale(.3, .42)`,borderRadius:`50%`,opacity:1,offset:.58},{transform:`scale(1.035, .96)`,borderRadius:`1rem`,offset:.9},{transform:`scale(1)`,borderRadius:t,offset:1}],i=e?r:[...r].reverse().map(({offset:e,...t})=>({...t,offset:1-e}));return this._blobAnimation=this.animate(i,{duration:n,easing:e?`cubic-bezier(.2, .8, .2, 1)`:`cubic-bezier(.4, 0, .8, .2)`,fill:`both`}),n}render(){let e=this.isOpen(),t=this.hasAttribute(`data-open`)||this.dataset.state===`closing`,n=this.hasAttribute(`data-open`);if(this.toggleAttribute(`data-open`,e),this.setAttribute(`aria-hidden`,String(!e)),this._trigger&&this._trigger.setAttribute(`aria-expanded`,String(e)),e){clearTimeout(this._closeAnimationTimer);let e=!n||this.dataset.state===`closing`;e&&(this._blobAnimation?.cancel(),this._blobAnimation=null),this.dataset.state=`open`,this._setOpenListeners(),this._position(),e&&this._animateBlob(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>{this.isOpen()&&this._position()}))}else if(this._removeOpenListeners(),t){this.dataset.state=`closing`;let e=this._animateBlob(!1);e?this._closeAnimationTimer=setTimeout(()=>{this.dataset.state===`closing`&&(this._blobAnimation?.cancel(),this._blobAnimation=null,this.dataset.state=`closed`)},e):this.dataset.state=`closed`}else this.dataset.state=`closed`}};typeof customElements<`u`&&!customElements.get(`mint-popover`)&&a(`mint-popover`,qt),s({name:`check`,viewBox:`0 0 24 24`,path:`M5 13l4 4L19 7`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var Jt=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null}connectedCallback(){let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=n!==null&&n!==`false`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n&&(this.render(),e===`checked`&&this._checkbox&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute(`checked`,``):this.removeAttribute(`checked`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute(`disabled`)}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this.getAttribute(`value`)||``}getCheckboxClasses(){return`mint-checkbox-control`}render(){let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-checkbox-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-checkbox-wrapper`,this.insertBefore(r,this.firstChild)),this._checkbox?this._checkbox.parentElement!==r&&r.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,r.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`mint-input-overlay`,this._checkbox.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._checkbox.checked=this._checked,this._checkbox.disabled=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._checkbox.id=i:this._checkbox.removeAttribute(`id`);let a=this.getName();a?this._checkbox.name=a:this._checkbox.removeAttribute(`name`);let o=this.getValue();o?this._checkbox.value=o:this._checkbox.removeAttribute(`value`),e?this._checkbox.setAttribute(`aria-label`,e):this._checkbox.removeAttribute(`aria-label`),r.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,r.style.pointerEvents=`none`,this._checkbox.style.pointerEvents=`auto`;let s=r.querySelector(`mint-icon`);s||(s=document.createElement(`mint-icon`),s.setAttribute(`name`,`check`),s.className=`mint-checkbox-check`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),this.updateVisualState();let c=this.querySelector(`.mint-checkbox-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-checkbox-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-checkbox-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-checkbox-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-checkbox-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.remove()}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener(`change`,this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`mousedown`,this._mousedownHandler),this._checkbox.addEventListener(`mouseup`,this._mouseupHandler),this._checkbox.addEventListener(`mouseleave`,this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`touchstart`,this._touchstartHandler),this._checkbox.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&=(this._checkbox.removeEventListener(`change`,this._changeHandler),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=e?.querySelector(`mint-icon`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains(`mint-checkbox-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}};typeof customElements<`u`&&!customElements.get(`mint-checkbox`)&&a(`mint-checkbox`,Jt);var Yt=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`required`]}constructor(){super(),this._radio=null,this._checked=!1,this._groupMode=!1,this._groupChangeHandler=null,this._groupObserver=null}connectedCallback(){if(this._activateGroupModeIfNeeded(),this._groupObserver=new MutationObserver(()=>this._activateGroupModeIfNeeded()),this._groupObserver.observe(this,{childList:!0,subtree:!0}),this._groupMode)return;let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners(),this._groupChangeHandler&&=(this.removeEventListener(`choice-option-change`,this._groupChangeHandler),null),this._groupObserver?.disconnect(),this._groupObserver=null}attributeChangedCallback(e,t,n){if(this._groupMode){t!==n&&this.renderGroup();return}e===`checked`&&(this._checked=n!==null&&n!==`false`,this._radio&&(this._radio.checked=this._checked)),t!==n&&(this.render(),e===`checked`&&this._radio&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute(`checked`,``):this.removeAttribute(`checked`),this._checked=!!e,this._radio&&(this._radio.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute(`disabled`)}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this._groupMode?this.querySelector(`mint-choice-option input[type="radio"]:checked`)?.value||this.getAttribute(`value`)||``:this.getAttribute(`value`)||``}set value(e){this.setValue(e)}get value(){return this.getValue()}setValue(e){if(!this._groupMode){e?this.setAttribute(`value`,e):this.removeAttribute(`value`);return}let t=e==null?``:String(e);this.querySelectorAll(`mint-choice-option`).forEach(e=>{let n=e.getAttribute(`value`)===t,r=e.querySelector(`input[type="radio"]`);r&&(r.checked=n),e.toggleAttribute(`checked`,n)}),t?this.setAttribute(`value`,t):this.removeAttribute(`value`)}renderGroup(){this.classList.add(`mint-choice-group`),this.setAttribute(`role`,`radiogroup`);let e=this.getAttribute(`label`)||``,t=this.querySelector(`:scope > .mint-choice-group-label`);e&&!t&&(t=document.createElement(`div`),t.className=`mint-choice-group-label`,this.insertBefore(t,this.firstChild)),t&&(e?t.textContent=e:t.remove());let n=this.querySelector(`:scope > .mint-choice-options`);n||(n=document.createElement(`div`),n.className=`mint-choice-options`,t?.parentElement===this?this.insertBefore(n,t.nextSibling):this.insertBefore(n,this.firstChild)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==n).forEach(e=>n.appendChild(e)),this.querySelectorAll(`mint-choice-option`).forEach(e=>e.render());let r=this.getAttribute(`value`);r&&this.setValue(r)}_activateGroupModeIfNeeded(){this._groupMode||!this.querySelector(`mint-choice-option`)||(this._groupMode=!0,this.removeEventListeners(),this.querySelector(`.mint-choice-wrapper`)?.remove(),this.querySelector(`.mint-choice-label-container`)?.remove(),this._radio=null,this._groupChangeHandler=e=>{let t=e.target.closest?.(`mint-choice-option`);if(!t||!this.contains(t))return;let n=t.getAttribute(`value`)||``;n?this.setAttribute(`value`,n):this.removeAttribute(`value`),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this.addEventListener(`choice-option-change`,this._groupChangeHandler),this.renderGroup())}getChoiceClasses(){return`mint-choice-control`}render(){if(this._groupMode){this.renderGroup();return}let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-choice-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-choice-wrapper`,this.insertBefore(r,this.firstChild)),this._radio?this._radio.parentElement!==r&&r.appendChild(this._radio):(this._radio=document.createElement(`input`),this._radio.type=`radio`,r.appendChild(this._radio),this.setupEventListeners()),this._radio.className=`mint-input-overlay`,this._radio.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._radio.checked=this._checked,this._radio.disabled=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._radio.id=i:this._radio.removeAttribute(`id`);let a=this.getName();a?this._radio.name=a:this._radio.removeAttribute(`name`);let o=this.getValue();o?this._radio.value=o:this._radio.removeAttribute(`value`),e?this._radio.setAttribute(`aria-label`,e):this._radio.removeAttribute(`aria-label`),r.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,r.style.pointerEvents=`none`,this._radio.style.pointerEvents=`auto`;let s=r.querySelector(`.mint-choice-indicator`);s||(s=document.createElement(`div`),s.className=`mint-choice-indicator`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),s.style.opacity=this._checked?`1`:`0`,s.style.transform=this._checked?`scale(1)`:`scale(0.8)`,this.updateVisualState();let c=this.querySelector(`.mint-choice-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-choice-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-choice-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-choice-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-choice-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-choice-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._radio&&(e.target===this._radio||this._radio.contains(e.target)||e.composedPath().includes(this._radio))||this.select()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();let t=this._checked;if(this._checked=this._radio.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState(),this._checked){let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}})}if(t!==this._checked){let e=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}},this._radio.addEventListener(`change`,this._changeHandler),this._groupChangeHandler=e=>{e.target!==this._radio&&e.target.type===`radio`&&e.target.name===this._radio.name&&e.target.checked&&setTimeout(()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState())},0)},document.addEventListener(`change`,this._groupChangeHandler,!0),this._clickHandler=e=>{let t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),requestAnimationFrame(()=>{this._checked=this._radio.checked,this.updateVisualState()})},this._radio.addEventListener(`click`,this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._radio.addEventListener(`mousedown`,this._mousedownHandler),this._radio.addEventListener(`mouseup`,this._mouseupHandler),this._radio.addEventListener(`mouseleave`,this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._radio.addEventListener(`touchstart`,this._touchstartHandler),this._radio.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._groupChangeHandler&&=(document.removeEventListener(`change`,this._groupChangeHandler),null),this._clickHandler&&=(this._radio.removeEventListener(`click`,this._clickHandler),null),this._mousedownHandler&&=(this._radio.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._radio.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._radio.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._radio.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._radio.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-choice-wrapper`),t=e?.querySelector(`.mint-choice-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,e.classList.contains(`mint-choice-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}select(){if(this._radio&&!this.isDisabled()){this._radio.checked=!0,this._radio.dispatchEvent(new Event(`change`,{bubbles:!0})),this._checked=!0,this.hasAttribute(`checked`)||this.setAttribute(`checked`,``);let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}},Xt=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`]}constructor(){super(),this._labelText=``,this._radio=null,this._changeHandler=null}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}render(){let e=this.closest(`mint-choice`),t=this.querySelector(`.mint-choice-option-label`);this._labelText||=t?.textContent?.trim()||this.textContent.trim();let n=this.querySelector(`:scope > .mint-choice-option-control`);n||(n=document.createElement(`label`),n.className=`mint-choice-option-control`,this.replaceChildren(n)),this._radio||(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`mint-choice-option-input`,n.appendChild(this._radio),this._changeHandler=()=>{this._radio?.checked&&e&&(e.setValue(this.getAttribute(`value`)||``),e.dispatchEvent(new CustomEvent(`choice-option-change`,{detail:{value:this.getAttribute(`value`)||``,option:this},bubbles:!1})))},this._radio.addEventListener(`change`,this._changeHandler)),this._radio.name=e?.getAttribute(`name`)||``,this._radio.value=this.getAttribute(`value`)||``,this._radio.disabled=this.hasAttribute(`disabled`)||e?.hasAttribute(`disabled`)||!1,this._radio.required=e?.hasAttribute(`required`)||!1,this._radio.checked=this.hasAttribute(`checked`)||e?.getAttribute(`value`)===this._radio.value;let r=n.querySelector(`.mint-choice-option-label`);r||(r=document.createElement(`span`),r.className=`mint-choice-option-label`,n.appendChild(r)),r.textContent=this._labelText}};typeof customElements<`u`&&!customElements.get(`mint-choice`)&&a(`mint-choice`,Yt),typeof customElements<`u`&&!customElements.get(`mint-choice-option`)&&a(`mint-choice-option`,Xt),s({name:`arrow-left`,viewBox:`0 0 24 24`,path:`M19 12H5m7-7l-7 7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`});var Zt=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.hasAttribute(`disabled`)}isLoading(){return this.hasAttribute(`loading`)}getType(){return(this.getAttribute(`type`)||this.getAttribute(`button-type`)||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.hasAttribute(`full-width`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}isIconOnly(){if(!(this.getIcon()||this._button?.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent.trim())return!1;if(this._button){for(let e=this._button.firstChild;e;e=e.nextSibling)if(e.nodeType===Node.TEXT_NODE&&e.textContent.trim()||e.nodeType===Node.ELEMENT_NODE&&e.tagName!==`MINT-ICON`&&e.tagName!==`MINT-SPINNER`&&!e.querySelector?.(`mint-spinner`)&&!e.hasAttribute?.(`slot`)&&e.className!==`mint-button-icon`&&!(e.className===`mr-2`&&e.querySelector(`mint-spinner`))&&e.textContent.trim())return!1}return!0}getButtonClasses(){return[`mint-button-core`,`mint-button-`+this.getVariant(),`mint-button-tone-`+this.getTone(),this.isIconOnly()?`mint-button-icon-only`:``,this.isFullWidth()?`mint-button-full-width`:``].filter(Boolean).join(` `)}render(){let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button),this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`);if(this.isLoading())if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),n.render();else{let e=document.createElement(`span`);e.className=`mint-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let r=this.getIcon(),i=this._button.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`);r?(i&&i.tagName!==`MINT-ICON`&&(i.remove(),i=null),!i||i.tagName!==`MINT-ICON`?(i=document.createElement(`mint-icon`),i.setAttribute(`name`,r),i.className=`mint-button-icon`):i.setAttribute(`name`,r)):i&&i.tagName===`MINT-ICON`&&(i.remove(),i=null),i||=this._button.querySelector(`[slot="icon"], .mint-button-icon`);let a=this.getIconPosition(),o=this._button.querySelector(`.mint-button-content`);if(o){let e=i&&i.tagName===`MINT-ICON`;if(i&&!i.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||a===`left`?t?t.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o):o.insertAdjacentElement(`afterend`,i)}else if(i&&(e||a===`left`)&&i.nextSibling!==o){i.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o)}else i&&!e&&a===`right`&&i.previousSibling!==o&&(i.remove(),o.insertAdjacentElement(`afterend`,i))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling)t.tagName!==`MINT-SPINNER`&&!t.querySelector?.(`mint-spinner`)&&t!==i&&!t.hasAttribute?.(`slot`)&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&e.push(t);if(e.length>0){o=document.createElement(`span`),o.className=`mint-button-content`,e.forEach(e=>{o.appendChild(e)});let t=this._button.querySelector(`mint-spinner`)?.parentElement;i&&a===`left`?t?(t.insertAdjacentElement(`afterend`,i),i.insertAdjacentElement(`afterend`,o)):(this._button.insertBefore(i,this._button.firstChild),i.insertAdjacentElement(`afterend`,o)):i&&a===`right`?t?(t.insertAdjacentElement(`afterend`,o),o.insertAdjacentElement(`afterend`,i)):(this._button.insertBefore(o,this._button.firstChild),o.insertAdjacentElement(`afterend`,i)):t?t.insertAdjacentElement(`afterend`,o):this._button.insertBefore(o,this._button.firstChild)}else if(i&&i.tagName===`MINT-ICON`&&!i.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,this._button.firstChild)}}let s=this.isIconOnly();i&&(i.classList.contains(`mint-button-icon`)||i.classList.add(`mint-button-icon`),i.classList.remove(`mint-icon-leading`,`mint-icon-trailing`),s?i.tagName===`MINT-ICON`?(i.style.width=`1rem`,i.style.height=`1rem`,i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`):(i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`,i.tagName===`svg`&&(i.style.width=`1rem`,i.style.height=`1rem`)):a===`left`?i.classList.add(`mint-icon-leading`):i.classList.add(`mint-icon-trailing`));let c=this.getButtonClasses();this._button.className=c}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}_handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleMouseUp=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleMouseLeave=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleTouchEnd=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchCancel=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};typeof customElements<`u`&&!customElements.get(`mint-button`)&&a(`mint-button`,Zt);var Qt=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0}connectedCallback(){this.render(),this._setupHistoryTracking()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_setupHistoryTracking(){window.addEventListener(`popstate`,()=>{this._backAttempts=0}),this._historyDepth=window.history.length}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}handleClick(e){if(e.preventDefault(),e.stopPropagation(),window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;let e=window.location.href,t=Date.now();window.history.back(),setTimeout(()=>{Date.now()-t,window.location.href===e?this._navigateToFallback():setTimeout(()=>{this._backAttempts=0},500)},200)}else this._navigateToFallback()}_navigateToFallback(){let e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith(`/`)&&!e.startsWith(`//`))try{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`));return}catch{}window.location.href=e}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};typeof customElements<`u`&&!customElements.get(`mint-back-button`)&&a(`mint-back-button`,Qt);var $t=0,en=class extends HTMLElement{static get observedAttributes(){return[`brand`,`brand-href`,`direction`,`label`,`open`]}constructor(){super(),this._built=!1,this._brand=null,this._brandLink=null,this._items=null,this._toggle=null,this._toggleLabel=null,this._mobileActions=null,this._mobileActionNodes=[],this._instanceId=++$t,this._dropdowns=[],this._content=null,this._actions=null,this._activeDropdown=null,this._layoutObserver=null}connectedCallback(){this._built||this._build(),this._observeDropdowns(),this._syncResponsiveDropdowns(),this._syncMobileActions(),typeof ResizeObserver<`u`&&(this._layoutObserver=new ResizeObserver(()=>{this._syncResponsiveDropdowns(),this._syncMobileActions()}),this._layoutObserver.observe(this)),this._syncAttributes()}disconnectedCallback(){for(let e of this._dropdowns)e.observer?.disconnect();this._layoutObserver?.disconnect(),this._layoutObserver=null}attributeChangedCallback(e,t,n){t===n||!this._built||(e===`open`?this._syncOpenState():this._syncAttributes())}getDirection(){return this.getAttribute(`direction`)===`vertical`?`vertical`:`horizontal`}getBrand(){return this.getAttribute(`brand`)||``}getBrandHref(){return this.getAttribute(`brand-href`)||`/`}getLabel(){return this.getAttribute(`label`)||`Primary navigation`}_build(){let e=Array.from(this.childNodes),t=e.find(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`brand`),n=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&[`actions`,`mobile-actions`].includes(e.getAttribute(`slot`)));this._mobileActionNodes=n.filter(e=>e.getAttribute(`slot`)===`mobile-actions`);let r=e.filter(e=>e!==t&&!n.includes(e));this.replaceChildren();let i=document.createElement(`div`);i.className=`mint-navigation-shell`;let a=document.createElement(`div`);a.className=`mint-navigation-bar`,this._brand=document.createElement(`div`),this._brand.className=`mint-navigation-brand`,t?(t.removeAttribute(`slot`),this._brand.appendChild(t)):this.getBrand()&&(this._brandLink=document.createElement(`mint-link`),this._brandLink.className=`mint-navigation-brand-link`,this._brandLink.textContent=this.getBrand(),this._brandLink.setAttribute(`href`,this.getBrandHref()),this._brand.appendChild(this._brandLink)),this._toggle=document.createElement(`mint-button`),this._toggle.className=`mint-navigation-toggle`,this._toggle.setAttribute(`aria-expanded`,`false`),this._toggle.addEventListener(`click`,()=>this.toggleMenu()),this._toggleLabel=document.createElement(`span`),this._toggleLabel.className=`mint-navigation-visually-hidden`,this._toggleLabel.textContent=`Open navigation menu`,this._toggle.append(this._toggleLabel),this._toggle.setAttribute(`variant`,`ghost`),this._toggle.setAttribute(`tone`,`action`),this._toggle.setAttribute(`button-type`,`button`),this._toggle.setAttribute(`icon`,`menu`),this._mobileActions=document.createElement(`div`),this._mobileActions.className=`mint-navigation-mobile-actions`,a.append(this._brand,this._mobileActions,this._toggle);let o=document.createElement(`div`);this._content=o,o.className=`mint-navigation-content`,this._items=document.createElement(`nav`),this._items.className=`mint-navigation-items`,this._items.setAttribute(`aria-label`,this.getLabel()),this._items.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()});let s=0;for(let e of r)if(e.nodeType!==Node.ELEMENT_NODE)this._items.appendChild(e);else if(e.tagName===`DETAILS`){let t=this._createDropdown(e,s++);this._items.append(t.trigger,t.popover),this._registerDropdown(t.trigger,t.popover)}else{let t=this._toMintLink(e);if(this._items.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-POPOVER`){let e=t.getAttribute(`trigger-id`),n=Array.from(this._items.querySelectorAll(`mint-button`)).find(t=>t.id===e);this._registerDropdown(n,t)}}let c=document.createElement(`div`);this._actions=c,c.className=`mint-navigation-actions`;for(let e of n)e.removeAttribute(`slot`),c.appendChild(e);let l=document.createElement(`section`);l.className=`mint-navigation-submenu`,l.setAttribute(`aria-label`,`Navigation submenu`);let u=document.createElement(`div`);u.className=`mint-navigation-submenu-header`;let d=document.createElement(`mint-button`);d.className=`mint-navigation-submenu-back`,d.setAttribute(`variant`,`ghost`),d.setAttribute(`tone`,`action`),d.setAttribute(`button-type`,`button`),d.setAttribute(`icon`,`arrow-left`),d.setAttribute(`aria-label`,`Back to main navigation`),d.addEventListener(`click`,()=>this._closeSubmenu());let f=document.createElement(`h3`);f.className=`mint-navigation-submenu-title`,u.append(d,f);let p=document.createElement(`nav`);p.className=`mint-navigation-submenu-items`,p.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()}),l.append(u,p),this._submenu=l,this._submenuTitle=f,this._submenuItems=p;for(let e of this._dropdowns)p.append(...e.submenuItems);o.append(this._items,c,l),i.append(a,o),this.appendChild(i),this._built=!0,this._syncMobileActions()}_syncMobileActions(){if(!this._mobileActions||!this._actions)return;let e=this._isMobileLayout()?this._mobileActions:this._actions;for(let t of this._mobileActionNodes)e.appendChild(t)}_toMintLink(e){if(e.nodeType!==Node.ELEMENT_NODE||e.tagName!==`A`)return e;let t=document.createElement(`mint-link`);for(;e.firstChild;)t.appendChild(e.firstChild);for(let n of Array.from(e.attributes))n.name!==`slot`&&t.setAttribute(n.name,n.value);return t}_createDropdown(e,t){let n=e.querySelector(`:scope > summary`),r=document.createElement(`mint-button`),i=`mint-navigation-${this._instanceId}-dropdown-${t}`,a=`${i}-popover`;if(r.id=i,r.className=`mint-navigation-dropdown-trigger`,r.setAttribute(`aria-haspopup`,`dialog`),r.setAttribute(`aria-expanded`,`false`),r.setAttribute(`aria-controls`,a),n){for(;n.firstChild;)r.appendChild(n.firstChild);n.remove()}else r.textContent=e.getAttribute(`label`)||`More`;r.setAttribute(`variant`,`ghost`),r.setAttribute(`tone`,`action`),r.setAttribute(`button-type`,`button`),r.setAttribute(`icon-position`,`right`);let o=document.createElement(`mint-popover`);o.id=a,o.className=`mint-navigation-dropdown`,o.setAttribute(`trigger-id`,i),o.setAttribute(`direction`,`down`),o.setAttribute(`aria-label`,`${r.textContent.trim()} links`);for(let t of Array.from(e.childNodes))o.appendChild(this._toMintLink(t));return{trigger:r,popover:o,observer:null}}_registerDropdown(e,t){if(!e||!t)return;t.id||=`mint-navigation-${this._instanceId}-popover-${this._dropdowns.length}`,e.classList.add(`mint-navigation-dropdown-trigger`),e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,String(t.hasAttribute(`open`))),e.setAttribute(`aria-controls`,t.id),t.classList.add(`mint-navigation-dropdown`),t.hasAttribute(`role`)||t.setAttribute(`role`,`group`),t.hasAttribute(`aria-label`)||t.setAttribute(`aria-label`,`${e.textContent.trim()} links`);let n=Array.from(t.querySelectorAll(`mint-link`)).map(e=>e.cloneNode(!0)),r={trigger:e,popover:t,observer:null,triggerId:t.getAttribute(`trigger-id`)||e.id,submenuItems:n};e.addEventListener(`click`,()=>{this._isMobileLayout()&&this._openSubmenu(r)}),this._dropdowns.push(r)}_observeDropdowns(){for(let e of this._dropdowns)e.observer||(e.observer=new MutationObserver(()=>{e.trigger.setAttribute(`aria-expanded`,String(e.popover.hasAttribute(`open`)))}),e.observer.observe(e.popover,{attributes:!0,attributeFilter:[`open`]}))}_isMobileLayout(){return this.getBoundingClientRect().width<=640}_syncResponsiveDropdowns(){let e=this._isMobileLayout();for(let t of this._dropdowns)e?(t.popover.hasAttribute(`open`)&&t.popover.close(),t.popover.getAttribute(`trigger-id`)&&t.popover.setAttribute(`trigger-id`,``)):t.triggerId&&t.popover.getAttribute(`trigger-id`)!==t.triggerId&&t.popover.setAttribute(`trigger-id`,t.triggerId);!e&&this._activeDropdown&&this._closeSubmenu()}_openSubmenu(e){this._isMobileLayout()&&(this._activeDropdown&&this._activeDropdown!==e&&this._activeDropdown.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=e,e.trigger.setAttribute(`aria-expanded`,`true`),this._submenuTitle.textContent=e.trigger.textContent.trim(),this._submenuItems.replaceChildren(...e.submenuItems),this._content.setAttribute(`data-submenu-open`,``))}_closeSubmenu(){this._activeDropdown?.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=null,this._content?.removeAttribute(`data-submenu-open`)}_syncAttributes(){if(this._brandLink){this._brandLink.setAttribute(`href`,this.getBrandHref());let e=this._brandLink.querySelector(`a`);e?e.textContent=this.getBrand():this._brandLink.textContent=this.getBrand()}this._items&&this._items.setAttribute(`aria-label`,this.getLabel()),this._syncOpenState()}_syncOpenState(){if(!this._toggle)return;let e=this.hasAttribute(`open`);this._toggle.setAttribute(`aria-expanded`,String(e));let t=e?`Close navigation menu`:`Open navigation menu`;this._toggle.setAttribute(`aria-label`,t),this._toggleLabel&&(this._toggleLabel.textContent=t),this._toggle.setAttribute(`icon`,e?`close`:`menu`)}openMenu(){this.setAttribute(`open`,``)}closeMenu(){this._closeSubmenu(),this.removeAttribute(`open`)}toggleMenu(){this.hasAttribute(`open`)?this.closeMenu():this.openMenu()}};typeof customElements<`u`&&!customElements.get(`mint-navigation`)&&a(`mint-navigation`,en),s({name:`info`,viewBox:`0 0 24 24`,path:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`success`,viewBox:`0 0 24 24`,path:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`error`,viewBox:`0 0 24 24`,path:`M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`close`,viewBox:`0 0 24 24`,path:`M6 18L18 6M6 6l12 12`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var tn=class extends HTMLElement{static get observedAttributes(){return[`heading`,`dismissable`,`tone`]}constructor(){super(),this._headingElement=null,this._iconElement=null,this._dismissButton=null,this._headerWrapper=null,this._bodyWrapper=null,this._dismissHandler=null,this._rendering=!1,this._childObserver=null,this._normalizingChildren=!1}connectedCallback(){this.render()}disconnectedCallback(){this._childObserver?.disconnect(),this._dismissButton?.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,String(e??``))}get tone(){return this.getTone()}set tone(e){this.setAttribute(`tone`,e)}get dismissable(){return this.isDismissable()}set dismissable(e){this.setAttribute(`dismissable`,String(!!e))}get dismissible(){return this.dismissable}set dismissible(e){this.dismissable=e}cleanupDismissListener(){this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getTone(){let e=this.getAttribute(`tone`);return e===`info`||e===`success`||e===`warning`||e===`danger`?e:`info`}isDismissable(){return this.getAttribute(`dismissable`)===`true`}getIconName(){switch(this.getTone()){case`info`:return`info`;case`success`:return`success`;case`warning`:return`warning`;case`danger`:return`error`;default:return`info`}}getAriaLive(){return this.getTone()===`danger`?`assertive`:`polite`}render(){if(!(this._rendering||!this.isConnected)){this._rendering=!0;try{this.renderContent()}finally{this._rendering=!1}}}renderContent(){this._childObserver?.disconnect();let e=this.getTone(),t=this.getHeading(),n=this.isDismissable(),r=this.getAriaLive();this.setAttribute(`role`,e===`danger`?`alert`:`status`),this.setAttribute(`aria-live`,r),e===`danger`?this.setAttribute(`aria-atomic`,`true`):this.removeAttribute(`aria-atomic`);let i=[];for(this._bodyWrapper?Array.from(this._bodyWrapper.childNodes).forEach(e=>{i.push(e)}):Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&e!==this._iconElement&&e!==this._headingElement&&e!==this._dismissButton&&i.push(e)}),this.cleanupDismissListener();this.firstChild;)this.removeChild(this.firstChild);if(this._headerWrapper=null,this._bodyWrapper=null,this._iconElement=null,this._headingElement=null,this._dismissButton=null,this._headerWrapper=document.createElement(`div`),this._headerWrapper.className=`mint-alert-header`,this._iconElement=document.createElement(`mint-icon`),this._iconElement.setAttribute(`name`,this.getIconName()),this._iconElement.className=`mint-alert-icon`,this._headerWrapper.appendChild(this._iconElement),this._headingElement=document.createElement(`mint-text`),this._headingElement.className=`mint-alert-heading`,this._headingElement.textContent=t||``,this._headerWrapper.appendChild(this._headingElement),n){this._dismissButton=document.createElement(`button`),this._dismissButton.className=`mint-alert-dismiss`,this._dismissButton.setAttribute(`aria-label`,`Dismiss alert`),this._dismissButton.setAttribute(`type`,`button`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`close`),e.className=`mint-alert-close-icon`,this._dismissButton.appendChild(e),this._dismissHandler=e=>{e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},this._dismissButton.addEventListener(`click`,this._dismissHandler),this._headerWrapper.appendChild(this._dismissButton)}this._bodyWrapper=document.createElement(`div`),this._bodyWrapper.className=`mint-alert-body`,i.forEach(e=>{this._bodyWrapper.appendChild(e)}),this.appendChild(this._headerWrapper),this.appendChild(this._bodyWrapper),this._childObserver||=new MutationObserver(()=>this.normalizeConsumerChildren()),this._childObserver.observe(this,{childList:!0})}normalizeConsumerChildren(){if(!(this._normalizingChildren||!this._bodyWrapper)){this._normalizingChildren=!0;try{Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&this._bodyWrapper.appendChild(e)})}finally{this._normalizingChildren=!1}}}};customElements.get(`mint-alert`)||a(`mint-alert`,tn);var H=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`mint-bottom-navigation`),this.setAttribute(`role`,`navigation`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this.hasAttribute(`data-preview`)||this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`is-hidden`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?this.classList.add(`is-hidden`):this.classList.remove(`is-hidden`),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||a(`mint-bottom-navigation`,H);var nn=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`mint-bottom-nav-item`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.hasAttribute(`active`)&&this.getAttribute(`active`)!==`false`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i;e?(i=document.createElement(`a`),i.href=e):(i=document.createElement(`button`),i.type=`button`),i.className=`mint-bottom-nav-link`,i.setAttribute(`aria-current`,r?`page`:`false`);let a=n.split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);i.setAttribute(`aria-label`,t||a||`Navigation item`);let o=document.createElement(`span`);if(o.className=`mint-bottom-nav-icon`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=`mint-bottom-nav-icon-glyph`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`mint-bottom-nav-label`,s.textContent=t,i.appendChild(o),i.appendChild(s),this.replaceChildren(i),this._root=i}};customElements.get(`mint-bottom-nav-item`)||a(`mint-bottom-nav-item`,nn);var rn=H,an=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.5,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._animateNextRender=!1,this._observedDataReference=null,this._observedDataFingerprint=``,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_setupDataObserver(){let e=()=>{if(!this.isConnected)return;let e=this.data,t=null;e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(t=e);let n=``;if(t)try{n=JSON.stringify(t)}catch{n=``}t&&(t!==this._observedDataReference||n&&n!==this._observedDataFingerprint)&&(this._observedDataReference=t,this._observedDataFingerprint=n,this._chartData=t,this._animateNextRender=!0,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{e(),requestAnimationFrame(()=>{e()})});let t=setInterval(()=>{if(!this.isConnected){clearInterval(t);return}e()},250);this._dataCheckInterval=t}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`data`){if(n)try{this._chartData=JSON.parse(n)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=null;this._invalidateDataCaches(),this._animateNextRender=!0}(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()})}}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this._invalidateDataCaches(),this._animateNextRender=!0,this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._animateNextRender=!0,this._syncObservedData(),!this._renderScheduled&&(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_invalidateDataCaches(){this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent?.clear()}_syncObservedData(){this._observedDataReference=this._chartData;try{this._observedDataFingerprint=this._chartData?JSON.stringify(this._chartData):``}catch{this._observedDataFingerprint=``}}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;let e=this._animateNextRender&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches&&this._svg?this._svg.cloneNode(!0):null;this._animateNextRender=!1,this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let t=this.data;if(t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(this._chartData=t),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let n=this.getBoundingClientRect(),r=n.width||this.parentElement?.clientWidth||800,i=n.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,r,r),this._height=this._calculateDimension(this._heightValue,i,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let a=this.getAttribute(`curve-tension`);if(a!==null){let e=parseFloat(a);this._curveTension=isNaN(e)?.5:Math.max(0,Math.min(1,e))}else this._curveTension=.5;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,this._chartContainer.style.position=`relative`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._svg.setAttribute(`role`,`img`);let o=this._chartData.datasets.map(e=>e.name).filter(Boolean),s=this.getAttribute(`aria-label`)?.trim()||`${this.type} chart${o.length?` showing ${o.join(`, `)}`:``}. ${Math.max(0,...this._chartData.datasets.map(e=>e.data.length))} data points.`,c=`${this.id||`mint-chart-${Math.random().toString(36).slice(2,10)}`}-data`;this._svg.setAttribute(`aria-label`,s),this._svg.setAttribute(`aria-describedby`,c),this._chartContainer&&this._svg&&(e&&(e.style.position=`absolute`,e.style.inset=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`none`,e.style.zIndex=`1`,e.style.opacity=`1`,e.style.transition=`opacity 260ms ease`,this._chartContainer.appendChild(e),this._svg.style.position=`relative`,this._svg.style.zIndex=`0`,this._svg.style.opacity=`0`,this._svg.style.transition=`opacity 260ms ease`),this._chartContainer.appendChild(this._svg));let l=document.createElement(`table`);l.id=c,Object.assign(l.style,{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:`0`});let u=document.createElement(`caption`);u.textContent=`Data for ${s}`,l.appendChild(u);let d=document.createElement(`thead`),f=document.createElement(`tr`),p=document.createElement(`th`);p.scope=`col`,p.textContent=`Category`,f.appendChild(p),this._chartData.datasets.forEach(e=>{let t=document.createElement(`th`);t.scope=`col`,t.textContent=e.name||`Series`,f.appendChild(t)}),d.appendChild(f),l.appendChild(d);let m=document.createElement(`tbody`),h=Math.max(0,...this._chartData.datasets.map(e=>e.data.length));for(let e=0;e<h;e+=1){let t=document.createElement(`tr`),n=document.createElement(`th`);n.scope=`row`,n.textContent=String(this._chartData.datasets.find(t=>t.data[e])?.data[e]?.x??e+1),t.appendChild(n),this._chartData.datasets.forEach(n=>{let r=document.createElement(`td`),i=n.data[e];r.textContent=i?this._formatValue(i.y,n):``,t.appendChild(r)}),m.appendChild(t)}switch(l.appendChild(m),this.appendChild(l),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}if(this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine(),e&&this._svg){let t=this._svg;requestAnimationFrame(()=>requestAnimationFrame(()=>{t.isConnected&&(e.style.opacity=`0`,t.style.opacity=`1`,window.setTimeout(()=>e.remove(),280))}))}}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
102
105
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
103
106
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
104
107
|
</div>`}),this._cachedTooltipContent.set(e,a)),this._updateTooltipPosition(n,r),this._lastTooltipContent!==a&&this._showTooltipAt(n,r,a);return}}if(this._activeXValue===s){this._updateTooltipPosition(n,r);return}let c=this._getAllDatasetsAtX(s);if(c.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=s,this._showPlotPointsForX(s),this._showVerticalLineAtX(s,t);let l=this._cachedTooltipContent.get(s);if(!l){if(l=this._tooltipXHeadingHtml(s),c.forEach(e=>{l+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
@@ -122,7 +125,7 @@ mint-select > optgroup {
|
|
|
122
125
|
</div>`}),this._cachedTooltipContent.size>=e.MAX_CACHE_SIZE){let e=this._cachedTooltipContent.keys().next().value;e!==void 0&&this._cachedTooltipContent.delete(e)}this._cachedTooltipContent.set(o,c)}this._showTooltipAt(r.clientX,r.clientY,c)}))},l=()=>{this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._pinnedXValue===null&&setTimeout(()=>{this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null},500)};this._chartClickOutsideHandler||(this._chartClickOutsideHandler=e=>{if(this._pinnedXValue===null)return;let t=e.target;this._svg&&!this._svg.contains(t)&&(this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null)},document.addEventListener(`click`,this._chartClickOutsideHandler,!0)),this._svg.addEventListener(`mousemove`,i),this._svg.addEventListener(`mouseleave`,a),this._svg.addEventListener(`click`,o),this._svg.addEventListener(`touchstart`,s,{passive:!0}),this._svg.addEventListener(`touchmove`,c,{passive:!0}),this._svg.addEventListener(`touchend`,l),this._chartTooltipMouseMove=i,this._chartTooltipMouseLeave=a,this._chartTooltipClick=o,this._chartTooltipTouchStart=s,this._chartTooltipTouchMove=c,this._chartTooltipTouchEnd=l}_updateTooltipPosition(e,t){if(!this._tooltip||this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)return;let n=this._tooltip.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=e+10,o=t-n.height-8;a+n.width>r&&(a=e-n.width-10),a<0&&(a=10),o<0&&(o=t+20),o+n.height>i&&(o=t-n.height-8,o<0&&(o=10));let s=`${a}px`,c=`${o}px`;this._tooltip.style.left!==s&&(this._tooltip.style.left=s),this._tooltip.style.top!==c&&(this._tooltip.style.top=c)}_scaleX(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=t.width/Math.max(1,n.length-1);return t.x+r*i}_scaleY(e,t){let n=this._getYRange();if(n.max===n.min)return t.y+t.height/2;let r=(e-n.min)/(n.max-n.min);return t.y+t.height-r*t.height}_getDatasetColor(e,t,n){return n===void 0?e.color||this._defaultColors[t%this._defaultColors.length]:e.color||this._defaultColors[n%this._defaultColors.length]}_getContrastColor(e){let t=e.replace(`#`,``),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`}_calculateRotatedLabelHeight(){if(this._rotatedLabelHeight=0,!this._chartData||!this._showGrid)return;let e=this._getXValues();if(e.length<=1)return;let t={width:this._width-(this._showGrid?60:0)-0,height:this._height-(this._showLegend?Math.max(this._legendHeight,60):0)-0,x:this._showGrid?60:0,y:0},n=this._chartType===`bar`,r=[];e.forEach(e=>{let i=n?this._scaleXForBarChart(e,t):this._scaleX(e,t);r.push(i)});let i=document.createElement(`canvas`).getContext(`2d`);if(!i)return;i.font=`12px system-ui, -apple-system, sans-serif`;let a=[];e.forEach(e=>{let t=this._formatXAxisValue(e),n=i.measureText(t);a.push(n.width)});let o=!0;for(let t=1;t<e.length;t++){let e=r[t]-r[t-1],n=a[t-1]/2+a[t]/2+10;if(e<Math.max(n,80)){o=!1;break}}if(!o){let e=(Math.max(...a)+12*1.2)*.707;this._rotatedLabelHeight=Math.ceil(e)+10}}_renderGrid(e){if(!this._svg||!this._showGrid)return;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-grid`);let n=this._getYRange(),r=Math.floor(e.height/35),i=Math.min(5,r);for(let r=0;r<=i;r++){let a=e.y+e.height/i*r,o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,e.x.toString()),o.setAttribute(`y1`,a.toString()),o.setAttribute(`x2`,(e.x+e.width).toString()),o.setAttribute(`y2`,a.toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let s=n.max-(n.max-n.min)/i*r,c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),l=a+4;r===0&&(l=a+12),c.setAttribute(`x`,`5`),c.setAttribute(`y`,l.toString()),c.setAttribute(`text-anchor`,`start`),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),c.textContent=this._formatYAxisValue(s),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}let a=this._getXValues();if(a.length===0){this._svg.appendChild(t);return}let o=this._chartType===`bar`,s=[];a.forEach(t=>{let n=o?this._scaleXForBarChart(t,e):this._scaleX(t,e);s.push(n)});let c=document.createElement(`canvas`).getContext(`2d`),l=!1,u=Array(a.length).fill(!0);if(c&&a.length>1){c.font=`12px system-ui, -apple-system, sans-serif`;let e=[];a.forEach(t=>{let n=this._formatXAxisValue(t),r=c.measureText(n);e.push(r.width)});let t=!0;for(let n=1;n<a.length;n++){let r=s[n]-s[n-1],i=e[n-1]/2+e[n]/2+10;if(r<Math.max(i,80)){t=!1;break}}if(!t){l=!0;let t=12*1.2;if(this._rotatedLabelHeight===0){let n=(Math.max(...e)+t)*.707;this._rotatedLabelHeight=Math.ceil(n)+10}let n=t*1.5,r=!0;for(let e=1;e<a.length;e++)if(s[e]-s[e-1]<n){r=!1;break}if(!r){let e=n;u=Array(a.length).fill(!1);let t=-1/0;a.length>0&&(u[0]=!0,t=s[0]);for(let n=1;n<a.length-1;n++){let r=s[n];r-t>=e&&(u[n]=!0,t=r)}if(a.length>1){let n=s[a.length-1];if(n-t>=e)u[a.length-1]=!0;else{for(;n-t<e;){let e=!1;for(let n=a.length-2;n>=0;n--)if(u[n]){if(u[n]=!1,n>0){for(let r=n-1;r>=0;r--)if(u[r]){t=s[r],e=!0;break}e||(t=s[0])}else t=s[0];e=!0;break}if(!e)break}n-t>=e&&(u[a.length-1]=!0)}}}}}else u=Array(a.length).fill(!1),a.length>0&&(u[0]=!0),a.length>1&&(u[a.length-1]=!0),this._rotatedLabelHeight=0;l||(this._rotatedLabelHeight=0),a.forEach((n,r)=>{if(u[r]){let i=s[r],o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,i.toString()),o.setAttribute(`y1`,e.y.toString()),o.setAttribute(`x2`,i.toString()),o.setAttribute(`y2`,(e.y+e.height).toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),u=i,d=`middle`;if(!l){if(r===0){let t=e.x;u=Math.max(i,t),d=`start`}else if(r===a.length-1){let t=e.x+e.width;u=Math.min(i,t),d=`end`}}else if(d=`end`,r===a.length-1){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`12px system-ui, -apple-system, sans-serif`;let r=this._formatXAxisValue(n),a=t.measureText(r).width*.707,o=e.x+e.width+100;u=Math.min(i,o-a)}}c.setAttribute(`x`,u.toString());let f=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,p=f;this._showLegend&&(p=f+20+Math.max(this._legendHeight,60));let m=(this._height-e.y-e.height)/p,h=(l?30:20)*m,g=e.y+e.height+h;c.setAttribute(`y`,g.toString()),c.setAttribute(`text-anchor`,d),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),l&&c.setAttribute(`transform`,`rotate(-45 ${u} ${g})`),c.textContent=this._formatXAxisValue(n),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}}),this._svg.appendChild(t)}_buildMonotoneXLinePathD(e){let t=e=>e<0?-1:1,n=(e,n,r,i,a,o)=>{let s=r-e,c=a-r,l=(i-n)/(s||c<0&&-0),u=(o-i)/(c||s<0&&-0),d=(l*c+u*s)/(s+c||1e-12);return(t(l)+t(u))*Math.min(Math.abs(l),Math.abs(u),.5*Math.abs(d))||0},r=(e,t,n,r,i)=>{let a=n-e;return a?(3*((r-t)/a)-i)/2:i},i=(e,t,n,r,i,a,o)=>{let s=(r-t)/3;e.push(`C ${t+s} ${n+s*a} ${r-s} ${i-s*o} ${r} ${i}`)},a=[];for(let t of e){let e=a[a.length-1];(!e||e.x!==t.x||e.y!==t.y)&&a.push(t)}if(a.length===0)return``;if(a.length===1)return`M ${a[0].x} ${a[0].y}`;let o=[],s=NaN,c=NaN,l=NaN,u=NaN,d=NaN,f=0;for(let e of a){let t=e.x,a=e.y;if(!(t===l&&a===u))switch(f){case 0:o.push(`M ${t} ${a}`),s=t,c=a,l=t,u=a,f=1;break;case 1:l=t,u=a,f=2;break;case 2:{let e=n(s,c,l,u,t,a);i(o,s,c,l,u,r(s,c,l,u,e),e),s=l,c=u,l=t,u=a,d=e,f=3;break}default:{let e=n(s,c,l,u,t,a);i(o,s,c,l,u,d,e),s=l,c=u,l=t,u=a,d=e}}}return f===2?o.push(`L ${l} ${u}`):f===3&&i(o,s,c,l,u,d,r(s,c,l,u,d)),o.join(` `)}_stripLeadingMoveTo(e){return e.replace(/^M\s+[\d.-]+\s+[\d.-]+\s*/i,``).trim()}_buildAreaFillPathD(e,t){if(e.length===0)return``;let n=e[e.length-1];if(e.length===1)return`M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} L ${e[0].x} ${t} Z`;if(this._curveTension<=0){let r=[`M ${e[0].x} ${t}`,`L ${e[0].x} ${e[0].y}`];for(let t=1;t<e.length;t++)r.push(`L ${e[t].x} ${e[t].y}`);return r.push(`L ${n.x} ${t}`,`Z`),r.join(` `)}let r=this._buildMonotoneXLinePathD(e),i=this._stripLeadingMoveTo(r);return`M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} ${i} L ${n.x} ${t} Z`}_buildSmoothLinePathD(e){if(e.length===0)return``;if(e.length===1)return`M ${e[0].x} ${e[0].y}`;if(this._curveTension<=0){let t=[`M ${e[0].x} ${e[0].y}`];for(let n=1;n<e.length;n++)t.push(`L ${e[n].x} ${e[n].y}`);return t.join(` `)}return this._buildMonotoneXLinePathD(e)}_renderLineChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),o=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));o.length!==0&&(a.setAttribute(`d`,this._buildSmoothLinePathD(o)),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,i),a.setAttribute(`stroke-width`,`2`),a.setAttribute(`stroke-linecap`,`round`),a.setAttribute(`stroke-linejoin`,`round`),n.appendChild(a),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)}))}),t.appendChild(n),this._svg.appendChild(t)}_scaleXForBarChart(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=n.length+1,a=t.width/i;return t.x+(r+1)*a}_renderBarChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment(),r=this._getXValues(),i=this._chartData.datasets.filter((e,t)=>this._isDatasetVisible(e,t)).length,a=r.length;if(a===0)return;let o=[];r.forEach(t=>{o.push(this._scaleXForBarChart(t,e))}),o.sort((e,t)=>e-t);let s=e.width;if(a>1)for(let e=0;e<o.length-1;e++){let t=o[e+1]-o[e];t>0&&t<s&&(s=t)}else s=e.width*.5;let c=s*.7,l=.2,u=c/((1+l)*i-l),d=u*l,f=(u+d)*i-d;if(f>c){let e=c/f;u*=e,d=u*l,f=(u+d)*i-d}let p=0;this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=-f/2+(u+d)*p;p++,t.data.forEach(o=>{let s=this._scaleXForBarChart(o.x,e),c=this._scaleY(o.y,e),l=e.y+e.height-c,d=s+a,f=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);f.setAttribute(`x`,d.toString()),f.setAttribute(`y`,c.toString()),f.setAttribute(`width`,u.toString()),f.setAttribute(`height`,l.toString()),f.setAttribute(`fill`,i),f.setAttribute(`rx`,`2`),f.setAttribute(`class`,`chart-bar`),f.setAttribute(`data-dataset`,r.toString()),f.setAttribute(`data-x`,String(o.x)),f.setAttribute(`data-y`,o.y.toString()),f.setAttribute(`data-name`,t.name),f.style.cursor=`pointer`,this._showTooltip&&f.addEventListener(`mouseenter`,e=>{let t=this._getAllDatasetsAtX(o.x),n=this._tooltipXHeadingHtml(o.x);t.forEach(e=>{n+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
123
126
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
124
127
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
125
|
-
</div>`}),this._showTooltipAt(e.clientX,e.clientY,n)}),n.appendChild(f)})}),t.appendChild(n),this._svg.appendChild(t)}_renderAreaChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(a.length===0)return;let o=e.y+e.height,s=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);s.setAttribute(`d`,this._buildAreaFillPathD(a,o)),s.setAttribute(`fill`,i),s.setAttribute(`fill-opacity`,`0.3`),n.appendChild(s);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);c.setAttribute(`d`,this._buildSmoothLinePathD(a)),c.setAttribute(`fill`,`none`),c.setAttribute(`stroke`,i),c.setAttribute(`stroke-width`,`2`),c.setAttribute(`stroke-linecap`,`round`),c.setAttribute(`stroke-linejoin`,`round`),n.appendChild(c),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_renderPieChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds(),t=e.x+e.width/2,n=e.y+e.height/2,r=Math.min(e.width,e.height)/2-20,i=this._chartData.datasets[0];if(!i||!i.data||i.data.length===0)return;let a=i.data.reduce((e,t)=>e+t.y,0);if(a===0)return;let o=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);o.setAttribute(`class`,`chart-data`),this._pieChartGroup=o,this._pieChartClickOutsideHandler||(this._pieChartClickOutsideHandler=e=>{if(!this._pieChartTooltipShown)return;let t=e.target;this._pieChartGroup&&!this._pieChartGroup.contains(t)&&(this._pieChartTooltipShown=!1,this._hideTooltip())},document.addEventListener(`click`,this._pieChartClickOutsideHandler,!0));let s=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);s.setAttribute(`cx`,t.toString()),s.setAttribute(`cy`,n.toString()),s.setAttribute(`r`,r.toString()),s.setAttribute(`fill`,`transparent`),s.setAttribute(`pointer-events`,`none`),o.appendChild(s);let c=-Math.PI/2;i.data.forEach((e,s)=>{let l=e.y,u=l/a*100,d=l/a*2*Math.PI,f=e.color||this._getDatasetColor(i,0,s),p=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);p.setAttribute(`class`,`chart-pie-slice-group`),p.setAttribute(`data-index`,s.toString()),p.style.cursor=`pointer`,p.style.transition=`transform 0.2s ease-out`;let m=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),h=r+2,g=t+h*Math.cos(c),_=n+h*Math.sin(c),v=t+h*Math.cos(c+d),y=n+h*Math.sin(c+d),b=d>Math.PI?1:0,x=[`M ${t} ${n}`,`L ${g} ${_}`,`A ${h} ${h} 0 ${b} 1 ${v} ${y}`,`Z`].join(` `);m.setAttribute(`d`,x),m.setAttribute(`fill`,f),m.setAttribute(`class`,`chart-pie-slice`),m.setAttribute(`data-index`,s.toString()),m.setAttribute(`data-x`,String(e.x)),m.setAttribute(`data-y`,e.y.toString()),m.setAttribute(`data-name`,i.name),m.setAttribute(`data-percentage`,u.toFixed(1)),p.appendChild(m);let S=c+d/2,C=Math.cos(S)*10,w=Math.sin(S)*10,T=null,E=null,D=!1;if(p.__chartInstance=this,p.addEventListener(`mouseenter`,function(){if(E!==null&&(clearTimeout(E),E=null),!D){T!==null&&clearTimeout(T);let e=window.setTimeout(()=>{D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`),T=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},150);T=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`mouseleave`,function(){if(T!==null&&(clearTimeout(T),T=null),D){E!==null&&clearTimeout(E);let e=window.setTimeout(()=>{D=!1,this.setAttribute(`transform`,`translate(0, 0)`),E=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},200);E=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,function(){T!==null&&(clearTimeout(T),T=null),E!==null&&(clearTimeout(E),E=null),D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`)}),this._showTooltip){let t=
|
|
128
|
+
</div>`}),this._showTooltipAt(e.clientX,e.clientY,n)}),n.appendChild(f)})}),t.appendChild(n),this._svg.appendChild(t)}_renderAreaChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(a.length===0)return;let o=e.y+e.height,s=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);s.setAttribute(`d`,this._buildAreaFillPathD(a,o)),s.setAttribute(`fill`,i),s.setAttribute(`fill-opacity`,`0.3`),n.appendChild(s);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);c.setAttribute(`d`,this._buildSmoothLinePathD(a)),c.setAttribute(`fill`,`none`),c.setAttribute(`stroke`,i),c.setAttribute(`stroke-width`,`2`),c.setAttribute(`stroke-linecap`,`round`),c.setAttribute(`stroke-linejoin`,`round`),n.appendChild(c),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_renderPieChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds(),t=e.x+e.width/2,n=e.y+e.height/2,r=Math.min(e.width,e.height)/2-20,i=this._chartData.datasets[0];if(!i||!i.data||i.data.length===0)return;let a=i.data.reduce((e,t)=>e+t.y,0);if(a===0)return;let o=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);o.setAttribute(`class`,`chart-data`),this._pieChartGroup=o,this._pieChartClickOutsideHandler||(this._pieChartClickOutsideHandler=e=>{if(!this._pieChartTooltipShown)return;let t=e.target;this._pieChartGroup&&!this._pieChartGroup.contains(t)&&(this._pieChartTooltipShown=!1,this._hideTooltip())},document.addEventListener(`click`,this._pieChartClickOutsideHandler,!0));let s=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);s.setAttribute(`cx`,t.toString()),s.setAttribute(`cy`,n.toString()),s.setAttribute(`r`,r.toString()),s.setAttribute(`fill`,`transparent`),s.setAttribute(`pointer-events`,`none`),o.appendChild(s);let c=-Math.PI/2;i.data.forEach((e,s)=>{let l=e.y,u=l/a*100,d=l/a*2*Math.PI,f=e.color||this._getDatasetColor(i,0,s),p=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);p.setAttribute(`class`,`chart-pie-slice-group`),p.setAttribute(`data-index`,s.toString()),p.style.cursor=`pointer`,p.style.transition=`transform 0.2s ease-out`;let m=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),h=r+2,g=t+h*Math.cos(c),_=n+h*Math.sin(c),v=t+h*Math.cos(c+d),y=n+h*Math.sin(c+d),b=d>Math.PI?1:0,x=[`M ${t} ${n}`,`L ${g} ${_}`,`A ${h} ${h} 0 ${b} 1 ${v} ${y}`,`Z`].join(` `);m.setAttribute(`d`,x),m.setAttribute(`fill`,f),m.setAttribute(`class`,`chart-pie-slice`),m.setAttribute(`data-index`,s.toString()),m.setAttribute(`data-x`,String(e.x)),m.setAttribute(`data-y`,e.y.toString()),m.setAttribute(`data-name`,i.name),m.setAttribute(`data-percentage`,u.toFixed(1)),p.appendChild(m);let S=c+d/2,C=Math.cos(S)*10,w=Math.sin(S)*10,T=null,E=null,D=!1;if(p.__chartInstance=this,p.addEventListener(`mouseenter`,function(){if(E!==null&&(clearTimeout(E),E=null),!D){T!==null&&clearTimeout(T);let e=window.setTimeout(()=>{D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`),T=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},150);T=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`mouseleave`,function(){if(T!==null&&(clearTimeout(T),T=null),D){E!==null&&clearTimeout(E);let e=window.setTimeout(()=>{D=!1,this.setAttribute(`transform`,`translate(0, 0)`),E=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},200);E=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,function(){T!==null&&(clearTimeout(T),T=null),E!==null&&(clearTimeout(E),E=null),D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`)}),this._showTooltip){let t=this._formatValue(l,i),n=`${this._tooltipXHeadingHtml(e.x)}${i.name}: ${t}<br/>${u.toFixed(1)}%`,r=e=>{this._pieChartTooltipShown=!0,this._showTooltipAt(e.clientX,e.clientY,n)};p.addEventListener(`mouseenter`,r),p.addEventListener(`mousemove`,r),p.addEventListener(`click`,e=>{e.stopPropagation(),r(e)}),p.addEventListener(`mouseleave`,()=>{this._tooltipHideTimeout=window.setTimeout(()=>{this._pieChartTooltipShown=!1,this._hideTooltip()},90)})}if(u>5){let e=c+d/2,i=r*.7,a=t+i*Math.cos(e),o=n+i*Math.sin(e),s=this._getContrastColor(f),l=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);l.setAttribute(`x`,a.toString()),l.setAttribute(`y`,o.toString()),l.setAttribute(`text-anchor`,`middle`),l.setAttribute(`dominant-baseline`,`middle`),l.setAttribute(`fill`,s),l.setAttribute(`font-size`,`12`),l.setAttribute(`font-weight`,`500`),l.textContent=`${u.toFixed(1)}%`,p.appendChild(l)}o.appendChild(p),c+=d}),this._svg.appendChild(o),this._showTooltip&&(this._svg.addEventListener(`mousemove`,e=>{this._pieChartTooltipShown&&this._lastTooltipContent&&this._showTooltipAt(e.clientX,e.clientY,this._lastTooltipContent)}),this._svg.addEventListener(`mouseleave`,()=>{this._pieChartTooltipShown=!1,this._hideTooltip()}))}_calculateLegendHeight(){if(!this._chartData)return 0;let e=this._width-40,t=[];this._chartType===`pie`&&this._chartData.datasets.length>0?this._chartData.datasets[0].data.forEach(e=>{t.push({name:String(e.x),row:0})}):this._chartData.datasets.forEach(e=>{t.push({name:e.name,row:0})});let n=0,r=[];return t.forEach(t=>{let i=20+Math.min(t.name.length*7.5,150);r[n]||(r[n]=[]),r[n].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+i>e&&r[n].length>0&&(n++,r[n]=[]),t.row=n,r[n].push(t)}),r.length*36}_renderLegend(){if(!this._chartData||!this._svg)return{height:0};let e=this._svg.querySelector(`.chart-legend`);e&&e.remove();let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);if(t.setAttribute(`class`,`chart-legend`),!this._chartData)return{height:0};let n=this._chartData,r=this._width-40,i=[];if(this._chartType===`pie`&&n.datasets.length>0){let e=n.datasets[0];e.data.forEach((t,n)=>{let r=t.color||this._getDatasetColor(e,0,n),a=String(t.x);i.push({name:a,color:r,x:0,textX:0,row:0})})}else n.datasets.forEach((e,t)=>{if(!this._isDatasetVisible(e,t))return;let n=this._getDatasetColor(e,t);i.push({name:e.name,color:n,x:0,textX:0,row:0})});let a=0,o=[];i.forEach(e=>{let t=20+Math.min(e.name.length*7.5,150);o[a]||(o[a]=[]),o[a].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+t>r&&o[a].length>0&&(a++,o[a]=[]),e.row=a,o[a].push(e)}),o.forEach(e=>{let t=e.reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150)),0)+(e.length-1)*32,n=(this._width-t)/2;e.forEach(e=>{let t=Math.min(e.name.length*7.5,150);e.x=n,e.textX=n+6+8,n+=20+t+32})}),o.length*36;let s=this._getChartBounds(),c=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,l=c;this._showLegend&&(l=c+20+Math.max(this._legendHeight,60));let u=this._height-s.y-s.height,d=l>0?u/l:1,f=(this._rotatedLabelHeight>0?30:20)*d,p=12*d,m=this._rotatedLabelHeight*d,h=s.y+s.height+f+(this._rotatedLabelHeight>0?m:p)+20*d;return i.forEach(e=>{let n=h+e.row*36+16/2,r=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);r.setAttribute(`cx`,e.x.toString()),r.setAttribute(`cy`,n.toString()),r.setAttribute(`r`,`6`),r.setAttribute(`fill`,e.color),t.appendChild(r);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`foreignObject`);i.setAttribute(`x`,e.textX.toString()),i.setAttribute(`y`,(n-12).toString()),i.setAttribute(`width`,`150`),i.setAttribute(`height`,`24`);let a=document.createElement(`div`);a.style.cssText=`
|
|
126
129
|
font-size: 12px;
|
|
127
130
|
font-family: system-ui, -apple-system, sans-serif;
|
|
128
131
|
color: ${document.documentElement.classList.contains(`dark`)?`#d1d5db`:`#374151`};
|
|
@@ -134,6 +137,7 @@ mint-select > optgroup {
|
|
|
134
137
|
display: flex;
|
|
135
138
|
align-items: center;
|
|
136
139
|
height: 100%;
|
|
137
|
-
`,a.textContent=e.name,i.appendChild(a),t.appendChild(i)}),this._svg.appendChild(t),{height:this._legendHeight+50}}async addDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.push(t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchAddDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,point:r}of e)this._chartData.datasets[n]&&(this._chartData.datasets[n].data.push(r),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async updateDatasetData(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data=t,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async addDataset(e){return this._chartData?(this._chartData.datasets.push(e),e.id&&this._datasetVisibility.set(e.id,e.visible!==!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Chart data not initialized`),Promise.reject(Error(`Chart data not initialized`)))}async removeDataset(e){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets.splice(e,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async updateDataPoint(e,t,n){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):this._chartData.datasets[e].data[t]?(this._chartData.datasets[e].data[t]=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Data point at index ${t} does not exist`),Promise.reject(Error(`Data point at index ${t} does not exist`)))}async batchUpdateDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r,point:i}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data[r]=i,t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async removeDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.splice(t,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchRemoveDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data.splice(r,1),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async showDataset(e){return this._datasetVisibility.set(e,!0),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async hideDataset(e){return this._datasetVisibility.set(e,!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async toggleDataset(e){let t=!(this._datasetVisibility.get(e)??!0);return this._datasetVisibility.set(e,t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),await new Promise(e=>requestAnimationFrame(()=>e())),t}isDatasetVisible(e){return this._datasetVisibility.get(e)}async downloadAsPNG(e=`chart.png`){if(!this._svg)return console.error(`Chart SVG not found`),Promise.reject(Error(`Chart SVG not found`));let t=this._svg.cloneNode(!0),n=this._width,r=this._height;t.querySelectorAll(`text`).forEach(e=>{let t=e.getAttribute(`font-family`);(!t||t.includes(`system-ui`)||t.includes(`apple-system`))&&e.setAttribute(`font-family`,`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`)}),t.setAttribute(`width`,n.toString()),t.setAttribute(`height`,r.toString()),t.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),t.querySelectorAll(`foreignObject`).forEach(e=>{let t=e.querySelector(`div`);if(t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),r=e.getAttribute(`x`)||`0`,i=e.getAttribute(`y`)||`0`;n.setAttribute(`x`,r),n.setAttribute(`y`,(parseFloat(i)+12).toString()),n.setAttribute(`fill`,t.style.color||`#374151`),n.setAttribute(`font-size`,`12`),n.setAttribute(`font-family`,t.style.fontFamily||`system-ui, -apple-system, sans-serif`),n.textContent=t.textContent||``,e.parentNode&&e.parentNode.replaceChild(n,e)}});let i=new XMLSerializer().serializeToString(t),a=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(i),o=new Image;return o.crossOrigin=`anonymous`,new Promise((t,i)=>{o.onload=()=>{setTimeout(()=>{let a=document.createElement(`canvas`);a.width=n+60,a.height=r+60;let s=a.getContext(`2d`);if(!s){console.error(`Could not get canvas context`),i(Error(`Could not get canvas context`));return}s.fillStyle=document.documentElement.classList.contains(`dark`)?`#111827`:`#ffffff`,s.fillRect(0,0,a.width,a.height),s.drawImage(o,30,30),a.toBlob(n=>{if(!n){console.error(`Could not create blob from canvas`),i(Error(`Could not create blob from canvas`));return}let r=URL.createObjectURL(n),a=document.createElement(`a`);a.href=r,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r),t()},`image/png`)},0)},o.onerror=()=>{console.error(`Error loading SVG image`),i(Error(`Error loading SVG image`))},o.src=a})}};customElements.get(`mint-chart`)||customElements.define(`mint-chart`,L);var R=class extends HTMLElement{constructor(...e){super(...e),this._trigger=null,this._submenuContainer=null,this._contentObserver=null,this._renderFrame=null}static get observedAttributes(){return[`label`,`icon`,`href`,`active`,`expanded`,`submenu-item`]}connectedCallback(){this.classList.add(`block`),this.render(),this._observeSubmenuMutations()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`active`&&this._isSubmenuItem()&&this._refreshDropdownAncestor())}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeSubmenuMutations(){this._contentObserver||=new MutationObserver(e=>{e.some(e=>[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>e instanceof HTMLElement&&e.getAttribute(`slot`)===`submenu`))&&this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`],subtree:!1})}_refreshDropdownAncestor(){let e=this.parentElement;for(;e;){if(e.tagName===`MINT-SIDENAV-LINK`&&e!==this){e.render();break}e=e.parentElement}}_isActive(){return this.getAttribute(`active`)===`true`}_isExpanded(){return this.getAttribute(`expanded`)===`true`}_isSubmenuPanelVisible(){return this._isExpanded()||this._isActive()}_isSubmenuItem(){return this.getAttribute(`submenu-item`)===`true`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}_getBaseClasses(){let e=this._isActive()?`border-black/20 bg-black/5 text-black dark:border-white/20 dark:bg-white/10 dark:text-white`:`border-transparent text-gray-700 hover:bg-black/5 dark:text-gray-200 dark:hover:bg-white/10`;return[`w-full`,`cursor-pointer`,`rounded-lg`,`border`,`block`,this._isSubmenuItem()?`px-2 py-1.5`:`px-3 py-2`,`text-left`,`text-sm`,e].join(` `)}_hasSubmenu(){return this.querySelectorAll(`:scope > [slot="submenu"]`).length>0?!0:!!this._submenuContainer&&this._submenuContainer.children.length>0}_createRow(e,t){let n=document.createElement(`span`);if(this._isSubmenuItem(),n.className=`inline-flex w-full items-center justify-start gap-2`,t){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,t),e.className=`h-4 w-4 shrink-0`,n.appendChild(e)}let r=document.createElement(`span`);return r.className=`inline truncate`,r.textContent=e,n.appendChild(r),n}_buildSimpleLink(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=e?document.createElement(`a`):document.createElement(`button`);e?(r.setAttribute(`href`,e),r.setAttribute(`role`,`link`)):r.setAttribute(`type`,`button`),r.className=this._getBaseClasses(),r.setAttribute(`aria-label`,t||`Side navigation link`),r.appendChild(this._createRow(t,n)),this.replaceChildren(r),this._trigger=r}_emitAccordionExpand(){this.dispatchEvent(new CustomEvent(`mint-sidenav-accordion`,{bubbles:!0,composed:!0,detail:{source:this}}))}_setExpanded(e,t){this.setAttribute(`expanded`,String(e)),e&&t&&this._emitAccordionExpand()}_buildDropdownLink(){let e=this._getLabel(),t=this._getIcon(),n=this._getHref(),r=Array.from(this.querySelectorAll(`:scope > [slot="submenu"]`)),i=r.length>0?r:this._submenuContainer?Array.from(this._submenuContainer.children):[],a=document.createElement(`div`);a.className=`w-full`,this._submenuContainer=document.createElement(`div`),this._submenuContainer.id=`mint-sidenav-submenu-${Math.random().toString(36).slice(2,11)}`;let o=this._submenuContainer.id;if(this._submenuContainer.className=[`mint-sidenav-submenu`,`mt-1`,`ml-5`,`border-l`,`border-gray-200`,`pl-2`,`space-y-1`,`dark:border-mint-divider`,this._isSubmenuPanelVisible()?`block`:`hidden`].join(` `),i.forEach(e=>{e.setAttribute(`submenu-item`,`true`),e.setAttribute(`slot`,`submenu`),this._submenuContainer?.appendChild(e)}),n){let r=document.createElement(`div`);r.className=`flex w-full items-stretch gap-1`;let i=document.createElement(`a`);i.setAttribute(`href`,n),i.className=`${this._getBaseClasses()} hidden min-[1100px]:block`,i.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),i.setAttribute(`aria-controls`,o),this._isActive()?i.setAttribute(`aria-current`,`page`):i.removeAttribute(`aria-current`),i.appendChild(this._createRow(e,t)),i.addEventListener(`click`,()=>{this._setExpanded(!0,!0)});let s=document.createElement(`a`);s.setAttribute(`href`,n),s.className=`${this._getBaseClasses()} block min-w-0 min-[1100px]:hidden`,s.style.flex=`1 1 auto`,s.setAttribute(`aria-controls`,o),s.appendChild(this._createRow(e,t)),this._isActive()?s.setAttribute(`aria-current`,`page`):s.removeAttribute(`aria-current`);let c=document.createElement(`button`);c.type=`button`,c.className=[`inline-flex`,`items-center`,`justify-center`,`rounded-lg`,`border`,`border-transparent`,`px-2`,`text-gray-600`,`hover:bg-black/5`,`dark:text-gray-300`,`dark:hover:bg-white/10`,`min-[1100px]:hidden`].join(` `),c.setAttribute(`aria-label`,`Toggle ${e} submenu`),c.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),c.setAttribute(`aria-controls`,o),c.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation();let t=!this._isExpanded();this._setExpanded(t,t)});let l=document.createElement(`mint-icon`);l.setAttribute(`name`,`caret-down`),l.className=[`h-4`,`w-4`,`transition-transform`,`duration-200`,`ease-out`,this._isSubmenuPanelVisible()?`rotate-180`:`rotate-0`].join(` `),c.appendChild(l),r.appendChild(i),r.appendChild(s),r.appendChild(c),a.appendChild(r),this._trigger=i}else{let n=document.createElement(`button`);n.type=`button`,n.className=`${this._getBaseClasses()} block w-full`,n.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),n.setAttribute(`aria-controls`,o),n.appendChild(this._createRow(e,t)),n.onclick=()=>{let e=!this._isExpanded();this._setExpanded(e,e)},a.appendChild(n),this._trigger=n}a.appendChild(this._submenuContainer),this.replaceChildren(a)}render(){this._hasSubmenu()&&!this._isSubmenuItem()?this._buildDropdownLink():this._buildSimpleLink()}};customElements.get(`mint-sidenav-link`)||customElements.define(`mint-sidenav-link`,R);var z=class extends HTMLElement{constructor(...e){super(...e),this._container=null,this._title=null,this._titleLabel=null,this._titleCaret=null,this._list=null,this._titleClickHandler=null,this._listenerCounts=new Map}static get observedAttributes(){return[`name`]}get onMintNameClick(){return this._onMintNameClick}set onMintNameClick(e){this._onMintNameClick=e,this.render()}addEventListener(e,t,n){super.addEventListener(e,t,n),this._trackListener(e,1)}removeEventListener(e,t,n){super.removeEventListener(e,t,n),this._trackListener(e,-1)}connectedCallback(){this.classList.add(`block`),this.render()}disconnectedCallback(){this._title&&this._titleClickHandler&&(this._title.removeEventListener(`click`,this._titleClickHandler),this._title.removeEventListener(`keydown`,this._titleClickHandler))}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getName(){return this.getAttribute(`name`)||``}_trackListener(e,t){if(e!==`mint-name-click`)return;let n=this._listenerCounts.get(e)||0,r=Math.max(0,n+t);this._listenerCounts.set(e,r),this.render()}_isNameInteractive(){return(this._listenerCounts.get(`mint-name-click`)||0)>0||typeof this._onMintNameClick==`function`}_emitNameClick(e){let t=new CustomEvent(`mint-name-click`,{detail:{name:this._getName(),originalEvent:e},bubbles:!0,composed:!0});this.dispatchEvent(t),typeof this._onMintNameClick==`function`&&this._onMintNameClick(t)}render(){this._container||(this._container=document.createElement(`section`),this._container.className=`mb-4`,this.appendChild(this._container)),this._title||(this._title=document.createElement(`button`),this._title.setAttribute(`type`,`button`),this._title.className=`mb-2 w-full`,this._titleLabel=document.createElement(`mint-text`),this._titleLabel.setAttribute(`size`,`small`),this._titleLabel.setAttribute(`bold`,`true`),this._titleCaret=document.createElement(`mint-icon`),this._titleCaret.setAttribute(`name`,`caret-right`),this._titleCaret.className=`ml-auto inline-flex h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400`,this._title.appendChild(this._titleLabel),this._title.appendChild(this._titleCaret),this._titleClickHandler=e=>{this._isNameInteractive()&&(e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `||(e instanceof KeyboardEvent&&e.key===` `&&e.preventDefault(),this._emitNameClick(e)))},this._title.addEventListener(`click`,this._titleClickHandler),this._title.addEventListener(`keydown`,this._titleClickHandler),this._container.appendChild(this._title));let e=this._getName(),t=e.trim().length>0,n=this._isNameInteractive();this._titleLabel&&(this._titleLabel.textContent=e,this._titleLabel.className=`uppercase tracking-wide text-gray-500 dark:text-gray-400`),this._title&&(this._title.className=n?[`mb-2`,`w-full`,`inline-flex`,`items-center`,`gap-2`,`rounded-lg`,`border`,`border-transparent`,`px-3`,`py-2`,`text-left`,`hover:bg-black/5`,`dark:hover:bg-white/10`,`cursor-pointer`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-black/20`,`dark:focus-visible:ring-white/20`].join(` `):`mb-2 w-full inline-flex items-center gap-2 rounded-lg border border-transparent px-3 py-2 text-left cursor-default`,this._title.tabIndex=n?0:-1,this._title.disabled=!n,this._title.setAttribute(`aria-disabled`,String(!n))),this._titleCaret&&(this._titleCaret.style.display=n?``:`none`,this._titleCaret.setAttribute(`aria-hidden`,String(!n))),t?this._title.parentElement!==this._container&&this._container?.insertBefore(this._title,this._list):this._title.parentElement===this._container&&this._container?.removeChild(this._title),this._list||(this._list=document.createElement(`div`),this._list.className=`space-y-1`,this._container.appendChild(this._list)),Array.from(this.children).filter(e=>e!==this._container&&e.tagName===`MINT-SIDENAV-LINK`).forEach(e=>{this._list&&e.parentElement!==this._list&&this._list.appendChild(e)})}};customElements.get(`mint-sidenav-links`)||customElements.define(`mint-sidenav-links`,z);var B=class extends HTMLElement{static get observedAttributes(){return[`separated`]}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isSeparated(){return this.getAttribute(`separated`)===`true`}render(){this.className=this._isSeparated()?`block w-full mt-2 border-t border-gray-200 pt-2 px-2 pb-2 dark:border-mint-divider`:`block w-full p-2`}};customElements.get(`mint-sidenav-action-links`)||customElements.define(`mint-sidenav-action-links`,B);var V=class extends HTMLElement{constructor(...e){super(...e),this._wrapper=null,this._trigger=null,this._popover=null,this._triggerId=``,this._contentObserver=null,this._renderFrame=null}static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this.classList.add(`block`),this._triggerId=this.id?`${this.id}-trigger`:`mint-sidenav-action-menu-${Math.random().toString(36).slice(2,9)}`,this.render(),this._observeContentMutations()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getTitle(){return this.getAttribute(`title`)||``}_getSubtitle(){return this.getAttribute(`subtitle`)||``}_createDefaultGroup(){let e=document.createElement(`mint-sidenav-action-links`),t=document.createElement(`div`);return t.appendChild(e),t}render(){let e=Array.from(this.children).filter(e=>e!==this._wrapper&&e.getAttribute(`slot`)===`action-links`);this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative`,this.appendChild(this._wrapper)),this._wrapper.innerHTML=``,this._trigger=document.createElement(`button`),this._trigger.type=`button`,this._trigger.id=this._triggerId,this._trigger.className=`flex w-full cursor-pointer items-center gap-3 rounded-xl border border-gray-200 bg-gray-50 px-3 py-2 text-left hover:bg-gray-100 dark:border-mint-divider dark:bg-white/5 dark:hover:bg-white/10`;let t=document.createElement(`div`);t.className=`inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gray-700 text-xs font-semibold text-white dark:bg-mint-nav`,t.textContent=this._getTitle().split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase();let n=document.createElement(`div`);n.className=`min-w-0 flex-1`;let r=document.createElement(`mint-text`);r.setAttribute(`size`,`body`),r.setAttribute(`bold`,`true`),r.className=`truncate text-gray-900 dark:text-gray-100`,r.textContent=this._getTitle();let i=document.createElement(`mint-text`);i.setAttribute(`size`,`small`),i.setAttribute(`variant`,`muted`),i.className=`truncate`,i.textContent=this._getSubtitle(),n.appendChild(r),n.appendChild(i),this._trigger.appendChild(t),this._trigger.appendChild(n),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`right`),this._popover.setAttribute(`padding`,`0`);let a=document.createElement(`div`);a.className=`w-64`,e.length>0?e.forEach(e=>{e.setAttribute(`hidden`,`true`);let t=e.cloneNode(!0);t.removeAttribute(`hidden`),t.removeAttribute(`slot`),a.appendChild(t)}):a.appendChild(this._createDefaultGroup()),this._popover.appendChild(a),this._wrapper.appendChild(this._trigger),this._wrapper.appendChild(this._popover)}};customElements.get(`mint-sidenav-action-menu`)||customElements.define(`mint-sidenav-action-menu`,V);var H=`mint:url-change`;function se(){if(window.__mintUrlChangePatched)return;window.__mintUrlChangePatched=!0;let e=()=>{window.dispatchEvent(new Event(H))},t=t=>{let n=history[t].bind(history);history[t]=((...t)=>{let r=n(...t);return e(),r})};t(`pushState`),t(`replaceState`)}var U=class extends HTMLElement{constructor(...e){super(...e),this._backdrop=null,this._container=null,this._header=null,this._content=null,this._footer=null,this._escapeHandler=null,this._mediaQuery=null,this._mediaListener=null,this._accordionHandler=null,this._urlChangeHandler=null,this._contentObserver=null,this._renderFrame=null,this._onMobileNavNavigateClick=e=>{if(this._mediaQuery?.matches)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement)||!this._container?.contains(n))return;let r=n.getAttribute(`href`);!r||r===`#`||r.trim().toLowerCase().startsWith(`javascript:`)||this._isOpen()&&this.removeAttribute(`open`)}}static get observedAttributes(){return[`user-name`,`user-status`,`open`,`drawer-top-class`]}connectedCallback(){this.classList.add(`relative`,`block`,`shrink-0`,`w-0`,`overflow-visible`,`min-[1100px]:w-[17rem]`,`min-[1100px]:shrink-0`),this._attachEscapeListener(),this._attachMediaListener(),this._attachAccordionListener(),this._attachUrlChangeListener(),this._observeContentMutations(),this.render()}disconnectedCallback(){this._detachEscapeListener(),this._detachMediaListener(),this._detachAccordionListener(),this._detachUrlChangeListener(),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_attachEscapeListener(){this._escapeHandler||(this._escapeHandler=e=>{e.key===`Escape`&&this.getAttribute(`open`)===`true`&&this.removeAttribute(`open`)},document.addEventListener(`keydown`,this._escapeHandler))}_detachEscapeListener(){this._escapeHandler&&=(document.removeEventListener(`keydown`,this._escapeHandler),null)}_attachMediaListener(){this._mediaListener||(this._mediaQuery=window.matchMedia(`(min-width: 1100px)`),this._mediaListener=()=>{this._mediaQuery?.matches&&this.removeAttribute(`open`)},this._mediaQuery.addEventListener(`change`,this._mediaListener))}_detachMediaListener(){this._mediaQuery&&this._mediaListener&&this._mediaQuery.removeEventListener(`change`,this._mediaListener),this._mediaQuery=null,this._mediaListener=null}_attachAccordionListener(){this._accordionHandler||(this._accordionHandler=e=>{let t=e.detail?.source;!(t instanceof HTMLElement)||t.tagName!==`MINT-SIDENAV-LINK`||this.contains(t)&&this.querySelectorAll(`mint-sidenav-link`).forEach(e=>{e!==t&&e.querySelector(`:scope .mint-sidenav-submenu`)&&e.setAttribute(`expanded`,`false`)})},this.addEventListener(`mint-sidenav-accordion`,this._accordionHandler))}_detachAccordionListener(){this._accordionHandler&&=(this.removeEventListener(`mint-sidenav-accordion`,this._accordionHandler),null)}_attachUrlChangeListener(){this._urlChangeHandler||(se(),this._urlChangeHandler=()=>{this._mediaQuery?.matches||this._isOpen()&&this.removeAttribute(`open`)},window.addEventListener(`popstate`,this._urlChangeHandler),window.addEventListener(`hashchange`,this._urlChangeHandler),window.addEventListener(H,this._urlChangeHandler))}_detachUrlChangeListener(){this._urlChangeHandler&&=(window.removeEventListener(`popstate`,this._urlChangeHandler),window.removeEventListener(`hashchange`,this._urlChangeHandler),window.removeEventListener(H,this._urlChangeHandler),null)}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}getUserName(){return this.getAttribute(`user-name`)||`Acme Inc`}getUserStatus(){return this.getAttribute(`user-status`)||`Enterprise`}_isOpen(){return this.getAttribute(`open`)===`true`}_ensureBackdrop(){this._backdrop||(this._backdrop=document.createElement(`div`),this._backdrop.setAttribute(`aria-hidden`,`true`),this._backdrop.addEventListener(`click`,()=>this.removeAttribute(`open`)),this.insertBefore(this._backdrop,this.firstChild))}_ensureContainer(){this._container||(this._container=document.createElement(`aside`),this._container.addEventListener(`click`,this._onMobileNavNavigateClick,!0),this.appendChild(this._container))}_syncShell(){let e=`max-[1099.98px]:top-14`,t=this._isOpen();if(this._backdrop&&(this._backdrop.className=[`fixed`,e,`left-0`,`right-0`,`bottom-0`,`z-40`,`bg-black/50`,`transition-opacity`,`duration-200`,`min-[1100px]:hidden`,t?`pointer-events-auto opacity-100`:`pointer-events-none opacity-0`].join(` `)),this._container){let n=t?`max-[1099.98px]:translate-x-0`:`max-[1099.98px]:-translate-x-full`;this._container.className=[`flex`,`min-h-0`,`flex-col`,`border-r`,`border-gray-200`,`bg-white`,`p-2`,`dark:border-mint-divider`,`dark:bg-mint-nav`,`w-[4.75rem]`,`max-[1099.98px]:fixed`,e,`max-[1099.98px]:bottom-0`,`max-[1099.98px]:left-0`,`max-[1099.98px]:z-50`,`max-[1099.98px]:h-auto`,`max-[1099.98px]:w-[17rem]`,`max-[1099.98px]:max-w-[85vw]`,`max-[1099.98px]:shadow-xl`,`max-[1099.98px]:transition-transform`,`max-[1099.98px]:duration-200`,`max-[1099.98px]:ease-out`,n,`min-[1100px]:fixed`,`min-[1100px]:left-0`,`min-[1100px]:top-14`,`min-[1100px]:bottom-0`,`min-[1100px]:z-[60]`,`min-[1100px]:w-[17rem]`,`min-[1100px]:p-3`,`min-[1100px]:shadow-none`].join(` `)}}_buildUserHeader(){if(!this._container)return;this._header||(this._header=document.createElement(`div`),this._header.className=`mb-4`,this._container.appendChild(this._header));let e=Array.from(this.querySelectorAll(`[slot="action-header"]`)).find(e=>e!==this._backdrop&&e!==this._container);if(e){this._header.replaceChildren(e);return}let t=document.createElement(`mint-sidenav-action-menu`);t.setAttribute(`title`,this.getUserName()),t.setAttribute(`subtitle`,this.getUserStatus()),this._header.replaceChildren(t)}_replaceSlottedChildren(e,t){let n=Array.from(this.querySelectorAll(`[slot="${t}"]`)).filter(e=>e!==this._container&&e!==this._backdrop);e.replaceChildren(...n)}_buildContent(){this._container&&(this._content||(this._content=document.createElement(`div`),this._content.className=`min-h-0 grow overflow-y-auto`,this._container.appendChild(this._content)),this._replaceSlottedChildren(this._content,`links`))}_buildFooter(){if(!this._container)return;this._footer||(this._footer=document.createElement(`div`),this._footer.className=`mt-auto border-t border-gray-200 py-3 dark:border-mint-divider`,this._container.appendChild(this._footer));let e=document.createElement(`div`);e.className=`space-y-1`,this._replaceSlottedChildren(e,`bottom-links`),this._footer.innerHTML=``,this._footer.appendChild(e)}render(){this._ensureBackdrop(),this._ensureContainer(),this._syncShell(),this._buildUserHeader(),this._buildContent(),this._buildFooter()}};customElements.get(`mint-side-navigation`)||customElements.define(`mint-side-navigation`,U);var W=class extends HTMLElement{constructor(...e){super(...e),this._bar=null,this._menuButton=null,this._logoLink=null,this._menuClickHandler=null,this._darkModeObserver=null,this._contentObserver=null,this._resizeHandler=null,this._desktopSearchInput=null,this._desktopSearchShell=null,this._mobileSearchButton=null,this._searchPanel=null,this._searchPanelInput=null,this._searchResultsWrap=null,this._searchStateWrap=null,this._searchDebounceId=null,this._searchAbortController=null,this._searchOpen=!1,this._searchQuery=``,this._globalKeydownHandler=null,this._docClickHandler=null,this._renderFrame=null}static get observedAttributes(){return[`logo-src`,`logo-src-light`,`logo-src-dark`,`logo-src-mobile`,`logo-src-mobile-light`,`logo-src-mobile-dark`,`logo-href`,`logo-alt`,`menu-target`,`search-endpoint`,`search-param`,`search-placeholder`]}connectedCallback(){this.classList.add(`relative`,`block`,`h-14`,`w-full`,`shrink-0`),this._observeDarkMode(),this._observeContentMutations(),this._attachResizeListener(),this._attachGlobalHandlers(),this.render()}disconnectedCallback(){this._menuButton&&this._menuClickHandler&&(this._menuButton.removeEventListener(`click`,this._menuClickHandler),this._menuClickHandler=null),this._disconnectDarkModeObserver(),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._detachResizeListener(),this._detachGlobalHandlers(),this._cancelSearchDebounce(),this._abortSearch()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_isDarkMode(){return document.documentElement.classList.contains(`dark`)}_isMobileViewport(){return window.matchMedia(`(max-width: 1099.98px)`).matches}_getLogoSrc(){let e=this.getAttribute(`logo-src`)||``,t=this.getAttribute(`logo-src-light`)||``,n=this.getAttribute(`logo-src-dark`)||``,r=this.getAttribute(`logo-src-mobile`)||``,i=this.getAttribute(`logo-src-mobile-light`)||``,a=this.getAttribute(`logo-src-mobile-dark`)||``,o=this._isDarkMode(),s=this._isMobileViewport();return s&&o?a||r||n||t||e:s&&!o?i||r||t||n||e:o?n||t||e:t||n||e}_getLogoHref(){return this.getAttribute(`logo-href`)||`/`}_getLogoAlt(){return this.getAttribute(`logo-alt`)||`Home`}_getMenuTargetId(){return(this.getAttribute(`menu-target`)||``).replace(/^#/,``)}_getSearchEndpoint(){return(this.getAttribute(`search-endpoint`)||``).trim()}_getSearchParam(){return(this.getAttribute(`search-param`)||`q`).trim()||`q`}_getSearchPlaceholder(){return this.getAttribute(`search-placeholder`)||`Search`}_isSearchEnabled(){return!!this._getSearchEndpoint()}_attachGlobalHandlers(){this._globalKeydownHandler||(this._globalKeydownHandler=e=>{let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&t===`k`){e.preventDefault(),this._openSearch(!0);return}t===`escape`&&this._searchOpen&&this._closeSearch()},document.addEventListener(`keydown`,this._globalKeydownHandler)),this._docClickHandler||(this._docClickHandler=e=>{if(!this._searchOpen)return;let t=e.target;t&&(this.contains(t)||this._closeSearch())},document.addEventListener(`click`,this._docClickHandler))}_detachGlobalHandlers(){this._globalKeydownHandler&&=(document.removeEventListener(`keydown`,this._globalKeydownHandler),null),this._docClickHandler&&=(document.removeEventListener(`click`,this._docClickHandler),null)}_cancelSearchDebounce(){this._searchDebounceId!==null&&(window.clearTimeout(this._searchDebounceId),this._searchDebounceId=null)}_abortSearch(){this._searchAbortController&&=(this._searchAbortController.abort(),null)}_openSearch(e=!1){if(this._isSearchEnabled()&&(this._searchOpen=!0,this._syncSearchPanelVisibility(),e)){let e=this._isMobileViewport()?this._searchPanelInput:this._desktopSearchInput;e?.focus(),e?.select()}}_closeSearch(){this._searchOpen=!1,this._syncSearchPanelVisibility()}_syncSearchPanelVisibility(){this._searchPanel&&(this._searchPanel.classList.toggle(`hidden`,!this._searchOpen),this._syncDesktopSearchOpenState(),this._positionSearchPanel())}_syncDesktopSearchOpenState(){this._desktopSearchShell&&(this._desktopSearchShell.classList.toggle(`rounded-b-none`,this._searchOpen),this._desktopSearchShell.classList.toggle(`border-b-transparent`,this._searchOpen))}_positionSearchPanel(){if(!this._searchPanel)return;if(this._isMobileViewport()||!this._desktopSearchShell){this._searchPanel.style.left=``,this._searchPanel.style.right=``,this._searchPanel.style.top=``,this._searchPanel.style.width=``,this._searchPanel.style.maxWidth=``,this._searchPanel.style.transform=``;return}let e=this._desktopSearchShell.getBoundingClientRect();this._searchPanel.style.left=`${e.left}px`,this._searchPanel.style.right=`auto`,this._searchPanel.style.top=`${e.bottom-1}px`,this._searchPanel.style.width=`${e.width}px`,this._searchPanel.style.maxWidth=`${e.width}px`,this._searchPanel.style.transform=`none`}_setSearchQuery(e){this._searchQuery=e,this._desktopSearchInput&&this._desktopSearchInput.value!==e&&(this._desktopSearchInput.value=e),this._searchPanelInput&&this._searchPanelInput.value!==e&&(this._searchPanelInput.value=e)}_normalizeResults(e){return(e=>{if(Array.isArray(e))return e;if(!e||typeof e!=`object`)return[];let t=e;for(let e of[`results`,`items`,`data`,`products`]){let n=t[e];if(Array.isArray(n))return n}return[]})(e).map(e=>{let t=e||{};return{title:String(t.title||t.name||t.label||t.email||t.id||``).trim()||`Untitled`,subtitle:String(t.description||t.category||t.username||``).trim()}}).slice(0,8)}_renderSearchState(e){this._searchStateWrap&&(this._searchStateWrap.textContent=e,this._searchStateWrap.classList.remove(`hidden`),this._searchResultsWrap&&(this._searchResultsWrap.innerHTML=``))}_renderSearchResults(e){if(!(!this._searchResultsWrap||!this._searchStateWrap)){if(this._searchResultsWrap.innerHTML=``,e.length===0){this._renderSearchState(`No results found`);return}this._searchStateWrap.classList.add(`hidden`);for(let t of e){let e=document.createElement(`button`);e.type=`button`,e.className=`flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-white/10`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`mt-0.5 h-4 w-4 text-gray-500 dark:text-gray-400`;let r=document.createElement(`div`);r.className=`min-w-0`;let i=document.createElement(`div`);if(i.className=`truncate text-sm font-semibold text-gray-900 dark:text-gray-100`,i.textContent=t.title,r.appendChild(i),t.subtitle){let e=document.createElement(`div`);e.className=`truncate text-xs text-gray-500 dark:text-gray-400`,e.textContent=t.subtitle,r.appendChild(e)}e.appendChild(n),e.appendChild(r),e.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`search-select`,{detail:{query:this._searchQuery,result:t},bubbles:!0,composed:!0})),this._closeSearch()}),this._searchResultsWrap.appendChild(e)}}}_fetchSearchResults(e){let t=this._getSearchEndpoint();if(!t)return;let n=e.trim();if(!n){this._renderSearchState(`Start typing to search`);return}this._abortSearch(),this._searchAbortController=new AbortController,this._renderSearchState(`Searching...`);let r=t.includes(`{query}`)?t.replace(`{query}`,encodeURIComponent(n)):`${t}${t.includes(`?`)?`&`:`?`}${encodeURIComponent(this._getSearchParam())}=${encodeURIComponent(n)}`;fetch(r,{signal:this._searchAbortController.signal}).then(e=>{if(!e.ok)throw Error(`Request failed: ${e.status}`);return e.json()}).then(e=>{let t=this._normalizeResults(e);this._renderSearchResults(t)}).catch(e=>{e?.name!==`AbortError`&&this._renderSearchState(`Unable to load results`)})}_scheduleSearch(e){this._setSearchQuery(e),this._cancelSearchDebounce(),this._searchDebounceId=window.setTimeout(()=>this._fetchSearchResults(e),220)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>this.render()),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_disconnectDarkModeObserver(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_attachResizeListener(){this._resizeHandler||(this._resizeHandler=()=>{this.render(),this._positionSearchPanel()},window.addEventListener(`resize`,this._resizeHandler,{passive:!0}))}_detachResizeListener(){this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_toggleMenuTarget(){let e=this._getMenuTargetId();if(!e)return;let t=document.getElementById(e);!t||t.tagName!==`MINT-SIDE-NAVIGATION`||(t.getAttribute(`open`)===`true`?t.removeAttribute(`open`):t.setAttribute(`open`,`true`))}render(){if(this._bar||(this._bar=document.createElement(`div`),this._bar.className=`fixed inset-x-0 top-0 z-50 flex h-14 w-full items-center gap-2 border-b border-gray-200 bg-white px-3 dark:border-mint-divider dark:bg-mint-nav`,this.appendChild(this._bar)),!this._menuButton){this._menuButton=document.createElement(`button`),this._menuButton.type=`button`,this._menuButton.className=`inline-flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent text-gray-700 hover:bg-black/5 min-[1100px]:hidden dark:text-gray-200 dark:hover:bg-white/10`,this._menuButton.setAttribute(`aria-label`,`Open navigation menu`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`menu`),e.className=`h-5 w-5`,this._menuButton.appendChild(e),this._menuClickHandler=()=>this._toggleMenuTarget(),this._menuButton.addEventListener(`click`,this._menuClickHandler),this._bar.appendChild(this._menuButton)}let e=!!this._getMenuTargetId();this._menuButton.classList.toggle(`hidden`,!e),this._logoLink||(this._logoLink=document.createElement(`a`),this._logoLink.className=`flex h-8 w-40 shrink-0 items-center`,this._bar.appendChild(this._logoLink)),this._logoLink.href=this._getLogoHref(),this._logoLink.setAttribute(`aria-label`,this._getLogoAlt());let t=this._getLogoSrc();if(t){let e=document.createElement(`img`);e.className=`h-full w-full object-contain [aspect-ratio:5/1]`,e.decoding=`async`,e.src=t,e.alt=this._getLogoAlt(),this._logoLink.replaceChildren(e),this._logoLink.classList.remove(`pointer-events-none`,`opacity-40`)}else{this._logoLink.replaceChildren(),this._logoLink.classList.add(`pointer-events-none`,`opacity-40`);let e=document.createElement(`span`);e.className=`text-sm font-semibold text-gray-400 dark:text-gray-500`,e.textContent=`Logo`,this._logoLink.appendChild(e)}let n=Array.from(this.querySelectorAll(`[slot="center"]`)),r=n.length>0,i=this._isSearchEnabled()&&!r,a=this._bar.querySelector(`[data-mint-topnav-center]`);if(a||(a=document.createElement(`div`),a.setAttribute(`data-mint-topnav-center`,`true`),this._bar.appendChild(a)),a.className=r?`min-w-0 flex-1 px-2 min-[1100px]:flex min-[1100px]:justify-center min-[1100px]:px-4`:`max-[1099.98px]:hidden min-[1100px]:flex min-[1100px]:min-w-0 min-[1100px]:flex-1 min-[1100px]:justify-center min-[1100px]:px-4`,a.classList.toggle(`min-[1100px]:hidden`,!i&&!r),r&&(a.replaceChildren(...n),this._closeSearch()),i&&!this._desktopSearchInput){let e=document.createElement(`div`);e.className=`relative w-full max-w-xl rounded-xl border border-gray-300 bg-gray-50 px-3 py-2 dark:border-mint-divider dark:bg-mint-hover`,this._desktopSearchShell=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`search`),t.className=`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400`,this._desktopSearchInput=document.createElement(`input`),this._desktopSearchInput.type=`search`,this._desktopSearchInput.className=`w-full bg-transparent pl-6 pr-20 text-sm text-gray-900 outline-none placeholder:text-gray-500 dark:text-gray-100 dark:placeholder:text-gray-400`,this._desktopSearchInput.placeholder=this._getSearchPlaceholder(),this._desktopSearchInput.addEventListener(`focus`,()=>this._openSearch(!1)),this._desktopSearchInput.addEventListener(`input`,e=>this._scheduleSearch(e.target.value));let n=document.createElement(`span`);n.className=`absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-500 dark:text-gray-400`,n.textContent=`⌘K`,e.appendChild(t),e.appendChild(this._desktopSearchInput),e.appendChild(n),a.appendChild(e)}i&&this._desktopSearchInput&&(this._desktopSearchInput.placeholder=this._getSearchPlaceholder(),this._desktopSearchShell=this._desktopSearchInput.closest(`div`),this._syncDesktopSearchOpenState());let o=this._bar.querySelector(`[data-mint-topnav-mobile-spacer]`);o||(o=document.createElement(`div`),o.setAttribute(`data-mint-topnav-mobile-spacer`,`true`),o.className=`min-w-0 flex-1 min-[1100px]:hidden`,this._bar.appendChild(o));let s=Array.from(this.querySelectorAll(`[slot="actions"]`)),c=this._bar.querySelector(`[data-mint-topnav-actions]`);if(c||(c=document.createElement(`div`),c.setAttribute(`data-mint-topnav-actions`,`true`),c.className=`flex shrink-0 items-center gap-2`,this._bar.appendChild(c)),i&&!this._mobileSearchButton){this._mobileSearchButton=document.createElement(`button`),this._mobileSearchButton.type=`button`,this._mobileSearchButton.className=`inline-flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent text-gray-700 hover:bg-black/5 min-[1100px]:hidden dark:text-gray-200 dark:hover:bg-white/10`,this._mobileSearchButton.setAttribute(`aria-label`,`Open search`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`search`),e.className=`h-5 w-5`,this._mobileSearchButton.appendChild(e),this._mobileSearchButton.addEventListener(`click`,()=>this._openSearch(!0)),c.insertBefore(this._mobileSearchButton,c.firstChild)}if(this._mobileSearchButton&&this._mobileSearchButton.classList.toggle(`hidden`,!i),c.replaceChildren(...s),i&&this._mobileSearchButton&&!s.includes(this._mobileSearchButton)&&c.insertBefore(this._mobileSearchButton,c.firstChild),i&&!this._searchPanel){this._searchPanel=document.createElement(`div`),this._searchPanel.className=`fixed left-0 right-0 top-14 z-[90] hidden p-3 min-[1100px]:p-0`;let e=document.createElement(`div`);e.className=`mx-auto w-full rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none`;let t=document.createElement(`div`);t.className=`relative border-b border-gray-200 p-3 dark:border-mint-divider min-[1100px]:hidden`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`absolute left-6 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400`,this._searchPanelInput=document.createElement(`input`),this._searchPanelInput.type=`search`,this._searchPanelInput.className=`w-full rounded-lg border border-gray-300 bg-gray-50 py-2 pl-10 pr-3 text-sm text-gray-900 outline-none dark:border-mint-divider dark:bg-mint-hover dark:text-gray-100`,this._searchPanelInput.placeholder=this._getSearchPlaceholder(),this._searchPanelInput.addEventListener(`input`,e=>this._scheduleSearch(e.target.value)),t.appendChild(n),t.appendChild(this._searchPanelInput);let r=document.createElement(`div`);r.className=`flex flex-wrap gap-2 px-3 py-3`,[`Apps`,`Customers`,`Orders`,`Products`,`Sales channels`].forEach(e=>{let t=document.createElement(`span`);t.className=`rounded-full bg-gray-100 px-3 py-1 text-xs font-semibold text-gray-600 dark:bg-mint-hover dark:text-gray-300`,t.textContent=e,r.appendChild(t)}),this._searchStateWrap=document.createElement(`div`),this._searchStateWrap.className=`px-4 pb-4 text-sm text-gray-500 dark:text-gray-400`,this._searchStateWrap.textContent=`Start typing to search`,this._searchResultsWrap=document.createElement(`div`),this._searchResultsWrap.className=`max-h-[52vh] overflow-y-auto px-2 pb-2`,e.appendChild(t),e.appendChild(r),e.appendChild(this._searchStateWrap),e.appendChild(this._searchResultsWrap),this._searchPanel.appendChild(e),this.appendChild(this._searchPanel)}this._searchPanelInput&&(this._searchPanelInput.placeholder=this._getSearchPlaceholder()),this._syncSearchPanelVisibility(),this._positionSearchPanel()}};customElements.get(`mint-top-navigation`)||customElements.define(`mint-top-navigation`,W);var G=class e extends HTMLElement{constructor(...e){super(...e),this._shell=null,this._desktopInput=null,this._panel=null,this._panelInner=null,this._panelInput=null,this._panelFiltersWrap=null,this._panelFiltersMainRow=null,this._panelFiltersChips=null,this._panelFiltersShowAllWrap=null,this._panelFiltersShowAllBtn=null,this._panelFiltersMorePanel=null,this._filtersMoreOpen=!1,this._filterOverflowObserver=null,this._filterOverflowZeroWidthRetries=0,this._desktopFilterWrap=null,this._mobileFilterWrap=null,this._resultsWrap=null,this._stateWrap=null,this._customResultsWrap=null,this._query=``,this._searchOpen=!1,this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._debounceId=null,this._abortController=null,this._docPointerDownHandler=null,this._globalKeydownHandler=null,this._focusOutHandler=null,this._resizeHandler=null,this._desktopShortcutHint=null,this._panelSearchBar=null,this._contentObserver=null,this._renderFrame=null}static{this._filterMorePanelSeq=0}static{this._filterChipsOverflowMask=`linear-gradient(to right, #000 0%, #000 max(0%, calc(100% - 3.5rem)), transparent 100%)`}static get observedAttributes(){return[`endpoint`,`search-param`,`placeholder`,`filters`,`filter-param`,`open-shortcut`,`open-shortcut-hint`,`collapse-on-mobile`]}connectedCallback(){this.classList.add(`relative`,`block`,`w-full`,`max-w-xl`),this._attachGlobalHandlers(),this._attachFocusOutHandler(),this._attachResizeHandler(),this.render(),this._observeContentMutations()}disconnectedCallback(){this._docPointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._docPointerDownHandler,!0),null),this._globalKeydownHandler&&=(document.removeEventListener(`keydown`,this._globalKeydownHandler),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null),this._focusOutHandler&&=(this.removeEventListener(`focusout`,this._focusOutHandler,!0),null),this._cancelDebounce(),this._abortSearch(),this._filterOverflowObserver&&=(this._filterOverflowObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getEndpoint(){return(this.getAttribute(`endpoint`)||``).trim()}_getSearchParam(){return(this.getAttribute(`search-param`)||`q`).trim()||`q`}_getPlaceholder(){return this.getAttribute(`placeholder`)||`Search`}_getFilterParam(){return(this.getAttribute(`filter-param`)||``).trim()}_getFilterOptions(){return(this.getAttribute(`filters`)||``).split(`,`).map(e=>e.trim()).filter(Boolean)}_hasSelectedFilters(){return this._selectedFilters.length>0}_getFilterChipOverflowReservePx(){let e=Math.max(1,this._getFilterOptions().length),t=this._hasSelectedFilters()?28:56;return Math.min(200,t+e*34)}_getFilterParamValue(){return this._selectedFilters.join(`,`)}_getFilterChipLabelText(){return this._selectedFilters.join(`, `)}_getCondensedFilterChipLabel(e=22){if(!this._hasSelectedFilters())return``;let[t=``]=this._selectedFilters,n=this._selectedFilters.length-1,r=Math.max(8,e-2),i=t;if(n<=0)return i.length<=r?i:`${i.slice(0,Math.max(1,r-3))}...`;let a=`${t}, and ${n} more`;return a.length<=r?a:`${a.slice(0,Math.max(1,r-3))}...`}_isMobileViewport(){return window.matchMedia(`(max-width: 1099.98px)`).matches}_collapseOnMobile(){let e=this.getAttribute(`collapse-on-mobile`);if(e===null)return!1;let t=e.trim().toLowerCase();return!(t===`false`||t===`0`||t===`off`||t===`none`)}_primarySearchInput(){return this._isMobileViewport()&&this._collapseOnMobile()?this._panelInput:this._desktopInput}_isApplePlatform(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/i.test(navigator.platform)||/Mac OS/i.test(navigator.userAgent)}_parseOpenShortcut(){let e=(this.getAttribute(`open-shortcut`)??`mod+k`).trim().toLowerCase();if(!e||e===`none`||e===`false`||e===`off`)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let t=e.split(`+`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let n=t[t.length-1],r=new Set(t.slice(0,-1).map(e=>e.toLowerCase()));return{disabled:!1,wantMod:r.has(`mod`),wantMeta:r.has(`meta`)||r.has(`cmd`)||r.has(`super`),wantCtrl:r.has(`ctrl`)||r.has(`control`),wantAlt:r.has(`alt`),wantShift:r.has(`shift`),key:n.toLowerCase()}}_eventKeyMatchesShortcutKey(e,t){let n=t.toLowerCase();return(e.key.length,e.key.toLowerCase())===n}_openShortcutMatches(e){let t=this._parseOpenShortcut();return t.disabled||!t.key||e.repeat||!this._eventKeyMatchesShortcutKey(e,t.key)||t.wantShift!==e.shiftKey||t.wantAlt!==e.altKey?!1:t.wantMod||t.wantMeta||t.wantCtrl?!(t.wantMod&&!(e.metaKey||e.ctrlKey)||t.wantMeta&&!e.metaKey||t.wantCtrl&&!e.ctrlKey):!!t.wantAlt}_getOpenShortcutHintText(){let e=this.getAttribute(`open-shortcut-hint`);if(e===`none`||e===`false`)return``;if(e!==null&&e.trim()!==``)return e.trim();let t=this._parseOpenShortcut();if(t.disabled)return``;let n=this._isApplePlatform(),r=[];t.wantMod&&r.push(n?`⌘`:`Ctrl`),t.wantMeta&&!t.wantMod&&r.push(n?`⌘`:`Meta`),t.wantCtrl&&!t.wantMod&&r.push(`Ctrl`),t.wantAlt&&r.push(`Alt`),t.wantShift&&r.push(`Shift`);let i=t.key.length===1?t.key.toUpperCase():t.key;return i?t.wantMod&&!t.wantMeta&&!t.wantCtrl&&!t.wantAlt&&!t.wantShift&&t.key.length===1?`${n?`⌘`:`Ctrl+`}${i}`:[...r,i].join(`+`):``}_attachGlobalHandlers(){this._globalKeydownHandler||(this._globalKeydownHandler=e=>{if(this._openShortcutMatches(e)){e.preventDefault(),this._openSearch(!0);return}if(e.key.toLowerCase()===`escape`&&this._searchOpen){if(this._filtersMoreOpen){this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput());return}this._closeSearch()}},document.addEventListener(`keydown`,this._globalKeydownHandler)),this._docPointerDownHandler||(this._docPointerDownHandler=e=>{if(!this._searchOpen)return;let t=e.composedPath();this._filtersMoreOpen&&this._panelFiltersWrap&&!t.includes(this._panelFiltersWrap)&&(this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput())),!(this._shell&&t.includes(this._shell)||this._panelInner&&t.includes(this._panelInner))&&this._closeSearch()},document.addEventListener(`pointerdown`,this._docPointerDownHandler,!0))}_attachResizeHandler(){this._resizeHandler||(this._resizeHandler=()=>{this._syncPanelVisibility(),this._syncFilterOverflow()},window.addEventListener(`resize`,this._resizeHandler,{passive:!0}))}_attachFocusOutHandler(){this._focusOutHandler||(this._focusOutHandler=e=>{if(!this._searchOpen)return;let t=e.relatedTarget;t&&(this._shell&&this._shell.contains(t)||this._panelInner&&this._panelInner.contains(t)||this._closeSearch())},this.addEventListener(`focusout`,this._focusOutHandler,!0))}_emitSearchOpenChange(){this.dispatchEvent(new CustomEvent(`search-open-change`,{detail:{open:this._searchOpen},bubbles:!0,composed:!0}))}_openSearch(e=!1){this._getEndpoint()&&(this._searchOpen||(this._searchOpen=!0,this._syncPanelVisibility(),this._emitSearchOpenChange(),e&&this._primarySearchInput()?.focus()))}_closeSearch(){this._searchOpen&&(this._searchOpen=!1,this._filtersMoreOpen=!1,this._syncPanelVisibility(),this._emitSearchOpenChange())}_syncPanelVisibility(){if(!this._panel)return;let e=this._panelLayoutBaseClass();this._panel.className=this._searchOpen?e:`${e} hidden`,this._shell&&(this._shell.classList.toggle(`rounded-b-none`,this._searchOpen),this._shell.classList.toggle(`border-b-transparent`,this._searchOpen)),this._positionPanel(),this._searchOpen&&this._scheduleFilterOverflowSync()}_panelLayoutBaseClass(){return!this._isMobileViewport()||!this._collapseOnMobile()?`absolute left-0 right-0 top-full z-[90] p-0 -mt-[9px]`:`fixed left-0 right-0 top-12 z-[90] p-3`}_positionPanel(){this._panel&&(!this._isMobileViewport()||!this._collapseOnMobile())&&(this._panel.style.left=``,this._panel.style.right=``,this._panel.style.top=``,this._panel.style.width=``,this._panel.style.maxWidth=``,this._panel.style.transform=``)}_setQuery(e){let t=this._query;this._query=e,e!==t&&(this._selectedFilterBackspaceArmed=!1),this._desktopInput&&(this._desktopInput.value=e),this._panelInput&&(this._panelInput.value=e)}_cancelDebounce(){this._debounceId!==null&&(window.clearTimeout(this._debounceId),this._debounceId=null)}_abortSearch(){this._abortController&&=(this._abortController.abort(),null)}_normalizeResults(e){return(e=>{if(Array.isArray(e))return e;if(!e||typeof e!=`object`)return[];let t=e;for(let e of[`results`,`items`,`data`,`products`]){let n=t[e];if(Array.isArray(n))return n}return[]})(e).map(e=>{let t=e||{};return{title:String(t.title||t.name||t.label||t.email||t.id||``).trim()||`Untitled`,subtitle:String(t.description||t.category||t.username||``).trim(),parent:String(t.parent||t.type||t.entity||t.kind||t.category||``).trim()||void 0}}).slice(0,8)}_emitResultsChange(e,t){let n=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-results-change`,{detail:{query:this._query,filter:n,filters:[...this._selectedFilters],results:e,raw:t??null},bubbles:!0,composed:!0}))}_emitFilterChange(){let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-filter-change`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters]},bubbles:!0,composed:!0}))}_renderState(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`hidden`);return}this._stateWrap&&(this._stateWrap.textContent=e,this._stateWrap.classList.remove(`hidden`),this._resultsWrap&&(this._resultsWrap.classList.remove(`hidden`),this._resultsWrap.innerHTML=``))}_renderResults(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`hidden`);return}if(!(!this._resultsWrap||!this._stateWrap)){if(this._resultsWrap.innerHTML=``,e.length===0){this._renderState(`No results found`);return}this._stateWrap.classList.add(`hidden`);for(let t of e){let e=document.createElement(`button`);e.type=`button`,e.className=`flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-white/10`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`mt-0.5 h-4 w-4 text-gray-500 dark:text-gray-400`;let r=document.createElement(`div`);r.className=`min-w-0`;let i=document.createElement(`div`);if(i.className=`truncate text-sm font-semibold text-gray-900 dark:text-gray-100`,i.textContent=t.title,r.appendChild(i),t.subtitle){let e=document.createElement(`div`);e.className=`truncate text-xs text-gray-500 dark:text-gray-400`,e.textContent=t.subtitle,r.appendChild(e)}e.appendChild(n),e.appendChild(r),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){t.preventDefault(),this._moveFocusInResults(e,1);return}if(t.key===`ArrowUp`){t.preventDefault(),this._moveFocusInResults(e,-1);return}}),e.addEventListener(`click`,()=>{let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-select`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters],result:t},bubbles:!0,composed:!0})),this._closeSearch()}),this._resultsWrap.appendChild(e)}}}_fetchSearchResults(e){let t=this._getEndpoint();if(!t)return;let n=e.trim();if(!n){this._emitResultsChange([]),this._renderState(`Start typing to search`);return}this._abortSearch(),this._abortController=new AbortController,this._renderState(`Searching...`);let r=new URLSearchParams;r.set(this._getSearchParam(),n);let i=this._getFilterParam();i&&this._hasSelectedFilters()&&r.set(i,this._getFilterParamValue());let a=t.includes(`{query}`)?t.replace(`{query}`,encodeURIComponent(n)):`${t}${t.includes(`?`)?`&`:`?`}${r.toString()}`;fetch(a,{signal:this._abortController.signal}).then(e=>{if(!e.ok)throw Error(`Request failed: ${e.status}`);return e.json()}).then(e=>{let t=this._normalizeResults(e);this._emitResultsChange(t,e),this._renderResults(t)}).catch(e=>{e?.name!==`AbortError`&&(this._emitResultsChange([]),this._renderState(`Unable to load results`))})}_scheduleSearch(e){this._setQuery(e),this._cancelDebounce(),this._debounceId=window.setTimeout(()=>this._fetchSearchResults(e),220)}_getNativeInputValue(e){if(!e)return``;let t=e.querySelector(`input, textarea`);return t?t.value||``:e.value||``}_getCurrentInputValue(){let e=document.activeElement;return e&&this._desktopInput&&this._desktopInput.contains(e)?this._getNativeInputValue(this._desktopInput):e&&this._panelInput&&this._panelInput.contains(e)?this._getNativeInputValue(this._panelInput):this._getNativeInputValue(this._primarySearchInput())}_applyFilterSelectionChange(){let e=this._getCurrentInputValue();if(this._setQuery(e),this._emitFilterChange(),this.render(),e.trim()){this._scheduleSearch(e);return}this._cancelDebounce(),this._abortSearch(),this._emitResultsChange([]),this._renderState(`Start typing to search`)}_clearAllSelectedFilters(){this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange()}_popLastSelectedFilter(){this._selectedFilters.length!==0&&(this._selectedFilters.pop(),this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange())}_focusActiveInput(){let e=this._primarySearchInput();e&&requestAnimationFrame(()=>{e.focus()})}_focusHideFiltersControl(){let e=this._panelFiltersShowAllBtn;e&&(e.querySelector(`button`)??e).focus()}_getFilterChipElements(){return this._panelFiltersWrap?Array.from(this._panelFiltersWrap.querySelectorAll(`mint-chip`)):[]}_ensurePanelFiltersShell(){!this._panelFiltersWrap||this._panelFiltersMainRow||(this._panelFiltersWrap.replaceChildren(),this._panelFiltersWrap.className=`relative flex shrink-0 flex-col gap-2 px-3 pb-3 pt-5 min-w-0`,this._panelFiltersMainRow=document.createElement(`div`),this._panelFiltersMainRow.className=`flex min-w-0 w-full flex-nowrap items-center gap-2`,this._panelFiltersChips=document.createElement(`div`),this._panelFiltersChips.className=`flex min-w-0 flex-1 flex-nowrap items-center gap-2 overflow-x-hidden`,this._panelFiltersMorePanel=document.createElement(`div`),this._panelFiltersMorePanel.id=`mint-search-filter-more-${e._filterMorePanelSeq++}`,this._panelFiltersMorePanel.className=`hidden absolute left-0 right-0 top-full z-[95] mt-1 flex max-h-[40vh] flex-wrap gap-2 overflow-y-auto rounded-lg border border-gray-200 bg-white p-2 shadow-lg dark:border-mint-divider dark:bg-mint-elevated`,this._panelFiltersShowAllWrap=document.createElement(`div`),this._panelFiltersShowAllWrap.className=`relative flex min-h-0 min-w-0 shrink-0 items-center hidden`,this._panelFiltersShowAllBtn=document.createElement(`mint-button`),this._panelFiltersShowAllBtn.setAttribute(`type`,`button`),this._panelFiltersShowAllBtn.setAttribute(`variant`,`ghost`),this._panelFiltersShowAllBtn.setAttribute(`tone`,`neutral`),this._panelFiltersShowAllBtn.setAttribute(`size`,`small`),this._panelFiltersShowAllBtn.classList.add(`shrink-0`,`whitespace-nowrap`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,`false`),this._panelFiltersShowAllBtn.setAttribute(`aria-controls`,this._panelFiltersMorePanel.id),this._panelFiltersShowAllBtn.addEventListener(`click`,e=>{e.stopPropagation();let t=this._filtersMoreOpen;this._filtersMoreOpen=!this._filtersMoreOpen,this.render(),t&&requestAnimationFrame(()=>this._focusActiveInput())}),this._panelFiltersShowAllWrap.append(this._panelFiltersShowAllBtn),this._panelFiltersMainRow.append(this._panelFiltersChips,this._panelFiltersShowAllWrap),this._setPanelFiltersShowAllLabel(`Show all`),this._panelFiltersWrap.append(this._panelFiltersMainRow,this._panelFiltersMorePanel),typeof ResizeObserver<`u`&&!this._filterOverflowObserver&&(this._filterOverflowObserver=new ResizeObserver(()=>this._syncFilterOverflow()),this._filterOverflowObserver.observe(this._panelFiltersChips),this._filterOverflowObserver.observe(this._panelFiltersMainRow)))}_setPanelFiltersShowAllLabel(e){let t=this._panelFiltersShowAllBtn;if(!t)return;for(let e of Array.from(t.childNodes))e.nodeType===Node.TEXT_NODE&&e.remove();let n=t.querySelector(`button .mint-button-content`)||t.querySelector(`.mint-button-content`);if(n){n.textContent=e;return}let r=t.querySelector(`:scope > button`);if(r){r.replaceChildren(document.createTextNode(e)),t.render?.();return}t.firstElementChild||t.appendChild(document.createTextNode(e))}_scheduleFilterOverflowSync(){requestAnimationFrame(()=>{requestAnimationFrame(()=>this._syncFilterOverflow())})}_setFilterChipsEdgeFade(t){let n=this._panelFiltersChips;n&&(t?(n.style.maskImage=e._filterChipsOverflowMask,n.style.webkitMaskImage=e._filterChipsOverflowMask):(n.style.maskImage=``,n.style.webkitMaskImage=``))}_syncFilterOverflow(){if(!this._panelFiltersChips||!this._panelFiltersShowAllWrap||!this._panelFiltersShowAllBtn)return;if(this._filtersMoreOpen){this._panelFiltersShowAllWrap.classList.remove(`hidden`),this._filterOverflowZeroWidthRetries=0,this._setFilterChipsEdgeFade(!1);return}let e=this._panelFiltersChips.clientWidth;if(e===0&&this._searchOpen){this._filterOverflowZeroWidthRetries<10&&(this._filterOverflowZeroWidthRetries+=1,this._scheduleFilterOverflowSync()),this._setFilterChipsEdgeFade(!1);return}this._filterOverflowZeroWidthRetries=0;let t=this._panelFiltersChips.scrollWidth+this._getFilterChipOverflowReservePx()>e;this._panelFiltersShowAllWrap.classList.toggle(`hidden`,!t),this._setFilterChipsEdgeFade(t)}_getResultFocusableElements(){let e=this._customResultsWrap&&!this._customResultsWrap.classList.contains(`hidden`)?this._customResultsWrap:this._resultsWrap;return e?Array.from(e.querySelectorAll(`button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])`)):[]}_focusFirstChipOrResult(e=!1){let t=this._getFilterChipElements(),n=this._getResultFocusableElements();if(!e){(t[0]||n[0])?.focus();return}(n[n.length-1]||t[t.length-1])?.focus()}_moveFocusInResults(e,t){let n=this._getResultFocusableElements();if(n.length===0)return;let r=n.indexOf(e);if(r===-1)return;let i=n[r+t];if(i){i.focus();return}if(t===-1){let e=this._getFilterChipElements(),t=e[e.length-1];t?t.focus():this._focusActiveInput()}}_renderSelectedFilter(){let e=e=>{if(!e||(e.innerHTML=``,!this._hasSelectedFilters()))return;let t=document.createElement(`mint-chip`);t.setAttribute(`dismissable`,``),t.title=this._getFilterChipLabelText();let n=this._getCondensedFilterChipLabel();t.classList.add(`max-w-[min(20rem,85vw)]`,`whitespace-nowrap`,`overflow-hidden`,`text-ellipsis`,`text-xs`,`px-2`,`py-0.5`),t.style.fontSize=`0.75rem`,t.style.padding=`0.125rem 0.375rem`,t.style.height=`1.375rem`,t.style.lineHeight=`1`,t.style.whiteSpace=`nowrap`,t.style.overflow=`hidden`,t.style.textOverflow=`ellipsis`,this._selectedFilterBackspaceArmed&&t.classList.add(`ring-2`,`ring-brand-400`,`dark:ring-brand-300`),t.textContent=n,t.addEventListener(`dismiss`,e=>{e.stopPropagation(),this._clearAllSelectedFilters()}),e.appendChild(t)};e(this._desktopFilterWrap),e(this._mobileFilterWrap)}_bindInputHandlers(e){let t=()=>{this._scheduleSearch(this._getNativeInputValue(e))};e.addEventListener(`focusin`,()=>this._openSearch(!1)),e.addEventListener(`input`,t),e.addEventListener(`search`,t),e.addEventListener(`change`,t),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!1);return}if(t.key===`ArrowUp`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!0);return}if(t.key===`Tab`&&!t.shiftKey&&this._searchOpen){let e=this._getFilterChipElements(),n=this._getResultFocusableElements();if(e.length>0||n.length>0){t.preventDefault(),this._focusFirstChipOrResult(!1);return}}if(t.key!==`Backspace`)return;let n=this._getNativeInputValue(e);if(n!==this._query&&this._setQuery(n),!(n.length>0)&&this._hasSelectedFilters()){if(!this._selectedFilterBackspaceArmed){t.preventDefault(),this._selectedFilterBackspaceArmed=!0,this._renderSelectedFilter();return}t.preventDefault(),this._popLastSelectedFilter()}})}openSearch(e=!0){this._openSearch(e)}closeSearch(){this._closeSearch()}toggleSearch(e=!0){if(this._searchOpen){this._closeSearch();return}this._openSearch(e)}isSearchOpen(){return this._searchOpen}render(){let e=this._getEndpoint();if(this.classList.toggle(`hidden`,!e),!e)return;if(!this._shell){this._shell=document.createElement(`div`),this._shell.className=`relative z-[91] flex h-10 w-full`,this._desktopFilterWrap=document.createElement(`div`),this._desktopFilterWrap.className=`inline-flex shrink-0 max-w-[8.5rem]`,this._desktopFilterWrap.setAttribute(`slot`,`prepend`),this._desktopInput=document.createElement(`mint-input`),this._desktopInput.setAttribute(`type`,`search`),this._desktopInput.setAttribute(`icon`,`search`),this._desktopInput.className=`h-full min-w-0 flex-1`;let e=document.createElement(`span`);e.className=`shrink-0 text-xs text-gray-500 dark:text-gray-400`,e.setAttribute(`slot`,`append`),this._desktopShortcutHint=e,this._bindInputHandlers(this._desktopInput),this._desktopInput.appendChild(this._desktopFilterWrap),this._desktopInput.appendChild(e),this._shell.appendChild(this._desktopInput),this.appendChild(this._shell)}if(!this._panel){this._panel=document.createElement(`div`),this._panel.className=`absolute left-0 right-0 top-full z-[90] hidden p-0 -mt-[9px]`;let e=document.createElement(`div`);e.className=`mx-auto flex max-h-[calc(100dvh-4rem)] w-full flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none min-[1100px]:border-t-0`,this._panelInner=e;let t=document.createElement(`div`);this._panelSearchBar=t,t.className=`hidden`,this._mobileFilterWrap=document.createElement(`div`),this._mobileFilterWrap.className=`inline-flex shrink-0 max-w-[8.5rem]`,this._mobileFilterWrap.setAttribute(`slot`,`prepend`),this._panelInput=document.createElement(`mint-input`),this._panelInput.setAttribute(`type`,`search`),this._panelInput.className=`min-w-0 flex-1`,this._bindInputHandlers(this._panelInput),this._panelInput.appendChild(this._mobileFilterWrap),t.appendChild(this._panelInput),this._customResultsWrap=document.createElement(`div`),this._customResultsWrap.className=`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,this._stateWrap=document.createElement(`div`),this._stateWrap.className=`px-4 pb-4 text-sm text-gray-500 dark:text-gray-400`,this._stateWrap.textContent=`Start typing to search`,this._resultsWrap=document.createElement(`div`),this._resultsWrap.className=`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,e.appendChild(t),this._panelFiltersWrap=document.createElement(`div`),e.appendChild(this._panelFiltersWrap),this._ensurePanelFiltersShell(),e.appendChild(this._customResultsWrap),e.appendChild(this._stateWrap),e.appendChild(this._resultsWrap),this._panel.appendChild(e),this.appendChild(this._panel)}let t=this._hasSelectedFilters()?``:this._getPlaceholder();if(this._desktopInput&&this._desktopInput.setAttribute(`placeholder`,t),this._panelInput&&this._panelInput.setAttribute(`placeholder`,t),this._desktopShortcutHint){let e=this._getOpenShortcutHintText();this._desktopShortcutHint.textContent=e,this._desktopShortcutHint.classList.toggle(`hidden`,!e)}if(this._panelFiltersWrap){this._ensurePanelFiltersShell();let e=this._getFilterOptions();this._selectedFilters=this._selectedFilters.filter(t=>e.includes(t));let t=e.length>0;t||(this._filtersMoreOpen=!1),this._panelFiltersWrap.classList.toggle(`hidden`,!t),this._stateWrap?.classList.toggle(`pt-4`,!t),this._resultsWrap?.classList.toggle(`pt-4`,!t),this._customResultsWrap?.classList.toggle(`pt-5`,!t),this._panelFiltersChips&&this._panelFiltersChips.replaceChildren(),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.replaceChildren();let n=this._filtersMoreOpen&&this._panelFiltersMorePanel?this._panelFiltersMorePanel:this._panelFiltersChips;for(let t of e){if(!n)break;let r=document.createElement(`mint-chip`),i=this._selectedFilters.includes(t);if(i&&r.classList.add(`ring-2`,`ring-inset`,`ring-brand-400`,`dark:ring-brand-300`),r.classList.add(`cursor-pointer`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-inset`,`focus-visible:ring-brand-400`,`inline-flex`,`items-center`,`gap-1`,`shrink-0`,`whitespace-nowrap`),i){let e=document.createElement(`span`);e.textContent=t;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`close`),n.className=`h-4 w-4 ml-2 shrink-0`,n.setAttribute(`aria-hidden`,`true`),r.append(e,n)}else r.textContent=t;r.tabIndex=0,r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,i?`Remove filter ${t}`:`Filter by ${t}`),r.dataset.mintSearchFilter=t,r.addEventListener(`pointerdown`,e=>{e.preventDefault()});let a=n=>{n&&n.stopPropagation();let r=this._filtersMoreOpen,i=this._selectedFilters.indexOf(t);i>=0?this._selectedFilters.splice(i,1):this._selectedFilters.push(t),this._selectedFilterBackspaceArmed=!1;let a=e.length>0&&this._selectedFilters.length===e.length,o=this._selectedFilters.length===0;r&&(a||o)&&(this._filtersMoreOpen=!1),this._emitFilterChange(),this._renderSelectedFilter(),this.render(),this._query.trim()&&this._scheduleSearch(this._query),r?a||o?this._focusActiveInput():requestAnimationFrame(()=>{this._getFilterChipElements().find(e=>e.dataset.mintSearchFilter===t)?.focus()}):this._focusActiveInput()};r.addEventListener(`click`,e=>a(e)),r.addEventListener(`keydown`,e=>{let t=this._getFilterChipElements(),n=t.indexOf(r);if(e.key===`Enter`||e.key===` `){e.preventDefault(),a(e);return}if(e.key===`ArrowRight`){e.preventDefault();let r=t[n+1];r&&r.focus();return}if(e.key===`ArrowLeft`){e.preventDefault();let r=t[n-1];r?r.focus():this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}if(e.key===`ArrowDown`){e.preventDefault(),this._getResultFocusableElements()[0]?.focus();return}if(e.key===`ArrowUp`){e.preventDefault(),this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}}),n.appendChild(r)}this._panelFiltersChips&&this._panelFiltersChips.classList.toggle(`hidden`,this._filtersMoreOpen),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.classList.toggle(`hidden`,!this._filtersMoreOpen),this._panelFiltersShowAllBtn&&(this._setPanelFiltersShowAllLabel(this._filtersMoreOpen?`Hide filters`:`Show all`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,this._filtersMoreOpen?`true`:`false`)),this._panelInner&&(this._filtersMoreOpen&&t?(this._panelInner.classList.remove(`overflow-hidden`),this._panelInner.classList.add(`overflow-visible`)):(this._panelInner.classList.remove(`overflow-visible`),this._panelInner.classList.add(`overflow-hidden`))),this._scheduleFilterOverflowSync()}if(this._customResultsWrap){Array.from(this.children).filter(e=>e===this._shell||e===this._panel?!1:e.getAttribute(`slot`)===`results`).forEach(e=>this._customResultsWrap.appendChild(e));let e=this._customResultsWrap.childElementCount>0;this._customResultsWrap.classList.toggle(`hidden`,!e),e?(this._stateWrap?.classList.add(`hidden`),this._resultsWrap?.classList.add(`hidden`)):this._resultsWrap?.classList.remove(`hidden`)}this._renderSelectedFilter(),this._syncResponsiveChrome(),this._syncPanelVisibility()}_syncResponsiveChrome(){let e=this._collapseOnMobile();this._shell&&(this._shell.className=e?`relative z-[91] hidden h-10 w-full min-[1100px]:flex`:`relative z-[91] flex h-10 w-full`),this._panelSearchBar&&(this._panelSearchBar.className=e?`flex shrink-0 items-center gap-2 border-b border-gray-200 p-3 dark:border-mint-divider min-[1100px]:hidden`:`hidden`)}};customElements.get(`mint-search`)||customElements.define(`mint-search`,G);var K=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`fixed`,`bottom-0`,`left-0`,`right-0`,`z-30`,`flex`,`w-full`,`items-stretch`,`justify-around`,`gap-1`,`border-t`,`border-gray-200`,`bg-white`,`px-1`,`pt-1`,`pb-[env(safe-area-inset-bottom,0px)]`,`min-[1100px]:hidden`,`transition-transform`,`duration-200`,`ease-out`,`translate-y-0`,`dark:border-mint-divider`,`dark:bg-mint-nav`),this.setAttribute(`role`,`navigation`),this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`translate-y-full`),this.classList.add(`translate-y-0`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?(this.classList.remove(`translate-y-0`),this.classList.add(`translate-y-full`)):(this.classList.remove(`translate-y-full`),this.classList.add(`translate-y-0`)),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||customElements.define(`mint-bottom-navigation`,K);var q=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`contents`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.getAttribute(`active`)===`true`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i=r?`text-gray-900 dark:text-gray-100`:`text-gray-600 hover:bg-black/5 dark:text-gray-300 dark:hover:bg-white/10`,a;e?(a=document.createElement(`a`),a.href=e):(a=document.createElement(`button`),a.type=`button`),a.className=`flex min-w-0 flex-1 flex-col items-center justify-center gap-1 rounded-lg px-1 py-2 text-center text-[11px] font-medium leading-tight ${i}`,a.setAttribute(`aria-current`,r?`page`:`false`),a.setAttribute(`aria-label`,t||`Navigation item`);let o=document.createElement(`span`);if(o.className=`inline-flex h-6 w-6 items-center justify-center`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=r?`h-6 w-6`:`h-6 w-6 opacity-90`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`block w-full truncate`,s.textContent=t,a.appendChild(o),a.appendChild(s),this.replaceChildren(a),this._root=a}};customElements.get(`mint-bottom-nav-item`)||customElements.define(`mint-bottom-nav-item`,q);var ce=class extends HTMLElement{constructor(...e){super(...e),this._messageEl=null,this._hideTimer=null,this._hideResolve=null,this._bottomNavObserver=null,this._bodyObserver=null}static get observedAttributes(){return[`open`,`message`]}connectedCallback(){this.classList.add(`pointer-events-none`,`fixed`,`left-1/2`,`-translate-x-1/2`,`min-[1100px]:bottom-4`,`z-40`,`transition-all`,`duration-200`,`ease-out`,`opacity-0`,`translate-y-2`),this._updateBottomOffset(),this._setupBottomNavObservers(),this.setAttribute(`aria-live`,`polite`),this.setAttribute(`aria-atomic`,`true`),this.render()}disconnectedCallback(){this._clearHideTimer(),this._disconnectBottomNavObservers(),this._hideResolve=null}attributeChangedCallback(e,t,n){t!==n&&(e===`open`||e===`message`)&&this.render()}async showToast(e,t=2200){let n=e.trim().slice(0,120);n&&(this._updateBottomOffset(),this._clearHideTimer(),this._hideResolve=null,this.setAttribute(`message`,n),this.setAttribute(`open`,`true`),this.render(),await new Promise(e=>{this._hideResolve=e,this._hideTimer=window.setTimeout(()=>{this.hideToast()},t)}))}hideToast(e=!1){this.removeAttribute(`open`),this.render(),this._clearHideTimer();let t=this._hideResolve;this._hideResolve=null,t&&(e?t():window.setTimeout(t,200))}_clearHideTimer(){this._hideTimer!==null&&(window.clearTimeout(this._hideTimer),this._hideTimer=null)}_updateBottomOffset(){let e=this._hasVisibleBottomNav();this.classList.remove(`bottom-[calc(env(safe-area-inset-bottom,0px)+4.5rem)]`,`bottom-[calc(env(safe-area-inset-bottom,0px)+1rem)]`),this.classList.add(e?`bottom-[calc(env(safe-area-inset-bottom,0px)+4.5rem)]`:`bottom-[calc(env(safe-area-inset-bottom,0px)+1rem)]`)}_hasVisibleBottomNav(){let e=document.querySelector(`mint-bottom-navigation`);if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.classList.contains(`translate-y-full`))}_setupBottomNavObservers(){this._disconnectBottomNavObservers();let e=()=>{this._bottomNavObserver&&=(this._bottomNavObserver.disconnect(),null);let e=document.querySelector(`mint-bottom-navigation`);if(!e){this._updateBottomOffset();return}this._bottomNavObserver=new MutationObserver(()=>{this._updateBottomOffset()}),this._bottomNavObserver.observe(e,{attributes:!0,attributeFilter:[`class`,`style`]}),this._updateBottomOffset()};this._bodyObserver=new MutationObserver(()=>{e()}),this._bodyObserver.observe(document.body,{childList:!0,subtree:!0}),e()}_disconnectBottomNavObservers(){this._bottomNavObserver&&=(this._bottomNavObserver.disconnect(),null),this._bodyObserver&&=(this._bodyObserver.disconnect(),null)}render(){let e=this.getAttribute(`open`)===`true`,t=this.getAttribute(`message`)||``;this.classList.toggle(`opacity-100`,e),this.classList.toggle(`translate-y-0`,e),this.classList.toggle(`opacity-0`,!e),this.classList.toggle(`translate-y-2`,!e),this._messageEl||=(this.innerHTML=`<div class="rounded-md bg-[#202223] px-4 py-2 text-sm font-medium text-white shadow-[0_8px_24px_rgba(0,0,0,0.25)] min-[1100px]:px-5 min-[1100px]:py-3 min-[1100px]:text-base dark:bg-[#0f1113]">
|
|
140
|
+
`,a.textContent=e.name,i.appendChild(a),t.appendChild(i)}),this._svg.appendChild(t),{height:this._legendHeight+50}}async addDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.push(t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchAddDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,point:r}of e)this._chartData.datasets[n]&&(this._chartData.datasets[n].data.push(r),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async updateDatasetData(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data=t,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async addDataset(e){return this._chartData?(this._chartData.datasets.push(e),e.id&&this._datasetVisibility.set(e.id,e.visible!==!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Chart data not initialized`),Promise.reject(Error(`Chart data not initialized`)))}async removeDataset(e){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets.splice(e,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async updateDataPoint(e,t,n){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):this._chartData.datasets[e].data[t]?(this._chartData.datasets[e].data[t]=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Data point at index ${t} does not exist`),Promise.reject(Error(`Data point at index ${t} does not exist`)))}async batchUpdateDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r,point:i}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data[r]=i,t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async removeDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.splice(t,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchRemoveDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data.splice(r,1),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async showDataset(e){return this._datasetVisibility.set(e,!0),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async hideDataset(e){return this._datasetVisibility.set(e,!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async toggleDataset(e){let t=!(this._datasetVisibility.get(e)??!0);return this._datasetVisibility.set(e,t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),await new Promise(e=>requestAnimationFrame(()=>e())),t}isDatasetVisible(e){return this._datasetVisibility.get(e)}async downloadAsPNG(e=`chart.png`){if(!this._svg)return console.error(`Chart SVG not found`),Promise.reject(Error(`Chart SVG not found`));let t=this._svg.cloneNode(!0),n=this._width,r=this._height;t.querySelectorAll(`text`).forEach(e=>{let t=e.getAttribute(`font-family`);(!t||t.includes(`system-ui`)||t.includes(`apple-system`))&&e.setAttribute(`font-family`,`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`)}),t.setAttribute(`width`,n.toString()),t.setAttribute(`height`,r.toString()),t.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),t.querySelectorAll(`foreignObject`).forEach(e=>{let t=e.querySelector(`div`);if(t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),r=e.getAttribute(`x`)||`0`,i=e.getAttribute(`y`)||`0`;n.setAttribute(`x`,r),n.setAttribute(`y`,(parseFloat(i)+12).toString()),n.setAttribute(`fill`,t.style.color||`#374151`),n.setAttribute(`font-size`,`12`),n.setAttribute(`font-family`,t.style.fontFamily||`system-ui, -apple-system, sans-serif`),n.textContent=t.textContent||``,e.parentNode&&e.parentNode.replaceChild(n,e)}});let i=new XMLSerializer().serializeToString(t),a=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(i),o=new Image;return o.crossOrigin=`anonymous`,new Promise((t,i)=>{o.onload=()=>{setTimeout(()=>{let a=document.createElement(`canvas`);a.width=n+60,a.height=r+60;let s=a.getContext(`2d`);if(!s){console.error(`Could not get canvas context`),i(Error(`Could not get canvas context`));return}s.fillStyle=document.documentElement.classList.contains(`dark`)?`#111827`:`#ffffff`,s.fillRect(0,0,a.width,a.height),s.drawImage(o,30,30),a.toBlob(n=>{if(!n){console.error(`Could not create blob from canvas`),i(Error(`Could not create blob from canvas`));return}let r=URL.createObjectURL(n),a=document.createElement(`a`);a.href=r,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r),t()},`image/png`)},0)},o.onerror=()=>{console.error(`Error loading SVG image`),i(Error(`Error loading SVG image`))},o.src=a})}};customElements.get(`mint-chart`)||a(`mint-chart`,an);var on=class extends HTMLElement{constructor(...e){super(...e),this._root=null,this._label=null,this._dismissBtn=null,this._clickHandler=null}static get observedAttributes(){return[`dismissable`,`tone`]}connectedCallback(){this._render()}disconnectedCallback(){this._dismissBtn&&this._clickHandler&&this._dismissBtn.removeEventListener(`click`,this._clickHandler)}attributeChangedCallback(){this.isConnected&&this._render()}_render(){if(this.classList.add(`mint-chip`),!this._root){for(this._root=document.createElement(`span`),this._root.className=`mint-chip__content`,this._label=document.createElement(`span`),this._label.className=`mint-chip__label`,this._label.setAttribute(`data-mt-chip-text`,``);this.firstChild;){let e=this.firstChild;if(e===this._root)break;this._label.appendChild(e)}this._root.appendChild(this._label),this.appendChild(this._root)}let e=this.getAttribute(`dismissable`);if(e===``||e===`true`?(this._dismissBtn||this._createDismissButton(),this._dismissBtn&&this._dismissBtn.parentElement!==this._root&&this._root?.appendChild(this._dismissBtn)):this._dismissBtn?.parentElement===this._root&&this._dismissBtn.remove(),this._dismissBtn){let e=this._label?.textContent?.trim();this._dismissBtn.setAttribute(`aria-label`,e?`Remove ${e}`:`Dismiss chip`)}}_createDismissButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`mint-chip__dismiss`,e.setAttribute(`aria-label`,`Dismiss chip`);let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`close`),t.className=`mint-chip__dismiss-icon`,t.setAttribute(`aria-hidden`,`true`),e.appendChild(t),this._clickHandler=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismiss`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},e.addEventListener(`click`,this._clickHandler),this._dismissBtn=e}};customElements.get(`mint-chip`)||a(`mint-chip`,on);var sn=class extends HTMLElement{constructor(...e){super(...e),this._clickHandler=null,this._keydownHandler=null,this._target=null,this._observer=null,this._managedRole=!1,this._managedTabindex=!1}connectedCallback(){this._setupEventListeners(),this._observer=new MutationObserver(()=>this._syncTarget()),this._observer.observe(this,{childList:!0}),this._syncTarget()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._bindTarget(null)}_syncTarget(){let e=Array.from(this.children).find(e=>e.tagName.toLowerCase()===`mint-card`),t=e??this;if(this._bindTarget(t),this.toggleAttribute(`data-delegated`,!!e),e){this.removeAttribute(`role`),this.removeAttribute(`tabindex`),e.setAttribute(`data-clickable-target`,``),e.hasAttribute(`role`)||(e.setAttribute(`role`,`button`),this._managedRole=!0),e.hasAttribute(`tabindex`)||(e.setAttribute(`tabindex`,this._isDisabled()?`-1`:`0`),this._managedTabindex=!0),this._isDisabled()?e.setAttribute(`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`);return}this._managedRole&&this.removeAttribute(`role`),this._managedTabindex&&this.removeAttribute(`tabindex`),this._managedRole=!1,this._managedTabindex=!1,this.hasAttribute(`role`)||this.setAttribute(`role`,`button`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this._isDisabled()?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}_setupEventListeners(){this._clickHandler=e=>{if(this._isDisabled()){e.preventDefault(),e.stopPropagation();return}this._isNestedControl(e)||this._dispatchClickableEvent(e)},this._keydownHandler=e=>{if(!(e.key!==`Enter`&&e.key!==` `)){if(this._isDisabled()){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),this._dispatchClickableEvent(e)}},this._bindTarget(this)}_bindTarget(e){this._target!==e&&(this._target&&this._clickHandler&&this._keydownHandler&&(this._target.removeEventListener(`click`,this._clickHandler),this._target.removeEventListener(`keydown`,this._keydownHandler)),this._target&&this._target!==this&&(this._target.removeAttribute(`data-clickable-target`),this._managedRole&&this._target.removeAttribute(`role`),this._managedTabindex&&this._target.removeAttribute(`tabindex`),this._target.removeAttribute(`aria-disabled`)),this._target!==e&&(this._managedRole=!1,this._managedTabindex=!1),this._target=e,e&&this._clickHandler&&this._keydownHandler&&(e.addEventListener(`click`,this._clickHandler),e.addEventListener(`keydown`,this._keydownHandler)))}_isDisabled(){return this.getAttribute(`disabled`)===`true`||this.hasAttribute(`disabled`)&&this.getAttribute(`disabled`)!==`false`}_isNestedControl(e){let t=e.target;return!(t instanceof Element)||t===this._target?!1:!!t.closest(`a, button, input, select, textarea, [contenteditable="true"], [role="button"]`)}_dispatchClickableEvent(e){this.dispatchEvent(new CustomEvent(`clickable-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}static get observedAttributes(){return[`disabled`,`inline`]}attributeChangedCallback(e,t,n){e===`disabled`&&this.isConnected&&this._syncTarget()}};customElements.get(`mint-clickable`)||a(`mint-clickable`,sn);var cn=class extends HTMLElement{static get observedAttributes(){return[`id`,`open`,`trigger-id`,`trigger-toggle`,`disabled`]}constructor(){super(),this._triggerElement=null,this._triggerClickHandler=null,this._contentElement=null,this._contentId=``,this._initialRenderDone=!1,this._triggerRetryTimer=null,this._contentAnimation=null,this._animationToken=0}connectedCallback(){this._ensureStructure(),this._setupTrigger(),this.render()}disconnectedCallback(){this._teardownTrigger(),this._triggerRetryTimer!==null&&(clearTimeout(this._triggerRetryTimer),this._triggerRetryTimer=null),this._animationToken+=1,this._contentAnimation?.cancel(),this._contentAnimation=null}attributeChangedCallback(e,t,n){if(t!==n){if((e===`trigger-id`||e===`trigger-toggle`)&&this._setupTrigger(),e===`open`){this._animateToState();return}this.render()}}isOpen(){let e=this.getAttribute(`open`);return e!==null&&e!==`false`}isDisabled(){let e=this.getAttribute(`disabled`);return e!==null&&e!==`false`}open(){this.isDisabled()||(this.setAttribute(`open`,`true`),this.dispatchEvent(new CustomEvent(`open`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{open:!0},bubbles:!0})))}close(){let e=this.isOpen();this.removeAttribute(`open`),e&&(this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{open:!1},bubbles:!0})))}toggle(){this.isOpen()?this.close():this.open()}_ensureStructure(){this._contentId||=`mint-collapsible-content-${Math.random().toString(36).slice(2,10)}`;let e=this.querySelector(`[slot="content"]`);if(e){this._contentElement=e,this._contentElement.id=this._contentId,this._ensureContentWrapper(e);return}let t=document.createElement(`div`);t.setAttribute(`slot`,`content`),t.id=this._contentId,Array.from(this.children).filter(e=>e instanceof HTMLElement?e.getAttribute(`slot`)!==`trigger`:!1).forEach(e=>t.appendChild(e)),this._ensureContentWrapper(t),this.appendChild(t),this._contentElement=t}_ensureContentWrapper(e){let t=e.querySelector(`:scope > .mint-collapsible__inner`);if(t)return t;for(t=document.createElement(`div`),t.className=`mint-collapsible__inner`;e.firstChild;)t.appendChild(e.firstChild);return e.appendChild(t),t}_getTriggerElement(){let e=(this.getAttribute(`trigger-id`)||``).trim();return e?document.getElementById(e):this.querySelector(`[slot="trigger"]`)}_teardownTrigger(){this._triggerRetryTimer!==null&&(clearTimeout(this._triggerRetryTimer),this._triggerRetryTimer=null),this._triggerClickHandler&&this._triggerElement&&this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null,this._triggerElement=null}_setupTrigger(){let e=this._triggerElement,t=this._getTriggerElement();if(e&&t&&e===t&&this._triggerClickHandler&&this.getAttribute(`trigger-toggle`)!==`false`){this._syncTriggerA11y();return}if(this._teardownTrigger(),this._triggerElement=t,!this._triggerElement){this.getAttribute(`trigger-id`)&&(this._triggerRetryTimer=window.setTimeout(()=>{this._triggerRetryTimer=null,this._setupTrigger()},10));return}if(this.getAttribute(`trigger-toggle`)===`false`){this._syncTriggerA11y();return}this._triggerClickHandler=e=>{this._triggerElement?.tagName===`MINT-BUTTON`&&e.target!==this._triggerElement||this.isDisabled()||(e.currentTarget instanceof HTMLAnchorElement&&e.preventDefault(),this.toggle())},this._triggerElement.addEventListener(`click`,this._triggerClickHandler,!0),this._syncTriggerA11y()}_syncTriggerA11y(){this._triggerElement&&(this._triggerElement.setAttribute(`aria-expanded`,this.isOpen()?`true`:`false`),this._triggerElement.setAttribute(`aria-controls`,this._contentId),this._triggerElement.setAttribute(`aria-disabled`,this.isDisabled()?`true`:`false`))}render(){this._contentElement=this.querySelector(`[slot="content"]`),this._contentElement||=(this._ensureStructure(),this.querySelector(`[slot="content"]`));let e=this.isOpen();this._contentElement&&(this._contentElement.id=this._contentId,this._ensureContentWrapper(this._contentElement),this._initialRenderDone||(this._contentElement.hidden=!e,this._contentElement.style.height=e?`auto`:`0px`,this._contentElement.style.opacity=e?`1`:`0`));let t=this._getTriggerElement();t?(t!==this._triggerElement&&this._setupTrigger(),this._triggerElement=t,this._syncTriggerA11y()):this.getAttribute(`trigger-id`)&&this._setupTrigger(),this._initialRenderDone||=!0}_animateToState(){let e=this.querySelector(`[slot="content"]`);if(this._syncTriggerA11y(),!e)return;let t=e.hidden?0:e.getBoundingClientRect().height,n=e.hidden?0:Number.parseFloat(getComputedStyle(e).opacity)||0;this._animationToken+=1;let r=this._animationToken;this._contentAnimation?.cancel(),this._contentAnimation=null;let i=this.isOpen(),a=matchMedia(`(prefers-reduced-motion: reduce)`).matches,o=()=>{r===this._animationToken&&(i||(e.hidden=!0),e.style.height=``,e.style.opacity=``,e.style.overflow=``,this._contentAnimation=null)};if(e.style.overflow=`hidden`,i){e.hidden=!1;let r=e.scrollHeight;if(a||typeof e.animate!=`function`){o();return}this._contentAnimation=e.animate([{height:`${t}px`,opacity:n},{height:`${r}px`,opacity:1}],{duration:220,easing:`ease-in-out`}),this._contentAnimation.onfinish=o;return}if(a||typeof e.animate!=`function`){o();return}let s=Math.max(t,e.getBoundingClientRect().height);this._contentAnimation=e.animate([{height:`${s}px`,opacity:n},{height:`0px`,opacity:0}],{duration:220,easing:`ease-in-out`}),this._contentAnimation.onfinish=o}};customElements.get(`mint-collapsible`)||a(`mint-collapsible`,cn);var ln=class extends HTMLElement{constructor(...e){super(...e),this._modal=null,this._actionsFooter=null,this._confirmButton=null,this._cancelButton=null,this._pendingResolve=null,this._modalObserver=null,this._lastAction=null,this._onConfirmClick=null,this._onCancelClick=null}connectedCallback(){this._ensureModal(),this._observeModalOpenState()}disconnectedCallback(){this._modalObserver&&=(this._modalObserver.disconnect(),null),this._pendingResolve=null}async showConfirm(e){if(this._ensureModal(),!this._modal||!this._confirmButton||!this._cancelButton)return!1;let t=e.question?.trim()||`Are you sure?`,n=e.tone||`action`,r=e.confirmLabel?.trim()||`Confirm`,i=e.cancelLabel?.trim()||`Cancel`;this._lastAction=null,this._modal.setAttribute(`heading`,t),this._cancelButton.className=`mint-button-core mint-button-ghost mint-button-tone-neutral mint-confirm-action-cancel`,this._confirmButton.className=`mint-button-core mint-button-solid mint-button-tone-${n} mint-confirm-action-confirm`,this._confirmButton.textContent=r,this._cancelButton.textContent=i;let a=new Promise(e=>{this._pendingResolve=e});return requestAnimationFrame(()=>{this._modal.open?.(),this._mountActionsFooter()}),a}_ensureModal(){this._modal||(this._modal=document.createElement(`mint-modal`),this._modal.setAttribute(`heading`,`Are you sure?`),this._modal.setAttribute(`size`,`small`),this._cancelButton=document.createElement(`button`),this._cancelButton.type=`button`,this._cancelButton.className=`mint-button-core mint-button-ghost mint-button-tone-neutral mint-confirm-action-cancel`,this._cancelButton.textContent=`Cancel`,this._confirmButton=document.createElement(`button`),this._confirmButton.type=`button`,this._confirmButton.className=`mint-button-core mint-button-solid mint-button-tone-action mint-confirm-action-confirm`,this._confirmButton.textContent=`Confirm`,this._actionsFooter=document.createElement(`div`),this._actionsFooter.className=`mint-confirm-action-footer`,this._actionsFooter.append(this._cancelButton,this._confirmButton),this._onCancelClick=()=>{this._lastAction=`cancel`,this._modal?.close?.()},this._onConfirmClick=()=>{this._lastAction=`confirm`,this._modal?.close?.()},this._cancelButton.addEventListener(`click`,this._onCancelClick),this._confirmButton.addEventListener(`click`,this._onConfirmClick),this.appendChild(this._modal))}_mountActionsFooter(){let e=this._modal?.querySelector(`.modal-content`);!e||!this._actionsFooter||(e.querySelectorAll(`:scope > [slot="body"], :scope > [slot="actions"]`).forEach(e=>{!e.textContent?.trim()&&!e.querySelector(`button, mint-button, a, input, select, textarea`)&&e.remove()}),this._actionsFooter.parentElement!==e&&e.appendChild(this._actionsFooter))}_observeModalOpenState(){!this._modal||this._modalObserver||(this._modalObserver=new MutationObserver(()=>{if((this._modal?.hasAttribute(`open`)??!1)||!this._pendingResolve)return;let e=this._pendingResolve;this._pendingResolve=null;let t=this._lastAction===`confirm`;this._lastAction=null,e(t)}),this._modalObserver.observe(this._modal,{attributes:!0,attributeFilter:[`open`]}))}};customElements.get(`mint-confirm-action`)||a(`mint-confirm-action`,ln);var U=[],W=!1;function un(){return typeof document>`u`||document.body?Promise.resolve():new Promise(e=>{if(typeof window>`u`){e();return}window.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0})})}async function dn(){if(await un(),typeof document>`u`)throw Error(`mintui.confirm is only available in browser environments.`);let e=document.querySelector(`mint-confirm-action[data-mint-confirm-action-root="true"]`);if(e)return e;let t=document.createElement(`mint-confirm-action`);return t.setAttribute(`data-mint-confirm-action-root`,`true`),document.body.appendChild(t),t}function fn(e){let t=(e||`action`).toString().trim().toLowerCase().replace(/^tone:\s*/,``);return t===`action`||t===`info`||t===`warning`||t===`danger`?t:`action`}async function pn(){if(!W){W=!0;try{for(;U.length>0;){let e=U.shift();e&&(await(await dn()).showConfirm({question:e.question,tone:fn(e.tone),confirmLabel:e.confirmLabel||`Confirm`,cancelLabel:e.cancelLabel||`Cancel`})?e.confirmed?.():e.cancelled?.())}}finally{W=!1}}}function mn(e,t,n,r=`action`,i=`Confirm`,a=`Cancel`){typeof window>`u`||(U.push({question:e,confirmed:t,cancelled:n,tone:r,confirmLabel:i,cancelLabel:a}),pn())}if(typeof window<`u`){let e=window.mintui||{};e.confirm=mn,window.mintui=e}s({name:`calendar`,viewBox:`0 0 24 24`,path:`M8 7V3m8 4V3M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2zM6 11h12M6 14h12M6 17h12`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`caret-left`,viewBox:`0 0 24 24`,path:`M15 19l-7-7 7-7`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`caret-right`,viewBox:`0 0 24 24`,path:`M9 5l7 7-7 7`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`caret-up`,viewBox:`0 0 24 24`,path:`M5 15l7-7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`caret-down`,viewBox:`0 0 24 24`,path:`M19 9l-7 7-7-7`,strokeLinecap:`round`,strokeLinejoin:`round`});var hn=class extends HTMLElement{static get observedAttributes(){return[`type`,`placeholder`,`value`,`disabled`,`id`,`name`,`required`,`readonly`,`rows`,`icon`,`label`,`info`,`error`,`error-message`,`loading`,`aria-label`,`aria-labelledby`,`aria-describedby`]}constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._prependSlotContainer=null,this._appendSlotContainer=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._contentObserver=null,this._focusHandler=null,this._a11yId=``,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null,this._renderFrame=null}connectedCallback(){this.classList.add(`mint-input-host`),this.render(),this._observeContentMutations()}disconnectedCallback(){this.removeEventListeners(),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._syncControlAccessibility(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(e===`loading`){this.render();return}this.render()}}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}getType(){return this.getAttribute(`type`)||`text`}getRows(){let e=this.getAttribute(`rows`);return e?parseInt(e,10):3}_getNormalizedType(){let e=this.getType();return e===`datetime`?`datetime-local`:e===`money`?`text`:e===`textarea`?`textarea`:e}_isTextarea(){return this.getType()===`textarea`}_isMoney(){return this.getType()===`money`}_isColor(){return this.getType()===`color`}_isNumber(){return this.getType()===`number`}getPlaceholder(){return this.getAttribute(`placeholder`)||``}getValue(){return this._isColor()?this._colorTextInput?this._colorTextInput.value:this._colorPicker?this._colorPicker.value:this.getAttribute(`value`)||`#000000`:this._element?this._element.value:this.getAttribute(`value`)||``}set value(e){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||`#000000`),this._colorTextInput&&(this._colorTextInput.value=e||`#000000`)):this._element&&(this._element.value=e),e?this.setAttribute(`value`,e):this.removeAttribute(`value`)}catch{}}get value(){try{return this.getValue()||``}catch{return``}}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getIcon(){return this.getAttribute(`icon`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getInputClasses(){let e=this._isTextarea(),t=!!this.getIcon(),n=this.querySelector(`[slot="prepend"]`)!==null,r=this.querySelector(`[slot="append"]`)!==null,i=this._isColor(),a=this._isNumber(),o=this.hasError();return[`mint-input-control`,e&&`is-textarea`,t&&`has-icon`,i&&`is-color`,n&&`has-prepend`,r&&`has-append`,a&&`is-number`,o&&`has-error`].filter(Boolean).join(` `)}_syncSlotAdornments(e,t){if(!this._wrapper||e||this._isColor()){this._prependSlotContainer&&=(this._prependSlotContainer.remove(),null),this._appendSlotContainer&&=(this._appendSlotContainer.remove(),null);return}this._prependSlotContainer||(this._prependSlotContainer=document.createElement(`div`),this._prependSlotContainer.className=`mint-input-adornment mint-input-prepend-slot`,this._wrapper.appendChild(this._prependSlotContainer)),this._appendSlotContainer||(this._appendSlotContainer=document.createElement(`div`),this._appendSlotContainer.className=`mint-input-adornment mint-input-append-slot`,this._wrapper.appendChild(this._appendSlotContainer)),this._prependSlotContainer.classList.toggle(`has-icon-offset`,t);let n=Array.from(this.querySelectorAll(`[slot="prepend"]`)),r=Array.from(this.querySelectorAll(`[slot="append"]`));this._prependSlotContainer.replaceChildren(),this._appendSlotContainer.replaceChildren(),n.forEach(e=>this._prependSlotContainer.appendChild(e)),r.forEach(e=>this._appendSlotContainer.appendChild(e)),this._prependSlotContainer.classList.toggle(`is-hidden`,n.length===0),this._appendSlotContainer.classList.toggle(`is-hidden`,r.length===0)}isLoading(){return this.getAttribute(`loading`)===`true`}render(){this.getType();let e=this._getNormalizedType(),t=this._isTextarea(),n=this._isMoney(),r=this._isColor(),i=this.getPlaceholder(),a=this.isDisabled(),o=this.isReadonly(),s=this.isRequired(),c=this.getId(),l=this.getName(),u=this.getAttribute(`value`)||(r?`#000000`:``),d=this.getRows(),f=this.getIcon(),p=this.getLabel(),m=this.getInfo(),h=this.isLoading();if(r&&this._renderSkeleton(h),r){this._input&&=(this._input.remove(),null),this._textarea&&=(this._textarea.remove(),null),this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`mint-input-wrapper`,this.appendChild(this._wrapper)),this._colorContainer&&=(this._colorContainer.remove(),null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement(`div`),this._colorPickerWrapper.className=`mint-color-picker-wrapper`,this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement(`input`),this._colorPicker.type=`color`,this._colorPicker.className=`mint-color-picker`,this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=e=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&requestAnimationFrame(()=>{this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&this._colorPickerWrapper?.classList.add(`is-focused`)})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove(`is-focused`)},this._colorPicker.addEventListener(`focus`,this._focusHandler),this._colorPicker.addEventListener(`blur`,this._blurHandler),this._colorPicker.addEventListener(`input`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorTextInput&&(this._colorTextInput.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener(`change`,()=>{let e=this._colorPicker?.value||`#000000`;this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement(`input`),this._colorTextInput.type=`text`,this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=i||`#000000`,this._colorTextInput.pattern=`^#[0-9A-Fa-f]{6}$`,this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener(`input`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)&&(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener(`blur`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)?(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this._colorPicker?.value||`#000000`},bubbles:!0,cancelable:!0}))}));let e=u||`#000000`;if(this._colorPicker&&this._colorPicker.value!==e&&(this._colorPicker.value=e),this._colorTextInput&&this._colorTextInput.value!==e&&(this._colorTextInput.value=e),this._colorPicker&&(this._colorPicker.disabled=a),this._colorPickerWrapper&&(a?this._colorPickerWrapper.classList.add(`is-disabled`):this._colorPickerWrapper.classList.remove(`is-disabled`)),this._colorTextInput&&(this._colorTextInput.disabled=a,this._colorTextInput.readOnly=o,this._colorTextInput.required=s),this._colorTextInput){let e=this._colorTextInput;c?e.id=c:e.removeAttribute(`id`),l?e.name=l:e.removeAttribute(`name`),e.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._element=e}this._renderErrorState();let t=this.querySelector(`.mint-input-label-container`);if(p||m){t||(t=document.createElement(`div`),t.className=`mint-input-label-container`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(t,this._wrapper):this.insertBefore(t,this.firstChild));let e=t.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label`,t.insertBefore(e,t.firstChild)),e.textContent=p;let n=c||this._colorTextInput?.id;if(n)e.setAttribute(`for`,n);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._colorTextInput&&(this._colorTextInput.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`is-disabled`):e.classList.remove(`is-disabled`)}else e&&e.remove();let n=t.querySelector(`.mint-input-info`);m?(n||(n=document.createElement(`span`),n.className=`mint-input-info`,t.appendChild(n)),n.textContent=m,a?n.classList.add(`is-disabled`):n.classList.remove(`is-disabled`)):n&&n.remove()}else t&&t.remove();return}if(this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`mint-input-wrapper`,this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),f&&!t?this._icon?this._icon.setAttribute(`name`,f):(this._icon=document.createElement(`mint-icon`),this._icon.setAttribute(`name`,f),this._icon.className=`mint-input-icon`,this._wrapper.appendChild(this._icon)):this._icon&&=(this._icon.remove(),null),this._syncSlotAdornments(t,!!f),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement(`div`),this._numberSpinnerContainer.className=`mint-input-spinner`,this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement(`button`),this._numberIncrementButton.type=`button`,this._numberIncrementButton.className=`mint-input-spinner-button`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`caret-up`),e.className=`mint-input-spinner-icon`,this._numberIncrementButton.appendChild(e),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement(`button`),this._numberDecrementButton.type=`button`,this._numberDecrementButton.className=`mint-input-spinner-button`;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`caret-down`),t.className=`mint-input-spinner-icon`,this._numberDecrementButton.appendChild(t),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e+t;r!==void 0&&i>r&&(i=r),n!==void 0&&i<n&&(i=n),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}}),this._numberDecrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e-t;n!==void 0&&i<n&&(i=n),r!==void 0&&i>r&&(i=r),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=a||o),this._numberDecrementButton&&(this._numberDecrementButton.disabled=a||o)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&=(this._input.remove(),null),this._textarea||(this._textarea=document.createElement(`textarea`),this._element=this._textarea,this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=i,this._textarea.disabled=a,this._textarea.readOnly=o,this._textarea.required=s,this._textarea.rows=d,this._textarea.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),u!==this._textarea.value&&(this._textarea.value=u),c?this._textarea.id=c:this._textarea.removeAttribute(`id`),l?this._textarea.name=l:this._textarea.removeAttribute(`name`),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._textarea.value&&(this._textarea.value=e.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&=(this._textarea.remove(),null),this._input||(this._input=document.createElement(`input`),this._element=this._input,this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=i,this._input.disabled=a,this._input.readOnly=o,this._input.required=s,this._input.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),n?(this._input.inputMode=`decimal`,this._input.pattern=`[0-9]*\\.?[0-9]*`):(this._input.removeAttribute(`inputmode`),this._input.removeAttribute(`pattern`)),u!==this._input.value&&(this._input.value=u),c?this._input.id=c:this._input.removeAttribute(`id`),l?this._input.name=l:this._input.removeAttribute(`name`),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._input.value&&(this._input.value=e.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(`.mint-input-label-container`);if(p||m){g||(g=document.createElement(`div`),g.className=`mint-input-label-container`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let e=g.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label`,g.insertBefore(e,g.firstChild)),e.textContent=p;let t=c||this._element?.id||this._colorTextInput?.id||this._input?.id||this._textarea?.id;if(t)e.setAttribute(`for`,t);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=t:this._colorTextInput?this._colorTextInput.id=t:this._input?this._input.id=t:this._textarea&&(this._textarea.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`is-disabled`):e.classList.remove(`is-disabled`)}else e&&e.remove();let t=g.querySelector(`.mint-input-info`);m?(t||(t=document.createElement(`span`),t.className=`mint-input-info`,g.appendChild(t)),t.textContent=m,a?t.classList.add(`is-disabled`):t.classList.remove(`is-disabled`)):t&&t.remove()}else g&&g.remove();this._syncSlotAdornments(t,!!f),this._renderErrorState(),this._syncControlAccessibility(),this._renderSkeleton(h)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-input-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-input-error`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_syncControlAccessibility(){let e=this._element;if(!e)return;this._a11yId||=this.getId()||`mint-input-${Math.random().toString(36).slice(2,10)}`;let t=this.getAttribute(`aria-label`)?.trim(),n=!!this.querySelector(`.mint-input-label`);t?e.setAttribute(`aria-label`,t):!n&&this.getAttribute(`placeholder`)?.trim()?e.setAttribute(`aria-label`,this.getAttribute(`placeholder`).trim()):e.removeAttribute(`aria-label`);let r=this.querySelector(`.mint-input-info`),i=this.querySelector(`.mint-input-error`),a=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean);r&&(r.id=`${this._a11yId}-info`,a.push(r.id)),i&&(i.id=`${this._a11yId}-error`,a.push(i.id)),e.setAttribute(`aria-invalid`,String(this.hasError())),a.length?e.setAttribute(`aria-describedby`,Array.from(new Set(a)).join(` `)):e.removeAttribute(`aria-describedby`);let o=this.getAttribute(`aria-labelledby`)?.trim();o?e.setAttribute(`aria-labelledby`,o):e.removeAttribute(`aria-labelledby`)}setupEventListeners(){this._element&&(this._element.addEventListener(`input`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`);let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener(`blur`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&=(this._colorPicker.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._colorPicker.removeEventListener(`blur`,this._blurHandler),null))}focus(){this._isColor()&&this._colorTextInput?this._colorTextInput.focus():this._element?.focus()}blur(){this._isColor()&&this._colorTextInput?this._colorTextInput.blur():this._element?.blur()}_renderSkeleton(e){this.classList.toggle(`is-loading`,e);let t=this.querySelector(`.mint-input-skeleton-container`),n=this._wrapper||this.querySelector(`.mint-input-wrapper`);if(e){t||(t=document.createElement(`div`),t.className=`mint-input-skeleton-container`,n?(n.classList.add(`mint-input-positioned`),n.appendChild(t)):(this.classList.add(`mint-input-positioned`),this.appendChild(t)));let e=t.querySelector(`.mint-input-skeleton`);e||(e=document.createElement(`div`),e.className=`mint-input-skeleton`,t.appendChild(e)),e.parentElement||t.appendChild(e)}}};customElements.get(`mint-input`)||a(`mint-input`,hn);var gn=class extends HTMLElement{static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`format`,`min`,`max`,`range`,`shortcuts`,`display-format`,`error`,`error-message`,`loading`,`selection-mode`,`week-start-day`,`mode`,`disabled-dates`]}constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode=`calendar`,this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._hoveredDate=null,this._isHandlingClick=!1,this._touchStartDate=null,this._touchStartElement=null,this._isTouchActive=!1,this._resizeObserver=null,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null,this._a11yId=`mint-date-picker-${Math.random().toString(36).slice(2,10)}`}connectedCallback(){this.classList.add(`mint-date-picker`),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._removeFocusTrap(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){let e=this.hasError(),t=this.getErrorMessage();this._applyErrorVisuals(e,t,this.isDisabled());return}if(e===`loading`){this.render();return}if(e===`mode`||e===`format`){let e=this.getMode();e===`month`?this._viewMode=`month`:e===`year`?this._viewMode=`year`:this._viewMode=`calendar`,this._popover&&this._calendarContainer&&this._buildCalendar()}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?(this.setAttribute(`value`,e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute(`value`),this._textInput&&(this._textInput.value=``),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}getFormat(){return this.getAttribute(`format`)||`mm/dd/yyyy`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isRange(){return this.getAttribute(`range`)===`true`}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getMin(){return this.getAttribute(`min`)||``}getMax(){return this.getAttribute(`max`)||``}getDisabledDates(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{let t=JSON.parse(e),n=this.getFormat();return t.map(e=>this._parseDateString(e,n)).filter(e=>e!==null)}catch{return[]}}getDisabledDateStrings(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{return JSON.parse(e)}catch{return[]}}disableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=this._parseDateString(e,t);if(r){let e=this._formatDate(r,t);n.includes(e)||i.push(e)}}if(i.length>0){let e=[...n,...i];this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}enableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);i.push(e)}}if(i.length>0){let e=n.filter(e=>!i.includes(e));e.length===0?this.removeAttribute(`disabled-dates`):this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}getSelectionMode(){let e=this.getAttribute(`selection-mode`);return e===`week`||e===`month`?e:`day`}getMode(){let e=this.getAttribute(`mode`);if(e===`month`||e===`year`)return e;let t=this.getFormat().toLowerCase(),n=t.includes(`d`),r=t.includes(`m`);return!n&&!r?`year`:!n&&r?`month`:`default`}getWeekStartDay(){return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[this.getAttribute(`week-start-day`)?.toLowerCase()||`sunday`]??0}getDisplayFormat(){return this.getAttribute(`display-format`)||`F j, Y`}getShortcuts(){let e=this.getAttribute(`shortcuts`);if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>({label:e.label,action:this._createShortcutAction(e.action)}))}catch{let t=e.trim();if(t&&typeof window[t]==`function`){let e=window[t]();if(Array.isArray(e))return e.map(e=>({label:e.label,action:typeof e.action==`function`?e.action:this._createShortcutAction(e.action)}))}}return[]}_createShortcutAction(e){return typeof e==`function`?e:typeof e==`string`&&typeof window[e]==`function`?window[e]:()=>null}_getDefaultShortcuts(){let e=[{label:`Today`,action:()=>new Date}];return this._isRange&&e.push({label:`This Week`,action:()=>{let e=new Date,t=e.getDay(),n=new Date(e);n.setDate(e.getDate()-t),n.setHours(0,0,0,0);let r=new Date(n);return r.setDate(n.getDate()+6),r.setHours(23,59,59,999),{start:n,end:r}}},{label:`This Month`,action:()=>{let e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return n.setHours(23,59,59,999),{start:t,end:n}}}),e}_getFormatTokens(e){let t=[],n=0,r=e.toLowerCase();for(;n<r.length;){let i=r[n];if(i===`d`||i===`m`||i===`y`){let e=1,a=n+1;for(;a<r.length&&r[a]===i;)e++,a++;t.push({type:`part`,part:i,len:e}),n=a}else t.push({type:`sep`,value:e[n]}),n++}return t}_createPartInput(e,t,n,r,i){let a=document.createElement(`input`);return a.type=`text`,a.inputMode=`numeric`,a.pattern=`\\d*`,a.maxLength=e,a.placeholder=t,a.className=`mint-date-picker-part-input`,a.disabled=n||r,a.readOnly=r,a.required=i,e===4?a.classList.add(`is-year-part`):e===2&&a.classList.add(`is-short-part`),a}_buildValueFromParts(e,t){let n=0;return t.map(t=>{if(t.type===`sep`)return t.value;let r=e[n]?.value||``;return n++,r}).join(``)}_applyDateToParts(e,t,n,r){if(!t.length)return;if(!e){t.forEach(e=>e.value=``);return}let i=this._formatDate(e,r),a=0,o=0;n.forEach(e=>{if(e.type===`sep`)a+=e.value.length;else{let n=i.substr(a,e.len);t[o]&&(t[o].value=n),o++,a+=e.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;let e=this.getFormat(),t=this._getFormatTokens(e),n=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){let e=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=e?`${n} - ${e}`:n}else this._hiddenInput.value=n}_focusNext(e,t){if(t+1<e.length){let n=e[t+1];n.focus(),n.setSelectionRange(0,n.value.length)}}_focusPrev(e,t){if(t-1>=0){let n=e[t-1];n.focus(),n.setSelectionRange(n.value.length,n.value.length)}}_attachPartInputHandlers(e,t,n){e.forEach((t,n)=>{let r=t.maxLength||2;t.addEventListener(`input`,()=>{t.value=t.value.replace(/\D/g,``).slice(0,r),t.value.length>=r&&this._focusNext(e,n),this._syncHiddenInput()}),t.addEventListener(`keydown`,r=>{r.key===`Backspace`&&t.selectionStart===0&&t.selectionEnd===0&&this._focusPrev(e,n),r.key===`ArrowLeft`&&t.selectionStart===0&&t.selectionEnd===0&&(this._focusPrev(e,n),r.preventDefault()),r.key===`ArrowRight`&&t.selectionStart===t.value.length&&t.selectionEnd===t.value.length&&(this._focusNext(e,n),r.preventDefault())}),t.addEventListener(`blur`,e=>{this._syncHiddenInput();let t=e.relatedTarget,n=t&&(this._startPartInputs.includes(t)||this._endPartInputs.includes(t));setTimeout(()=>{if(!(this._startPartInputs.some(e=>e===document.activeElement)||this._endPartInputs.some(e=>e===document.activeElement))&&(n||this._handleBlur(this._hiddenInput?.value||``),this._exitInputMode(),!n&&this._hiddenInput)){let t=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:e.relatedTarget});this._hiddenInput.dispatchEvent(t)}},0)})})}_splitRangeInput(e,t){let n=e.split(/\s*-\s*/);return n.length>=2?[n[0],n.slice(1).join(`-`)]:[e]}_parseValue(e){let t=this.getFormat(),n=this._getFormatTokens(t),r=this.getSelectionMode();if(this._isRange||r===`week`||r===`month`){let[r,i]=this._splitRangeInput(e,t),a=r?this._parseDateString(r,t):null,o=i?this._parseDateString(i,t):null;if(a&&o){let[e,t]=a<=o?[a,o]:[o,a];this._selectedStartDate=e,this._selectedEndDate=t,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else a&&(this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,n,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,n,t)}else{let r=this._parseDateString(e,t);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,n,t)):this._applyDateToParts(null,this._startPartInputs,n,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){let n=/[\/\-\.\s]+/;if(n.test(e)){let r=e.split(n).filter(e=>e.length>0),i=t.split(/[\/\-\.\s]+/).filter(e=>e.length>0);if(r.length===i.length){let e=0,t=0,n=0;for(let a=0;a<i.length;a++){let o=i[a].toLowerCase(),s=r[a];if(o.includes(`d`))e=parseInt(s,10);else if(o.includes(`m`))t=parseInt(s,10)-1;else if(o.includes(`y`)){let e=parseInt(s,10),t=o.length,r=s.length;(r===2&&t===4||r===2&&t===2)&&(e=Math.floor(new Date().getFullYear()/100)*100+e),n=e}}let a=i.some(e=>e.toLowerCase().includes(`d`)),o=i.some(e=>e.toLowerCase().includes(`m`));if(a||(e=1),o||(t=0),t>=0&&t<=11&&n){let r=new Date(n,t,e);if(!isNaN(r.getTime()))return a&&r.getDate()!==e||r.getMonth()!==t||r.getFullYear()!==n?null:r}}}let r=e.replace(/[\/\-\.]/g,``),i=t.replace(/[\/\-\.]/g,``).toLowerCase(),a=i.indexOf(`d`),o=i.indexOf(`m`),s=i.indexOf(`y`),c=[{char:`d`,index:a},{char:`m`,index:o},{char:`y`,index:s}].sort((e,t)=>e.index-t.index),l=0,u=0,d=0,f=0;i.length,r.length;for(let e of c)if(e.char===`d`){let e=i.lastIndexOf(`d`)-i.indexOf(`d`)+1,t=r.substr(f,e);if(t.length===0)return null;l=parseInt(t,10),f+=t.length}else if(e.char===`m`){let e=i.lastIndexOf(`m`)-i.indexOf(`m`)+1,t=r.substr(f,e);if(t.length===0)return null;u=parseInt(t,10)-1,f+=t.length}else if(e.char===`y`){let e=i.lastIndexOf(`y`)-i.indexOf(`y`)+1,t=r.substr(f),n=Math.min(e,t.length),a=t.substr(0,n);if(a.length===0)return null;let o=parseInt(a,10);(n===2&&e===4||n===2&&e===2)&&(o=Math.floor(new Date().getFullYear()/100)*100+o),d=o,f+=n}let p=t.toLowerCase(),m=p.includes(`d`),h=p.includes(`m`);if(m||(l=1),h||(u=0),u<0||u>11||!d)return null;let g=new Date(d,u,l);return isNaN(g.getTime())||m&&g.getDate()!==l||g.getMonth()!==u||g.getFullYear()!==d?null:g}_formatDate(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=t.toLowerCase(),o=t;return a.includes(`dd`)?o=o.replace(/dd/gi,String(n).padStart(2,`0`)):a.includes(`d`)&&(o=o.replace(/d/gi,String(n))),a.includes(`mm`)?o=o.replace(/mm/gi,String(r).padStart(2,`0`)):a.includes(`m`)&&(o=o.replace(/m/gi,String(r))),a.includes(`yyyy`)?o=o.replace(/yyyy/gi,String(i)):a.includes(`yy`)&&(o=o.replace(/yy/gi,String(i).substr(2))),o}_formatDatePhp(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=(e,t=2)=>e.toString().padStart(t,`0`),u=e=>{let t=e%10,n=e%100;return t===1&&n!==11?`st`:t===2&&n!==12?`nd`:t===3&&n!==13?`rd`:`th`},d=``;for(let f=0;f<t.length;f++){let p=t[f];if(p===`\\`&&f+1<t.length){d+=t[f+1],f++;continue}switch(p){case`Y`:d+=i.toString();break;case`y`:d+=i.toString().slice(-2);break;case`m`:d+=l(r);break;case`n`:d+=r.toString();break;case`M`:d+=c[r-1];break;case`F`:d+=s[r-1];break;case`d`:d+=l(n);break;case`j`:d+=n.toString();break;case`D`:d+=o[e.getDay()];break;case`l`:d+=a[e.getDay()];break;case`S`:d+=u(n);break;default:d+=p;break}}return d}_validateDateString(e,t){let n=this._parseDateString(e,t);return n!==null&&!isNaN(n.getTime())}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getValue(),i=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),s=this.getId()||this._a11yId,c=this.getName(),l=this.getFormat(),u=this.hasError(),d=this.getErrorMessage(),f=this.getSelectionMode();this._isRange=this.isRange()||f===`week`||f===`month`,this._input||(this._input=document.createElement(`div`),this._input.className=`mint-date-picker-field`,this.appendChild(this._input));let p=this.querySelector(`.mint-date-picker-label-container`);if(t||n){p||(p=document.createElement(`div`),p.className=`mint-date-picker-label-container`,this.contains(this._input)?this.insertBefore(p,this._input):this.appendChild(p));let e=p.querySelector(`.mint-date-picker-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-date-picker-label`,p.insertBefore(e,p.firstChild)),e.textContent=t,s&&this._textInput&&e.setAttribute(`for`,s)):e&&e.remove();let r=p.querySelector(`.mint-date-picker-info`);n?(r||(r=document.createElement(`span`),r.className=`mint-date-picker-info`,p.appendChild(r)),r.textContent=n):r&&r.remove()}else p&&p.remove();this._hiddenInput||(this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.value=r||``,this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),s&&(this._hiddenInput.id=s),c&&(this._hiddenInput.name=c),this._hiddenInput.value=r||``,this._hiddenInput.setAttribute(`aria-invalid`,u?`true`:`false`);let m=this._input.querySelector(`.mint-date-fields`);m||(m=document.createElement(`div`),this._input.appendChild(m)),this._fieldsContainer=m,this._applyErrorVisuals(u,d,i),m.innerHTML=``,this._displayEl=document.createElement(`div`),this._displayEl.className=`mint-date-picker-display${a?` is-readonly`:``}`,this._displayEl.tabIndex=i||a?-1:0,this._displayEl.setAttribute(`role`,`button`),this._displayEl.setAttribute(`aria-label`,`${this.getLabel()||`Date`}: ${r||`Select date`}`),this._displayEl.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._displayEl.addEventListener(`keydown`,e=>{i||a||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement(`div`),this._isRange,this._inputsWrapperEl.className=`mint-date-picker-inputs`;let h=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];let g=e=>{let t=document.createDocumentFragment();return h.forEach(n=>{if(n.type===`sep`){let e=document.createElement(`span`);e.textContent=n.value,e.className=`mint-date-picker-separator`,t.appendChild(e)}else{let r=n.part===`d`?`dd`:n.part===`m`?`mm`:n.len===2?`yy`:`yyyy`,s=this._createPartInput(n.len,r,i,a,o),c=n.part===`d`?`day`:n.part===`m`?`month`:`year`,l=this.getLabel()||`Date`;s.setAttribute(`aria-label`,`${e===`end`?`End ${l.toLowerCase()}`:l} ${c}`),e===`start`?this._startPartInputs.push(s):this._endPartInputs.push(s),t.appendChild(s)}}),t};if(this._isRange){let e=document.createElement(`div`);e.className=`mint-date-picker-range-part`,e.appendChild(g(`start`)),this._inputsWrapperEl.appendChild(e);let t=document.createElement(`span`);t.textContent=` - `,t.className=`mint-date-picker-range-dash`,this._inputsWrapperEl.appendChild(t);let n=document.createElement(`div`);n.className=`mint-date-picker-range-part`,n.appendChild(g(`end`)),this._inputsWrapperEl.appendChild(n)}else this._inputsWrapperEl.appendChild(g(`start`));let _=document.createElement(`div`);if(_.className=`mint-date-picker-stacked`,this.classList.toggle(`is-input-mode`,this._isInputMode),_.appendChild(this._displayEl),_.appendChild(this._inputsWrapperEl),m.appendChild(_),this._isRange&&this._inputsWrapperEl&&this._setupContainerObserver(),m.addEventListener(`click`,()=>{this._isInputMode||i||a||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,h,m),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,h,m),this._parseValue(r),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=i||a,!i&&!a?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement(`button`),this._iconButton.type=`button`,this._iconButton.tabIndex=0,this._iconButton.className=`mint-date-picker-icon-button`,this._iconButton.setAttribute(`aria-label`,`Open calendar`),this._iconButton.setAttribute(`aria-haspopup`,`dialog`),this._iconButton.setAttribute(`aria-expanded`,`false`);let e=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`calendar`),t.className=`mint-date-picker-icon`,this._iconButton.appendChild(t),this._input.prepend(this._iconButton),this._iconButton.disabled=i||a}this._renderErrorState(u,d),this._syncDateFieldDescriptions(),this._renderSkeleton(e)}_renderErrorState(e,t){let n=this.querySelector(`.mint-date-picker-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-date-picker-error`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_syncDateFieldDescriptions(){let e=Array.from(this.querySelectorAll(`.mint-date-fields input`));if(!e.length)return;let t=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),n=this.querySelector(`.mint-date-picker-info`),r=this.querySelector(`.mint-date-picker-error`),i=this.getAttribute(`id`)||this._a11yId;n&&(n.id=`${i}-info`,t.push(n.id)),r&&(r.id=`${i}-error`,t.push(r.id));let a=Array.from(new Set(t)).join(` `);e.forEach(e=>{e.setAttribute(`aria-invalid`,String(this._hiddenInput?.getAttribute(`aria-invalid`)===`true`)),a?e.setAttribute(`aria-describedby`,a):e.removeAttribute(`aria-describedby`)})}_applyErrorVisuals(e,t,n){if(this._renderErrorState(e,t),this._fieldsContainer){let t=this._getFieldContainerClass(e,n);this._fieldsContainer.className=t}this._hiddenInput&&this._hiddenInput.setAttribute(`aria-invalid`,e?`true`:`false`),this._syncDateFieldDescriptions()}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(``),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,``,this.isDisabled())},e.addEventListener(`reset`,this._resetHandler))}_clearPartInputs(e){e.forEach(e=>{e.value=``})}_getFieldContainerClass(e,t){return`mint-date-fields${e?` has-error`:``}${t?` is-disabled`:``}`}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){let t=this.getFormat(),n=this.getSelectionMode(),r=this._isRange||n===`week`||n===`month`;if(!e){this.setValue(``),this._updateDisplayText();return}if(r){let[n,r]=this._splitRangeInput(e,t),i=n?this._parseDateString(n,t):null,a=r?this._parseDateString(r,t):null;if(i&&a){let[e,n]=i<=a?[i,a]:[a,i],r=`${this._formatDate(e,t)} - ${this._formatDate(n,t)}`;this.setValue(r),this._applyDateToParts(e,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(n,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=e,this._selectedEndDate=n,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else if(i){let e=this._formatDate(i,t);this.setValue(e),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);this.setValue(e),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}let t=this._iconButton.id;t&&this._iconButton.isConnected&&document.getElementById(t)?this._createPopover(t):e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(e){if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(this._popover){if(this._popover.getAttribute(`trigger-id`)!==e){this._popover.setAttribute(`trigger-id`,e);let t=this._popover;typeof t._setupTrigger==`function`&&t._setupTrigger()}this._buildCalendar()}else{this._popover=document.createElement(`mint-popover`),this._popover.classList.add(`mint-date-picker-popover`),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`);let t=this.closest(`mint-modal`),n=this.closest(`mint-off-canvas`);t||n?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute(`trigger-id`,e),this._popoverObserver||(this._popoverObserver=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`open`)if(this._popover?.hasAttribute(`open`))requestAnimationFrame(()=>{this._buildCalendar();let e=this._popover;typeof e.render==`function`&&e.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{this._iconButton?.focus()}),this._viewMode=`calendar`,this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{let e=new Date;this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{let e=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:null});this._hiddenInput?.dispatchEvent(e)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]})),requestAnimationFrame(()=>{this._buildCalendar()}))})})}}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement(`div`),this._calendarContainer.className=`mint-date-calendar`;let e=this.getMode();e===`month`&&this._viewMode===`calendar`?this._viewMode=`month`:e===`year`&&this._viewMode===`calendar`?this._viewMode=`year`:e===`default`&&this._viewMode!==`month`&&this._viewMode!==`year`&&(this._viewMode=`calendar`),this._viewMode===`calendar`?this._buildCalendarView():this._viewMode===`month`?this._buildMonthView():this._viewMode===`year`&&this._buildYearView(),this._popover.replaceChildren(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;let e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),n=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],r=this.getWeekStartDay(),i=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],a=[...i.slice(r),...i.slice(0,r)],o=this.getShortcuts(),s=o.length>0;this._calendarContainer.className=`mint-date-calendar${s?` has-shortcuts`:``}`;let c=document.createElement(`div`);c.className=`mint-date-calendar-layout`;let l=document.createElement(`div`);l.className=`mint-date-calendar-content`;let u=document.createElement(`div`);u.className=`mint-date-calendar-header`;let d=document.createElement(`button`);d.type=`button`,d.tabIndex=0,d.className=`mint-date-calendar-nav-button`,d.setAttribute(`aria-label`,`Previous month`),d.setAttribute(`data-keep-popover-open`,`true`);let f=document.createElement(`mint-icon`);f.setAttribute(`name`,`caret-left`),f.className=`mint-date-calendar-icon`,d.appendChild(f),d.addEventListener(`click`,()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}),u.appendChild(d);let p=document.createElement(`div`);p.className=`mint-date-calendar-month-year`;let m=document.createElement(`button`);m.type=`button`,m.tabIndex=0,m.className=`mint-date-calendar-title-button`,m.setAttribute(`data-keep-popover-open`,`true`),m.textContent=n[this._currentMonth],m.setAttribute(`aria-label`,`Choose month, ${n[this._currentMonth]}`);let h=()=>{let e=this.getMode();e!==`month`&&e!==`year`&&(this._viewMode=`month`,this._buildCalendar())};m.addEventListener(`click`,h),m.addEventListener(`touchend`,e=>{e.preventDefault(),h()},{passive:!1}),p.appendChild(m);let g=document.createElement(`button`);g.type=`button`,g.tabIndex=0,g.className=`mint-date-calendar-title-button`,g.setAttribute(`data-keep-popover-open`,`true`),g.textContent=String(this._currentYear),g.setAttribute(`aria-label`,`Choose year, ${this._currentYear}`),g.addEventListener(`click`,()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())}),p.appendChild(g),u.appendChild(p);let _=document.createElement(`button`);_.type=`button`,_.tabIndex=0,_.className=`mint-date-calendar-nav-button`,_.setAttribute(`aria-label`,`Next month`),_.setAttribute(`data-keep-popover-open`,`true`);let v=document.createElement(`mint-icon`);v.setAttribute(`name`,`caret-right`),v.className=`mint-date-calendar-icon`,_.appendChild(v);let y=()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};_.addEventListener(`click`,y),_.addEventListener(`touchend`,e=>{e.preventDefault(),y()},{passive:!1}),u.appendChild(_);let b=document.createElement(`div`);b.className=`mint-date-calendar-day-names`,a.forEach(e=>{let t=document.createElement(`div`);t.className=`mint-date-calendar-day-name`,t.textContent=e,b.appendChild(t)});let x=document.createElement(`div`);x.className=`mint-date-calendar-grid`,x.setAttribute(`role`,`group`),x.setAttribute(`aria-label`,`${n[this._currentMonth]} ${this._currentYear}`);let S=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,C=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;this.getDisabledDates();let w=this._currentMonth===0?11:this._currentMonth-1,T=this._currentMonth===0?this._currentYear-1:this._currentYear,E=this._getDaysInMonth(w,T),D=this._currentMonth===11?0:this._currentMonth+1,O=this._currentMonth===11?this._currentYear+1:this._currentYear,k=t+e,A=Math.ceil(k/7)*7-k,j=(e,t,n)=>{let r=this._isToday(e),i=this._isDateSelected(e),a=this._isDateInRange(e),o=S&&e<S||C&&e>C||this._isDateDisabled(e),s=`is-fully-rounded`,c=this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate,l=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._selectedStartDate:c&&this._hoveredDate?this._hoveredDate:null,u=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._hoveredDate:c&&this._selectedStartDate?this._selectedStartDate:null,d=l!==null&&this._isSameDate(e,l),f=u!==null&&this._isSameDate(e,u),p=this._hoveredDate!==null&&this._isSameDate(e,this._hoveredDate),m=c&&this._hoveredDate&&this._selectedStartDate?!this._rangeIncludesDisabledDates(this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate):!1;if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){let t=this._isSameDate(e,this._selectedStartDate),n=this._isSameDate(e,this._selectedEndDate);t&&n?s=`is-fully-rounded`:t?s=`is-range-start`:n?s=`is-range-end`:a&&(s=`is-range-middle`)}else c&&(d||f)&&m?d&&f?s=`is-fully-rounded`:d?s=`is-range-start`:f&&(s=`is-range-end`):i&&!this._isRange||i&&this._isRange&&!this._selectedEndDate?s=`is-fully-rounded`:a&&c&&m&&(s=`is-range-middle`);let h=document.createElement(`button`);h.type=`button`,h.disabled=!!o,h.tabIndex=o?-1:0;let g=[`mint-date-picker-day`,s],_=i||c&&p&&m;return n||g.push(`is-outside-month`),_&&g.push(`is-selected`),a&&!_&&g.push(`is-in-range`),r&&!_&&g.push(`is-today`),o&&g.push(`is-disabled`),h.className=g.join(` `),h.textContent=t.toString(),h.setAttribute(`aria-label`,e.toLocaleDateString(void 0,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`})),h.setAttribute(`aria-pressed`,String(i)),r&&h.setAttribute(`aria-current`,`date`),o||(h.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),this._handleDateClick(e)}),h.addEventListener(`touchstart`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive=!0,this._touchStartDate=e,this._touchStartElement=h,h.classList.add(`is-touch-active`)},{passive:!1}),h.addEventListener(`touchend`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive&&this._touchStartDate&&this._isSameDate(this._touchStartDate,e)&&this._handleDateClick(e),this._touchStartElement&&this._touchStartElement.classList.remove(`is-touch-active`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null},{passive:!1}),h.addEventListener(`touchcancel`,()=>{this._touchStartElement&&this._touchStartElement.classList.remove(`is-touch-active`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null}),this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&!o&&(h.addEventListener(`mouseenter`,()=>{this._isHandlingClick||this._isTouchActive||this._isDateDisabled(e)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,e))&&(this._hoveredDate=e,this._buildCalendar())}),h.addEventListener(`touchmove`,e=>{if(!this._isTouchActive||!this._touchStartDate)return;let t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);for(;n&&!n.classList.contains(`mint-date-picker-day`);)n=n.parentElement;if(n&&n!==h){let e=n.getAttribute(`data-date`);if(e){let t=new Date(e);this._isDateDisabled(t)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,t))&&(this._hoveredDate=t,this._buildCalendar())}}},{passive:!0}))),h};for(let e=t-1;e>=0;e--){let t=E-e,n=j(new Date(T,w,t),t,!1);x.appendChild(n)}for(let t=1;t<=e;t++){let e=j(new Date(this._currentYear,this._currentMonth,t),t,!0);x.appendChild(e)}for(let e=1;e<=A;e++){let t=j(new Date(O,D,e),e,!1);x.appendChild(t)}if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&(x.addEventListener(`mouseleave`,()=>{this._isTouchActive||(this._hoveredDate=null,this._buildCalendar())}),x.addEventListener(`touchend`,e=>{let t=e.changedTouches[0],n=document.elementFromPoint(t.clientX,t.clientY);n&&!x.contains(n)&&(this._hoveredDate=null,this._buildCalendar())},{passive:!0})),s){let e=document.createElement(`div`);e.className=`mint-date-shortcuts`;let t=document.createElement(`div`);t.className=`mint-date-shortcuts-wrapper`;let n=document.createElement(`div`);n.className=`mint-date-shortcuts-row`;let r=document.createElement(`div`);r.className=`mint-date-shortcuts-fade is-horizontal is-left`,t.appendChild(r);let i=document.createElement(`div`);i.className=`mint-date-shortcuts-fade is-horizontal is-right is-visible`,t.appendChild(i);let a=document.createElement(`div`);a.className=`mint-date-shortcuts-fade is-vertical is-top`,t.appendChild(a);let s=document.createElement(`div`);s.className=`mint-date-shortcuts-fade is-vertical is-bottom is-visible`,t.appendChild(s);let l=()=>{if(window.innerWidth>=768){let e=n.scrollTop,t=n.scrollHeight,o=n.clientHeight;e>0?a.classList.add(`is-visible`):a.classList.remove(`is-visible`),e+o<t-1?s.classList.add(`is-visible`):s.classList.remove(`is-visible`),r.classList.remove(`is-visible`),i.classList.remove(`is-visible`)}else{let e=n.scrollLeft,t=n.scrollWidth,o=n.clientWidth;e>0?r.classList.add(`is-visible`):r.classList.remove(`is-visible`),e+o<t-1?i.classList.add(`is-visible`):i.classList.remove(`is-visible`),a.classList.remove(`is-visible`),s.classList.remove(`is-visible`)}};n.addEventListener(`scroll`,l),window.addEventListener(`resize`,l),setTimeout(l,0),o.forEach(e=>{let t=document.createElement(`button`);t.type=`button`,t.tabIndex=0,t.className=`mint-date-shortcut-button`,t.textContent=e.label;let r=()=>{let t=e.action();if(t){if(this._isRange&&`start`in t&&`end`in t){this._selectedStartDate=t.start,this._selectedEndDate=t.end;let e=this.getFormat(),n=`${this._formatDate(t.start,e)} - ${this._formatDate(t.end,e)}`;this.setValue(n),this._currentMonth=t.start.getMonth(),this._currentYear=t.start.getFullYear()}else if(t instanceof Date){this._selectedStartDate=t,this._selectedEndDate=null;let e=this.getFormat(),n=this._formatDate(t,e);this.setValue(n),this._currentMonth=t.getMonth(),this._currentYear=t.getFullYear()}this._buildCalendar(),this._popover&&typeof this._popover.close==`function`&&this._popover.close(),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0}))}};t.addEventListener(`click`,r),t.addEventListener(`touchend`,e=>{e.preventDefault(),r()},{passive:!1}),n.appendChild(t)}),t.appendChild(n),e.appendChild(t),c.appendChild(e)}l.appendChild(u),l.appendChild(b),l.appendChild(x),c.appendChild(l),this._calendarContainer.appendChild(c)}_buildMonthView(){if(!this._calendarContainer)return;let e=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],t=document.createElement(`div`);t.className=`mint-date-calendar-header`;let n=document.createElement(`button`);n.type=`button`,n.tabIndex=0,n.className=`mint-date-calendar-nav-button`,n.setAttribute(`data-keep-popover-open`,`true`);let r=document.createElement(`mint-icon`);r.setAttribute(`name`,`caret-left`),r.className=`mint-date-calendar-icon`,n.appendChild(r);let i=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};n.addEventListener(`click`,i),n.addEventListener(`touchend`,e=>{e.preventDefault(),i()},{passive:!1}),t.appendChild(n);let a=document.createElement(`button`);a.type=`button`,a.tabIndex=0,a.className=`mint-date-calendar-title-button`,a.setAttribute(`data-keep-popover-open`,`true`),a.textContent=String(this._currentYear);let o=()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())};a.addEventListener(`click`,o),a.addEventListener(`touchend`,e=>{e.preventDefault(),o()},{passive:!1}),t.appendChild(a);let s=document.createElement(`button`);s.type=`button`,s.tabIndex=0,s.className=`mint-date-calendar-nav-button`,s.setAttribute(`data-keep-popover-open`,`true`);let c=document.createElement(`mint-icon`);c.setAttribute(`name`,`caret-right`),c.className=`mint-date-calendar-icon`,s.appendChild(c);let l=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};s.addEventListener(`click`,l),s.addEventListener(`touchend`,e=>{e.preventDefault(),l()},{passive:!1}),t.appendChild(s);let u=document.createElement(`div`);u.className=`mint-date-calendar-option-grid`,e.forEach((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.tabIndex=0,this.getMode()!==`month`&&n.setAttribute(`data-keep-popover-open`,`true`),n.className=`mint-date-calendar-option${this._currentMonth===t?` is-selected`:``}`,n.textContent=e;let r=()=>{if(this.getMode()===`month`){let e=new Date(this._currentYear,t,1),n=this.getFormat(),r=this._formatDate(e,n);this.setValue(r),this._selectedStartDate=e,this._selectedEndDate=null;let i=this._currentMonth,a=this._currentYear;this._currentMonth=t,this._dispatchMonthChangeEvent(i,a,this._currentMonth,this._currentYear),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this._dispatchDateChangeEvent(),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else{let e=this._currentMonth,n=this._currentYear;this._currentMonth=t,this._viewMode=`calendar`,this._buildCalendar(),this._dispatchMonthChangeEvent(e,n,this._currentMonth,this._currentYear)}};n.addEventListener(`click`,r),n.addEventListener(`touchend`,e=>{e.preventDefault(),r()},{passive:!1}),u.appendChild(n)}),this._calendarContainer.appendChild(t),this._calendarContainer.appendChild(u)}_buildYearView(){if(!this._calendarContainer)return;let e=this._currentYear-6,t=this._currentYear+6,n=document.createElement(`div`);n.className=`mint-date-calendar-header`;let r=document.createElement(`button`);r.type=`button`,r.tabIndex=0,r.className=`mint-date-calendar-nav-button`,r.setAttribute(`data-keep-popover-open`,`true`);let i=document.createElement(`mint-icon`);i.setAttribute(`name`,`caret-left`),i.className=`mint-date-calendar-icon`,r.appendChild(i);let a=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear-=12,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};r.addEventListener(`click`,a),r.addEventListener(`touchend`,e=>{e.preventDefault(),a()},{passive:!1}),n.appendChild(r);let o=document.createElement(`div`);o.className=`mint-date-calendar-title`,o.textContent=`${e} - ${t}`,n.appendChild(o);let s=document.createElement(`button`);s.type=`button`,s.tabIndex=0,s.className=`mint-date-calendar-nav-button`,s.setAttribute(`data-keep-popover-open`,`true`);let c=document.createElement(`mint-icon`);c.setAttribute(`name`,`caret-right`),c.className=`mint-date-calendar-icon`,s.appendChild(c);let l=()=>{let e=this._currentMonth,t=this._currentYear;this._currentYear+=12,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};s.addEventListener(`click`,l),s.addEventListener(`touchend`,e=>{e.preventDefault(),l()},{passive:!1}),n.appendChild(s);let u=document.createElement(`div`);u.className=`mint-date-calendar-option-grid`;for(let n=e;n<=t;n++){let e=document.createElement(`button`);e.type=`button`,e.tabIndex=0,this.getMode()!==`year`&&e.setAttribute(`data-keep-popover-open`,`true`),e.className=`mint-date-calendar-option${this._currentYear===n?` is-selected`:``}`,e.textContent=String(n),e.addEventListener(`click`,()=>{let e=this.getMode();if(e===`year`){let e=new Date(n,0,1),t=this.getFormat(),r=this._formatDate(e,t);this.setValue(r),this._selectedStartDate=e,this._selectedEndDate=null;let i=this._currentMonth,a=this._currentYear;this._currentYear=n,this._currentMonth=0,this._dispatchMonthChangeEvent(i,a,this._currentMonth,this._currentYear),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this._dispatchDateChangeEvent(),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else if(e===`month`){let e=this._currentMonth,t=this._currentYear;this._currentYear=n,this._viewMode=`month`,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}else{let e=this._currentMonth,t=this._currentYear;this._currentYear=n,this._viewMode=`calendar`,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}}),u.appendChild(e)}this._calendarContainer.appendChild(n),this._calendarContainer.appendChild(u)}_getDaysInMonth(e,t){return new Date(t,e+1,0).getDate()}_getFirstDayOfMonth(e,t){let n=this.getWeekStartDay(),r=new Date(t,e,1).getDay();return r>=n?r-n:7-(n-r)}_isToday(e){let t=new Date;return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isDateSelected(e){let t=this.getSelectionMode();return this._isRange||t===`week`||t===`month`?this._selectedStartDate&&this._selectedEndDate?this._isSameDate(e,this._selectedStartDate)||this._isSameDate(e,this._selectedEndDate):this._isRange&&this._selectedStartDate&&!this._selectedEndDate?this._isSameDate(e,this._selectedStartDate):!1:this._selectedStartDate!==null&&this._isSameDate(e,this._selectedStartDate)}_isDateInRange(e){let t=this.getSelectionMode();if((this._isRange||t===`week`||t===`month`)&&this._selectedStartDate&&this._selectedEndDate)return this._rangeIncludesDisabledDates(this._selectedStartDate,this._selectedEndDate)?!1:e>=this._selectedStartDate&&e<=this._selectedEndDate;if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate){let t=this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,n=this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate;if(this._rangeIncludesDisabledDates(t,n)){let r=this._findFirstDisabledDateInRange(t,n);return r?this._selectedStartDate<this._hoveredDate?e>=t&&e<r&&!this._isSameDate(e,t):e>r&&e<=n&&!this._isSameDate(e,n):!1}return e>=t&&e<=n&&!this._isSameDate(e,t)&&!this._isSameDate(e,n)}return!1}_rangeIncludesDisabledDates(e,t){let n=this.getDisabledDates(),r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate());return n.some(e=>{let t=new Date(e.getFullYear(),e.getMonth(),e.getDate());return t>=r&&t<=i})}_findFirstDisabledDateInRange(e,t){let n=this.getDisabledDates(),r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),a=n.map(e=>new Date(e.getFullYear(),e.getMonth(),e.getDate())).filter(e=>e>=r&&e<=i).sort((e,t)=>e.getTime()-t.getTime());return a.length>0?a[0]:null}_hasIncompleteRange(){return this._isRange&&this._selectedStartDate!==null&&this._selectedEndDate===null}_isSameDate(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isDateDisabled(e){return this.getDisabledDates().some(t=>this._isSameDate(e,t))}_dispatchMonthChangeEvent(e,t,n,r){(e!==n||t!==r)&&this.dispatchEvent(new CustomEvent(`month-change`,{detail:{month:n,year:r,oldMonth:e,oldYear:t},bubbles:!0,cancelable:!0,composed:!0}))}_dispatchDateChangeEvent(){let e=this.getFormat(),t={value:this.getValue()};this._selectedStartDate&&(t.startDate=this._selectedStartDate,t.startDateFormatted=this._formatDate(this._selectedStartDate,e)),this._selectedEndDate&&(t.endDate=this._selectedEndDate,t.endDateFormatted=this._formatDate(this._selectedEndDate,e)),this.dispatchEvent(new CustomEvent(`date-change`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}))}_setupContainerObserver(){if(this._resizeObserver&&=(this._resizeObserver.disconnect(),null),!this._inputsWrapperEl)return;let e=e=>{this._inputsWrapperEl&&(e<400?(this._inputsWrapperEl.classList.add(`is-wrapping`),this._inputsWrapperEl.classList.remove(`is-nowrap`)):(this._inputsWrapperEl.classList.remove(`is-wrapping`),this._inputsWrapperEl.classList.add(`is-nowrap`)))};e(this._inputsWrapperEl.offsetWidth||this.offsetWidth),this._resizeObserver=new ResizeObserver(t=>{for(let n of t){let t=n.contentRect.width;e(t)}}),this._resizeObserver.observe(this)}_getWeekStart(e){let t=this.getWeekStartDay(),n=e.getDay(),r;r=n>=t?n-t:7-(t-n);let i=new Date(e);return i.setDate(e.getDate()-r),i.setHours(0,0,0,0),i}_getWeekEnd(e){let t=this._getWeekStart(e),n=new Date(t);return n.setDate(t.getDate()+6),n.setHours(23,59,59,999),n}_getMonthStart(e){let t=new Date(e.getFullYear(),e.getMonth(),1);return t.setHours(0,0,0,0),t}_getMonthEnd(e){let t=new Date(e.getFullYear(),e.getMonth()+1,0);return t.setHours(23,59,59,999),t}_handleDateClick(e){this._isHandlingClick=!0;try{let t=this.getFormat(),n=this.getSelectionMode(),r,i;if(n===`week`?(r=this._getWeekStart(e),i=this._getWeekEnd(e)):n===`month`?(r=this._getMonthStart(e),i=this._getMonthEnd(e)):(r=e,i=e),this.isRange()||n===`week`||n===`month`)if(n===`week`||n===`month`){if(this._rangeIncludesDisabledDates(r,i)){this._buildCalendar();return}this._selectedStartDate=r,this._selectedEndDate=i;let e=`${this._formatDate(this._selectedStartDate,t)} - ${this._formatDate(this._selectedEndDate,t)}`;this.setValue(e),this._textInput&&(this._textInput.value=e),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else if(this._hoveredDate=null,this._selectedStartDate===null){if(this._isDateDisabled(r)){this._buildCalendar();return}this._selectedStartDate=new Date(r.getFullYear(),r.getMonth(),r.getDate()),this._selectedEndDate=null,this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear(),this._hoveredDate=null,this._buildCalendar()}else if(this._selectedEndDate===null){let n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=this._selectedStartDate?new Date(this._selectedStartDate.getFullYear(),this._selectedStartDate.getMonth(),this._selectedStartDate.getDate()):null,i,a;if(r&&n<r?(i=n,a=r):(i=r,a=n),this._rangeIncludesDisabledDates(i,a)){this._buildCalendar();return}r&&n<r?(this._selectedEndDate=r,this._selectedStartDate=n):(this._selectedEndDate=n,r&&(this._selectedStartDate=r)),this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();let o=`${this._formatDate(this._selectedStartDate,t)} - ${this._formatDate(this._selectedEndDate,t)}`;this.setAttribute(`value`,o),this._textInput&&(this._textInput.value=o),this._hiddenInput&&(this._hiddenInput.value=o),this._updateDisplayText(),this._buildCalendar(),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}else this._selectedStartDate=r,this._selectedEndDate=null;else{this._selectedStartDate=r,this._selectedEndDate=null;let e=this._formatDate(r,t);this.setValue(e),this._textInput&&(this._textInput.value=e),this._popover&&typeof this._popover.close==`function`&&this._popover.close()}this._buildCalendar(),this._updateDisplayText(),this._exitInputMode();let a=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0})),this._dispatchDateChangeEvent()}finally{this._isHandlingClick=!1}}_updateDisplayText(){if(!this._displayEl)return;let e=this.getDisplayFormat(),t=this.getSelectionMode(),n=this._isRange||t===`week`||t===`month`,r=``;n&&this._selectedStartDate&&this._selectedEndDate?r=`${this._formatDatePhp(this._selectedStartDate,e)} - ${this._formatDatePhp(this._selectedEndDate,e)}`:this._selectedStartDate&&(r=this._formatDatePhp(this._selectedStartDate,e)),r?(this._displayEl.textContent=r,this._displayEl.classList.remove(`is-empty`)):(this._displayEl.textContent=`Select date`,this._displayEl.classList.add(`is-empty`)),this._displayEl&&this._inputsWrapperEl&&this.classList.toggle(`is-input-mode`,this._isInputMode)}_enterInputMode(){if(!this._isInputMode&&!(this.isReadonly()||this.isDisabled())&&(this._isInputMode=!0,this._displayEl&&this._inputsWrapperEl&&this.classList.add(`is-input-mode`),this._startPartInputs.length>0)){let e=this._startPartInputs[0];requestAnimationFrame(()=>{e.focus();try{e.setSelectionRange(0,e.value.length)}catch{}})}}_exitInputMode(){this._isInputMode&&(this._isInputMode=!1,this._displayEl&&this._inputsWrapperEl&&this.classList.remove(`is-input-mode`),this._updateDisplayText())}_renderSkeleton(e){let t=this.querySelector(`.mint-date-picker-skeleton-container`);this._fieldsContainer;let n=this._input;if(e){t||(t=document.createElement(`div`),t.className=`mint-date-picker-skeleton-container`,n?n.appendChild(t):(this.classList.add(`is-positioned`),this.appendChild(t)));let e=t.querySelector(`.mint-date-picker-skeleton`);e||(e=document.createElement(`div`),e.className=`mint-date-picker-skeleton`,t.appendChild(e)),this.classList.add(`is-loading`)}else t?.remove(),this.classList.remove(`is-loading`,`is-positioned`)}_getFocusableElements(){if(!this._calendarContainer)return[];let e=[`button:not([disabled])`,`a[href]`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `);return Array.from(this._calendarContainer.querySelectorAll(e)).filter(e=>{let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}_setupFocusTrap(){if(!this._popover||!this._popover.hasAttribute(`open`))return;this._removeFocusTrap();let e=this;this._focusTrapHandler=function(t){if(t.key!==`Tab`)return;if(!e._popover||!e._popover.hasAttribute(`open`)){e._removeFocusTrap();return}let n=e._getFocusableElements();if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;if(!e._calendarContainer?.contains(a)){t.preventDefault(),r.focus();return}if(t.shiftKey&&a===r){t.preventDefault(),i.focus();return}if(!t.shiftKey&&a===i){t.preventDefault(),r.focus();return}},this._escapeHandler=function(t){(t.key===`Escape`||t.key===`Esc`)&&e._popover&&e._popover.hasAttribute(`open`)&&(t.preventDefault(),t.stopPropagation(),typeof e._popover.close==`function`&&e._popover.close())},document.addEventListener(`keydown`,this._focusTrapHandler,!0),document.addEventListener(`keydown`,this._escapeHandler,!0),requestAnimationFrame(()=>{let e=this._getFocusableElements();e.length>0&&e[0].focus()})}_removeFocusTrap(){this._focusTrapHandler&&=(document.removeEventListener(`keydown`,this._focusTrapHandler,!0),null),this._escapeHandler&&=(document.removeEventListener(`keydown`,this._escapeHandler,!0),null)}};customElements.get(`mint-date-picker`)||a(`mint-date-picker`,gn),s({name:`upload`,viewBox:`0 0 24 24`,path:`M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`attach`,viewBox:`0 0 24 24`,path:`M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13`,strokeLinecap:`round`,strokeLinejoin:`round`});var _n=class extends HTMLElement{static get observedAttributes(){return[`label`,`accept`,`multiple`,`width`,`height`,`disabled`,`name`,`error`,`error-message`,`loading`,`aria-label`,`aria-describedby`]}constructor(){super(),this._dropzone=null,this._fileInput=null,this._previewContainer=null,this._isDragging=!1,this._wasDragging=!1,this._isUpdatingFiles=!1,this._listenersInitialized=!1,this._selectedFiles=[],this._previewUrls=[],this._resetHandler=null,this._a11yId=`mint-dropzone-${Math.random().toString(36).slice(2,10)}`}connectedCallback(){this.classList.add(`mint-dropzone`),this.render(),this._attachFormResetListener()}disconnectedCallback(){if(this.removeEventListeners(),this._cleanupPreviewUrls(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._updateDragStateClass(),this._renderErrorState(this.hasError(),this.getErrorMessage());return}if(e===`loading`){this.render();return}this.render()}}getLabel(){return this.getAttribute(`label`)||``}getAccept(){return this.getAttribute(`accept`)||``}isMultiple(){return this.getAttribute(`multiple`)===`true`}getWidth(){return this.getAttribute(`width`)||`200px`}getHeight(){return this.getAttribute(`height`)||`200px`}_renderSkeleton(e){let t=this.querySelector(`.mint-dropzone-skeleton-container`),n=this._dropzone;if(e){this.classList.add(`is-loading`),t||(t=document.createElement(`div`),t.className=`mint-dropzone-skeleton-container`,n?(n.classList.add(`is-positioned`),n.appendChild(t)):this.appendChild(t));let e=t.querySelector(`.mint-dropzone-skeleton`);e||(e=document.createElement(`div`),e.className=`mint-dropzone-skeleton`,t.appendChild(e)),t.classList.add(`is-visible`),n?.classList.add(`is-loading`)}else this.classList.remove(`is-loading`),t&&t.classList.remove(`is-visible`),n?.classList.remove(`is-loading`)}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getAccept(),r=this.isMultiple(),i=this.isDisabled(),a=this.getWidth(),o=this.getHeight(),s=this.getName(),c=this.hasError(),l=this.getErrorMessage();if(this._dropzone||(this._dropzone=document.createElement(`div`),this.appendChild(this._dropzone)),this._updateDragStateClass(),this._dropzone.setAttribute(`aria-invalid`,c?`true`:`false`),i)this._dropzone.setAttribute(`tabindex`,`-1`),this._dropzone.removeAttribute(`role`);else{this._dropzone.setAttribute(`tabindex`,`0`),this._dropzone.setAttribute(`role`,`button`),this._dropzone.setAttribute(`aria-label`,this.getAttribute(`aria-label`)||t||`File upload dropzone`);let e=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),n=this.querySelector(`.mint-dropzone-error`);n&&(n.id=`${this.id||this._a11yId}-error`,e.push(n.id)),e.length?this._dropzone.setAttribute(`aria-describedby`,Array.from(new Set(e)).join(` `)):this._dropzone.removeAttribute(`aria-describedby`)}this._dropzone.style.width=a,this._dropzone.style.height=o,this._dropzone.style.minWidth=a,this._dropzone.style.minHeight=o,this._fileInput||(this._fileInput=document.createElement(`input`),this._fileInput.type=`file`,this._fileInput.className=`mint-dropzone-file-input`,this._fileInput.setAttribute(`tabindex`,`-1`),this._fileInput.setAttribute(`aria-hidden`,`true`),this._dropzone.appendChild(this._fileInput)),this._fileInput.accept=n,this._fileInput.multiple=r,this._fileInput.disabled=i,s?this._fileInput.name=s:this._fileInput.removeAttribute(`name`),this._fileInput.setAttribute(`aria-invalid`,c?`true`:`false`);let u=this._dropzone.querySelector(`.mint-dropzone-icon`),d=this._dropzone.querySelector(`.mint-dropzone-label`);u&&u.remove(),d&&d.remove();let f=document.createElement(`div`);f.className=`mint-dropzone-icon`;let p=document.createElement(`mint-icon`);if(p.setAttribute(`name`,`upload`),p.className=`mint-dropzone-upload-icon`,f.appendChild(p),this._dropzone.appendChild(f),t){let e=document.createElement(`div`);e.className=`mint-dropzone-label`,e.textContent=t,this._dropzone.appendChild(e)}this.setupEventListeners(),this._renderErrorState(c,l),this._renderPreviews(),this._renderSkeleton(e)}_updateDragState(){this._dropzone&&this._updateDragStateClass()}_renderErrorState(e,t){let n=this.querySelector(`.mint-dropzone-error`);if(e&&t?(n||(n=document.createElement(`div`),n.className=`mint-dropzone-error`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._dropzone){this._dropzone.setAttribute(`aria-invalid`,String(e)),n&&(n.id=`${this.id||this._a11yId}-error`);let t=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean);n&&t.push(n.id),t.length?this._dropzone.setAttribute(`aria-describedby`,Array.from(new Set(t)).join(` `)):this._dropzone.removeAttribute(`aria-describedby`)}}_updateDragStateClass(){if(!this._dropzone)return;let e=this.isDisabled(),t=this.hasError();this._dropzone.className=`mint-dropzone-target`,this._dropzone.classList.toggle(`has-files`,this._selectedFiles.length>0),this._dropzone.classList.toggle(`is-dragging`,this._isDragging),this._dropzone.classList.toggle(`has-error`,t),this._dropzone.classList.toggle(`is-disabled`,e)}setupEventListeners(){this._listenersInitialized||(this._listenersInitialized=!0,this.removeEventListeners(),!(!this._dropzone||!this._fileInput||this.isDisabled())&&(this._onDropzoneClick||=e=>{if(!(this.isDisabled()||!this._fileInput)&&e.target!==this._fileInput&&(e.stopPropagation(),e.preventDefault(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onDragOver||=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||this._isDragging||(this._isDragging=!0,this._wasDragging=!0,this._updateDragState())},this._onDragLeave||=e=>{e.preventDefault(),e.stopPropagation();let t=this._dropzone?.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState())},this._onDrop||=e=>{if(e.preventDefault(),e.stopPropagation(),this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState()),this.isDisabled())return;let t=e.dataTransfer?.files;t&&t.length>0&&this._handleFiles(t)},this._onFileInputInput||=e=>{e.stopImmediatePropagation(),e.stopPropagation()},this._onKeyDown||=e=>{if(!(this.isDisabled()||!this._fileInput)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onFocus||=e=>{this._dropzone&&!this.isDisabled()&&this._dropzone.classList.add(`is-focused`)},this._onBlur||=e=>{this._dropzone},this._onFileInputChange||=e=>{if(e.stopImmediatePropagation(),e.stopPropagation(),this._isUpdatingFiles)return;let t=e.target.files;if(t&&t.length>0){let e=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<t.length;n++){let a=t[n];this._isFileAccepted(a,e)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}},this._dropzone.addEventListener(`click`,this._onDropzoneClick),this._dropzone.addEventListener(`dragover`,this._onDragOver),this._dropzone.addEventListener(`dragleave`,this._onDragLeave),this._dropzone.addEventListener(`drop`,this._onDrop),this._dropzone.addEventListener(`keydown`,this._onKeyDown),this._dropzone.addEventListener(`focus`,this._onFocus),this._dropzone.addEventListener(`blur`,this._onBlur),this._fileInput.addEventListener(`change`,this._onFileInputChange),this._fileInput.addEventListener(`input`,this._onFileInputInput,!0)))}removeEventListeners(){this._dropzone&&(this._onDropzoneClick&&this._dropzone.removeEventListener(`click`,this._onDropzoneClick),this._onDragOver&&this._dropzone.removeEventListener(`dragover`,this._onDragOver),this._onDragLeave&&this._dropzone.removeEventListener(`dragleave`,this._onDragLeave),this._onDrop&&this._dropzone.removeEventListener(`drop`,this._onDrop),this._onKeyDown&&this._dropzone.removeEventListener(`keydown`,this._onKeyDown),this._onFocus&&this._dropzone.removeEventListener(`focus`,this._onFocus),this._onBlur&&this._dropzone.removeEventListener(`blur`,this._onBlur)),this._fileInput&&(this._onFileInputChange&&this._fileInput.removeEventListener(`change`,this._onFileInputChange),this._onFileInputInput&&this._fileInput.removeEventListener(`input`,this._onFileInputInput,!0)),this._isDragging=!1,this._listenersInitialized=!1}_handleFiles(e){let t=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<e.length;n++){let a=e[n];this._isFileAccepted(a,t)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}_isFileAccepted(e,t){if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase());for(let t of n)if(t.startsWith(`.`)){if(`.`+e.name.split(`.`).pop()?.toLowerCase()===t)return!0}else if(t.includes(`/*`)){if(t.split(`/`)[0]===e.type.split(`/`)[0])return!0}else if(e.type===t)return!0;return!1}_dispatchEvent(e,t){let n=t.target,r=new CustomEvent(e,{detail:{files:n.files?Array.from(n.files):[],value:n.value||``},bubbles:!0,cancelable:!0});this.dispatchEvent(r)}_dispatchSelectionEvents(){let e={files:[...this._selectedFiles],value:``};this.dispatchEvent(new CustomEvent(`input`,{detail:e,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:e,bubbles:!0,cancelable:!0,composed:!0}))}_syncFileInputFromSelected(){if(!this._fileInput)return;let e=new DataTransfer;this._selectedFiles.forEach(t=>{try{e.items.add(t)}catch(e){console.warn(`Failed to add file to DataTransfer:`,e)}}),this._isUpdatingFiles=!0;try{this._fileInput.files=e.files}catch(e){console.warn(`Failed to set files on input:`,e)}setTimeout(()=>{this._isUpdatingFiles=!1},0)}get files(){return this._syncFileInputFromSelected(),this._fileInput?.files||null}syncFiles(){this._syncFileInputFromSelected()}_renderPreviews(){if(!this._dropzone)return;if(this._previewContainer&&(this._cleanupPreviewUrls(),this._previewContainer.remove()),this._selectedFiles.length===0){this._previewContainer=null,this._updateDragStateClass();return}let e=document.createElement(`div`);e.className=`mint-dropzone-previews-wrapper`,e.classList.toggle(`has-error`,this.hasError()),e.classList.toggle(`is-dragging`,this._isDragging);let t=document.createElement(`div`);t.className=`mint-dropzone-previews`,this._selectedFiles.forEach((e,n)=>{let r=document.createElement(`div`);if(r.className=`mint-dropzone-file`,e.type.startsWith(`image/`)){let t=document.createElement(`img`);t.className=`mint-dropzone-file-image`;let n=URL.createObjectURL(e);this._previewUrls.push(n),t.src=n,r.appendChild(t)}else{let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`attach`),e.className=`mint-dropzone-file-icon`,r.appendChild(e)}let i=document.createElement(`div`);i.className=`mint-dropzone-file-name`,i.textContent=e.name,r.appendChild(i);let a=document.createElement(`button`);a.type=`button`,a.className=`mint-dropzone-file-remove`;let o=document.createElement(`mint-icon`);o.setAttribute(`name`,`close`),o.className=`mint-dropzone-file-remove-icon`,a.appendChild(o),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),this._removeFileAt(n)}),r.appendChild(a),t.appendChild(r)});let n=document.createElement(`div`);n.className=`mint-dropzone-preview-fade is-top`,e.appendChild(n);let r=document.createElement(`div`);r.className=`mint-dropzone-preview-fade is-bottom is-visible`,e.appendChild(r);let i=()=>{let e=t.scrollTop,i=t.scrollHeight,a=t.clientHeight;e>0?n.classList.add(`is-visible`):n.classList.remove(`is-visible`),e+a<i-1?r.classList.add(`is-visible`):r.classList.remove(`is-visible`)};i(),t.addEventListener(`scroll`,i),e.appendChild(t),this._previewContainer=e,this._dropzone.appendChild(e),this._updateDragStateClass()}_removeFileAt(e){if(e<0||e>=this._selectedFiles.length)return;let[t]=this._selectedFiles.splice(e,1);t&&this._cleanupPreviewUrls(),this._syncFileInputFromSelected(),this._renderPreviews(),this._dispatchSelectionEvents()}_cleanupPreviewUrls(){this._previewUrls.forEach(e=>URL.revokeObjectURL(e)),this._previewUrls=[]}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this._selectedFiles=[],this._syncFileInputFromSelected(),this._renderPreviews(),this._cleanupPreviewUrls()},e.addEventListener(`reset`,this._resetHandler))}_applyValidFiles(e){if(this.isMultiple()){let t=e.filter(e=>!this._isDuplicateFile(e));this._selectedFiles.push(...t)}else this._selectedFiles=[e[0]];this._syncFileInputFromSelected(),this._selectedFiles.length>0&&(this.removeAttribute(`error`),this.removeAttribute(`error-message`),this._fileInput&&this._fileInput.removeAttribute(`aria-invalid`)),this._renderPreviews(),this._dispatchSelectionEvents()}_isDuplicateFile(e){return this._selectedFiles.some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)}};customElements.get(`mint-dropzone`)||a(`mint-dropzone`,_n);var vn=class extends HTMLElement{static get observedAttributes(){return[`action`,`method`,`enctype`,`data-form-data`,`loading`,`headers`,`submitting`]}constructor(){super(),this._form=null,this._submitHandler=null,this._hostSubmitHandler=null,this._errors={},this._fieldBlurHandlers=new Map,this._fieldChangeHandlers=new Map,this._observer=null,this._formData=null,this._headers=null,this._buttonStates=new Map,this._attrSubmittingMintFields=new Map,this._attrSubmittingNativeFields=new Map,this._attrSubmittingMintButtons=new Map,this._attrSubmittingNativeButtons=new Map,this._reactiveDataProxy=null,this._reactiveDataObserver=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null}connectedCallback(){this._render(),this._ensureSubmitHandler(),this._setupBlurValidation();let e=this.getAttribute(`headers`);e&&this._parseHeaders(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this._formData)this._isReactiveObject(this._formData)?this._setupObjectDataObserver(this._formData):this._lastDataSnapshot||=this._createDataSnapshot(this._formData),this._applyFormData();else{let e=this.getAttribute(`data-form-data`);e&&(this._parseFormData(e),this._applyFormData())}this._propagateLoadingState(),this._applySubmittingAttributeState()})})}disconnectedCallback(){this._form&&this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._hostSubmitHandler&&this.removeEventListener(`submit`,this._hostSubmitHandler),this._restoreSubmittingAttributeState(),this._cleanupBlurValidation(),this._stopReactiveDataObserver()}reset(){this._clearErrors(),this._formData?(this._lastAppliedDataSnapshot=null,this._applyFormData()):this.clear()}clear(){this._clearErrors(),this._form&&this._form.reset(),this._resetCustomFields()}submit(){if(this._form){if(typeof this._form.requestSubmit==`function`){this._form.requestSubmit();return}this._handleSubmit(new Event(`submit`,{bubbles:!0,cancelable:!0}))}}attributeChangedCallback(e,t,n){e===`form-data`?(this._parseFormData(n),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})):e===`headers`?this._parseHeaders(n):e===`loading`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._propagateLoadingState()}):this._propagateLoadingState():e===`submitting`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._applySubmittingAttributeState()}):this._applySubmittingAttributeState():this._applyFormAttributes()}get data(){return this._formData}set data(e){this._stopReactiveDataObserver(),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null,e&&typeof e==`object`&&!Array.isArray(e)?(this._formData=e,this._isReactiveObject(e)?this._setupObjectDataObserver(e):this._lastDataSnapshot=this._createDataSnapshot(e)):e==null?this._formData=null:this._parseFormData(e),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})})}get headers(){return this._headers}set headers(e){if(e&&typeof e==`object`&&!Array.isArray(e))this._headers=e;else if(e==null)this._headers=null;else if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_render(){if(this.classList.add(`mint-form-host`),!this._form){for(this._form=document.createElement(`form`),this._form.classList.add(`mint-form-content`),this._form.noValidate=!0;this.firstChild;)this._form.appendChild(this.firstChild);this.appendChild(this._form)}this._ensureSubmitHandler(),this._applyFormAttributes()}_ensureSubmitHandler(){this._form&&(this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._submitHandler=e=>{e.preventDefault(),e.stopImmediatePropagation(),this._handleSubmit(e)},this._form.addEventListener(`submit`,this._submitHandler,!0))}_applyFormAttributes(){if(!this._form)return;let e=this.getAttribute(`action`)||``,t=this.getAttribute(`method`)||``,n=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;e&&(this._form.action=e),t&&(this._form.method=t),this._form.enctype=n}async _handleSubmit(e){if(e.preventDefault(),!this._form)return;this._clearErrors(),this._syncDropzoneFiles();let t=this._collectValidationRules(),n=new FormData(this._form),r=this._formDataToValues(n);if(this._formData){let e=this._getObjectValue(this._formData);e&&typeof e==`object`&&!Array.isArray(e)&&(r={...this._extractReactiveData(e),...r})}let i=this._collectLiveControlValues();if(r={...r,...i},!this._validate(r,t)){this.dispatchEvent(new CustomEvent(`invalid`,{detail:{errors:this._errors},bubbles:!0,cancelable:!0,composed:!0}));return}let a=new CustomEvent(`submit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),a.form=this;let o=new CustomEvent(`mintFormSubmit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});if(o.form=this,this.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented)return;let s=this.getAttribute(`action`),c=this.getAttribute(`method`);if(!(!s||!c)){this._setButtonsSubmitting();try{let e=await this._submitData(n,r);this.dispatchEvent(new CustomEvent(`submitsuccess`,{detail:e,bubbles:!0,cancelable:!0}))}catch(e){e?.status===422&&e?.data?.errors&&this._applyServerErrors(e.data.errors),this.dispatchEvent(new CustomEvent(`submiterror`,{detail:{error:e},bubbles:!0,cancelable:!0}))}finally{this._restoreButtonsState()}}}async _submitData(e,t){let n=this.getAttribute(`action`),r=this.getAttribute(`method`),i=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;if(!n)return{status:0,ok:!0,data:{values:t}};let a=Array.from(e.values()).some(e=>e instanceof File),o=null,s={},c=n;if(typeof window<`u`&&window.mintForm?.defaults?.headers?.common&&Object.assign(s,window.mintForm.defaults.headers.common),this._headers&&Object.assign(s,this._headers),r===`GET`){let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),c+=(n.includes(`?`)?`&`:`?`)+t.toString()}else if(i===`multipart/form-data`||a)o=e;else if(i===`application/json`)o=JSON.stringify(t),s[`Content-Type`]=`application/json`;else{let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),o=t,s[`Content-Type`]=`application/x-www-form-urlencoded`}if(typeof fetch==`function`)try{let e=await fetch(c,{method:r||`POST`,body:r===`GET`?null:o,headers:s}),t=await e.text().catch(()=>``),n=t;try{n=JSON.parse(t)}catch{}if(!e.ok){let t={status:e.status,data:n,response:{status:e.status,data:n}};throw await this._applyErrorInterceptors(t)}let i={status:e.status,ok:e.ok,data:n};return await this._applySuccessInterceptors(i)}catch(e){if(e.response)throw e;let t={status:e.status||0,data:e.data||e.message||`Network error`,response:{status:e.status||0,data:e.data||e.message||`Network error`}};throw await this._applyErrorInterceptors(t)}let l=this;return await new Promise(async(e,t)=>{let n=new XMLHttpRequest;n.open(r||`POST`,c,!0),Object.entries(s).forEach(([e,t])=>n.setRequestHeader(e,t)),n.onload=async function(){let{status:r,responseText:i}=n;if(r>=200&&r<300){let n=i;try{n=JSON.parse(i)}catch{}try{let t={status:r,ok:!0,data:n};e(await l._applySuccessInterceptors(t))}catch(e){t(e)}}else{let e=i;try{e=JSON.parse(i)}catch{}try{let n={status:r,data:e,response:{status:r,data:e}};t(await l._applyErrorInterceptors(n))}catch(e){t(e)}}},n.onerror=async function(){try{let e={status:n.status||0,data:n.responseText||`Network error`,response:{status:n.status||0,data:n.responseText||`Network error`}};t(await l._applyErrorInterceptors(e))}catch(e){t(e)}},n.send(r===`GET`?null:o)})}async _applySuccessInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return e;let t=e,n=window.mintForm.interceptors.response.handlers;for(let e of n)e.fulfilled&&(t=await e.fulfilled(t));return t}async _applyErrorInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return Promise.reject(e);let t=e,n=window.mintForm.interceptors.response.handlers;for(let e=n.length-1;e>=0;e--){let r=n[e];if(r.rejected)try{if(t=await r.rejected(t),t!==void 0)return t}catch(e){t=e}}return Promise.reject(t)}_formDataToValues(e){let t={};return e.forEach((e,n)=>{e instanceof File?(t[n]||(t[n]=[]),t[n].push(e)):n in t?Array.isArray(t[n])?(t[n].length>0&&t[n][0]instanceof File,t[n].push(e)):t[n]=[t[n],e]:t[n]=e}),this._form&&(Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n&&e.files!==void 0&&e.files){let r=e.files;if(r.length>0){let e=Array.from(r);t[n]&&Array.isArray(t[n])?e.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=e}}}),Array.from(this._form.querySelectorAll(`input[type="file"][name]`)).forEach(e=>{let n=e.name;if(n&&e.files&&e.files.length>0){let r=Array.from(e.files);t[n]&&Array.isArray(t[n])?r.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=r}}),Array.from(this._form.querySelectorAll(`mint-tags[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n){let r=[];e.tags===void 0?typeof e.getTags==`function`&&(r=e.getTags()):r=e.tags,Array.isArray(r)&&r.length>0?t[n]=r.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):t[n]=[]}})),t}_isControlDisabledForSubmit(e){let t=e;for(;t&&t!==this._form;){if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLButtonElement)&&t.disabled)return!0;let e=t.getAttribute(`disabled`);if(e!==null&&e!==`false`)return!0;t=t.parentElement}return!1}_collectLiveControlValues(){let e={};if(!this._form)return e;let t=new Set,n=Array.from(this._form.querySelectorAll([`input[name]`,`textarea[name]`,`select[name]`,`mint-input[name]`,`mint-select[name]`,`mint-date-picker[name]`,`mint-time-picker[name]`,`mint-dropzone[name]`,`mint-checkbox[name]`,`mint-choice[name]`,`mint-switch[name]`,`mint-tags[name]`].join(`,`)));for(let e of n){let n=e.getAttribute(`name`);!n||this._isControlDisabledForSubmit(e)||t.add(n)}for(let n of t){let t=this._getFieldElements(n).filter(e=>!this._isControlDisabledForSubmit(e));if(t.length!==0)try{let r=this._extractFieldValue(t),i=r instanceof FileList?Array.from(r):r;if(t.every(e=>e instanceof HTMLInputElement?e.type===`checkbox`||e.type===`radio`:[`MINT-CHECKBOX`,`MINT-CHOICE`,`MINT-SWITCH`].includes(e.tagName))&&(i===``||i==null||Array.isArray(i)&&i.length===0))continue;e[n]=i}catch{}}return e}_collectValidationRules(){let e={};return this._form&&Array.from(this._form.querySelectorAll(`[name][validation]`)).forEach(t=>{let n=t.getAttribute(`name`)||``,r=t.getAttribute(`validation`);if(!n||!r)return;let i=this._parseRules(r);i.length&&(e[n]=i)}),e}_parseRules(e){if(!e)return[];try{let t=e.replace(/'/g,`"`),n=JSON.parse(t);if(Array.isArray(n))return n.map(e=>String(e))}catch{}return e.split(`,`).map(e=>e.trim()).filter(Boolean)}_validate(e,t){let n=!0;return this._errors={},Object.entries(t||{}).forEach(([e,t])=>{let r=Array.isArray(t)?t:[t],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(n=!1,this._errors[e]=o,this._flagFieldError(i,o)):this._clearFieldError(i)}),n}_validateField(e){let t=this._collectValidationRules();if(!t[e])return;let n=t[e],r=Array.isArray(n)?n:[n],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(this._errors[e]=o,this._flagFieldError(i,o)):(this._clearFieldError(i),delete this._errors[e])}_validateRules(e,t){for(let n of t){let[t,r]=n.split(`:`);switch(t){case`required`:if(e==null||typeof e==`string`&&e.trim()===``||e instanceof FileList&&e.length===0||Array.isArray(e)&&e.length===0)return`This field is required.`;break;case`string`:if(typeof e!=`string`)return`Must be a string.`;break;case`email`:if(typeof e==`string`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()))return`Enter a valid email.`;break;case`number`:{let t=Number(e);if(Number.isNaN(t))return`Must be a number.`;break}case`min`:{let t=Number(r);if(Number.isNaN(t))break;if(typeof e==`string`&&e.trim().length<t)return`Must be at least ${t} characters.`;if(Array.isArray(e)&&e.length<t)return`Select at least ${t}.`;if(e instanceof FileList&&e.length<t)return`Upload at least ${t} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)<t)return`Must be at least ${t}.`;break}case`max`:{let t=Number(r);if(Number.isNaN(t))break;if(typeof e==`string`&&e.trim().length>t)return`Must be at most ${t} characters.`;if(Array.isArray(e)&&e.length>t)return`Select no more than ${t}.`;if(e instanceof FileList&&e.length>t)return`Upload no more than ${t} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)>t)return`Must be at most ${t}.`;break}default:break}}return null}_getFieldElements(e){if(!this._form)return[];let t=Array.from(this._form.querySelectorAll(`[name="${e}"]`)),n=t.filter(e=>e.tagName===`MINT-SELECT`);if(n.length>0){let r=[];return n.forEach(t=>{let n=t.querySelector(`select[name="`+e+`"]`);n&&r.push(n)}),t.filter(e=>e.tagName!==`MINT-SELECT`).concat(r)}if(t.filter(e=>e.tagName===`MINT-TAGS`).length>0)return t.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`));let r=t.filter(e=>e.tagName===`INPUT`&&e.closest(`mint-tags`));if(r.length>0){let e=[];return r.forEach(t=>{let n=t.closest(`mint-tags`);n&&!e.includes(n)&&e.push(n)}),t.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`)).concat(e)}return t}_extractFieldValue(e){if(e.length===0)return``;let t=e.find(e=>e instanceof HTMLSelectElement);if(t)return t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value;if(e.length>1){let t=e.filter(e=>e instanceof HTMLInputElement);if(t.length>0&&t.length===e.length){let e=t.filter(e=>e.checked);if(t.every(e=>e.type===`radio`))return e.length>0?e[0].value||`on`:``;if(t.every(e=>e.type===`checkbox`))return e.map(e=>e.value||`on`)}let n=e.filter(e=>e.tagName===`MINT-CHOICE`);if(n.length>0&&n.length===e.length){let e=n.find(e=>typeof e.getValue==`function`?e.getValue()!==``:e.querySelector(`mint-choice-option[checked]`)!==null);if(e){if(typeof e.getValue==`function`)return e.getValue();let t=e.querySelector(`mint-choice-option[checked]`);if(t)return t.getAttribute(`value`)||``}return``}let r=e.filter(e=>e.tagName===`MINT-CHECKBOX`);if(r.length>0&&r.length===e.length)return r.filter(e=>e.checked===void 0?e.hasAttribute(`checked`):e.checked).map(e=>e.getAttribute(`value`)||`on`)}let n=e[0];if(n instanceof HTMLInputElement)return n.type===`file`?n.files:n.type===`checkbox`||n.type===`radio`?n.checked?n.value||`on`:``:n.value;if(n instanceof HTMLTextAreaElement)return n.value;if(n.tagName===`MINT-SELECT`){let e=n.querySelector(`select`);if(e)return e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value;if(typeof n.getValue==`function`){let e=n.getValue();if(e!=null&&e!==``)return e}return n.getAttribute(`value`)||``}if(n.tagName===`MINT-DROPZONE`&&n.files!==void 0)return n.files;if(n.tagName===`MINT-TAGS`){let e=null;return n.tags===void 0?typeof n.getTags==`function`&&(e=n.getTags()):e=n.tags,Array.isArray(e)?e.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):[]}return n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`?(n.checked===void 0?n.hasAttribute(`checked`):n.checked)?n.getAttribute(`value`)||`on`:``:n.tagName===`MINT-CHOICE`?(typeof n.getValue==`function`?n.getValue():``)||``:n.value===void 0?n.getAttribute(`value`)||``:n.value}_flagFieldError(e,t){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.setAttribute(`aria-invalid`,`true`);let n=this._resolveHost(e);n&&(n.setAttribute(`error`,`true`),n.setAttribute(`error-message`,t),n.setAttribute(`data-mint-form-error`,`true`))})}_clearFieldError(e){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.removeAttribute(`aria-invalid`);let t=this._resolveHost(e);t&&(t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`))})}_clearErrors(){this.querySelectorAll(`[data-mint-form-error]`).forEach(e=>{let t=e;t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`)}),this._form&&this._form.querySelectorAll(`[aria-invalid="true"]`).forEach(e=>{e.removeAttribute(`aria-invalid`)}),this._errors={}}setFormErrors(e){this._applyServerErrors(e)}_applyServerErrors(e){this._clearErrors(),Object.entries(e).forEach(([e,t])=>{let n=Array.isArray(t)?t[0]||`Validation error`:t||`Validation error`,r=this._getFieldElements(e);r.length>0&&(this._errors[e]=n,this._flagFieldError(r,n))})}_parseFormData(e){if(!e){this._formData=null;return}if(typeof e==`object`&&!Array.isArray(e)){this._formData=e;return}if(typeof e==`string`)try{this._formData=JSON.parse(e)}catch{this._formData=null}else this._formData=null}_parseHeaders(e){if(!e){this._headers=null;return}if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_applyFormData(){if(!this._formData||!this._form)return;let e=this._getObjectValue(this._formData);if(!e||typeof e!=`object`||Array.isArray(e))return;let t=this._extractReactiveData(e),n=this._createDataSnapshot(t),r=this._lastAppliedDataSnapshot,i=new Set;if(r?(Object.keys(n).forEach(e=>{let t=r[e],a=n[e];JSON.stringify(t)!==JSON.stringify(a)&&i.add(e)}),Object.keys(r).forEach(e=>{e in n||i.add(e)})):Object.keys(n).forEach(e=>i.add(e)),i.size===0)return;let a=()=>{i.forEach(e=>{let t=n[e],r=this._getFieldElements(e);if(r.length===0){setTimeout(()=>{let t=this._getFieldElements(e);if(t.length===0)return;let n=this._formData?this._getObjectValue(this._formData):null;if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n[e];this._applyValueToField(t,e,r)},300);return}this._applyValueToField(r,e,t)}),this._lastAppliedDataSnapshot=n};requestAnimationFrame(()=>{requestAnimationFrame(()=>{a()})})}_applyValueToField(e,t,n){e.forEach(e=>{let r=e.tagName;try{if(r===`MINT-INPUT`)e.value!==void 0&&(e.value=n||``);else if(r===`MINT-DATE-PICKER`)typeof e.setValue==`function`&&e.setValue(n||``);else if(r===`MINT-TIME-PICKER`)typeof e.setValue==`function`?e.setValue(n==null?``:String(n)):e.value!==void 0&&(e.value=n==null?``:String(n));else if(r===`MINT-SELECT`||r===`SELECT`)if(r===`SELECT`){let t=e,r=t.closest(`mint-select`);if(r&&typeof r.setValue==`function`)r.setValue(n);else if(t.multiple){let e=Array.isArray(n)?n.map(e=>String(e)):n==null||n===``?[]:[String(n)];Array.from(t.options).forEach(t=>{t.selected=e.includes(t.value)})}else t.value=n==null?``:String(n)}else typeof e.setValue==`function`&&e.setValue(n);else if(r===`MINT-CHOICE`)typeof e.setValue==`function`?e.setValue(n==null?``:String(n)):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=e.getAttribute(`value`)===n});else if(r===`MINT-CHECKBOX`||r===`MINT-SWITCH`){let t=n===!0||n===`true`||n===`on`||n===1||n===`1`;e.checked===void 0?t?e.setAttribute(`checked`,`true`):e.removeAttribute(`checked`):e.checked=t}else if(r===`MINT-TAGS`)if(Array.isArray(n)){let t=new Map;try{let n=e.getAttribute(`predefined-tags`);if(n){let e=JSON.parse(n);Array.isArray(e)&&(t=new Map(e.map(e=>{if(typeof e==`string`){let t=e.trim();return t?[t.toLowerCase(),t]:null}if(!e||typeof e!=`object`)return null;let t=String(e.value??``).trim();if(!t)return null;let n=String(e.label??t);return[t.toLowerCase(),n]}).filter(e=>e!==null)))}}catch{}e.tags!==void 0&&(e.tags=n.map(e=>{if(typeof e==`string`){let n=e.trim();return{value:n,label:t.get(n.toLowerCase())||n,dismissable:!0}}if(e&&typeof e==`object`){let n=String(e.value??``).trim(),r=t.get(n.toLowerCase())||String(e.label??n);return{...e,value:n,label:r,dismissable:e.dismissable!==!1}}return e}))}else e.tags!==void 0&&(e.tags=[]);else if(e instanceof HTMLInputElement){if(e.type===`file`)return;e.type===`checkbox`||e.type===`radio`?e.checked=n===!0||n===`true`||n===`on`||n===1||n===`1`:e.value=n||``}else (e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(e.value=n||``)}catch(e){console.warn(`Failed to set value for field ${t}:`,e)}})}_resetCustomFields(){this.querySelectorAll(`mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{e.removeAttribute(`error`),e.removeAttribute(`error-message`);let t=e.tagName;if(t===`MINT-INPUT`)try{e.value=``}catch{}else if(t===`MINT-DATE-PICKER`)try{e.setValue?.(``)}catch{}else if(t===`MINT-SELECT`)try{e.setValue?.(``)}catch{}else if(t===`MINT-DROPZONE`){let t=e.querySelector(`input[type="file"]`);t&&(t.value=``)}else if(t===`MINT-CHECKBOX`||t===`MINT-SWITCH`)try{if(e.checked!==void 0)e.checked=!1;else{e.removeAttribute(`checked`);let t=e.querySelector(`input[type="checkbox"], input[type="radio"]`);t&&(t.checked=!1)}}catch{}else if(t===`MINT-CHOICE`)try{typeof e.setValue==`function`?e.setValue(``):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=!1})}catch{}else if(t===`MINT-TAGS`)try{e.tags=[]}catch{}})}_resolveHost(e){if(e.tagName===`MINT-CHOICE-OPTION`){let t=e.closest(`mint-choice`);if(t)return t}return e.closest(`mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)||e}_setupBlurValidation(){if(!this._form)return;let e=e=>{let t=e.target;if(!t)return;let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);if(!r||!this._collectValidationRules()[r])return;let i=this._extractFieldValue([n]),a=i!=null&&(typeof i==`string`?i.trim()!==``:i instanceof FileList||Array.isArray(i)?i.length>0:!0),o=n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&(t.hasAttribute(`aria-invalid`)||t.closest(`[data-mint-form-error]`)),s=!!n.closest(`mint-tags`),c=n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`||n.tagName===`MINT-CHOICE`||t instanceof HTMLElement&&(t.closest(`mint-checkbox, mint-switch, mint-choice`)||t.closest(`mint-choice-option`)),l=n.tagName===`MINT-DATE-PICKER`||t instanceof HTMLElement&&t.closest(`mint-date-picker`);(a||o||s||c||l)&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`blur`,e,!0),this._fieldBlurHandlers.set(this._form,e);let t=e=>{let t=e.target;if(!t)return;if(!(t instanceof HTMLInputElement&&t.type===`file`)){let e=this._findFieldElement(t),n=e?this._getFieldName(e):null;e&&n&&this._syncFieldToReactiveData(e,n)}if(e.type===`tags-change`&&t.tagName===`MINT-TAGS`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLSelectElement||t.tagName===`MINT-SELECT`||t.closest(`mint-select`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(e.type===`choice-change`&&t.tagName===`MINT-CHOICE`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLInputElement&&t.type===`checkbox`||t.tagName===`MINT-CHECKBOX`||t.tagName===`MINT-SWITCH`||t.closest(`mint-checkbox, mint-switch`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);r&&this._collectValidationRules()[r]&&(n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&t.hasAttribute(`aria-invalid`))&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`change`,t,!0),this._form.addEventListener(`input`,t,!0),this._form.addEventListener(`tags-change`,t,!0),this._form.addEventListener(`choice-change`,t,!0),this._fieldChangeHandlers.set(this._form,t)}_findFieldElement(e){let t=e.closest(`mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`);if(t&&t.hasAttribute(`name`))return t;if(e.hasAttribute(`name`)&&(e.tagName.startsWith(`MINT-`)||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)||(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.hasAttribute(`name`))return e;let n=e;for(;n&&n!==this._form;){if(n.hasAttribute(`name`))return n;n=n.parentElement}return null}_getFieldName(e){return e.hasAttribute(`name`)||e.tagName.startsWith(`MINT-`)?e.getAttribute(`name`):(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.name||null}_syncFieldToReactiveData(e,t){if(!this._formData||!t)return;let n=this._getObjectValue(this._formData);if(!n||typeof n!=`object`||Array.isArray(n))return;let r=this._getFieldElements(t),i=this._extractFieldValue(r.length?r:[e]);n[t]=this._normalizeReactiveValue(r,i),this._lastDataSnapshot=this._createDataSnapshot(n)}_normalizeReactiveValue(e,t){if(t instanceof FileList)return Array.from(t);if(Array.isArray(t))return t;let n=e[0];return e.length===1&&(n instanceof HTMLInputElement&&n.type===`checkbox`||n?.tagName===`MINT-CHECKBOX`||n?.tagName===`MINT-SWITCH`)?!!t:t??``}_cleanupBlurValidation(){if(this._form&&this._fieldBlurHandlers.has(this._form)){let e=this._fieldBlurHandlers.get(this._form);e&&this._form.removeEventListener(`blur`,e,!0),this._fieldBlurHandlers.delete(this._form)}if(this._form&&this._fieldChangeHandlers.has(this._form)){let e=this._fieldChangeHandlers.get(this._form);e&&(this._form.removeEventListener(`change`,e,!0),this._form.removeEventListener(`input`,e,!0),this._form.removeEventListener(`tags-change`,e,!0),this._form.removeEventListener(`choice-change`,e,!0)),this._fieldChangeHandlers.delete(this._form)}this._observer&&=(this._observer.disconnect(),null)}_syncDropzoneFiles(){this._form&&Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{typeof e.syncFiles==`function`&&e.syncFiles()})}_isSubmittingAttrActive(){let e=this.getAttribute(`submitting`);return e!==null&&e!==`false`}_applySubmittingAttributeState(){if(this._form){if(!this._isSubmittingAttrActive()){this._restoreSubmittingAttributeState();return}this._attrSubmittingMintFields.size>0||this._attrSubmittingNativeFields.size>0||this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0||(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`;this._attrSubmittingMintFields.set(e,t),t||e.setAttribute(`disabled`,`true`),typeof e.render==`function`&&e.render()}),this._form.querySelectorAll(`input, textarea, select`).forEach(e=>{if(e.closest(`mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags, mint-button`)||e instanceof HTMLInputElement&&e.type===`hidden`)return;let t=e.disabled;this._attrSubmittingNativeFields.set(e,t),t||(e.disabled=!0)}),Array.from(this.querySelectorAll(`mint-button`)).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._attrSubmittingMintButtons.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&!n&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),Array.from(this.querySelectorAll(`button`)).forEach(e=>{if(e.closest(`mint-button, mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`))return;let t=e.disabled;this._attrSubmittingNativeButtons.set(e,t),t||(e.disabled=!0)}))}}_restoreSubmittingAttributeState(){this._attrSubmittingMintFields.forEach((e,t)=>{e?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintFields.clear(),this._attrSubmittingNativeFields.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeFields.clear(),this._attrSubmittingMintButtons.forEach((e,t)=>{e.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),e.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintButtons.clear(),this._attrSubmittingNativeButtons.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeButtons.clear()}_propagateLoadingState(){if(!this._form)return;let e=this.getAttribute(`loading`),t=e!==null&&e!==`false`;Array.from(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)).forEach(e=>{t?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`),typeof e.render==`function`&&e.render()})}_setButtonsSubmitting(){if(!this._form)return;this._buttonStates.clear();let e=Array.from(this.querySelectorAll(`mint-button`)),t=Array.from(this.querySelectorAll(`button`));e.forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._buttonStates.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),t.forEach(e=>{if(e.closest(`mint-button`))return;let t=e.disabled;this._buttonStates.set(e,{disabled:t,loading:!1}),t||(e.disabled=!0)})}_restoreButtonsState(){if(!this._form)return;let e=this._isSubmittingAttrActive()&&(this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0),t=Array.from(this.querySelectorAll(`mint-button`)),n=Array.from(this.querySelectorAll(`button`));t.forEach(t=>{if(e&&this._attrSubmittingMintButtons.has(t))return;let n=this._buttonStates.get(t);n&&(n.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),n.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render())}),n.forEach(t=>{if(t.closest(`mint-button`)||e&&this._attrSubmittingNativeButtons.has(t))return;let n=this._buttonStates.get(t);n&&(t.disabled=n.disabled)}),this._buttonStates.clear()}_isReactiveObject(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}_createDataSnapshot(e){try{let t=this._extractReactiveData(e);return JSON.parse(JSON.stringify(t))}catch{return{...this._extractReactiveData(e)}}}_extractReactiveData(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>this._extractReactiveData(e));let t=this._getObjectValue(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=this._extractReactiveData(t[n]));return e}return t}_hasDataChanged(e,t){try{return JSON.stringify(e)!==JSON.stringify(t)}catch{return!0}}_getObjectValue(e){return e}_setupObjectDataObserver(e){if(this._stopReactiveDataObserver(),!this.isConnected)return;let t=this._getObjectValue(e);if(t&&typeof t==`object`&&!Array.isArray(t))this._lastDataSnapshot=this._createDataSnapshot(t);else{this._lastDataSnapshot=null;return}let n=()=>{if(!this._formData||!this._lastDataSnapshot){this._stopReactiveDataObserver();return}let e=this._getObjectValue(this._formData);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=this._createDataSnapshot(e);this._hasDataChanged(t,this._lastDataSnapshot)&&(this._lastDataSnapshot=t,requestAnimationFrame(()=>{this._applyFormData()}))}this.isConnected&&this._formData?this._reactiveDataObserver=requestAnimationFrame(n):this._stopReactiveDataObserver()};this._reactiveDataObserver=requestAnimationFrame(n)}_stopReactiveDataObserver(){this._reactiveDataObserver!==null&&(cancelAnimationFrame(this._reactiveDataObserver),this._reactiveDataObserver=null),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null}};customElements.get(`mint-form`)||a(`mint-form`,vn),typeof window<`u`&&(window.mintForm=window.mintForm||{defaults:{headers:{common:{}}},interceptors:{response:{handlers:[]}}},window.mintForm.interceptors.response.use||(window.mintForm.interceptors.response.use=function(e,t){return window.mintForm.interceptors.response.handlers.push({fulfilled:e,rejected:t}),window.mintForm.interceptors.response.handlers.length-1}));var yn=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`position`,`full-page`,`width`,`height`]}constructor(){super(),this._overlay=null,this._offCanvas=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._contentObserver=null,this._renderFrame=null,this._exitTimer=null,this._previousFocus=null,this._dialogWasOpen=!1,this._dialogKeydownHandler=null}connectedCallback(){this.classList.add(`mint-off-canvas-host`),this.isOpen()||this.classList.add(`mint-off-canvas-hidden`),this.render(),this._observeContentMutations(),this._dialogKeydownHandler=e=>{if(!this.isOpen())return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this.close();return}if(e.key!==`Tab`)return;let t=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!t)return;let n=this._getDialogFocusableElements(t);if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===i||!t.contains(a))&&(e.preventDefault(),r.focus())},document.addEventListener(`keydown`,this._dialogKeydownHandler,!0)}disconnectedCallback(){this._dialogKeydownHandler&&=(document.removeEventListener(`keydown`,this._dialogKeydownHandler,!0),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null)}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getPosition(){let e=this.getAttribute(`position`)?.toLowerCase();return e===`top`||e===`bottom`||e===`left`||e===`right`?e:`right`}isFullPage(){return this.getAttribute(`full-page`)===`true`}getWidth(){return this.getAttribute(`width`)||`320px`}getHeight(){return this.getAttribute(`height`)||``}_normalizeCssValue(e){return/^\d+(\.\d+)?$/.test(e.trim())?`${e.trim()}px`:e.trim()}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getPosition(),i=this.isFullPage(),a=this.getHeight();e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-off-canvas-overlay`,this._overlay.setAttribute(`aria-hidden`,`true`),this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._offCanvas||(this._offCanvas=document.createElement(`div`),this.appendChild(this._offCanvas)),this._offCanvas.className=`mint-off-canvas-shell`,this._offCanvas.dataset.position=r,this._offCanvas.dataset.fullPage=String(i);let o=this._offCanvas.querySelector(`.mint-off-canvas-panel`);o||(o=document.createElement(`div`),o.className=`mint-off-canvas-panel`,o.style.transform=this._getTransformValue(r,!1),this._offCanvas.appendChild(o)),o.setAttribute(`role`,`dialog`),o.setAttribute(`aria-modal`,`true`),o.hasAttribute(`tabindex`)||(o.tabIndex=-1),n?this._animateEnter():this._animateExit(),o.style.removeProperty(`--off-canvas-width`),o.style.removeProperty(`--off-canvas-height`),r===`top`||r===`bottom`?a&&o.style.setProperty(`--off-canvas-height`,this._normalizeCssValue(a)):o.style.setProperty(`--off-canvas-width`,this._normalizeCssValue(this.getWidth())),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-off-canvas-header`,o.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-off-canvas-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let s=this._headingSlot.querySelector(`mint-text`);if(t?(s||(s=document.createElement(`mint-text`),s.setAttribute(`size`,`sub-heading`),s.setAttribute(`bold`,`true`),this._headingSlot.appendChild(s)),s.textContent=t,s.id=`${e||`mint-off-canvas`}-heading`,o.setAttribute(`aria-labelledby`,s.id),o.removeAttribute(`aria-label`)):s&&s.remove(),!t){let e=this.getAttribute(`aria-label`)?.trim();e?o.setAttribute(`aria-label`,e):o.hasAttribute(`aria-label`)||o.setAttribute(`aria-label`,`Dialog`)}Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.setAttribute(`aria-label`,`Close panel`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-off-canvas-body`,this._bodySlot.setAttribute(`slot`,`body`),o.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-off-canvas-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),o.appendChild(this._actionsSlot));let c=this._actionsSlot.querySelector(`mint-stack`);c||(c=document.createElement(`mint-stack`),c.setAttribute(`direction`,`horizontal`),c.className=`mint-off-canvas-actions-stack`,this._actionsSlot.appendChild(c)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==c&&c.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._offCanvas&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)})}_getTransformValue(e,t){if(t)switch(e){case`top`:return`translateY(0)`;case`bottom`:return`translateY(0)`;case`left`:return`translateX(0)`;case`right`:return`translateX(0)`;default:return`translateX(0)`}else switch(e){case`top`:return`translateY(-100%)`;case`bottom`:return`translateY(100%)`;case`left`:return`translateX(-100%)`;case`right`:return`translateX(100%)`;default:return`translateX(100%)`}}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getDialogFocusableElements(e){return Array.from(e.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>{if(e.closest(`[hidden], [aria-hidden="true"]`))return!1;let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}_animateEnter(){let e=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!e)return;this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null);let t=this.getPosition(),n=!this._dialogWasOpen;if(n){this._dialogWasOpen=!0;let e=document.activeElement;this._previousFocus=e instanceof HTMLElement&&e!==document.body?e:null}e.style.transform=this._getTransformValue(t,!1),e.style.transition=`transform 300ms ease-out`,this.classList.remove(`mint-off-canvas-hidden`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isOpen()&&(this.classList.add(`mint-off-canvas-open`),e.style.transform=this._getTransformValue(t,!0),n&&(this._getDialogFocusableElements(e)[0]??e).focus())})})}_animateExit(){this.classList.remove(`mint-off-canvas-open`);let e=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!e){this.classList.add(`mint-off-canvas-hidden`),this._dialogWasOpen=!1;return}let t=this.getPosition();e.style.transition=`transform 300ms ease-in`,e.style.transform=this._getTransformValue(t,!1),this._exitTimer!==null&&clearTimeout(this._exitTimer),this._exitTimer=window.setTimeout(()=>{if(this._exitTimer=null,this.isOpen())return;this.classList.add(`mint-off-canvas-hidden`),e.style.transform=``,e.style.transition=``;let t=this._previousFocus;this._previousFocus=null,t?.isConnected&&t.focus()},300)}};customElements.get(`mint-off-canvas`)||a(`mint-off-canvas`,yn),s({name:`search`,viewBox:`0 0 24 24`,path:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`,strokeLinecap:`round`,strokeLinejoin:`round`});var bn={"-mr-1":`rtu-8956a4275`,"-translate-y-1/2":`rtu-36b381be4`,"[&>*]:m-0":`rtu-7b41b3d11`,"[&>*]:max-w-full":`rtu-ba23a8c34`,"[&>*]:min-h-0":`rtu-860618883`,"[&>*]:min-w-0":`rtu-85a48d872`,"[&>*]:p-0":`rtu-299511c44`,"[&>*]:w-full":`rtu-d26168286`,"[&>span]:flex":`rtu-684665eca`,"[&>span]:h-full":`rtu-e4b40d71e`,"[&>span]:items-stretch":`rtu-d7d251fc2`,"[&>span]:justify-stretch":`rtu-86ed0d205`,"[&>span]:min-h-0":`rtu-f145dfde7`,"[&>span]:min-w-0":`rtu-0a6cfb970`,"[&>span]:w-full":`rtu-85ca68177`,"[&_img]:!block":`rtu-83fb557c2`,"[&_img]:!border-0":`rtu-2288f2d07`,"[&_img]:!box-border":`rtu-9253a17e4`,"[&_img]:!h-full":`rtu-07505e4a3`,"[&_img]:!m-0":`rtu-52565be3c`,"[&_img]:!max-h-full":`rtu-9b7f93d32`,"[&_img]:!max-w-full":`rtu-690df1880`,"[&_img]:!min-h-0":`rtu-a6c91024c`,"[&_img]:!min-w-0":`rtu-249d05caa`,"[&_img]:!object-center":`rtu-c24cf3532`,"[&_img]:!object-cover":`rtu-5c4ff5239`,"[&_img]:!p-0":`rtu-45a528345`,"[&_img]:!rounded-none":`rtu-6b1008ffa`,"[&_img]:!w-full":`rtu-ce262d06f`,"[-webkit-overflow-scrolling:touch]":`rtu-66a5833b4`,absolute:`rtu-da4dbfbc4`,"align-baseline":`rtu-8d378d3b6`,"animate-pulse":`rtu-d59b97947`,"animate-spin":`rtu-afbdd13a3`,"bg-gray-100":`rtu-d260f3e1b`,"bg-gray-200":`rtu-fcf159058`,"bg-white":`rtu-5e10cdb8f`,block:`rtu-0214b4b35`,border:`rtu-ca6bcd4b6`,"border-0":`rtu-119b2aa0b`,"border-2":`rtu-65935df57`,"border-b":`rtu-65fdbade2`,"border-collapse":`rtu-4583f90cd`,"border-gray-200":`rtu-534158080`,"border-gray-300":`rtu-5ab1f191a`,"border-t":`rtu-b950dda29`,"border-t-gray-700":`rtu-2f99a0daf`,"box-border":`rtu-7906320e4`,"cursor-pointer":`rtu-345168367`,"dark:bg-mint-canvas":`rtu-91530d570`,"dark:bg-mint-hover":`rtu-f3646e34b`,"dark:bg-mint-nav":`rtu-ef1a5fba7`,"dark:bg-white/15":`rtu-2a035a254`,"dark:border-gray-600":`rtu-17b5ca3ec`,"dark:border-mint-divider":`rtu-785e12750`,"dark:border-t-gray-200":`rtu-d1e9bc81b`,"dark:hover:bg-gray-800":`rtu-c211aa745`,"dark:hover:bg-mint-elevated":`rtu-e02bea78e`,"dark:text-gray-400":`rtu-cd05fca6d`,"dark:text-gray-500":`rtu-cae7d218d`,"dark:text-gray-600":`rtu-916f092fc`,"dark:text-red-400":`rtu-150dc4530`,"dark:text-white":`rtu-889e4e871`,fixed:`rtu-7bc555991`,flex:`rtu-60fbb7713`,"flex-1":`rtu-36e579c0b`,"flex-col":`rtu-8dddea077`,"flex-nowrap":`rtu-51ecff099`,"font-normal":`rtu-8ecebc9f8`,"font-semibold":`rtu-e83a7042b`,"gap-0.5":`rtu-a3899220f`,"gap-1":`rtu-44ee8ba0a`,"gap-2":`rtu-77a2a20e9`,"gap-3":`rtu-1004c0c39`,"h-3":`rtu-6a60c09e6`,"h-4":`rtu-11e59c6d5`,"h-full":`rtu-668b21aa5`,hidden:`rtu-99d72c7fc`,"hover:bg-gray-50":`rtu-6c0fe2c8e`,"inline-block":`rtu-bb0c4bfc5`,"inline-flex":`rtu-52083e7da`,"items-center":`rtu-3960ffc24`,"items-start":`rtu-60541e1e2`,"items-stretch":`rtu-a13d486c1`,"justify-between":`rtu-8ef2268ef`,"justify-center":`rtu-86843cf1e`,"justify-end":`rtu-77c08e015`,"leading-snug":`rtu-e25ca6535`,"left-3":`rtu-22e59b722`,"list-none":`rtu-b20d79b23`,"m-0":`rtu-74f9876a6`,"max-w-[95%]":`rtu-80fa57ccf`,"max-w-none":`rtu-2191c1456`,"max-w-xs":`rtu-3acf64d53`,"mb-3":`rtu-1bb883263`,"md:block":`rtu-9d60be3a6`,"md:border-t-0":`rtu-f6099fc6b`,"md:flex":`rtu-7651aeb99`,"md:hidden":`rtu-e477a6af4`,"md:justify-end":`rtu-70ce0294b`,"md:mt-4":`rtu-ef9aeb563`,"md:pt-0":`rtu-30dec114f`,"md:py-0":`rtu-3957f1b8e`,"min-h-0":`rtu-fb7302e53`,"min-w-0":`rtu-7e0b7cdf1`,"min-w-[11rem]":`rtu-46b2fd2eb`,"ml-2":`rtu-c68af9986`,"mr-0":`rtu-719fceda9`,"mr-2":`rtu-d2347e849`,"overflow-hidden":`rtu-2cd02d11d`,"overflow-x-auto":`rtu-1384f66f4`,"overflow-x-hidden":`rtu-e271e6ae1`,"overflow-y-auto":`rtu-92bf82f49`,"overflow-y-hidden":`rtu-b70fd23f6`,"overscroll-x-contain":`rtu-63ccdaaca`,"p-0":`rtu-8a539c7fe`,"p-1":`rtu-eb6a3cef9`,"p-3.5":`rtu-56796a90b`,"p-4":`rtu-8e63407b5`,"pb-3.5":`rtu-2d1f72154`,"pl-0":`rtu-d569803f7`,"pointer-events-none":`rtu-a4326536b`,"pr-4":`rtu-ba64a7c03`,"pt-3":`rtu-ce335a8e4`,"px-1":`rtu-d8e0e382c`,"px-2":`rtu-d5eab218a`,"px-3.5":`rtu-e0d9cc7f0`,"px-4":`rtu-f0faeb26d`,"py-0.5":`rtu-465609a24`,"py-2":`rtu-03b4dd7f1`,"py-3":`rtu-1b2d54a3f`,"py-3.5":`rtu-69e76918f`,"py-8":`rtu-a1f611f02`,rounded:`rtu-07389a777`,"rounded-full":`rtu-ac204c108`,"rounded-md":`rtu-421ac2be5`,"rounded-t-none":`rtu-79ee0e356`,"shrink-0":`rtu-012fbd121`,sticky:`rtu-3e0fd166d`,table:`rtu-c3ee137d4`,"table-fixed":`rtu-604d60250`,"text-center":`rtu-ca6bf6303`,"text-gray-300":`rtu-5ed47f375`,"text-gray-400":`rtu-a572cdde6`,"text-gray-500":`rtu-5a630e0cf`,"text-gray-900":`rtu-ba48f7479`,"text-left":`rtu-2eba0d65d`,"text-red-500":`rtu-e3f51cc69`,"text-sm":`rtu-fc7473ca0`,"text-xs":`rtu-359090c2d`,"top-0":`rtu-2167406b2`,"top-1/2":`rtu-d694ba66e`,truncate:`rtu-f283ea9be`,"w-4":`rtu-dc7972ebf`,"w-40":`rtu-84789e8a2`,"w-full":`rtu-6da6a3c3f`,"w-max":`rtu-2f935d2ee`,"z-10":`rtu-236812d64`,"z-20":`rtu-145745bf5`,"z-30":`rtu-0f2fff0ae`},xn=class extends HTMLElement{constructor(...e){super(...e),this._observer=null}connectedCallback(){this.classList.add(`mint-table-host`),this._observeChanges(),this._applyStyles(),requestAnimationFrame(()=>{this._applyStyles(),setTimeout(()=>this._applyStyles(),0)})}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}_observeChanges(){this._observer=new MutationObserver(()=>this._applyStyles()),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!1})}_applyStyles(){this._observer?.disconnect();let e=Array.from(this.querySelectorAll(`table`));if(e.length===0){this._observer&&this._observeChanges();return}e.forEach(e=>{let t=!!e.closest(`[id^="mint-rt-vscroll-"]`)||!!e.closest(`mint-resource-table[data-mint-rt-fixed-header]`);e.classList.add(`mint-table-native`),e.classList.toggle(`mint-table-pinned-layout`,t)});let t=e.find(e=>e.querySelector(`thead`))??e[0],n=e.find(e=>e.querySelector(`tbody`))??e[0],r=t.querySelector(`thead`);r&&r.querySelectorAll(`th`).forEach(e=>{let t=e.querySelector(`mint-icon`),n=t?.getAttribute(`name`)||``,r=e.hasAttribute(`data-mint-rt-sortable`)||t!==null&&n!==`ellipsis`;e.classList.toggle(`mint-table-sortable`,r);let i=e.closest(`table`),a=i?.closest(`mint-resource-table`),o=!!i?.closest(`[id^="mint-rt-vscroll-"]`)||!!a?.hasAttribute(`data-mint-rt-fixed-header`);e.classList.toggle(`mint-table-pinned-header`,o)});let i=n.querySelector(`tbody`);if(i){let e=Array.from(i.querySelectorAll(`tr`)),t=!!n.closest(`[id^="mint-rt-vscroll-"]`)||!!n.closest(`mint-resource-table`)?.hasAttribute(`data-mint-rt-fixed-header`),r=e.findIndex(e=>e.getAttribute(`data-mint-rt-spacer`)===`bottom`);e.forEach((n,i)=>{let a=n.hasAttribute(`data-mint-rt-spacer`),o=n.hasAttribute(`data-row-clickable`);n.classList.toggle(`mint-table-spacer`,a),n.classList.toggle(`mint-table-clickable`,o&&!a),n.classList.toggle(`mint-table-row-bordered`,!a&&!t&&i!==e.length-1),Array.from(n.querySelectorAll(`td`)).forEach(o=>{let s=n.hasAttribute(`data-mint-rt-last-row`),c=r===-1&&i===e.length-1;o.classList.toggle(`mint-table-cell-bordered`,t&&!a&&!s&&!c),this._restoreCell(o)})})}n.querySelectorAll(`tfoot td`).forEach(e=>this._restoreCell(e)),this._observer&&this._observeChanges()}_restoreCell(e){if(e.dataset.mtProcessed!==`true`)return;let t={};Array.from(e.attributes).forEach(e=>{e.name.startsWith(`data-`)&&e.name!==`data-original`&&e.name!==`data-mt-processed`&&(t[e.name]=e.value)});let n=e.getAttribute(`data-original`)||``;e.dataset.mtProcessed=``,e.innerHTML=n,Object.entries(t).forEach(([t,n])=>e.setAttribute(t,n))}};customElements.get(`mint-table`)||a(`mint-table`,xn);var Sn=class extends HTMLElement{static get observedAttributes(){return[`configuration`,`loading`,`virtual-scroll`,`virtual-scroll-root`,`virtual-row-height`,`virtual-max-height`,`fixed-header`,`fixed-controls`]}_isExternalLoading(){let e=this.getAttribute(`loading`);return e!==null&&e!==`false`}constructor(){super(),this._configuration=null,this._rows=[],this._search=``,this._currentPage=1,this._perPage=15,this._totalRows=0,this._lastPage=0,this._offset=0,this._loaded=!1,this._fetching=!1,this._loading=!1,this._loadingPage=null,this._fetchError=null,this._searching=!1,this._sorting=!1,this._sortingColumn=null,this._type=`provided`,this._searchTimeoutId=null,this._sortTimeoutId=null,this._searchColumns=[],this._exportColumns={},this._columns=[],this._tableId=``,this._searchInput=null,this._tableContainer=null,this._paginationContainer=null,this._skeletonContainer=null,this._inMintCard=!1,this._virtualBodyScrollEl=null,this._virtualScrollHandler=null,this._virtualWindowRaf=null,this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``,this._virtualResizeObserver=null,this._virtualWindowResizeHandler=null,this._virtualRowCache=new Map,this._virtualRangeFetching=!1,this._mobileListMql=null,this._boundMobileListMqlListener=null,this._virtualFetchGeneration=0,this._virtualAjaxPrefetchTimer=null,this._fixedChromeResizeObserver=null,this._utilityClassObserver=null}get inMintCard(){return this._inMintCard}get configuration(){return this._configuration}set configuration(e){e&&typeof e==`object`&&!Array.isArray(e)?(this._configuration=e,this._tableId=this._configuration.id||`mint-resource-table-${Date.now()}`,this._perPage=this._configuration.perPage||15,this._type=typeof this._configuration.data==`string`?`ajax`:`provided`,this._loaded=!1,this._currentPage=1,this._offset=0,this._type===`provided`&&Array.isArray(this._configuration.data)&&(this._rows=[...this._configuration.data],this._totalRows=this._configuration.data.length),this._initializeColumns(),this.isConnected&&this.render()):e==null?this._configuration=null:this._parseConfiguration()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._utilityClassObserver=new MutationObserver(()=>this._replaceUtilityClasses()),this._utilityClassObserver.observe(this,{attributes:!0,attributeFilter:[`class`],childList:!0,subtree:!0}),this._inMintCard=this.parentElement?.tagName?.toLowerCase()===`mint-card`,this._configuration||this._parseConfiguration(),this._initializeColumns(),this._loadPageFromUrl(),this._attachRowClickHandler(),this.render()}disconnectedCallback(){this._searchTimeoutId&&clearTimeout(this._searchTimeoutId),this._detachVirtualScroll(),this._detachFixedChromeResize(),this._detachMobileListMql(),this._utilityClassObserver?.disconnect(),this._utilityClassObserver=null,this._rowClickHandler&&=(this.removeEventListener(`click`,this._rowClickHandler,!0),null),this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}attributeChangedCallback(e,t,n){e===`configuration`&&t!==n?(!this._configuration||typeof n==`string`)&&(this._parseConfiguration(),this.render()):t!==n&&(e===`loading`||e===`virtual-scroll`||e===`virtual-scroll-root`||e===`virtual-row-height`||e===`virtual-max-height`||e===`fixed-header`||e===`fixed-controls`)&&this._configuration&&this.isConnected&&this.render()}refresh(){this._configuration&&(this._type===`ajax`?this._fetchData(void 0,!0,this._perPage,this._offset):(Array.isArray(this._configuration.data)&&(this._rows=[...this._configuration.data],this._totalRows=this._rows.length),this.render()))}setData(e){if(this._configuration){if(this._configuration.data=e,this._type=typeof e==`string`?`ajax`:`provided`,this._currentPage=1,this._offset=0,this._fetchError=null,this._searching=!1,this._loadingPage=null,this._sortTimeoutId&&=(clearTimeout(this._sortTimeoutId),null),this._searchTimeoutId&&=(clearTimeout(this._searchTimeoutId),null),this._virtualScrollActive()&&(this._virtualRowCache.clear(),this._virtualInvalidate()),this._type===`ajax`){this._rows=[],this._totalRows=0,this._lastPage=0,this._loaded=!1,this._fetching=!1,this._loading=!1,this._fetchData(void 0,!0,this._perPage,0);return}this._rows=Array.isArray(e)?[...e]:[],this._totalRows=this._rows.length,this._lastPage=Math.max(1,Math.ceil(this._totalRows/this._perPage)),this._loaded=!0,this._fetching=!1,this._loading=!1,this.render()}}_parseConfiguration(){let e=this.getAttribute(`configuration`);if(!e){console.error(`mint-resource-table: configuration attribute is required`);return}try{this._configuration=JSON.parse(e),this._tableId=this._configuration.id||`mint-resource-table-${Date.now()}`,this._perPage=this._configuration.perPage||15,this._type=typeof this._configuration.data==`string`?`ajax`:`provided`,this._loaded=!1,this._currentPage=this._getPageFromUrl()||1,this._offset=(this._currentPage-1)*this._perPage,this._type===`provided`&&Array.isArray(this._configuration.data)&&(this._rows=[...this._configuration.data],this._totalRows=this._configuration.data.length),this._initializeColumns()}catch(e){console.error(`mint-resource-table: Invalid configuration JSON`,e)}}_initializeColumns(){this._configuration&&(this._searchColumns=[],this._exportColumns={},this._columns=[],this._configuration.columns.forEach(e=>{e.searchable&&e.data&&this._searchColumns.push(e.data),e.export&&e.data&&(this._exportColumns[e.data]=e.label),e.data&&this._columns.push(e.data)}),this._configuration.sortBy||(this._configuration.sortBy=`id`),this._configuration.sort||(this._configuration.sort=`asc`))}async _fetchData(e,t=!0,n,r){if(!this._configuration)return;let i=e||(typeof this._configuration.data==`string`?this._configuration.data:null);if(!i||this._fetching||this._loading)return;t&&(this._fetching=!0,this._loaded?this._updatePagination():this.render()),this._loading=!0;let a=n||this._perPage,o=r===void 0?this._offset:r;this._virtualScrollActive()&&this._type===`ajax`&&o===0&&(this._virtualFetchGeneration++,this._virtualRowCache.clear(),this._virtualInvalidate());try{let e=new URLSearchParams({perPage:a.toString(),offset:o.toString(),search:this._search,sortBy:this._configuration.sortBy||`id`,sort:this._configuration.sort||`asc`,searchColumns:this._searchColumns.join(`,`),columns:this._columns.join(`,`)}),t={};this._configuration.headers&&(t.headers=this._configuration.headers);let n=await fetch(`${i}?${e.toString()}`,t);if(!n.ok)throw Error(`HTTP error! status: ${n.status}`);let r=await n.json(),s=r.content?.rows||[],c=r.content?.total||0,l=s;this._configuration.predefinedData?(l=[...this._configuration.predefinedData,...s],this._totalRows=c+this._configuration.predefinedData.length):this._totalRows=c,this._rows=l;let u=Math.floor(o/a)+1;r.content?.current_page!==void 0&&r.content.current_page===u?this._currentPage=r.content.current_page:this._currentPage=u,this._offset=(this._currentPage-1)*a,this._lastPage=r.content?.last_page||1,this._fetching=!1,this._loaded=!0,this._loading=!1,this._fetchError=null,this._searching=!1;let d=this._sorting;d&&this._updateSortIcons(),this._sorting=!1,this._sortingColumn=null,d&&this._updateSortIcons(),this.dispatchEvent(new CustomEvent(`loaded`,{detail:{rows:this._rows}})),this._updateSearchIcon();let f=`tbody[data-mint-rt-tbody="${this._tableId}"]`,p=!!this.querySelector(f);if(this._virtualScrollActive()&&this._type===`ajax`)p||this.render(),s.forEach((e,t)=>{this._virtualRowCache.set(o+t,e)}),this._virtualInvalidate(),o===0?queueMicrotask(()=>this._scrollVirtualTableTopIntoView()):this._scheduleVirtualWindowSync(),this._loadingPage,this._loadingPage=null,this._updatePagination(),setTimeout(()=>{let e=this._paginationMountedRoot();e&&e.querySelectorAll(`mint-button[data-action="page"]`).forEach(e=>{`render`in e&&typeof e.render==`function`&&e.render()})},0);else if(this.querySelector(`#${this._tableId}`)?.closest(`table`)?.querySelector(`tbody`)){if(d){let e=this._loading,t=this._fetching;this._loading=!1,this._fetching=!1,this._updateTableBody(),this._loading=e,this._fetching=t}else this._updateTableBody();this._loadingPage,this._loadingPage=null,this._updatePagination(),setTimeout(()=>{let e=this._paginationMountedRoot();e&&e.querySelectorAll(`mint-button[data-action="page"]`).forEach(e=>{`render`in e&&typeof e.render==`function`&&e.render()})},0)}else this.render()}catch(e){this._fetching=!1,this._loading=!1,this._loadingPage=null,this._loaded=!0,this._searching=!1,this._fetchError=e instanceof Error?e.message:`Failed to fetch data`,console.error(`mint-resource-table: Error fetching data`,e),this._updateSearchIcon(),this.querySelector(`#${this._tableId}`)?.closest(`table`)?.querySelector(`tbody`)?(this._updateTableBody(),this._loadingPage=null,this._updatePagination()):this.render()}}_getRows(){if(!this._configuration)return[];if(this._type===`ajax`)return this._rows;let e=[...this._rows],t=this._configuration.sortBy||`id`,n=this._configuration.sort||`asc`;if(this._search){let t=this._search.toLowerCase().trim().split(/\s+/);e=e.filter(e=>{let n=Object.values(e).map(e=>String(e).toLowerCase()).join(` `);return t.every(e=>n.includes(e))})}if(e.sort((e,r)=>{let i=e[t],a=r[t];if(i==null&&a==null)return 0;if(i==null)return 1;if(a==null)return-1;let o=typeof i==`number`?i:typeof i==`string`&&!isNaN(Number(i))&&i.trim()!==``?Number(i):null,s=typeof a==`number`?a:typeof a==`string`&&!isNaN(Number(a))&&a.trim()!==``?Number(a):null;if(o!==null&&s!==null){let e=o-s;return n===`asc`?e:-e}let c=i instanceof Date?i:typeof i==`string`?new Date(i):null,l=a instanceof Date?a:typeof a==`string`?new Date(a):null;if(c&&l&&!isNaN(c.getTime())&&!isNaN(l.getTime())){let e=c.getTime()-l.getTime();return n===`asc`?e:-e}let u=String(i).localeCompare(String(a),void 0,{numeric:!0,sensitivity:`base`});return n===`asc`?u:-u}),this._perPage){let t=Math.ceil(e.length/this._perPage);this._lastPage=t,e.forEach((e,t)=>{e.page=Math.ceil((t+1)/this._perPage)}),this._currentPage>t&&t>0&&(this._currentPage=t)}return e.filter(e=>!this._perPage||e.page===this._currentPage)}_getAllFilteredRowsSorted(){if(!this._configuration||this._type!==`provided`)return[];let e=[...this._rows],t=this._configuration.sortBy||`id`,n=this._configuration.sort||`asc`;if(this._search){let t=this._search.toLowerCase().trim().split(/\s+/);e=e.filter(e=>{let n=Object.values(e).map(e=>String(e).toLowerCase()).join(` `);return t.every(e=>n.includes(e))})}return e.sort((e,r)=>{let i=e[t],a=r[t];if(i==null&&a==null)return 0;if(i==null)return 1;if(a==null)return-1;let o=typeof i==`number`?i:typeof i==`string`&&!isNaN(Number(i))&&i.trim()!==``?Number(i):null,s=typeof a==`number`?a:typeof a==`string`&&!isNaN(Number(a))&&a.trim()!==``?Number(a):null;if(o!==null&&s!==null){let e=o-s;return n===`asc`?e:-e}let c=i instanceof Date?i:typeof i==`string`?new Date(i):null,l=a instanceof Date?a:typeof a==`string`?new Date(a):null;if(c&&l&&!isNaN(c.getTime())&&!isNaN(l.getTime())){let e=c.getTime()-l.getTime();return n===`asc`?e:-e}let u=String(i).localeCompare(String(a),void 0,{numeric:!0,sensitivity:`base`});return n===`asc`?u:-u}),e}_virtualInvalidate(){this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``}_getRowDataForEventIndex(e){if(this._configuration){if(!this._virtualScrollActive())return this._getRows()[e];if(this._type===`provided`)return this._getAllFilteredRowsSorted()[e];if(this._type===`ajax`)return this._virtualRowCache.get(e)}}getRowByIndex(e){return this._getRowDataForEventIndex(e)}_virtualScrollActive(){return this._configuration?(this.getAttribute(`virtual-scroll`)||``).toLowerCase().trim()===`true`:!1}_virtualScrollRoot(){let e=(this.getAttribute(`virtual-scroll-root`)||``).toLowerCase().trim();return e===`table-body`||e===`body`||this._configuration?.virtualScrollRoot===`table-body`?`table-body`:`document`}_virtualBodyScrollDisablesDocumentFixedChrome(){return this._virtualScrollActive()&&this._virtualScrollRoot()===`table-body`}_fixedHeader(){if(this._virtualBodyScrollDisablesDocumentFixedChrome()||!this.hasAttribute(`fixed-header`))return!1;let e=(this.getAttribute(`fixed-header`)||``).toLowerCase().trim();return e!==`false`&&e!==`0`}_fixedControls(){if(this._virtualBodyScrollDisablesDocumentFixedChrome()||!this.hasAttribute(`fixed-controls`))return!1;let e=(this.getAttribute(`fixed-controls`)||``).toLowerCase().trim();return e!==`false`&&e!==`0`}_virtualRowHeightPx(){let e=parseInt(this.getAttribute(`virtual-row-height`)||``,10);if(!isNaN(e)&&e>0)return e;let t=this._configuration?.virtualRowHeight;return typeof t==`number`&&t>0?t:48}_virtualRowHeightPxForSync(e){let t=this._virtualRowHeightPx();if(!this._configuration)return t;if(e){let e=this._mobileThumbnailColumn();if(e){let n=this._thumbnailMobilePx(e);return Math.max(t,n+36)}return Math.max(t,80)}let n=this._mobileThumbnailColumn();if(n){let e=this._thumbnailDesktopPx(n);return Math.max(t,e+28)}return t}_virtualMaxHeightCss(){let e=this.getAttribute(`virtual-max-height`);if(e&&e.trim())return e.trim();let t=this._configuration?.virtualMaxHeight;return t&&String(t).trim()?String(t).trim():`min(70dvh, 28rem)`}_virtualColspan(){return this._configuration?Math.max(1,this._configuration.columns.filter(e=>!e.hidden).length):1}_ensureMobileListMql(){typeof window>`u`||!window.matchMedia||this._mobileListMql||(this._mobileListMql=window.matchMedia(`(max-width: 767px)`),this._boundMobileListMqlListener=()=>{this._configuration&&this.isConnected&&this.render()},this._mobileListMql.addEventListener(`change`,this._boundMobileListMqlListener))}_detachMobileListMql(){this._mobileListMql&&this._boundMobileListMqlListener&&this._mobileListMql.removeEventListener(`change`,this._boundMobileListMqlListener),this._mobileListMql=null,this._boundMobileListMqlListener=null}_useMobileListLayout(){return!!this._mobileListMql?.matches}_paginationHostPlaceholderHtml(){if(!this._configuration?.perPage||this._virtualScrollActive())return``;let e=this._lastPage||Math.ceil(this._rows.length/this._perPage);if((this._lastPage>0?this._lastPage:e)<=1)return``;let t=[`mint-rt-pagination-host`,`w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain`,`flex justify-center [-webkit-overflow-scrolling:touch] md:justify-end`,this._inMintCard?`border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider md:border-t-0 md:pt-0`:`border-t border-gray-200 px-2 py-3 dark:border-mint-divider md:border-t-0 md:py-0 md:mt-4`].join(` `);return`<div id="mint-rt-pagination-host-${this._tableId}" data-mint-rt-pagination-wrap="" class="${t}"></div>`}_getPaginationHostEl(){return this.querySelector(`#mint-rt-pagination-host-${this._tableId}`)}_paginationMountedRoot(){return this._getPaginationHostEl()||this.querySelector(`nav[data-mint-rt-pagination-nav]`)?.parentElement||this.querySelector(`nav`)?.closest(`.flex.justify-end`)}_paginationPageButtonLi(e){let t=this._currentPage===e,n=this._loadingPage===e;return`<li class="shrink-0"><mint-button variant="solid" size="sm"${t?` active="true"`:``}${this._loading||this._fetching?` disabled="true"`:``}${n?` loading="true"`:``} data-action="page" data-page="${e}">${n?``:`${e}`}</mint-button></li>`}_paginationHtmlCompactMiddle(e){let t=``,n=this._currentPage;if(e<=5){for(let n=1;n<=e;n++)t+=this._paginationPageButtonLi(n);return t}let r=[...new Set([1,e,n-1,n,n+1].map(t=>Math.min(e,Math.max(1,t))))].sort((e,t)=>e-t),i=0;for(let e of r)i>0&&e-i>1&&(t+=`<li class="shrink-0"><span class="px-1 text-gray-500 dark:text-gray-400" aria-hidden="true">…</span></li>`),t+=this._paginationPageButtonLi(e),i=e;return t}_paginationHtmlDesktopMiddle(e){let t=``,n=e>=10,r=Math.max(1,this._currentPage-1),i=Math.min(e,this._currentPage+1);if(n){for(let e=1;e<=3;e++)t+=this._paginationPageButtonLi(e);let n=i<=3,a=r>=e-2;if(!n&&!a){r>4&&(t+=`<li class="shrink-0"><span class="px-2">...</span></li>`);for(let e=r;e<=i;e++)e<=3||(t+=this._paginationPageButtonLi(e));i<e-3&&(t+=`<li class="shrink-0"><span class="px-2">...</span></li>`)}else (n&&!a||!n&&a&&e-2>4)&&(t+=`<li class="shrink-0"><span class="px-2">...</span></li>`);for(let o=e-2;o<=e;o++)o<=3||!n&&!a&&o>=r&&o<=i||(t+=this._paginationPageButtonLi(o))}else for(let n=1;n<=e;n++)t+=this._paginationPageButtonLi(n);return t}_buildPaginationNavMarkup(e){let t=this._currentPage===1||this._loading||this._fetching,n=`<nav data-mint-rt-pagination-nav="" class="w-max max-w-none shrink-0" aria-label="Pagination">`;n+=`<ul class="flex flex-nowrap items-center gap-1">`,n+=`<li class="shrink-0"><mint-button variant="solid" size="sm" icon="caret-left" ${t?`disabled="true"`:``} data-action="page-prev"></mint-button></li>`,n+=this._useMobileListLayout()?this._paginationHtmlCompactMiddle(e):this._paginationHtmlDesktopMiddle(e);let r=this._currentPage>=e||this._loading||this._fetching;return n+=`<li class="shrink-0"><mint-button variant="solid" size="sm" icon="caret-right" ${r?`disabled="true"`:``} data-action="page-next"></mint-button></li>`,n+=`</ul></nav>`,n}_hasSortableColumns(){return!!this._configuration?.columns.some(e=>!e.hidden&&e.sortable&&e.data)}_getMobileSortTriggerIconName(){return`sort-arrows`}_mobileSortPopoverAffordanceInnerHtml(e){return e===`spinner`?`<span class="inline-block h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700 dark:border-gray-600 dark:border-t-gray-200" aria-hidden="true"></span>`:e===`caret-up`||e===`caret-down`?`<mint-icon name="${e}" class="h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400"></mint-icon>`:``}_buildMobileSortPopoverInnerHtml(){if(!this._configuration)return``;let e=`<div class="flex w-full min-w-[11rem] flex-col gap-0.5 p-1">`;return this._configuration.columns.forEach((t,n)=>{if(t.hidden||!t.sortable||!t.data)return;let r=t.raw?t.label:this._escapeHtml(t.label),i=this._getSortClass(t),a=this._mobileSortPopoverAffordanceInnerHtml(i),o=` type="button" variant="ghost" tone="neutral" size="sm" full-width="true" align="left" data-action="mobile-sort" data-column-key="${n}"`;e+=`<mint-button${o}>`,e+=`<span class="flex w-full min-w-0 flex-1 items-center justify-between gap-2">`,e+=`<span class="min-w-0 flex-1 truncate text-left">${r}</span>`,e+=`<span class="inline-flex shrink-0 items-center justify-end" data-mint-rt-mobile-sort-affordance="">${a}</span>`,e+=`</span></mint-button>`}),e+=`</div>`,e}_syncMobileSortPopoverIcons(){if(!this._configuration)return;let e=this.querySelector(`#mint-rt-mobile-sort-popover-${this._tableId}`);e&&this._configuration.columns.forEach((t,n)=>{if(t.hidden||!t.sortable||!t.data)return;let r=e.querySelector(`[data-action="mobile-sort"][data-column-key="${n}"]`);if(!r||r.tagName!==`MINT-BUTTON`)return;let i=r.querySelector(`[data-mint-rt-mobile-sort-affordance]`);if(!i)return;let a=this._getSortClass(t);i.innerHTML=this._mobileSortPopoverAffordanceInnerHtml(a),i.querySelectorAll(`mint-icon`).forEach(e=>{let t=e;typeof t.render==`function`&&t.render()})})}_closeMobileSortPopover(){let e=this.querySelector(`#mint-rt-mobile-sort-popover-${this._tableId}`);e&&typeof e.close==`function`?e.close():e&&e.removeAttribute(`open`)}_buildMobileSortToolbarHtml(){if(!this._hasSortableColumns())return``;let e=`mint-rt-mobile-sort-btn-${this._tableId}`,t=`mint-rt-mobile-sort-popover-${this._tableId}`,n=this._sorting?` loading="true"`:``,r=` icon="${this._escapeHtml(this._getMobileSortTriggerIconName())}"`,i=`<div class="flex shrink-0 items-center md:hidden">`;return i+=`<mint-button id="${e}" data-mint-rt-toolbar="mobile-sort" variant="solid" tone="neutral" size="sm"${n}${r}></mint-button>`,i+=`<mint-popover id="${t}" trigger-id="${e}" direction="down" padding="0">`,i+=this._buildMobileSortPopoverInnerHtml(),i+=`</mint-popover></div>`,i}_stripHtml(e){if(!e)return``;let t=document.createElement(`div`);return t.innerHTML=e,(t.textContent||t.innerText||``).replace(/\s+/g,` `).trim()}_visibleDataColumns(){return this._configuration?this._configuration.columns.filter(e=>!e.hidden):[]}_mobileThumbnailColumn(){return this._visibleDataColumns().find(e=>e.thumbnail)||null}_thumbnailDesktopPx(e){let t=typeof e.thumbnailDesktopPx==`number`&&e.thumbnailDesktopPx>0?e.thumbnailDesktopPx:void 0,n=this._configuration,r=n&&typeof n.thumbnailDesktopPx==`number`&&n.thumbnailDesktopPx>0?n.thumbnailDesktopPx:void 0;return Math.round(t??r??40)}_thumbnailMobilePx(e){let t=typeof e.thumbnailMobilePx==`number`&&e.thumbnailMobilePx>0?e.thumbnailMobilePx:void 0,n=this._configuration,r=n&&typeof n.thumbnailMobilePx==`number`&&n.thumbnailMobilePx>0?n.thumbnailMobilePx:void 0;return Math.round(t??r??56)}_wrapThumbnailDesktopBox(e,t){let n=this._thumbnailDesktopPx(t);return`<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${`width:${n}px;height:${n}px;min-width:${n}px;min-height:${n}px`}">${e}</div>`}_mobilePrimaryColumn(){let e=this._visibleDataColumns();return e.find(e=>e.primary)||e.find(e=>(e.data||typeof e.format==`function`)&&!e.thumbnail&&!e.actions)||e[0]||null}_mobileActionsDropdownColumn(){return this._visibleDataColumns().find(e=>e.actions&&e.actionStyle!==`buttons`)||null}_columnPlainSummaryText(e,t){if(!(!e.show||e.show(this,t))||e.actions||e.action)return``;try{if(e.raw){if(typeof e.format==`function`)return this._stripHtml(e.format(this,t));if(e.data)return String(t[e.data]??``)}else{if(typeof e.format==`function`)return this._stripHtml(e.format(this,t));if(e.data)return String(t[e.data]??``)}}catch{return``}return``}_buildTableCellInnerHtml(e,t,n,r=`table`){if(!this._configuration)return``;let i=n,a=``;if(!(!e.show||e.show(this,t)))return``;if(e.raw)if(e.action){if(!e.action.show||e.action.show(this,t)){let n=typeof e.action.label==`function`?e.action.label(this,t):e.action.label;a+=`<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(n))}</mint-button>`}}else if(e.actions)if(e.actionStyle!==`buttons`){let n=`actions-popover-${this._tableId}-${i}`,r=`actions-button-${this._tableId}-${i}`;a+=`<mint-button id="${r}" variant="ghost" icon="ellipsis">`,a+=`</mint-button>`,a+=`<mint-popover id="${n}" trigger-id="${r}" direction="down">`,a+=`<div class="mint-resource-action-menu">`,e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=typeof n.label==`function`?n.label(this,t):n.label,s=n.icon?` icon="${this._escapeHtml(n.icon)}"`:``,c=n.variant?this._escapeHtml(n.variant):`ghost`,l=n.tone?` tone="${this._escapeHtml(n.tone)}"`:``;a+=`<mint-button variant="${c}" full-width="true" align="left" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${l}>${this._escapeHtml(String(o??``))}</mint-button>`}}),a+=`</div>`,a+=`</mint-popover>`}else e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=n.label?typeof n.label==`function`?n.label(this,t):n.label:``,s=n.icon?` icon="${this._escapeHtml(n.icon)}"`:``,c=n.variant?` variant="${this._escapeHtml(n.variant)}"`:` variant="ghost"`,l=n.tone?` tone="${this._escapeHtml(n.tone)}"`:``;a+=`<mint-button${c} class="${n.classes||``}" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${l}>`,o&&(a+=this._escapeHtml(String(o))),a+=`</mint-button>`}});else typeof e.format==`function`?a+=e.format(this,t):e.data&&(a+=this._escapeHtml(String(t[e.data]||``)));else if(e.action)(!e.action.show||e.action.show(this,t))&&(a+=`<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${e.action.label}</mint-button>`);else if(e.actions)if(e.actionStyle!==`buttons`){let n=`actions-popover-${this._tableId}-${i}`,r=`actions-button-${this._tableId}-${i}`;a+=`<mint-button id="${r}" variant="ghost" icon="ellipsis">`,a+=`</mint-button>`,a+=`<mint-popover id="${n}" trigger-id="${r}" direction="down">`,a+=`<div class="mint-resource-action-menu">`,e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=typeof n.label==`function`?n.label(this,t):n.label,s=n.icon?` icon="${this._escapeHtml(n.icon)}"`:``,c=n.variant?this._escapeHtml(n.variant):`ghost`,l=n.tone?` tone="${this._escapeHtml(n.tone)}"`:``;a+=`<mint-button variant="${c}" full-width="true" align="left" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${l}>${this._escapeHtml(String(o??``))}</mint-button>`}}),a+=`</div>`,a+=`</mint-popover>`}else e.actions.forEach((n,r)=>{if(!n.show||n.show(this,t)){let o=n.label?typeof n.label==`function`?n.label(this,t):n.label:``,s=n.icon?` icon="${this._escapeHtml(n.icon)}"`:``,c=n.variant?` variant="${this._escapeHtml(n.variant)}"`:` variant="ghost"`,l=n.tone?` tone="${this._escapeHtml(n.tone)}"`:``;a+=`<mint-button${c} class="${n.classes||``}" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${l}>`,o&&(a+=this._escapeHtml(String(o))),a+=`</mint-button>`}});else typeof e.format==`function`?a+=this._escapeHtml(e.format(this,t)):e.data&&(a+=this._escapeHtml(String(t[e.data]||``)));return r===`table`&&e.thumbnail&&a&&!e.actions&&!e.action?this._wrapThumbnailDesktopBox(a,e):a}_buildMobileListItemHtml(e,t,n,r=!1){if(!this._configuration)return``;let i=t,a=typeof this._configuration.onRowClick==`function`,o=this._mobileThumbnailColumn(),s=this._mobilePrimaryColumn(),c=this._mobileActionsDropdownColumn(),l=o?this._buildTableCellInnerHtml(o,e,i,`mobile`):``,u=s?this._buildTableCellInnerHtml(s,e,i,`mobile`):``,d=c?this._buildTableCellInnerHtml(c,e,i,`mobile`):``,f=[],p=this._configuration.mobileShowLabels===!0;for(let t of this._configuration.columns){if(t.hidden||o&&t===o||s&&t===s||c&&t===c)continue;let n=this._columnPlainSummaryText(t,e);if(n)if(p){let e=this._stripHtml(String(t.label||``)).trim();e?f.push(`${this._escapeHtml(e)}: ${this._escapeHtml(n)}`):f.push(this._escapeHtml(n))}else f.push(this._escapeHtml(n))}let m=f.join(`<span class="text-gray-300 dark:text-gray-600" aria-hidden="true"> · </span>`),h=[`list-none`,...r?[]:[`border-b`,`border-gray-200`,`dark:border-mint-divider`],`bg-white`,`dark:bg-mint-canvas`,a?`cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated`:``].filter(Boolean).join(` `),g=`<div class="flex items-center gap-3 py-3 pr-4${o?` pl-0`:` pl-4`}">`;if(o){let e=this._thumbnailMobilePx(o),t=`width:${e}px;height:${e}px;min-width:${e}px;min-height:${e}px`;g+=`<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${t}">${l}</div>`}g+=`<div class="flex min-w-0 flex-1 flex-col justify-center gap-1">`,g+=`<div class="flex items-start justify-between gap-2">`,g+=`<div class="min-w-0 text-sm font-semibold leading-snug text-gray-900 dark:text-white">${u}</div>`,d&&(g+=`<div class="shrink-0 -mr-1">${d}</div>`),g+=`</div>`,m&&(g+=`<div class="text-xs font-normal leading-snug text-gray-500 dark:text-gray-400">${m}</div>`),g+=`</div></div>`;let _=typeof n==`number`&&n>0?` style="box-sizing:border-box;min-height:${n}px;max-height:${n}px;height:${n}px;overflow:hidden"`:``;return`<li data-row-index="${i}" ${a?`data-row-clickable="true" `:``}class="${h}"${_}>${g}</li>`}_buildMobileListPlaceholderLi(e,t,n=!1){let r=this._mobileThumbnailColumn(),i=r?this._thumbnailMobilePx(r):56,a=`width:${i}px;height:${i}px;min-width:${i}px;min-height:${i}px`;return`<li data-row-index="${e}" data-mint-rt-placeholder="true" class="list-none${n?``:` border-b border-gray-200 dark:border-mint-divider`} bg-white dark:bg-mint-canvas" style="box-sizing:border-box;min-height:${t}px;max-height:${t}px;height:${t}px;overflow:hidden"><div class="flex h-full min-h-0 items-center gap-3 py-3 pl-0 pr-4"><div class="shrink-0 overflow-hidden rounded-md bg-gray-200 dark:bg-white/15" style="${a}"></div><div class="flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 py-0.5"><div class="h-4 w-40 rounded bg-gray-200 dark:bg-white/15"></div><div class="h-3 w-full max-w-xs rounded bg-gray-200 dark:bg-white/15"></div></div></div></li>`}_renderColgroupHtml(){if(!this._configuration)return``;let e=this._configuration.columns.filter(e=>!e.hidden),t=[],n=0;for(let r of e){let e=r.width==null?``:String(r.width).trim();e?/^\d+(\.\d+)?$/.test(e)?(n+=parseFloat(e),t.push(`px`)):t.push(`lit`):t.push(`flex`)}let r=t.filter(e=>e===`flex`).length,i=t.includes(`lit`),a=``;r>0&&!i&&(a=n>0?`width:calc((100% - ${n}px) / ${r});min-width:0`:`width:${100/r}%;min-width:0`);let o=`<colgroup>`;return e.forEach((e,n)=>{let r=e.width==null?``:String(e.width).trim(),i=t[n],s=``;i===`px`?s=` style="width:${r}px;min-width:0"`:i===`lit`?s=` style="width:${this._escapeHtml(r)};min-width:0"`:a&&(s=` style="${a}"`),o+=`<col${s} />`}),o+=`</colgroup>`,o}_buildDataRowHtml(e,t,n,r=!1){if(!this._configuration)return``;let i=t,a=n,o=`box-sizing:border-box;min-height:${a}px;max-height:${a}px;height:${a}px;overflow:hidden`,s=``,c=typeof this._configuration.onRowClick==`function`,l=c?`cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800`:``,u=c?` data-row-clickable="true"`:``,d=l?` class="${l}"`:``;return s+=`<tr data-row-index="${i}"${r?` data-mint-rt-last-row=""`:``}${u}${d} style="${o}">`,this._configuration.columns.forEach(t=>{if(t.hidden)return;let n=!t.show||t.show(this,e),r=`${this._getStyle(t)}box-sizing:border-box;max-height:${a}px;overflow:hidden;vertical-align:middle;`;s+=`<td style="${r}" class="${this._getClasses(t,!0)}">`,s+=n?this._buildTableCellInnerHtml(t,e,i):``,s+=`</td>`}),s+=`</tr>`,s}_getVirtualRowCount(){return!this._virtualScrollActive()||!this._configuration?0:this._type===`provided`?this._getAllFilteredRowsSorted().length:this._type===`ajax`?this._totalRows:0}_getVirtualRowAt(e){return this._type===`provided`?this._getAllFilteredRowsSorted()[e]??null:this._type===`ajax`&&this._virtualRowCache.has(e)?this._virtualRowCache.get(e):null}_buildVirtualPlaceholderRowHtml(e,t,n=!1){if(!this._configuration)return``;let r=t,i=`box-sizing:border-box;min-height:${r}px;max-height:${r}px;height:${r}px;overflow:hidden`,a=`<tr data-row-index="${e}" data-mint-rt-placeholder="true"${n?` data-mint-rt-last-row=""`:``} class="bg-white dark:bg-mint-canvas" style="${i}">`;return this._configuration.columns.forEach(e=>{if(e.hidden)return;let t=`${this._getStyle(e)}box-sizing:border-box;max-height:${r}px;height:${r}px;overflow:hidden;vertical-align:middle;line-height:0;`;if(a+=`<td style="${t}" class="${this._getClasses(e,!0)}">`,e.thumbnail){let t=this._thumbnailDesktopPx(e);a+=`<div class="rounded-md bg-gray-200 dark:bg-white/15" style="width:${t}px;height:${t}px;max-width:100%;box-sizing:border-box"></div>`}else a+=`<div class="h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15"></div>`;a+=`</td>`}),a+=`</tr>`,a}_virtualScrollStickyOverlapPx(e){let t=0;if(this._fixedControls()){let e=this.querySelector(`#mint-rt-fixed-controls-${this._tableId}`);if(e)t+=Math.ceil(e.getBoundingClientRect().height);else{let e=getComputedStyle(this).getPropertyValue(`--mint-rt-fixed-controls-h`).trim(),n=parseFloat(e);isNaN(n)||(t+=Math.ceil(n))}}if(this._fixedHeader()&&e){let n=e.querySelector(`thead`);n&&(t+=Math.ceil(n.getBoundingClientRect().height))}return t}_scrollVirtualTableTopIntoView(){if(!(!this._virtualScrollActive()||!this.isConnected)){if(this._virtualScrollRoot()===`table-body`){let e=this._virtualBodyScrollEl?.isConnected?this._virtualBodyScrollEl:this.querySelector(`#mint-rt-vscroll-${this._tableId}`);this._useMobileListLayout()&&e&&e.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`);let t=e?.querySelector(`mint-table.table-section`)||e?.querySelector(`mint-table`),n=t?.querySelector(`#${this._tableId}`)?.closest(`table`)||t?.querySelector(`table`);this._virtualScrollStickyOverlapPx(n),e&&(e.scrollTop=0,this._virtualBodyScrollEl=e,this._virtualInvalidate(),this._scheduleVirtualWindowSync());return}this._virtualInvalidate(),this._scheduleVirtualWindowSync()}}_scheduleVirtualWindowSync(){this._virtualScrollActive()&&this._virtualWindowRaf===null&&(this._virtualWindowRaf=window.requestAnimationFrame(()=>{this._virtualWindowRaf=null,this._syncVirtualWindow()}))}_syncVirtualWindow(){if(!this._virtualScrollActive()||!this._configuration)return;let e=this._useMobileListLayout(),t=this.querySelector(`tbody[data-mint-rt-tbody="${this._tableId}"]`),n=this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`),r=e?n:t;if(!r)return;let i=this._getVirtualRowCount(),a=this._virtualRowHeightPxForSync(e),o=this._virtualColspan();if(i===0){e?this._fetchError?r.innerHTML=`<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`:r.innerHTML=`<li class="list-none px-4 py-8 text-center text-sm">No records found.</li>`:this._fetchError?r.innerHTML=`<tr><td colspan="${o}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`:r.innerHTML=`<tr><td colspan="${o}" class="text-center py-8">No records found.</td></tr>`,this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``;return}let s=0,c=window.innerHeight;if(this._virtualScrollRoot()===`table-body`){let e=this._virtualBodyScrollEl;if((!e||!e.isConnected)&&(e=this.querySelector(`#mint-rt-vscroll-${this._tableId}`),this._virtualBodyScrollEl=e),!e)return;s=e.scrollTop,c=e.clientHeight||400}else{let e=r.getBoundingClientRect();s=Math.max(0,-e.top)}let l=Math.min(Math.max(0,Math.floor(s/a)),Math.max(0,i-1)),u=Math.ceil(c/a)+16,d=Math.max(0,l-8),f=Math.min(i,l+u),p=``;if(this._type===`ajax`)for(let e=d;e<f;e++)p+=this._virtualRowCache.has(e)?`1`:`0`;if(d===this._virtualLastRangeStart&&f===this._virtualLastRangeEnd&&(this._type!==`ajax`||p===this._virtualLastRangeCacheSig))return;this._virtualLastRangeStart=d,this._virtualLastRangeEnd=f,this._virtualLastRangeCacheSig=p;let m=d*a,h=Math.max(0,(i-f)*a),g=``;if(e){g+=`<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${m}px"></li>`;for(let e=d;e<f;e++){let t=this._getVirtualRowAt(e),n=i>0&&e===i-1;t?g+=this._buildMobileListItemHtml(t,e,a,n):g+=this._buildMobileListPlaceholderLi(e,a,n)}g+=`<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${h}px"></li>`}else{g+=`<tr data-mint-rt-spacer="top" aria-hidden="true"><td colspan="${o}" style="height:${m}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`;for(let e=d;e<f;e++){let t=this._getVirtualRowAt(e),n=i>0&&e===i-1;t?g+=this._buildDataRowHtml(t,e,a,n):g+=this._buildVirtualPlaceholderRowHtml(e,a,n)}g+=`<tr data-mint-rt-spacer="bottom" aria-hidden="true"><td colspan="${o}" style="height:${h}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`}if(r.innerHTML=g,this.querySelectorAll(`tbody[data-mint-rt-tbody="${this._tableId}"] mint-button[data-action], ul[data-mint-rt-mobile-list="${this._tableId}"] mint-button[data-action]`).forEach(e=>{e.render&&e.render()}),this._attachTableEventListeners(),this._attachRowClickHandler(),this._type===`ajax`&&this._virtualScrollActive()&&this._scheduleVirtualAjaxPrefetch(d,f),this._virtualScrollRoot()===`table-body`&&!e){let e=this._virtualBodyScrollEl;e?.isConnected&&requestAnimationFrame(()=>{if(!e.isConnected)return;let t=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop>t&&(e.scrollTop=t)})}}_detachVirtualScroll(){this._virtualScrollHandler&&=(window.removeEventListener(`scroll`,this._virtualScrollHandler),this._virtualBodyScrollEl?.removeEventListener(`scroll`,this._virtualScrollHandler),null),this._virtualWindowResizeHandler&&=(window.removeEventListener(`resize`,this._virtualWindowResizeHandler),null),this._virtualResizeObserver&&=(this._virtualResizeObserver.disconnect(),null),this._virtualBodyScrollEl=null,this._virtualWindowRaf!==null&&(window.cancelAnimationFrame(this._virtualWindowRaf),this._virtualWindowRaf=null),this._virtualLastRangeStart=-1,this._virtualLastRangeEnd=-1,this._virtualLastRangeCacheSig=``,this._virtualAjaxPrefetchTimer!==null&&(window.clearTimeout(this._virtualAjaxPrefetchTimer),this._virtualAjaxPrefetchTimer=null),this._virtualRangeFetching=!1}_scheduleVirtualAjaxPrefetch(e,t){if(this._type!==`ajax`||!this._virtualScrollActive()||!this._configuration)return;let n=!1;for(let r=e;r<t;r++)if(!this._virtualRowCache.has(r)){n=!0;break}if(!n)return;this._virtualAjaxPrefetchTimer!==null&&window.clearTimeout(this._virtualAjaxPrefetchTimer);let r=e,i=t;this._virtualAjaxPrefetchTimer=window.setTimeout(()=>{this._virtualAjaxPrefetchTimer=null,this._fetchVirtualAjaxRange(r,i-r)},60)}async _fetchVirtualAjaxRange(e,t){if(!this._configuration||this._type!==`ajax`||!this._virtualScrollActive())return;let n=typeof this._configuration.data==`string`?this._configuration.data:null;if(!n||t<=0||this._virtualRangeFetching||e<0||e>=this._totalRows)return;this._virtualRangeFetching=!0;let r=this._virtualFetchGeneration,i=Math.min(e,Math.max(0,this._totalRows-1)),a=Math.min(150,Math.max(this._perPage,t,15),Math.max(1,this._totalRows-i));try{let e=new URLSearchParams({perPage:a.toString(),offset:i.toString(),search:this._search,sortBy:this._configuration.sortBy||`id`,sort:this._configuration.sort||`asc`,searchColumns:this._searchColumns.join(`,`),columns:this._columns.join(`,`)}),t={};this._configuration.headers&&(t.headers=this._configuration.headers);let o=await fetch(`${n}?${e.toString()}`,t);if(!o.ok)throw Error(`HTTP error! status: ${o.status}`);let s=await o.json();if(r!==this._virtualFetchGeneration)return;(s.content?.rows||[]).forEach((e,t)=>{let n=i+t;n<this._totalRows&&this._virtualRowCache.set(n,e)})}catch(e){console.error(`mint-resource-table: virtual range fetch failed`,e)}finally{this._virtualRangeFetching=!1,r===this._virtualFetchGeneration&&(this._virtualInvalidate(),this._scheduleVirtualWindowSync())}}_detachFixedChromeResize(){this._fixedChromeResizeObserver?.disconnect(),this._fixedChromeResizeObserver=null,this.style.removeProperty(`--mint-rt-fixed-controls-h`)}_syncFixedControlsChromeHeight(){if(!this._fixedHeader()||!this._fixedControls())return;this._fixedChromeResizeObserver?.disconnect(),this._fixedChromeResizeObserver=null;let e=this.querySelector(`#mint-rt-fixed-controls-${this._tableId}`);if(!e)return;let t=()=>{let t=Math.ceil(e.getBoundingClientRect().height);this.style.setProperty(`--mint-rt-fixed-controls-h`,`${t}px`)};t(),this._fixedChromeResizeObserver=new ResizeObserver(t),this._fixedChromeResizeObserver.observe(e)}_attachVirtualScrollListeners(){if(this._detachVirtualScroll(),!this._virtualScrollActive())return;let e=()=>{this._scheduleVirtualWindowSync()};this._virtualScrollHandler=e,this._virtualScrollRoot()===`table-body`?(this._virtualBodyScrollEl=this.querySelector(`#mint-rt-vscroll-${this._tableId}`),this._virtualBodyScrollEl?.addEventListener(`scroll`,e,{passive:!0}),this._virtualBodyScrollEl&&typeof ResizeObserver<`u`&&(this._virtualResizeObserver=new ResizeObserver(()=>this._scheduleVirtualWindowSync()),this._virtualResizeObserver.observe(this._virtualBodyScrollEl))):window.addEventListener(`scroll`,e,{passive:!0}),this._virtualWindowResizeHandler=()=>this._scheduleVirtualWindowSync(),window.addEventListener(`resize`,this._virtualWindowResizeHandler,{passive:!0}),this._scheduleVirtualWindowSync()}_toggleSort(e){if(!this._configuration||!e.data||!e.sortable)return;let t=e.data;if(this._sortTimeoutId!==null&&(clearTimeout(this._sortTimeoutId),this._sortTimeoutId=null),this._sorting=!0,this._sortingColumn=e,this._updateSortIcons(),this._type===`ajax`)this._sortTimeoutId=window.setTimeout(()=>{if(this._sortTimeoutId=null,!this._configuration||!t||!e.sortable)return;let n=this._configuration.sort||`asc`;this._configuration.sortBy?.toLowerCase()===t.toLowerCase()&&(n=n===`desc`?`asc`:`desc`),this._configuration.sort=n,this._configuration.sortBy=t,this._updateSortIcons(),this._offset=0,this._currentPage=1,this._fetching=!1,this._loading=!1,this._fetchData(void 0,!1,this._perPage,0)},10);else{let e=this._configuration.sort||`asc`;this._configuration.sortBy?.toLowerCase()===t.toLowerCase()&&(e=e===`desc`?`asc`:`desc`),this._configuration.sort=e,this._configuration.sortBy=t,this._currentPage=1,this._sorting=!1,this._sortingColumn=null,this._updateSortIcons(),this.render(),this._virtualScrollActive()&&queueMicrotask(()=>this._scrollVirtualTableTopIntoView())}}_getSortClass(e){return this._sorting&&this._sortingColumn===e?`spinner`:this._configuration?.sortBy?.toLowerCase()===e.data?.toLowerCase()?this._configuration?.sort?.toLowerCase()===`desc`?`caret-down`:`caret-up`:``}_updateSortIcons(){if(!this._configuration)return;this._configuration.columns.forEach((e,t)=>{if(!e.sortable||e.hidden)return;let n=this.querySelector(`th[data-column-key="${t}"]`);if(!n)return;let r=n.querySelector(`:scope > div.flex.items-center`);if(!r)return;let i=r.querySelector(`:scope > div.ml-2.flex.items-center`),a=this._getSortClass(e),o=()=>{if(!i){let e=document.createElement(`div`);e.className=`ml-2 flex items-center`,r.appendChild(e),i=e}return i},s=()=>{i&&=(i.remove(),null)};if(a===`spinner`){let e=o();if(e.querySelector(`mint-icon`)?.remove(),!e.querySelector(`mint-spinner`)){let t=document.createElement(`mint-spinner`);t.className=`w-4 h-4`,e.appendChild(t)}}else if(a===`caret-up`||a===`caret-down`){let e=o();e.querySelector(`mint-spinner`)?.remove();let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a),t.className=`w-4 h-4`}else s()}),this._syncMobileSortPopoverIcons();let e=this.querySelector(`#mint-rt-mobile-sort-btn-${this._tableId}`);e&&(e.setAttribute(`icon`,this._getMobileSortTriggerIconName()),this._sorting?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`),typeof e.render==`function`&&e.render())}_showFetchingState(){}_triggerSearch(){this._searchTimeoutId&&clearTimeout(this._searchTimeoutId),this._searching=!0,this._type===`ajax`&&this._updateSearchIcon(),this._type!==`ajax`&&(this._currentPage=1),this._updateTableBody(),this._type!==`ajax`&&this._updatePagination(),this._searchTimeoutId=window.setTimeout(()=>{this._type===`ajax`?(this._offset=0,this._fetchData(void 0,!1,this._perPage,0)):(this._searching=!1,this._virtualScrollActive()&&queueMicrotask(()=>this._scrollVirtualTableTopIntoView()))},400)}_updateSearchIcon(){let e=this.querySelector(`#search-${this._tableId}`);if(!e)return;let t=this._type===`ajax`&&(this._searching||this._fetching);setTimeout(()=>{let n=e.querySelector(`.relative`)||e.querySelector(`div`);if(!n)return;let r=n.querySelector(`mint-icon`),i=n.querySelector(`mint-spinner`);if(t){if(r&&!i){let e=document.createElement(`mint-spinner`);e.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none`,r.replaceWith(e)}else if(!r&&!i){let e=document.createElement(`mint-spinner`);e.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none`,n.appendChild(e)}}else if(i){e.getAttribute(`icon`)||e.setAttribute(`icon`,`search`);let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`search`),t.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none`,i.replaceWith(t)}},0)}_updateTableBody(){if(!this._configuration)return;let e=this.querySelector(`tbody[data-mint-rt-tbody="${this._tableId}"]`),t=this.querySelector(`#${this._tableId}`)?.closest(`table`)?.querySelector(`tbody`);if(this._virtualScrollActive()&&(this._type===`provided`||this._type===`ajax`)){if(!(e||t)){this.render();return}let n=this.querySelector(`#search-${this._tableId}`),r=document.activeElement===n||n?.querySelector(`input`)===document.activeElement,i=this._search;if((this._fetching||this._loading)&&!this._loaded&&!this._sorting)return;if(this._virtualInvalidate(),this._syncVirtualWindow(),r&&n){let e=n.querySelector(`input`)||n._element;e?(e.value=i,setTimeout(()=>{e.focus(),e.setSelectionRange(i.length,i.length)},0)):n.value!==void 0&&(n.value=i,setTimeout(()=>{n.focus()},0))}return}let n=this._getRows(),r=t;if(!r){this.render();return}let i=this.querySelector(`#search-${this._tableId}`),a=document.activeElement===i||i?.querySelector(`input`)===document.activeElement,o=this._search,s=``,c=``;if((this._fetching||this._loading)&&!this._loaded&&!this._sorting)return;n.forEach((e,t)=>{c+=this._buildMobileListItemHtml(e,t,void 0,t===n.length-1);let r=typeof this._configuration.onRowClick==`function`,i=r?`cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800`:``;s+=`<tr data-row-index="${t}" ${r?`data-row-clickable="true"`:``}${i?` class="${i}"`:``}>`,this._configuration.columns.forEach(n=>{if(n.hidden)return;let r=!n.show||n.show(this,e);s+=`<td style="${this._getStyle(n)}" class="${this._getClasses(n,!0)}">`,r&&(s+=this._buildTableCellInnerHtml(n,e,t,`table`)),s+=`</td>`}),s+=`</tr>`}),n.length===0&&(this._fetchError?(s+=`<tr><td colspan="${this._configuration.columns.filter(e=>!e.hidden).length}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`,c+=`<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`):(s+=`<tr><td colspan="${this._configuration.columns.filter(e=>!e.hidden).length}" class="text-center py-8">No records found.</td></tr>`,c+=`<li class="list-none px-4 py-8 text-center text-sm">No records found.</li>`)),r.innerHTML=s;let l=this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`);if(l&&(l.innerHTML=c),this._attachTableEventListeners(),this._attachRowClickHandler(),a&&i){let e=i.querySelector(`input`)||i._element;e?(e.value=o,setTimeout(()=>{e.focus(),e.setSelectionRange(o.length,o.length)},0)):i.value!==void 0&&(i.value=o,setTimeout(()=>{i.focus()},0))}}_updatePagination(){if(!this._configuration)return;let e=this._lastPage||Math.ceil(this._rows.length/this._perPage),t=()=>{let e=this.querySelector(`mint-table`),t=e?.nextElementSibling;e&&t&&t.id!==`mint-rt-pagination-host-${this._tableId}`&&!t.classList.contains(`mint-rt-pagination-host`)&&t.querySelector?.(`[data-action="page"]`)&&t.remove()};if(!this._configuration.perPage||e<=1||this._virtualScrollActive()){this._getPaginationHostEl()?.replaceChildren(),t();return}let n=this._getPaginationHostEl();if(!n){let e=this.querySelector(`[data-mint-rt-mobile-list="${this._tableId}"]`)||this.querySelector(`mint-table`);if(!e){this.render();return}n=document.createElement(`div`),n.id=`mint-rt-pagination-host-${this._tableId}`,n.setAttribute(`data-mint-rt-pagination-wrap`,``),n.className=`mint-rt-pagination-host w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain flex justify-center [-webkit-overflow-scrolling:touch] md:justify-end `+(this._inMintCard?`border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider md:border-t-0 md:pt-0`:`border-t border-gray-200 px-2 py-3 dark:border-mint-divider md:border-t-0 md:py-0 md:mt-4`),e.insertAdjacentElement(`afterend`,n)}let r=this._buildPaginationNavMarkup(e);n.innerHTML=r,setTimeout(()=>{this._attachPaginationListeners(),n.querySelectorAll(`mint-button[data-action="page"]`).forEach(e=>{let t=e.getAttribute(`data-page`),n=t&&this._loadingPage===parseInt(t),r=e._button||e.querySelector(`button`);if(r)if(n){let e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null),n;for(;n=t.nextNode();)e.push(n);e.forEach(e=>e.parentNode?.removeChild(e));let i=r.querySelector(`.mint-button-content`);if(i){let e=i.textContent?.trim();e&&/^\d+$/.test(e)&&i.remove()}let a=r.querySelector(`span.mr-2`);a&&a.querySelector(`mint-spinner`)&&(a.classList.remove(`mr-2`),a.classList.add(`mr-0`))}else{let e=r.textContent?.trim();if(!e||!/^\d+$/.test(e)){let e=t||``,n=r.querySelector(`mint-spinner`);r.innerHTML=``,n&&r.appendChild(n),r.appendChild(document.createTextNode(e))}}if(`render`in e&&typeof e.render==`function`&&(e.render(),n&&r)){let e=r.querySelector(`span.mr-2`);e&&e.querySelector(`mint-spinner`)&&(e.classList.remove(`mr-2`),e.classList.add(`mr-0`))}}),n.querySelectorAll(`mint-button[data-action="page-prev"], mint-button[data-action="page-next"]`).forEach(e=>{`render`in e&&typeof e.render==`function`&&e.render()}),this._loadingPage!==null&&!this._loading&&!this._fetching&&this._updatePagination()},0)}_goToPage(e){let t=this._lastPage||Math.ceil(this._rows.length/this._perPage);e>t&&(e=t),e<1&&(e=1),e!==this._currentPage&&(this._currentPage=e,this._offset=(e-1)*this._perPage,this._updatePageInUrl(e),this._type===`ajax`?(this._loadingPage=e,this._updatePagination(),this._fetchData()):this.render())}_handleButtonClick(e){if(this._configuration)switch(e.type){case`export`:break;case`print`:window.print();break;case`csv`:this._downloadCSV();break;default:e.onClick&&e.onClick(this);break}}_downloadCSV(){if(!this._configuration)return;let e=this.querySelector(`#${this._tableId}`)||this.querySelector(`table`);if(!e)return;let t=`data:text/csv;charset=utf-8,`,n=e=>{let n=[];e.querySelectorAll(`th, td`).forEach(e=>{let t=e.getAttribute(`colspan`);if(t)for(let e=0;e<parseInt(t,10)-1;e++)n.push(``);n.push(`"`+e.textContent?.trim().replace(/"/g,`""`)+`"`)}),t+=n.join(`,`)+`
|
|
141
|
+
`};e.querySelectorAll(`tr`).forEach(e=>n(e));let r=encodeURI(t),i=document.createElement(`a`);i.setAttribute(`href`,r),i.setAttribute(`download`,`${this._configuration.export_name||this._tableId}.csv`),document.body.appendChild(i),i.click(),document.body.removeChild(i)}_getStyle(e){let t=``;return(e.nowrap||e.actions)&&(t+=`white-space: nowrap;`),e.offsetLeft&&(t+=`left: ${e.offsetLeft} !important;`),e.offsetRight&&(t+=`right: ${e.offsetRight} !important;`),e.width&&(t+=`min-width: ${e.width}px; max-width: ${e.width}px;`),t}_getClasses(e,t=!1){let n=[];return e.class&&n.push(e.class.trim()),e.sortable&&!t&&n.push(`cursor-pointer`),e.stickLeft&&n.push(`sticky-left`),e.stickRight&&n.push(`sticky-right`),n.join(` `)}_replaceUtilityClasses(){let e=bn,t=[this,...Array.from(this.querySelectorAll(`[class]`))];for(let n of t)for(let t of Array.from(n.classList)){let r=e[t];r&&n.classList.replace(t,r)}}_renderTheadHtml(e,t,n=!1,r=!1){if(!this._configuration)return``;let i=[`bg-white`,`dark:bg-mint-nav`];e&&(i.push(`sticky`,`z-30`),r?i.push(`top-[var(--mint-rt-fixed-controls-h,0px)]`):i.push(`top-0`)),t&&i.push(`border-b`,`border-gray-200`,`dark:border-mint-divider`);let a=`<thead class="${i.join(` `)}"><tr>`;return this._configuration.columns.forEach((e,t)=>{if(e.hidden)return;let r=n?``:` width="${e.width||``}"`,i=e.sortable?` data-mint-rt-sortable=""`:``;if(a+=`<th${r} style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${i}>`,e.showLabel!==!1){if(a+=`<div class="flex items-center">`,a+=`<div class="flex-1">${e.raw?e.label:this._escapeHtml(e.label)}</div>`,e.sortable){let t=this._getSortClass(e);t===`spinner`?a+=`<div class="ml-2 flex items-center"><mint-spinner class="w-4 h-4"></mint-spinner></div>`:(t===`caret-up`||t===`caret-down`)&&(a+=`<div class="ml-2 flex items-center"><mint-icon name="${t}" class="w-4 h-4"></mint-icon></div>`)}a+=`</div>`}a+=`</th>`}),a+=`</tr></thead>`,a}render(){if(!this._configuration){this.innerHTML=`<div class="p-4 text-red-500">Error: Invalid configuration</div>`,this._replaceUtilityClasses();return}this._ensureMobileListMql();let e=String(this._configuration.id||``).trim();e&&(this.id=e),this._detachVirtualScroll(),this._detachFixedChromeResize(),this._virtualScrollActive()||this._virtualRowCache.clear();let t=!this._loaded||this._rows.length>0||this._search.length>0||this._searching,n=this._getRows();this._lastPage||Math.ceil(this._rows.length/this._perPage);let r=this._isExternalLoading(),i=``;if(t){let e=this._fixedControls(),t=[`flex`,`items-center`,`min-w-0`,this._inMintCard?`p-3.5`:`mb-3`,e?`sticky top-0 z-20 bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider`:``].filter(Boolean).join(` `);if(i+=`<div id="mint-rt-fixed-controls-${this._tableId}" class="${t}">`,i+=`<div class="flex min-w-0 flex-1 items-center gap-2">`,i+=this._buildMobileSortToolbarHtml(),this._configuration.showSearch!==!1){let e=`search-${this._tableId}`,t=this._escapeHtml(this._configuration.searchPlaceholder||`Search...`);i+=`<mint-input id="${e}" type="search" label="" placeholder="${t}" class="min-w-0 flex-1" icon="search" value="${this._escapeHtml(this._search)}"></mint-input>`}i+=`<div class="hidden shrink-0 items-center gap-2 md:flex">`,this._configuration.buttons&&this._configuration.buttons.forEach(e=>{let t=e.icon?` icon="${this._escapeHtml(e.icon)}"`:``,n=e.tone?` tone="${this._escapeHtml(e.tone)}"`:``;i+=`<mint-button variant="solid" class="${e.class||``}" data-button-type="${e.type||`custom`}"${t}${n}>`,e.label&&(i+=this._escapeHtml(e.label)),i+=`</mint-button>`}),i+=`</div>`,i+=`</div>`,i+=`</div>`}if((this._type===`ajax`&&!this._loaded||this._type===`provided`&&r)&&!this._fetchError&&!this._sorting){let e=this._fixedHeader()?` data-mint-rt-scroll-inner=""`:``,t=this._fixedHeader()&&this._fixedControls(),n=this._fixedHeader()?t?`sticky top-[var(--mint-rt-fixed-controls-h,0px)] z-30 `:`sticky top-0 z-30 `:`sticky top-0 z-10 `;i+=`<div class="min-w-0">`,i+=`<mint-table class="table-section`+(this._inMintCard?` rounded-t-none`:``)+`"`+e+`>`,i+=`<table id="${this._tableId}">`,i+=`<thead class="`+n+`bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider"><tr>`,this._configuration.columns.forEach((e,t)=>{if(e.hidden)return;let n=e.sortable?` data-mint-rt-sortable=""`:``;if(i+=`<th width="${e.width||``}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${n}>`,e.showLabel!==!1){if(i+=`<div class="flex items-center">`,i+=`<div class="flex-1">${e.raw?e.label:this._escapeHtml(e.label)}</div>`,e.sortable){let t=this._getSortClass(e);t===`spinner`?i+=`<div class="ml-2 flex items-center"><mint-spinner class="w-4 h-4"></mint-spinner></div>`:(t===`caret-up`||t===`caret-down`)&&(i+=`<div class="ml-2 flex items-center"><mint-icon name="${t}" class="w-4 h-4"></mint-icon></div>`)}i+=`</div>`}i+=`</th>`}),i+=`</tr></thead>`,i+=`<tbody>`;for(let e=0;e<4;e++)i+=`<tr>`,this._configuration.columns.forEach(e=>{if(!e.hidden){if(i+=`<td style="${this._getStyle(e)}" class="${this._getClasses(e,!0)}">`,e.thumbnail){let t=this._thumbnailDesktopPx(e);i+=`<div class="rounded-md bg-gray-200 dark:bg-white/15 animate-pulse" style="width:${t}px;height:${t}px;box-sizing:border-box"></div>`}else i+=`<div class="h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15 animate-pulse"></div>`;i+=`</td>`}}),i+=`</tr>`;i+=`</tbody>`,i+=`</table>`,i+=`</mint-table>`,i+=`</div>`,i+=this._paginationHostPlaceholderHtml()}else if(n.length>0||this._search.length>0||this._searching||this._fetchError){let e=this._virtualScrollActive()&&(this._type===`provided`||this._type===`ajax`&&this._loaded&&!this._fetchError),t=e&&this._virtualScrollRoot()===`table-body`,a=this._escapeHtml(this._virtualMaxHeightCss()),o=t||this._fixedHeader(),s=this._fixedHeader()&&this._fixedControls(),c=o?` data-mint-rt-scroll-inner=""`:``,l=`table-section`+(this._inMintCard?` rounded-t-none`:``),u=`m-0 min-h-0 w-full list-none border-collapse overflow-x-hidden bg-white ${this._inMintCard?`px-3.5 py-3.5`:`py-3`} dark:bg-mint-canvas md:hidden`,d=``;if(t){let e=this._renderColgroupHtml();i+=`<div id="mint-rt-vscroll-${this._tableId}" class="overflow-y-auto overflow-x-auto min-h-0 w-full" style="max-height: ${a}; scrollbar-gutter: stable; overscroll-behavior-x: contain; overscroll-behavior-y: none; overflow-anchor: none;">`,i+=`<div class="hidden min-h-0 min-w-0 md:block">`,i+=`<mint-table class="${l}"${c}>`,i+=`<table id="${this._tableId}" class="w-full min-w-0 table-fixed">`,i+=e,i+=this._renderTheadHtml(!0,!0,!0,s)}else i+=`<div class="hidden min-h-0 min-w-0 md:block">`,i+=`<mint-table class="${l}"${c}>`,i+=`<table id="${this._tableId}">`,e&&(i+=this._renderColgroupHtml()),i+=this._renderTheadHtml(!0,!0,!!e,s);if(i+=`<tbody`+(e?` data-mint-rt-tbody="${this._tableId}"`:``)+`>`,!this._fetching&&!this._loading&&!r&&!e&&n.forEach((e,t)=>{d+=this._buildMobileListItemHtml(e,t,void 0,t===n.length-1);let r=typeof this._configuration.onRowClick==`function`,a=r?`cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated`:``;i+=`<tr data-row-index="${t}" ${r?`data-row-clickable="true"`:``}${a?` class="${a}"`:``}>`,this._configuration.columns.forEach(n=>{if(n.hidden)return;let r=!n.show||n.show(this,e);i+=`<td style="${this._getStyle(n)}" class="${this._getClasses(n,!0)}">`,r&&(i+=this._buildTableCellInnerHtml(n,e,t,`table`)),i+=`</td>`}),i+=`</tr>`}),!this._fetching&&!this._loading&&!r&&n.length===0&&!e)if(this._fetchError){let e=this._configuration.columns.filter(e=>!e.hidden).length;i+=`<tr><td colspan="${e}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`,d+=`<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`}else{let e=this._configuration.columns.filter(e=>!e.hidden).length;i+=`<tr><td colspan="${e}" class="text-center py-8">No records found.</td></tr>`,d+=`<li class="list-none px-4 py-8 text-center text-sm">No records found.</li>`}i+=`</tbody>`,i+=`</table>`,i+=`</mint-table>`,i+=`</div>`,i+=`<ul class="${u}" data-mint-rt-mobile-list="${this._tableId}">${e?``:d}</ul>`,e||(i+=this._paginationHostPlaceholderHtml()),t&&(i+=`</div>`)}else i+=`<slot name="empty"></slot>`;this._fixedHeader()?this.setAttribute(`data-mint-rt-fixed-header`,``):this.removeAttribute(`data-mint-rt-fixed-header`),this._fixedControls()?this.setAttribute(`data-mint-rt-fixed-controls`,``):this.removeAttribute(`data-mint-rt-fixed-controls`),this.innerHTML=i,this._replaceUtilityClasses(),this._updatePagination(),this.querySelectorAll(`mint-button[data-action]`).forEach(e=>{e.render&&e.render()}),this.querySelectorAll(`mint-button[data-mint-rt-toolbar]`).forEach(e=>{e.render&&e.render()}),this.querySelectorAll(`mint-button[data-button-type]`).forEach(e=>{e.render&&e.render()}),this._attachEventListeners(),this._type===`ajax`&&!this._loaded&&!this._fetching&&!this._loading&&this._fetchData()}_attachRowClickHandler(){this._rowClickHandler&&this.removeEventListener(`click`,this._rowClickHandler,!0);let e=e=>{let t=e.target;if(t.tagName===`MINT-BUTTON`||t.tagName===`BUTTON`||t.closest(`mint-button`)||t.closest(`button`)||t.closest(`mint-popover`)||t.closest(`[data-action]`))return;let n=t.closest(`tr[data-row-clickable="true"]`)||t.closest(`li[data-row-clickable="true"]`);if(!n)return;let r=n.getAttribute(`data-row-index`);if(!r)return;let i=parseInt(r),a=this._getRowDataForEventIndex(i);!a||!this._configuration?.onRowClick||(this._configuration.onRowClick.length===1?this._configuration.onRowClick(a):this._configuration.onRowClick(this,a))};this.addEventListener(`click`,e,!0),this._rowClickHandler=e}_attachPaginationListeners(){this.querySelectorAll(`[data-action="page"]`).forEach(e=>{e.addEventListener(`click`,()=>{if(e.getAttribute(`active`)===`true`)return;let t=parseInt(e.getAttribute(`data-page`)||`1`);t!==this._currentPage&&this._goToPage(t)})}),this.querySelectorAll(`[data-action="page-prev"]`).forEach(e=>{e.addEventListener(`click`,()=>{this._goToPage(this._currentPage-1)})}),this.querySelectorAll(`[data-action="page-next"]`).forEach(e=>{e.addEventListener(`click`,()=>{this._goToPage(this._currentPage+1)})})}_attachTableEventListeners(){this.querySelectorAll(`[data-action="row-action"]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=parseInt(e.getAttribute(`data-row-index`)||`0`),n=parseInt(e.getAttribute(`data-action-index`)||`0`),r=parseInt(e.getAttribute(`data-column-key`)||`0`),i=this._getRowDataForEventIndex(t),a=this._configuration?.columns[r];a&&a.actions&&a.actions[n]&&i!==void 0&&a.actions[n].onClick(this,i)})}),this.querySelectorAll(`[data-action="column-action"]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=parseInt(e.getAttribute(`data-row-index`)||`0`),n=parseInt(e.getAttribute(`data-column-key`)||`0`),r=this._getRowDataForEventIndex(t),i=this._configuration?.columns[n];i&&i.action&&r!==void 0&&i.action.onClick(this,r)})})}_attachEventListeners(){let e=this.querySelector(`#search-${this._tableId}`);if(e){let t=e.querySelector(`input`)||e._element;t?t.addEventListener(`input`,e=>{this._search=e.target.value,this._triggerSearch()}):e.addEventListener(`input`,t=>{this._search=e.value||t.target.value||``,this._triggerSearch()})}this._attachTableEventListeners(),this._attachRowClickHandler(),this.querySelectorAll(`th[data-column-key]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=parseInt(e.getAttribute(`data-column-key`)||`0`),n=this._configuration?.columns[t];n&&this._toggleSort(n)})}),this.querySelectorAll(`[data-action="mobile-sort"]`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation();let n=parseInt(e.getAttribute(`data-column-key`)||`0`,10),r=this._configuration?.columns[n];r&&(this._closeMobileSortPopover(),this._toggleSort(r))})}),this.querySelectorAll(`[data-button-type]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-button-type`),n=this._configuration?.buttons?.find(e=>(e.type||`custom`)===t);n&&this._handleButtonClick(n)})}),this._attachPaginationListeners(),this._virtualScrollActive()&&(this._type===`provided`||this._type===`ajax`)&&this._attachVirtualScrollListeners(),this._fixedHeader()&&this._fixedControls()&&queueMicrotask(()=>{this._syncFixedControlsChromeHeight(),requestAnimationFrame(()=>this._syncFixedControlsChromeHeight())})}_escapeHtml(e){let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}_getPageFromUrl(){if(!this._tableId)return null;let e=new URLSearchParams(window.location.search).get(`mui.${this._tableId}`);if(!e)return null;let t=parseInt(e,10);return isNaN(t)||t<1?null:t}_updatePageInUrl(e){if(!this._tableId)return;let t=new URL(window.location.href),n=t.searchParams;n.set(`mui.${this._tableId}`,e.toString()),e===1&&n.set(`mui.${this._tableId}`,`1`),window.history.replaceState({},``,t.toString())}_loadPageFromUrl(){if(!this._configuration||!this._tableId)return;let e=this._getPageFromUrl();e!==null&&(this._currentPage=e,this._offset=(this._currentPage-1)*this._perPage)}};customElements.get(`mint-resource-table`)||a(`mint-resource-table`,Sn);var Cn=550,wn=12,Tn={passive:!0},En=class extends HTMLElement{constructor(...e){super(...e),this._table=null,this._anchor=null,this._popover=null,this._menuRoot=null,this._baseId=``,this._touchTimer=null,this._touchStart=null,this._slotObserver=null,this._scrollCloseTargets=[],this._onScrollClose=()=>{this._closePopover()},this._onContextMenu=e=>{let t=e,n=this._rowTargetFromEventTarget(t.target);n&&(t.preventDefault(),this._openAtRowIndex(n.index,t.clientX,t.clientY))},this._onTouchStart=e=>{let t=e;if(!t.touches.length)return;let n=this._rowTargetFromEventTarget(t.target);if(!n)return;let r=t.touches[0];this._touchStart={x:r.clientX,y:r.clientY,rowIndex:n.index},this._touchTimer!==null&&(window.clearTimeout(this._touchTimer),this._touchTimer=null);let i=this._longPressMs();this._touchTimer=window.setTimeout(()=>{this._touchTimer=null,this._touchStart&&=(this._openAtRowIndex(this._touchStart.rowIndex,this._touchStart.x,this._touchStart.y),null)},i)},this._onTouchMove=e=>{if(!this._touchStart||this._touchTimer===null)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this._touchStart.x,r=t.clientY-this._touchStart.y;n*n+r*r>wn*wn&&(this._clearTouchTimer(),this._touchStart=null)},this._onTouchEnd=()=>{this._clearTouchTimer(),this._touchStart=null}}static get observedAttributes(){return[`for`,`long-press-ms`]}connectedCallback(){this.classList.add(`contents`),this._baseId=this.id?.trim()||`mint-rt-ctx-${Math.random().toString(36).slice(2,10)}`,this._anchor=document.createElement(`div`),this._anchor.id=`${this._baseId}-anchor`,this._anchor.setAttribute(`aria-hidden`,`true`),this._anchor.className=`pointer-events-none fixed z-0 h-px w-px overflow-hidden p-0 m-0 border-0 opacity-0`,document.body.appendChild(this._anchor),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`data-mint-rt-ctx-internal`,``),this._popover.id=`${this._baseId}-popover`,this._popover.setAttribute(`trigger-id`,this._anchor.id),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),this._menuRoot=document.createElement(`div`),this._menuRoot.className=`flex min-w-[11rem] flex-col gap-0.5 py-1`,this._popover.appendChild(this._menuRoot),this.appendChild(this._popover),this._slotObserver=new MutationObserver(()=>{this._hideMenuSlotSources()}),this._slotObserver.observe(this,{childList:!0}),queueMicrotask(()=>{this._hideMenuSlotSources(),this._bindTable()})}disconnectedCallback(){this._slotObserver?.disconnect(),this._slotObserver=null,this._unbindTable(),this._anchor?.remove(),this._anchor=null,this._popover?.remove(),this._popover=null,this._menuRoot=null}attributeChangedCallback(){this.isConnected&&this._bindTable()}_longPressMs(){let e=parseInt(this.getAttribute(`long-press-ms`)||``,10);return!Number.isNaN(e)&&e>100?e:Cn}_resolveTable(){let e=this.getAttribute(`for`)?.trim();if(e){let t=document.getElementById(e);return t&&t.tagName===`MINT-RESOURCE-TABLE`?t:null}let t=this.previousElementSibling;return t&&t.tagName===`MINT-RESOURCE-TABLE`?t:this.parentElement?.querySelector?.(`mint-resource-table`)??null}_hideMenuSlotSources(){for(let e of Array.from(this.children))e===this._popover||e.hasAttribute(`data-mint-rt-ctx-internal`)||e.setAttribute(`hidden`,``)}_bindTable(){this._unbindTable(),this._table=this._resolveTable(),this._table&&(this._table.addEventListener(`contextmenu`,this._onContextMenu,!0),this._table.addEventListener(`touchstart`,this._onTouchStart,{passive:!0}),this._table.addEventListener(`touchmove`,this._onTouchMove,{passive:!0}),this._table.addEventListener(`touchend`,this._onTouchEnd,{passive:!0}),this._table.addEventListener(`touchcancel`,this._onTouchEnd,{passive:!0}))}_unbindTable(){this._closePopover(),this._table&&=(this._table.removeEventListener(`contextmenu`,this._onContextMenu,!0),this._table.removeEventListener(`touchstart`,this._onTouchStart),this._table.removeEventListener(`touchmove`,this._onTouchMove),this._table.removeEventListener(`touchend`,this._onTouchEnd),this._table.removeEventListener(`touchcancel`,this._onTouchEnd),null)}_rowTargetFromEventTarget(e){if(!e||!this._table)return null;let t=e.closest?.(`tr[data-row-index], li[data-row-index]`);if(!t||!this._table.contains(t)||t.hasAttribute(`data-mint-rt-spacer`)||t.getAttribute(`data-mint-rt-placeholder`)===`true`)return null;let n=t.getAttribute(`data-row-index`);if(n==null)return null;let r=parseInt(n,10);return Number.isNaN(r)?null:{index:r}}_clearTouchTimer(){this._touchTimer!==null&&(window.clearTimeout(this._touchTimer),this._touchTimer=null)}_positionAnchor(e,t){this._anchor&&(this._anchor.style.left=`${Math.round(e)}px`,this._anchor.style.top=`${Math.round(t)}px`)}_slotTemplateElements(){return Array.from(this.children).filter(e=>e!==this._popover&&e instanceof HTMLElement&&!e.hasAttribute(`data-mint-rt-ctx-internal`))}_elementIsScrollContainer(e){let t=getComputedStyle(e);return t.overflowX===`auto`||t.overflowX===`scroll`||t.overflowY===`auto`||t.overflowY===`scroll`}_collectScrollCloseTargets(e){let t=[],n=new Set,r=e=>{!e||n.has(e)||(n.add(e),t.push(e))};r(window),e.querySelectorAll(`[id^="mint-rt-vscroll-"]`).forEach(e=>{this._elementIsScrollContainer(e)&&r(e)});let i=e.querySelector(`mint-table`);for(;i&&i!==e;)this._elementIsScrollContainer(i)&&r(i),i=i.parentElement;return this._elementIsScrollContainer(e)&&r(e),t}_detachScrollCloseListeners(){for(let e of this._scrollCloseTargets)e.removeEventListener(`scroll`,this._onScrollClose,Tn);this._scrollCloseTargets=[]}_attachScrollCloseListeners(e){this._detachScrollCloseListeners(),this._scrollCloseTargets=this._collectScrollCloseTargets(e);for(let e of this._scrollCloseTargets)e.addEventListener(`scroll`,this._onScrollClose,Tn)}_closePopover(){if(this._detachScrollCloseListeners(),!this._popover?.hasAttribute(`open`))return;let e=this._popover;typeof e.close==`function`?e.close():this._popover.removeAttribute(`open`)}_openAtRowIndex(e,t,n){this._closePopover();let r=this._resolveTable();if(!r||typeof r.getRowByIndex!=`function`||!this._popover||!this._menuRoot)return;let i=this._popover,a=this._menuRoot,o=r.getRowByIndex(e);if(o===void 0)return;let s=this._slotTemplateElements();if(!s.length)return;this._positionAnchor(t,n),a.innerHTML=``,s.forEach(t=>{if(t.hasAttribute(`data-mint-rt-ctx-if-selection`)&&!(window.getSelection?.()?.toString?.()?.trim()??``))return;let n=t.cloneNode(!0);n.removeAttribute(`hidden`),n.addEventListener(`click`,t=>{t.stopPropagation();let r=n.getAttribute(`data-context-action`)||n.querySelector?.(`[data-context-action]`)?.getAttribute(`data-context-action`)||``,i=window.getSelection?.()?.toString?.()?.trim()??``;this.dispatchEvent(new CustomEvent(`context-action`,{bubbles:!0,composed:!0,detail:{action:r,row:o,rowIndex:e,selectedText:i}})),this._closePopover()}),a.appendChild(n);let r=n;typeof r.render==`function`&&queueMicrotask(()=>r.render())}),i.removeAttribute(`open`),i.offsetHeight,i.setAttribute(`open`,`true`);let c=i;typeof c.render==`function`&&queueMicrotask(()=>c.render());let l=this._resolveTable();l&&this._attachScrollCloseListeners(l)}};customElements.get(`mint-resource-table-context-menu`)||a(`mint-resource-table-context-menu`,En);var Dn=class e extends HTMLElement{constructor(...e){super(...e),this._shell=null,this._desktopInput=null,this._panel=null,this._panelInner=null,this._resultsId=``,this._panelInput=null,this._panelFiltersWrap=null,this._panelFiltersMainRow=null,this._panelFiltersChips=null,this._panelFiltersShowAllWrap=null,this._panelFiltersShowAllBtn=null,this._panelFiltersMorePanel=null,this._filtersMoreOpen=!1,this._filterOverflowObserver=null,this._filterOverflowZeroWidthRetries=0,this._desktopFilterWrap=null,this._mobileFilterWrap=null,this._resultsWrap=null,this._stateWrap=null,this._customResultsWrap=null,this._query=``,this._searchOpen=!1,this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._debounceId=null,this._abortController=null,this._docPointerDownHandler=null,this._globalKeydownHandler=null,this._focusOutHandler=null,this._resizeHandler=null,this._scrollHandler=null,this._desktopShortcutHint=null,this._panelSearchBar=null,this._contentObserver=null,this._renderFrame=null}static{this._filterMorePanelSeq=0}static{this._filterChipsOverflowMask=`linear-gradient(to right, #000 0%, #000 max(0%, calc(100% - 3.5rem)), transparent 100%)`}static get observedAttributes(){return[`endpoint`,`search-param`,`placeholder`,`filters`,`filter-param`,`open-shortcut`,`open-shortcut-hint`,`collapse-on-mobile`,`results-limit`]}connectedCallback(){this.classList.add(`mint-search-host`),this._attachGlobalHandlers(),this._attachFocusOutHandler(),this._attachResizeHandler(),this.render(),this._observeContentMutations()}disconnectedCallback(){this._panel?.remove(),this._docPointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._docPointerDownHandler,!0),null),this._globalKeydownHandler&&=(document.removeEventListener(`keydown`,this._globalKeydownHandler),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null),this._scrollHandler&&=(document.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._focusOutHandler&&=(this.removeEventListener(`focusout`,this._focusOutHandler,!0),null),this._cancelDebounce(),this._abortSearch(),this._filterOverflowObserver&&=(this._filterOverflowObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getEndpoint(){return(this.getAttribute(`endpoint`)||``).trim()}_getSearchParam(){return(this.getAttribute(`search-param`)||`q`).trim()||`q`}_getPlaceholder(){return this.getAttribute(`placeholder`)||`Search`}_getFilterParam(){return(this.getAttribute(`filter-param`)||``).trim()}_getFilterOptions(){return(this.getAttribute(`filters`)||``).split(`,`).map(e=>e.trim()).filter(Boolean)}_hasSelectedFilters(){return this._selectedFilters.length>0}_getFilterChipOverflowReservePx(){let e=Math.max(1,this._getFilterOptions().length),t=this._hasSelectedFilters()?28:56;return Math.min(200,t+e*34)}_getFilterParamValue(){return this._selectedFilters.join(`,`)}_getFilterChipLabelText(){return this._selectedFilters.join(`, `)}_getCondensedFilterChipLabel(e=22){if(!this._hasSelectedFilters())return``;let[t=``]=this._selectedFilters,n=this._selectedFilters.length-1,r=Math.max(8,e-2),i=t;if(n<=0)return i.length<=r?i:`${i.slice(0,Math.max(1,r-3))}...`;let a=`${t}, and ${n} more`;return a.length<=r?a:`${a.slice(0,Math.max(1,r-3))}...`}_isMobileViewport(){return window.matchMedia(`(max-width: 1099.98px)`).matches}_collapseOnMobile(){let e=this.getAttribute(`collapse-on-mobile`);if(e===null)return!1;let t=e.trim().toLowerCase();return!(t===`false`||t===`0`||t===`off`||t===`none`)}_primarySearchInput(){return this._isMobileViewport()&&this._collapseOnMobile()?this._panelInput:this._desktopInput}_isApplePlatform(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/i.test(navigator.platform)||/Mac OS/i.test(navigator.userAgent)}_parseOpenShortcut(){let e=(this.getAttribute(`open-shortcut`)??`mod+k`).trim().toLowerCase();if(!e||e===`none`||e===`false`||e===`off`)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let t=e.split(`+`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let n=t[t.length-1],r=new Set(t.slice(0,-1).map(e=>e.toLowerCase()));return{disabled:!1,wantMod:r.has(`mod`),wantMeta:r.has(`meta`)||r.has(`cmd`)||r.has(`super`),wantCtrl:r.has(`ctrl`)||r.has(`control`),wantAlt:r.has(`alt`),wantShift:r.has(`shift`),key:n.toLowerCase()}}_eventKeyMatchesShortcutKey(e,t){let n=t.toLowerCase();return(e.key.length,e.key.toLowerCase())===n}_openShortcutMatches(e){let t=this._parseOpenShortcut();return t.disabled||!t.key||e.repeat||!this._eventKeyMatchesShortcutKey(e,t.key)||t.wantShift!==e.shiftKey||t.wantAlt!==e.altKey?!1:t.wantMod||t.wantMeta||t.wantCtrl?!(t.wantMod&&!(e.metaKey||e.ctrlKey)||t.wantMeta&&!e.metaKey||t.wantCtrl&&!e.ctrlKey):!!t.wantAlt}_getOpenShortcutHintText(){let e=this.getAttribute(`open-shortcut-hint`);if(e===`none`||e===`false`)return``;if(e!==null&&e.trim()!==``)return e.trim();let t=this._parseOpenShortcut();if(t.disabled)return``;let n=this._isApplePlatform(),r=[];t.wantMod&&r.push(n?`⌘`:`Ctrl`),t.wantMeta&&!t.wantMod&&r.push(n?`⌘`:`Meta`),t.wantCtrl&&!t.wantMod&&r.push(`Ctrl`),t.wantAlt&&r.push(`Alt`),t.wantShift&&r.push(`Shift`);let i=t.key.length===1?t.key.toUpperCase():t.key;return i?t.wantMod&&!t.wantMeta&&!t.wantCtrl&&!t.wantAlt&&!t.wantShift&&t.key.length===1?`${n?`⌘`:`Ctrl+`}${i}`:[...r,i].join(`+`):``}_attachGlobalHandlers(){this._globalKeydownHandler||(this._globalKeydownHandler=e=>{if(this._openShortcutMatches(e)){e.preventDefault(),this._openSearch(!0);return}if(e.key===`Tab`&&this._searchOpen){let t=e.composedPath();if(this._shell&&t.includes(this._shell)||this._panelInner&&t.includes(this._panelInner)){let t=this._getSearchFocusableElements();if(t.length){let n=document.activeElement,r=n?t.indexOf(n):-1,i=e.shiftKey?-1:1,a=r<0?e.shiftKey?t.length-1:0:(r+i+t.length)%t.length;e.preventDefault(),t[a]?.focus()}}return}if(e.key.toLowerCase()===`escape`&&this._searchOpen){if(this._filtersMoreOpen){this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput());return}this._closeSearch()}},document.addEventListener(`keydown`,this._globalKeydownHandler)),this._docPointerDownHandler||(this._docPointerDownHandler=e=>{if(!this._searchOpen)return;let t=e.composedPath();this._filtersMoreOpen&&this._panelFiltersWrap&&!t.includes(this._panelFiltersWrap)&&(this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput())),!(this._shell&&t.includes(this._shell)||this._panelInner&&t.includes(this._panelInner))&&this._closeSearch()},document.addEventListener(`pointerdown`,this._docPointerDownHandler,!0))}_attachResizeHandler(){this._resizeHandler||(this._resizeHandler=()=>{this._syncPanelVisibility(),this._syncFilterOverflow()},window.addEventListener(`resize`,this._resizeHandler,{passive:!0})),this._scrollHandler||(this._scrollHandler=()=>{this._searchOpen&&this._positionPanel()},document.addEventListener(`scroll`,this._scrollHandler,!0))}_attachFocusOutHandler(){this._focusOutHandler||(this._focusOutHandler=e=>{if(!this._searchOpen)return;let t=e.relatedTarget;t&&(this._shell&&this._shell.contains(t)||this._panelInner&&this._panelInner.contains(t)||this._closeSearch())},this.addEventListener(`focusout`,this._focusOutHandler,!0))}_emitSearchOpenChange(){this.dispatchEvent(new CustomEvent(`search-open-change`,{detail:{open:this._searchOpen},bubbles:!0,composed:!0}))}_openSearch(e=!1){this._getEndpoint()&&(this._searchOpen||(this._searchOpen=!0,this._syncPanelVisibility(),this._emitSearchOpenChange(),e&&this._primarySearchInput()?.focus()))}_closeSearch(){this._searchOpen&&(this._searchOpen=!1,this._filtersMoreOpen=!1,this._syncPanelVisibility(),this._emitSearchOpenChange())}_syncPanelVisibility(){if(this._panel){this._syncPanelLayoutClass(),this._panel.classList.toggle(`is-hidden`,!this._searchOpen),this._panel.classList.toggle(`is-open`,this._searchOpen),this._shell&&this._shell.classList.toggle(`is-open`,this._searchOpen);for(let e of[this._desktopInput,this._panelInput]){let t=e?.querySelector(`input`);t&&(t.setAttribute(`aria-expanded`,String(this._searchOpen)),this._resultsId&&t.setAttribute(`aria-controls`,this._resultsId))}this._positionPanel(),this._searchOpen&&this._scheduleFilterOverflowSync()}}_syncPanelLayoutClass(){if(!this._panel)return;let e=!this._isMobileViewport()||!this._collapseOnMobile();this._panel.classList.toggle(`mint-search-panel-anchored`,e),this._panel.classList.toggle(`mint-search-panel-mobile`,!e),this._panel.classList.toggle(`mint-search-panel-global`,this.classList.contains(`global-search-control`))}_positionPanel(){if(!this._panel)return;if(!(!this._isMobileViewport()||!this._collapseOnMobile())){this._panel.style.left=``,this._panel.style.right=``,this._panel.style.top=``,this._panel.style.bottom=``,this._panel.style.width=``,this._panel.classList.remove(`is-open-above`),this._panelInner&&(this._panelInner.style.maxHeight=``);return}let e=this._shell?.getBoundingClientRect();if(!e)return;let t=window.innerHeight,n=Math.max(0,Math.min(416,t-16)),r=Math.max(0,t-e.bottom-4),i=Math.max(0,e.top-4),a=r<n&&i>r,o=Math.min(n,a?i:r);this._panel.classList.toggle(`is-open-above`,a),this._panelInner&&(this._panelInner.style.maxHeight=`${o}px`),this._panel.style.left=`${e.left}px`,this._panel.style.width=`${e.width}px`,this._panel.style.right=`auto`,a?(this._panel.style.top=`auto`,this._panel.style.bottom=`${Math.max(0,t-e.top-4)}px`):(this._panel.style.top=`${e.bottom-4}px`,this._panel.style.bottom=`auto`)}_setQuery(e){let t=this._query;this._query=e,e!==t&&(this._selectedFilterBackspaceArmed=!1),this._desktopInput&&(this._desktopInput.value=e),this._panelInput&&(this._panelInput.value=e)}_cancelDebounce(){this._debounceId!==null&&(window.clearTimeout(this._debounceId),this._debounceId=null)}_abortSearch(){this._abortController&&=(this._abortController.abort(),null)}_normalizeResults(e){let t=Number.parseInt(this.getAttribute(`results-limit`)||``,10),n=Number.isFinite(t)&&t>0?Math.min(t,1e3):8;return(e=>{if(Array.isArray(e))return e;if(!e||typeof e!=`object`)return[];let t=e;for(let e of[`results`,`items`,`data`,`products`]){let n=t[e];if(Array.isArray(n))return n}return[]})(e).map(e=>{let t=e||{};return{title:String(t.title||t.name||t.label||t.email||t.id||``).trim()||`Untitled`,subtitle:String(t.description||t.category||t.username||``).trim(),parent:String(t.parent||t.type||t.entity||t.kind||t.category||``).trim()||void 0}}).slice(0,n)}_emitResultsChange(e,t){let n=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-results-change`,{detail:{query:this._query,filter:n,filters:[...this._selectedFilters],results:e,raw:t??null},bubbles:!0,composed:!0}))}_emitFilterChange(){let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-filter-change`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters]},bubbles:!0,composed:!0}))}_renderState(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`is-hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`is-hidden`);return}this._stateWrap&&(this._stateWrap.textContent=e,this._stateWrap.classList.remove(`is-hidden`),this._resultsWrap&&(this._resultsWrap.classList.remove(`is-hidden`),this._resultsWrap.innerHTML=``))}_renderResults(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`is-hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`is-hidden`);return}if(!(!this._resultsWrap||!this._stateWrap)){if(this._resultsWrap.innerHTML=``,e.length===0){this._renderState(`No results found`);return}this._stateWrap.classList.add(`is-hidden`);for(let t of e){let e=document.createElement(`button`);e.type=`button`,e.className=`mint-search-result`,e.setAttribute(`role`,`option`),e.setAttribute(`aria-selected`,`false`);let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`mint-search-result-icon`;let r=document.createElement(`div`);r.className=`mint-search-result-copy`;let i=document.createElement(`div`);if(i.className=`mint-search-result-title`,i.textContent=t.title,r.appendChild(i),t.subtitle){let e=document.createElement(`div`);e.className=`mint-search-result-subtitle`,e.textContent=t.subtitle,r.appendChild(e)}e.appendChild(n),e.appendChild(r),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){t.preventDefault(),this._moveFocusInResults(e,1);return}if(t.key===`ArrowUp`){t.preventDefault(),this._moveFocusInResults(e,-1);return}}),e.addEventListener(`click`,()=>{let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-select`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters],result:t},bubbles:!0,composed:!0})),this._closeSearch()}),this._resultsWrap.appendChild(e)}}}_fetchSearchResults(e){let t=this._getEndpoint();if(!t)return;let n=e.trim();if(!n){this._emitResultsChange([]),this._renderState(`Start typing to search`);return}this._abortSearch(),this._abortController=new AbortController,this._renderState(`Searching...`);let r=new URLSearchParams;r.set(this._getSearchParam(),n);let i=this._getFilterParam();i&&this._hasSelectedFilters()&&r.set(i,this._getFilterParamValue());let a=t.includes(`{query}`)?t.replace(`{query}`,encodeURIComponent(n)):`${t}${t.includes(`?`)?`&`:`?`}${r.toString()}`;fetch(a,{signal:this._abortController.signal}).then(e=>{if(!e.ok)throw Error(`Request failed: ${e.status}`);return e.json()}).then(e=>{let t=this._normalizeResults(e);this._emitResultsChange(t,e),this._renderResults(t)}).catch(e=>{e?.name!==`AbortError`&&(this._emitResultsChange([]),this._renderState(`Unable to load results`))})}_scheduleSearch(e){this._setQuery(e),this._cancelDebounce(),this._debounceId=window.setTimeout(()=>this._fetchSearchResults(e),220)}_getNativeInputValue(e){if(!e)return``;let t=e.querySelector(`input, textarea`);return t?t.value||``:e.value||``}_getCurrentInputValue(){let e=document.activeElement;return e&&this._desktopInput&&this._desktopInput.contains(e)?this._getNativeInputValue(this._desktopInput):e&&this._panelInput&&this._panelInput.contains(e)?this._getNativeInputValue(this._panelInput):this._getNativeInputValue(this._primarySearchInput())}_applyFilterSelectionChange(){let e=this._getCurrentInputValue();if(this._setQuery(e),this._emitFilterChange(),this.render(),e.trim()){this._scheduleSearch(e);return}this._cancelDebounce(),this._abortSearch(),this._emitResultsChange([]),this._renderState(`Start typing to search`)}_clearAllSelectedFilters(){this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange()}_popLastSelectedFilter(){this._selectedFilters.length!==0&&(this._selectedFilters.pop(),this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange())}_focusActiveInput(){let e=this._primarySearchInput();e&&requestAnimationFrame(()=>{e.focus()})}_focusHideFiltersControl(){let e=this._panelFiltersShowAllBtn;e&&(e.querySelector(`button`)??e).focus()}_getFilterChipElements(){return this._panelFiltersWrap?Array.from(this._panelFiltersWrap.querySelectorAll(`mint-chip`)):[]}_ensurePanelFiltersShell(){!this._panelFiltersWrap||this._panelFiltersMainRow||(this._panelFiltersWrap.replaceChildren(),this._panelFiltersWrap.className=`mint-search-filters`,this._panelFiltersMainRow=document.createElement(`div`),this._panelFiltersMainRow.className=`mint-search-filter-row`,this._panelFiltersChips=document.createElement(`div`),this._panelFiltersChips.className=`mint-search-filter-chips`,this._panelFiltersMorePanel=document.createElement(`div`),this._panelFiltersMorePanel.id=`mint-search-filter-more-${e._filterMorePanelSeq++}`,this._panelFiltersMorePanel.className=`mint-search-filter-more is-hidden`,this._panelFiltersShowAllWrap=document.createElement(`div`),this._panelFiltersShowAllWrap.className=`mint-search-filter-more-trigger is-hidden`,this._panelFiltersShowAllBtn=document.createElement(`mint-button`),this._panelFiltersShowAllBtn.setAttribute(`type`,`button`),this._panelFiltersShowAllBtn.setAttribute(`variant`,`ghost`),this._panelFiltersShowAllBtn.setAttribute(`tone`,`neutral`),this._panelFiltersShowAllBtn.setAttribute(`size`,`small`),this._panelFiltersShowAllBtn.classList.add(`mint-search-filter-more-button`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,`false`),this._panelFiltersShowAllBtn.setAttribute(`aria-controls`,this._panelFiltersMorePanel.id),this._panelFiltersShowAllBtn.addEventListener(`click`,e=>{e.stopPropagation();let t=this._filtersMoreOpen;this._filtersMoreOpen=!this._filtersMoreOpen,this.render(),t&&requestAnimationFrame(()=>this._focusActiveInput())}),this._panelFiltersShowAllWrap.append(this._panelFiltersShowAllBtn),this._panelFiltersMainRow.append(this._panelFiltersChips,this._panelFiltersShowAllWrap),this._setPanelFiltersShowAllLabel(`Show all`),this._panelFiltersWrap.append(this._panelFiltersMainRow,this._panelFiltersMorePanel),typeof ResizeObserver<`u`&&!this._filterOverflowObserver&&(this._filterOverflowObserver=new ResizeObserver(()=>this._syncFilterOverflow()),this._filterOverflowObserver.observe(this._panelFiltersChips),this._filterOverflowObserver.observe(this._panelFiltersMainRow)))}_setPanelFiltersShowAllLabel(e){let t=this._panelFiltersShowAllBtn;if(!t)return;for(let e of Array.from(t.childNodes))e.nodeType===Node.TEXT_NODE&&e.remove();let n=t.querySelector(`button .mint-button-content`)||t.querySelector(`.mint-button-content`);if(n){n.textContent=e;return}let r=t.querySelector(`:scope > button`);if(r){r.replaceChildren(document.createTextNode(e)),t.render?.();return}t.firstElementChild||t.appendChild(document.createTextNode(e))}_scheduleFilterOverflowSync(){requestAnimationFrame(()=>{requestAnimationFrame(()=>this._syncFilterOverflow())})}_setFilterChipsEdgeFade(t){let n=this._panelFiltersChips;n&&(t?(n.style.maskImage=e._filterChipsOverflowMask,n.style.webkitMaskImage=e._filterChipsOverflowMask):(n.style.maskImage=``,n.style.webkitMaskImage=``))}_syncFilterOverflow(){if(!this._panelFiltersChips||!this._panelFiltersShowAllWrap||!this._panelFiltersShowAllBtn)return;if(this._filtersMoreOpen){this._panelFiltersShowAllWrap.classList.remove(`is-hidden`),this._filterOverflowZeroWidthRetries=0,this._setFilterChipsEdgeFade(!1);return}let e=this._panelFiltersChips.clientWidth;if(e===0&&this._searchOpen){this._filterOverflowZeroWidthRetries<10&&(this._filterOverflowZeroWidthRetries+=1,this._scheduleFilterOverflowSync()),this._setFilterChipsEdgeFade(!1);return}this._filterOverflowZeroWidthRetries=0;let t=this._panelFiltersChips.scrollWidth+this._getFilterChipOverflowReservePx()>e;this._panelFiltersShowAllWrap.classList.toggle(`is-hidden`,!t),this._setFilterChipsEdgeFade(t)}_getResultFocusableElements(){let e=this._customResultsWrap&&!this._customResultsWrap.classList.contains(`is-hidden`)?this._customResultsWrap:this._resultsWrap;return e?Array.from(e.querySelectorAll(`button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])`)):[]}_getSearchFocusableElements(){return[this._shell,this._panelInner].filter(e=>!!e).flatMap(e=>Array.from(e.querySelectorAll(`button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])`))).filter(e=>{if(e.closest(`.is-hidden`)||e.closest(`[aria-hidden="true"]`))return!1;let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}_focusFirstChipOrResult(e=!1){let t=this._getFilterChipElements(),n=this._getResultFocusableElements();if(!e){(t[0]||n[0])?.focus();return}(n[n.length-1]||t[t.length-1])?.focus()}_moveFocusInResults(e,t){let n=this._getResultFocusableElements();if(n.length===0)return;let r=n.indexOf(e);if(r===-1)return;let i=n[r+t];if(i){i.focus();return}if(t===-1){let e=this._getFilterChipElements(),t=e[e.length-1];t?t.focus():this._focusActiveInput()}}_renderSelectedFilter(){let e=e=>{if(!e||(e.innerHTML=``,!this._hasSelectedFilters()))return;let t=document.createElement(`mint-chip`);t.setAttribute(`dismissable`,``),t.title=this._getFilterChipLabelText();let n=this._getCondensedFilterChipLabel();t.classList.add(`mint-search-selected-filter`),this._selectedFilterBackspaceArmed&&t.classList.add(`is-backspace-armed`),t.textContent=n,t.addEventListener(`dismiss`,e=>{e.stopPropagation(),this._clearAllSelectedFilters()}),e.appendChild(t)};e(this._desktopFilterWrap),e(this._mobileFilterWrap);let t=this._hasSelectedFilters();this._desktopInput?.classList.toggle(`has-selected-filter`,t),this._panelInput?.classList.toggle(`has-selected-filter`,t),this._syncSelectedFilterInputOffset(this._desktopInput,this._desktopFilterWrap),this._syncSelectedFilterInputOffset(this._panelInput,this._mobileFilterWrap)}_syncSelectedFilterInputOffset(e,t){if(!e||!t)return;let n=t.querySelector(`mint-chip`);if(!n){e.style.removeProperty(`--mint-search-filter-chip-width`);return}let r=()=>{n.isConnected&&e.style.setProperty(`--mint-search-filter-chip-width`,`${n.getBoundingClientRect().width}px`)};r(),requestAnimationFrame(r)}_bindInputHandlers(e){let t=()=>{this._scheduleSearch(this._getNativeInputValue(e))};e.addEventListener(`focusin`,()=>this._openSearch(!1)),e.addEventListener(`input`,t),e.addEventListener(`search`,t),e.addEventListener(`change`,t),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!1);return}if(t.key===`ArrowUp`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!0);return}if(t.key!==`Backspace`)return;let n=this._getNativeInputValue(e);if(n!==this._query&&this._setQuery(n),!(n.length>0)&&this._hasSelectedFilters()){if(!this._selectedFilterBackspaceArmed){t.preventDefault(),this._selectedFilterBackspaceArmed=!0,this._renderSelectedFilter();return}t.preventDefault(),this._popLastSelectedFilter()}})}openSearch(e=!0){this._openSearch(e)}closeSearch(){this._closeSearch()}toggleSearch(e=!0){if(this._searchOpen){this._closeSearch();return}this._openSearch(e)}isSearchOpen(){return this._searchOpen}render(){let e=this._getEndpoint();if(this.classList.toggle(`is-hidden`,!e),!e){this._searchOpen=!1,this._panel?.classList.add(`is-hidden`);return}if(!this._shell){this._shell=document.createElement(`div`),this._shell.className=`mint-search-shell`,this._desktopFilterWrap=document.createElement(`div`),this._desktopFilterWrap.className=`mint-search-filter-slot`,this._desktopFilterWrap.setAttribute(`slot`,`prepend`),this._desktopInput=document.createElement(`mint-input`),this._desktopInput.setAttribute(`type`,`search`),this._desktopInput.setAttribute(`icon`,`search`),this._desktopInput.setAttribute(`aria-label`,this.getAttribute(`placeholder`)||`Search`),this._desktopInput.className=`mint-search-input`;let e=document.createElement(`span`);e.className=`mint-search-shortcut-hint`,e.setAttribute(`slot`,`append`),this._desktopShortcutHint=e,this._bindInputHandlers(this._desktopInput),this._desktopInput.appendChild(this._desktopFilterWrap),this._desktopInput.appendChild(e),this._shell.appendChild(this._desktopInput),this.appendChild(this._shell)}if(!this._panel){this._panel=document.createElement(`div`),this._panel.className=`mint-search-panel is-hidden`;let e=document.createElement(`div`);e.className=`mint-search-panel-inner`,this._panelInner=e;let t=document.createElement(`div`);this._panelSearchBar=t,t.className=`mint-search-panel-searchbar is-hidden`,this._mobileFilterWrap=document.createElement(`div`),this._mobileFilterWrap.className=`mint-search-filter-slot`,this._mobileFilterWrap.setAttribute(`slot`,`prepend`),this._panelInput=document.createElement(`mint-input`),this._panelInput.setAttribute(`type`,`search`),this._panelInput.setAttribute(`aria-label`,this.getAttribute(`placeholder`)||`Search`),this._panelInput.className=`mint-search-input`,this._bindInputHandlers(this._panelInput),this._panelInput.appendChild(this._mobileFilterWrap),t.appendChild(this._panelInput),this._customResultsWrap=document.createElement(`div`),this._customResultsWrap.className=`mint-search-custom-results is-hidden`,this._stateWrap=document.createElement(`div`),this._stateWrap.className=`mint-search-state`,this._stateWrap.textContent=`Start typing to search`,this._stateWrap.setAttribute(`role`,`status`),this._stateWrap.setAttribute(`aria-live`,`polite`),this._resultsWrap=document.createElement(`div`),this._resultsWrap.className=`mint-search-results`,this._resultsId=`mint-search-results-${Math.random().toString(36).slice(2,10)}`,this._resultsWrap.id=this._resultsId,this._resultsWrap.setAttribute(`role`,`listbox`),this._resultsWrap.setAttribute(`aria-label`,`Search results`),this._customResultsWrap.setAttribute(`role`,`region`),this._customResultsWrap.setAttribute(`aria-label`,`Search results`),e.appendChild(t),this._panelFiltersWrap=document.createElement(`div`),e.appendChild(this._panelFiltersWrap),this._ensurePanelFiltersShell(),e.appendChild(this._customResultsWrap),e.appendChild(this._stateWrap),e.appendChild(this._resultsWrap),this._panel.appendChild(e)}this._panel.parentElement!==document.body&&document.body.appendChild(this._panel);let t=this._hasSelectedFilters()?``:this._getPlaceholder();if(this._desktopInput&&this._desktopInput.setAttribute(`placeholder`,t),this._panelInput&&this._panelInput.setAttribute(`placeholder`,t),this._desktopInput&&this._desktopInput.setAttribute(`aria-label`,this.getAttribute(`aria-label`)||this._getPlaceholder()),this._panelInput&&this._panelInput.setAttribute(`aria-label`,this.getAttribute(`aria-label`)||this._getPlaceholder()),this._desktopShortcutHint){let e=this._getOpenShortcutHintText();this._desktopShortcutHint.textContent=e,this._desktopShortcutHint.classList.toggle(`is-hidden`,!e)}if(this._panelFiltersWrap){this._ensurePanelFiltersShell();let e=this._getFilterOptions();this._selectedFilters=this._selectedFilters.filter(t=>e.includes(t));let t=e.length>0;t||(this._filtersMoreOpen=!1),this._panelFiltersWrap.classList.toggle(`is-hidden`,!t),this._panelInner?.classList.toggle(`has-no-filters`,!t),this._panelFiltersChips&&this._panelFiltersChips.replaceChildren(),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.replaceChildren();let n=this._filtersMoreOpen&&this._panelFiltersMorePanel?this._panelFiltersMorePanel:this._panelFiltersChips;for(let t of e){if(!n)break;let r=document.createElement(`mint-chip`),i=this._selectedFilters.includes(t);if(i&&r.classList.add(`is-selected`),r.classList.add(`mint-search-filter-chip`),i){let e=document.createElement(`span`);e.textContent=t;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`close`),n.className=`mint-search-filter-chip-close`,n.setAttribute(`aria-hidden`,`true`),r.append(e,n)}else r.textContent=t;r.tabIndex=0,r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,i?`Remove filter ${t}`:`Filter by ${t}`),r.dataset.mintSearchFilter=t,r.addEventListener(`pointerdown`,e=>{e.preventDefault()});let a=n=>{n&&n.stopPropagation();let r=this._filtersMoreOpen,i=this._selectedFilters.indexOf(t);i>=0?this._selectedFilters.splice(i,1):this._selectedFilters.push(t),this._selectedFilterBackspaceArmed=!1;let a=e.length>0&&this._selectedFilters.length===e.length,o=this._selectedFilters.length===0;r&&(a||o)&&(this._filtersMoreOpen=!1),this._emitFilterChange(),this._renderSelectedFilter(),this.render(),this._query.trim()&&this._scheduleSearch(this._query),r?a||o?this._focusActiveInput():requestAnimationFrame(()=>{this._getFilterChipElements().find(e=>e.dataset.mintSearchFilter===t)?.focus()}):this._focusActiveInput()};r.addEventListener(`click`,e=>a(e)),r.addEventListener(`keydown`,e=>{let t=this._getFilterChipElements(),n=t.indexOf(r);if(e.key===`Enter`||e.key===` `){e.preventDefault(),a(e);return}if(e.key===`ArrowRight`){e.preventDefault();let r=t[n+1];r&&r.focus();return}if(e.key===`ArrowLeft`){e.preventDefault();let r=t[n-1];r?r.focus():this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}if(e.key===`ArrowDown`){e.preventDefault(),this._getResultFocusableElements()[0]?.focus();return}if(e.key===`ArrowUp`){e.preventDefault(),this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}}),n.appendChild(r)}this._panelFiltersChips&&this._panelFiltersChips.classList.toggle(`is-hidden`,this._filtersMoreOpen),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.classList.toggle(`is-hidden`,!this._filtersMoreOpen),this._panelFiltersShowAllBtn&&(this._setPanelFiltersShowAllLabel(this._filtersMoreOpen?`Hide filters`:`Show all`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,this._filtersMoreOpen?`true`:`false`)),this._panelInner&&(this._filtersMoreOpen&&t?this._panelInner.classList.add(`is-overflow-visible`):this._panelInner.classList.remove(`is-overflow-visible`)),this._scheduleFilterOverflowSync()}if(this._customResultsWrap){Array.from(this.children).filter(e=>e===this._shell||e===this._panel?!1:e.getAttribute(`slot`)===`results`).forEach(e=>this._customResultsWrap.appendChild(e));let e=this._customResultsWrap.childElementCount>0;this._customResultsWrap.classList.toggle(`is-hidden`,!e),e?(this._stateWrap?.classList.add(`is-hidden`),this._resultsWrap?.classList.add(`is-hidden`)):this._resultsWrap?.classList.remove(`is-hidden`)}this._renderSelectedFilter(),this._syncResponsiveChrome(),this._syncPanelVisibility()}_syncResponsiveChrome(){let e=this._collapseOnMobile();this._shell&&this._shell.classList.toggle(`is-collapsed`,e),this._panelSearchBar&&(this._panelSearchBar.classList.toggle(`is-hidden`,!e),this._panelSearchBar.classList.toggle(`is-collapsed`,e))}};customElements.get(`mint-search`)||a(`mint-search`,Dn);var G=`data-mint-select-part`,On=class extends HTMLElement{static get observedAttributes(){return[`name`,`value`,`disabled`,`id`,`required`,`label`,`info`,`error`,`error-message`,`multiple`,`loading`,`aria-label`,`aria-labelledby`,`aria-describedby`]}constructor(){super(),this._select=null,this._wrapper=null,this._caretUpIcon=null,this._caretDownIcon=null,this._changeHandler=null,this._optionObserver=null,this._childrenObserver=null,this._hostOptionsObserverRaf=null,this._generatedControlId=`mint-select-${Math.random().toString(36).slice(2,10)}`}connectedCallback(){this.classList.add(`mint-select-host`),this.getLabel()||console.error(`mint-select: The "label" attribute is required. Please provide a label for the select.`),this.render(),this._childrenObserver&&this._childrenObserver.disconnect(),this._childrenObserver=new MutationObserver(e=>{if(e.some(e=>{let t=e.target;if(this._select&&(t===this._select||this._select.contains(t)))return!1;let n=Array.from(e.addedNodes).some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.tagName===`OPTION`||e.tagName===`OPTGROUP`))||Array.from(e.removedNodes).some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.tagName===`OPTION`||e.tagName===`OPTGROUP`)),r=e.type===`attributes`&&e.target.nodeType===Node.ELEMENT_NODE&&(e.target.tagName===`OPTION`||e.target.tagName===`OPTGROUP`);return n||r})){if(this._hostOptionsObserverRaf!==null)return;this._hostOptionsObserverRaf=requestAnimationFrame(()=>{this._hostOptionsObserverRaf=null,this.isConnected&&this.render()})}}),this._childrenObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`,`selected`,`disabled`]})}disconnectedCallback(){this._select&&this._changeHandler&&(this._select.removeEventListener(`change`,this._changeHandler),this._changeHandler=null),this._optionObserver&&=(this._optionObserver.disconnect(),null),this._childrenObserver&&=(this._childrenObserver.disconnect(),null),this._hostOptionsObserverRaf!==null&&(cancelAnimationFrame(this._hostOptionsObserverRaf),this._hostOptionsObserverRaf=null)}isLoading(){let e=this.getAttribute(`loading`);return e!==null&&e!==`false`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._select&&(this._select.className=this.getSelectClasses(),this._select.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._syncSelectAccessibility());return}if(e===`loading`){this.render();return}if(e===`value`){if(this._select)if(this.isMultiple()){let e=[];try{let t=n?JSON.parse(n):[];e=Array.isArray(t)?t.map(e=>String(e)):[]}catch{e=n?[String(n)]:[]}Array.from(this._select.options).forEach(t=>{t.selected=e.includes(t.value)})}else this._select.value=n||``;return}this.render()}}getName(){return this.getAttribute(`name`)||``}getValue(){if(this.isMultiple()&&this._select){let e=Array.from(this._select.selectedOptions).map(e=>e.value);return JSON.stringify(e)}return this.hasAttribute(`value`)?this.getAttribute(`value`)||``:this._select?this._select.value:``}setValue(e){if(this.isMultiple()){let t=Array.isArray(e)?e.map(e=>String(e)):e==null||e===``?[]:[String(e)];this.setAttribute(`value`,JSON.stringify(t)),this._select&&Array.from(this._select.options).forEach(e=>{e.selected=t.includes(e.value)});return}let t=e==null?``:String(e);this.setAttribute(`value`,t),this._select&&(this._select.value=t)}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{if(this.isMultiple()){this.setValue(e);return}let t=e||``;(this.getAttribute(`value`)||``)!==t&&this.setAttribute(`value`,t),this._select&&requestAnimationFrame(()=>{this._select&&(t===``||Array.from(this._select.options).some(e=>e.value===t))&&this._select.value!==t&&(this._select.value=t)})}catch{}}isDisabled(){let e=this.getAttribute(`disabled`);return e!==null&&e!==`false`}isMultiple(){let e=this.getAttribute(`multiple`);return e!==null&&e!==`false`}isRequired(){let e=this.getAttribute(`required`);return e!==null&&e!==`false`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getSelectClasses(){return[`mint-select-control`,this.isMultiple()?`is-multiple`:``,this.hasError()?`has-error`:``].filter(Boolean).join(` `)}render(){this._hostOptionsObserverRaf!==null&&(cancelAnimationFrame(this._hostOptionsObserverRaf),this._hostOptionsObserverRaf=null);let e=this.isLoading(),t=this.isMultiple(),n=this.getValue(),r=[];this._select&&Array.from(this._select.children).forEach(e=>{(e.tagName===`OPTION`||e.tagName===`OPTGROUP`)&&r.push(e.cloneNode(!0))}),Array.from(this.children).forEach(e=>{e instanceof HTMLElement&&e.hasAttribute(G)&&e.remove()}),this._wrapper=null,this._select=null;let i=Array.from(this.children).filter(e=>e.tagName===`OPTION`||e.tagName===`OPTGROUP`).map(e=>e.cloneNode(!0)),a=this.getLabel(),o=this.getInfo(),s=this.getId()||this._generatedControlId,c=this.getName(),l=this.isDisabled(),u=this.hasError();if(a){let e=document.createElement(`label`);e.setAttribute(G,`label`),e.className=`mint-select-label`,s&&e.setAttribute(`for`,s);let t=document.createTextNode(a);e.appendChild(t),this.appendChild(e)}this._wrapper=document.createElement(`div`),this._wrapper.setAttribute(G,`wrapper`),this._wrapper.className=`mint-select-control-wrap`,this.appendChild(this._wrapper),this._select=document.createElement(`select`),this._select.className=this.getSelectClasses(),s&&(this._select.id=s),c&&(this._select.name=c),l&&(this._select.disabled=!0),this._select.required=this.isRequired(),t&&(this._select.multiple=!0),this._select.setAttribute(`aria-invalid`,u?`true`:`false`);let d=this.getAttribute(`aria-label`)?.trim(),f=this.getAttribute(`aria-labelledby`)?.trim();f?this._select.setAttribute(`aria-labelledby`,f):a?this._select.removeAttribute(`aria-label`):this._select.setAttribute(`aria-label`,d||`Select an option`);let p=i.length>0?i:r;if(p.length>0&&p.forEach(e=>{this._select.appendChild(e)}),this._select.options.length===0){let e=document.createElement(`option`);e.value=``,e.textContent=`Select an option`,e.disabled=!0,e.selected=!0,this._select.appendChild(e)}if(t){let e=[];try{let t=n?JSON.parse(n):[];e=Array.isArray(t)?t.map(e=>String(e)):[]}catch{e=n?[String(n)]:[]}Array.from(this._select.options).forEach(t=>{t.selected=e.includes(t.value)})}else this._select.value=n||``;if(this._changeHandler&&this._select&&this._select.removeEventListener(`change`,this._changeHandler),this._changeHandler=e=>{let n=e.target,r=t?Array.from(n.selectedOptions).map(e=>e.value):n.value,i=t?JSON.stringify(r):String(r||``);(this.getAttribute(`value`)||``)!==i&&(i?this.setAttribute(`value`,i):this.removeAttribute(`value`));let a=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:r},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,cancelable:!0,composed:!0}))},this._select.addEventListener(`change`,this._changeHandler),this._optionObserver&&this._optionObserver.disconnect(),this._optionObserver=new MutationObserver(()=>{let e=this.getAttribute(`value`)||this.value||``;this._select&&e&&requestAnimationFrame(()=>{if(this._select)if(t){let t=[];try{let n=JSON.parse(e);t=Array.isArray(n)?n.map(e=>String(e)):[]}catch{t=[String(e)]}Array.from(this._select.options).forEach(e=>{e.selected=t.includes(e.value)})}else Array.from(this._select.options).some(t=>t.value===e)&&this._select.value!==e&&(this._select.value=e)})}),this._optionObserver.observe(this._select,{childList:!0,subtree:!0}),this._wrapper.appendChild(this._select),t)this._caretUpIcon=null,this._caretDownIcon=null;else{let e=document.createElement(`div`);e.className=`mint-select-caret`,this._caretUpIcon=document.createElement(`mint-icon`),this._caretUpIcon.setAttribute(`name`,`caret-up`),this._caretUpIcon.className=`mint-select-caret-up`,this._caretUpIcon.setAttribute(`aria-hidden`,`true`),e.appendChild(this._caretUpIcon),this._caretDownIcon=document.createElement(`mint-icon`),this._caretDownIcon.setAttribute(`name`,`caret-down`),this._caretDownIcon.className=`mint-select-caret-down`,this._caretDownIcon.setAttribute(`aria-hidden`,`true`),e.appendChild(this._caretDownIcon),this._wrapper.appendChild(e)}if(o){let e=document.createElement(`div`);e.setAttribute(G,`info`),e.className=`mint-select-info`,e.textContent=o,this.appendChild(e)}this._renderErrorState(),this._syncSelectAccessibility(),this._renderSkeleton(e)}_renderSkeleton(e){let t=this.querySelector(`.mint-select-skeleton-container`),n=this._wrapper;if(e){t||(t=document.createElement(`div`),t.className=`mint-select-skeleton-container`,t.setAttribute(`aria-hidden`,`true`),n?n.appendChild(t):this.appendChild(t));let e=t.querySelector(`.mint-select-skeleton`);e||(e=document.createElement(`div`),t.appendChild(e));let r=this.isMultiple();e.classList.toggle(`is-multiple`,r),e.style.height=r?`5rem`:`2rem`,t.style.display=`block`,this._select&&(this._select.style.opacity=`0`,this._select.style.pointerEvents=`none`,this._select.setAttribute(`aria-busy`,`true`))}else t&&(t.style.display=`none`),this._select&&(this._select.style.opacity=`1`,this._select.style.pointerEvents=`auto`,this._select.removeAttribute(`aria-busy`))}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-select-error`);e&&t?(n?n.hasAttribute(G)||n.setAttribute(G,`error`):(n=document.createElement(`div`),n.setAttribute(G,`error`),n.className=`mint-select-error`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_syncSelectAccessibility(){if(!this._select)return;let e=this._select.id||this._generatedControlId,t=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),n=this.querySelector(`[${G}="info"]`),r=this.querySelector(`.mint-select-error`);n&&(n.id=`${e}-info`,t.push(n.id)),r&&(r.id=`${e}-error`,t.push(r.id)),t.length?this._select.setAttribute(`aria-describedby`,Array.from(new Set(t)).join(` `)):this._select.removeAttribute(`aria-describedby`)}};customElements.get(`mint-select`)||a(`mint-select`,On);var kn=class extends HTMLElement{constructor(...e){super(...e),this._trigger=null,this._submenuContainer=null,this._contentObserver=null,this._renderFrame=null}static get observedAttributes(){return[`label`,`icon`,`href`,`active`,`expanded`,`submenu-item`]}connectedCallback(){this.render(),this._observeSubmenuMutations()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`active`&&this._isSubmenuItem()&&this._refreshDropdownAncestor())}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeSubmenuMutations(){this._contentObserver||=new MutationObserver(e=>{e.some(e=>[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>e instanceof HTMLElement&&e.getAttribute(`slot`)===`submenu`))&&this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`],subtree:!1})}_refreshDropdownAncestor(){let e=this.parentElement;for(;e;){if(e.tagName===`MINT-SIDENAV-LINK`&&e!==this){e.render();break}e=e.parentElement}}_isActive(){return this.getAttribute(`active`)===`true`}_isExpanded(){return this.getAttribute(`expanded`)===`true`}_isSubmenuPanelVisible(){return this._isExpanded()||this._isActive()}_isSubmenuItem(){return this.getAttribute(`submenu-item`)===`true`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}_getBaseClasses(){return`mint-sidenav-link-control${this._isActive()?` is-active`:``}${this._isSubmenuItem()?` is-submenu-item`:``}`}_hasSubmenu(){return this.querySelectorAll(`:scope > [slot="submenu"]`).length>0?!0:!!this._submenuContainer&&this._submenuContainer.children.length>0}_createRow(e,t){let n=document.createElement(`span`);if(n.className=`mint-sidenav-link-row`,t){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,t),e.className=`mint-sidenav-link-icon`,e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}let r=document.createElement(`span`);return r.className=`mint-sidenav-link-label`,r.textContent=e,n.appendChild(r),n}_buildSimpleLink(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=e?document.createElement(`a`):document.createElement(`button`);e?r.setAttribute(`href`,e):r.setAttribute(`type`,`button`),r.className=this._getBaseClasses(),r.setAttribute(`aria-label`,t||`Side navigation link`),r.appendChild(this._createRow(t,n)),this.replaceChildren(r),this._trigger=r}_emitAccordionExpand(){this.dispatchEvent(new CustomEvent(`mint-sidenav-accordion`,{bubbles:!0,composed:!0,detail:{source:this}}))}_setExpanded(e,t){this.setAttribute(`expanded`,String(e)),e&&t&&this._emitAccordionExpand()}_buildDropdownLink(){let e=this._getLabel(),t=this._getIcon(),n=this._getHref(),r=Array.from(this.querySelectorAll(`:scope > [slot="submenu"]`)),i=r.length>0?r:this._submenuContainer?Array.from(this._submenuContainer.children):[],a=document.createElement(`div`);a.className=`mint-sidenav-dropdown`,this._submenuContainer=document.createElement(`div`),this._submenuContainer.id=`mint-sidenav-submenu-${Math.random().toString(36).slice(2,11)}`;let o=this._submenuContainer.id;if(this._submenuContainer.className=`mint-sidenav-submenu${this._isSubmenuPanelVisible()?` is-expanded`:``}`,i.forEach(e=>{e.setAttribute(`submenu-item`,`true`),e.setAttribute(`slot`,`submenu`),this._submenuContainer?.appendChild(e)}),n){let r=document.createElement(`div`);r.className=`mint-sidenav-link-row-wrap`;let i=document.createElement(`a`);i.setAttribute(`href`,n),i.className=`${this._getBaseClasses()} mint-sidenav-desktop-link`,i.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),i.setAttribute(`aria-controls`,o),this._isActive()?i.setAttribute(`aria-current`,`page`):i.removeAttribute(`aria-current`),i.appendChild(this._createRow(e,t)),i.addEventListener(`click`,()=>{this._setExpanded(!0,!0)});let s=document.createElement(`a`);s.setAttribute(`href`,n),s.className=`${this._getBaseClasses()} mint-sidenav-mobile-link`,s.setAttribute(`aria-controls`,o),s.appendChild(this._createRow(e,t)),this._isActive()?s.setAttribute(`aria-current`,`page`):s.removeAttribute(`aria-current`);let c=document.createElement(`button`);c.type=`button`,c.className=`mint-sidenav-mobile-toggle`,c.setAttribute(`aria-label`,`Toggle ${e} submenu`),c.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),c.setAttribute(`aria-controls`,o),c.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation();let t=!this._isExpanded();this._setExpanded(t,t)});let l=document.createElement(`mint-icon`);l.setAttribute(`name`,`caret-down`),l.className=`mint-sidenav-dropdown-caret${this._isSubmenuPanelVisible()?` is-expanded`:``}`,l.setAttribute(`aria-hidden`,`true`),c.appendChild(l),r.appendChild(i),r.appendChild(s),r.appendChild(c),a.appendChild(r),this._trigger=i}else{let n=document.createElement(`button`);n.type=`button`,n.className=this._getBaseClasses(),n.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),n.setAttribute(`aria-controls`,o),n.appendChild(this._createRow(e,t)),n.onclick=()=>{let e=!this._isExpanded();this._setExpanded(e,e)},a.appendChild(n),this._trigger=n}a.appendChild(this._submenuContainer),this.replaceChildren(a)}render(){this._hasSubmenu()&&!this._isSubmenuItem()?this._buildDropdownLink():this._buildSimpleLink()}};customElements.get(`mint-sidenav-link`)||a(`mint-sidenav-link`,kn);var An=class extends HTMLElement{constructor(...e){super(...e),this._container=null,this._title=null,this._titleLabel=null,this._titleCaret=null,this._titleIsInteractive=null,this._list=null,this._titleClickHandler=null,this._listenerCounts=new Map}static get observedAttributes(){return[`name`]}get onMintNameClick(){return this._onMintNameClick}set onMintNameClick(e){this._onMintNameClick=e,this.render()}addEventListener(e,t,n){super.addEventListener(e,t,n),this._trackListener(e,1)}removeEventListener(e,t,n){super.removeEventListener(e,t,n),this._trackListener(e,-1)}connectedCallback(){this.render()}disconnectedCallback(){this._title instanceof HTMLButtonElement&&this._titleClickHandler&&this._title.removeEventListener(`click`,this._titleClickHandler)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getName(){return this.getAttribute(`name`)||``}_trackListener(e,t){if(e!==`mint-name-click`)return;let n=this._listenerCounts.get(e)||0,r=Math.max(0,n+t);this._listenerCounts.set(e,r),this.render()}_isNameInteractive(){return(this._listenerCounts.get(`mint-name-click`)||0)>0||typeof this._onMintNameClick==`function`}_emitNameClick(e){let t=new CustomEvent(`mint-name-click`,{detail:{name:this._getName(),originalEvent:e},bubbles:!0,composed:!0});this.dispatchEvent(t),typeof this._onMintNameClick==`function`&&this._onMintNameClick(t)}render(){this._container||(this._container=document.createElement(`section`),this._container.className=`mint-sidenav-link-group`,this.appendChild(this._container));let e=this._getName(),t=e.trim().length>0,n=this._isNameInteractive();if(!this._title||this._titleIsInteractive!==n){this._title instanceof HTMLButtonElement&&this._titleClickHandler&&this._title.removeEventListener(`click`,this._titleClickHandler);let e=n?document.createElement(`button`):document.createElement(`div`);e instanceof HTMLButtonElement?(e.type=`button`,this._titleClickHandler=e=>this._emitNameClick(e),e.addEventListener(`click`,this._titleClickHandler)):(e.setAttribute(`role`,`heading`),e.setAttribute(`aria-level`,`3`),this._titleClickHandler=null),e.className=`mint-sidenav-group-trigger${n?` is-interactive`:``}`,this._titleLabel=document.createElement(`mint-text`),this._titleLabel.setAttribute(`size`,`small`),this._titleLabel.setAttribute(`bold`,`true`),this._titleLabel.className=n?`mint-sidenav-group-label is-interactive`:`mint-sidenav-group-label`,e.appendChild(this._titleLabel),this._titleCaret=null,n&&(this._titleCaret=document.createElement(`mint-icon`),this._titleCaret.setAttribute(`name`,`caret-right`),this._titleCaret.className=`mint-sidenav-group-caret`,this._titleCaret.setAttribute(`aria-hidden`,`true`),e.appendChild(this._titleCaret)),this._title?.parentElement===this._container?this._container.replaceChild(e,this._title):this._container.appendChild(e),this._title=e,this._titleIsInteractive=n}this._titleLabel&&(this._titleLabel.textContent=e,this._titleLabel.className=n?`mint-sidenav-group-label is-interactive`:`mint-sidenav-group-label`),this._title&&(this._title.className=`mint-sidenav-group-trigger${n?` is-interactive`:``}`),t?this._title.parentElement!==this._container&&this._container?.insertBefore(this._title,this._list):this._title.parentElement===this._container&&this._container?.removeChild(this._title),this._list||(this._list=document.createElement(`div`),this._list.className=`mint-sidenav-link-list`,this._container.appendChild(this._list)),Array.from(this.children).filter(e=>e!==this._container&&e.tagName===`MINT-SIDENAV-LINK`).forEach(e=>{this._list&&e.parentElement!==this._list&&this._list.appendChild(e)})}};customElements.get(`mint-sidenav-links`)||a(`mint-sidenav-links`,An);var jn=class extends HTMLElement{static get observedAttributes(){return[`separated`]}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isSeparated(){return this.getAttribute(`separated`)===`true`}render(){this.className=this._isSeparated()?`mint-sidenav-action-links is-separated`:`mint-sidenav-action-links`}};customElements.get(`mint-sidenav-action-links`)||a(`mint-sidenav-action-links`,jn);var Mn=class extends HTMLElement{constructor(...e){super(...e),this._wrapper=null,this._trigger=null,this._popover=null,this._triggerId=``,this._contentObserver=null,this._renderFrame=null}static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this._triggerId=this.id?`${this.id}-trigger`:`mint-sidenav-action-menu-${Math.random().toString(36).slice(2,9)}`,this.render(),this._observeContentMutations()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getTitle(){return this.getAttribute(`title`)||``}_getSubtitle(){return this.getAttribute(`subtitle`)||``}_createDefaultGroup(){let e=document.createElement(`mint-sidenav-action-links`),t=document.createElement(`div`);return t.appendChild(e),t}render(){let e=Array.from(this.children).filter(e=>e!==this._wrapper&&e.getAttribute(`slot`)===`action-links`);this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`mint-sidenav-action-menu-wrap`,this.appendChild(this._wrapper)),this._wrapper.innerHTML=``,this._trigger=document.createElement(`button`),this._trigger.type=`button`,this._trigger.id=this._triggerId,this._trigger.className=`mint-sidenav-action-trigger`;let t=document.createElement(`div`);t.className=`mint-sidenav-avatar`,t.textContent=this._getTitle().split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase();let n=document.createElement(`div`);n.className=`mint-sidenav-action-text`;let r=document.createElement(`mint-text`);r.setAttribute(`size`,`body`),r.setAttribute(`bold`,`true`),r.className=`mint-sidenav-action-title`,r.textContent=this._getTitle();let i=document.createElement(`mint-text`);i.setAttribute(`size`,`small`),i.setAttribute(`variant`,`muted`),i.className=`mint-sidenav-action-subtitle`,i.textContent=this._getSubtitle(),n.appendChild(r),n.appendChild(i),this._trigger.appendChild(t),this._trigger.appendChild(n),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`right`),this._popover.setAttribute(`padding`,`0`);let a=document.createElement(`div`);a.className=`mint-sidenav-action-menu-content`,e.length>0?e.forEach(e=>{let t=e;t.setAttribute(`hidden`,`true`),t.style.display=`none`;let n=t.cloneNode(!0);n.removeAttribute(`hidden`),n.style.removeProperty(`display`),n.removeAttribute(`slot`),[...n.matches(`mint-button`)?[n]:[],...Array.from(n.querySelectorAll(`mint-button`))].forEach(e=>{let t=e.querySelector(`:scope > button`);for(;t;){let e=t.querySelector(`button`);if(!e)break;e.replaceWith(...Array.from(e.childNodes))}}),a.appendChild(n)}):a.appendChild(this._createDefaultGroup()),this._popover.appendChild(a),this._wrapper.appendChild(this._trigger),this._wrapper.appendChild(this._popover)}};customElements.get(`mint-sidenav-action-menu`)||a(`mint-sidenav-action-menu`,Mn);var K=`mint:url-change`;function Nn(){if(window.__mintUrlChangePatched)return;window.__mintUrlChangePatched=!0;let e=()=>{window.dispatchEvent(new Event(K))},t=t=>{let n=history[t].bind(history);history[t]=((...t)=>{let r=n(...t);return e(),r})};t(`pushState`),t(`replaceState`)}var Pn=class extends HTMLElement{constructor(...e){super(...e),this._backdrop=null,this._container=null,this._header=null,this._content=null,this._footer=null,this._escapeHandler=null,this._mediaQuery=null,this._mediaListener=null,this._accordionHandler=null,this._urlChangeHandler=null,this._contentObserver=null,this._renderFrame=null,this._onMobileNavNavigateClick=e=>{if(this._mediaQuery?.matches)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement)||!this._container?.contains(n))return;let r=n.getAttribute(`href`);!r||r===`#`||r.trim().toLowerCase().startsWith(`javascript:`)||this._isOpen()&&this.removeAttribute(`open`)}}static get observedAttributes(){return[`user-name`,`user-status`,`open`,`drawer-top-class`,`preview`]}connectedCallback(){this._attachEscapeListener(),this._attachMediaListener(),this._attachAccordionListener(),this._attachUrlChangeListener(),this._observeContentMutations(),this.render()}disconnectedCallback(){this._detachEscapeListener(),this._detachMediaListener(),this._detachAccordionListener(),this._detachUrlChangeListener(),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_attachEscapeListener(){this._escapeHandler||(this._escapeHandler=e=>{e.key===`Escape`&&this.getAttribute(`open`)===`true`&&this.removeAttribute(`open`)},document.addEventListener(`keydown`,this._escapeHandler))}_detachEscapeListener(){this._escapeHandler&&=(document.removeEventListener(`keydown`,this._escapeHandler),null)}_attachMediaListener(){this._mediaListener||(this._mediaQuery=window.matchMedia(`(min-width: 1100px)`),this._mediaListener=()=>{this._mediaQuery?.matches&&this.removeAttribute(`open`)},this._mediaQuery.addEventListener(`change`,this._mediaListener))}_detachMediaListener(){this._mediaQuery&&this._mediaListener&&this._mediaQuery.removeEventListener(`change`,this._mediaListener),this._mediaQuery=null,this._mediaListener=null}_attachAccordionListener(){this._accordionHandler||(this._accordionHandler=e=>{let t=e.detail?.source;!(t instanceof HTMLElement)||t.tagName!==`MINT-SIDENAV-LINK`||this.contains(t)&&this.querySelectorAll(`mint-sidenav-link`).forEach(e=>{e!==t&&e.querySelector(`:scope .mint-sidenav-submenu`)&&e.setAttribute(`expanded`,`false`)})},this.addEventListener(`mint-sidenav-accordion`,this._accordionHandler))}_detachAccordionListener(){this._accordionHandler&&=(this.removeEventListener(`mint-sidenav-accordion`,this._accordionHandler),null)}_attachUrlChangeListener(){this._urlChangeHandler||(Nn(),this._urlChangeHandler=()=>{this._mediaQuery?.matches||this._isOpen()&&this.removeAttribute(`open`)},window.addEventListener(`popstate`,this._urlChangeHandler),window.addEventListener(`hashchange`,this._urlChangeHandler),window.addEventListener(K,this._urlChangeHandler))}_detachUrlChangeListener(){this._urlChangeHandler&&=(window.removeEventListener(`popstate`,this._urlChangeHandler),window.removeEventListener(`hashchange`,this._urlChangeHandler),window.removeEventListener(K,this._urlChangeHandler),null)}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}getUserName(){return this.getAttribute(`user-name`)||`Acme Inc`}getUserStatus(){return this.getAttribute(`user-status`)||`Enterprise`}_isOpen(){return this.getAttribute(`open`)===`true`}_ensureBackdrop(){this._backdrop||(this._backdrop=document.createElement(`div`),this._backdrop.setAttribute(`aria-hidden`,`true`),this._backdrop.addEventListener(`click`,()=>this.removeAttribute(`open`)),this.insertBefore(this._backdrop,this.firstChild))}_ensureContainer(){this._container||(this._container=document.createElement(`aside`),this._container.addEventListener(`click`,this._onMobileNavNavigateClick,!0),this.appendChild(this._container))}_syncShell(){let e=this._isOpen(),t=this.hasAttribute(`preview`);this._backdrop&&(this._backdrop.className=`mint-sidenav-backdrop${e&&!t?` is-open`:``}`),this._container&&(this._container.className=`mint-sidenav-panel${e?` is-open`:``}${t?` is-preview`:``}`)}_buildUserHeader(){if(!this._container)return;this._header||(this._header=document.createElement(`div`),this._header.className=`mint-sidenav-header`,this._container.appendChild(this._header));let e=Array.from(this.querySelectorAll(`[slot="action-header"]`)).find(e=>e!==this._backdrop&&e!==this._container);if(e){this._header.replaceChildren(e);return}let t=document.createElement(`mint-sidenav-action-menu`);t.setAttribute(`title`,this.getUserName()),t.setAttribute(`subtitle`,this.getUserStatus()),this._header.replaceChildren(t)}_replaceSlottedChildren(e,t){let n=Array.from(this.querySelectorAll(`[slot="${t}"]`)).filter(e=>e!==this._container&&e!==this._backdrop);e.replaceChildren(...n)}_buildContent(){this._container&&(this._content||(this._content=document.createElement(`div`),this._content.className=`mint-sidenav-content`,this._container.appendChild(this._content)),this._replaceSlottedChildren(this._content,`links`))}_buildFooter(){if(!this._container)return;this._footer||(this._footer=document.createElement(`div`),this._footer.className=`mint-sidenav-footer`,this._container.appendChild(this._footer));let e=document.createElement(`div`);e.className=`mint-sidenav-footer-links`,this._replaceSlottedChildren(e,`bottom-links`),this._footer.innerHTML=``,this._footer.appendChild(e)}render(){this._ensureBackdrop(),this._ensureContainer(),this._syncShell(),this._buildUserHeader(),this._buildContent(),this._buildFooter()}};customElements.get(`mint-side-navigation`)||a(`mint-side-navigation`,Pn);var Fn=Pn,q=`mint-sortable-placeholder`,J=`mint-sortable-dragging`,In=class extends HTMLElement{static get observedAttributes(){return[`direction`,`gap`,`text-align`,`align-content`,`scroll-max-height`,`disabled`,`handle-selector`,`scroll-sensitivity`,`scroll-speed`,`animation-duration`,`item-key-attribute`]}constructor(){super(),this._pointerId=null,this._dragEl=null,this._placeholder=null,this._listRoot=this,this._startIndex=0,this._pointerStartX=0,this._pointerStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._scrollRaf=null,this._childObserver=null,this._pointerBoundRoot=null,this._restoreAfter=null,this._sortStatus=null,this._keyboardKeydownHandler=e=>this._onKeyboardReorder(e),this._onListPointerDown=e=>{let t=e;if(this._isDisabled()||this._pointerId!==null||t.button!==0)return;let n=t.target;if(!n||!this.contains(n))return;let r=this._closestSortableItem(n);if(!r||!this._listRoot.contains(r)||r.hasAttribute(`data-sortable-disabled`))return;let i=this._getHandleSelector();if(i){let e=t.target.closest(i);if(!e||!r.contains(e))return}t.preventDefault(),this._startDrag(t,r)},this._boundPointerMove=this._onPointerMove.bind(this),this._boundPointerUp=this._onPointerUp.bind(this),this._boundPointerCancel=this._onPointerCancel.bind(this)}connectedCallback(){this.classList.add(`mint-sortable`),this._syncInnerStackAttributes(),this._applyHostScrollAndLayout(),this.addEventListener(`keydown`,this._keyboardKeydownHandler),this._observeInnerStack()}disconnectedCallback(){this._unobserveInnerStack(),this.removeEventListener(`keydown`,this._keyboardKeydownHandler),this._teardownDrag(),this._pointerBoundRoot&&=(this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),null)}attributeChangedCallback(e,t,n){t!==n&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}_observeInnerStack(){this._childObserver||(this._childObserver=new MutationObserver(()=>{this._pointerId===null&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}),this._childObserver.observe(this,{childList:!0}))}_unobserveInnerStack(){this._childObserver&&=(this._childObserver.disconnect(),null)}_getInnerStack(){for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-STACK`)return t}return null}_resolveListRoot(){return this._getInnerStack()??this}_getItemKeyAttribute(){return this.getAttribute(`item-key-attribute`)?.trim()||`data-sortable-id`}_collectOrderedKeys(){let e=this._resolveListRoot(),t=this._getItemKeyAttribute(),n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r];if(i.nodeType!==Node.ELEMENT_NODE)continue;let a=i;a.classList.contains(q)||a.hasAttribute(`data-mint-sortable-status`)||n.push(a.getAttribute(t)??``)}return n}_syncInnerStackAttributes(){let e=this._getInnerStack();if(!e)return;let t=this.getDirection(),n=this.getGap(),r=this.getTextAlign();e.setAttribute(`direction`,t),e.setAttribute(`gap`,String(n)),r?e.setAttribute(`text-align`,r):e.removeAttribute(`text-align`);let i=this.getAlignContent();i?e.setAttribute(`align-content`,i):e.removeAttribute(`align-content`)}_applyHostScrollAndLayout(){this._listRoot=this._resolveListRoot();let e=this.getAttribute(`scroll-max-height`);e?(this.style.maxHeight=e,this.style.overflowY=`auto`,this.style.overflowX=`hidden`,this.classList.add(`mint-sortable-scrollable`)):(this.style.maxHeight=``,this.style.overflowY=``,this.style.overflowX=``,this.classList.remove(`mint-sortable-scrollable`));let t=this._getInnerStack();this.classList.toggle(`mint-sortable-has-inner-stack`,!!t);let n=this.getDirection(),r=this.getAlignContent(),i=Math.min(12,Math.max(1,Math.round(this.getGap()))),a=this.getTextAlign();this.style.setProperty(`--mint-sortable-direction`,n===`horizontal`?`row`:`column`),this.style.setProperty(`--mint-sortable-gap`,`${i*.25}rem`),this.style.setProperty(`--mint-sortable-text-align`,a||`initial`),this.style.setProperty(`--mint-sortable-button-justify`,a===`left`?`flex-start`:a===`right`?`flex-end`:`center`);let o=r?r===`left`?`flex-start`:r===`right`?`flex-end`:`center`:``,s=n===`vertical`&&o||`stretch`,c=n===`horizontal`&&o||`flex-start`;this.style.setProperty(`--mint-sortable-cross-align`,s),this.style.setProperty(`--mint-sortable-main-align`,c),this._ensureListPointerBinding(),this._syncKeyboardAccessibility()}_syncKeyboardAccessibility(){let e=this._resolveListRoot();e.hasAttribute(`role`)||e.setAttribute(`role`,`list`),this._sortStatus||(this._sortStatus=document.createElement(`div`),this._sortStatus.className=`mint-sortable-status`,this._sortStatus.setAttribute(`role`,`status`),this._sortStatus.setAttribute(`aria-live`,`polite`),this._sortStatus.setAttribute(`aria-atomic`,`true`),this._sortStatus.setAttribute(`data-mint-sortable-status`,``),this.appendChild(this._sortStatus)),this._getLayoutChildren().forEach(e=>{e.classList.contains(q)||(e.hasAttribute(`role`)||e.setAttribute(`role`,`listitem`),e.hasAttribute(`tabindex`)||(e.tabIndex=0),e.setAttribute(`aria-keyshortcuts`,`Alt+ArrowUp Alt+ArrowDown`),e.hasAttribute(`aria-roledescription`)||e.setAttribute(`aria-roledescription`,`sortable item`))})}_onKeyboardReorder(e){if(this._isDisabled()||!e.altKey||![`ArrowUp`,`ArrowDown`].includes(e.key))return;let t=e.target instanceof Element?e.target:null,n=t?this._closestSortableItem(t):null;if(!n||n.hasAttribute(`data-sortable-disabled`))return;let r=this._getLayoutChildren().filter(e=>!e.classList.contains(q)),i=r.indexOf(n),a=i+(e.key===`ArrowUp`?-1:1);if(i<0||a<0||a>=r.length)return;e.preventDefault();let o=r[a];e.key===`ArrowUp`?this._listRoot.insertBefore(n,o):this._listRoot.insertBefore(o,n),n.focus({preventScroll:!0});let s=this._collectOrderedKeys(),c=this._indexOfItem(n),l=n.getAttribute(`aria-label`)||n.textContent?.trim().replace(/\s+/g,` `)||`Item`;this._sortStatus&&(this._sortStatus.textContent=`${l} moved to position ${c+1} of ${r.length}.`);let u={oldIndex:i,newIndex:c,keys:s};this.dispatchEvent(new CustomEvent(`mint-sortable-change`,{bubbles:!0,composed:!0,detail:u})),this.dispatchEvent(new CustomEvent(`mint-sortable-order`,{bubbles:!0,composed:!0,detail:{keys:s}}))}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`,t=parseFloat(e);return Number.isFinite(t)?t:3}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`left`||e===`right`||e===`center`?e:``}_isDisabled(){return this.hasAttribute(`disabled`)&&this.getAttribute(`disabled`)!==`false`}_getHandleSelector(){let e=this.getAttribute(`handle-selector`);return e&&e.trim()?e.trim():null}_getScrollSensitivity(){let e=parseFloat(this.getAttribute(`scroll-sensitivity`)||`48`);return Number.isFinite(e)?e:48}_getScrollSpeed(){let e=parseFloat(this.getAttribute(`scroll-speed`)||`12`);return Number.isFinite(e)?e:12}_getAnimationDurationMs(){let e=parseFloat(this.getAttribute(`animation-duration`)||`220`);return Number.isFinite(e)?Math.max(0,e):220}_ensureListPointerBinding(){let e=this._resolveListRoot();this._pointerBoundRoot!==e&&(this._pointerBoundRoot&&this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),e.addEventListener(`pointerdown`,this._onListPointerDown),this._pointerBoundRoot=e,this._listRoot=e)}_closestSortableItem(e){let t=e;for(;t&&t!==this._listRoot;){if(t.nodeType===Node.ELEMENT_NODE){let e=t;if(e.classList.contains(q)||e.classList.contains(J))return null;if(t.parentElement===this._listRoot)return e}t=t.parentElement}return null}_startDrag(e,t){this._listRoot=this._resolveListRoot(),this._restoreAfter=t.nextElementSibling,this._dragEl=t,this._pointerId=e.pointerId,this._startIndex=this._indexOfItem(t);let n=t.getBoundingClientRect();this._pointerStartX=e.clientX,this._pointerStartY=e.clientY,this._dragStartLeft=n.left,this._dragStartTop=n.top;let r=document.createElement(`div`);r.className=q,r.style.minHeight=`${n.height}px`,r.style.minWidth=`${n.width}px`,r.setAttribute(`aria-hidden`,`true`),this._placeholder=r,this._listRoot.insertBefore(r,t),t.classList.add(J),t.style.position=`fixed`,t.style.left=`${n.left}px`,t.style.top=`${n.top}px`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,t.style.margin=`0`,t.style.zIndex=`10000`,t.style.boxSizing=`border-box`,t.style.pointerEvents=`none`,t.style.touchAction=`none`,t.style.willChange=`transform, left, top`,t.setPointerCapture(e.pointerId);let i=this._collectOrderedKeys(),a={index:this._startIndex,keys:i};this.dispatchEvent(new CustomEvent(`mint-sortable-start`,{bubbles:!0,composed:!0,detail:a})),this.dispatchEvent(new CustomEvent(`sort-start`,{bubbles:!0,composed:!0,detail:a})),window.addEventListener(`pointermove`,this._boundPointerMove,{passive:!1}),window.addEventListener(`pointerup`,this._boundPointerUp),window.addEventListener(`pointercancel`,this._boundPointerCancel)}_indexOfItem(e){let t=0;for(let n=0;n<this._listRoot.children.length;n++){let r=this._listRoot.children[n];if(r.nodeType!==Node.ELEMENT_NODE)continue;let i=r;if(!i.classList.contains(q)){if(i===e)return t;t++}}return-1}_getLayoutChildren(){return Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&!e.hasAttribute(`data-mint-sortable-status`))}_onPointerMove(e){if(e.pointerId!==this._pointerId||!this._dragEl||!this._placeholder)return;e.preventDefault();let t=e.clientX-this._pointerStartX,n=e.clientY-this._pointerStartY;this._dragEl.style.left=`${this._dragStartLeft+t}px`,this._dragEl.style.top=`${this._dragStartTop+n}px`,this._autoScroll(e),this._maybeMovePlaceholder(e)}_autoScroll(e){let t=this;if(!t.style.maxHeight)return;let n=this._getScrollSensitivity(),r=this._getScrollSpeed(),i=t.getBoundingClientRect();this._scrollRaf!==null&&cancelAnimationFrame(this._scrollRaf),this._scrollRaf=requestAnimationFrame(()=>{this._scrollRaf=null;let a=0;e.clientY<i.top+n?a=-r:e.clientY>i.bottom-n&&(a=r),a!==0&&(t.scrollTop+=a,this._maybeMovePlaceholder(e))})}_maybeMovePlaceholder(e){let t=this._placeholder,n=this._dragEl;if(!t||!n)return;let r=this.getDirection()===`horizontal`,i=r?e.clientX:e.clientY,a=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n&&e!==t),o=null;for(let e of a){let t=e.getBoundingClientRect();if(i<(r?t.left+t.width/2:t.top+t.height/2)){o=e;break}}let s=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n),c=s.length>0&&s[s.length-1]===t;(o?!(t.nextSibling===o&&t.parentNode===this._listRoot):!c)&&this._flipAnimate(()=>{o?this._listRoot.insertBefore(t,o):this._listRoot.appendChild(t)})}_flipAnimate(e){let t=this._dragEl,n=this._getAnimationDurationMs(),r=this._getLayoutChildren().filter(e=>e!==t),i=new Map;r.forEach(e=>i.set(e,e.getBoundingClientRect())),e(),!(n<=0)&&r.forEach(e=>{let t=i.get(e);if(!t)return;let r=e.getBoundingClientRect(),a=t.left-r.left,o=t.top-r.top;Math.abs(a)<.5&&Math.abs(o)<.5||(e.style.transition=`none`,e.style.transform=`translate(${a}px, ${o}px)`,requestAnimationFrame(()=>{e.style.transition=`transform ${n}ms cubic-bezier(0.2, 0.8, 0.2, 1)`,e.style.transform=``;let t=()=>{e.removeEventListener(`transitionend`,t),e.style.transition=``,e.style.transform=``};e.addEventListener(`transitionend`,t,{once:!0}),setTimeout(t,n+40)}))})}_onPointerUp(e){e.pointerId===this._pointerId&&this._finishDrag(!1)}_onPointerCancel(e){e.pointerId===this._pointerId&&this._finishDrag(!0)}_finishDrag(e){let t=this._dragEl,n=this._placeholder;if(!t||this._pointerId===null){this._teardownDrag();return}try{t.releasePointerCapture(this._pointerId)}catch{}if(window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),e){let e=this._restoreAfter;e&&e.parentNode===this._listRoot?this._listRoot.insertBefore(t,e):this._listRoot.appendChild(t)}else n?.parentNode&&this._listRoot.insertBefore(t,n);n?.remove(),this._placeholder=null,t.classList.remove(J),t.style.cssText=``;let r=this._indexOfItem(t),i=this._startIndex;this._pointerId=null,this._dragEl=null,this._restoreAfter=null;let a=this._collectOrderedKeys(),o={oldIndex:i,newIndex:r,cancelled:e,keys:a};this.dispatchEvent(new CustomEvent(`mint-sortable-end`,{bubbles:!0,composed:!0,detail:o})),this.dispatchEvent(new CustomEvent(`sort-stop`,{bubbles:!0,composed:!0,detail:o})),!e&&r!==i&&(this.dispatchEvent(new CustomEvent(`mint-sortable-change`,{bubbles:!0,composed:!0,detail:{oldIndex:i,newIndex:r,keys:a}})),this.dispatchEvent(new CustomEvent(`mint-sortable-order`,{bubbles:!0,composed:!0,detail:{keys:a}})))}_teardownDrag(){if(this._scrollRaf!==null&&(cancelAnimationFrame(this._scrollRaf),this._scrollRaf=null),window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),this._dragEl){try{this._pointerId!==null&&this._dragEl.releasePointerCapture(this._pointerId)}catch{}this._dragEl.classList.remove(J),this._dragEl.style.cssText=``}this._placeholder?.remove(),this._placeholder=null,this._dragEl=null,this._pointerId=null,this._restoreAfter=null}};customElements.get(`mint-sortable`)||a(`mint-sortable`,In);var Ln=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null}connectedCallback(){this.render(),this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}e.__mintTabsSynthetic||(e.stopPropagation(),this.dispatchEvent(new CustomEvent(`tab-click`,{detail:{tab:this,target:this.getTarget()},bubbles:!0,cancelable:!0,composed:!0})))}};customElements.get(`mint-tab`)||a(`mint-tab`,Ln);var Y=class extends HTMLElement{static get observedAttributes(){return[`position`]}constructor(){super()}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getPosition(){return this.getAttribute(`position`)||`top`}render(){this.setAttribute(`role`,`tablist`),!this.hasAttribute(`aria-label`)&&!this.hasAttribute(`aria-labelledby`)&&this.setAttribute(`aria-label`,`Tabs`),this.setAttribute(`aria-orientation`,this.getPosition()===`top`?`horizontal`:`vertical`)}};customElements.get(`mint-tab-list`)||a(`mint-tab-list`,Y);var Rn=class extends HTMLElement{static get observedAttributes(){return[`id`]}constructor(){super()}connectedCallback(){this.render(),this.checkInitialVisibility()}attributeChangedCallback(e,t,n){t!==n&&e===`id`&&(this.render(),this.checkInitialVisibility())}getId(){return this.getAttribute(`id`)||``}show(){this.removeAttribute(`hidden`)}hide(){this.setAttribute(`hidden`,``)}checkInitialVisibility(){let e=this.closest(`mint-tabs`);if(!e){this.hide();return}let t=e.querySelectorAll(`mint-tab`),n=!1;t.forEach(e=>{let t=e.getAttribute(`active`),r=e.getAttribute(`target`),i=this.getId();t===`true`&&r===i&&(n=!0)}),!n&&t.length>0&&t[0].getAttribute(`target`)===this.getId()&&!e.querySelector(`mint-tab[active="true"]`)&&(n=!0),n?this.show():this.hide()}render(){this.setAttribute(`role`,`tabpanel`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`)}};customElements.get(`mint-tab-content`)||a(`mint-tab-content`,Rn);var zn=class e extends HTMLElement{static{this._id=0}constructor(){super(),this._tabClickHandler=null,this._tabKeydownHandler=null,this._mutationObserver=null}connectedCallback(){this.render(),this.setupEventListeners(),this.setupMutationObserver(),this.initializeActiveTab()}disconnectedCallback(){this.removeEventListeners(),this._mutationObserver&&=(this._mutationObserver.disconnect(),null)}render(){let e=this.querySelector(`mint-tab-list`);if(this.querySelectorAll(`mint-tab-content`),!e){console.warn(`mint-tabs: mint-tab-list is required`);return}this.syncAccessibility()}initializeActiveTab(){requestAnimationFrame(()=>{let e=this.querySelectorAll(`mint-tab`),t=null;if(e.forEach(e=>{e.getAttribute(`active`)===`true`&&(t=e)}),!t&&e.length>0&&(t=e[0],t.setAttribute(`active`,`true`)),t){let e=t.getAttribute(`target`);e?this.showContent(e):this.hideAllContent()}else this.hideAllContent();this.syncAccessibility(),this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.checkInitialVisibility&&t.checkInitialVisibility()})})}hideAllContent(){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`})}showContent(e){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`});let t=this.querySelector(`mint-tab-content[id="${e}"]`);t&&(t.show?t.show():t.style.display=`block`)}setupEventListeners(){this._tabClickHandler||(this._tabClickHandler=this.handleTabClick.bind(this),this.addEventListener(`tab-click`,this._tabClickHandler)),this._tabKeydownHandler||(this._tabKeydownHandler=e=>{let t=e.target?.closest(`mint-tab`),n=t?.closest(`mint-tab-list`);if(!t||!n)return;let r=Array.from(n.querySelectorAll(`mint-tab:not([disabled="true"])`)),i=r.indexOf(t);if(i<0||r.length===0)return;let a=n.getAttribute(`position`)===`left`||n.getAttribute(`position`)===`right`,o=i;if(e.key===(a?`ArrowDown`:`ArrowRight`))o=(i+1)%r.length;else if(e.key===(a?`ArrowUp`:`ArrowLeft`))o=(i-1+r.length)%r.length;else if(e.key===`Home`)o=0;else if(e.key===`End`)o=r.length-1;else return;e.preventDefault();let s=r[o];s.focus(),this.activateTab(s)},this.addEventListener(`keydown`,this._tabKeydownHandler))}removeEventListeners(){this._tabClickHandler&&=(this.removeEventListener(`tab-click`,this._tabClickHandler),null),this._tabKeydownHandler&&=(this.removeEventListener(`keydown`,this._tabKeydownHandler),null)}setupMutationObserver(){this._mutationObserver=new MutationObserver(()=>{this.render()});let e=this.querySelector(`mint-tab-list`);e&&this._mutationObserver.observe(e,{attributes:!0,attributeFilter:[`position`]})}handleTabClick(e){let t=e.detail?.tab;t&&this.activateTab(t)}activateTab(e){let t=e.getAttribute(`target`),n=e.closest(`mint-tab-list`);n&&(n.querySelectorAll(`mint-tab`).forEach(t=>{let n=t;t===e?n.active=!0:n.active=!1}),t&&this.showContent(t),this.syncAccessibility())}syncAccessibility(){this.id||=(e._id+=1,`mint-tabs-${e._id}`),Array.from(this.querySelectorAll(`mint-tab-list`)).forEach((e,t)=>{e.setAttribute(`role`,`tablist`),e.setAttribute(`aria-orientation`,e.getAttribute(`position`)===`left`||e.getAttribute(`position`)===`right`?`vertical`:`horizontal`),!e.hasAttribute(`aria-label`)&&!e.hasAttribute(`aria-labelledby`)&&e.setAttribute(`aria-label`,`Tabs`),Array.from(e.querySelectorAll(`mint-tab`)).forEach((e,n)=>{let r=e.id||`${this.id}-tab-${t+1}-${n+1}`;e.id=r,e.setAttribute(`role`,`tab`);let i=e.getAttribute(`active`)===`true`;e.setAttribute(`aria-selected`,String(i)),e.setAttribute(`aria-disabled`,String(e.getAttribute(`disabled`)===`true`)),e.tabIndex=i?0:-1;let a=e.getAttribute(`target`);a?e.setAttribute(`aria-controls`,a):e.removeAttribute(`aria-controls`);let o=a?Array.from(this.querySelectorAll(`mint-tab-content`)).find(e=>e.id===a)??null:null;o&&(o.setAttribute(`role`,`tabpanel`),o.setAttribute(`aria-labelledby`,r),o.hasAttribute(`tabindex`)||(o.tabIndex=0))})})}};customElements.get(`mint-tabs`)||a(`mint-tabs`,zn);var Bn=class extends HTMLElement{constructor(...e){super(...e),this._container=null,this._chipsWrap=null,this._input=null,this._tags=[],this._predefinedTags=[],this._placeholder=`Add tag`,this._predefinedPopoverOpenListenersAttached=!1,this._predefinedBlurCloseTimer=null,this._suppressNextPredefinedBlurClose=!1,this._dragIndex=null,this._dragChip=null,this._isPointerDragging=!1,this._pointerMoveHandler=null,this._pointerUpHandler=null,this._containerFocusRingListeners=!1,this._predefinedFieldResizeObserver=null,this._predefinedPopoverBodyEl=null}static get observedAttributes(){return[`tags`,`placeholder`,`predefined-tags`,`predefined-only`,`sortable`,`label`,`info`,`error`,`error-message`,`name`,`id`,`required`,`loading`]}connectedCallback(){this._parseAttrs(),this._render(),this._pointerMoveHandler||(this._pointerMoveHandler=e=>this._onPointerMove(e),window.addEventListener(`pointermove`,this._pointerMoveHandler)),this._pointerUpHandler||(this._pointerUpHandler=e=>this._onPointerUp(e),window.addEventListener(`pointerup`,this._pointerUpHandler),window.addEventListener(`pointercancel`,this._pointerUpHandler))}disconnectedCallback(){this._disconnectPredefinedFieldResizeObserver()}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._syncInputAccessibility(),this._container&&this._container.classList.toggle(`mint-tags-field-error`,this.hasError());return}if(e===`loading`){this._parseAttrs(),this._render();return}this._parseAttrs(),this._render()}}set tags(e){this._tags=Array.isArray(e)?[...e]:[],this._syncAttr(),this._render()}get tags(){return[...this._tags]}_parseAttrs(){let e=this.getAttribute(`tags`);e&&(this._tags=this._parseTagItems(e,`tags`));let t=this.getAttribute(`placeholder`);t!==null&&(this._placeholder=t);let n=this.getAttribute(`predefined-tags`);this._predefinedTags=this._parseTagItems(n,`predefined-tags`)}_parseTagItems(e,t){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(e=>{if(typeof e==`string`){let t=e.trim();return t?{value:t,label:t,dismissable:!0}:null}if(!e||typeof e!=`object`)return null;let t=e,n=String(t.value??``).trim();return n?{value:n,label:String(t.label??n),dismissable:t.dismissable!==!1}:null}).filter(e=>e!==null):[]}catch(e){return console.warn(`mint-tags: failed to parse ${t} attribute`,e),[]}}_syncAttr(){this.setAttribute(`tags`,JSON.stringify(this._tags))}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}hasError(){return this.getAttribute(`error`)===`true`}_attachContainerFocusRingListeners(){!this._container||this._containerFocusRingListeners||(this._containerFocusRingListeners=!0,this._container.addEventListener(`focusin`,()=>{this._container?.setAttribute(`data-mint-tags-active`,`true`)}),this._container.addEventListener(`focusout`,()=>{requestAnimationFrame(()=>{this._container&&(this._container.contains(document.activeElement)||this._container.removeAttribute(`data-mint-tags-active`))})}))}getErrorMessage(){return this.getAttribute(`error-message`)||``}getName(){return this.getAttribute(`name`)||``}getId(){return this.getAttribute(`id`)||``}isRequired(){return this.getAttribute(`required`)===`true`}isLoading(){return this.hasAttribute(`loading`)}isPredefinedOnly(){return this.getAttribute(`predefined-only`)===`true`}_render(){this.classList.add(`mint-tags-host`);let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.hasError(),i=this.getId()||`mint-tags-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute(`id`,i),this._container?this._input&&(this._input.placeholder=this._placeholder):(this._container=document.createElement(`div`),this._container.className=`mint-tags-field`,this._container.classList.toggle(`mint-tags-field-error`,r),this._container.addEventListener(`pointerdown`,e=>this._onContainerPointerDown(e)),this._attachContainerFocusRingListeners(),this._chipsWrap=document.createElement(`div`),this._chipsWrap.className=`mint-tags-chips`,this._chipsWrap.addEventListener(`dragover`,e=>{this.hasAttribute(`sortable`)&&e.preventDefault()}),this._chipsWrap.addEventListener(`drop`,e=>{this.hasAttribute(`sortable`)&&e.preventDefault()}),this._input=document.createElement(`input`),this._input.type=`text`,this._input.placeholder=this._placeholder,this._input.className=`mint-tags-input`,this._input.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this._addFromInput())}),this._container.appendChild(this._chipsWrap),this.appendChild(this._container)),this._input&&(this.isPredefinedOnly()&&this._predefinedTags.length>0?this._input.setAttribute(`readonly`,`true`):this._input.removeAttribute(`readonly`)),this._container&&this._container.classList.toggle(`mint-tags-field-error`,r);let a=this.querySelector(`.mint-tags-label-container`);if(t){a||(a=document.createElement(`div`),a.className=`mint-tags-label-container`,this._container&&this._container.parentElement===this?this.insertBefore(a,this._container):this.insertBefore(a,this.firstChild));let e=a.querySelector(`.mint-tags-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-tags-label`,a.appendChild(e)),e.textContent=t,e.setAttribute(`for`,i)):e&&e.remove()}else a&&a.remove();let o=this.querySelector(`.mint-tags-info`);n?(o||(o=document.createElement(`span`),o.className=`mint-tags-info`,this._container&&this._container.parentElement===this?this.insertBefore(o,this._container.nextSibling):this.appendChild(o)),o.textContent=n):o&&o.remove();let s=this.getName();s?(this.setAttribute(`name`,s),this._input&&(this._input.name=s,this._input.id=i)):(this.removeAttribute(`name`),this._input&&(this._input.removeAttribute(`name`),this._input.id=i)),this._wireInputBackspace(),this._renderChips(),this._renderPredefinedPopover(),this._renderErrorState(),this._syncInputAccessibility(),this._renderSkeleton(e)}_getAvailablePredefinedTags(){let e=new Set(this._tags.map(e=>e.value.toLowerCase()));return this._predefinedTags.filter(t=>!e.has(t.value.toLowerCase()))}_shouldShowInput(){return this._input?!this.isPredefinedOnly()||!this._predefinedTags.length?!0:this._getAvailablePredefinedTags().length>0:!1}_disconnectPredefinedFieldResizeObserver(){this._predefinedFieldResizeObserver&&=(this._predefinedFieldResizeObserver.disconnect(),null),this._predefinedPopoverBodyEl=null}_syncPredefinedPopoverBodyMinWidth(e){if(!this._container)return;let t=this._container.offsetWidth;t>0?e.style.minWidth=`${Math.max(t,200)}px`:e.style.minWidth=`12rem`}_attachPredefinedFieldResizeObserver(e){if(this._disconnectPredefinedFieldResizeObserver(),!this._container||typeof ResizeObserver>`u`){this._syncPredefinedPopoverBodyMinWidth(e);return}this._predefinedPopoverBodyEl=e,this._predefinedFieldResizeObserver=new ResizeObserver(()=>{!this._predefinedPopoverBodyEl||!this._container||this._syncPredefinedPopoverBodyMinWidth(this._predefinedPopoverBodyEl)}),this._predefinedFieldResizeObserver.observe(this._container),this._syncPredefinedPopoverBodyMinWidth(e)}_renderPredefinedPopover(){if(!this._container||!this._chipsWrap||(this._disconnectPredefinedFieldResizeObserver(),this.querySelectorAll(`[data-mint-tags-predefined="true"]`).forEach(e=>e.remove()),!this._predefinedTags.length)||!this._input||!this._input.id)return;let e=this._getAvailablePredefinedTags();if(this.isPredefinedOnly()&&e.length===0)return;let t=`${this.getAttribute(`id`)||this._input.id}-tags-field`;this._container.id=t;let n=document.createElement(`mint-popover`);n.setAttribute(`trigger-id`,t),n.setAttribute(`trigger-toggle`,`false`),n.setAttribute(`trigger-align`,`start`),n.setAttribute(`direction`,`down`),n.setAttribute(`padding`,`0`),n.setAttribute(`distance`,`6px`),n.dataset.mintTagsPredefined=`true`;let r=document.createElement(`div`);if(r.dataset.mintTagsPredefinedBody=`true`,r.className=`mint-tags-options`,r.addEventListener(`mousedown`,e=>{e.preventDefault()}),e.length)e.forEach(e=>{let t=document.createElement(`mint-button`);t.setAttribute(`type`,`button`),t.setAttribute(`variant`,`ghost`),t.setAttribute(`full-width`,`true`),t.setAttribute(`align`,`left`),t.classList.add(`mint-tags-option`),t.textContent=e.label||e.value,t.addEventListener(`mousedown`,e=>{e.preventDefault()},!0),t.addEventListener(`click`,()=>{this._addTag(e),n.removeAttribute(`open`),requestAnimationFrame(()=>{this._input?.focus({preventScroll:!0}),this._container?.setAttribute(`data-mint-tags-active`,`true`)})}),r.appendChild(t)});else{let e=document.createElement(`div`);e.className=`mint-tags-empty`,e.textContent=`No tags available`,r.appendChild(e)}n.appendChild(r),this._container.appendChild(n),this._attachPredefinedPopoverOpenOnInputFocus(),this._attachPredefinedFieldResizeObserver(r)}_getPredefinedPopoverEl(){return this.querySelector(`mint-popover[data-mint-tags-predefined="true"]`)}_attachPredefinedPopoverOpenOnInputFocus(){!this._input||!this._predefinedTags.length||this._predefinedPopoverOpenListenersAttached||(this._predefinedPopoverOpenListenersAttached=!0,this._input.addEventListener(`focus`,()=>{if(this._predefinedBlurCloseTimer!==null&&(window.clearTimeout(this._predefinedBlurCloseTimer),this._predefinedBlurCloseTimer=null),this.isLoading())return;let e=this._getPredefinedPopoverEl();e&&e.setAttribute(`open`,`true`)}),this._input.addEventListener(`blur`,()=>{this._predefinedBlurCloseTimer!==null&&window.clearTimeout(this._predefinedBlurCloseTimer),this._predefinedBlurCloseTimer=window.setTimeout(()=>{if(this._predefinedBlurCloseTimer=null,this._suppressNextPredefinedBlurClose){this._suppressNextPredefinedBlurClose=!1;return}this._getPredefinedPopoverEl()?.removeAttribute(`open`)},150)}))}_renderSkeleton(e){let t=this._container;if(!t)return;let n=t.querySelector(`.mint-tags-skeleton`);e?(n||(n=document.createElement(`div`),n.className=`mint-tags-skeleton`,t.appendChild(n)),n.style.display=`block`,this._chipsWrap&&(this._chipsWrap.style.visibility=`hidden`,this._chipsWrap.style.pointerEvents=`none`),this._input&&(this._input.style.visibility=`hidden`,this._input.style.pointerEvents=`none`)):(n&&(n.style.display=`none`),this._chipsWrap&&(this._chipsWrap.style.visibility=`visible`,this._chipsWrap.style.pointerEvents=`auto`),this._input&&(this._input.style.visibility=`visible`,this._input.style.pointerEvents=`auto`))}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-tags-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-tags-error`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_syncInputAccessibility(){if(!this._input)return;let e=this.getId()||`mint-tags-${Math.random().toString(36).slice(2,10)}`;this._input.id=e;let t=this.getLabel().trim();t?this._input.setAttribute(`aria-label`,t):this._placeholder.trim()?this._input.setAttribute(`aria-label`,this._placeholder.trim()):this._input.setAttribute(`aria-label`,`Add tag`),this._input.setAttribute(`aria-invalid`,String(this.hasError()));let n=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),r=this.querySelector(`.mint-tags-info`),i=this.querySelector(`.mint-tags-error`);r&&(r.id=`${e}-info`,n.push(r.id)),i&&(i.id=`${e}-error`,n.push(i.id)),n.length?this._input.setAttribute(`aria-describedby`,Array.from(new Set(n)).join(` `)):this._input.removeAttribute(`aria-describedby`)}_renderChips(){if(!this._chipsWrap)return;this._chipsWrap.innerHTML=``;let e=0;this._tags.forEach(t=>{let n=document.createElement(`mint-chip`);n.dataset.index=String(e++),n.dataset.value=t.value,n.draggable=this.hasAttribute(`sortable`),n.draggable&&n.classList.add(`mint-tags-chip-draggable`),t.dismissable&&(n.setAttribute(`dismissable`,`true`),n.addEventListener(`dismissed`,()=>this._removeTag(t.value))),this._chipsWrap.appendChild(n);let r=n.querySelector(`[data-mt-chip-text]`);r&&(r.textContent=t.label||t.value),this._setupChipEvents(n,t),n.draggable&&(n.addEventListener(`dragstart`,e=>this._onDragStart(e,n)),n.addEventListener(`dragover`,e=>this._onDragOverChip(e,n)),n.addEventListener(`drop`,e=>this._onDrop(e)),n.addEventListener(`dragend`,()=>this._onDragEnd())),this.hasAttribute(`sortable`)&&n.addEventListener(`pointerdown`,e=>this._onPointerDown(e,n))}),this._input&&this._shouldShowInput()&&(this.hasAttribute(`sortable`)&&(this._input.addEventListener(`dragover`,e=>this._onDragOverInput(e)),this._input.addEventListener(`drop`,e=>this._onDrop(e)),this._input.addEventListener(`dragend`,()=>this._onDragEnd())),this._chipsWrap.appendChild(this._input))}_addFromInput(){if(!this._input)return;let e=this._input.value.trim();if(!e)return;if(this._tags.some(t=>t.value.toLowerCase()===e.toLowerCase())){this._input.value=``;return}let t=this._predefinedTags.find(t=>t.value.toLowerCase()===e.toLowerCase());if(this.isPredefinedOnly()){if(!t){this._input.value=``;return}this._addTag(t)}else this._addTag(t||{value:e,label:e,dismissable:!0});this._input.value=``,setTimeout(()=>{this._input?.focus()},10)}_addTag(e){this._tags.some(t=>t.value.toLowerCase()===e.value.toLowerCase())||(this._tags.push({value:e.value,label:e.label||e.value,dismissable:e.dismissable!==!1}),this._syncAttr(),this._renderChips(),this._renderPredefinedPopover(),this._emitChange())}_removeTag(e){this._tags=this._tags.filter(t=>t.value!==e),this._syncAttr(),this._renderChips(),this._renderPredefinedPopover(),this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent(`tags-change`,{bubbles:!0,composed:!0,detail:{tags:this.tags}}))}_focusLastChip(){let e=this._chipsWrap?.querySelectorAll(`mint-chip`);e&&e.length>0&&e[e.length-1].focus({preventScroll:!0})}_focusInput(){setTimeout(()=>{this._input?.focus({preventScroll:!0})},10)}_wireInputBackspace(){this._input&&this._input.addEventListener(`keydown`,e=>{e.key===`Backspace`&&this._input?.value===``&&(e.preventDefault(),this._focusLastChip())})}_setupChipEvents(e,t){e.tabIndex=0,e.addEventListener(`keydown`,e=>{(e.key===`Backspace`||e.key===`Delete`)&&t.dismissable&&(e.preventDefault(),this._removeTag(t.value),this._focusInput())})}_onContainerPointerDown(e){if(!this._input||!this._input.isConnected||this._input.parentElement!==this._chipsWrap||e.button!==0||e.defaultPrevented)return;let t=e.composedPath();if(!t.some(e=>e===this._input)&&!t.some(e=>e instanceof Element&&e.closest(`mint-chip`)!=null)){this._predefinedBlurCloseTimer!==null&&(window.clearTimeout(this._predefinedBlurCloseTimer),this._predefinedBlurCloseTimer=null),this._suppressNextPredefinedBlurClose=!0,e.preventDefault();try{this._input.focus({preventScroll:!0})}catch{}this._predefinedTags.length>0&&this._getPredefinedPopoverEl()?.setAttribute(`open`,`true`)}}_onDragStart(e,t){this.hasAttribute(`sortable`)&&(this._dragChip=t,this._dragIndex=Number(t.dataset.index),e.dataTransfer?.setData(`text/plain`,t.dataset.index||``),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`),t.classList.add(`mint-tags-chip-dragging`))}_reorderTags(e,t){if(e<0||t<0||e>=this._tags.length||t>=this._tags.length)return;let n=[...this._tags],[r]=n.splice(e,1);n.splice(t,0,r),this._tags=n,this._syncAttr(),this._renderChips(),this._emitChange()}_onDragOverInput(e){this.hasAttribute(`sortable`)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),this._dragChip&&this._chipsWrap&&this._input&&this._chipsWrap.insertBefore(this._dragChip,this._input))}_onDragOverChip(e,t){if(!this.hasAttribute(`sortable`)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),!this._dragChip||!this._chipsWrap)||t===this._dragChip)return;let n=t.getBoundingClientRect();if(e.clientX<n.left+n.width*.5){if(this._dragChip.nextSibling===t)return;this._chipsWrap.insertBefore(this._dragChip,t)}else{if(t.nextSibling===this._dragChip)return;let e=t.nextSibling;e?this._chipsWrap.insertBefore(this._dragChip,e):this._chipsWrap.appendChild(this._dragChip)}}_onDrop(e){this.hasAttribute(`sortable`)&&e.preventDefault()}_onDragEnd(){this._dragChip&&this._dragChip.classList.remove(`mint-tags-chip-dragging`),this._syncOrderFromDom(),this._dragChip=null,this._dragIndex=null}_syncOrderFromDom(){if(!this._chipsWrap)return;let e=Array.from(this._chipsWrap.querySelectorAll(`mint-chip`));if(e.length===0)return;let t=[];e.forEach(e=>{let n=e.dataset.value;if(!n)return;let r=this._tags.find(e=>e.value===n);r&&t.push(r)}),t.length===this._tags.length&&(this._tags=t,this._syncAttr(),this._renderChips(),this._emitChange())}_onPointerDown(e,t){if(this.hasAttribute(`sortable`)&&e.pointerType!==`mouse`){this._isPointerDragging=!0,this._dragChip=t,this._dragIndex=Number(t.dataset.index);try{t.setPointerCapture(e.pointerId)}catch{}t.classList.add(`mint-tags-chip-dragging`,`mint-tags-chip-no-select`),e.preventDefault()}}_onPointerMove(e){if(!this._isPointerDragging||!this._dragChip||!this._chipsWrap||e.pointerType===`mouse`)return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return;let n=t.closest(`mint-chip`);if(n&&n!==this._dragChip){let t=n.getBoundingClientRect();if(e.clientX<t.left+t.width*.5)this._dragChip.nextSibling!==n&&this._chipsWrap.insertBefore(this._dragChip,n);else if(n.nextSibling!==this._dragChip){let e=n.nextSibling;e?this._chipsWrap.insertBefore(this._dragChip,e):this._chipsWrap.appendChild(this._dragChip)}return}this._input&&t.closest(`input`)===this._input&&this._chipsWrap.insertBefore(this._dragChip,this._input)}_onPointerUp(e){if(this._isPointerDragging){if(this._isPointerDragging=!1,this._dragChip){try{this._dragChip.releasePointerCapture(e.pointerId)}catch{}this._dragChip.classList.remove(`mint-tags-chip-dragging`,`mint-tags-chip-no-select`)}this._syncOrderFromDom(),this._dragChip=null,this._dragIndex=null}}};customElements.get(`mint-tags`)||a(`mint-tags`,Bn);var Vn=class extends HTMLElement{constructor(...e){super(...e),this._triggerId=`mint-time-picker-trigger-${Math.random().toString(36).slice(2,10)}`,this._popover=null,this._popoverObserver=null,this._inputEl=null,this._hiddenInput=null,this._single={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeStart={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeEnd={hour:5,minute:0,second:0,meridiem:`PM`},this._invalidFromInput=!1}static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`range`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-time-picker-host`),this._parseAndApplyValue(this.getAttribute(`value`)||``),this.render()}disconnectedCallback(){this._popoverObserver&&=(this._popoverObserver.disconnect(),null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`value`){if(this._parseAndApplyValue(n||``),this._syncHiddenInput(),this._syncInputValue(),this._popover){let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);e&&this._buildPopoverContent(e)}return}e!==`error`&&e!==`error-message`&&(this._invalidFromInput=!1),this.render()}}get value(){return this.getValue()}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._parseAndApplyValue(e||``),this._syncHiddenInput(),this._syncInputValue()}isRange(){return this.getAttribute(`range`)===`true`}isHoursEnabled(){let e=this.getAttribute(`hours`);return e===null?!0:e!==`false`}isMinutesEnabled(){let e=this.getAttribute(`minutes`);return e===null?!0:e!==`false`}isSecondsEnabled(){let e=this.getAttribute(`seconds`);return e===null?!1:e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasExternalError(){return this.getAttribute(`error`)===`true`}getExternalErrorMessage(){return this.getAttribute(`error-message`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}_getEffectiveError(){return{hasError:this.hasExternalError(),message:this.getExternalErrorMessage()}}_formatParts(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=[];return t&&i.push(e.hour.toString()),n&&i.push(e.minute.toString().padStart(2,`0`)),r&&i.push(e.second.toString().padStart(2,`0`)),t?`${i.join(`:`)} ${e.meridiem.toLowerCase()}`:i.join(`:`)}_to24Hour(e){let t=e.hour%12;return e.meridiem===`PM`&&(t+=12),{hour:t,minute:e.minute,second:e.second}}_formatParts24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=this._to24Hour(e),a=[];return t&&a.push(i.hour.toString().padStart(2,`0`)),n&&a.push(i.minute.toString().padStart(2,`0`)),r&&a.push(i.second.toString().padStart(2,`0`)),a.join(`:`)}_getDisplayValue(){return this.isRange()?`${this._formatParts(this._rangeStart)} - ${this._formatParts(this._rangeEnd)}`:this._formatParts(this._single)}_getOutputValue(){return this.isRange()?`${this._formatParts24(this._rangeStart)} - ${this._formatParts24(this._rangeEnd)}`:this._formatParts24(this._single)}_getExpectedFormat(){let e=this.isHoursEnabled(),t=this.isMinutesEnabled(),n=this.isSecondsEnabled(),r=[];e&&r.push(`h`),t&&r.push(`mm`),n&&r.push(`ss`);let i=e?`${r.join(`:`)} am/pm`:r.join(`:`);return this.isRange()?`${i} - ${i}`:i}_syncHiddenInput(){this._hiddenInput&&(this._hiddenInput.value=this.getValue()||this._getOutputValue())}_syncInputValue(){this._inputEl&&(this._inputEl.value=this._getDisplayValue(),typeof this._inputEl.render==`function`&&this._inputEl.render())}_emitChangeFromPicker(){let e=this._getOutputValue();this._invalidFromInput=!1,this.setAttribute(`value`,e),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_parseSingle(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*(am|pm)$/i);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0),s=e[4].toUpperCase();return t<1||t>12||n&&(a<0||a>59)||r&&(o<0||o>59)?null:{hour:t,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseSingleOutput24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{2})(?::(\d{2}))?(?::(\d{2}))?$/);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0);if(t<0||t>23||n&&(a<0||a>59)||r&&(o<0||o>59))return null;let s=t>=12?`PM`:`AM`;return{hour:t%12==0?12:t%12,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseAndApplyValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingleOutput24(t||``),i=this._parseSingleOutput24(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingleOutput24(e);return t?(this._single=t,!0):!1}_parseAndApplyDisplayValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingle(t||``),i=this._parseSingle(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingle(e);return t?(this._single=t,!0):!1}_handleTypedValue(e){let t=e.trim();if(!t){this._invalidFromInput=!1,this.removeAttribute(`value`),this._syncHiddenInput(),this._syncInputValue();return}if(!this._parseAndApplyDisplayValue(t)){this._invalidFromInput=!0,this.removeAttribute(`value`),this._inputEl&&(this._inputEl.value=``),this._syncHiddenInput(),this.render(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._invalidFromInput=!1;let n=this._getOutputValue();this.setAttribute(`value`,n),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_buildColumn(e,t,n,r=!0,i=`standard`,a=`Time`){let o=document.createElement(`div`);return o.className=`mint-time-picker-column mint-time-picker-column-${i}${r?` mint-time-picker-column-divider`:``}`,o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,a),e.forEach(e=>{let r=document.createElement(`button`);r.type=`button`;let i=e===t;r.className=`mint-time-picker-option${i?` is-selected`:``}`,r.dataset.selected=i?`true`:`false`,r.setAttribute(`aria-pressed`,String(i)),r.setAttribute(`aria-label`,`${a}: ${e}`),r.textContent=e,r.addEventListener(`click`,()=>n(e)),o.appendChild(r)}),o}_centerSelectedInColumn(e,t=0){let n=e.querySelector(`button[data-selected="true"]`);if(!n)return;let r=n.offsetTop-(e.clientHeight/2-n.clientHeight/2)-t;e.scrollTop=Math.max(0,r)}_centerAllColumnsInPopoverBody(){if(!this._popover)return;let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);if(!e)return;let t=Array.from(e.querySelectorAll(`.mint-time-picker-column`)),n=this.isRange()?20:0;t.forEach(e=>this._centerSelectedInColumn(e,n))}_setupPopoverOpenObserver(){this._popover&&(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._popoverObserver=new MutationObserver(()=>{this._popover?.getAttribute(`open`)===`true`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]}))}_buildPickerSet(e,t,n){let r=this.isHoursEnabled(),i=this.isMinutesEnabled(),a=this.isSecondsEnabled(),o=document.createElement(`div`),s=(r?1:0)+(i?1:0)+(a?1:0)+(r?1:0);o.className=`mint-time-picker-wheel`,o.style.gridTemplateColumns=`repeat(${Math.max(s,1)}, minmax(0, 1fr))`;let c=Array.from({length:12},(e,t)=>(t+1).toString().padStart(2,`0`)),l=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),u=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),d=[`AM`,`PM`],f=[];r&&f.push(this._buildColumn(c,t.hour.toString().padStart(2,`0`),e=>{n({...t,hour:Number(e)})},!0,`tall`,`Hour`)),i&&f.push(this._buildColumn(l,t.minute.toString().padStart(2,`0`),e=>{n({...t,minute:Number(e)})},!0,`tall`,`Minute`)),a&&f.push(this._buildColumn(u,t.second.toString().padStart(2,`0`),e=>{n({...t,second:Number(e)})},!0,`tall`,`Second`)),r&&f.push(this._buildColumn(d,t.meridiem,e=>{n({...t,meridiem:e})},!0,`compact`,`Meridiem`)),f.forEach((e,t)=>{t===f.length-1&&e.classList.remove(`mint-time-picker-column-divider`),o.appendChild(e)}),e.appendChild(o)}_buildPopoverContent(e){if(e.innerHTML=``,!this.isRange()){this._buildPickerSet(e,this._single,t=>{this._single=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});return}let t=document.createElement(`div`);t.className=`mint-time-picker-range`;let n=document.createElement(`div`),r=document.createElement(`mint-text`);r.setAttribute(`variant`,`muted`),r.className=`mint-time-picker-range-label`,r.textContent=`Start`,n.appendChild(r),this._buildPickerSet(n,this._rangeStart,t=>{this._rangeStart=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});let i=document.createElement(`div`),a=document.createElement(`mint-text`);a.setAttribute(`variant`,`muted`),a.className=`mint-time-picker-range-label`,a.textContent=`End`,i.appendChild(a),this._buildPickerSet(i,this._rangeEnd,t=>{this._rangeEnd=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),t.appendChild(n),t.appendChild(i),e.appendChild(t),requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})}render(){let e=this.isDisabled(),t=this.isReadonly(),n=this._getEffectiveError();this.innerHTML=``;let r=document.createElement(`div`);r.className=`mint-time-picker-control`,this._inputEl=document.createElement(`mint-input`),this._inputEl.id=this._triggerId,this._inputEl.classList.add(`mint-time-picker-trigger`),this._inputEl.setAttribute(`type`,`text`),this._inputEl.setAttribute(`icon`,`clock`),this._inputEl.setAttribute(`placeholder`,this._getExpectedFormat()),this._inputEl.setAttribute(`label`,this.getLabel()),this._inputEl.setAttribute(`info`,this.getInfo()),this._inputEl.setAttribute(`value`,this._getDisplayValue()),this._inputEl.setAttribute(`error`,n.hasError?`true`:`false`),this._inputEl.setAttribute(`error-message`,n.message||``),e&&this._inputEl.setAttribute(`disabled`,`true`),t&&this._inputEl.setAttribute(`readonly`,`true`),this._inputEl.addEventListener(`change`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())}),this._inputEl.addEventListener(`blur`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())},!0),r.appendChild(this._inputEl),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getName(),this._hiddenInput.required=this.isRequired(),r.appendChild(this._hiddenInput),this._syncHiddenInput(),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),(e||t)&&this._popover.setAttribute(`open`,`false`);let i=document.createElement(`div`);i.setAttribute(`data-mint-time-picker-body`,`true`),i.className=`mint-time-picker-popover`,this._buildPopoverContent(i),this._popover.appendChild(i),r.appendChild(this._popover),this._setupPopoverOpenObserver(),this.appendChild(r)}};customElements.get(`mint-time-picker`)||a(`mint-time-picker`,Vn);var Hn=class extends HTMLElement{constructor(...e){super(...e),this._messageEl=null,this._hideTimer=null,this._hideResolve=null,this._bottomNavObserver=null,this._bodyObserver=null}static get observedAttributes(){return[`open`,`message`,`type`]}connectedCallback(){this.classList.add(`mint-toast-host`),this._updateBottomOffset(),this._setupBottomNavObservers(),this.setAttribute(`role`,`status`),this.setAttribute(`aria-live`,`polite`),this.setAttribute(`aria-atomic`,`true`),this.render()}disconnectedCallback(){this._clearHideTimer(),this._disconnectBottomNavObservers(),this._hideResolve=null}attributeChangedCallback(e,t,n){t!==n&&(e===`open`||e===`message`||e===`type`)&&this.render()}async showToast(e,t=2200,n=`neutral`){let r=e.trim().slice(0,120);r&&(this._updateBottomOffset(),this._clearHideTimer(),this._hideResolve=null,this.setAttribute(`message`,r),this.setAttribute(`type`,n),this.setAttribute(`open`,`true`),this.render(),await new Promise(e=>{this._hideResolve=e,this._hideTimer=window.setTimeout(()=>{this.hideToast()},t)}))}hideToast(e=!1){this.removeAttribute(`open`),this.render(),this._clearHideTimer();let t=this._hideResolve;this._hideResolve=null,t&&(e?t():window.setTimeout(t,200))}_clearHideTimer(){this._hideTimer!==null&&(window.clearTimeout(this._hideTimer),this._hideTimer=null)}_updateBottomOffset(){let e=this._hasVisibleBottomNav()?`calc(env(safe-area-inset-bottom, 0px) + 4.5rem)`:`calc(env(safe-area-inset-bottom, 0px) + 1rem)`;this.style.setProperty(`--mint-toast-bottom-offset`,e)}_hasVisibleBottomNav(){let e=document.querySelector(`mint-bottom-navigation`);if(!e)return!1;let t=window.getComputedStyle(e);return!(t.display===`none`||t.visibility===`hidden`||e.classList.contains(`is-hidden`))}_setupBottomNavObservers(){this._disconnectBottomNavObservers();let e=()=>{this._bottomNavObserver&&=(this._bottomNavObserver.disconnect(),null);let e=document.querySelector(`mint-bottom-navigation`);if(!e){this._updateBottomOffset();return}this._bottomNavObserver=new MutationObserver(()=>{this._updateBottomOffset()}),this._bottomNavObserver.observe(e,{attributes:!0,attributeFilter:[`class`,`style`]}),this._updateBottomOffset()};this._bodyObserver=new MutationObserver(()=>{e()}),this._bodyObserver.observe(document.body,{childList:!0,subtree:!0}),e()}_disconnectBottomNavObservers(){this._bottomNavObserver&&=(this._bottomNavObserver.disconnect(),null),this._bodyObserver&&=(this._bodyObserver.disconnect(),null)}render(){let e=this.getAttribute(`open`)===`true`,t=this.getAttribute(`message`)||``;this.classList.toggle(`mint-toast-is-open`,e),this._messageEl||=(this.innerHTML=`<div class="mint-toast-surface">
|
|
138
142
|
<span data-mint-toast-message></span>
|
|
139
|
-
</div>`,this.querySelector(`[data-mint-toast-message]`)),this._messageEl&&(this._messageEl.textContent=t)}};customElements.get(`mint-toast`)||
|
|
143
|
+
</div>`,this.querySelector(`[data-mint-toast-message]`)),this._messageEl&&(this._messageEl.textContent=t)}};customElements.get(`mint-toast`)||a(`mint-toast`,Hn);var Un=2200,X=[],Z=!1,Q=null;function Wn(){return typeof document>`u`||document.body?Promise.resolve():new Promise(e=>{if(typeof window>`u`){e();return}window.addEventListener(`DOMContentLoaded`,()=>{e()},{once:!0})})}async function Gn(){if(await Wn(),typeof document>`u`)throw Error(`mintui.toast is only available in browser environments.`);let e=document.querySelector(`mint-toast[data-mint-toast-root="true"]`);if(e)return e;let t=document.createElement(`mint-toast`);return t.setAttribute(`data-mint-toast-root`,`true`),document.body.appendChild(t),t}async function Kn(){if(!Z){Z=!0;try{for(;X.length>0;){let e=X.shift();if(!e)continue;let t=e.message.trim().slice(0,120);if(!t)continue;let n=await Gn();Q=n;let r=e.options?.duration??Un,i=e.options?.type??`neutral`;await n.showToast(t,r,i)}}finally{Z=!1,Q=null}}}function $(e,t){typeof window>`u`||(X.push({message:e,options:t}),Z&&Q&&Q.hideToast(),Kn())}var qn={toast:$};if(typeof window<`u`){let e=window.mintui||{};e.toast=$,window.mintui=e}exports.Alert=tn,exports.BackButton=Qt,exports.BottomNavigation=rn,exports.Button=V,exports.default=V,exports.Card=Vt,exports.Chart=an,exports.Checkbox=Jt,exports.Chip=on,exports.Choice=Yt,exports.Clickable=sn,exports.Collapsible=cn,exports.ConfirmAction=ln,exports.DatePicker=gn,exports.Dropzone=_n,exports.Form=vn,exports.Grid=Wt,exports.Icon=l,exports.Input=hn,exports.Link=Ht,exports.MintBottomNavItem=nn,exports.MintBottomNavigation=H,exports.MintSidenavActionLinks=jn,exports.MintSidenavActionMenu=Mn,exports.MintSidenavLink=kn,exports.MintSidenavLinks=An,exports.Modal=Gt,exports.Navigation=en,exports.OffCanvas=yn,exports.Page=Ut,exports.Popover=qt,exports.ResourceTable=Sn,exports.Search=Dn,exports.Select=On,exports.SideNavigation=Fn,exports.Sortable=In,exports.Spinner=Lt,exports.Stack=Bt,exports.Switch=Rt,exports.Tab=Ln,exports.TabContent=Rn,exports.TabList=Y,exports.Table=xn,exports.Tabs=zn,exports.Tags=Bn,exports.Text=zt,exports.TimePicker=Vn,exports.Toast=Hn,exports.confirm=mn,exports.mintui=qn,exports.toast=$;
|