snice 5.2.3 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -8
- package/adapters/react/SniceProvider.js +1 -1
- package/adapters/react/SniceRouter.js +1 -1
- package/adapters/react/audio-recorder.d.ts +0 -4
- package/adapters/react/audio-recorder.d.ts.map +1 -1
- package/adapters/react/audio-recorder.js +1 -1
- package/adapters/react/audio-recorder.js.map +1 -1
- package/adapters/react/audio-recorder.tsx +1 -5
- package/adapters/react/avatar.d.ts +0 -1
- package/adapters/react/avatar.d.ts.map +1 -1
- package/adapters/react/avatar.js +1 -1
- package/adapters/react/avatar.js.map +1 -1
- package/adapters/react/avatar.tsx +1 -2
- package/adapters/react/breadcrumbs.d.ts +0 -1
- package/adapters/react/breadcrumbs.d.ts.map +1 -1
- package/adapters/react/breadcrumbs.js +1 -1
- package/adapters/react/breadcrumbs.js.map +1 -1
- package/adapters/react/breadcrumbs.tsx +1 -2
- package/adapters/react/camera-annotate.d.ts +0 -5
- package/adapters/react/camera-annotate.d.ts.map +1 -1
- package/adapters/react/camera-annotate.js +1 -1
- package/adapters/react/camera-annotate.js.map +1 -1
- package/adapters/react/camera-annotate.tsx +1 -6
- package/adapters/react/card.d.ts +0 -2
- package/adapters/react/card.d.ts.map +1 -1
- package/adapters/react/card.js +1 -1
- package/adapters/react/card.js.map +1 -1
- package/adapters/react/card.tsx +1 -3
- package/adapters/react/carousel.d.ts +0 -1
- package/adapters/react/carousel.d.ts.map +1 -1
- package/adapters/react/carousel.js +1 -1
- package/adapters/react/carousel.js.map +1 -1
- package/adapters/react/carousel.tsx +1 -2
- package/adapters/react/cart.d.ts +0 -1
- package/adapters/react/cart.d.ts.map +1 -1
- package/adapters/react/cart.js +1 -1
- package/adapters/react/cart.js.map +1 -1
- package/adapters/react/cart.tsx +1 -2
- package/adapters/react/chart.d.ts +0 -5
- package/adapters/react/chart.d.ts.map +1 -1
- package/adapters/react/chart.js +1 -1
- package/adapters/react/chart.js.map +1 -1
- package/adapters/react/chart.tsx +1 -6
- package/adapters/react/chat.d.ts +4 -1
- package/adapters/react/chat.d.ts.map +1 -1
- package/adapters/react/chat.js +2 -2
- package/adapters/react/chat.js.map +1 -1
- package/adapters/react/chat.tsx +6 -3
- package/adapters/react/chip.d.ts +0 -1
- package/adapters/react/chip.d.ts.map +1 -1
- package/adapters/react/chip.js +1 -1
- package/adapters/react/chip.js.map +1 -1
- package/adapters/react/chip.tsx +1 -2
- package/adapters/react/command-palette.d.ts +0 -4
- package/adapters/react/command-palette.d.ts.map +1 -1
- package/adapters/react/command-palette.js +1 -1
- package/adapters/react/command-palette.js.map +1 -1
- package/adapters/react/command-palette.tsx +1 -5
- package/adapters/react/comments.d.ts +0 -1
- package/adapters/react/comments.d.ts.map +1 -1
- package/adapters/react/comments.js +1 -1
- package/adapters/react/comments.js.map +1 -1
- package/adapters/react/comments.tsx +1 -2
- package/adapters/react/countdown.d.ts +0 -4
- package/adapters/react/countdown.d.ts.map +1 -1
- package/adapters/react/countdown.js +1 -1
- package/adapters/react/countdown.js.map +1 -1
- package/adapters/react/countdown.tsx +1 -5
- package/adapters/react/date-time-picker.d.ts +0 -1
- package/adapters/react/date-time-picker.d.ts.map +1 -1
- package/adapters/react/date-time-picker.js +1 -1
- package/adapters/react/date-time-picker.js.map +1 -1
- package/adapters/react/date-time-picker.tsx +1 -2
- package/adapters/react/file-upload.d.ts +0 -2
- package/adapters/react/file-upload.d.ts.map +1 -1
- package/adapters/react/file-upload.js +1 -1
- package/adapters/react/file-upload.js.map +1 -1
- package/adapters/react/file-upload.tsx +1 -3
- package/adapters/react/heatmap.d.ts +0 -4
- package/adapters/react/heatmap.d.ts.map +1 -1
- package/adapters/react/heatmap.js +1 -1
- package/adapters/react/heatmap.js.map +1 -1
- package/adapters/react/heatmap.tsx +1 -5
- package/adapters/react/image.d.ts +0 -2
- package/adapters/react/image.d.ts.map +1 -1
- package/adapters/react/image.js +1 -1
- package/adapters/react/image.js.map +1 -1
- package/adapters/react/image.tsx +1 -3
- package/adapters/react/kanban.d.ts +0 -4
- package/adapters/react/kanban.d.ts.map +1 -1
- package/adapters/react/kanban.js +1 -1
- package/adapters/react/kanban.js.map +1 -1
- package/adapters/react/kanban.tsx +1 -5
- package/adapters/react/key-value.d.ts +0 -2
- package/adapters/react/key-value.d.ts.map +1 -1
- package/adapters/react/key-value.js +1 -1
- package/adapters/react/key-value.js.map +1 -1
- package/adapters/react/key-value.tsx +1 -3
- package/adapters/react/leaderboard.d.ts +0 -1
- package/adapters/react/leaderboard.d.ts.map +1 -1
- package/adapters/react/leaderboard.js +1 -1
- package/adapters/react/leaderboard.js.map +1 -1
- package/adapters/react/leaderboard.tsx +1 -2
- package/adapters/react/map.d.ts +0 -3
- package/adapters/react/map.d.ts.map +1 -1
- package/adapters/react/map.js +1 -1
- package/adapters/react/map.js.map +1 -1
- package/adapters/react/map.tsx +1 -4
- package/adapters/react/markdown.d.ts +1 -1
- package/adapters/react/markdown.d.ts.map +1 -1
- package/adapters/react/markdown.js +1 -1
- package/adapters/react/markdown.js.map +1 -1
- package/adapters/react/markdown.tsx +2 -2
- package/adapters/react/matchRoute.d.ts +1 -1
- package/adapters/react/matchRoute.js +38 -4
- package/adapters/react/matchRoute.js.map +1 -1
- package/adapters/react/message-strip.d.ts +1 -1
- package/adapters/react/message-strip.js +1 -1
- package/adapters/react/message-strip.tsx +2 -2
- package/adapters/react/music-player.d.ts +0 -1
- package/adapters/react/music-player.d.ts.map +1 -1
- package/adapters/react/music-player.js +1 -1
- package/adapters/react/music-player.js.map +1 -1
- package/adapters/react/music-player.tsx +1 -2
- package/adapters/react/org-chart.d.ts +0 -1
- package/adapters/react/org-chart.d.ts.map +1 -1
- package/adapters/react/org-chart.js +1 -1
- package/adapters/react/org-chart.js.map +1 -1
- package/adapters/react/org-chart.tsx +1 -2
- package/adapters/react/paint.d.ts +0 -1
- package/adapters/react/paint.d.ts.map +1 -1
- package/adapters/react/paint.js +1 -1
- package/adapters/react/paint.js.map +1 -1
- package/adapters/react/paint.tsx +1 -2
- package/adapters/react/podcast-player.d.ts +0 -2
- package/adapters/react/podcast-player.d.ts.map +1 -1
- package/adapters/react/podcast-player.js +1 -1
- package/adapters/react/podcast-player.js.map +1 -1
- package/adapters/react/podcast-player.tsx +1 -3
- package/adapters/react/product-card.d.ts +0 -3
- package/adapters/react/product-card.d.ts.map +1 -1
- package/adapters/react/product-card.js +1 -1
- package/adapters/react/product-card.js.map +1 -1
- package/adapters/react/product-card.tsx +1 -4
- package/adapters/react/qr-reader.d.ts +0 -4
- package/adapters/react/qr-reader.d.ts.map +1 -1
- package/adapters/react/qr-reader.js +1 -1
- package/adapters/react/qr-reader.js.map +1 -1
- package/adapters/react/qr-reader.tsx +1 -5
- package/adapters/react/recipe.d.ts +0 -5
- package/adapters/react/recipe.d.ts.map +1 -1
- package/adapters/react/recipe.js +1 -1
- package/adapters/react/recipe.js.map +1 -1
- package/adapters/react/recipe.tsx +1 -6
- package/adapters/react/route-specificity.d.ts +1 -0
- package/adapters/react/spotlight.d.ts +0 -2
- package/adapters/react/spotlight.d.ts.map +1 -1
- package/adapters/react/spotlight.js +1 -1
- package/adapters/react/spotlight.js.map +1 -1
- package/adapters/react/spotlight.tsx +1 -3
- package/adapters/react/tag-input.d.ts +0 -4
- package/adapters/react/tag-input.d.ts.map +1 -1
- package/adapters/react/tag-input.js +1 -1
- package/adapters/react/tag-input.js.map +1 -1
- package/adapters/react/tag-input.tsx +1 -5
- package/adapters/react/terminal.d.ts +0 -1
- package/adapters/react/terminal.d.ts.map +1 -1
- package/adapters/react/terminal.js +1 -1
- package/adapters/react/terminal.js.map +1 -1
- package/adapters/react/terminal.tsx +1 -2
- package/adapters/react/time-picker.d.ts +0 -1
- package/adapters/react/time-picker.d.ts.map +1 -1
- package/adapters/react/time-picker.js +1 -1
- package/adapters/react/time-picker.js.map +1 -1
- package/adapters/react/time-picker.tsx +1 -2
- package/adapters/react/timer.d.ts +0 -1
- package/adapters/react/timer.d.ts.map +1 -1
- package/adapters/react/timer.js +1 -1
- package/adapters/react/timer.js.map +1 -1
- package/adapters/react/timer.tsx +1 -2
- package/adapters/react/useRequestHandler.js +1 -1
- package/adapters/react/video-player.d.ts +0 -6
- package/adapters/react/video-player.d.ts.map +1 -1
- package/adapters/react/video-player.js +1 -1
- package/adapters/react/video-player.js.map +1 -1
- package/adapters/react/video-player.tsx +1 -7
- package/adapters/react/virtual-scroller.d.ts +0 -1
- package/adapters/react/virtual-scroller.d.ts.map +1 -1
- package/adapters/react/virtual-scroller.js +1 -1
- package/adapters/react/virtual-scroller.js.map +1 -1
- package/adapters/react/virtual-scroller.tsx +1 -2
- package/bin/templates/default/tests/services/jwt.test.ts +8 -1
- package/bin/templates/react/tests/services/jwt.test.ts +10 -3
- package/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/accordion/snice-accordion.min.js +1 -1
- package/dist/cdn/action-bar/README.md +2 -2
- package/dist/cdn/action-bar/snice-action-bar.js +2 -2
- package/dist/cdn/action-bar/snice-action-bar.js.map +1 -1
- package/dist/cdn/action-bar/snice-action-bar.min.js +2 -2
- package/dist/cdn/action-bar/snice-action-bar.min.js.map +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.min.js +1 -1
- package/dist/cdn/alert/snice-alert.js +1 -1
- package/dist/cdn/alert/snice-alert.js.map +1 -1
- package/dist/cdn/alert/snice-alert.min.js +1 -1
- package/dist/cdn/alert/snice-alert.min.js.map +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.min.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.js.map +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.min.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.min.js.map +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
- package/dist/cdn/availability/snice-availability.js +1 -1
- package/dist/cdn/availability/snice-availability.min.js +1 -1
- package/dist/cdn/avatar/snice-avatar.js +1 -1
- package/dist/cdn/avatar/snice-avatar.min.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.min.js +1 -1
- package/dist/cdn/badge/snice-badge.js +1 -1
- package/dist/cdn/badge/snice-badge.js.map +1 -1
- package/dist/cdn/badge/snice-badge.min.js +1 -1
- package/dist/cdn/badge/snice-badge.min.js.map +1 -1
- package/dist/cdn/banner/README.md +1 -1
- package/dist/cdn/banner/snice-banner.js +2 -2
- package/dist/cdn/banner/snice-banner.js.map +1 -1
- package/dist/cdn/banner/snice-banner.min.js +2 -2
- package/dist/cdn/banner/snice-banner.min.js.map +1 -1
- package/dist/cdn/binpack/snice-binpack.js +1 -1
- package/dist/cdn/binpack/snice-binpack.min.js +1 -1
- package/dist/cdn/book/snice-book.js +1 -1
- package/dist/cdn/book/snice-book.min.js +1 -1
- package/dist/cdn/booking/snice-booking.js +1 -1
- package/dist/cdn/booking/snice-booking.min.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js.map +1 -1
- package/dist/cdn/button/snice-button.js +1 -1
- package/dist/cdn/button/snice-button.js.map +1 -1
- package/dist/cdn/button/snice-button.min.js +1 -1
- package/dist/cdn/button/snice-button.min.js.map +1 -1
- package/dist/cdn/calendar/snice-calendar.js +1 -1
- package/dist/cdn/calendar/snice-calendar.min.js +1 -1
- package/dist/cdn/camera/snice-camera.js +1 -1
- package/dist/cdn/camera/snice-camera.min.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.min.js +1 -1
- package/dist/cdn/card/snice-card.js +1 -1
- package/dist/cdn/card/snice-card.min.js +1 -1
- package/dist/cdn/carousel/snice-carousel.js +1 -1
- package/dist/cdn/carousel/snice-carousel.min.js +1 -1
- package/dist/cdn/cart/snice-cart.js +1 -1
- package/dist/cdn/cart/snice-cart.min.js +1 -1
- package/dist/cdn/chart/snice-chart.js +1 -1
- package/dist/cdn/chart/snice-chart.js.map +1 -1
- package/dist/cdn/chart/snice-chart.min.js +1 -1
- package/dist/cdn/chart/snice-chart.min.js.map +1 -1
- package/dist/cdn/chat/README.md +2 -2
- package/dist/cdn/chat/snice-chat.js +785 -89
- package/dist/cdn/chat/snice-chat.js.map +1 -1
- package/dist/cdn/chat/snice-chat.min.js +71 -75
- package/dist/cdn/chat/snice-chat.min.js.map +1 -1
- package/dist/cdn/checkbox/snice-checkbox.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
- package/dist/cdn/chip/snice-chip.js +1 -1
- package/dist/cdn/chip/snice-chip.js.map +1 -1
- package/dist/cdn/chip/snice-chip.min.js +1 -1
- package/dist/cdn/chip/snice-chip.min.js.map +1 -1
- package/dist/cdn/code-block/snice-code-block.js +1 -1
- package/dist/cdn/code-block/snice-code-block.min.js +1 -1
- package/dist/cdn/color-display/snice-color-display.js +1 -1
- package/dist/cdn/color-display/snice-color-display.min.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
- package/dist/cdn/command-palette/README.md +1 -1
- package/dist/cdn/command-palette/snice-command-palette.js +2 -2
- package/dist/cdn/command-palette/snice-command-palette.js.map +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js +2 -2
- package/dist/cdn/command-palette/snice-command-palette.min.js.map +1 -1
- package/dist/cdn/comments/snice-comments.js +1 -1
- package/dist/cdn/comments/snice-comments.min.js +1 -1
- package/dist/cdn/countdown/snice-countdown.js +1 -1
- package/dist/cdn/countdown/snice-countdown.min.js +1 -1
- package/dist/cdn/cropper/snice-cropper.js +1 -1
- package/dist/cdn/cropper/snice-cropper.min.js +1 -1
- package/dist/cdn/data-card/snice-data-card.js +1 -1
- package/dist/cdn/data-card/snice-data-card.js.map +1 -1
- package/dist/cdn/data-card/snice-data-card.min.js +1 -1
- package/dist/cdn/data-card/snice-data-card.min.js.map +1 -1
- package/dist/cdn/date-picker/snice-date-picker.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.min.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.min.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.min.js +1 -1
- package/dist/cdn/diff/snice-diff.js +1 -1
- package/dist/cdn/diff/snice-diff.min.js +1 -1
- package/dist/cdn/divider/snice-divider.js +1 -1
- package/dist/cdn/divider/snice-divider.min.js +1 -1
- package/dist/cdn/doc/snice-doc.js +1 -1
- package/dist/cdn/doc/snice-doc.min.js +1 -1
- package/dist/cdn/draw/snice-draw.js +1 -1
- package/dist/cdn/draw/snice-draw.min.js +1 -1
- package/dist/cdn/drawer/snice-drawer.js +1 -1
- package/dist/cdn/drawer/snice-drawer.js.map +1 -1
- package/dist/cdn/drawer/snice-drawer.min.js +1 -1
- package/dist/cdn/drawer/snice-drawer.min.js.map +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js.map +1 -1
- package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.min.js.map +1 -1
- package/dist/cdn/estimate/snice-estimate.js +1 -1
- package/dist/cdn/estimate/snice-estimate.min.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.min.js +1 -1
- package/dist/cdn/flow/snice-flow.js +1 -1
- package/dist/cdn/flow/snice-flow.min.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.min.js +1 -1
- package/dist/cdn/funnel/snice-funnel.js +1 -1
- package/dist/cdn/funnel/snice-funnel.js.map +1 -1
- package/dist/cdn/funnel/snice-funnel.min.js +1 -1
- package/dist/cdn/funnel/snice-funnel.min.js.map +1 -1
- package/dist/cdn/gantt/snice-gantt.js +1 -1
- package/dist/cdn/gantt/snice-gantt.min.js +1 -1
- package/dist/cdn/gauge/snice-gauge.js +1 -1
- package/dist/cdn/gauge/snice-gauge.min.js +1 -1
- package/dist/cdn/grid/snice-grid.js +1 -1
- package/dist/cdn/grid/snice-grid.min.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
- package/dist/cdn/image/snice-image.js +1 -1
- package/dist/cdn/image/snice-image.js.map +1 -1
- package/dist/cdn/image/snice-image.min.js +1 -1
- package/dist/cdn/image/snice-image.min.js.map +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/input/snice-input.js.map +1 -1
- package/dist/cdn/input/snice-input.min.js +1 -1
- package/dist/cdn/input/snice-input.min.js.map +1 -1
- package/dist/cdn/invoice/README.md +1 -1
- package/dist/cdn/invoice/snice-invoice.js +2 -2
- package/dist/cdn/invoice/snice-invoice.js.map +1 -1
- package/dist/cdn/invoice/snice-invoice.min.js +2 -2
- package/dist/cdn/invoice/snice-invoice.min.js.map +1 -1
- package/dist/cdn/kanban/snice-kanban.js +1 -1
- package/dist/cdn/kanban/snice-kanban.min.js +1 -1
- package/dist/cdn/key-value/snice-key-value.js +1 -1
- package/dist/cdn/key-value/snice-key-value.min.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js.map +1 -1
- package/dist/cdn/kpi/snice-kpi.min.js +1 -1
- package/dist/cdn/kpi/snice-kpi.min.js.map +1 -1
- package/dist/cdn/layout/snice-layout.js +1 -1
- package/dist/cdn/layout/snice-layout.min.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.min.js +1 -1
- package/dist/cdn/link/snice-link.js +1 -1
- package/dist/cdn/link/snice-link.min.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
- package/dist/cdn/list/snice-list.js +1 -1
- package/dist/cdn/list/snice-list.js.map +1 -1
- package/dist/cdn/list/snice-list.min.js +1 -1
- package/dist/cdn/list/snice-list.min.js.map +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/location/snice-location.js.map +1 -1
- package/dist/cdn/location/snice-location.min.js +1 -1
- package/dist/cdn/location/snice-location.min.js.map +1 -1
- package/dist/cdn/login/snice-login.js +3 -1
- package/dist/cdn/login/snice-login.js.map +1 -1
- package/dist/cdn/login/snice-login.min.js +1 -1
- package/dist/cdn/login/snice-login.min.js.map +1 -1
- package/dist/cdn/map/snice-map.js +1 -1
- package/dist/cdn/map/snice-map.min.js +1 -1
- package/dist/cdn/markdown/README.md +2 -2
- package/dist/cdn/markdown/snice-markdown.js +16 -3
- package/dist/cdn/markdown/snice-markdown.js.map +1 -1
- package/dist/cdn/markdown/snice-markdown.min.js +3 -3
- package/dist/cdn/markdown/snice-markdown.min.js.map +1 -1
- package/dist/cdn/masonry/snice-masonry.js +1 -1
- package/dist/cdn/masonry/snice-masonry.min.js +1 -1
- package/dist/cdn/menu/snice-menu.js +2 -2
- package/dist/cdn/menu/snice-menu.js.map +1 -1
- package/dist/cdn/menu/snice-menu.min.js +2 -2
- package/dist/cdn/menu/snice-menu.min.js.map +1 -1
- package/dist/cdn/message-strip/snice-message-strip.js +9 -9
- package/dist/cdn/message-strip/snice-message-strip.js.map +1 -1
- package/dist/cdn/message-strip/snice-message-strip.min.js +3 -3
- package/dist/cdn/message-strip/snice-message-strip.min.js.map +1 -1
- package/dist/cdn/metric-table/snice-metric-table.js +1 -1
- package/dist/cdn/metric-table/snice-metric-table.min.js +1 -1
- package/dist/cdn/modal/snice-modal.js +1 -1
- package/dist/cdn/modal/snice-modal.js.map +1 -1
- package/dist/cdn/modal/snice-modal.min.js +1 -1
- package/dist/cdn/modal/snice-modal.min.js.map +1 -1
- package/dist/cdn/music-player/snice-music-player.js +1 -1
- package/dist/cdn/music-player/snice-music-player.min.js +1 -1
- package/dist/cdn/nav/snice-nav.js +1 -1
- package/dist/cdn/nav/snice-nav.min.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.js.map +1 -1
- package/dist/cdn/network-graph/snice-network-graph.min.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.min.js.map +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js.map +1 -1
- package/dist/cdn/notification-center/snice-notification-center.min.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.min.js.map +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.min.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.min.js +1 -1
- package/dist/cdn/pagination/snice-pagination.js +1 -1
- package/dist/cdn/pagination/snice-pagination.min.js +1 -1
- package/dist/cdn/paint/snice-paint.js +1 -1
- package/dist/cdn/paint/snice-paint.min.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.min.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.min.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.min.js +1 -1
- package/dist/cdn/popover/snice-popover.js +1 -1
- package/dist/cdn/popover/snice-popover.min.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.min.js +1 -1
- package/dist/cdn/product-card/snice-product-card.js +3 -3
- package/dist/cdn/product-card/snice-product-card.js.map +1 -1
- package/dist/cdn/product-card/snice-product-card.min.js +3 -3
- package/dist/cdn/product-card/snice-product-card.min.js.map +1 -1
- package/dist/cdn/progress/README.md +1 -1
- package/dist/cdn/progress/snice-progress.js +2 -2
- package/dist/cdn/progress/snice-progress.js.map +1 -1
- package/dist/cdn/progress/snice-progress.min.js +2 -2
- package/dist/cdn/progress/snice-progress.min.js.map +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.js +2 -2
- package/dist/cdn/progress-ring/snice-progress-ring.js.map +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.min.js +2 -2
- package/dist/cdn/progress-ring/snice-progress-ring.min.js.map +1 -1
- package/dist/cdn/qr-code/snice-qr-code.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
- package/dist/cdn/radio/snice-radio.js +1 -1
- package/dist/cdn/radio/snice-radio.min.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.min.js +1 -1
- package/dist/cdn/rating/snice-rating.js +1 -1
- package/dist/cdn/rating/snice-rating.min.js +1 -1
- package/dist/cdn/receipt/snice-receipt.js +1 -1
- package/dist/cdn/receipt/snice-receipt.min.js +1 -1
- package/dist/cdn/recipe/snice-recipe.js +1 -1
- package/dist/cdn/recipe/snice-recipe.min.js +1 -1
- package/dist/cdn/runtime/README.md +2 -2
- package/dist/cdn/runtime/snice-runtime.esm.js +644 -172
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js +8 -8
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +644 -172
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js +8 -8
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/snice-sankey.js +1 -1
- package/dist/cdn/sankey/snice-sankey.js.map +1 -1
- package/dist/cdn/sankey/snice-sankey.min.js +1 -1
- package/dist/cdn/sankey/snice-sankey.min.js.map +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.min.js +1 -1
- package/dist/cdn/select/snice-select.js +1 -1
- package/dist/cdn/select/snice-select.min.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
- package/dist/cdn/slider/snice-slider.js +1 -1
- package/dist/cdn/slider/snice-slider.min.js +1 -1
- package/dist/cdn/sortable/snice-sortable.js +1 -1
- package/dist/cdn/sortable/snice-sortable.min.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
- package/dist/cdn/spinner/snice-spinner.js +1 -1
- package/dist/cdn/spinner/snice-spinner.min.js +1 -1
- package/dist/cdn/split-button/snice-split-button.js +1 -1
- package/dist/cdn/split-button/snice-split-button.js.map +1 -1
- package/dist/cdn/split-button/snice-split-button.min.js +1 -1
- package/dist/cdn/split-button/snice-split-button.min.js.map +1 -1
- package/dist/cdn/split-pane/snice-split-pane.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.min.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.min.js +1 -1
- package/dist/cdn/step-input/snice-step-input.js +1 -1
- package/dist/cdn/step-input/snice-step-input.min.js +1 -1
- package/dist/cdn/stepper/snice-stepper.js +1 -1
- package/dist/cdn/stepper/snice-stepper.min.js +1 -1
- package/dist/cdn/switch/snice-switch.js +1 -1
- package/dist/cdn/switch/snice-switch.min.js +1 -1
- package/dist/cdn/table/README.md +1 -1
- package/dist/cdn/table/snice-table.js +14 -4
- package/dist/cdn/table/snice-table.js.map +1 -1
- package/dist/cdn/table/snice-table.min.js +14 -4
- package/dist/cdn/table/snice-table.min.js.map +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tabs/snice-tabs.min.js +1 -1
- package/dist/cdn/tag/snice-tag.js +1 -1
- package/dist/cdn/tag/snice-tag.min.js +1 -1
- package/dist/cdn/tag-input/snice-tag-input.js +2 -2
- package/dist/cdn/tag-input/snice-tag-input.js.map +1 -1
- package/dist/cdn/tag-input/snice-tag-input.min.js +2 -2
- package/dist/cdn/tag-input/snice-tag-input.min.js.map +1 -1
- package/dist/cdn/terminal/snice-terminal.js +1 -1
- package/dist/cdn/terminal/snice-terminal.min.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.min.js +1 -1
- package/dist/cdn/textarea/snice-textarea.js +1 -1
- package/dist/cdn/textarea/snice-textarea.min.js +1 -1
- package/dist/cdn/time-picker/README.md +1 -1
- package/dist/cdn/time-picker/snice-time-picker.js +18 -13
- package/dist/cdn/time-picker/snice-time-picker.js.map +1 -1
- package/dist/cdn/time-picker/snice-time-picker.min.js +3 -3
- package/dist/cdn/time-picker/snice-time-picker.min.js.map +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +1 -1
- package/dist/cdn/timeline/snice-timeline.js +1 -1
- package/dist/cdn/timeline/snice-timeline.js.map +1 -1
- package/dist/cdn/timeline/snice-timeline.min.js +1 -1
- package/dist/cdn/timeline/snice-timeline.min.js.map +1 -1
- package/dist/cdn/timer/snice-timer.js +1 -1
- package/dist/cdn/timer/snice-timer.min.js +1 -1
- package/dist/cdn/toast/snice-toast.js +1 -1
- package/dist/cdn/toast/snice-toast.js.map +1 -1
- package/dist/cdn/toast/snice-toast.min.js +1 -1
- package/dist/cdn/toast/snice-toast.min.js.map +1 -1
- package/dist/cdn/tooltip/snice-tooltip.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
- package/dist/cdn/tree/snice-tree.js +1 -1
- package/dist/cdn/tree/snice-tree.min.js +1 -1
- package/dist/cdn/treemap/snice-treemap.js +1 -1
- package/dist/cdn/treemap/snice-treemap.js.map +1 -1
- package/dist/cdn/treemap/snice-treemap.min.js +1 -1
- package/dist/cdn/treemap/snice-treemap.min.js.map +1 -1
- package/dist/cdn/user-card/snice-user-card.js +1 -1
- package/dist/cdn/user-card/snice-user-card.min.js +1 -1
- package/dist/cdn/video-player/snice-video-player.js +1 -1
- package/dist/cdn/video-player/snice-video-player.min.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.min.js +1 -1
- package/dist/cdn/weather/snice-weather.js +1 -1
- package/dist/cdn/weather/snice-weather.min.js +1 -1
- package/dist/cdn/work-order/snice-work-order.js +1 -1
- package/dist/cdn/work-order/snice-work-order.min.js +1 -1
- package/dist/components/action-bar/snice-action-bar.js +1 -1
- package/dist/components/action-bar/snice-action-bar.js.map +1 -1
- package/dist/components/banner/snice-banner.js +1 -1
- package/dist/components/banner/snice-banner.js.map +1 -1
- package/dist/components/chat/snice-chat-message.d.ts +32 -0
- package/dist/components/chat/snice-chat-message.js +127 -0
- package/dist/components/chat/snice-chat-message.js.map +1 -0
- package/dist/components/chat/snice-chat-message.types.d.ts +30 -0
- package/dist/components/chat/snice-chat.d.ts +31 -4
- package/dist/components/chat/snice-chat.js +363 -90
- package/dist/components/chat/snice-chat.js.map +1 -1
- package/dist/components/chat/snice-chat.types.d.ts +34 -3
- package/dist/components/command-palette/snice-command-palette.js +1 -1
- package/dist/components/command-palette/snice-command-palette.js.map +1 -1
- package/dist/components/icons/index.d.ts +4 -0
- package/dist/components/icons/index.js +5 -1
- package/dist/components/icons/index.js.map +1 -1
- package/dist/components/invoice/snice-invoice.js +1 -1
- package/dist/components/invoice/snice-invoice.js.map +1 -1
- package/dist/components/login/snice-login.d.ts +2 -2
- package/dist/components/login/snice-login.js +2 -0
- package/dist/components/login/snice-login.js.map +1 -1
- package/dist/components/login/snice-login.types.d.ts +4 -0
- package/dist/components/markdown/snice-markdown.d.ts +1 -0
- package/dist/components/markdown/snice-markdown.js +15 -2
- package/dist/components/markdown/snice-markdown.js.map +1 -1
- package/dist/components/menu/snice-menu.js +1 -1
- package/dist/components/menu/snice-menu.js.map +1 -1
- package/dist/components/message-strip/snice-message-strip.d.ts +1 -1
- package/dist/components/message-strip/snice-message-strip.js +8 -8
- package/dist/components/message-strip/snice-message-strip.types.d.ts +1 -1
- package/dist/components/product-card/snice-product-card.js +2 -2
- package/dist/components/product-card/snice-product-card.js.map +1 -1
- package/dist/components/progress/snice-progress.js +1 -1
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/progress-ring/snice-progress-ring.js +1 -1
- package/dist/components/progress-ring/snice-progress-ring.js.map +1 -1
- package/dist/components/table/snice-table.js +13 -3
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/tag-input/snice-tag-input.js +1 -1
- package/dist/components/tag-input/snice-tag-input.js.map +1 -1
- package/dist/components/time-picker/snice-time-picker.js +17 -12
- package/dist/components/time-picker/snice-time-picker.js.map +1 -1
- package/dist/components/utils.d.ts +6 -0
- package/dist/components/utils.js +1 -1
- package/dist/components/utils.js.map +1 -1
- package/dist/element.d.ts +2 -1
- package/dist/events.d.ts +6 -0
- package/dist/index.cjs +641 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +641 -169
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +641 -169
- package/dist/index.iife.js.map +1 -1
- package/dist/parts.d.ts +1 -8
- package/dist/react/SniceProvider.js +1 -1
- package/dist/react/SniceRouter.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/matchRoute.d.ts +1 -1
- package/dist/react/matchRoute.js +38 -4
- package/dist/react/matchRoute.js.map +1 -1
- package/dist/react/route-specificity.d.ts +1 -0
- package/dist/react/useRequestHandler.js +1 -1
- package/dist/render.d.ts +7 -0
- package/dist/route-specificity.d.ts +1 -0
- package/dist/symbols.cjs +14 -1
- package/dist/symbols.cjs.map +1 -1
- package/dist/symbols.d.ts +3 -0
- package/dist/symbols.esm.js +12 -2
- package/dist/symbols.esm.js.map +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/dist/types/context.d.ts +5 -2
- package/dist/types/dispatch-options.d.ts +7 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/on-options.d.ts +14 -0
- package/dist/types/watch-options.d.ts +9 -0
- package/dist/utils.d.ts +26 -0
- package/docs/ai/DEVELOPMENT.md +1 -1
- package/docs/ai/README.md +11 -0
- package/docs/ai/api.md +24 -5
- package/docs/ai/cdn.md +31 -0
- package/docs/ai/components/chat.md +57 -1
- package/docs/ai/components/message-strip.md +3 -3
- package/docs/ai/decorators.md +44 -5
- package/docs/cdn.md +56 -0
- package/docs/components/chat.md +108 -2
- package/docs/components/message-strip.md +8 -8
- package/docs/elements.md +21 -0
- package/docs/events.md +88 -0
- package/docs/superpowers/specs/2026-05-26-chat-styling-design.md +155 -0
- package/docs/superpowers/specs/2026-05-27-chat-theming-REMAINING.md +83 -0
- package/docs/superpowers/specs/2026-06-09-chat-custom-content-design.md +233 -0
- package/package.json +1 -1
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice
|
|
2
|
+
* snice v6.0.0
|
|
3
3
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
7
|
/*!
|
|
8
|
-
* snice v5.2.
|
|
8
|
+
* snice v5.2.3
|
|
9
9
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
10
10
|
* (c) 2024
|
|
11
11
|
* Released under the MIT License.
|
|
12
12
|
*
|
|
13
13
|
* GENERATED FILE — DO NOT EDIT. Source: src/. Rebuild: npm run build:core
|
|
14
14
|
*/
|
|
15
|
-
globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0});const t=globalThis.snice;function e(t){return Symbol.for(`snice:${t}`)}const n=e("is-controller-class"),o=e("is-controller-instance"),r=e("is-element-class"),s=e("channel-handlers"),i=e("ready-promise"),a=e("ready-resolve"),c=e("controller"),l=e("initialized"),u=e("controller-key"),h=e("controller-name"),d=e("controller-id"),m=e("controller-operations"),f=e("native-controller"),p=e("cleanup"),y=e("properties"),g=e("property-values"),b=e("pre-init-property-values"),v=e("properties-initialized"),w=e("property-watchers"),N=e("explicitly-set-properties"),S=e("router-context"),T=e("page-transition"),E=e("created-at"),A=e("ready-handlers"),O=e("dispose-handlers"),x=e("reconnect-handlers"),C=e("moved-handlers"),_=e("adopted-handlers"),k=e("observers"),L=e("setting-from-property"),P=e("moved-timers"),M=e("adopted-timers"),$=e("dispatch-timers"),I=e("render-method"),D=e("render-options"),R=e("render-instance"),j=e("render-timers"),q=e("render-callbacks"),F=e("styles-method"),B=e("styles-applied"),V=e("parent-styles-methods"),U=e("context-handler"),z=e("navigation-context-instance"),H=e("registered-elements"),W=e("is-updating"),K=e("context-register"),G=e("context-unregister"),Q=e("context-notify-element"),J=e("context-timer"),X=e("context-called"),Y=e("context-update"),Z=e("context-methods"),tt=e("watch-methods"),et=e("observe-methods"),nt=e("on-methods"),ot=e("respond-methods"),rt=e("ready-methods"),st=e("dispose-methods"),it=e("reconnect-methods"),at=e("moved-methods"),ct=e("adopted-methods"),lt=e("controller-abort"),ut=e("property-definers");class ht{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(ht.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${ht.SEPARATOR}" (U+FF0C)`);return t}if("number"==typeof t||"boolean"==typeof t)return String(t);throw new Error("SimpleArray only supports string, number, and boolean types. Got: "+typeof t)}).join(ht.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(ht.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var dt,mt,ft,pt;!function(t){t.SEQUENTIAL="sequential",t.SIMULTANEOUS="simultaneous"}(dt||(dt={}));const yt=Symbol.for("snice:registered-elements-set");let gt=0;class bt{constructor(t={},e=[],n="",o={},r){if(this[mt]=new WeakMap,this[ft]=new Set,this[pt]=!1,this.id=gt++,this.application=t,this.navigation={placards:e,route:n,params:o},r&&"function"==typeof r.create)this.fetch=r.create(this);else{if("function"!=typeof fetch)throw new Error("No fetch implementation available");this.fetch=fetch.bind(this)}}[(mt=H,ft=yt,pt=W,K)](t,e){const n=this[H];let o=n.get(t);o||(o=new Set,n.set(t,o)),o.add(e),this[yt].add(t)}[G](t){this[H].delete(t),this[yt].delete(t)}[Y](t,e,n,o){this.application=t,this.navigation.placards=e,this.navigation.route=n,this.navigation.params=o,this.notify()}update(){this.notify()}notify(){if(this[W])return;this[W]=!0;const t=this[yt],e=this[H];for(const n of t){const t=e.get(n);if(t)for(const e of t)if("function"==typeof n[e])try{n[e](this)}catch(t){console.error(`Error calling @context method ${e}:`,t)}}this[W]=!1}[Q](t){const e=this[H].get(t);if(e)for(const n of e)"function"==typeof t[n]&&t[n](this)}}function vt(t){if(null!=t)return"string"==typeof t?String:"number"==typeof t?Number:"boolean"==typeof t?Boolean:t instanceof Date?Date:"bigint"==typeof t?BigInt:Array.isArray(t)?Array:void 0}function wt(t,e,n,o){switch(e.type||vt(o)){case Boolean:return null!==t&&"false"!==t;case Number:return null!==t?Number(t):null;case String:return t;case Date:return t?new Date(t):null;case BigInt:return t&&t.endsWith("n")?BigInt(t.slice(0,-1)):t?BigInt(t):null;case ht:return ht.parse(t);case Array:try{return t?JSON.parse(t):[]}catch{return[]}case Object:try{return t?JSON.parse(t):{}}catch{return{}}default:return"number"==typeof n&&null!==t?Number(t):t}}function Nt(t,e){return"string"==typeof t.attribute?t.attribute:e.toLowerCase()}function St(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Tt(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Et(t,e={}){const n=String(t??"").trim();if(!n)return!1;const o=e.allowed??["http:","https:","mailto:","tel:"];if(/^[#?/]/.test(n))return!0;try{const t=new URL(n,"http://__snice-base/");return"http://__snice-base"===t.origin||o.includes(t.protocol)}catch{return/^[\w\-./]+$/.test(n)}}function At(t){const e=String(t).trim(),n=parseFloat(e);let o;return o=isNaN(n)?0:/ms$/i.test(e)?n:/s$/i.test(e)?1e3*n:/m$/i.test(e)?6e4*n:/h$/i.test(e)?36e5*n:n,{milliseconds:()=>o,seconds:()=>o/1e3,minutes:()=>o/6e4}}function Ot(t,e){return t[e]||(t[e]=new Set),t[e]}function xt(t,e){return t[e]||(t[e]={}),t[e]}function Ct(t,e,n,o,r){const s=e[w];if(!s)return;const i=[n],a=e[y]?.get(n),c=a&&"string"==typeof a.attribute?a.attribute:null;c&&c!==n&&i.push(c);for(const e of i)if(s.has(e))for(const i of s.get(e))try{i.method.call(t,o,r,n)}catch(t){console.error(`Error in @watch('${e}') method ${i.methodName}:`,t)}if(s.has("*"))for(const e of s.get("*"))try{e.method.call(t,o,r,n)}catch(t){console.error(`Error in @watch('*') method ${e.methodName}:`,t)}}function _t(t,e){let n=null;return function(...o){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,o),n=null},e)}}function kt(t,e){let n=0,o=null;return function(...r){const s=Date.now(),i=e-(s-n);if(i<=0)return o&&(clearTimeout(o),o=null),n=s,t.apply(this,r);o||(o=setTimeout(()=>{n=Date.now(),o=null,t.apply(this,r)},i))}}const Lt=new Map;function Pt(t,e,n){let o,r;return"string"==typeof e?(o=e,r=n):(o=void 0,r=e),function(e,n){const s=n.name;n.addInitializer(function(){const n=this.constructor;if(Object.prototype.hasOwnProperty.call(n,et)||(n[et]=new Set),n[et].has(e))return;if(n[et].add(e),!Object.prototype.hasOwnProperty.call(n,k)){const t=n[k];n[k]=t?[...t]:[]}const i=Array.isArray(t)?t:[t];for(const t of i){const[i,...a]=t.split(":"),c=a.join(":");n[k].push({type:i,target:c,selector:o,methodName:s,method:e,options:r})}})}}function Mt(t,e){const n=t.constructor[k];if(n&&Array.isArray(n)&&0!==n.length){t[p]?t[p].observers||(t[p].observers=[]):t[p]={events:[],channels:[],observers:[]};for(const o of n){const n=o.method.bind(t),r=o.options?.throttle?kt(n,o.options.throttle):n;switch(o.type){case"intersection":$t(t,e,o,r);break;case"resize":It(t,e,o,r);break;case"media":Dt(t,e,o,r);break;case"mutation":Rt(t,e,o,r);break;default:console.warn(`Unknown observer type: ${o.type}`)}}}}function $t(t,e,n,o){const r={threshold:n.options?.threshold??0,rootMargin:n.options?.rootMargin??"0px",root:n.options?.root??null};if("undefined"==typeof IntersectionObserver)return void console.warn("IntersectionObserver is not available in this environment");const s=new IntersectionObserver(t=>{for(const e of t)try{!1===o(e)&&s&&s.unobserve(e.target)}catch(t){console.error(`Error in intersection observer ${n.methodName}:`,t)}},r),i=n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e];i.forEach(t=>s.observe(t)),t[p].observers.push(()=>{i.forEach(t=>s.unobserve(t)),0===s.takeRecords().length&&s.disconnect()})}function It(t,e,n,o){const r=n.options?.box||"content-box";if("undefined"==typeof ResizeObserver)return void console.warn("ResizeObserver is not available in this environment");const s=new ResizeObserver(t=>{for(const e of t)try{o(e)}catch(t){console.error(`Error in resize observer ${n.methodName}:`,t)}});(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e]).forEach(t=>{s.observe(t,{box:r})}),t[p].observers.push(()=>{s.disconnect()})}function Dt(t,e,n,o){const r=n.target;if(!r)return void console.warn("Media query observer requires a query string");let s=Lt.get(r);if(!s)try{s=window.matchMedia(r),Lt.set(r,s)}catch(t){return void console.error(`Invalid media query: ${r}`,t)}const i=t=>{try{o(t.matches)}catch(t){console.error(`Error in media query observer ${n.methodName}:`,t)}};i(s);const a=t=>i(t);s.addEventListener?(s.addEventListener("change",a),t[p].observers.push(()=>{s.removeEventListener("change",a)})):(s.addListener(a),t[p].observers.push(()=>{s.removeListener(a)}))}function Rt(t,e,n,r){const s=n.target.split(":"),i=s[0]||"childList",a=s[1],c={};switch(i){case"childList":c.childList=!0;break;case"attributes":c.attributes=!0,a&&(c.attributeFilter=[a]);break;default:return void console.warn(`Unknown mutation type: ${i}`)}n.options?.subtree&&(c.subtree=!0,n.options.maxDepth&&console.warn("maxDepth is set but requires custom implementation"));const l=!(!n.options?.maxDepth||!n.options.subtree),u=new MutationObserver(t=>{try{if(!l)return void r(t);const o=n.options.maxDepth,s=e.shadowRoot||e,i=t.filter(t=>{let e=0,n=t.target;for(;n&&n!==s&&e<o;)n=n.parentNode,e++;return e<o});i.length>0&&r(i)}catch(t){console.error(`Error in mutation observer ${n.methodName}:`,t)}}),h=!0===t[o];(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):h&&e.shadowRoot?[e.shadowRoot]:[e]).forEach(t=>{u.observe(t,c)}),t[p].observers.push(()=>{u.disconnect()})}function jt(t){if(t[p]?.observers){for(const e of t[p].observers)e();t[p].observers=[]}}function qt(t,e){return function(n,r){let s,i,a=0;const c=[];return async function(...r){const l=async()=>{const s=e?.timeout??12e4,i=e?.discoveryTimeout??50,a=n.apply(this,r),{value:c,done:l}=await a.next();if(l)return c;let u,h;const d=new Promise((t,e)=>{u=t,h=e});let m,f,p;const y=new Promise((e,n)=>{m=e,f=n,p=setTimeout(()=>{n(new Error(`Request "${t}" timed out after ${i}ms - no handler found`))},i)}),g=new CustomEvent(`@request/${t}`,{bubbles:void 0===e?.bubbles||e.bubbles,cancelable:e?.cancelable||!1,composed:!0,detail:{payload:c,discovery:{resolve:()=>{clearTimeout(p),m()},reject:f},data:{resolve:u,reject:h}}});(!0===this[o]&&this.element?this.element:this).dispatchEvent(g);try{await y;const e=setTimeout(()=>{h(new Error(`Request "${t}" timed out after ${s}ms`))},s),n=await d;clearTimeout(e);const{value:o}=await a.next(n);return o}catch(t){try{await a.throw(t)}catch(t){throw t}}};if(e?.debounce)return new Promise((t,n)=>{clearTimeout(s),s=setTimeout(async()=>{try{t(await l())}catch(t){n(t)}},e.debounce)});if(!e?.throttle)return l();const u=Date.now(),h=e.throttle-(u-a);return h<=0?(clearTimeout(i),a=u,l()):new Promise(i?(t,e)=>{c.push({resolve:t,reject:e})}:(t,e)=>{c.push({resolve:t,reject:e}),i=setTimeout(async()=>{a=Date.now(),i=null;const t=c.splice(0);try{const e=await l();for(const n of t)n.resolve(e)}catch(e){for(const n of t)n.reject(e)}},h)})}}}function Ft(t,e){return function(n,o){const r=o.name;o.addInitializer(function(){const o=this.constructor;if(Object.prototype.hasOwnProperty.call(o,ot)||(o[ot]=new Set),!o[ot].has(n)){if(o[ot].add(n),!Object.prototype.hasOwnProperty.call(o,s)){const t=o[s];o[s]=t?[...t]:[]}o[s].push({channelName:t,methodName:r,method:n,options:e})}})}}function Bt(t,e){const n=t.constructor[s];if(n){t[p]||(t[p]={events:[],channels:[]});for(const o of n){const n=o.method.bind(t),r=`@request/${o.channelName}`;let s,i,a=0;const c=[];let l=null;const u=(t=>o.options?.debounce?(...e)=>new Promise((n,r)=>{clearTimeout(s),s=setTimeout(async()=>{try{n(await t(...e))}catch(t){r(t)}},o.options.debounce)}):o.options?.throttle?(...e)=>{const n=Date.now(),r=o.options.throttle-(n-a);return r<=0?(clearTimeout(i),i=null,a=n,t(...e)):(l=e,new Promise((n,o)=>{c.push({resolve:n,reject:o}),i||(i=setTimeout(async()=>{a=Date.now(),i=null;const n=c.splice(0),o=l??e;l=null;try{const e=await t(...o);for(const t of n)t.resolve(e)}catch(t){for(const e of n)e.reject(t)}},r))}))}:t)(n),h=t=>{const{data:e,discovery:n,payload:r}=t.detail;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.resolve(),Promise.resolve(u(r)).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t),console.error(`Error in response handler ${o.methodName}:`,t)})};e.addEventListener(r,h),t[p].channels.push(()=>{e.removeEventListener(r,h)})}}}function Vt(t){if(t[p]?.channels){for(const e of t[p].channels)e();t[p].channels=[]}}const Ut=Symbol.for("snice:html-result"),zt=Symbol.for("snice:css-result");function Ht(t,...e){return{_$litType$:Ut,strings:t,values:e}}function Wt(t,...e){let n=t[0];for(let o=0;o<e.length;o++)n+=String(e[o])+t[o+1];const o={_$litType$:zt,cssText:n};if("undefined"!=typeof CSSStyleSheet&&"undefined"!=typeof Document&&"adoptedStyleSheets"in Document.prototype)try{const t=new CSSStyleSheet;t.replaceSync(n),o.styleSheet=t}catch(t){}return o}function Kt(t){return t&&t._$litType$===Ut}function Gt(t){return t&&t._$litType$===zt}const Qt=Symbol.for("snice:nothing"),Jt=Symbol.for("snice:unsafe-html");function Xt(t){return{_$litType$:Jt,html:t}}const Yt=`snice$${Math.random().toFixed(9).slice(2)}$`,Zt="?"+Yt,te=`<${Zt}>`,ee=new RegExp(Yt,"g"),ne=new WeakMap,oe=Symbol("not-committed"),re=Symbol.for("snice:no-change"),se=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class ie{constructor(t,e,n){this.parts=[],this.element=e;const o=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let r=0;const s=[];let i;for(;null!==(i=o.nextNode());)if(i.nodeType===Node.ELEMENT_NODE){const t=i,e=t.tagName.toLowerCase();if("if"===e){const e=t.getAttribute("value");e&&e.includes(Yt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-if",index:r++,element:t}));continue}if("case"===e){const e=t.getAttribute("value");e&&e.includes(Yt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-case",index:r++,element:t}));continue}if(t.hasAttributes()){const e=t.attributes,o=[];for(let s=0;s<e.length;s++){const i=e[s],a=i.value;if(a.includes(Yt)){o.push(i);const e=n[r]||i.name,s=a.split(Yt),c=s.length-1;e.startsWith("@@")||e.startsWith("@")?(this.parts.push({type:"event",index:r,name:e.slice(1),element:t}),r+=1):e.startsWith(".")?(this.parts.push({type:"property",index:r,name:e.slice(1),element:t}),r+=1):e.startsWith("?")?(this.parts.push({type:"boolean-attribute",index:r,name:e.slice(1),element:t}),r+=1):(this.parts.push({type:"attribute",index:r,name:i.name,element:t,attrStrings:s}),r+=c)}}for(const e of o)t.removeAttribute(e.name)}}else if(i.nodeType===Node.COMMENT_NODE){const t=i;if(t.data===Zt){const e=t.parentNode,n=document.createComment("");e.insertBefore(n,t.nextSibling),this.parts.push({type:"node",index:r++,startNode:t,endNode:n})}}else if(i.nodeType===Node.TEXT_NODE){const t=i,e=t.data;if(e.includes(Yt)){const n=t.parentNode,o=e.split(ee),i=o.length-1;for(let e=0;e<i;e++){n.insertBefore(document.createTextNode(o[e]),t);const s=document.createComment(""),i=document.createComment("");n.insertBefore(s,t),n.insertBefore(i,t),this.parts.push({type:"node",index:r++,startNode:s,endNode:i})}""!==o[i]?t.data=o[i]:s.push(t)}}for(const t of s)t.parentNode?.removeChild(t)}}class ae{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=ne.get(e);if(n)return n;const o=[],r=[];let s=!1,i=!1,a="",c="";for(let t=0;t<e.length;t++){const n=e[t];if(o.push(n),t<e.length-1){for(let t=0;t<n.length;t++){const e=n[t];if(s){if(i)e===a&&(i=!1,a="");else if(">"===e)s=!1;else if('"'===e||"'"===e)i=!0,a=e;else if("="===e){let e=t-1;for(;e>=0&&/[\w\-\.@\?:\+~]/.test(n[e]);)e--;c=n.substring(e+1,t).trim()}}else"<"===e&&(s=!0)}if(i)r.push(c),o.push(Yt);else if(s){const t=n.trimEnd();if(t.endsWith("=")){let e=t.length-2;for(;e>=0&&/[\w\-\.@\?\/:\+~]/.test(t[e]);)e--;c=t.substring(e+1,t.length-1).trim(),r.push(c),o.push(Yt)}else n.match(/<(if|case)\s*$/)?(c="value",r.push("value"),o.push(`value="${Yt}"`)):(r.push(""),o.push(Yt))}else r.push(""),o.push(te)}}const l=o.join(""),u=document.createElement("template");u.innerHTML=l;const h=new ie(t,u,r);return ne.set(e,h),h}(t),this.strings=t.strings}isSameTemplate(t){return this.strings===t}renderFragment(){if(!this.fragment){this.fragment=this.template.element.content.cloneNode(!0);const t=document.createTreeWalker(this.template.element.content,NodeFilter.SHOW_ALL),e=document.createTreeWalker(this.fragment,NodeFilter.SHOW_ALL),n=new Map;let o=t.currentNode,r=e.currentNode;for(;o&&r;)n.set(o,r),o=t.nextNode(),r=e.nextNode();for(let t=0;t<this.template.parts.length;t++){const e=this.template.parts[t];let o;switch(e.type){case"node":const t=n.get(e.startNode),r=n.get(e.endNode);o=new le(t,r);break;case"attribute":const s=n.get(e.element);o=new ue(s,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);o=new he(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);o=new de(a,e.name);break;case"event":const c=n.get(e.element);o=new me(c,e.name);break;case"conditional-if":const l=n.get(e.element);o=new be(l);break;case"conditional-case":const u=n.get(e.element);o=new ve(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(o),o instanceof be||o instanceof ve?this.conditionalParts.push({part:o,index:e.index}):this.regularParts.push({part:o,index:e.index})}}return this.fragment}render(t){const e=this.renderFragment();return this.update(t),e}update(t){for(const{part:e,index:n}of this.conditionalParts)e.commit(t[n]);for(const{part:e,index:n}of this.regularParts)e instanceof ue&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class ce{}class le extends ce{constructor(t,e){super(),this._committedValue=oe,this.startNode=t,this.endNode=e}commit(t){if(t!==re)return t===Qt||null==t||""===t?(this._committedValue!==Qt&&this._clear(),void(this._committedValue=Qt)):void(se(t)?t!==this._committedValue&&this._commitText(t):Kt(t)?this._commitTemplateResult(t):!function(t){return t&&t._$litType$===Jt}(t)?void 0===t.nodeType?(t=>Array.isArray(t)||"function"==typeof t?.[Symbol.iterator])(t)?this._commitIterable(t):this._commitText(t):this._commitNode(t):this._commitUnsafeHTML(t))}_commitText(t){if(this._committedValue!==oe&&this._committedValue!==Qt&&se(this._committedValue)&&!Array.isArray(this._committedValue)){const e=this.startNode.nextSibling;if(e&&e.nodeType===Node.TEXT_NODE)return e.data=String(t),void(this._committedValue=t)}this._clear(),this._insertBefore(document.createTextNode(String(t))),this._committedValue=t}_commitTemplateResult(t){const e=this._committedValue;if(e instanceof ae){const n=ne.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new ae(t),o=n.renderFragment();this._insertBefore(o),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof le||(this._clear(),this._committedValue=[]);const e=this._committedValue;let n=0;for(const o of t){let t;if(n>=e.length){const n=document.createComment(""),o=document.createComment("");this._insertBefore(n),this._insertBefore(o),t=new le(n,o),e.push(t)}else t=e[n];t.commit(o),n++}if(n<e.length){for(let t=n;t<e.length;t++){const n=e[t];n._clear(),n.startNode.remove(),n.endNode.remove()}e.length=n}}_commitNode(t){this._committedValue!==t&&(this._clear(),this._insertBefore(t),this._committedValue=t)}_commitUnsafeHTML(t){this._clear();const e=document.createElement("template");e.innerHTML=t.html,this._insertBefore(e.content),this._committedValue=t}_insertBefore(t){this.endNode.parentNode?.insertBefore(t,this.endNode)}_clear(){const t=this.startNode.parentNode;if(!t)return;let e=this.startNode.nextSibling;for(;e&&e!==this.endNode;){const n=e.nextSibling;t.removeChild(e),e=n}this._committedValue=Qt}clear(){this._clear()}}class ue extends ce{constructor(t,e,n){super(),this._committedValue=oe,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill(oe),this.strings=n):this._committedValue=oe}commit(t,e=0){let n,o=!1;if(void 0===this.strings){if(t===re)return;if(o=!se(t)||t!==this._committedValue&&t!==re,!o)return;this._committedValue=t,n=t}else{const r=t,s=this._committedValue;n=this.strings[0];for(let t=0;t<this.strings.length-1;t++){let i=r[e+t];i===re&&(i=s[t]),o=o||!se(i)||i!==s[t],i===Qt?n=Qt:n!==Qt&&(n=n+(i??"")+this.strings[t+1]),s[t]=i}if(!o)return}this._commitValue(n)}_commitValue(t){t===Qt||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class he extends ce{constructor(t,e){super(),this._committedValue=oe,this.element=t,this.name=e}commit(t){t!==re&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===Qt?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=oe}}class de extends ce{constructor(t,e){super(),this._committedValue=oe,this.element=t,this.name=e}commit(t){if(t===re)return;const e=!!t&&t!==Qt;e!==this._committedValue&&(this._committedValue=e,e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name))}clear(){this.element.removeAttribute(this.name),this._committedValue=oe}}class me extends ce{constructor(t,e){super(),this.listener=null,this.value=void 0,this.keyFilter=null,this.host=null,this.element=t;const n=["keydown","keyup","keypress"].includes(e.split(".")[0].split(":")[0]),o=e.indexOf("."),r=n?e.indexOf(":"):-1,s=o>0&&r>0?Math.min(o,r):Math.max(o,r);if(s>0){const t=e.substring(0,s),n=e.substring(s+1);this.eventName=t,this.keyFilter=fe(n)}else this.eventName=e}commit(t){if(t===re)return;if(t===Qt&&(t=null),t===this.value&&null!=t)return;if(this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null),this.value=t,null==t)return;if("function"!=typeof t)return;if(!this.host){const t=this.element.getRootNode();this.host=t.host||null}const e=this.host||null,n=this.keyFilter;this.listener=o=>{n&&!ye(o,n)||t.call(e,o)},this.element.addEventListener(this.eventName,this.listener)}clear(){this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null)}}function fe(t){const e=t.startsWith("~");e&&(t=t.substring(1));const n=t.split("+"),o={key:"",anyModifiers:e};for(const t of n){const e=t.toLowerCase();"ctrl"===e||"control"===e?o.ctrl=!0:"alt"===e?o.alt=!0:"shift"===e?o.shift=!0:"meta"===e||"cmd"===e||"command"===e?o.meta=!0:o.key=pe(t)}return o}function pe(t){return{esc:"Escape",escape:"Escape",enter:"Enter",return:"Enter",space:" ",spacebar:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight",delete:"Delete",del:"Delete",backspace:"Backspace",tab:"Tab",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"}[t.toLowerCase()]||t}function ye(t,e){if(t.key!==e.key)return!1;if(e.anyModifiers)return!0;const n=e.ctrl?t.ctrlKey:!t.ctrlKey,o=e.alt?t.altKey:!t.altKey,r=e.shift?t.shiftKey:!t.shiftKey,s=e.meta?t.metaKey:!t.metaKey;return n&&o&&r&&s}const ge=Symbol("not-set");class be extends ce{constructor(t){super(),this.value=ge,this.childFragment=null;const e=t.parentNode;for(this.startNode=document.createComment("if"),this.endNode=document.createComment("/if"),e.insertBefore(this.startNode,t),e.insertBefore(this.endNode,t.nextSibling);t.firstChild;)e.insertBefore(t.firstChild,this.endNode);e.removeChild(t)}commit(t){const e=Boolean(t);if(this.value!==t)if(this.value=t,e)this.childFragment&&this.childFragment.hasChildNodes()&&this.startNode.parentNode.insertBefore(this.childFragment,this.endNode);else{this.childFragment||(this.childFragment=document.createDocumentFragment());let t=this.startNode.nextSibling;for(;t&&t!==this.endNode;){const e=t.nextSibling;this.childFragment.appendChild(t),t=e}}}clear(){this.childFragment||(this.childFragment=document.createDocumentFragment());let t=this.startNode.nextSibling;for(;t&&t!==this.endNode;){const e=t.nextSibling;this.childFragment.appendChild(t),t=e}}}class ve extends ce{constructor(t){super(),this.value=ge,this.branches=new Map,this.defaultBranch=null,this.currentKey=null;const e=t.parentNode;this.startNode=document.createComment("case"),this.endNode=document.createComment("/case"),e.insertBefore(this.startNode,t),e.insertBefore(this.endNode,t.nextSibling);for(const e of Array.from(t.children)){const t=e.tagName.toLowerCase();if("when"===t){const t=e.getAttribute("value")||"",n=document.createDocumentFragment();for(;e.firstChild;)n.appendChild(e.firstChild);this.branches.set(t,n)}else if("default"===t)for(this.defaultBranch=document.createDocumentFragment();e.firstChild;)this.defaultBranch.appendChild(e.firstChild)}e.removeChild(t)}commit(t){if(this.value===t)return;this.value=t;const e=String(t);this._collectCurrent();const n=this.branches.has(e),o=n?this.branches.get(e):this.defaultBranch;this.currentKey=n?e:this.defaultBranch?"__default__":null,o&&o.hasChildNodes()&&this.startNode.parentNode.insertBefore(o,this.endNode)}_collectCurrent(){if(null===this.currentKey)return;const t="__default__"===this.currentKey?this.defaultBranch:this.branches.get(this.currentKey);if(!t)return;let e=this.startNode.nextSibling;for(;e&&e!==this.endNode;){const n=e.nextSibling;t.appendChild(e),e=n}}clear(){this._collectCurrent(),this.currentKey=null}}const we=e("on-handlers");function Ne(t,e,n){let o=null,r={};return"string"==typeof e?(o=e,r=n||{}):e&&"object"==typeof e?r=e:null===e&&n&&(r=n),function(e,n){const s=n.name;return n.addInitializer(function(){const n=this.constructor;if(Object.prototype.hasOwnProperty.call(n,nt)||(n[nt]=new Set),n[nt].has(e))return;if(n[nt].add(e),!Object.prototype.hasOwnProperty.call(n,we)){const t=n[we];n[we]=t?[...t]:[]}const i=Array.isArray(t)?t:[t];for(const t of i)n[we].push({eventName:t,selector:o,methodName:s,method:e,options:r})}),e}}function Se(t,e){let n=0;return function(...o){const r=Date.now();r-n>=e&&(n=r,t.apply(this,o))}}const Te=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function Ee(t,e){const n=t.constructor[we];if(n&&Array.isArray(n)&&0!==n.length){t[p]?t[p].events?t[p].events.length>0&&Ae(t):t[p].events=[]:t[p]={events:[],channels:[],observers:[]};for(const o of n){const n=t[o.methodName];let r=n?n.bind(t):o.method.bind(t);const s=o.options||{},i=["keydown","keyup","keypress"].includes(o.eventName.split(".")[0].split(":")[0]),a=o.eventName.indexOf("."),c=i?o.eventName.indexOf(":"):-1,l=a>0&&c>0?Math.min(a,c):Math.max(a,c),u=l>0?o.eventName.substring(0,l):o.eventName,h=l>0?o.eventName.substring(l+1):null;s.debounce&&s.debounce>0?r=_t(r,s.debounce):s.throttle&&s.throttle>0&&(r=Se(r,s.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=fe(h));const m=(t=>d?e=>{ye(e,d)&&t(e)}:t)(r);if(o.selector){const n=e.shadowRoot||e,r=t=>{const e=t.target;if(e.matches&&e.matches(o.selector)&&e||e.closest&&e.closest(o.selector)||null){s.preventDefault&&t.preventDefault(),s.stopPropagation&&(t.stopPropagation(),t.stopImmediatePropagation());try{m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},i=Te.has(u),a={capture:void 0!==s.capture?s.capture:i,once:s.once||!1,passive:s.passive||!1};n.addEventListener(u,r,a),t[p].events.push({target:n,eventName:u,handler:r,options:a})}else{const n=e.shadowRoot,r=Symbol(),i=t=>{if(!t[r]){t[r]=!0,s.preventDefault&&t.preventDefault(),s.stopPropagation&&t.stopPropagation();try{m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},a={capture:s.capture||!1,once:s.once||!1,passive:s.passive||!1};n&&(n.addEventListener(u,i,a),t[p].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[p].events.push({target:e,eventName:u,handler:i,options:a})}}}}function Ae(t){if(t[p]?.events){for(const{target:e,eventName:n,handler:o,options:r}of t[p].events)e.removeEventListener(n,o,r);t[p].events=[]}}class Oe{constructor(){this.cleanupFns=new Map,this.pendingOperations=new Set}register(t,e){this.cleanupFns.set(t,e)}unregister(t){this.cleanupFns.delete(t)}async cleanup(){await Promise.all(this.pendingOperations);for(const t of this.cleanupFns.values())try{await t()}catch(t){console.error("Error during cleanup:",t)}this.cleanupFns.clear()}async runOperation(t){const e=t(),n=e.then(()=>{},()=>{});this.pendingOperations.add(n);try{const t=await e;return this.pendingOperations.delete(n),t}catch(t){throw this.pendingOperations.delete(n),t}}}function xe(t){return function(e,o){const r=globalThis.snice?.controllerRegistry;if(!r)throw new Error("Snice global registry not initialized");return r.set(t,e),e.prototype[n]=!0,e}}async function Ce(e,n){const r=e[u],s=e[h],i=e[f];if(void 0!==i&&i!==n)return;if(s===n&&r)return;r&&await _e(e);const a=globalThis.snice?.controllerRegistry;if(!a)throw new Error("Snice global registry not initialized");const c=a.get(n);if(!c)throw console.error(`Controller "${n}" not found. Available:`,Array.from(a.keys())),new Error(`Controller "${n}" not found in registry`);const l=new c;t.controllerIdCounter+=1;const p=t.controllerIdCounter,y=new Oe;l[o]=!0,l[d]=p,l.element=e;const g=e[S];void 0!==g&&(l[S]=g),e[u]=l,e[h]=n,e[m]=y;const b=new AbortController;e[lt]=b;try{await Promise.race([e.ready,new Promise((t,e)=>{const o=()=>e(new Error(`attachController("${n}"): aborted before element was ready (likely detached or never connected)`));if(b.signal.aborted)return o();b.signal.addEventListener("abort",o,{once:!0});const r=setTimeout(()=>e(new Error(`attachController("${n}"): element did not become ready within 30000ms (did you forget to appendChild it?)`)),3e4);b.signal.addEventListener("abort",()=>clearTimeout(r),{once:!0})})])}finally{e[lt]===b&&delete e[lt]}await y.runOperation(async()=>{await l.attach(e)}),Mt(l,e),Bt(l,e),Ee(l,e),e.dispatchEvent(new CustomEvent("controller-attached",{detail:{name:n,controller:l}}))}async function _e(t){const e=t[lt];e&&e.abort();const n=t[u],o=t[h],r=t[m];n&&(r?await r.runOperation(async()=>{await n.detach(t)}):await n.detach(t),n.element=null,jt(n),Vt(n),Ae(n),r&&await r.cleanup(),delete n[S],delete t[u],delete t[h],delete t[m],t.dispatchEvent(new CustomEvent("controller-detached",{detail:{name:o,controller:n}})))}function ke(){if(globalThis.sniceNativeControllersInitialized)return;function t(t){if(!(t instanceof HTMLElement))return;if(!t.tagName||t.tagName.includes("-"))return;if(t[r])return;const e=t.getAttribute("controller"),n=t[f];if(e!==n){if(!e)return delete t[f],delete t[h],void _e(t).catch(t=>{console.error("Failed to detach controller from native element:",t)});t[f]=e,t.ready||(t.ready=Promise.resolve()),n&&_e(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),Ce(t,e).catch(t=>{console.error(`Failed to attach controller "${e}" to native element:`,t)})}}globalThis.sniceNativeControllersInitialized=!0;const e=new MutationObserver(e=>{for(const n of e)"attributes"===n.type&&"controller"===n.attributeName?t(n.target):"childList"===n.type&&n.addedNodes.forEach(e=>{e instanceof HTMLElement&&(t(e),e.querySelectorAll("[controller]").forEach(t))})});function n(){document.querySelectorAll("[controller]").forEach(t),e.observe(document.body,{attributes:!0,attributeFilter:["controller"],childList:!0,subtree:!0})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n(),globalThis.sniceNativeControllerObserver=e}const Le=e("context-handlers");function Pe(t={}){return function(e,n){const o=n.name;return n.addInitializer(function(){const n=this.constructor;if(Object.prototype.hasOwnProperty.call(n,Z)||(n[Z]=new Set),!n[Z].has(e)){if(n[Z].add(e),!Object.prototype.hasOwnProperty.call(n,Le)){const t=n[Le];n[Le]=t?[...t]:[]}n[Le].push({methodName:o,method:e,options:t})}}),e}}function Me(t){const e=t.constructor[Le];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[U];if(n){t[z]=n;for(const o of e){const{methodName:e,method:r,options:s}=o,i=`__wrapped_${e}`;t[i]=function(n){if(s.once&&t[X])return;const o=()=>{if(r.call(t,n),s.once){t[X]=!0;const e=t[z];e&&"function"==typeof e[G]&&e[G](t)}},i=t[J]||(t[J]={}),a=e;if(s.debounce)return clearTimeout(i[a]?.timeout),void(i[a]={timeout:setTimeout(o,s.debounce)});if(s.throttle){const t=Date.now();return void(t-(i[a]?.lastCall||0)>=s.throttle&&(i[a]={lastCall:t},o()))}o()},"function"==typeof n[K]&&n[K](t,i)}}}const $e=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?De(t,e):(this.pending.add(t),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush())))}flush(){const t=Array.from(this.pending);this.pending.clear(),this.scheduled=!1;for(const e of t){if(!e.isConnected)continue;De(e,e[D]||{})}}remove(t){this.pending.delete(t)}};function Ie(t){const e=t[q];if(!e||0===e.length)return;const n=[...e];t[q]=[],n.forEach(t=>t())}function De(t,e,n){const o=t[I];if(o&&(!e.once||!t[R]))try{const r=void 0!==n?n:o.call(t);if(t.shadowRoot||t.attachShadow({mode:"open"}),!1===e.differential)return"string"!=typeof r?void console.warn("Render method with differential: false must return a string"):(t.shadowRoot.innerHTML=r,void Ie(t));if(!Kt(r))return void console.warn("Render method must return html`` template result");let s=t[R];if(s&&s.isSameTemplate(r.strings))return s.update(r.values),void Ie(t);if(s){const e=t.shadowRoot,n=[];for(const t of Array.from(e.childNodes))1===t.nodeType&&"STYLE"===t.tagName||n.push(t);for(const t of n)t.remove()}s=new ae(r),t[R]=s,t.shadowRoot.appendChild(s.renderFragment()),s.update(r.values),Ie(t)}catch(t){console.error("Error rendering element:",t)}}function Re(t,e=!1){const n=t[D]||{};if(!n.once||!t[R])if(e)De(t,n);else{if(void 0!==n.debounce&&n.debounce>0)return t[j]||(t[j]={}),clearTimeout(t[j].debounce),void(t[j].debounce=setTimeout(()=>{$e.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[j]||(t[j]={lastThrottle:0});const e=t[j],o=Date.now();if(0===e.lastThrottle||o-e.lastThrottle>=n.throttle)return e.lastThrottle=o,void $e.schedule(t,n);if(!e.throttleTimer){const r=n.throttle-(o-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),$e.schedule(t,n)},r)}return}$e.schedule(t,n)}}function je(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[I]=e,this[D]=t}),function(...t){const n=e.apply(this,t);return De(this,{},n),n}}}function qe(){return function(t,e){return e.addInitializer(function(){this[F]&&!this[V]?this[V]=[this[F]]:this[F]&&this[V]&&this[V].push(this[F]),this[F]=t}),t}}const Fe=e("debounce-timers"),Be=e("throttle-timers"),Ve=e("once-called"),Ue=e("memoize-cache");function ze(t=300,e={}){const{leading:n=!1,trailing:o=!0,maxWait:r}=e;return function(e,s){const i=s.name;return function(...s){this[Fe]||(this[Fe]={});const a=this[Fe],c=i;a[c]&&clearTimeout(a[c].timeout);const l=Date.now(),u=!a[c],h=u?l:a[c].startTime,d=void 0!==r&&l-h>=r;if(n&&u){const t=e.apply(this,s);return a[c]={timeout:null,startTime:h,lastArgs:s},t}const m=setTimeout(()=>{(o||d)&&e.apply(this,a[c].lastArgs),delete a[c]},d?0:t);a[c]={timeout:m,startTime:h,lastArgs:s}}}}function He(t=300,e={}){const{leading:n=!0,trailing:o=!0}=e;return function(e,r){const s=r.name;return function(...r){this[Be]||(this[Be]={});const i=this[Be],a=s,c=Date.now();if(!i[a])return n&&e.apply(this,r),i[a]={lastInvoke:c,timeout:null,lastArgs:r},void(o&&!n&&(i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),delete i[a]},t)));const l=c-i[a].lastInvoke;if(i[a].lastArgs=r,i[a].timeout&&clearTimeout(i[a].timeout),l>=t)return e.apply(this,r),void(i[a].lastInvoke=c);if(o){const n=t-l;i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),i[a].lastInvoke=Date.now(),i[a].timeout=null},n)}}}}function We(t=!0){let e,n=!1;return function(o,r){const s=r.name;return function(...r){return t?(this[Ve]||(this[Ve]={}),this[Ve][s]||(this[Ve][s]={called:!0,result:o.apply(this,r)}),this[Ve][s].result):(n||(n=!0,e=o.apply(this,r)),e)}}}function Ke(t={}){const{keyGenerator:e=(...t)=>JSON.stringify(t),maxSize:n=100,ttl:o}=t;return function(t,r){const s=r.name;return function(...r){this[Ue]||(this[Ue]={}),this[Ue][s]||(this[Ue][s]=new Map);const i=this[Ue][s],a=e(...r);if(i.has(a)){const t=i.get(a);if(!(void 0!==o&&Date.now()-t.timestamp>o))return t.value;i.delete(a)}const c=t.apply(this,r);if(i.set(a,{value:c,timestamp:Date.now()}),i.size>n){const t=i.keys().next().value;i.delete(t)}return c}}}function Ge(t){if(t[Fe]){for(const e in t[Fe])t[Fe][e]?.timeout&&clearTimeout(t[Fe][e].timeout);t[Fe]={}}}function Qe(t){if(t[Be]){for(const e in t[Be])t[Be][e]?.timeout&&clearTimeout(t[Be][e].timeout);t[Be]={}}}function Je(t,e){t[Ue]&&(e?delete t[Ue][e]:t[Ue]={})}function Xe(t,e){t[Ve]&&(e?delete t[Ve][e]:t[Ve]={})}function Ye(t){t.prototype[r]=!0;const e=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback,o=t.prototype.attributeChangedCallback,s=t.observedAttributes||[];s.includes("controller")||s.push("controller");const u=t[y];if(u)for(const[t,e]of u){if(!1===e.attribute)continue;const n=Nt(e,t);s.includes(n)||s.push(n)}Object.defineProperty(t,"observedAttributes",{get:()=>s,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get(){return this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[i]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[c]},set(t){const e=this[c];this[c]=t,t!==e&&(t?Ce(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):e&&_e(this).catch(t=>{console.error("Failed to detach controller:",t)}))},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[l]){Ee(this,this),Bt(this,this),Me(this);try{Mt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName} on reconnection:`,t)}e&&e.call(this);const n=t[x];if(n)for(const t of n)try{const e=t.method.call(this);e&&"function"==typeof e.then&&e.catch(e=>{console.error(`Error in @reconnect handler ${t.methodName}:`,e)})}catch(e){console.error(`Error in @reconnect handler ${t.methodName}:`,e)}return}this[v]=!0;const n=t[y];if(n)for(const[t,e]of n){if(!1===e.attribute)continue;const n=Nt(e,t);if(!this.hasAttribute(n))continue;const o=this.getAttribute(n);Ot(this,N).add(t),e.type===Boolean&&""===o&&this.setAttribute(n,"true"),this[t]=wt(o,e)}if(this[b]){for(const[t,e]of Array.from(this[b].entries())){const o=n?.get(t),r=Nt(o||{},t);this[b].delete(t),this.hasAttribute(r)||(this[t]=e)}delete this[b]}if(this.hasAttribute("controller")&&!this[c]){const t=this.getAttribute("controller");t&&(this.controller=t)}!function(t){const e=t[F];if(e&&!t[B]){t[B]=!0;try{const n=[],o=t[V];if(o)for(const e of o){const o=e.call(t);Gt(o)&&n.push(o)}const r=e.call(t);if(!Gt(r))return void console.warn("Styles method must return css`` template result");if(n.push(r),t.shadowRoot||t.attachShadow({mode:"open"}),!t.shadowRoot)return;if(n.every(t=>!!t.styleSheet)&&"adoptedStyleSheets"in t.shadowRoot)return void(t.shadowRoot.adoptedStyleSheets=n.map(t=>t.styleSheet));for(const e of n){const n=document.createElement("style");n.textContent=e.cssText,t.shadowRoot.appendChild(n)}}catch(t){console.error("Error applying styles:",t)}}}(this),Ee(this,this),Bt(this,this),Me(this),this[l]=!0,e&&e.call(this);const o=t[A];if(await new Promise(t=>queueMicrotask(t)),this.isConnected){this[I]&&Re(this,!0);try{Mt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}if(await new Promise(t=>queueMicrotask(t)),this.isConnected){if(o)for(const t of o)try{await t.method.call(this)}catch(e){console.error(`Error in @ready handler ${t.methodName}:`,e)}this[a]&&(this[a](),this[a]=null)}else this[a]&&(this[a](),this[a]=null)}else this[a]&&(this[a](),this[a]=null)},t.prototype.disconnectedCallback=async function(){const e=t[O];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @dispose handler ${t.methodName}:`,e)}n&&n.call(this),this[c]&&_e(this).catch(t=>{console.error("Failed to detach controller:",t)}),Ae(this),Vt(this),function(t){const e=t.constructor[Le];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[J];if(n&&"object"==typeof n){for(const t of Object.keys(n))n[t]?.timeout&&clearTimeout(n[t].timeout);delete t[J]}for(const n of e)delete t[`__wrapped_${n.methodName}`];const o=t[z];o&&"function"==typeof o[G]&&o[G](t),delete t[z],delete t[X]}(this),jt(this),Ge(this),Qe(this)},t.prototype.attributeChangedCallback=function(e,n,r){if(o?.call(this,e,n,r),"controller"===e)return void(this.controller=r);const s=t[y];if(s)for(const[n,o]of s){if(Nt(o,n).toLowerCase()!==e.toLowerCase())continue;const s=this[g]?.[n],i=wt(r,o,s,void 0);if(s===i)break;Ot(this,N).add(n),xt(this,g)[n]=i,this[L]?.has(e.toLowerCase())||(Ct(this,t,n,s,i),this[I]&&this[l]&&Re(this));break}},t.prototype.connectedMoveCallback=async function(){const e=t[C];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @moved handler ${t.methodName}:`,e)}},t.prototype.adoptedCallback=async function(){const e=t[_];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @adopted handler ${t.methodName}:`,e)}}}function Ze(t,e,n,o){if(function(t){let e=Object.getPrototypeOf(t);const n=[];for(;e&&e!==HTMLElement&&e!==Function.prototype;)n.push(e),e=Object.getPrototypeOf(e);n.reverse();for(const e of n){if(e[y]){t[y]||(t[y]=new Map);for(const[n,o]of e[y])t[y].has(n)||t[y].set(n,o)}e.formAssociated&&!t.formAssociated&&(t.formAssociated=!0)}}(e),n.metadata&&n.metadata[y]){e[y]||(e[y]=new Map);for(const[t,o]of n.metadata[y])e[y].set(t,o)}else if(nn.length>0){e[y]||(e[y]=new Map);const t=nn.pop();for(const[n,o]of t)e[y].set(n,o)}return o?.formAssociated&&(e.formAssociated=!0),Ye(e),customElements.get(t)?(globalThis.SNICE_DEBUG&&console.warn(`[snice] "${t}" is already registered. Skipping.`),e):(customElements.define(t,e),e)}function tn(t,e){return function(n,o){return Ze(t,n,o,e)}}function en(t){return function(e,n){return Ze(t,e,n)}}const nn=[];function on(t){return function(e,n){const o=n.name;return n.metadata?(n.metadata[y]||(n.metadata[y]=new Map),n.metadata[y].set(o,t||{})):(0===nn.length&&nn.push(new Map),nn[nn.length-1].set(o,t||{})),function(e){const n=this.constructor;n[y]||(n[y]=new Map);const r={...t};r.type||void 0===e||(r.type=vt(e)),n[y].set(o,r);const s=this.constructor.prototype;let i=s[ut];i&&Object.prototype.hasOwnProperty.call(s,ut)||(i=new Map(i),s[ut]=i);const a=i.get(o);if(!a||a!==t){i.set(o,t);const n={get(){if(!1===r?.attribute)return this[g]&&o in this[g]?this[g][o]:this[b]?.has(o)?this[b].get(o):e;const t=Nt(r||{},o),n=this.getAttribute?.(t);if(null!==n)return wt(n,r||{},void 0,e);return((r?.type||vt(e))!==Boolean||!this[N]?.has(o))&&(this[b]?.has(o)?this[b].get(o):e)},set(t){const n=this[o];if(n!==t){if(!this[v])return this[b]||(this[b]=new Map),void this[b].set(o,t);if(!1===r?.attribute)xt(this,g)[o]=t;else{const n=Nt(r,o),s=function(t,e,n){if(null==t||!1===t||e?.type===ht&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||vt(n)){case Boolean:return"true";case Date:return t instanceof Date?t.toISOString():String(t);case BigInt:return"bigint"==typeof t?t.toString()+"n":String(t);case ht:return Array.isArray(t)?ht.serialize(t):String(t);case Array:return Array.isArray(t)?JSON.stringify(t):String(t);case Object:return"object"==typeof t&&null!==t?JSON.stringify(t):String(t);default:return String(t)}}(t,r,e);Ot(this,N).add(o),Ot(this,L).add(n.toLowerCase()),null===s?this.removeAttribute?.(n):this.setAttribute?.(n,s),queueMicrotask(()=>{this[L]?.delete(n.toLowerCase())})}Ct(this,this.constructor,o,n,t),this[I]&&this[l]&&Re(this)}},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,o,n)}return xt(this,g)[o]=e,e}}}function rn(t){return!0===t[o]&&t.element?t.element:t}function sn(t,e={}){return function(n,o){const{light:r=!1,shadow:s=!0}=e,i=o.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=rn(this);let n=null;return s&&e.shadowRoot&&(n=e.shadowRoot.querySelector(t)),!n&&r&&(n=e.querySelector(t)),n||null},set(){},configurable:!0,enumerable:!0}),e}}}function an(t,e={}){return function(n,o){const{light:r=!1,shadow:s=!0}=e,i=o.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=rn(this),n=[];return s&&e.shadowRoot&&n.push(...e.shadowRoot.querySelectorAll(t)),r&&n.push(...e.querySelectorAll(t)),n},set(){},configurable:!0,enumerable:!0}),e}}}function cn(...t){return function(e,n){const o=n.name;n.addInitializer(function(){const n=this.constructor;Object.prototype.hasOwnProperty.call(n,tt)||(n[tt]=new Map);let r=n[tt].get(e);if(r||(r=new Set,n[tt].set(e,r)),!Object.prototype.hasOwnProperty.call(n,w)){const t=n[w],e=new Map;if(t)for(const[n,o]of t)e.set(n,[...o]);n[w]=e}for(const s of t)r.has(s)||(r.add(s),n[w].has(s)||n[w].set(s,[]),n[w].get(s).push({methodName:o,method:e}))})}}function ln(){return function(t,e){const n=e.name;return function(t){if(!Object.hasOwn(this.constructor.prototype,n)){const t={get(){if(void 0!==this[S])return this[S];let t=!0===this[o]&&this.element?this.element:this;if(!t||!t.dispatchEvent)return;t.getRootNode&&t.getRootNode()instanceof ShadowRoot&&(t=t.getRootNode().host);const e={target:this};return t.dispatchEvent(new CustomEvent("@context/request",{bubbles:!0,cancelable:!0,detail:e})),void 0!==e.context?(this[S]=e.context,e.context):void 0},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,n,t)}return t}}}function un(t,e,n,o,r){const s=o.name;o.addInitializer(function(){const o=this.constructor;if(Object.prototype.hasOwnProperty.call(o,e)||(o[e]=new Set),!o[e].has(n)){if(o[e].add(n),!Object.prototype.hasOwnProperty.call(o,t)){const e=o[t];o[t]=e?[...e]:[]}o[t].push({methodName:s,method:n,...r})}})}function hn(){return function(t,e){un(A,rt,t,e)}}function dn(){return function(t,e){un(O,st,t,e)}}function mn(){return function(t,e){un(x,it,t,e)}}function fn(t,e,n){return function(o={}){return function(r,s){un(t,n,r,s,{options:o});const i=s.name;return function(...t){this[e]||(this[e]=new Map),this[e].has(i)||this[e].set(i,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const n=this[e].get(i),s=(...t)=>r.apply(this,t);if(o.debounce>0)return clearTimeout(n.debounceTimer),void(n.debounceTimer=setTimeout(()=>s(...t),o.debounce));if(o.throttle>0){const e=Date.now();if(0===n.lastThrottleCall||e-n.lastThrottleCall>=o.throttle)return n.lastThrottleCall=e,s(...t);if(!n.throttleTimer){const r=o.throttle-(e-n.lastThrottleCall);n.throttleTimer=setTimeout(()=>{n.throttleTimer=null,n.lastThrottleCall=Date.now(),s(...t)},r)}return}return s(...t)}}}}const pn=fn(C,P,at),yn=fn(_,M,ct);
|
|
15
|
+
globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0});const t=globalThis.snice;function e(t){return Symbol.for(`snice:${t}`)}const n=e("is-controller-class"),o=e("is-controller-instance"),r=e("is-element-class"),s=e("channel-handlers"),i=e("ready-promise"),a=e("ready-resolve"),c=e("pending-reconnect-render"),l=e("render-depth"),u=e("controller"),h=e("initialized"),d=e("controller-key"),f=e("controller-name"),m=e("controller-id"),p=e("controller-operations"),y=e("native-controller"),g=e("cleanup"),b=e("properties"),v=e("property-values"),w=e("pre-init-property-values"),N=e("properties-initialized"),T=e("property-watchers"),S=e("explicitly-set-properties"),E=e("router-context"),A=e("page-transition"),x=e("created-at"),O=e("ready-handlers"),C=e("dispose-handlers"),_=e("reconnect-handlers"),L=e("moved-handlers"),k=e("adopted-handlers"),P=e("observers"),$=e("setting-from-property"),M=e("moved-timers"),I=e("adopted-timers"),D=e("dispatch-timers"),R=e("render-method"),j=e("render-options"),F=e("render-instance"),q=e("render-timers"),B=e("render-callbacks"),V=e("styles-method"),U=e("styles-applied"),z=e("parent-styles-methods"),W=e("context-handler"),H=e("navigation-context-instance"),K=e("registered-elements"),G=e("is-updating"),Q=e("context-register"),J=e("context-unregister"),X=e("context-notify-element"),Y=e("context-timer"),Z=e("context-called"),tt=e("context-update"),et=e("context-methods"),nt=e("watch-methods"),ot=e("observe-methods"),rt=e("on-methods"),st=e("respond-methods"),it=e("ready-methods"),at=e("dispose-methods"),ct=e("reconnect-methods"),lt=e("moved-methods"),ut=e("adopted-methods"),ht=e("controller-abort"),dt=e("controller-attached"),ft=e("property-definers");class mt{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(mt.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${mt.SEPARATOR}" (U+FF0C)`);return t}if("number"==typeof t||"boolean"==typeof t)return String(t);throw new Error("SimpleArray only supports string, number, and boolean types. Got: "+typeof t)}).join(mt.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(mt.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var pt,yt,gt,bt;!function(t){t.SEQUENTIAL="sequential",t.SIMULTANEOUS="simultaneous"}(pt||(pt={}));const vt=Symbol.for("snice:registered-elements-set");let wt=0;class Nt{constructor(t={},e=[],n="",o={},r){if(this[yt]=new WeakMap,this[gt]=new Set,this[bt]=!1,this.id=wt++,this.application=t,this.navigation={placards:e,route:n,params:o},r&&"function"==typeof r.create)this.fetch=r.create(this);else{if("function"!=typeof fetch)throw new Error("No fetch implementation available");this.fetch=fetch.bind(this)}}[(yt=K,gt=vt,bt=G,Q)](t,e){const n=this[K];let o=n.get(t);o||(o=new Set,n.set(t,o)),o.add(e),this[vt].add(t)}[J](t,e){const n=this[K];if(void 0!==e){const o=n.get(t);if(!o)return;if(o.delete(e),o.size>0)return}n.delete(t),this[vt].delete(t)}[tt](t,e,n,o){this.application=t,this.navigation.placards=e,this.navigation.route=n,this.navigation.params=o,this.notify()}update(){this.notify()}notify(){if(this[G])return;this[G]=!0;const t=this[vt],e=this[K];for(const n of t){const t=e.get(n);if(t)for(const e of t)if("function"==typeof n[e])try{n[e](this)}catch(t){console.error(`Error calling @context method ${e}:`,t)}}this[G]=!1}[X](t){const e=this[K].get(t);if(e)for(const n of e)"function"==typeof t[n]&&t[n](this)}}function Tt(t){if(null!=t)return"string"==typeof t?String:"number"==typeof t?Number:"boolean"==typeof t?Boolean:t instanceof Date?Date:"bigint"==typeof t?BigInt:Array.isArray(t)?Array:void 0}function St(t,e,n,o){switch(e.type||Tt(o)){case Boolean:return null!==t&&"false"!==t;case Number:return null!==t?Number(t):null;case String:return t;case Date:return t?new Date(t):null;case BigInt:return t&&t.endsWith("n")?BigInt(t.slice(0,-1)):t?BigInt(t):null;case mt:return mt.parse(t);case Array:try{return t?JSON.parse(t):[]}catch{return[]}case Object:try{return t?JSON.parse(t):{}}catch{return{}}default:return"number"==typeof n&&null!==t?Number(t):t}}function Et(t,e){return t!==e&&(t==t||e==e)}function At(t,e){return("string"==typeof t.attribute?t.attribute:e).toLowerCase()}function xt(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Ot(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ct(t,e={}){const n=String(t??"").trim();if(!n)return!1;const o=e.allowed??["http:","https:","mailto:","tel:"];if(/^[#?/]/.test(n))return!0;try{const t=new URL(n,"http://__snice-base/");return"http://__snice-base"===t.origin||o.includes(t.protocol)}catch{return/^[\w\-./]+$/.test(n)}}function _t(t){const e=String(t).trim(),n=parseFloat(e);let o;return o=isNaN(n)?0:/ms$/i.test(e)?n:/s$/i.test(e)?1e3*n:/m$/i.test(e)?6e4*n:/h$/i.test(e)?36e5*n:n,{milliseconds:()=>o,seconds:()=>o/1e3,minutes:()=>o/6e4}}function Lt(t,e){return t[e]||(t[e]=new Set),t[e]}function kt(t,e){return t[e]||(t[e]={}),t[e]}function Pt(t,e,n,o,r){const s=e[T];if(!s)return;const i=[n],a=e[b]?.get(n),c=a&&"string"==typeof a.attribute?a.attribute:null;c&&c!==n&&i.push(c);for(const e of i)if(s.has(e))for(const i of s.get(e))try{i.method.call(t,o,r,n)}catch(t){console.error(`Error in @watch('${e}') method ${i.methodName}:`,t)}if(s.has("*"))for(const e of s.get("*"))try{e.method.call(t,o,r,n)}catch(t){console.error(`Error in @watch('*') method ${e.methodName}:`,t)}}function $t(t,e){let n=null;return function(...o){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,o),n=null},e)}}function Mt(t,e){let n=0,o=null;return function(...r){const s=Date.now(),i=e-(s-n);if(i<=0)return o&&(clearTimeout(o),o=null),n=s,t.apply(this,r);o||(o=setTimeout(()=>{n=Date.now(),o=null,t.apply(this,r)},i))}}function It(t,e){if(null==e)return t;if("global"===e)return"undefined"!=typeof document?document:null;if("function"==typeof e)try{return e.call(t)||null}catch{return null}return"string"==typeof e?t.closest?.(e)||null:e&&"function"==typeof e.addEventListener?e:null}const Dt=new Map;function Rt(t,e,n){let o,r;return"string"==typeof e?(o=e,r=n):(o=void 0,r=e),function(e,n){const s=n.name;n.addInitializer(function(){const n=this.constructor;if(Object.prototype.hasOwnProperty.call(n,ot)||(n[ot]=new Set),n[ot].has(e))return;if(n[ot].add(e),!Object.prototype.hasOwnProperty.call(n,P)){const t=n[P];n[P]=t?[...t]:[]}const i=Array.isArray(t)?t:[t];for(const t of i){const[i,...a]=t.split(":"),c=a.join(":");n[P].push({type:i,target:c,selector:o,methodName:s,method:e,options:r})}})}}function jt(t,e){const n=t.constructor[P];if(n&&Array.isArray(n)&&0!==n.length){t[g]?t[g].observers||(t[g].observers=[]):t[g]={events:[],channels:[],observers:[]};for(const o of n){const n=o.method.bind(t),r=o.options?.throttle?Mt(n,o.options.throttle):n;switch(o.type){case"intersection":Ft(t,e,o,r);break;case"resize":qt(t,e,o,r);break;case"media":Bt(t,e,o,r);break;case"mutation":Vt(t,e,o,r);break;default:console.warn(`Unknown observer type: ${o.type}`)}}}}function Ft(t,e,n,o){const r={threshold:n.options?.threshold??0,rootMargin:n.options?.rootMargin??"0px",root:n.options?.root??null};if("undefined"==typeof IntersectionObserver)return void console.warn("IntersectionObserver is not available in this environment");const s=new IntersectionObserver(t=>{for(const e of t)try{!1===o(e)&&s&&s.unobserve(e.target)}catch(t){console.error(`Error in intersection observer ${n.methodName}:`,t)}},r),i=n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e];i.forEach(t=>s.observe(t)),t[g].observers.push(()=>{i.forEach(t=>s.unobserve(t)),0===s.takeRecords().length&&s.disconnect()})}function qt(t,e,n,o){const r=n.options?.box||"content-box";if("undefined"==typeof ResizeObserver)return void console.warn("ResizeObserver is not available in this environment");const s=new ResizeObserver(t=>{for(const e of t)try{o(e)}catch(t){console.error(`Error in resize observer ${n.methodName}:`,t)}});(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e]).forEach(t=>{s.observe(t,{box:r})}),t[g].observers.push(()=>{s.disconnect()})}function Bt(t,e,n,o){const r=n.target;if(!r)return void console.warn("Media query observer requires a query string");let s=Dt.get(r);if(!s)try{s=window.matchMedia(r),Dt.set(r,s)}catch(t){return void console.error(`Invalid media query: ${r}`,t)}const i=t=>{try{o(t.matches)}catch(t){console.error(`Error in media query observer ${n.methodName}:`,t)}};i(s);const a=t=>i(t);s.addEventListener?(s.addEventListener("change",a),t[g].observers.push(()=>{s.removeEventListener("change",a)})):(s.addListener(a),t[g].observers.push(()=>{s.removeListener(a)}))}function Vt(t,e,n,r){const s=n.target.split(":"),i=s[0]||"childList",a=s[1],c={};switch(i){case"childList":c.childList=!0;break;case"attributes":c.attributes=!0,a&&(c.attributeFilter=[a]);break;default:return void console.warn(`Unknown mutation type: ${i}`)}n.options?.subtree&&(c.subtree=!0,n.options.maxDepth&&console.warn("maxDepth is set but requires custom implementation"));const l=!(!n.options?.maxDepth||!n.options.subtree),u=new MutationObserver(t=>{try{if(!l)return void r(t);const o=n.options.maxDepth,s=e.shadowRoot||e,i=t.filter(t=>{let e=0,n=t.target;for(;n&&n!==s&&e<o;)n=n.parentNode,e++;return e<o});i.length>0&&r(i)}catch(t){console.error(`Error in mutation observer ${n.methodName}:`,t)}}),h=!0===t[o];(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):h&&e.shadowRoot?[e.shadowRoot]:[e]).forEach(t=>{u.observe(t,c)}),t[g].observers.push(()=>{u.disconnect()})}function Ut(t){if(t[g]?.observers){for(const e of t[g].observers)e();t[g].observers=[]}}function zt(t,e){return function(n,r){let s,i,a=0;const c=[];return async function(...r){const l=async()=>{const s=e?.timeout??12e4,i=e?.discoveryTimeout??50,a=n.apply(this,r),{value:c,done:l}=await a.next();if(l)return c;let u,h;const d=new Promise((t,e)=>{u=t,h=e});let f,m,p;const y=new Promise((e,n)=>{f=e,m=n,p=setTimeout(()=>{n(new Error(`Request "${t}" timed out after ${i}ms - no handler found`))},i)}),g=new CustomEvent(`@request/${t}`,{bubbles:void 0===e?.bubbles||e.bubbles,cancelable:e?.cancelable||!1,composed:!0,detail:{payload:c,discovery:{resolve:()=>{clearTimeout(p),f()},reject:m},data:{resolve:u,reject:h}}});(!0===this[o]&&this.element?this.element:this).dispatchEvent(g);try{await y;const e=setTimeout(()=>{h(new Error(`Request "${t}" timed out after ${s}ms`))},s),n=await d;clearTimeout(e);const{value:o}=await a.next(n);return o}catch(t){const{value:e}=await a.throw(t);return e}};if(e?.debounce)return new Promise((t,n)=>{clearTimeout(s),s=setTimeout(async()=>{try{t(await l())}catch(t){n(t)}},e.debounce)});if(!e?.throttle)return l();const u=Date.now(),h=e.throttle-(u-a);if(h<=0){clearTimeout(i),i=null,a=u;const t=c.splice(0),e=l();return t.length&&e.then(e=>{for(const n of t)n.resolve(e)},e=>{for(const n of t)n.reject(e)}),e}return new Promise(i?(t,e)=>{c.push({resolve:t,reject:e})}:(t,e)=>{c.push({resolve:t,reject:e}),i=setTimeout(async()=>{a=Date.now(),i=null;const t=c.splice(0);try{const e=await l();for(const n of t)n.resolve(e)}catch(e){for(const n of t)n.reject(e)}},h)})}}}function Wt(t,e){return function(n,o){const r=o.name;o.addInitializer(function(){const o=this.constructor;if(Object.prototype.hasOwnProperty.call(o,st)||(o[st]=new Set),!o[st].has(n)){if(o[st].add(n),!Object.prototype.hasOwnProperty.call(o,s)){const t=o[s];o[s]=t?[...t]:[]}o[s].push({channelName:t,methodName:r,method:n,options:e})}})}}function Ht(t,e){const n=t.constructor[s];if(n){t[g]||(t[g]={events:[],channels:[]});for(const o of n){const n=o.method.bind(t),r=`@request/${o.channelName}`;let s,i,a=0;const c=[];let l=null;const u=(t=>o.options?.debounce?(...e)=>new Promise((n,r)=>{clearTimeout(s),s=setTimeout(async()=>{try{n(await t(...e))}catch(t){r(t)}},o.options.debounce)}):o.options?.throttle?(...e)=>{const n=Date.now(),r=o.options.throttle-(n-a);if(r<=0){clearTimeout(i),i=null,a=n;const o=c.splice(0);l=null;const r=t(...e);return o.length&&Promise.resolve(r).then(t=>{for(const e of o)e.resolve(t)},t=>{for(const e of o)e.reject(t)}),r}return l=e,new Promise((n,o)=>{c.push({resolve:n,reject:o}),i||(i=setTimeout(async()=>{a=Date.now(),i=null;const n=c.splice(0),o=l??e;l=null;try{const e=await t(...o);for(const t of n)t.resolve(e)}catch(t){for(const e of n)e.reject(t)}},r))})}:t)(n),h=t=>{const{data:e,discovery:n,payload:r}=t.detail;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.resolve(),Promise.resolve(u(r)).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t),console.error(`Error in response handler ${o.methodName}:`,t)})};e.addEventListener(r,h),t[g].channels.push(()=>{e.removeEventListener(r,h)})}}}function Kt(t){if(t[g]?.channels){for(const e of t[g].channels)e();t[g].channels=[]}}const Gt=Symbol.for("snice:html-result"),Qt=Symbol.for("snice:css-result");function Jt(t,...e){return{_$litType$:Gt,strings:t,values:e}}function Xt(t,...e){let n=t[0];for(let o=0;o<e.length;o++){const r=e[o];n+=(Zt(r)?r.cssText:String(r))+t[o+1]}const o={_$litType$:Qt,cssText:n};if("undefined"!=typeof CSSStyleSheet&&"undefined"!=typeof Document&&"adoptedStyleSheets"in Document.prototype)try{const t=new CSSStyleSheet;t.replaceSync(n),o.styleSheet=t}catch(t){}return o}function Yt(t){return t&&t._$litType$===Gt}function Zt(t){return t&&t._$litType$===Qt}const te=Symbol.for("snice:nothing"),ee=Symbol.for("snice:unsafe-html");function ne(t){return{_$litType$:ee,html:t}}function oe(t){return t&&t._$litType$===ee}const re=`snice$${Math.random().toFixed(9).slice(2)}$`,se="?"+re,ie=`<${se}>`,ae=new RegExp(re,"g"),ce=new WeakMap,le=Symbol("not-committed"),ue=Symbol.for("snice:no-change"),he=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class de{constructor(t,e,n){this.parts=[],this.element=e;const o=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let r=0;const s=[];let i;for(;null!==(i=o.nextNode());)if(i.nodeType===Node.ELEMENT_NODE){const t=i,e=t.tagName.toLowerCase();if("if"===e){const e=t.getAttribute("value");e&&e.includes(re)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-if",index:r++,element:t}));continue}if("case"===e){const e=t.getAttribute("value");e&&e.includes(re)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-case",index:r++,element:t}));continue}if(t.hasAttributes()){const e=t.attributes,o=[];for(let s=0;s<e.length;s++){const i=e[s],a=i.value;if(a.includes(re)){o.push(i);const e=n[r]||i.name,s=a.split(re),c=s.length-1;if(/^@@?|^[.?]/.test(e)){const t=s.some(t=>""!==t);(c>1||t)&&console.warn(`snice: binding "${e}" takes a single expression; static text and extra interpolations are ignored. Use a plain attribute for string interpolation.`)}e.startsWith("@@")||e.startsWith("@")?(this.parts.push({type:"event",index:r,name:e.slice(1),element:t}),r+=c):e.startsWith(".")?(this.parts.push({type:"property",index:r,name:e.slice(1),element:t}),r+=c):e.startsWith("?")?(this.parts.push({type:"boolean-attribute",index:r,name:e.slice(1),element:t}),r+=c):(this.parts.push({type:"attribute",index:r,name:i.name,element:t,attrStrings:s}),r+=c)}}for(const e of o)t.removeAttribute(e.name)}}else if(i.nodeType===Node.COMMENT_NODE){const t=i;if(t.data===se){const e=t.parentNode,n=document.createComment("");e.insertBefore(n,t.nextSibling),this.parts.push({type:"node",index:r++,startNode:t,endNode:n})}}else if(i.nodeType===Node.TEXT_NODE){const t=i,e=t.data;if(e.includes(re)){const n=t.parentNode,o=e.split(ae),i=o.length-1;for(let e=0;e<i;e++){n.insertBefore(document.createTextNode(o[e]),t);const s=document.createComment(""),i=document.createComment("");n.insertBefore(s,t),n.insertBefore(i,t),this.parts.push({type:"node",index:r++,startNode:s,endNode:i})}""!==o[i]?t.data=o[i]:s.push(t)}}for(const t of s)t.parentNode?.removeChild(t)}}class fe{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=ce.get(e);if(n)return n;const o=[],r=[];let s=!1,i=!1,a="",c="";for(let t=0;t<e.length;t++){const n=e[t];if(o.push(n),t<e.length-1){for(let t=0;t<n.length;t++){const e=n[t];if(s){if(i)e===a&&(i=!1,a="");else if(">"===e)s=!1;else if('"'===e||"'"===e)i=!0,a=e;else if("="===e){let e=t-1;for(;e>=0&&/[\w\-\.@\?:\+~]/.test(n[e]);)e--;c=n.substring(e+1,t).trim()}}else"<"===e&&(s=!0)}if(i)r.push(c),o.push(re);else if(s){const t=n.trimEnd();if(t.endsWith("=")){let e=t.length-2;for(;e>=0&&/[\w\-\.@\?\/:\+~]/.test(t[e]);)e--;c=t.substring(e+1,t.length-1).trim(),r.push(c),o.push(re)}else n.match(/<(if|case)\s*$/)?(c="value",r.push("value"),o.push(`value="${re}"`)):(r.push(""),o.push(re))}else r.push(""),o.push(ie)}}const l=o.join(""),u=document.createElement("template");u.innerHTML=l;const h=new de(t,u,r);return ce.set(e,h),h}(t),this.strings=t.strings}isSameTemplate(t){return this.strings===t}renderFragment(){if(!this.fragment){this.fragment=this.template.element.content.cloneNode(!0);const t=document.createTreeWalker(this.template.element.content,NodeFilter.SHOW_ALL),e=document.createTreeWalker(this.fragment,NodeFilter.SHOW_ALL),n=new Map;let o=t.currentNode,r=e.currentNode;for(;o&&r;)n.set(o,r),o=t.nextNode(),r=e.nextNode();for(let t=0;t<this.template.parts.length;t++){const e=this.template.parts[t];let o;switch(e.type){case"node":const t=n.get(e.startNode),r=n.get(e.endNode);o=new pe(t,r);break;case"attribute":const s=n.get(e.element);o=new ye(s,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);o=new ge(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);o=new be(a,e.name);break;case"event":const c=n.get(e.element);o=new ve(c,e.name);break;case"conditional-if":const l=n.get(e.element);o=new xe(l);break;case"conditional-case":const u=n.get(e.element);o=new Oe(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(o),o instanceof xe||o instanceof Oe?this.conditionalParts.push({part:o,index:e.index}):this.regularParts.push({part:o,index:e.index})}}return this.fragment}render(t){const e=this.renderFragment();return this.update(t),e}update(t){for(const{part:e,index:n}of this.conditionalParts)e.commit(t[n]);for(const{part:e,index:n}of this.regularParts)e instanceof ye&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class me{}class pe extends me{constructor(t,e){super(),this._committedValue=le,this.startNode=t,this.endNode=e}commit(t){if(t!==ue)return t===te||null==t||""===t?(this._committedValue!==te&&this._clear(),void(this._committedValue=te)):void(he(t)?t!==this._committedValue&&this._commitText(t):Yt(t)?this._commitTemplateResult(t):oe(t)?this._commitUnsafeHTML(t):void 0===t.nodeType?(t=>Array.isArray(t)||"function"==typeof t?.[Symbol.iterator])(t)?this._commitIterable(t):this._commitText(t):this._commitNode(t))}_commitText(t){if(this._committedValue!==le&&this._committedValue!==te&&he(this._committedValue)&&!Array.isArray(this._committedValue)){const e=this.startNode.nextSibling;if(e&&e.nodeType===Node.TEXT_NODE)return e.data=String(t),void(this._committedValue=t)}this._clear(),this._insertBefore(document.createTextNode(String(t))),this._committedValue=t}_commitTemplateResult(t){const e=this._committedValue;if(e instanceof fe){const n=ce.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new fe(t),o=n.renderFragment();this._insertBefore(o),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof pe||(this._clear(),this._committedValue=[]);const e=this._committedValue;let n=0;for(const o of t){let t;if(n>=e.length){const n=document.createComment(""),o=document.createComment("");this._insertBefore(n),this._insertBefore(o),t=new pe(n,o),e.push(t)}else t=e[n];t.commit(o),n++}if(n<e.length){for(let t=n;t<e.length;t++){const n=e[t];n._clear(),n.startNode.remove(),n.endNode.remove()}e.length=n}}_commitNode(t){this._committedValue!==t&&(this._clear(),this._insertBefore(t),this._committedValue=t)}_commitUnsafeHTML(t){const e=this._committedValue;if(oe(e)&&e.html===t.html)return;this._clear();const n=document.createElement("template");n.innerHTML=t.html,this._insertBefore(n.content),this._committedValue=t}_insertBefore(t){this.endNode.parentNode?.insertBefore(t,this.endNode)}_clear(){const t=this.startNode.parentNode;if(!t)return;let e=this.startNode.nextSibling;for(;e&&e!==this.endNode;){const n=e.nextSibling;t.removeChild(e),e=n}this._committedValue=te}clear(){this._clear()}}class ye extends me{constructor(t,e,n){super(),this._committedValue=le,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill(le),this.strings=n):this._committedValue=le}commit(t,e=0){let n,o=!1;if(void 0===this.strings){if(t===ue)return;if(o=!he(t)||t!==this._committedValue&&t!==ue,!o)return;this._committedValue=t,n=t}else{const r=t,s=this._committedValue;n=this.strings[0];for(let t=0;t<this.strings.length-1;t++){let i=r[e+t];i===ue&&(i=s[t]),o=o||!he(i)||i!==s[t],i===te?n=te:n!==te&&(n=n+(i??"")+this.strings[t+1]),s[t]=i}if(!o)return}this._commitValue(n)}_commitValue(t){t===te||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class ge extends me{constructor(t,e){super(),this._committedValue=le,this.element=t,this.name=e}commit(t){t!==ue&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===te?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=le}}class be extends me{constructor(t,e){super(),this._committedValue=le,this.element=t,this.name=e}commit(t){if(t===ue)return;const e=!!t&&t!==te;e!==this._committedValue&&(this._committedValue=e,e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name))}clear(){this.element.removeAttribute(this.name),this._committedValue=le}}class ve extends me{constructor(t,e){super(),this.listener=null,this.value=void 0,this.keyFilter=null,this.host=null,this.element=t;const n=["keydown","keyup","keypress"].includes(e.split(".")[0].split(":")[0]),o=n?e.indexOf("."):-1,r=n?e.indexOf(":"):-1,s=o>0&&r>0?Math.min(o,r):Math.max(o,r);if(s>0){const t=e.substring(0,s),n=e.substring(s+1);this.eventName=t,this.keyFilter=Te(n)}else this.eventName=e,Ne(e)}commit(t){if(t===ue)return;if(t===te&&(t=null),t===this.value&&null!=t)return;if(this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null),this.value=t,null==t)return;if("function"!=typeof t)return;const e=this.keyFilter;this.listener=n=>{e&&!Ee(n,e)||(this.host||(this.host=this.element.getRootNode().host||null),t.call(this.host||null,n))},this.element.addEventListener(this.eventName,this.listener)}clear(){this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null)}}const we=new Set(["once","prevent","preventdefault","stop","stoppropagation","capture","passive"]);function Ne(t){const e=t.lastIndexOf(".");if(e<0)return;const n=t.slice(e+1).toLowerCase();we.has(n)&&console.warn(`snice: "@${t}" is not a valid modifier — once/preventDefault/stopPropagation/capture are @on() options, not template modifiers. This registers a listener for event "${t}", which never fires.`)}function Te(t){const e=t.startsWith("~");e&&(t=t.substring(1));const n=t.split("+"),o={key:"",anyModifiers:e};for(const t of n){const e=t.toLowerCase();"ctrl"===e||"control"===e?o.ctrl=!0:"alt"===e?o.alt=!0:"shift"===e?o.shift=!0:"meta"===e||"cmd"===e||"command"===e?o.meta=!0:o.key=Se(t)}return o}function Se(t){return{esc:"Escape",escape:"Escape",enter:"Enter",return:"Enter",space:" ",spacebar:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight",delete:"Delete",del:"Delete",backspace:"Backspace",tab:"Tab",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"}[t.toLowerCase()]||t}function Ee(t,e){if(t.key!==e.key)return!1;if(e.anyModifiers)return!0;const n=e.ctrl?t.ctrlKey:!t.ctrlKey,o=e.alt?t.altKey:!t.altKey,r=e.shift?t.shiftKey:!t.shiftKey,s=e.meta?t.metaKey:!t.metaKey;return n&&o&&r&&s}const Ae=Symbol("not-set");class xe extends me{constructor(t){super(),this.value=Ae,this.childFragment=null;const e=t.parentNode;for(this.startNode=document.createComment("if"),this.endNode=document.createComment("/if"),e.insertBefore(this.startNode,t),e.insertBefore(this.endNode,t.nextSibling),this.childFragment=document.createDocumentFragment();t.firstChild;)this.childFragment.appendChild(t.firstChild);e.removeChild(t)}commit(t){const e=Boolean(t);if(this.value!==t)if(this.value=t,e)this.childFragment&&this.childFragment.hasChildNodes()&&this.startNode.parentNode.insertBefore(this.childFragment,this.endNode);else{this.childFragment||(this.childFragment=document.createDocumentFragment());let t=this.startNode.nextSibling;for(;t&&t!==this.endNode;){const e=t.nextSibling;this.childFragment.appendChild(t),t=e}}}clear(){this.childFragment||(this.childFragment=document.createDocumentFragment());let t=this.startNode.nextSibling;for(;t&&t!==this.endNode;){const e=t.nextSibling;this.childFragment.appendChild(t),t=e}}}class Oe extends me{constructor(t){super(),this.value=Ae,this.branches=new Map,this.defaultBranch=null,this.currentKey=null;const e=t.parentNode;this.startNode=document.createComment("case"),this.endNode=document.createComment("/case"),e.insertBefore(this.startNode,t),e.insertBefore(this.endNode,t.nextSibling);for(const e of Array.from(t.children)){const t=e.tagName.toLowerCase();if("when"===t){const t=e.getAttribute("value")||"",n=document.createDocumentFragment();for(;e.firstChild;)n.appendChild(e.firstChild);this.branches.set(t,n)}else if("default"===t)for(this.defaultBranch=document.createDocumentFragment();e.firstChild;)this.defaultBranch.appendChild(e.firstChild)}e.removeChild(t)}commit(t){const e=String(t),n=this.branches.has(e),o=n?e:this.defaultBranch?"__default__":null;if(this.currentKey===o)return void(this.value=t);this.value=t,this._collectCurrent();const r=n?this.branches.get(e):this.defaultBranch;this.currentKey=o,r&&r.hasChildNodes()&&this.startNode.parentNode.insertBefore(r,this.endNode)}_collectCurrent(){if(null===this.currentKey)return;const t="__default__"===this.currentKey?this.defaultBranch:this.branches.get(this.currentKey);if(!t)return;let e=this.startNode.nextSibling;for(;e&&e!==this.endNode;){const n=e.nextSibling;t.appendChild(e),e=n}}clear(){this._collectCurrent(),this.currentKey=null}}const Ce=e("on-handlers");function _e(t,e,n){let o=null,r={};return"string"==typeof e?(o=e,r=n||{}):e&&"object"==typeof e?r=e:null===e&&n&&(r=n),function(e,n){const s=n.name;return n.addInitializer(function(){const n=this.constructor;if(Object.prototype.hasOwnProperty.call(n,rt)||(n[rt]=new Set),n[rt].has(e))return;if(n[rt].add(e),!Object.prototype.hasOwnProperty.call(n,Ce)){const t=n[Ce];n[Ce]=t?[...t]:[]}const i=Array.isArray(t)?t:[t];for(const t of i)n[Ce].push({eventName:t,selector:o,methodName:s,method:e,options:r})}),e}}function Le(t,e){let n=0;return function(...o){const r=Date.now();r-n>=e&&(n=r,t.apply(this,o))}}const ke=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function Pe(t,e){const n=t.constructor[Ce];if(n&&Array.isArray(n)&&0!==n.length){t[g]?t[g].events?t[g].events.length>0&&$e(t):t[g].events=[]:t[g]={events:[],channels:[],observers:[]};for(const o of n){const n=t[o.methodName];let r=n?n.bind(t):o.method.bind(t);const s=o.options||{},i=["keydown","keyup","keypress"].includes(o.eventName.split(".")[0].split(":")[0]),a=i?o.eventName.indexOf("."):-1,c=i?o.eventName.indexOf(":"):-1,l=a>0&&c>0?Math.min(a,c):Math.max(a,c),u=l>0?o.eventName.substring(0,l):o.eventName,h=l>0?o.eventName.substring(l+1):null;l<=0&&Ne(o.eventName),s.debounce&&s.debounce>0?r=$t(r,s.debounce):s.throttle&&s.throttle>0&&(r=Le(r,s.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=Te(h));const f=(t=>d?e=>{Ee(e,d)&&t(e)}:t)(r),m=void 0!==s.scope;let p=null;if(!m||(p=It(e,s.scope),p))if(o.selector){const n=m?p:e.shadowRoot||e,r=t=>{const e=t.target;if(e.matches&&e.matches(o.selector)&&e||e.closest&&e.closest(o.selector)||null){s.preventDefault&&t.preventDefault(),s.stopPropagation&&(t.stopPropagation(),t.stopImmediatePropagation());try{f(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},i=ke.has(u),a={capture:void 0!==s.capture?s.capture:i,once:s.once||!1,passive:s.passive||!1};n.addEventListener(u,r,a),t[g].events.push({target:n,eventName:u,handler:r,options:a})}else{const n=m?null:e.shadowRoot,r=Symbol(),i=t=>{if(!t[r]){t[r]=!0,s.preventDefault&&t.preventDefault(),s.stopPropagation&&t.stopPropagation();try{f(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},a={capture:s.capture||!1,once:s.once||!1,passive:s.passive||!1};if(m){p.addEventListener(u,i,a),t[g].events.push({target:p,eventName:u,handler:i,options:a});continue}n&&(n.addEventListener(u,i,a),t[g].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[g].events.push({target:e,eventName:u,handler:i,options:a})}else console.warn(`[snice/@on] scope did not resolve for "${o.eventName}" on ${o.methodName} — listener skipped.`)}}}function $e(t){if(t[g]?.events){for(const{target:e,eventName:n,handler:o,options:r}of t[g].events)e.removeEventListener(n,o,r);t[g].events=[]}}class Me{constructor(){this.cleanupFns=new Map,this.pendingOperations=new Set}register(t,e){this.cleanupFns.set(t,e)}unregister(t){this.cleanupFns.delete(t)}async cleanup(){await Promise.all(this.pendingOperations);for(const t of this.cleanupFns.values())try{await t()}catch(t){console.error("Error during cleanup:",t)}this.cleanupFns.clear()}async runOperation(t){const e=t(),n=e.then(()=>{},()=>{});this.pendingOperations.add(n);try{const t=await e;return this.pendingOperations.delete(n),t}catch(t){throw this.pendingOperations.delete(n),t}}}function Ie(t){return function(e,o){const r=globalThis.snice?.controllerRegistry;if(!r)throw new Error("Snice global registry not initialized");return r.set(t,e),e.prototype[n]=!0,e}}async function De(e,n){const r=e[d],s=e[f],i=e[y];if(void 0!==i&&i!==n)return;if(s===n&&r)return;r&&await Re(e);const a=globalThis.snice?.controllerRegistry;if(!a)throw new Error("Snice global registry not initialized");const c=a.get(n);if(!c)throw console.error(`Controller "${n}" not found. Available:`,Array.from(a.keys())),new Error(`Controller "${n}" not found in registry`);const l=new c;t.controllerIdCounter+=1;const u=t.controllerIdCounter,h=new Me;l[o]=!0,l[m]=u,l.element=e;const g=e[E];void 0!==g&&(l[E]=g),e[d]=l,e[f]=n,e[p]=h;const b=new AbortController;e[ht]=b;try{await Promise.race([e.ready,new Promise((t,e)=>{const o=()=>e(new Error(`attachController("${n}"): aborted before element was ready (likely detached or never connected)`));if(b.signal.aborted)return o();b.signal.addEventListener("abort",o,{once:!0});const r=setTimeout(()=>e(new Error(`attachController("${n}"): element did not become ready within 30000ms (did you forget to appendChild it?)`)),3e4);b.signal.addEventListener("abort",()=>clearTimeout(r),{once:!0})})])}catch(t){throw e[d]===l&&(delete e[d],delete e[f],delete e[p]),t}finally{e[ht]===b&&delete e[ht]}l[dt]=!0,await h.runOperation(async()=>{await l.attach(e)}),jt(l,e),Ht(l,e),Pe(l,e),e.dispatchEvent(new CustomEvent("controller-attached",{detail:{name:n,controller:l}}))}async function Re(t){const e=t[ht];e&&e.abort();const n=t[d],o=t[f],r=t[p];n&&(delete t[d],delete t[f],delete t[p],n[dt]&&(r?await r.runOperation(async()=>{await n.detach(t)}):await n.detach(t),n.element=null,Ut(n),Kt(n),$e(n),r&&await r.cleanup(),delete n[E],t.dispatchEvent(new CustomEvent("controller-detached",{detail:{name:o,controller:n}}))))}function je(){if(globalThis.sniceNativeControllersInitialized)return;function t(t){if(!(t instanceof HTMLElement))return;if(!t.tagName||t.tagName.includes("-"))return;if(t[r])return;const e=t.getAttribute("controller"),n=t[y];if(e!==n){if(!e)return delete t[y],delete t[f],void Re(t).catch(t=>{console.error("Failed to detach controller from native element:",t)});t[y]=e,t.ready||(t.ready=Promise.resolve()),n&&Re(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),De(t,e).catch(t=>{console.error(`Failed to attach controller "${e}" to native element:`,t)})}}globalThis.sniceNativeControllersInitialized=!0;const e=new MutationObserver(e=>{for(const n of e)"attributes"===n.type&&"controller"===n.attributeName?t(n.target):"childList"===n.type&&n.addedNodes.forEach(e=>{e instanceof HTMLElement&&(t(e),e.querySelectorAll("[controller]").forEach(t))})});function n(){document.querySelectorAll("[controller]").forEach(t),e.observe(document.body,{attributes:!0,attributeFilter:["controller"],childList:!0,subtree:!0})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n(),globalThis.sniceNativeControllerObserver=e}const Fe=e("context-handlers");function qe(t={}){return function(e,n){const o=n.name;return n.addInitializer(function(){const n=this.constructor;if(Object.prototype.hasOwnProperty.call(n,et)||(n[et]=new Set),!n[et].has(e)){if(n[et].add(e),!Object.prototype.hasOwnProperty.call(n,Fe)){const t=n[Fe];n[Fe]=t?[...t]:[]}n[Fe].push({methodName:o,method:e,options:t})}}),e}}function Be(t){const e=t.constructor[Fe];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[W];if(n){t[H]=n;for(const o of e){const{methodName:e,method:r,options:s}=o,i=`__wrapped_${e}`;t[i]=function(n){const o=t[Z]||(t[Z]=new Set);if(s.once&&o.has(e))return;const a=()=>{if(r.call(t,n),s.once){o.add(e);const n=t[H];n&&"function"==typeof n[J]&&n[J](t,i)}},c=t[Y]||(t[Y]={}),l=e;if(s.debounce)return clearTimeout(c[l]?.timeout),void(c[l]={timeout:setTimeout(a,s.debounce)});if(s.throttle){const t=Date.now();return void(t-(c[l]?.lastCall||0)>=s.throttle&&(c[l]={lastCall:t},a()))}a()},"function"==typeof n[Q]&&n[Q](t,i)}}}const Ve=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?We(t,e):(this.pending.add(t),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush())))}flush(){const t=Array.from(this.pending);this.pending.clear(),this.scheduled=!1;for(const e of t){if(!e.isConnected){e[c]=!0;continue}We(e,e[j]||{})}}remove(t){this.pending.delete(t)}};function Ue(t){const e=t[B];if(!e||0===e.length)return;const n=[...e];t[B]=[],n.forEach(t=>t())}const ze=50;function We(t,e,n){const o=t[R];if(!o)return;if(e.once&&t[F])return;const r=t[l]??0;if(r>=ze){const e=t.tagName?t.tagName.toLowerCase():"element";return void console.error(`snice: maximum render depth (${ze}) exceeded for <${e}>. render() is mutating an observed property, causing an infinite render loop.`)}t[l]=r+1;try{const r=void 0!==n?n:o.call(t);if(t.shadowRoot||t.attachShadow({mode:"open"}),!1===e.differential)return"string"!=typeof r?void console.warn("Render method with differential: false must return a string"):(t.shadowRoot.innerHTML=r,void Ue(t));if(!Yt(r))return void console.warn("Render method must return html`` template result");let s=t[F];if(s&&s.isSameTemplate(r.strings))return s.update(r.values),void Ue(t);if(s){const e=t.shadowRoot,n=[];for(const t of Array.from(e.childNodes))1===t.nodeType&&"STYLE"===t.tagName&&t.hasAttribute("data-snice-style")||n.push(t);for(const t of n)t.remove()}s=new fe(r),t[F]=s,t.shadowRoot.appendChild(s.renderFragment()),s.update(r.values),Ue(t)}catch(t){console.error("Error rendering element:",t)}finally{t[l]=r}}function He(t,e=!1){const n=t[j]||{};if(!n.once||!t[F])if(e)We(t,n);else{if(void 0!==n.debounce&&n.debounce>0)return t[q]||(t[q]={}),clearTimeout(t[q].debounce),void(t[q].debounce=setTimeout(()=>{Ve.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[q]||(t[q]={lastThrottle:0});const e=t[q],o=Date.now();if(0===e.lastThrottle||o-e.lastThrottle>=n.throttle)return e.lastThrottle=o,void Ve.schedule(t,n);if(!e.throttleTimer){const r=n.throttle-(o-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),Ve.schedule(t,n)},r)}return}Ve.schedule(t,n)}}function Ke(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[R]=e,this[j]=t}),function(...t){const n=e.apply(this,t);return We(this,{},n),n}}}function Ge(){return function(t,e){return e.addInitializer(function(){this[V]&&!this[z]?this[z]=[this[V]]:this[V]&&this[z]&&this[z].push(this[V]),this[V]=t}),t}}function Qe(t,e){return function(n,o){return function(...r){this[D]||(this[D]=new Map);const s=`${t}_${o.name}`;this[D].has(s)||this[D].set(s,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[D].get(s),a=n.apply(this,r),c=n=>{if(void 0===n&&!1===e?.dispatchOnUndefined)return;const o=new CustomEvent(t,{bubbles:!0,composed:!0,...e,detail:n});if(void 0!==e?.scope){const n=It(this,e.scope);return n?void n.dispatchEvent(o):void console.warn(`[snice/@dispatch] scope did not resolve for "${t}" — event not dispatched.`)}this.dispatchEvent(o)},l=t=>{if(e?.debounce)return clearTimeout(i.debounceTimeout),void(i.debounceTimeout=setTimeout(()=>c(t),e.debounce));if(!e?.throttle)return void c(t);const n=Date.now(),o=e.throttle-(n-i.throttleLastCall);if(o<=0)return clearTimeout(i.throttleTimeout),i.throttleLastCall=n,void c(t);i.latestDetail=t,i.throttleTimeout||(i.throttleTimeout=setTimeout(()=>{i.throttleLastCall=Date.now(),i.throttleTimeout=null;const t=i.latestDetail;i.latestDetail=void 0,c(t)},o))};return a instanceof Promise?a.then(t=>(l(t),t)):(l(a),a)}}}const Je=e("debounce-timers"),Xe=e("throttle-timers"),Ye=e("once-called"),Ze=e("memoize-cache");function tn(t=300,e={}){const{leading:n=!1,trailing:o=!0,maxWait:r}=e;return function(e,s){const i=s.name;return function(...s){this[Je]||(this[Je]={});const a=this[Je],c=i;a[c]&&clearTimeout(a[c].timeout);const l=Date.now(),u=!a[c],h=u?l:a[c].startTime,d=void 0!==r&&l-h>=r;if(n&&u){const t=e.apply(this,s);return a[c]={timeout:null,startTime:h,lastArgs:s},t}const f=setTimeout(()=>{(o||d)&&e.apply(this,a[c].lastArgs),delete a[c]},d?0:t);a[c]={timeout:f,startTime:h,lastArgs:s}}}}function en(t=300,e={}){const{leading:n=!0,trailing:o=!0}=e;return function(e,r){const s=r.name;return function(...r){this[Xe]||(this[Xe]={});const i=this[Xe],a=s,c=Date.now();if(!i[a])return n&&e.apply(this,r),i[a]={lastInvoke:c,timeout:null,lastArgs:r},void(o&&!n&&(i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),delete i[a]},t)));const l=c-i[a].lastInvoke;if(i[a].lastArgs=r,i[a].timeout&&clearTimeout(i[a].timeout),l>=t)return e.apply(this,r),void(i[a].lastInvoke=c);if(o){const n=t-l;i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),i[a].lastInvoke=Date.now(),i[a].timeout=null},n)}}}}function nn(t=!0){let e,n=!1;return function(o,r){const s=r.name;return function(...r){return t?(this[Ye]||(this[Ye]={}),this[Ye][s]||(this[Ye][s]={called:!0,result:o.apply(this,r)}),this[Ye][s].result):(n||(n=!0,e=o.apply(this,r)),e)}}}function on(t={}){const{keyGenerator:e=(...t)=>JSON.stringify(t),maxSize:n=100,ttl:o}=t;return function(t,r){const s=r.name;return function(...r){this[Ze]||(this[Ze]={}),this[Ze][s]||(this[Ze][s]=new Map);const i=this[Ze][s],a=e(...r);if(i.has(a)){const t=i.get(a);if(!(void 0!==o&&Date.now()-t.timestamp>o))return t.value;i.delete(a)}const c=t.apply(this,r);if(i.set(a,{value:c,timestamp:Date.now()}),i.size>n){const t=i.keys().next().value;i.delete(t)}return c}}}function rn(t){if(t[Je]){for(const e in t[Je])t[Je][e]?.timeout&&clearTimeout(t[Je][e].timeout);t[Je]={}}}function sn(t){if(t[Xe]){for(const e in t[Xe])t[Xe][e]?.timeout&&clearTimeout(t[Xe][e].timeout);t[Xe]={}}}function an(t,e){t[Ze]&&(e?delete t[Ze][e]:t[Ze]={})}function cn(t,e){t[Ye]&&(e?delete t[Ye][e]:t[Ye]={})}function ln(t){t.prototype[r]=!0;const e=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback,o=t.prototype.attributeChangedCallback,s=t.observedAttributes||[];s.includes("controller")||s.push("controller");const l=t[b];if(l)for(const[t,e]of l){if(!1===e.attribute)continue;const n=At(e,t);s.includes(n)||s.push(n)}Object.defineProperty(t,"observedAttributes",{get:()=>s,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get(){return this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[i]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[u]},set(t){const e=this[u];this[u]=t,t!==e&&(t?De(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):e&&Re(this).catch(t=>{console.error("Failed to detach controller:",t)}))},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[h]){Pe(this,this),Ht(this,this),Be(this);try{jt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName} on reconnection:`,t)}e&&e.call(this);const n=t[_];if(n)for(const t of n)try{const e=t.method.call(this);e&&"function"==typeof e.then&&e.catch(e=>{console.error(`Error in @reconnect handler ${t.methodName}:`,e)})}catch(e){console.error(`Error in @reconnect handler ${t.methodName}:`,e)}return void(this[R]&&this[c]&&(this[c]=!1,He(this)))}this[N]=!0;const n=t[b];if(n)for(const[t,e]of n){if(!1===e.attribute)continue;const n=At(e,t);if(!this.hasAttribute(n))continue;const o=this.getAttribute(n);Lt(this,S).add(t),e.type===Boolean&&""===o&&this.setAttribute(n,"true"),this[t]=St(o,e)}if(this[w]){for(const[t,e]of Array.from(this[w].entries())){const o=n?.get(t),r=At(o||{},t);this[w].delete(t),this.hasAttribute(r)||(this[t]=e)}delete this[w]}if(this.hasAttribute("controller")&&!this[u]){const t=this.getAttribute("controller");t&&(this.controller=t)}!function(t){const e=t[V];if(e&&!t[U]){t[U]=!0;try{const n=[],o=t[z];if(o)for(const e of o){const o=e.call(t);Zt(o)&&n.push(o)}const r=e.call(t);if(!Zt(r))return void console.warn("Styles method must return css`` template result");if(n.push(r),t.shadowRoot||t.attachShadow({mode:"open"}),!t.shadowRoot)return;if(n.every(t=>!!t.styleSheet)&&"adoptedStyleSheets"in t.shadowRoot)return void(t.shadowRoot.adoptedStyleSheets=n.map(t=>t.styleSheet));for(const e of n){const n=document.createElement("style");n.setAttribute("data-snice-style",""),n.textContent=e.cssText,t.shadowRoot.appendChild(n)}}catch(t){console.error("Error applying styles:",t)}}}(this),Pe(this,this),Ht(this,this),Be(this),this[h]=!0,function(t,e){const n=e[T],o=e[b];if(n&&o)for(const[e,r]of o){const o=[e],s=r&&"string"==typeof r.attribute?r.attribute:null;s&&s!==e&&o.push(s),o.push("*");for(const r of o)if(n.has(r))for(const o of n.get(r))if(o.immediate)try{o.method.call(t,void 0,t[e],e)}catch(t){console.error(`Error in @watch('${r}') method ${o.methodName}:`,t)}}}(this,t),e&&e.call(this);const o=t[O];if(await new Promise(t=>queueMicrotask(t)),this.isConnected){this[R]&&He(this,!0);try{jt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}if(await new Promise(t=>queueMicrotask(t)),this.isConnected){if(o)for(const t of o)try{await t.method.call(this)}catch(e){console.error(`Error in @ready handler ${t.methodName}:`,e)}this[a]&&(this[a](),this[a]=null)}else this[a]&&(this[a](),this[a]=null)}else this[a]&&(this[a](),this[a]=null)},t.prototype.disconnectedCallback=async function(){const e=t[C];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @dispose handler ${t.methodName}:`,e)}n&&n.call(this),this[u]&&Re(this).catch(t=>{console.error("Failed to detach controller:",t)}),$e(this),Kt(this),function(t){const e=t.constructor[Fe];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[Y];if(n&&"object"==typeof n){for(const t of Object.keys(n))n[t]?.timeout&&clearTimeout(n[t].timeout);delete t[Y]}for(const n of e)delete t[`__wrapped_${n.methodName}`];const o=t[H];o&&"function"==typeof o[J]&&o[J](t),delete t[H],delete t[Z]}(this),Ut(this),rn(this),sn(this),function(t){const e=t[q];if(!e)return!1;let n=!1;return e.debounce&&(clearTimeout(e.debounce),e.debounce=null,n=!0),e.throttleTimer&&(clearTimeout(e.throttleTimer),e.throttleTimer=null,n=!0),n}(this)&&(this[c]=!0),function(t){const e=t[D];if(e)for(const t of e.values())t.debounceTimeout&&clearTimeout(t.debounceTimeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.debounceTimeout=null,t.throttleTimeout=null,t.throttleLastCall=0,t.latestDetail=void 0}(this),En(this,M),En(this,I)},t.prototype.attributeChangedCallback=function(e,n,r){if(o?.call(this,e,n,r),"controller"===e)return void(this.controller=r);const s=t[b];if(s)for(const[n,o]of s){if(At(o,n).toLowerCase()!==e.toLowerCase())continue;const s=this[v]?.[n],i=null===r?this[n]:St(r,o,s,void 0);if(!(o?.hasChanged?o.hasChanged(i,s):Et(i,s)))break;Lt(this,S).add(n),kt(this,v)[n]=i,this[$]?.has(e.toLowerCase())||(this[h]&&Pt(this,t,n,s,i),this[R]&&this[h]&&He(this));break}},t.prototype.connectedMoveCallback=async function(){const e=t[L];if(e)for(const t of e)try{await this[t.methodName]()}catch(e){console.error(`Error in @moved handler ${t.methodName}:`,e)}},t.prototype.adoptedCallback=async function(){const e=t[k];if(e)for(const t of e)try{await this[t.methodName]()}catch(e){console.error(`Error in @adopted handler ${t.methodName}:`,e)}}}function un(t,e,n,o){if(function(t){let e=Object.getPrototypeOf(t);const n=[];for(;e&&e!==HTMLElement&&e!==Function.prototype;)n.push(e),e=Object.getPrototypeOf(e);n.reverse();for(const e of n){if(e[b]){t[b]||(t[b]=new Map);for(const[n,o]of e[b])t[b].has(n)||t[b].set(n,o)}e.formAssociated&&!t.formAssociated&&(t.formAssociated=!0)}}(e),n.metadata&&n.metadata[b]){e[b]||(e[b]=new Map);for(const[t,o]of n.metadata[b])e[b].set(t,o)}else if(fn.length>0){e[b]||(e[b]=new Map);const t=fn.pop();for(const[n,o]of t)e[b].set(n,o)}return o?.formAssociated&&(e.formAssociated=!0),ln(e),customElements.get(t)?(globalThis.SNICE_DEBUG&&console.warn(`[snice] "${t}" is already registered. Skipping.`),e):(customElements.define(t,e),e)}function hn(t,e){return function(n,o){return un(t,n,o,e)}}function dn(t){return function(e,n){return un(t,e,n)}}const fn=[];function mn(t){return function(e,n){const o=n.name;return n.metadata?(n.metadata[b]||(n.metadata[b]=new Map),n.metadata[b].set(o,t||{})):(0===fn.length&&fn.push(new Map),fn[fn.length-1].set(o,t||{})),function(e){const n=this.constructor;n[b]||(n[b]=new Map);const r={...t};r.type||void 0===e||(r.type=Tt(e)),n[b].set(o,r);const s=this.constructor.prototype;let i=s[ft];i&&Object.prototype.hasOwnProperty.call(s,ft)||(i=new Map(i),s[ft]=i);const a=i.get(o);if(!a||a!==t){i.set(o,t);const n={get(){if(!1===r?.attribute)return this[v]&&o in this[v]?this[v][o]:this[w]?.has(o)?this[w].get(o):e;const t=At(r||{},o),n=this.getAttribute?.(t);if(null!==n)return St(n,r||{},void 0,e);return((r?.type||Tt(e))!==Boolean||!this[S]?.has(o))&&(this[w]?.has(o)?this[w].get(o):e)},set(t){const n=this[o];if(r?.hasChanged?r.hasChanged(t,n):Et(t,n)){if(!this[N])return this[w]||(this[w]=new Map),void this[w].set(o,t);if(!1===r?.attribute)kt(this,v)[o]=t;else{const n=At(r,o),s=function(t,e,n){if(null==t||!1===t||e?.type===mt&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||Tt(n)){case Boolean:return"true";case Date:return t instanceof Date?t.toISOString():String(t);case BigInt:return"bigint"==typeof t?t.toString()+"n":String(t);case mt:return Array.isArray(t)?mt.serialize(t):String(t);case Array:return Array.isArray(t)?JSON.stringify(t):String(t);case Object:return"object"==typeof t&&null!==t?JSON.stringify(t):String(t);default:return String(t)}}(t,r,e);Lt(this,S).add(o);const i=n.toLowerCase();Lt(this,$).add(i),null===s?this.removeAttribute?.(n):this.setAttribute?.(n,s),this[$].delete(i)}this[h]&&Pt(this,this.constructor,o,n,t),this[R]&&this[h]&&He(this)}},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,o,n)}return kt(this,v)[o]=e,e}}}function pn(t){return!0===t[o]&&t.element?t.element:t}function yn(t,e={}){return function(n,o){const{light:r=!1,shadow:s=!0}=e,i=o.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=pn(this);let n=null;return s&&e.shadowRoot&&(n=e.shadowRoot.querySelector(t)),!n&&r&&(n=e.querySelector(t)),n||null},set(){},configurable:!0,enumerable:!0}),e}}}function gn(t,e={}){return function(n,o){const{light:r=!1,shadow:s=!0}=e,i=o.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=pn(this),n=[];return s&&e.shadowRoot&&n.push(...e.shadowRoot.querySelectorAll(t)),r&&n.push(...e.querySelectorAll(t)),n},set(){},configurable:!0,enumerable:!0}),e}}}function bn(...t){const e=t.filter(t=>"string"==typeof t),n=t.find(t=>"object"==typeof t&&null!==t),o=!1!==n?.immediate;return function(t,n){const r=n.name;n.addInitializer(function(){const n=this.constructor;Object.prototype.hasOwnProperty.call(n,nt)||(n[nt]=new Map);let s=n[nt].get(t);if(s||(s=new Set,n[nt].set(t,s)),!Object.prototype.hasOwnProperty.call(n,T)){const t=n[T],e=new Map;if(t)for(const[n,o]of t)e.set(n,[...o]);n[T]=e}for(const i of e)s.has(i)||(s.add(i),n[T].has(i)||n[T].set(i,[]),n[T].get(i).push({methodName:r,method:t,immediate:o}))})}}function vn(){return function(t,e){const n=e.name;return function(t){if(!Object.hasOwn(this.constructor.prototype,n)){const t={get(){if(void 0!==this[E])return this[E];let t=!0===this[o]&&this.element?this.element:this;if(!t||!t.dispatchEvent)return;t.getRootNode&&t.getRootNode()instanceof ShadowRoot&&(t=t.getRootNode().host);const e={target:this};return t.dispatchEvent(new CustomEvent("@context/request",{bubbles:!0,cancelable:!0,detail:e})),void 0!==e.context?(this[E]=e.context,e.context):void 0},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,n,t)}return t}}}function wn(t,e,n,o,r){const s=o.name;o.addInitializer(function(){const o=this.constructor;if(Object.prototype.hasOwnProperty.call(o,e)||(o[e]=new Set),!o[e].has(n)){if(o[e].add(n),!Object.prototype.hasOwnProperty.call(o,t)){const e=o[t];o[t]=e?[...e]:[]}o[t].push({methodName:s,method:n,...r})}})}function Nn(){return function(t,e){wn(O,it,t,e)}}function Tn(){return function(t,e){wn(C,at,t,e)}}function Sn(){return function(t,e){wn(_,ct,t,e)}}function En(t,e){const n=t[e];if(n)for(const t of n.values())t.debounceTimer&&clearTimeout(t.debounceTimer),t.throttleTimer&&clearTimeout(t.throttleTimer),t.debounceTimer=null,t.throttleTimer=null,t.lastThrottleCall=0}function An(t,e,n){return function(o={}){return function(r,s){wn(t,n,r,s,{options:o});const i=s.name;return function(...t){this[e]||(this[e]=new Map),this[e].has(i)||this[e].set(i,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const n=this[e].get(i),s=(...t)=>r.apply(this,t),a=(...t)=>{try{const e=r.apply(this,t);e&&"function"==typeof e.then&&e.catch(t=>console.error(`Error in deferred lifecycle handler ${i}:`,t))}catch(t){console.error(`Error in deferred lifecycle handler ${i}:`,t)}};if(o.debounce>0)return clearTimeout(n.debounceTimer),void(n.debounceTimer=setTimeout(()=>a(...t),o.debounce));if(o.throttle>0){const e=Date.now();if(0===n.lastThrottleCall||e-n.lastThrottleCall>=o.throttle)return n.lastThrottleCall=e,s(...t);if(!n.throttleTimer){const r=o.throttle-(e-n.lastThrottleCall);n.throttleTimer=setTimeout(()=>{n.throttleTimer=null,n.lastThrottleCall=Date.now(),a(...t)},r)}return}return s(...t)}}}}const xn=An(L,M,lt),On=An(k,I,ut);
|
|
16
16
|
/*!
|
|
17
17
|
* pica-route v1.1.2
|
|
18
18
|
* A pure URL pattern matching library compatible with route-parser API
|
|
19
19
|
* (c) 2024
|
|
20
20
|
* Released under the MIT License.
|
|
21
21
|
*/
|
|
22
|
-
class gn{constructor(t){this.parsed=this.parsePattern(t)}get spec(){return this.parsed.template}parsePattern(t){let e=t,n="",o=!1;const r=t.indexOf("?");return-1!==r&&(e=t.slice(0,r),n=t.slice(r+1),e.endsWith("(")&&n.endsWith(")")&&(o=!0,e=e.slice(0,-1),n=n.slice(0,-1))),{pathSegments:this.parseSegments(e),querySegments:n?this.parseQuerySegments(n):[],queryOptional:o,template:t}}parseSegments(t){const e=[];let n=0;for(;n<t.length;){switch(t[n]){case"(":const{segments:o,endIndex:r}=this.parseOptionalGroup(t,n);e.push({type:"optional",segments:o}),n=r+1;break;case":":const{name:s,endIndex:i}=this.parseIdentifier(t,n+1);e.push({type:"param",name:s}),n=i;break;case"*":const{name:a,endIndex:c}=this.parseIdentifier(t,n+1);e.push({type:"splat",name:a}),n=c;break;default:const{value:l,endIndex:u}=this.parseLiteral(t,n);l&&e.push({type:"literal",value:l}),n=u}}return e}parseOptionalGroup(t,e){let n=1,o=e+1;for(;o<t.length&&n>0;)"("===t[o]&&n++,")"===t[o]&&n--,o++;const r=t.slice(e+1,o-1);return{segments:this.parseSegments(r),endIndex:o-1}}parseIdentifier(t,e){let n=e;for(;n<t.length&&/[\w-]/.test(t[n]);)n++;return{name:t.slice(e,n),endIndex:n}}parseLiteral(t,e){let n=e;for(;n<t.length&&!"(:*(".includes(t[n]);)n++;return{value:t.slice(e,n),endIndex:n}}parseQuerySegments(t){let e=t;e.startsWith("(")&&e.endsWith(")")&&(e=e.slice(1,-1));const n=[];let o=0;for(;o<e.length;)if(":"===e[o]){const{name:t,endIndex:r}=this.parseIdentifier(e,o+1);n.push({type:"param",name:t}),o=r}else{const{value:t,endIndex:r}=this.parseQueryLiteral(e,o);t&&n.push({type:"literal",value:t}),o=r}return n}parseQueryLiteral(t,e){let n=e;for(;n<t.length&&":"!==t[n];)n++;return{value:t.slice(e,n),endIndex:n}}getAllParamNames(){const t=new Set,e=n=>{for(const o of n)switch(o.type){case"param":case"splat":t.add(o.name);break;case"optional":e(o.segments)}};return e(this.parsed.pathSegments),e(this.parsed.querySegments),Array.from(t)}canMatchRemainingSegments(t,e,n){let o=e;for(const e of n)if("literal"===e.type){const n=t.indexOf(e.value,o);if(-1===n)return!1;o=n+e.value.length}return!0}match(t){const[e,n]=t.split("?"),o=this.matchPath(e,this.parsed.pathSegments);if(!1===o)return!1;const r=this.matchQuery(n||"",this.parsed.querySegments);if(!1===r)return!1;const s=this.getAllParamNames(),i={};for(const t of s)i[t]=void 0;return Object.assign(i,o,r),i}matchPath(t,e){const n={};let o=0;for(let r=0;r<e.length;r++){const s=e[r],i=e.slice(r+1),a=this.matchSegment(t,o,s,i);if(!1===a)return!1;Object.assign(n,a.params),o=a.nextIndex}return!(o<t.length)&&n}matchSegment(t,e,n,o=[]){switch(n.type){case"literal":return t.slice(e,e+n.value.length)===n.value&&{params:{},nextIndex:e+n.value.length};case"param":{let r=e;const s=o[0];let i,a=["/","?"];if(s&&"literal"===s.type){const n=s.value,o=t.indexOf(n,e);if(-1===o)return!1;r=o}else for(;r<t.length&&!a.includes(t[r]);)r++;if(r===e)return!1;try{i=decodeURIComponent(t.slice(e,r))}catch(n){i=t.slice(e,r)}return!(r<t.length&&"?"===t[r]&&o.length>0)&&{params:{[n.name]:i},nextIndex:r}}case"splat":{let r=t.length;const s=o[0];if(s)switch(s.type){case"literal":if("."===s.value){const n=t.indexOf(".",e);-1!==n&&(r=n)}else{const n=t.lastIndexOf(s.value);-1!==n&&n>=e&&(r=n)}break;case"param":let n=-1;for(let o=t.length-1;o>=e;o--)if("/"===t[o]){n=o;break}-1!==n&&(r=n);break;case"splat":let o=-1;for(let n=t.length-1;n>e;n--)if("/"===t[n]){o=n+1;break}if(-1!==o)r=o;else{const n=t.slice(e).split("/").filter(t=>t);r=n.length>1?e+n.slice(0,-1).join("/").length+1:e}break;case"optional":const i=t=>{for(const e of t){if("literal"===e.type)return e.value;if("optional"===e.type){const t=i(e.segments);if(t)return t}}return null},a=i(s.segments);if(a){const n=t.lastIndexOf(a);-1!==n&&n>=e&&(r=n)}}const i=t.indexOf("?",e);let a;-1!==i&&i<r&&(r=i);try{a=decodeURIComponent(t.slice(e,r))}catch(n){a=t.slice(e,r)}return{params:{[n.name]:a},nextIndex:r}}case"optional":{let r=e,s={},i=!0;for(let e=0;e<n.segments.length;e++){const o=n.segments[e],a=n.segments.slice(e+1),c=this.matchSegment(t,r,o,a);if(!1===c){i=!1;break}Object.assign(s,c.params),r=c.nextIndex}if(i){if(this.canMatchRemainingSegments(t,r,o))return{params:s,nextIndex:r}}return{params:{},nextIndex:e}}default:return!1}}findNextLiteral(t){for(const e of t){if("literal"===e.type)return e;if("optional"===e.type){const t=this.findNextLiteral(e.segments);if(t)return t}}return null}matchQuery(t,e){if(0===e.length)return{};const n={};let o=0;for(const r of e)switch(r.type){case"literal":if(t.slice(o,o+r.value.length)!==r.value)return!1;o+=r.value.length;break;case"param":{let e,s=o;for(;s<t.length&&"&"!==t[s];)s++;if(s===o)return!1;try{e=decodeURIComponent(t.slice(o,s))}catch(n){e=t.slice(o,s)}n[r.name]=e,o=s;break}}return n}reverse(t={}){const e=this.reverseSegments(this.parsed.pathSegments,t);if(!1===e)return!1;let n=e;if(this.parsed.querySegments.length>0){const e=this.reverseSegments(this.parsed.querySegments,t);if(!this.parsed.queryOptional&&!1===e)return!1;e&&""!==e&&(n+="?"+e)}return n}reverseSegments(t,e,n=!1){let o="";for(let r=0;r<t.length;r++){const s=t[r],i=t.slice(r+1);switch(s.type){case"literal":o+=s.value;break;case"param":case"splat":if(!(s.name in e))return!1;o+=String(e[s.name]);break;case"optional":if(this.hasAllParams(s.segments,e,n)||this.hasLaterOptionalGroupNeedingParams(i,e,s.segments)){const t=this.reverseSegments(s.segments,e,!0);if(!1===t)return!1;o+=t}}}return o}hasLaterOptionalGroupNeedingParams(t,e,n){for(const o of t)if("optional"===o.type&&this.hasAnyParamInSegments(o.segments,e))return this.hasOnlyLiteralsAndOptionals(n);return!1}hasOnlyLiteralsAndOptionals(t){for(const e of t)if("param"===e.type||"splat"===e.type)return!1;return!0}hasAllParams(t,e,n=!1){let o=!1,r=!1,s=!1,i=!0;for(const n of t)switch(n.type){case"param":case"splat":i=!1,n.name in e&&void 0!==e[n.name]?o=!0:s=!0}const a=n||o&&!s;for(const n of t)if("optional"===n.type){this.hasAllParams(n.segments,e,a)&&(r=!0)}return!(!o||s)||(!(!r||s)||!(!i||!n))}hasOnlyOptionalMissingParams(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(!(n.name in e))return!1}return!0}hasAnyParamInSegments(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(n.name in e)return!0;break;case"optional":if(this.hasAnyParamInSegments(n.segments,e))return!0}return!1}}function bn(t){const e={};return t.split(";").forEach(t=>{const n=t.indexOf(":");if(-1===n)return;const o=t.slice(0,n).trim(),r=t.slice(n+1).trim();o&&r&&(e[o]=r)}),e}function vn(t,e,n,o){if(t.style.position="absolute",t.style.width="100%",e)return t.style.height="100%",void(t.style.transition=`opacity ${n}ms ease-in-out`);t.style.top="0",t.style.left="0",t.style.transition=`${o} ${n}ms ease-in-out`}var wn;function Nn(t){const e=t.window??window,n=t.document??document,o=[];let r,s,i,a=!1,c=[],l=null,u=null;const h=t.context||{},d=new bt(h,[],"",{},t.fetcher);function m(t){if(!l||!u)return null;const e=t.querySelectorAll(l);for(const t of e){if(t[E]===u)return t}return null}function f(t,e,n,c,l,u){switch(o.push({route:new gn(t),tag:e,transition:n,guards:c,layout:l,placard:u}),a=!1,t){case"/404":r=e;break;case"/403":s=e;break;case"/":i=e}}function p(){const t=new Set;c=o.filter(t=>t.placard).map(t=>{const e=t.placard;return"function"==typeof e?e(h):e}).filter(e=>!t.has(e.name)&&(t.add(e.name),!0))}function g(t,e,n){d[Y](h,c,e,n)}function b(){switch(t.type){case"hash":return e.location.hash.slice(1);case"pushstate":return e.location.pathname}}function v(t){let e;if(s)e=n.createElement(s),e[S]=h;else{const t=n.createElement("div");t.className="default-403",t.innerHTML="<h1>403</h1><p>Unauthorized</p>",e=t}t.innerHTML="",t.appendChild(e),l=null,u=null}async function w(t,e,o){if(!!!t)return!0;const r=Array.isArray(t)?t:[t];let s=null,i=null;i=setTimeout(()=>{s=function(){const t=n.createElement("div");return t.setAttribute("data-snice-loading",""),t.innerHTML='\n <style>@keyframes snice-spin{to{transform:rotate(360deg)}}</style>\n <div style="display:flex;align-items:center;justify-content:center;height:100%;min-height:200px">\n <div style="width:32px;height:32px;border:3px solid rgba(128,128,128,0.3);border-top-color:rgba(128,128,128,0.8);border-radius:50%;animation:snice-spin 0.6s linear infinite"></div>\n </div>',t}(),o.appendChild(s)},50);try{for(const t of r){if(!await t(h,e))return v(o),!1}return!0}finally{i&&clearTimeout(i),s&&s.remove()}}async function N(t,e,n,o,r,s,i,a){const l=o||m(t);if(!l)return;!function(t,e,n){"function"==typeof t.update&&t.update(h,c,e,n)}(l,s,i);const u=l.querySelector('[slot="page"]');if(!(!n||!u)){if(e.setAttribute("slot","page"),await C(l,u,e,n),a&&a())return;return void(r&&(t.innerHTML="",t.appendChild(l)))}if(a&&a())return;l.querySelectorAll('[slot="page"]').forEach(t=>t.remove()),e.setAttribute("slot","page"),l.appendChild(e),r&&(t.innerHTML="",t.appendChild(l))}async function A(e,o,r,s,i,a,c){const d=!1===(f=s)?null:f||(t.layout?t.layout:null);var f;const{element:p,needsNewLayout:y}=function(t){if(t===l)return{element:null,needsNewLayout:!1};if(l=t,!!t){const e=Date.now();u=e;const o=n.createElement(t);return o[S]=h,o[E]=e,{element:o,needsNewLayout:!0}}return u=null,{element:null,needsNewLayout:!0}}(d),b=r||t.transition;if(null!==p||null!==m(e)){if(await N(e,o,b,p,y,i,a,c),c&&c())return;g(0,i,a)}else await async function(t,e,n,o){const r=t.children[0];n&&r?await C(t,r,e,n):o&&o()||(t.innerHTML="",t.appendChild(e))}(e,o,b,c),c&&c()||g(0,i,a)}let O=0;async function x(s){const a=n.querySelector(t.target);if(!a)throw new Error(`Target element not found: ${t.target}`);const c=++O,l=()=>c!==O;p(),e.scrollTo(0,0);if((""===s?.trim()||"/"===s)&&!!i){const t=o.find(t=>t.route.match("/"));if(!await w(t?.guards,{},a))return;if(l())return;const{element:r,transition:c,layout:u}=function(){const t=n.createElement(i);t[S]=h;const r=e.customElements.get(i),s=r?.[T],a=o.find(t=>t.route.match("/"));return{element:t,transition:s,layout:a?.layout}}();return void await A(a,r,c,u,s,{},l)}if(!s)return;const u=await async function(t,e){for(const r of o){const o=r.route.match(t);if(!1===o)continue;if(!await w(r.guards,o,e))return{result:wn.GUARDS_FAILED};const s=n.createElement(r.tag);s[S]=h,s[U]=d;const i=o;return Object.keys(i).forEach(t=>s.setAttribute(t,i[t])),{result:wn.SUCCESS,element:s,transition:r.transition,layout:r.layout,routeParams:i}}return{result:wn.NOT_FOUND}}(s,a);if(l())return;if(u.result===wn.GUARDS_FAILED)return;if(u.result===wn.SUCCESS){const{element:t,transition:e,layout:n,routeParams:o={}}=u;return void await A(a,t,e,n,s,o,l)}const{element:m,transition:f,layout:y}=function(){if(r){const t=n.createElement(r);t[S]=h;const o=e.customElements.get(r),s=o?.[T];return{element:t,transition:s,layout:void 0}}const t=n.createElement("div");return t.className="default-404",t.innerHTML="<h1>404</h1><p>Page not found</p>",{element:t,transition:void 0,layout:void 0}}();await A(a,m,f,y,s,{})}async function C(t,e,n,o,r=O){return async function(t,e,n,o={},r=()=>!1){const s=o.outDuration||300,i=o.inDuration||300,a=o.mode||"sequential",c=o.out?bn(o.out):{opacity:"0"},l={opacity:"0"},u=o.in?bn(o.in):{opacity:"1"},h=t.style,d=t.tagName.includes("-")&&t.shadowRoot,m=Symbol.for("snice:transition-original-position"),f=Symbol.for("snice:transition-count"),p=t;d||(m in p||(p[m]=h.position,p[f]=0),p[f]++,h.position="relative");const y=()=>{d||(p[f]--,p[f]<=0&&(h.position=p[m],delete p[m],delete p[f]))},g=e.hasAttribute("slot")||n.hasAttribute("slot");switch(vn(e,g,s,"all"),vn(n,g,i,"all"),Object.assign(n.style,l),t.appendChild(n),n.offsetHeight,a){case dt.SIMULTANEOUS:Object.assign(e.style,c),Object.assign(n.style,u),await new Promise(t=>setTimeout(t,Math.max(s,i)));break;case dt.SEQUENTIAL:if(Object.assign(e.style,c),await new Promise(t=>setTimeout(t,s)),r())return n.parentNode===t&&n.remove(),void y();Object.assign(n.style,u),await new Promise(t=>setTimeout(t,i))}if(r())return n.parentNode===t&&n.remove(),void y();e.remove(),function(t,e){t.style.position="",t.style.width="",t.style.transition="",e?t.style.height="":(t.style.top="",t.style.left="")}(n,g),Object.keys({...l,...u}).forEach(t=>{n.style[t]=""}),y()}(t,e,n,o,()=>r!==O)}return{page:function(t){return function(n,o){if(o?.metadata&&o.metadata[y]){n[y]||(n[y]=new Map);for(const[t,e]of o.metadata[y])n[y].set(t,e)}Ye(n),n[T]=t.transition;const r=n.prototype.connectedCallback;n.prototype.connectedCallback=function(){this[U]=d,r?.call(this)};const s=n.prototype.disconnectedCallback;return n.prototype.disconnectedCallback=function(){s?.call(this),delete this[S],delete this[U]},e.customElements.get(t.tag)||e.customElements.define(t.tag,n),t.routes.forEach(e=>f(e,t.tag,t.transition,t.guards,t.layout,t.placard)),n}},initialize:function(){if(!n.querySelector(t.target))throw new Error(`Target element not found: ${t.target}`);!a&&(o.sort((t,e)=>e.route.spec.length-t.route.spec.length),a=!0),p(),function(){const o=()=>{n.querySelector(t.target)&&x(b())};switch(t.type){case"hash":e.addEventListener("hashchange",o);break;case"pushstate":e.addEventListener("popstate",o)}}(),x(b())},navigate:x,register:f}}function Sn(t,e){return function(n,o){return function(...r){this[$]||(this[$]=new Map);const s=`${t}_${o.name}`;this[$].has(s)||this[$].set(s,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[$].get(s),a=n.apply(this,r),c=n=>{if(void 0===n&&!1===e?.dispatchOnUndefined)return;const o=new CustomEvent(t,{bubbles:!0,composed:!0,...e,detail:n});this.dispatchEvent(o)},l=t=>{if(e?.debounce)return clearTimeout(i.debounceTimeout),void(i.debounceTimeout=setTimeout(()=>c(t),e.debounce));if(!e?.throttle)return void c(t);const n=Date.now(),o=e.throttle-(n-i.throttleLastCall);if(o<=0)return clearTimeout(i.throttleTimeout),i.throttleLastCall=n,void c(t);i.latestDetail=t,i.throttleTimeout||(i.throttleTimeout=setTimeout(()=>{i.throttleLastCall=Date.now(),i.throttleTimeout=null;const t=i.latestDetail;i.latestDetail=void 0,c(t)},o))};return a instanceof Promise?a.then(t=>(l(t),t)):(l(a),a)}}}function Tn(t,e,n){const o=[];for(const[r,s]of Object.entries(e)){const e=`@request/${r}`,i=t=>{const e=t,{discovery:o,data:i,payload:a}=e.detail;n?.passive||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()),o.resolve(),Promise.resolve().then(()=>s(a)).then(t=>i.resolve(t)).catch(t=>{i.reject(t),console.error(`createRequestHandler: error in "${r}" handler:`,t)})};t.addEventListener(e,i),o.push(()=>t.removeEventListener(e,i))}return()=>{for(const t of o)t();o.length=0}}!function(t){t.SUCCESS="success",t.GUARDS_FAILED="guards-failed",t.NOT_FOUND="not-found"}(wn||(wn={}));let En=!1;function An(t){En=t}async function On(t,e=500){if(customElements.get(t))return;let n=null;En||(n=setTimeout(()=>{console.warn(`Custom element <${t}> is taking longer than ${e}ms to register. This may indicate a missing import or circular dependency. Set DISABLE_ELEMENT_READY_WARNINGS=true to disable this warning.`)},e));try{await customElements.whenDefined(t)}finally{n&&clearTimeout(n)}}async function xn(t,e=500){const n=t.tagName.toLowerCase();await On(n,e),"ready"in t&&"function"==typeof t.ready?.then&&await t.ready}async function Cn(t,e=500){const n=[];if(t instanceof Element&&(t.tagName.includes("-")&&n.push(t),t.shadowRoot)){t.shadowRoot.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}if(t instanceof DocumentFragment){t.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}await Promise.all(n.map(t=>xn(t,e)))}async function*_n(t){for(;;)await new Promise(e=>{t[q]||(t[q]=[]),t[q].push(e)}),yield}let kn=0,Ln=null;const Pn=Symbol.for("snice:body-scroll-lock");function Mn(){0===kn&&(Ln=document.body.style.overflow,document.body.style.overflow="hidden"),kn++}function $n(){0!==kn&&(kn--,0===kn&&(document.body.style.overflow=Ln??"",Ln=null))}function In(){return kn}globalThis[Pn]={clear(){kn=0,Ln=null}};class Dn{constructor(){this.requestMiddlewares=[],this.responseMiddlewares=[]}use(t,e){"request"!==t?this.responseMiddlewares.push(e):this.requestMiddlewares.push(e)}create(t){const e=this.requestMiddlewares,n=this.responseMiddlewares;return async function(t,o){const r=new Request(t,o);let s=0;const i=async()=>{if(s<e.length){return e[s++].call(this,r,i)}const t=await fetch(r);let o=0;const a=async()=>{if(o<n.length){return n[o++].call(this,t,a)}return t};return a()};return i()}.bind(t)}}
|
|
22
|
+
class Cn{constructor(t){this.parsed=this.parsePattern(t)}get spec(){return this.parsed.template}parsePattern(t){let e=t,n="",o=!1;const r=t.indexOf("?");return-1!==r&&(e=t.slice(0,r),n=t.slice(r+1),e.endsWith("(")&&n.endsWith(")")&&(o=!0,e=e.slice(0,-1),n=n.slice(0,-1))),{pathSegments:this.parseSegments(e),querySegments:n?this.parseQuerySegments(n):[],queryOptional:o,template:t}}parseSegments(t){const e=[];let n=0;for(;n<t.length;){switch(t[n]){case"(":const{segments:o,endIndex:r}=this.parseOptionalGroup(t,n);e.push({type:"optional",segments:o}),n=r+1;break;case":":const{name:s,endIndex:i}=this.parseIdentifier(t,n+1);e.push({type:"param",name:s}),n=i;break;case"*":const{name:a,endIndex:c}=this.parseIdentifier(t,n+1);e.push({type:"splat",name:a}),n=c;break;default:const{value:l,endIndex:u}=this.parseLiteral(t,n);l&&e.push({type:"literal",value:l}),n=u}}return e}parseOptionalGroup(t,e){let n=1,o=e+1;for(;o<t.length&&n>0;)"("===t[o]&&n++,")"===t[o]&&n--,o++;const r=t.slice(e+1,o-1);return{segments:this.parseSegments(r),endIndex:o-1}}parseIdentifier(t,e){let n=e;for(;n<t.length&&/[\w-]/.test(t[n]);)n++;return{name:t.slice(e,n),endIndex:n}}parseLiteral(t,e){let n=e;for(;n<t.length&&!"(:*(".includes(t[n]);)n++;return{value:t.slice(e,n),endIndex:n}}parseQuerySegments(t){let e=t;e.startsWith("(")&&e.endsWith(")")&&(e=e.slice(1,-1));const n=[];let o=0;for(;o<e.length;)if(":"===e[o]){const{name:t,endIndex:r}=this.parseIdentifier(e,o+1);n.push({type:"param",name:t}),o=r}else{const{value:t,endIndex:r}=this.parseQueryLiteral(e,o);t&&n.push({type:"literal",value:t}),o=r}return n}parseQueryLiteral(t,e){let n=e;for(;n<t.length&&":"!==t[n];)n++;return{value:t.slice(e,n),endIndex:n}}getAllParamNames(){const t=new Set,e=n=>{for(const o of n)switch(o.type){case"param":case"splat":t.add(o.name);break;case"optional":e(o.segments)}};return e(this.parsed.pathSegments),e(this.parsed.querySegments),Array.from(t)}canMatchRemainingSegments(t,e,n){let o=e;for(const e of n)if("literal"===e.type){const n=t.indexOf(e.value,o);if(-1===n)return!1;o=n+e.value.length}return!0}match(t){const[e,n]=t.split("?"),o=this.matchPath(e,this.parsed.pathSegments);if(!1===o)return!1;const r=this.matchQuery(n||"",this.parsed.querySegments);if(!1===r)return!1;const s=this.getAllParamNames(),i={};for(const t of s)i[t]=void 0;return Object.assign(i,o,r),i}matchPath(t,e){const n={};let o=0;for(let r=0;r<e.length;r++){const s=e[r],i=e.slice(r+1),a=this.matchSegment(t,o,s,i);if(!1===a)return!1;Object.assign(n,a.params),o=a.nextIndex}return!(o<t.length)&&n}matchSegment(t,e,n,o=[]){switch(n.type){case"literal":return t.slice(e,e+n.value.length)===n.value&&{params:{},nextIndex:e+n.value.length};case"param":{let r=e;const s=o[0];let i,a=["/","?"];if(s&&"literal"===s.type){const n=s.value,o=t.indexOf(n,e);if(-1===o)return!1;r=o}else for(;r<t.length&&!a.includes(t[r]);)r++;if(r===e)return!1;try{i=decodeURIComponent(t.slice(e,r))}catch(n){i=t.slice(e,r)}return!(r<t.length&&"?"===t[r]&&o.length>0)&&{params:{[n.name]:i},nextIndex:r}}case"splat":{let r=t.length;const s=o[0];if(s)switch(s.type){case"literal":if("."===s.value){const n=t.indexOf(".",e);-1!==n&&(r=n)}else{const n=t.lastIndexOf(s.value);-1!==n&&n>=e&&(r=n)}break;case"param":let n=-1;for(let o=t.length-1;o>=e;o--)if("/"===t[o]){n=o;break}-1!==n&&(r=n);break;case"splat":let o=-1;for(let n=t.length-1;n>e;n--)if("/"===t[n]){o=n+1;break}if(-1!==o)r=o;else{const n=t.slice(e).split("/").filter(t=>t);r=n.length>1?e+n.slice(0,-1).join("/").length+1:e}break;case"optional":const i=t=>{for(const e of t){if("literal"===e.type)return e.value;if("optional"===e.type){const t=i(e.segments);if(t)return t}}return null},a=i(s.segments);if(a){const n=t.lastIndexOf(a);-1!==n&&n>=e&&(r=n)}}const i=t.indexOf("?",e);let a;-1!==i&&i<r&&(r=i);try{a=decodeURIComponent(t.slice(e,r))}catch(n){a=t.slice(e,r)}return{params:{[n.name]:a},nextIndex:r}}case"optional":{let r=e,s={},i=!0;for(let e=0;e<n.segments.length;e++){const o=n.segments[e],a=n.segments.slice(e+1),c=this.matchSegment(t,r,o,a);if(!1===c){i=!1;break}Object.assign(s,c.params),r=c.nextIndex}if(i){if(this.canMatchRemainingSegments(t,r,o))return{params:s,nextIndex:r}}return{params:{},nextIndex:e}}default:return!1}}findNextLiteral(t){for(const e of t){if("literal"===e.type)return e;if("optional"===e.type){const t=this.findNextLiteral(e.segments);if(t)return t}}return null}matchQuery(t,e){if(0===e.length)return{};const n={};let o=0;for(const r of e)switch(r.type){case"literal":if(t.slice(o,o+r.value.length)!==r.value)return!1;o+=r.value.length;break;case"param":{let e,s=o;for(;s<t.length&&"&"!==t[s];)s++;if(s===o)return!1;try{e=decodeURIComponent(t.slice(o,s))}catch(n){e=t.slice(o,s)}n[r.name]=e,o=s;break}}return n}reverse(t={}){const e=this.reverseSegments(this.parsed.pathSegments,t);if(!1===e)return!1;let n=e;if(this.parsed.querySegments.length>0){const e=this.reverseSegments(this.parsed.querySegments,t);if(!this.parsed.queryOptional&&!1===e)return!1;e&&""!==e&&(n+="?"+e)}return n}reverseSegments(t,e,n=!1){let o="";for(let r=0;r<t.length;r++){const s=t[r],i=t.slice(r+1);switch(s.type){case"literal":o+=s.value;break;case"param":case"splat":if(!(s.name in e))return!1;o+=String(e[s.name]);break;case"optional":if(this.hasAllParams(s.segments,e,n)||this.hasLaterOptionalGroupNeedingParams(i,e,s.segments)){const t=this.reverseSegments(s.segments,e,!0);if(!1===t)return!1;o+=t}}}return o}hasLaterOptionalGroupNeedingParams(t,e,n){for(const o of t)if("optional"===o.type&&this.hasAnyParamInSegments(o.segments,e))return this.hasOnlyLiteralsAndOptionals(n);return!1}hasOnlyLiteralsAndOptionals(t){for(const e of t)if("param"===e.type||"splat"===e.type)return!1;return!0}hasAllParams(t,e,n=!1){let o=!1,r=!1,s=!1,i=!0;for(const n of t)switch(n.type){case"param":case"splat":i=!1,n.name in e&&void 0!==e[n.name]?o=!0:s=!0}const a=n||o&&!s;for(const n of t)if("optional"===n.type){this.hasAllParams(n.segments,e,a)&&(r=!0)}return!(!o||s)||(!(!r||s)||!(!i||!n))}hasOnlyOptionalMissingParams(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(!(n.name in e))return!1}return!0}hasAnyParamInSegments(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(n.name in e)return!0;break;case"optional":if(this.hasAnyParamInSegments(n.segments,e))return!0}return!1}}function _n(t){const e=t.split("/").filter(Boolean);let n=e.length;for(const t of e)t.startsWith("*")?n+=-2:t.startsWith(":")?n+=3:n+=10;return n}function Ln(t){const e={};return t.split(";").forEach(t=>{const n=t.indexOf(":");if(-1===n)return;const o=t.slice(0,n).trim(),r=t.slice(n+1).trim();o&&r&&(e[o]=r)}),e}function kn(t,e,n,o){if(t.style.position="absolute",t.style.width="100%",e)return t.style.height="100%",void(t.style.transition=`opacity ${n}ms ease-in-out`);t.style.top="0",t.style.left="0",t.style.transition=`${o} ${n}ms ease-in-out`}var Pn;function $n(t){const e=t.window??window,n=t.document??document,o=[];let r,s,i,a=!1,c=[],l=null,u=null;const h=t.context||{},d=new Nt(h,[],"",{},t.fetcher);function f(t){if(!l||!u)return null;const e=t.querySelectorAll(l);for(const t of e){if(t[x]===u)return t}return null}function m(t,e,n,c,l,u){switch(o.push({route:new Cn(t),tag:e,transition:n,guards:c,layout:l,placard:u}),a=!1,t){case"/404":r=e;break;case"/403":s=e;break;case"/":i=e}}function p(){const t=new Set;c=o.filter(t=>t.placard).map(t=>{const e=t.placard;return"function"==typeof e?e(h):e}).filter(e=>!t.has(e.name)&&(t.add(e.name),!0))}function y(t,e,n){d[tt](h,c,e,n)}function g(){switch(t.type){case"hash":return e.location.hash.slice(1);case"pushstate":return e.location.pathname}}function v(t){let e;if(s)e=n.createElement(s),e[E]=h;else{const t=n.createElement("div");t.className="default-403",t.innerHTML="<h1>403</h1><p>Unauthorized</p>",e=t}t.innerHTML="",t.appendChild(e),l=null,u=null}async function w(t,e,o,r){if(!!!t)return!0;const s=Array.isArray(t)?t:[t];let i=null,a=null;a=setTimeout(()=>{r&&r()||(i=function(){const t=n.createElement("div");return t.setAttribute("data-snice-loading",""),t.innerHTML='\n <style>@keyframes snice-spin{to{transform:rotate(360deg)}}</style>\n <div style="display:flex;align-items:center;justify-content:center;height:100%;min-height:200px">\n <div style="width:32px;height:32px;border:3px solid rgba(128,128,128,0.3);border-top-color:rgba(128,128,128,0.8);border-radius:50%;animation:snice-spin 0.6s linear infinite"></div>\n </div>',t}(),o.appendChild(i))},50);try{for(const t of s){if(!await t(h,e))return r&&r()||v(o),!1}return!0}finally{a&&clearTimeout(a),i&&i.remove()}}async function N(t,e,n,o,r,s,i,a){const l=o||f(t);if(!l)return;!function(t,e,n){"function"==typeof t.update&&t.update(h,c,e,n)}(l,s,i);const u=l.querySelector('[slot="page"]');if(!(!n||!u)){if(e.setAttribute("slot","page"),await C(l,u,e,n),a&&a())return;return void(r&&(t.innerHTML="",t.appendChild(l)))}if(a&&a())return;l.querySelectorAll('[slot="page"]').forEach(t=>t.remove()),e.setAttribute("slot","page"),l.appendChild(e),r&&(t.innerHTML="",t.appendChild(l))}async function T(e,o,r,s,i,a,c){const d=!1===(m=s)?null:m||(t.layout?t.layout:null);var m;const{element:p,needsNewLayout:g}=function(t){if(t===l)return{element:null,needsNewLayout:!1};if(l=t,!!t){const e=Date.now();u=e;const o=n.createElement(t);return o[E]=h,o[x]=e,{element:o,needsNewLayout:!0}}return u=null,{element:null,needsNewLayout:!0}}(d),b=r||t.transition;if(null!==p||null!==f(e)){if(await N(e,o,b,p,g,i,a,c),c&&c())return;y(0,i,a)}else await async function(t,e,n,o){const r=t.children[0];n&&r?await C(t,r,e,n):o&&o()||(t.innerHTML="",t.appendChild(e))}(e,o,b,c),c&&c()||y(0,i,a)}let S=0;async function O(s){const a=n.querySelector(t.target);if(!a)throw new Error(`Target element not found: ${t.target}`);const c=++S,l=()=>c!==S;p(),e.scrollTo(0,0);if((""===s?.trim()||"/"===s)&&!!i){const t=o.find(t=>t.route.match("/"));if(!await w(t?.guards,{},a,l))return;if(l())return;const{element:r,transition:c,layout:u}=function(){const t=n.createElement(i);t[E]=h;const r=e.customElements.get(i),s=r?.[A],a=o.find(t=>t.route.match("/"));return{element:t,transition:s,layout:a?.layout}}();return void await T(a,r,c,u,s,{},l)}if(!s)return;const u=await async function(t,e,r){for(const s of o){const o=s.route.match(t);if(!1===o)continue;if(!await w(s.guards,o,e,r))return{result:Pn.GUARDS_FAILED};const i=n.createElement(s.tag);i[E]=h,i[W]=d;const a=o;return Object.keys(a).forEach(t=>i.setAttribute(t,a[t])),{result:Pn.SUCCESS,element:i,transition:s.transition,layout:s.layout,routeParams:a}}return{result:Pn.NOT_FOUND}}(s,a,l);if(l())return;if(u.result===Pn.GUARDS_FAILED)return;if(u.result===Pn.SUCCESS){const{element:t,transition:e,layout:n,routeParams:o={}}=u;return void await T(a,t,e,n,s,o,l)}const{element:f,transition:m,layout:y}=function(){if(r){const t=n.createElement(r);t[E]=h;const o=e.customElements.get(r),s=o?.[A];return{element:t,transition:s,layout:void 0}}const t=n.createElement("div");return t.className="default-404",t.innerHTML="<h1>404</h1><p>Page not found</p>",{element:t,transition:void 0,layout:void 0}}();await T(a,f,m,y,s,{},l)}async function C(t,e,n,o,r=S){return async function(t,e,n,o={},r=()=>!1){const s=o.outDuration||300,i=o.inDuration||300,a=o.mode||"sequential",c=o.out?Ln(o.out):{opacity:"0"},l={opacity:"0"},u=o.in?Ln(o.in):{opacity:"1"},h=t.style,d=t.tagName.includes("-")&&t.shadowRoot,f=Symbol.for("snice:transition-original-position"),m=Symbol.for("snice:transition-count"),p=t;d||(f in p||(p[f]=h.position,p[m]=0),p[m]++,h.position="relative");const y=()=>{d||(p[m]--,p[m]<=0&&(h.position=p[f],delete p[f],delete p[m]))},g=e.hasAttribute("slot")||n.hasAttribute("slot");switch(kn(e,g,s,"all"),kn(n,g,i,"all"),Object.assign(n.style,l),t.appendChild(n),n.offsetHeight,a){case pt.SIMULTANEOUS:Object.assign(e.style,c),Object.assign(n.style,u),await new Promise(t=>setTimeout(t,Math.max(s,i)));break;case pt.SEQUENTIAL:if(Object.assign(e.style,c),await new Promise(t=>setTimeout(t,s)),r())return n.parentNode===t&&n.remove(),void y();Object.assign(n.style,u),await new Promise(t=>setTimeout(t,i))}if(r())return n.parentNode===t&&n.remove(),void y();e.remove(),function(t,e){t.style.position="",t.style.width="",t.style.transition="",e?t.style.height="":(t.style.top="",t.style.left="")}(n,g),Object.keys({...l,...u}).forEach(t=>{n.style[t]=""}),y()}(t,e,n,o,()=>r!==S)}return{page:function(t){return function(n,o){if(o?.metadata&&o.metadata[b]){n[b]||(n[b]=new Map);for(const[t,e]of o.metadata[b])n[b].set(t,e)}ln(n),n[A]=t.transition;const r=n.prototype.connectedCallback;n.prototype.connectedCallback=function(){this[W]=d,r?.call(this)};const s=n.prototype.disconnectedCallback;return n.prototype.disconnectedCallback=function(){s?.call(this),delete this[E],delete this[W]},e.customElements.get(t.tag)||e.customElements.define(t.tag,n),t.routes.forEach(e=>m(e,t.tag,t.transition,t.guards,t.layout,t.placard)),n}},initialize:function(){if(!n.querySelector(t.target))throw new Error(`Target element not found: ${t.target}`);!a&&(o.sort((t,e)=>_n(e.route.spec)-_n(t.route.spec)),a=!0),p(),function(){const o=()=>{n.querySelector(t.target)&&O(g())};switch(t.type){case"hash":e.addEventListener("hashchange",o);break;case"pushstate":e.addEventListener("popstate",o)}}(),O(g())},navigate:O,register:m}}function Mn(t,e,n){const o=[];for(const[r,s]of Object.entries(e)){const e=`@request/${r}`,i=t=>{const e=t,{discovery:o,data:i,payload:a}=e.detail;n?.passive||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()),o.resolve(),Promise.resolve().then(()=>s(a)).then(t=>i.resolve(t)).catch(t=>{i.reject(t),console.error(`createRequestHandler: error in "${r}" handler:`,t)})};t.addEventListener(e,i),o.push(()=>t.removeEventListener(e,i))}return()=>{for(const t of o)t();o.length=0}}!function(t){t.SUCCESS="success",t.GUARDS_FAILED="guards-failed",t.NOT_FOUND="not-found"}(Pn||(Pn={}));let In=!1;function Dn(t){In=t}async function Rn(t,e=500){if(customElements.get(t))return;let n=null;In||(n=setTimeout(()=>{console.warn(`Custom element <${t}> is taking longer than ${e}ms to register. This may indicate a missing import or circular dependency. Set DISABLE_ELEMENT_READY_WARNINGS=true to disable this warning.`)},e));try{await customElements.whenDefined(t)}finally{n&&clearTimeout(n)}}async function jn(t,e=500){const n=t.tagName.toLowerCase();await Rn(n,e),"ready"in t&&"function"==typeof t.ready?.then&&await t.ready}async function Fn(t,e=500){const n=[];if(t instanceof Element&&(t.tagName.includes("-")&&n.push(t),t.shadowRoot)){t.shadowRoot.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}if(t instanceof DocumentFragment){t.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}await Promise.all(n.map(t=>jn(t,e)))}async function*qn(t){for(;;)await new Promise(e=>{t[B]||(t[B]=[]),t[B].push(e)}),yield}let Bn=0,Vn=null;const Un=Symbol.for("snice:body-scroll-lock");function zn(){0===Bn&&(Vn=document.body.style.overflow,document.body.style.overflow="hidden"),Bn++}function Wn(){0!==Bn&&(Bn--,0===Bn&&(document.body.style.overflow=Vn??"",Vn=null))}function Hn(){return Bn}globalThis[Un]={clear(){Bn=0,Vn=null}};class Kn{constructor(){this.requestMiddlewares=[],this.responseMiddlewares=[]}use(t,e){"request"!==t?this.responseMiddlewares.push(e):this.requestMiddlewares.push(e)}create(t){const e=this.requestMiddlewares,n=this.responseMiddlewares;return async function(t,o){const r=new Request(t,o);let s=0;const i=async()=>{if(s<e.length){return e[s++].call(this,r,i)}const t=await fetch(r);let o=0;const a=async()=>{if(o<n.length){return n[o++].call(this,t,a)}return t};return a()};return i()}.bind(t)}}
|
|
23
23
|
/*!
|
|
24
|
-
* snice v5.2.
|
|
24
|
+
* snice v5.2.3
|
|
25
25
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
26
26
|
* (c) 2024
|
|
27
27
|
* Released under the MIT License.
|
|
28
28
|
*
|
|
29
29
|
* GENERATED FILE — DO NOT EDIT. Source: src/. Rebuild: npm run build:core
|
|
30
30
|
*/
|
|
31
|
-
var
|
|
31
|
+
var Gn;"undefined"!=typeof document&&je(),
|
|
32
32
|
/*!
|
|
33
|
-
* snice v5.2.
|
|
33
|
+
* snice v5.2.3
|
|
34
34
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
35
35
|
* (c) 2024
|
|
36
36
|
* Released under the MIT License.
|
|
37
37
|
*
|
|
38
38
|
* GENERATED FILE — DO NOT EDIT. Source: src/. Rebuild: npm run build:core
|
|
39
39
|
*/
|
|
40
|
-
globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0}),function(t){t.SEQUENTIAL="sequential",t.SIMULTANEOUS="simultaneous"}(
|
|
40
|
+
globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0}),function(t){t.SEQUENTIAL="sequential",t.SIMULTANEOUS="simultaneous"}(Gn||(Gn={}));export{Nt as Context,Kn as ContextAwareFetcher,o as IS_CONTROLLER_INSTANCE,$n as Router,mt as SimpleArray,pt as TransitionMode,On as adopted,ln as applyElementFunctionality,rn as clearDebounceTimers,an as clearMemoizeCache,sn as clearThrottleTimers,qe as context,vn as contextProperty,Ie as controller,Mn as createRequestHandler,Xt as css,tn as debounce,Qe as dispatch,Tn as dispose,hn as element,Ot as escapeAttr,xt as escapeHtml,Hn as getBodyScrollLockCount,e as getSymbol,Jt as html,Ct as isSafeUrl,dn as layout,zn as lockBodyScroll,on as memoize,xn as moved,ue as noChange,te as nothing,Rt as observe,_e as on,nn as once,_t as parseDuration,mn as property,yn as query,gn as queryAll,Nn as ready,Sn as reconnect,Ke as render,zt as request,cn as resetOnce,Wt as respond,Dn as setDisableElementReadyWarnings,Ge as styles,en as throttle,qn as trackRenders,Wn as unlockBodyScroll,ne as unsafeHTML,je as useNativeElementControllers,Fn as waitForAllCustomElements,Rn as waitForElementDefined,jn as waitForElementReady,bn as watch};
|
|
41
41
|
//# sourceMappingURL=snice-runtime.esm.min.js.map
|