snice 4.27.0 → 4.29.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/adapters/react/action-bar.d.ts +30 -0
- package/adapters/react/action-bar.d.ts.map +1 -0
- package/adapters/react/action-bar.js +24 -0
- package/adapters/react/action-bar.js.map +1 -0
- package/adapters/react/action-bar.tsx +38 -0
- package/adapters/react/binpack.d.ts +35 -0
- package/adapters/react/binpack.d.ts.map +1 -0
- package/adapters/react/binpack.js +24 -0
- package/adapters/react/binpack.js.map +1 -0
- package/adapters/react/binpack.tsx +43 -0
- package/adapters/react/components.d.ts +4 -0
- package/adapters/react/components.d.ts.map +1 -1
- package/adapters/react/components.js +2 -0
- package/adapters/react/components.js.map +1 -1
- package/adapters/react/components.ts +4 -0
- package/adapters/react/useRequestHandler.d.ts +56 -0
- package/adapters/react/useRequestHandler.js +103 -0
- package/adapters/react/useRequestHandler.js.map +1 -0
- 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 +27 -0
- package/dist/cdn/action-bar/snice-action-bar.js +249 -0
- package/dist/cdn/action-bar/snice-action-bar.js.map +1 -0
- package/dist/cdn/action-bar/snice-action-bar.min.js +12 -0
- package/dist/cdn/action-bar/snice-action-bar.min.js.map +1 -0
- 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.min.js +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.min.js +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 +2 -2
- package/dist/cdn/badge/snice-badge.js.map +1 -1
- package/dist/cdn/badge/snice-badge.min.js +2 -2
- package/dist/cdn/badge/snice-badge.min.js.map +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/banner/snice-banner.min.js +1 -1
- package/dist/cdn/binpack/README.md +27 -0
- package/dist/cdn/binpack/snice-binpack.js +1037 -0
- package/dist/cdn/binpack/snice-binpack.js.map +1 -0
- package/dist/cdn/binpack/snice-binpack.min.js +13 -0
- package/dist/cdn/binpack/snice-binpack.min.js.map +1 -0
- 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.min.js +1 -1
- package/dist/cdn/button/README.md +1 -1
- package/dist/cdn/button/snice-button.js +11 -10
- package/dist/cdn/button/snice-button.js.map +1 -1
- package/dist/cdn/button/snice-button.min.js +3 -3
- 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.min.js +1 -1
- package/dist/cdn/chat/snice-chat.js +1 -1
- package/dist/cdn/chat/snice-chat.min.js +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.min.js +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/snice-command-palette.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js +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.min.js +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.min.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.min.js +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.min.js +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/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.min.js +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/input/snice-input.min.js +1 -1
- package/dist/cdn/invoice/snice-invoice.js +1 -1
- package/dist/cdn/invoice/snice-invoice.min.js +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.min.js +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.min.js +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/location/snice-location.min.js +1 -1
- package/dist/cdn/login/README.md +2 -2
- package/dist/cdn/login/snice-login.js +11 -10
- package/dist/cdn/login/snice-login.js.map +1 -1
- package/dist/cdn/login/snice-login.min.js +5 -5
- 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/snice-markdown.js +1 -1
- package/dist/cdn/markdown/snice-markdown.min.js +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 +1 -1
- package/dist/cdn/menu/snice-menu.min.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.min.js +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.min.js +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.min.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.min.js +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/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 +1 -1
- package/dist/cdn/product-card/snice-product-card.min.js +1 -1
- package/dist/cdn/progress/snice-progress.js +1 -1
- package/dist/cdn/progress/snice-progress.min.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.min.js +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 +152 -62
- 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 +152 -61
- 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.min.js +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.min.js +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/spreadsheet/snice-spreadsheet.js +1 -1
- package/dist/cdn/spreadsheet/snice-spreadsheet.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 +11 -10
- package/dist/cdn/table/snice-table.js.map +1 -1
- package/dist/cdn/table/snice-table.min.js +73 -73
- 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 +1 -1
- package/dist/cdn/tag-input/snice-tag-input.min.js +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/snice-time-picker.js +1 -1
- package/dist/cdn/time-picker/snice-time-picker.min.js +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.min.js +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.min.js +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.min.js +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.d.ts +22 -0
- package/dist/components/action-bar/snice-action-bar.js +182 -0
- package/dist/components/action-bar/snice-action-bar.js.map +1 -0
- package/dist/components/action-bar/snice-action-bar.types.d.ts +17 -0
- package/dist/components/badge/snice-badge.js +1 -1
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/binpack/snice-binpack.d.ts +82 -0
- package/dist/components/binpack/snice-binpack.js +970 -0
- package/dist/components/binpack/snice-binpack.js.map +1 -0
- package/dist/components/binpack/snice-binpack.types.d.ts +52 -0
- package/dist/components/button/snice-button.d.ts +2 -2
- package/dist/components/button/snice-button.js +11 -10
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/create-request-handler.d.ts +42 -0
- package/dist/index.cjs +149 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +149 -59
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +149 -58
- package/dist/index.iife.js.map +1 -1
- package/dist/parts.d.ts +9 -7
- package/dist/react/useRequestHandler.d.ts +56 -0
- package/dist/react/useRequestHandler.js +103 -0
- package/dist/react/useRequestHandler.js.map +1 -0
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/DEVELOPMENT.md +1 -1
- package/docs/ai/components/accordion.md +46 -80
- package/docs/ai/components/action-bar.md +75 -0
- package/docs/ai/components/activity-feed.md +7 -7
- package/docs/ai/components/alert.md +26 -44
- package/docs/ai/components/app-tiles.md +34 -39
- package/docs/ai/components/approval-flow.md +1 -1
- package/docs/ai/components/audio-recorder.md +35 -67
- package/docs/ai/components/availability.md +13 -34
- package/docs/ai/components/avatar-group.md +26 -13
- package/docs/ai/components/avatar.md +52 -36
- package/docs/ai/components/badge.md +21 -32
- package/docs/ai/components/banner.md +21 -43
- package/docs/ai/components/binpack.md +89 -0
- package/docs/ai/components/book.md +25 -23
- package/docs/ai/components/booking.md +31 -36
- package/docs/ai/components/breadcrumbs.md +36 -11
- package/docs/ai/components/button.md +33 -44
- package/docs/ai/components/calendar.md +37 -70
- package/docs/ai/components/camera-annotate.md +31 -64
- package/docs/ai/components/camera.md +38 -120
- package/docs/ai/components/candlestick.md +32 -52
- package/docs/ai/components/card.md +20 -30
- package/docs/ai/components/carousel.md +32 -32
- package/docs/ai/components/cart.md +24 -29
- package/docs/ai/components/chart.md +29 -114
- package/docs/ai/components/chat.md +38 -75
- package/docs/ai/components/checkbox.md +22 -41
- package/docs/ai/components/chip.md +18 -54
- package/docs/ai/components/code-block.md +57 -178
- package/docs/ai/components/color-display.md +12 -32
- package/docs/ai/components/color-picker.md +17 -39
- package/docs/ai/components/command-palette.md +49 -71
- package/docs/ai/components/comments.md +55 -36
- package/docs/ai/components/countdown.md +28 -30
- package/docs/ai/components/cropper.md +33 -33
- package/docs/ai/components/data-card.md +20 -14
- package/docs/ai/components/date-picker.md +40 -47
- package/docs/ai/components/date-range-picker.md +31 -15
- package/docs/ai/components/date-time-picker.md +23 -46
- package/docs/ai/components/diff.md +30 -31
- package/docs/ai/components/divider.md +17 -47
- package/docs/ai/components/doc.md +43 -68
- package/docs/ai/components/draw.md +35 -87
- package/docs/ai/components/drawer.md +48 -77
- package/docs/ai/components/empty-state.md +10 -44
- package/docs/ai/components/estimate.md +33 -58
- package/docs/ai/components/file-gallery.md +48 -100
- package/docs/ai/components/file-upload.md +17 -53
- package/docs/ai/components/flip-card.md +31 -23
- package/docs/ai/components/flow.md +37 -65
- package/docs/ai/components/form-builder.md +35 -75
- package/docs/ai/components/form-layout.md +10 -20
- package/docs/ai/components/funnel.md +33 -48
- package/docs/ai/components/gantt.md +27 -23
- package/docs/ai/components/gauge.md +16 -17
- package/docs/ai/components/heatmap.md +21 -21
- package/docs/ai/components/image.md +7 -13
- package/docs/ai/components/input.md +38 -70
- package/docs/ai/components/invoice.md +35 -36
- package/docs/ai/components/kanban.md +32 -61
- package/docs/ai/components/key-value.md +32 -16
- package/docs/ai/components/kpi.md +38 -73
- package/docs/ai/components/layout.md +29 -23
- package/docs/ai/components/leaderboard.md +28 -37
- package/docs/ai/components/link-preview.md +12 -18
- package/docs/ai/components/link.md +10 -7
- package/docs/ai/components/list.md +21 -5
- package/docs/ai/components/location.md +21 -25
- package/docs/ai/components/login.md +14 -9
- package/docs/ai/components/map.md +27 -33
- package/docs/ai/components/markdown.md +20 -24
- package/docs/ai/components/masonry.md +10 -14
- package/docs/ai/components/mentions.md +26 -12
- package/docs/ai/components/menu.md +54 -52
- package/docs/ai/components/message-strip.md +20 -20
- package/docs/ai/components/metric-table.md +14 -21
- package/docs/ai/components/modal.md +27 -18
- package/docs/ai/components/music-player.md +49 -41
- package/docs/ai/components/nav.md +34 -31
- package/docs/ai/components/network-graph.md +27 -42
- package/docs/ai/components/notification-center.md +31 -33
- package/docs/ai/components/order-tracker.md +36 -27
- package/docs/ai/components/org-chart.md +36 -31
- package/docs/ai/components/pagination.md +34 -26
- package/docs/ai/components/paint.md +53 -91
- package/docs/ai/components/pdf-viewer.md +35 -36
- package/docs/ai/components/permission-matrix.md +26 -31
- package/docs/ai/components/podcast-player.md +64 -70
- package/docs/ai/components/pricing-table.md +37 -48
- package/docs/ai/components/product-card.md +58 -41
- package/docs/ai/components/progress-ring.md +20 -24
- package/docs/ai/components/progress.md +28 -45
- package/docs/ai/components/qr-code.md +25 -27
- package/docs/ai/components/qr-reader.md +20 -23
- package/docs/ai/components/radio.md +17 -15
- package/docs/ai/components/range-slider.md +22 -11
- package/docs/ai/components/rating.md +29 -33
- package/docs/ai/components/receipt.md +50 -127
- package/docs/ai/components/recipe.md +44 -42
- package/docs/ai/components/sankey.md +21 -30
- package/docs/ai/components/scheduler.md +29 -41
- package/docs/ai/components/segmented-control.md +11 -15
- package/docs/ai/components/select.md +58 -102
- package/docs/ai/components/skeleton.md +16 -30
- package/docs/ai/components/slider.md +26 -20
- package/docs/ai/components/sortable.md +25 -27
- package/docs/ai/components/sparkline.md +21 -17
- package/docs/ai/components/spinner.md +9 -5
- package/docs/ai/components/split-button.md +10 -13
- package/docs/ai/components/split-pane.md +19 -14
- package/docs/ai/components/spotlight.md +31 -26
- package/docs/ai/components/spreadsheet.md +51 -97
- package/docs/ai/components/stat-group.md +9 -19
- package/docs/ai/components/step-input.md +17 -15
- package/docs/ai/components/stepper.md +14 -15
- package/docs/ai/components/switch.md +15 -9
- package/docs/ai/components/table.md +24 -84
- package/docs/ai/components/tabs.md +18 -10
- package/docs/ai/components/tag-input.md +18 -29
- package/docs/ai/components/tag.md +10 -22
- package/docs/ai/components/terminal.md +9 -9
- package/docs/ai/components/testimonial.md +9 -19
- package/docs/ai/components/textarea.md +15 -16
- package/docs/ai/components/theme.md +3 -3
- package/docs/ai/components/time-picker.md +30 -49
- package/docs/ai/components/time-range-picker.md +16 -15
- package/docs/ai/components/timeline.md +5 -4
- package/docs/ai/components/timer.md +8 -8
- package/docs/ai/components/toast.md +24 -18
- package/docs/ai/components/tooltip.md +11 -22
- package/docs/ai/components/tree.md +9 -9
- package/docs/ai/components/treemap.md +14 -13
- package/docs/ai/components/user-card.md +21 -27
- package/docs/ai/components/video-player.md +35 -52
- package/docs/ai/components/virtual-scroller.md +1 -1
- package/docs/ai/components/waterfall.md +17 -16
- package/docs/ai/components/weather.md +19 -34
- package/docs/ai/components/work-order.md +58 -134
- package/docs/ai/patterns.md +63 -0
- package/docs/components/accordion.md +72 -151
- package/docs/components/action-bar.md +185 -0
- package/docs/components/activity-feed.md +9 -14
- package/docs/components/alert.md +17 -109
- package/docs/components/app-tiles.md +58 -43
- package/docs/components/approval-flow.md +8 -14
- package/docs/components/audio-recorder.md +45 -51
- package/docs/components/availability.md +30 -45
- package/docs/components/avatar-group.md +34 -14
- package/docs/components/avatar.md +20 -55
- package/docs/components/badge.md +53 -470
- package/docs/components/banner.md +44 -30
- package/docs/components/binpack.md +208 -0
- package/docs/components/book.md +78 -57
- package/docs/components/booking.md +35 -87
- package/docs/components/breadcrumbs.md +74 -448
- package/docs/components/button.md +72 -603
- package/docs/components/calendar.md +77 -261
- package/docs/components/camera-annotate.md +44 -96
- package/docs/components/camera.md +94 -333
- package/docs/components/candlestick.md +79 -116
- package/docs/components/card.md +51 -689
- package/docs/components/carousel.md +29 -76
- package/docs/components/cart.md +44 -136
- package/docs/components/chart.md +95 -438
- package/docs/components/chat.md +175 -439
- package/docs/components/checkbox.md +52 -609
- package/docs/components/chip.md +45 -574
- package/docs/components/code-block.md +157 -421
- package/docs/components/color-display.md +45 -54
- package/docs/components/color-picker.md +103 -36
- package/docs/components/command-palette.md +98 -92
- package/docs/components/comments.md +16 -10
- package/docs/components/countdown.md +15 -20
- package/docs/components/cropper.md +14 -16
- package/docs/components/data-card.md +16 -15
- package/docs/components/date-picker.md +45 -25
- package/docs/components/date-range-picker.md +140 -87
- package/docs/components/date-time-picker.md +25 -28
- package/docs/components/diff.md +22 -17
- package/docs/components/divider.md +18 -20
- package/docs/components/doc.md +105 -197
- package/docs/components/draw.md +117 -223
- package/docs/components/drawer.md +113 -478
- package/docs/components/empty-state.md +13 -29
- package/docs/components/estimate.md +58 -118
- package/docs/components/file-gallery.md +123 -495
- package/docs/components/file-upload.md +36 -123
- package/docs/components/flip-card.md +30 -34
- package/docs/components/flow.md +74 -89
- package/docs/components/form-builder.md +59 -86
- package/docs/components/form-layout.md +21 -31
- package/docs/components/funnel.md +21 -22
- package/docs/components/gantt.md +5 -5
- package/docs/components/gauge.md +5 -23
- package/docs/components/heatmap.md +13 -55
- package/docs/components/image.md +28 -32
- package/docs/components/input.md +25 -14
- package/docs/components/invoice.md +34 -33
- package/docs/components/kanban.md +99 -394
- package/docs/components/key-value.md +22 -12
- package/docs/components/kpi.md +41 -112
- package/docs/components/layout.md +7 -13
- package/docs/components/leaderboard.md +52 -76
- package/docs/components/link-preview.md +20 -16
- package/docs/components/link.md +22 -19
- package/docs/components/list.md +44 -26
- package/docs/components/location.md +9 -13
- package/docs/components/login.md +42 -36
- package/docs/components/map.md +24 -46
- package/docs/components/markdown.md +14 -25
- package/docs/components/masonry.md +15 -13
- package/docs/components/mentions.md +36 -25
- package/docs/components/menu.md +39 -46
- package/docs/components/message-strip.md +15 -51
- package/docs/components/metric-table.md +50 -72
- package/docs/components/modal.md +32 -43
- package/docs/components/music-player.md +41 -49
- package/docs/components/nav.md +23 -13
- package/docs/components/network-graph.md +14 -13
- package/docs/components/notification-center.md +68 -172
- package/docs/components/order-tracker.md +72 -117
- package/docs/components/org-chart.md +58 -207
- package/docs/components/pagination.md +67 -89
- package/docs/components/paint.md +86 -172
- package/docs/components/pdf-viewer.md +46 -151
- package/docs/components/permission-matrix.md +61 -112
- package/docs/components/podcast-player.md +41 -119
- package/docs/components/pricing-table.md +104 -147
- package/docs/components/product-card.md +94 -197
- package/docs/components/progress-ring.md +29 -32
- package/docs/components/progress.md +30 -61
- package/docs/components/qr-code.md +53 -61
- package/docs/components/qr-reader.md +53 -42
- package/docs/components/radio.md +42 -40
- package/docs/components/range-slider.md +41 -30
- package/docs/components/rating.md +50 -84
- package/docs/components/receipt.md +91 -129
- package/docs/components/recipe.md +107 -216
- package/docs/components/sankey.md +47 -83
- package/docs/components/scheduler.md +81 -184
- package/docs/components/segmented-control.md +48 -40
- package/docs/components/select.md +107 -129
- package/docs/components/skeleton.md +33 -47
- package/docs/components/slider.md +49 -53
- package/docs/components/sortable.md +43 -186
- package/docs/components/sparkline.md +26 -25
- package/docs/components/spinner.md +32 -37
- package/docs/components/split-button.md +43 -23
- package/docs/components/split-pane.md +41 -58
- package/docs/components/spotlight.md +53 -145
- package/docs/components/spreadsheet.md +84 -307
- package/docs/components/stat-group.md +27 -61
- package/docs/components/step-input.md +44 -41
- package/docs/components/stepper.md +55 -89
- package/docs/components/switch.md +39 -39
- package/docs/components/table.md +27 -32
- package/docs/components/tabs.md +36 -27
- package/docs/components/tag-input.md +50 -176
- package/docs/components/tag.md +12 -50
- package/docs/components/terminal.md +32 -37
- package/docs/components/testimonial.md +24 -81
- package/docs/components/textarea.md +9 -14
- package/docs/components/theme.md +10 -23
- package/docs/components/time-picker.md +48 -72
- package/docs/components/time-range-picker.md +22 -41
- package/docs/components/timeline.md +7 -14
- package/docs/components/timer.md +16 -32
- package/docs/components/toast.md +19 -45
- package/docs/components/tooltip.md +13 -115
- package/docs/components/tree.md +2 -19
- package/docs/components/treemap.md +19 -43
- package/docs/components/user-card.md +13 -22
- package/docs/components/video-player.md +53 -227
- package/docs/components/virtual-scroller.md +11 -44
- package/docs/components/waterfall.md +58 -137
- package/docs/components/weather.md +94 -153
- package/docs/components/work-order.md +56 -143
- package/docs/plans/2026-03-09-action-bar-design.md +104 -0
- package/docs/plans/2026-03-09-action-bar-plan.md +676 -0
- package/docs/plans/2026-03-10-react-integration-design.md +166 -0
- package/docs/request-response.md +77 -0
- package/package.json +20 -10
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v4.
|
|
2
|
+
* snice v4.29.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
|
var Snice=function(t){"use strict";
|
|
8
8
|
/*!
|
|
9
|
-
* snice v4.
|
|
9
|
+
* snice v4.28.0
|
|
10
10
|
* 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.
|
|
11
11
|
* (c) 2024
|
|
12
12
|
* Released under the MIT License.
|
|
13
|
-
*/globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0});const e=globalThis.snice;function n(t){return Symbol.for(`snice:${t}`)}const r=n("is-controller-class"),o=n("is-controller-instance"),s=n("is-element-class"),i=n("channel-handlers"),a=n("ready-promise"),c=n("ready-resolve"),l=n("controller"),u=n("initialized"),h=n("controller-key"),d=n("controller-name"),m=n("controller-id"),f=n("controller-operations"),p=n("native-controller"),y=n("cleanup"),g=n("properties"),b=n("property-values"),v=n("pre-init-property-values"),w=n("properties-initialized"),S=n("property-watchers"),T=n("explicitly-set-properties"),E=n("router-context"),N=n("page-transition"),A=n("created-at"),_=n("ready-handlers"),C=n("dispose-handlers"),x=n("moved-handlers"),O=n("adopted-handlers"),k=n("observers"),L=n("setting-from-property"),I=n("moved-timers"),$=n("adopted-timers"),M=n("dispatch-timers"),R=n("render-method"),D=n("render-options"),P=n("render-instance"),q=n("render-timers"),F=n("render-callbacks"),V=n("styles-method"),j=n("styles-applied"),U=n("context-handler"),z=n("navigation-context-instance"),B=n("registered-elements"),W=n("is-updating"),H=n("context-register"),G=n("context-unregister"),Q=n("context-notify-element"),K=n("context-timer"),J=n("context-called"),X=n("context-update");class Y{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(Y.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${Y.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(Y.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(Y.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var Z,tt,et;const nt=Symbol.for("snice:registered-elements-set");let rt=0;class ot{constructor(t={},e=[],n="",r={},o){if(this[Z]=new WeakMap,this[tt]=new Set,this[et]=!1,this.id=rt++,this.application=t,this.navigation={placards:e,route:n,params:r},o&&"function"==typeof o.create)this.fetch=o.create(this);else{if("function"!=typeof fetch)throw new Error("No fetch implementation available");this.fetch=fetch.bind(this)}}[(Z=B,tt=nt,et=W,H)](t,e){this[B].set(t,e),this[nt].add(t)}[G](t){this[B].delete(t),this[nt].delete(t)}[X](t,e,n,r){this.application=t,this.navigation.placards=e,this.navigation.route=n,this.navigation.params=r,this.notify()}update(){this.notify()}notify(){if(this[W])return;this[W]=!0;const t=this[nt],e=this[B];for(const n of t){const t=e.get(n);if(t&&"function"==typeof n[t])try{n[t](this)}catch(e){console.error(`Error calling @context method ${t}:`,e)}}this[W]=!1}[Q](t){const e=this[B].get(t);e&&"function"==typeof t[e]&&t[e](this)}}function st(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 it(t,e,n,r){switch(e.type||st(r)){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 Y:return Y.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 at(t,e){return"string"==typeof t.attribute?t.attribute:e.toLowerCase()}function ct(t,e){return t[e]||(t[e]=new Set),t[e]}function lt(t,e){return t[e]||(t[e]={}),t[e]}function ut(t,e,n,r,o){const s=e[S];if(s){if(s.has(n))for(const e of s.get(n))try{e.method.call(t,r,o,n)}catch(t){console.error(`Error in @watch('${n}') method ${e.methodName}:`,t)}if(s.has("*"))for(const e of s.get("*"))try{e.method.call(t,r,o,n)}catch(t){console.error(`Error in @watch('*') method ${e.methodName}:`,t)}}}function ht(t,e){let n=null;return function(...r){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r),n=null},e)}}function dt(t,e){let n=0,r=null;return function(...o){const s=Date.now(),i=e-(s-n);if(i<=0)return r&&(clearTimeout(r),r=null),n=s,t.apply(this,o);r||(r=setTimeout(()=>{n=Date.now(),r=null,t.apply(this,o)},i))}}const mt=new Map;function ft(t,e){const n=t.constructor[k];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].observers||(t[y].observers=[]):t[y]={events:[],channels:[],observers:[]};for(const r of n){const n=r.method.bind(t),o=r.options?.throttle?dt(n,r.options.throttle):n;switch(r.type){case"intersection":pt(t,e,r,o);break;case"resize":yt(t,e,r,o);break;case"media":gt(t,e,r,o);break;case"mutation":bt(t,e,r,o);break;default:console.warn(`Unknown observer type: ${r.type}`)}}}}function pt(t,e,n,r){const o={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===r(e)&&s&&s.unobserve(e.target)}catch(t){console.error(`Error in intersection observer ${n.methodName}:`,t)}},o),i=n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e];i.forEach(t=>s.observe(t)),t[y].observers.push(()=>{i.forEach(t=>s.unobserve(t)),0===s.takeRecords().length&&s.disconnect()})}function yt(t,e,n,r){const o=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{r(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:o})}),t[y].observers.push(()=>{s.disconnect()})}function gt(t,e,n,r){const o=n.target;if(!o)return void console.warn("Media query observer requires a query string");let s=mt.get(o);if(!s)try{s=window.matchMedia(o),mt.set(o,s)}catch(t){return void console.error(`Invalid media query: ${o}`,t)}const i=t=>{try{r(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[y].observers.push(()=>{s.removeEventListener("change",a)})):(s.addListener(a),t[y].observers.push(()=>{s.removeListener(a)}))}function bt(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[y].observers.push(()=>{u.disconnect()})}function vt(t){if(t[y]?.observers){for(const e of t[y].observers)e();t[y].observers=[]}}function wt(t,e){const n=t.constructor[i];if(n){t[y]||(t[y]={events:[],channels:[]});for(const r of n){const n=r.method.bind(t),o=`@request/${r.channelName}`;let s,i,a=0;const c=(t=>r.options?.debounce?(...e)=>new Promise((n,o)=>{clearTimeout(s),s=setTimeout(async()=>{try{n(await t(...e))}catch(t){o(t)}},r.options.debounce)}):r.options?.throttle?(...e)=>{const n=Date.now(),o=r.options.throttle-(n-a);return o<=0?(clearTimeout(i),a=n,t(...e)):i?Promise.resolve(void 0):new Promise((n,r)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{n(await t(...e))}catch(t){r(t)}},o)})}:t)(n),l=t=>{const{data:e,discovery:n,payload:o}=t.detail;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.resolve(),Promise.resolve(c(o)).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t),console.error(`Error in response handler ${r.methodName}:`,t)})};e.addEventListener(o,l),t[y].channels.push(()=>{e.removeEventListener(o,l)})}}}function St(t){if(t[y]?.channels){for(const e of t[y].channels)e();t[y].channels=[]}}const Tt=Symbol.for("snice:html-result"),Et=Symbol.for("snice:css-result");function Nt(t){return t&&t._$litType$===Tt}const At=Symbol.for("snice:nothing"),_t=Symbol.for("snice:unsafe-html");const Ct=`snice$${Math.random().toFixed(9).slice(2)}$`,xt="?"+Ct,Ot=`<${xt}>`,kt=new RegExp(Ct,"g"),Lt=new WeakMap,It=Symbol("not-committed"),$t=Symbol.for("snice:no-change"),Mt=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class Rt{constructor(t,e,n){this.parts=[],this.element=e;const r=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let o=0;const s=[];let i;for(;null!==(i=r.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(Ct)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-if",index:o++,element:t}));continue}if("case"===e){const e=t.getAttribute("value");e&&e.includes(Ct)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-case",index:o++,element:t}));continue}if(t.hasAttributes()){const e=t.attributes,r=[];for(let s=0;s<e.length;s++){const i=e[s],a=i.value;if(a.includes(Ct)){r.push(i);const e=n[o]||i.name,s=a.split(Ct),c=s.length-1;e.startsWith("@@")||e.startsWith("@")?(this.parts.push({type:"event",index:o,name:e.slice(1),element:t}),o+=1):e.startsWith(".")?(this.parts.push({type:"property",index:o,name:e.slice(1),element:t}),o+=1):e.startsWith("?")?(this.parts.push({type:"boolean-attribute",index:o,name:e.slice(1),element:t}),o+=1):(this.parts.push({type:"attribute",index:o,name:i.name,element:t,attrStrings:s}),o+=c)}}for(const e of r)t.removeAttribute(e.name)}}else if(i.nodeType===Node.COMMENT_NODE){const t=i;if(t.data===xt){const e=t.parentNode,n=document.createComment("");e.insertBefore(n,t.nextSibling),this.parts.push({type:"node",index:o++,startNode:t,endNode:n})}}else if(i.nodeType===Node.TEXT_NODE){const t=i,e=t.data;if(e.includes(Ct)){const n=t.parentNode,r=e.split(kt),i=r.length-1;for(let e=0;e<i;e++){n.insertBefore(document.createTextNode(r[e]),t);const s=document.createComment(""),i=document.createComment("");n.insertBefore(s,t),n.insertBefore(i,t),this.parts.push({type:"node",index:o++,startNode:s,endNode:i})}""!==r[i]?t.data=r[i]:s.push(t)}}for(const t of s)t.parentNode?.removeChild(t)}}class Dt{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=Lt.get(e);if(n)return n;const r=[],o=[];let s=!1,i=!1,a="",c="";for(let t=0;t<e.length;t++){const n=e[t];if(r.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)o.push(c),r.push(Ct);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(),o.push(c),r.push(Ct)}else n.match(/<(if|case)\s*$/)?(c="value",o.push("value"),r.push(`value="${Ct}"`)):(o.push(""),r.push(Ct))}else o.push(""),r.push(Ot)}}const l=r.join(""),u=document.createElement("template");u.innerHTML=l;const h=new Rt(t,u,o);return Lt.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 r=t.currentNode,o=e.currentNode;for(;r&&o;)n.set(r,o),r=t.nextNode(),o=e.nextNode();for(let t=0;t<this.template.parts.length;t++){const e=this.template.parts[t];let r;switch(e.type){case"node":const t=n.get(e.startNode),o=n.get(e.endNode);r=new qt(t,o);break;case"attribute":const s=n.get(e.element);r=new Ft(s,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);r=new Vt(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);r=new jt(a,e.name);break;case"event":const c=n.get(e.element);r=new Ut(c,e.name);break;case"conditional-if":const l=n.get(e.element);r=new Gt(l);break;case"conditional-case":const u=n.get(e.element);r=new Qt(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(r),r instanceof Gt||r instanceof Qt?this.conditionalParts.push({part:r,index:e.index}):this.regularParts.push({part:r,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 Ft&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class Pt{}class qt extends Pt{constructor(t,e){super(),this._committedValue=It,this.startNode=t,this.endNode=e}commit(t){if(t!==$t)return t===At||null==t||""===t?(this._committedValue!==At&&this._clear(),void(this._committedValue=At)):void(Mt(t)?t!==this._committedValue&&this._commitText(t):Nt(t)?this._commitTemplateResult(t):!function(t){return t&&t._$litType$===_t}(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!==It&&this._committedValue!==At&&Mt(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 Dt){const n=Lt.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new Dt(t),r=n.renderFragment();this._insertBefore(r),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof qt||(this._clear(),this._committedValue=[]);const e=this._committedValue;let n=0;for(const r of t){let t;if(n>=e.length){const n=document.createComment(""),r=document.createComment("");this._insertBefore(n),this._insertBefore(r),t=new qt(n,r),e.push(t)}else t=e[n];t.commit(r),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=At}clear(){this._clear()}}class Ft extends Pt{constructor(t,e,n){super(),this._committedValue=It,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill(It),this.strings=n):this._committedValue=It}commit(t,e=0){let n,r=!1;if(void 0===this.strings){if(t===$t)return;if(r=!Mt(t)||t!==this._committedValue&&t!==$t,!r)return;this._committedValue=t,n=t}else{const o=t,s=this._committedValue;n=this.strings[0];for(let t=0;t<this.strings.length-1;t++){let i=o[e+t];i===$t&&(i=s[t]),r=r||!Mt(i)||i!==s[t],i===At?n=At:n!==At&&(n=n+(i??"")+this.strings[t+1]),s[t]=i}if(!r)return}this._commitValue(n)}_commitValue(t){t===At||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class Vt extends Pt{constructor(t,e){super(),this._committedValue=It,this.element=t,this.name=e}commit(t){t!==$t&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===At?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=It}}class jt extends Pt{constructor(t,e){super(),this._committedValue=It,this.element=t,this.name=e}commit(t){if(t===$t)return;const e=!!t&&t!==At;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=It}}class Ut extends Pt{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]),r=e.indexOf("."),o=n?e.indexOf(":"):-1,s=r>0&&o>0?Math.min(r,o):Math.max(r,o);if(s>0){const t=e.substring(0,s),n=e.substring(s+1);this.eventName=t,this.keyFilter=zt(n)}else this.eventName=e}commit(t){if(t===$t)return;if(t===At&&(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=r=>{n&&!Wt(r,n)||t.call(e,r)},this.element.addEventListener(this.eventName,this.listener)}clear(){this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null)}}function zt(t){const e=t.startsWith("~");e&&(t=t.substring(1));const n=t.split("+"),r={key:"",anyModifiers:e};for(const t of n){const e=t.toLowerCase();"ctrl"===e||"control"===e?r.ctrl=!0:"alt"===e?r.alt=!0:"shift"===e?r.shift=!0:"meta"===e||"cmd"===e||"command"===e?r.meta=!0:r.key=Bt(t)}return r}function Bt(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 Wt(t,e){if(t.key!==e.key)return!1;if(e.anyModifiers)return!0;const n=e.ctrl?t.ctrlKey:!t.ctrlKey,r=e.alt?t.altKey:!t.altKey,o=e.shift?t.shiftKey:!t.shiftKey,s=e.meta?t.metaKey:!t.metaKey;return n&&r&&o&&s}const Ht=Symbol("not-set");class Gt extends Pt{constructor(t){super(),this.value=Ht,this.fragment=null,this.ifElement=t,this.ifElement.style.display="contents"}commit(t){const e=Boolean(t);if(this.value!==t)if(this.value=t,e)this.fragment&&this.fragment.hasChildNodes()&&this.ifElement.appendChild(this.fragment);else for(this.fragment||(this.fragment=document.createDocumentFragment());this.ifElement.firstChild;)this.fragment.appendChild(this.ifElement.firstChild)}clear(){for(this.fragment||(this.fragment=document.createDocumentFragment());this.ifElement.firstChild;)this.fragment.appendChild(this.ifElement.firstChild)}}class Qt extends Pt{constructor(t){super(),this.value=Ht,this.childrenMap=new Map,this.fragments=new Map,this.defaultChild=null,this.currentChild=null,this.caseElement=t,this.caseElement.style.display="contents";for(const t of Array.from(this.caseElement.children)){const e=t.tagName.toLowerCase();if("when"===e){t.style.display="contents";const e=t.getAttribute("value")||"";this.childrenMap.set(e,t);const n=document.createDocumentFragment();n.appendChild(t),this.fragments.set(t,n)}else if("default"===e){t.style.display="contents",this.defaultChild=t;const e=document.createDocumentFragment();e.appendChild(t),this.fragments.set(t,e)}}}commit(t){if(this.value===t)return;this.value=t;const e=String(t);if(this.currentChild){const t=this.fragments.get(this.currentChild);t&&!t.hasChildNodes()&&t.appendChild(this.currentChild)}const n=this.childrenMap.get(e)||this.defaultChild;if(n){const t=this.fragments.get(n);t&&t.hasChildNodes()&&this.caseElement.appendChild(t),this.currentChild=n}}clear(){if(this.currentChild){const t=this.fragments.get(this.currentChild);t&&!t.hasChildNodes()&&t.appendChild(this.currentChild),this.currentChild=null}}}const Kt=n("on-handlers");function Jt(t,e){let n=0;return function(...r){const o=Date.now();o-n>=e&&(n=o,t.apply(this,r))}}const Xt=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function Yt(t,e){const n=t.constructor[Kt];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].events?t[y].events.length>0&&Zt(t):t[y].events=[]:t[y]={events:[],channels:[],observers:[]};for(const r of n){const n=t[r.methodName];let o=n?n.bind(t):r.method.bind(t);const s=r.options||{},i=["keydown","keyup","keypress"].includes(r.eventName.split(".")[0].split(":")[0]),a=r.eventName.indexOf("."),c=i?r.eventName.indexOf(":"):-1,l=a>0&&c>0?Math.min(a,c):Math.max(a,c),u=l>0?r.eventName.substring(0,l):r.eventName,h=l>0?r.eventName.substring(l+1):null;s.debounce&&s.debounce>0?o=ht(o,s.debounce):s.throttle&&s.throttle>0&&(o=Jt(o,s.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=zt(h));const m=(t=>d?e=>{Wt(e,d)&&t(e)}:t)(o);if(r.selector){const n=e.shadowRoot||e,o=t=>{const e=t.target;if(e.matches&&e.matches(r.selector)&&e||e.closest&&e.closest(r.selector)||null){s.preventDefault&&t.preventDefault(),s.stopPropagation&&(t.stopPropagation(),t.stopImmediatePropagation());try{m(t)}catch(t){console.error(`Error in event handler ${r.methodName}:`,t)}}},i=Xt.has(u),a={capture:void 0!==s.capture?s.capture:i,once:s.once||!1,passive:s.passive||!1};n.addEventListener(u,o,a),t[y].events.push({target:n,eventName:u,handler:o,options:a})}else{const n=e.shadowRoot,o=Symbol.for(`snice:event-handled:${r.methodName}`),i=t=>{if(!t[o]){t[o]=!0,s.preventDefault&&t.preventDefault(),s.stopPropagation&&t.stopPropagation();try{m(t)}catch(t){console.error(`Error in event handler ${r.methodName}:`,t)}}},a={capture:s.capture||!1,once:s.once||!1,passive:s.passive||!1};n&&(n.addEventListener(u,i,a),t[y].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[y].events.push({target:e,eventName:u,handler:i,options:a})}}}}function Zt(t){if(t[y]?.events){for(const{target:e,eventName:n,handler:r,options:o}of t[y].events)e.removeEventListener(n,r,o);t[y].events=[]}}class te{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}}}async function ee(t,n){const r=t[h],s=t[d],i=t[p];if(void 0!==i&&i!==n)return;if(s===n&&r)return;r&&await ne(t);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;e.controllerIdCounter+=1;const u=e.controllerIdCounter,y=new te;l[o]=!0,l[m]=u,l.element=t;const g=t[E];void 0!==g&&(l[E]=g),t[h]=l,t[d]=n,t[f]=y,await t.ready,await y.runOperation(async()=>{await l.attach(t)}),ft(l,t),wt(l,t),Yt(l,t),t.dispatchEvent(new CustomEvent("controller-attached",{detail:{name:n,controller:l}}))}async function ne(t){const e=t[h],n=t[d],r=t[f];e&&(r?await r.runOperation(async()=>{await e.detach(t)}):await e.detach(t),e.element=null,vt(e),St(e),Zt(e),r&&await r.cleanup(),delete e[E],delete t[h],delete t[d],delete t[f],t.dispatchEvent(new CustomEvent("controller-detached",{detail:{name:n,controller:e}})))}function re(){if(globalThis.sniceNativeControllersInitialized)return;function t(t){if(!(t instanceof HTMLElement))return;if(t.tagName.includes("-"))return;if(t[s])return;const e=t.getAttribute("controller"),n=t[p];if(e!==n){if(!e)return delete t[p],delete t[d],void ne(t).catch(t=>{console.error("Failed to detach controller from native element:",t)});t[p]=e,t.ready||(t.ready=Promise.resolve()),n&&ne(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),ee(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]:not([class*="-"])').forEach(t))})});function n(){document.querySelectorAll('[controller]:not([class*="-"])').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 oe=n("context-handlers");function se(t){const e=t.constructor[oe];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[U];if(n){t[z]=n;for(const r of e){const{methodName:e,method:o,options:s}=r,i=`__wrapped_${e}`;t[i]=function(e){if(s.once&&t[J])return;const n=()=>{if(o.call(t,e),s.once){t[J]=!0;const e=t[z];e&&"function"==typeof e[G]&&e[G](t)}};if(s.debounce)return clearTimeout(t[K]),void(t[K]=setTimeout(n,s.debounce));if(s.throttle){const e=Date.now();return void(e-(t[K]||0)>=s.throttle&&(t[K]=e,n()))}n()},"function"==typeof n[H]&&n[H](t,i)}}}const ie=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?ce(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){ce(e,e[D]||{})}}};function ae(t){const e=t[F];if(!e||0===e.length)return;const n=[...e];t[F]=[],n.forEach(t=>t())}function ce(t,e,n){const r=t[R];if(r&&(!e.once||!t[P]))try{const o=void 0!==n?n:r.call(t);if(t.shadowRoot||t.attachShadow({mode:"open"}),!1===e.differential)return"string"!=typeof o?void console.warn("Render method with differential: false must return a string"):(t.shadowRoot.innerHTML=o,void ae(t));if(!Nt(o))return void console.warn("Render method must return html`` template result");let s=t[P];if(s&&s.isSameTemplate(o.strings))return s.update(o.values),void ae(t);s&&(t.shadowRoot.innerHTML=""),s=new Dt(o),t[P]=s,t.shadowRoot.appendChild(s.renderFragment()),s.update(o.values),ae(t)}catch(t){console.error("Error rendering element:",t)}}function le(t,e=!1){const n=t[D]||{};if(!n.once||!t[P])if(e)ce(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(()=>{ie.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[q]||(t[q]={lastThrottle:0});const e=t[q],r=Date.now();if(0===e.lastThrottle||r-e.lastThrottle>=n.throttle)return e.lastThrottle=r,void ie.schedule(t,n);if(!e.throttleTimer){const o=n.throttle-(r-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),ie.schedule(t,n)},o)}return}ie.schedule(t,n)}}function ue(t){const e=t[V];if(e&&!t[j]){t[j]=!0;try{const r=e.call(t);if(!(n=r)||n._$litType$!==Et)return void console.warn("Styles method must return css`` template result");t.shadowRoot||t.attachShadow({mode:"open"});const o=new CSSStyleSheet;if(o.replaceSync("if, case { display: contents; }"),!t.shadowRoot)return;if(r.styleSheet&&"adoptedStyleSheets"in t.shadowRoot)return void(t.shadowRoot.adoptedStyleSheets=[o,r.styleSheet]);const s=document.createElement("style");s.textContent="if, case { display: contents; }\n"+r.cssText,t.shadowRoot.appendChild(s)}catch(t){console.error("Error applying styles:",t)}var n}}function he(t){t.prototype[s]=!0;const e=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback,r=t.prototype.attributeChangedCallback,o=t.observedAttributes||[];o.includes("controller")||o.push("controller");const i=t[g];if(i)for(const[t,e]of i){if(!1===e.attribute)continue;const n=at(e,t);o.includes(n)||o.push(n)}Object.defineProperty(t,"observedAttributes",{get:()=>o,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get(){return this[a]||(this[a]=new Promise(t=>{this[c]=t})),this[a]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[l]},set(t){const e=this[l];this[l]=t,t!==e&&(t?ee(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):e&&ne(this).catch(t=>{console.error("Failed to detach controller:",t)}))},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[a]||(this[a]=new Promise(t=>{this[c]=t})),this[u]){Yt(this,this),wt(this,this),se(this);try{ft(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName} on reconnection:`,t)}return void(e&&e.call(this))}this[w]=!0;const n=t[g];if(n)for(const[t,e]of n){if(!1===e.attribute)continue;const n=at(e,t);if(!this.hasAttribute(n))continue;const r=this.getAttribute(n);ct(this,T).add(t),e.type===Boolean&&""===r&&this.setAttribute(n,"true"),this[t]=it(r,e)}if(this[v]){for(const[t,e]of Array.from(this[v].entries())){const r=n?.get(t),o=at(r||{},t);this[v].delete(t),this.hasAttribute(o)||(this[t]=e)}delete this[v]}ue(this),Yt(this,this),wt(this,this),se(this),this[u]=!0,e&&e.call(this);const r=t[_];await new Promise(t=>queueMicrotask(t)),this[R]&&le(this,!0);try{ft(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}if(r)for(const t of r)try{await t.method.call(this)}catch(e){console.error(`Error in @ready handler ${t.methodName}:`,e)}this[c]&&(this[c](),this[c]=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[l]&&ne(this).catch(t=>{console.error("Failed to detach controller:",t)}),Zt(this),St(this),function(t){const e=t.constructor[oe];if(!e||!Array.isArray(e)||0===e.length)return;for(const n of e)n.options.debounce&&t[K]&&(clearTimeout(t[K]),delete t[K]),delete t[`__wrapped_${n.methodName}`];const n=t[z];n&&"function"==typeof n[G]&&n[G](t),delete t[z],delete t[J]}(this),vt(this)},t.prototype.attributeChangedCallback=function(e,n,o){if(r?.call(this,e,n,o),"controller"===e)return void(this.controller=o);const s=t[g];if(s)for(const[n,r]of s){if(at(r,n).toLowerCase()!==e.toLowerCase())continue;const s=this[b]?.[n],i=it(o,r,s,void 0);if(s===i)break;ct(this,T).add(n),lt(this,b)[n]=i,this[L]?.has(e.toLowerCase())||(ut(this,t,n,s,i),this[R]&&this[u]&&le(this));break}},t.prototype.connectedMoveCallback=async function(){const e=t[x];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[O];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 de(t,e,n,r){if(n.metadata&&n.metadata[g]){e[g]||(e[g]=new Map);for(const[t,r]of n.metadata[g])e[g].set(t,r)}return r?.formAssociated&&(e.formAssociated=!0),he(e),customElements.get(t)?(globalThis.SNICE_DEBUG&&console.warn(`[snice] "${t}" is already registered. Skipping.`),e):(customElements.define(t,e),e)}function me(t){return!0===t[o]&&t.element?t.element:t}function fe(t,e,n,r,o){const s=r.name,i=`__${e}_init_${s}`;r.addInitializer(function(){const e=this.constructor;e[i]||(e[i]=!0,e[t]||(e[t]=[]),e[t].push({methodName:s,method:n,...o}))})}function pe(t,e,n){return function(r={}){return function(o,s){fe(t,n,o,s,{options:r});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)=>o.apply(this,t);if(r.debounce>0)return clearTimeout(n.debounceTimer),void(n.debounceTimer=setTimeout(()=>s(...t),r.debounce));if(r.throttle>0){const e=Date.now();if(0===n.lastThrottleCall||e-n.lastThrottleCall>=r.throttle)return n.lastThrottleCall=e,s(...t);if(!n.throttleTimer){const o=r.throttle-(e-n.lastThrottleCall);n.throttleTimer=setTimeout(()=>{n.throttleTimer=null,n.lastThrottleCall=Date.now(),s(...t)},o)}return}return s(...t)}}}}const ye=pe(x,I,"moved"),ge=pe(O,$,"adopted");
|
|
13
|
+
*/globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0});const e=globalThis.snice;function n(t){return Symbol.for(`snice:${t}`)}const r=n("is-controller-class"),o=n("is-controller-instance"),s=n("is-element-class"),i=n("channel-handlers"),a=n("ready-promise"),c=n("ready-resolve"),l=n("controller"),u=n("initialized"),h=n("controller-key"),d=n("controller-name"),m=n("controller-id"),f=n("controller-operations"),p=n("native-controller"),y=n("cleanup"),g=n("properties"),b=n("property-values"),v=n("pre-init-property-values"),w=n("properties-initialized"),N=n("property-watchers"),S=n("explicitly-set-properties"),T=n("router-context"),E=n("page-transition"),A=n("created-at"),_=n("ready-handlers"),x=n("dispose-handlers"),C=n("moved-handlers"),O=n("adopted-handlers"),L=n("observers"),k=n("setting-from-property"),$=n("moved-timers"),I=n("adopted-timers"),R=n("dispatch-timers"),M=n("render-method"),D=n("render-options"),P=n("render-instance"),F=n("render-timers"),q=n("render-callbacks"),B=n("styles-method"),V=n("styles-applied"),j=n("context-handler"),U=n("navigation-context-instance"),z=n("registered-elements"),H=n("is-updating"),W=n("context-register"),K=n("context-unregister"),G=n("context-notify-element"),Q=n("context-timer"),J=n("context-called"),X=n("context-update");class Y{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(Y.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${Y.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(Y.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(Y.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var Z,tt,et;const nt=Symbol.for("snice:registered-elements-set");let rt=0;class ot{constructor(t={},e=[],n="",r={},o){if(this[Z]=new WeakMap,this[tt]=new Set,this[et]=!1,this.id=rt++,this.application=t,this.navigation={placards:e,route:n,params:r},o&&"function"==typeof o.create)this.fetch=o.create(this);else{if("function"!=typeof fetch)throw new Error("No fetch implementation available");this.fetch=fetch.bind(this)}}[(Z=z,tt=nt,et=H,W)](t,e){this[z].set(t,e),this[nt].add(t)}[K](t){this[z].delete(t),this[nt].delete(t)}[X](t,e,n,r){this.application=t,this.navigation.placards=e,this.navigation.route=n,this.navigation.params=r,this.notify()}update(){this.notify()}notify(){if(this[H])return;this[H]=!0;const t=this[nt],e=this[z];for(const n of t){const t=e.get(n);if(t&&"function"==typeof n[t])try{n[t](this)}catch(e){console.error(`Error calling @context method ${t}:`,e)}}this[H]=!1}[G](t){const e=this[z].get(t);e&&"function"==typeof t[e]&&t[e](this)}}function st(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 it(t,e,n,r){switch(e.type||st(r)){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 Y:return Y.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 at(t,e){return"string"==typeof t.attribute?t.attribute:e.toLowerCase()}function ct(t,e){return t[e]||(t[e]=new Set),t[e]}function lt(t,e){return t[e]||(t[e]={}),t[e]}function ut(t,e,n,r,o){const s=e[N];if(s){if(s.has(n))for(const e of s.get(n))try{e.method.call(t,r,o,n)}catch(t){console.error(`Error in @watch('${n}') method ${e.methodName}:`,t)}if(s.has("*"))for(const e of s.get("*"))try{e.method.call(t,r,o,n)}catch(t){console.error(`Error in @watch('*') method ${e.methodName}:`,t)}}}function ht(t,e){let n=null;return function(...r){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r),n=null},e)}}function dt(t,e){let n=0,r=null;return function(...o){const s=Date.now(),i=e-(s-n);if(i<=0)return r&&(clearTimeout(r),r=null),n=s,t.apply(this,o);r||(r=setTimeout(()=>{n=Date.now(),r=null,t.apply(this,o)},i))}}const mt=new Map;function ft(t,e){const n=t.constructor[L];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].observers||(t[y].observers=[]):t[y]={events:[],channels:[],observers:[]};for(const r of n){const n=r.method.bind(t),o=r.options?.throttle?dt(n,r.options.throttle):n;switch(r.type){case"intersection":pt(t,e,r,o);break;case"resize":yt(t,e,r,o);break;case"media":gt(t,e,r,o);break;case"mutation":bt(t,e,r,o);break;default:console.warn(`Unknown observer type: ${r.type}`)}}}}function pt(t,e,n,r){const o={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===r(e)&&s&&s.unobserve(e.target)}catch(t){console.error(`Error in intersection observer ${n.methodName}:`,t)}},o),i=n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e];i.forEach(t=>s.observe(t)),t[y].observers.push(()=>{i.forEach(t=>s.unobserve(t)),0===s.takeRecords().length&&s.disconnect()})}function yt(t,e,n,r){const o=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{r(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:o})}),t[y].observers.push(()=>{s.disconnect()})}function gt(t,e,n,r){const o=n.target;if(!o)return void console.warn("Media query observer requires a query string");let s=mt.get(o);if(!s)try{s=window.matchMedia(o),mt.set(o,s)}catch(t){return void console.error(`Invalid media query: ${o}`,t)}const i=t=>{try{r(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[y].observers.push(()=>{s.removeEventListener("change",a)})):(s.addListener(a),t[y].observers.push(()=>{s.removeListener(a)}))}function bt(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[y].observers.push(()=>{u.disconnect()})}function vt(t){if(t[y]?.observers){for(const e of t[y].observers)e();t[y].observers=[]}}function wt(t,e){const n=t.constructor[i];if(n){t[y]||(t[y]={events:[],channels:[]});for(const r of n){const n=r.method.bind(t),o=`@request/${r.channelName}`;let s,i,a=0;const c=(t=>r.options?.debounce?(...e)=>new Promise((n,o)=>{clearTimeout(s),s=setTimeout(async()=>{try{n(await t(...e))}catch(t){o(t)}},r.options.debounce)}):r.options?.throttle?(...e)=>{const n=Date.now(),o=r.options.throttle-(n-a);return o<=0?(clearTimeout(i),a=n,t(...e)):i?Promise.resolve(void 0):new Promise((n,r)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{n(await t(...e))}catch(t){r(t)}},o)})}:t)(n),l=t=>{const{data:e,discovery:n,payload:o}=t.detail;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.resolve(),Promise.resolve(c(o)).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t),console.error(`Error in response handler ${r.methodName}:`,t)})};e.addEventListener(o,l),t[y].channels.push(()=>{e.removeEventListener(o,l)})}}}function Nt(t){if(t[y]?.channels){for(const e of t[y].channels)e();t[y].channels=[]}}const St=Symbol.for("snice:html-result"),Tt=Symbol.for("snice:css-result");function Et(t){return t&&t._$litType$===St}const At=Symbol.for("snice:nothing"),_t=Symbol.for("snice:unsafe-html");const xt=`snice$${Math.random().toFixed(9).slice(2)}$`,Ct="?"+xt,Ot=`<${Ct}>`,Lt=new RegExp(xt,"g"),kt=new WeakMap,$t=Symbol("not-committed"),It=Symbol.for("snice:no-change"),Rt=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class Mt{constructor(t,e,n){this.parts=[],this.element=e;const r=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let o=0;const s=[];let i;for(;null!==(i=r.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(xt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-if",index:o++,element:t}));continue}if("case"===e){const e=t.getAttribute("value");e&&e.includes(xt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-case",index:o++,element:t}));continue}if(t.hasAttributes()){const e=t.attributes,r=[];for(let s=0;s<e.length;s++){const i=e[s],a=i.value;if(a.includes(xt)){r.push(i);const e=n[o]||i.name,s=a.split(xt),c=s.length-1;e.startsWith("@@")||e.startsWith("@")?(this.parts.push({type:"event",index:o,name:e.slice(1),element:t}),o+=1):e.startsWith(".")?(this.parts.push({type:"property",index:o,name:e.slice(1),element:t}),o+=1):e.startsWith("?")?(this.parts.push({type:"boolean-attribute",index:o,name:e.slice(1),element:t}),o+=1):(this.parts.push({type:"attribute",index:o,name:i.name,element:t,attrStrings:s}),o+=c)}}for(const e of r)t.removeAttribute(e.name)}}else if(i.nodeType===Node.COMMENT_NODE){const t=i;if(t.data===Ct){const e=t.parentNode,n=document.createComment("");e.insertBefore(n,t.nextSibling),this.parts.push({type:"node",index:o++,startNode:t,endNode:n})}}else if(i.nodeType===Node.TEXT_NODE){const t=i,e=t.data;if(e.includes(xt)){const n=t.parentNode,r=e.split(Lt),i=r.length-1;for(let e=0;e<i;e++){n.insertBefore(document.createTextNode(r[e]),t);const s=document.createComment(""),i=document.createComment("");n.insertBefore(s,t),n.insertBefore(i,t),this.parts.push({type:"node",index:o++,startNode:s,endNode:i})}""!==r[i]?t.data=r[i]:s.push(t)}}for(const t of s)t.parentNode?.removeChild(t)}}class Dt{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=kt.get(e);if(n)return n;const r=[],o=[];let s=!1,i=!1,a="",c="";for(let t=0;t<e.length;t++){const n=e[t];if(r.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)o.push(c),r.push(xt);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(),o.push(c),r.push(xt)}else n.match(/<(if|case)\s*$/)?(c="value",o.push("value"),r.push(`value="${xt}"`)):(o.push(""),r.push(xt))}else o.push(""),r.push(Ot)}}const l=r.join(""),u=document.createElement("template");u.innerHTML=l;const h=new Mt(t,u,o);return kt.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 r=t.currentNode,o=e.currentNode;for(;r&&o;)n.set(r,o),r=t.nextNode(),o=e.nextNode();for(let t=0;t<this.template.parts.length;t++){const e=this.template.parts[t];let r;switch(e.type){case"node":const t=n.get(e.startNode),o=n.get(e.endNode);r=new Ft(t,o);break;case"attribute":const s=n.get(e.element);r=new qt(s,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);r=new Bt(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);r=new Vt(a,e.name);break;case"event":const c=n.get(e.element);r=new jt(c,e.name);break;case"conditional-if":const l=n.get(e.element);r=new Kt(l);break;case"conditional-case":const u=n.get(e.element);r=new Gt(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(r),r instanceof Kt||r instanceof Gt?this.conditionalParts.push({part:r,index:e.index}):this.regularParts.push({part:r,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 qt&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class Pt{}class Ft extends Pt{constructor(t,e){super(),this._committedValue=$t,this.startNode=t,this.endNode=e}commit(t){if(t!==It)return t===At||null==t||""===t?(this._committedValue!==At&&this._clear(),void(this._committedValue=At)):void(Rt(t)?t!==this._committedValue&&this._commitText(t):Et(t)?this._commitTemplateResult(t):!function(t){return t&&t._$litType$===_t}(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!==$t&&this._committedValue!==At&&Rt(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 Dt){const n=kt.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new Dt(t),r=n.renderFragment();this._insertBefore(r),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof Ft||(this._clear(),this._committedValue=[]);const e=this._committedValue;let n=0;for(const r of t){let t;if(n>=e.length){const n=document.createComment(""),r=document.createComment("");this._insertBefore(n),this._insertBefore(r),t=new Ft(n,r),e.push(t)}else t=e[n];t.commit(r),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=At}clear(){this._clear()}}class qt extends Pt{constructor(t,e,n){super(),this._committedValue=$t,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill($t),this.strings=n):this._committedValue=$t}commit(t,e=0){let n,r=!1;if(void 0===this.strings){if(t===It)return;if(r=!Rt(t)||t!==this._committedValue&&t!==It,!r)return;this._committedValue=t,n=t}else{const o=t,s=this._committedValue;n=this.strings[0];for(let t=0;t<this.strings.length-1;t++){let i=o[e+t];i===It&&(i=s[t]),r=r||!Rt(i)||i!==s[t],i===At?n=At:n!==At&&(n=n+(i??"")+this.strings[t+1]),s[t]=i}if(!r)return}this._commitValue(n)}_commitValue(t){t===At||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class Bt extends Pt{constructor(t,e){super(),this._committedValue=$t,this.element=t,this.name=e}commit(t){t!==It&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===At?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=$t}}class Vt extends Pt{constructor(t,e){super(),this._committedValue=$t,this.element=t,this.name=e}commit(t){if(t===It)return;const e=!!t&&t!==At;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=$t}}class jt extends Pt{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]),r=e.indexOf("."),o=n?e.indexOf(":"):-1,s=r>0&&o>0?Math.min(r,o):Math.max(r,o);if(s>0){const t=e.substring(0,s),n=e.substring(s+1);this.eventName=t,this.keyFilter=Ut(n)}else this.eventName=e}commit(t){if(t===It)return;if(t===At&&(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=r=>{n&&!Ht(r,n)||t.call(e,r)},this.element.addEventListener(this.eventName,this.listener)}clear(){this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null)}}function Ut(t){const e=t.startsWith("~");e&&(t=t.substring(1));const n=t.split("+"),r={key:"",anyModifiers:e};for(const t of n){const e=t.toLowerCase();"ctrl"===e||"control"===e?r.ctrl=!0:"alt"===e?r.alt=!0:"shift"===e?r.shift=!0:"meta"===e||"cmd"===e||"command"===e?r.meta=!0:r.key=zt(t)}return r}function zt(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 Ht(t,e){if(t.key!==e.key)return!1;if(e.anyModifiers)return!0;const n=e.ctrl?t.ctrlKey:!t.ctrlKey,r=e.alt?t.altKey:!t.altKey,o=e.shift?t.shiftKey:!t.shiftKey,s=e.meta?t.metaKey:!t.metaKey;return n&&r&&o&&s}const Wt=Symbol("not-set");class Kt extends Pt{constructor(t){super(),this.value=Wt,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 Gt extends Pt{constructor(t){super(),this.value=Wt,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),r=n?this.branches.get(e):this.defaultBranch;this.currentKey=n?e:this.defaultBranch?"__default__":null,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 Qt=n("on-handlers");function Jt(t,e){let n=0;return function(...r){const o=Date.now();o-n>=e&&(n=o,t.apply(this,r))}}const Xt=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function Yt(t,e){const n=t.constructor[Qt];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].events?t[y].events.length>0&&Zt(t):t[y].events=[]:t[y]={events:[],channels:[],observers:[]};for(const r of n){const n=t[r.methodName];let o=n?n.bind(t):r.method.bind(t);const s=r.options||{},i=["keydown","keyup","keypress"].includes(r.eventName.split(".")[0].split(":")[0]),a=r.eventName.indexOf("."),c=i?r.eventName.indexOf(":"):-1,l=a>0&&c>0?Math.min(a,c):Math.max(a,c),u=l>0?r.eventName.substring(0,l):r.eventName,h=l>0?r.eventName.substring(l+1):null;s.debounce&&s.debounce>0?o=ht(o,s.debounce):s.throttle&&s.throttle>0&&(o=Jt(o,s.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=Ut(h));const m=(t=>d?e=>{Ht(e,d)&&t(e)}:t)(o);if(r.selector){const n=e.shadowRoot||e,o=t=>{const e=t.target;if(e.matches&&e.matches(r.selector)&&e||e.closest&&e.closest(r.selector)||null){s.preventDefault&&t.preventDefault(),s.stopPropagation&&(t.stopPropagation(),t.stopImmediatePropagation());try{m(t)}catch(t){console.error(`Error in event handler ${r.methodName}:`,t)}}},i=Xt.has(u),a={capture:void 0!==s.capture?s.capture:i,once:s.once||!1,passive:s.passive||!1};n.addEventListener(u,o,a),t[y].events.push({target:n,eventName:u,handler:o,options:a})}else{const n=e.shadowRoot,o=Symbol.for(`snice:event-handled:${r.methodName}`),i=t=>{if(!t[o]){t[o]=!0,s.preventDefault&&t.preventDefault(),s.stopPropagation&&t.stopPropagation();try{m(t)}catch(t){console.error(`Error in event handler ${r.methodName}:`,t)}}},a={capture:s.capture||!1,once:s.once||!1,passive:s.passive||!1};n&&(n.addEventListener(u,i,a),t[y].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[y].events.push({target:e,eventName:u,handler:i,options:a})}}}}function Zt(t){if(t[y]?.events){for(const{target:e,eventName:n,handler:r,options:o}of t[y].events)e.removeEventListener(n,r,o);t[y].events=[]}}class te{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}}}async function ee(t,n){const r=t[h],s=t[d],i=t[p];if(void 0!==i&&i!==n)return;if(s===n&&r)return;r&&await ne(t);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;e.controllerIdCounter+=1;const u=e.controllerIdCounter,y=new te;l[o]=!0,l[m]=u,l.element=t;const g=t[T];void 0!==g&&(l[T]=g),t[h]=l,t[d]=n,t[f]=y,await t.ready,await y.runOperation(async()=>{await l.attach(t)}),ft(l,t),wt(l,t),Yt(l,t),t.dispatchEvent(new CustomEvent("controller-attached",{detail:{name:n,controller:l}}))}async function ne(t){const e=t[h],n=t[d],r=t[f];e&&(r?await r.runOperation(async()=>{await e.detach(t)}):await e.detach(t),e.element=null,vt(e),Nt(e),Zt(e),r&&await r.cleanup(),delete e[T],delete t[h],delete t[d],delete t[f],t.dispatchEvent(new CustomEvent("controller-detached",{detail:{name:n,controller:e}})))}function re(){if(globalThis.sniceNativeControllersInitialized)return;function t(t){if(!(t instanceof HTMLElement))return;if(t.tagName.includes("-"))return;if(t[s])return;const e=t.getAttribute("controller"),n=t[p];if(e!==n){if(!e)return delete t[p],delete t[d],void ne(t).catch(t=>{console.error("Failed to detach controller from native element:",t)});t[p]=e,t.ready||(t.ready=Promise.resolve()),n&&ne(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),ee(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]:not([class*="-"])').forEach(t))})});function n(){document.querySelectorAll('[controller]:not([class*="-"])').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 oe=n("context-handlers");function se(t){const e=t.constructor[oe];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[j];if(n){t[U]=n;for(const r of e){const{methodName:e,method:o,options:s}=r,i=`__wrapped_${e}`;t[i]=function(e){if(s.once&&t[J])return;const n=()=>{if(o.call(t,e),s.once){t[J]=!0;const e=t[U];e&&"function"==typeof e[K]&&e[K](t)}};if(s.debounce)return clearTimeout(t[Q]),void(t[Q]=setTimeout(n,s.debounce));if(s.throttle){const e=Date.now();return void(e-(t[Q]||0)>=s.throttle&&(t[Q]=e,n()))}n()},"function"==typeof n[W]&&n[W](t,i)}}}const ie=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?ce(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){ce(e,e[D]||{})}}};function ae(t){const e=t[q];if(!e||0===e.length)return;const n=[...e];t[q]=[],n.forEach(t=>t())}function ce(t,e,n){const r=t[M];if(r&&(!e.once||!t[P]))try{const o=void 0!==n?n:r.call(t);if(t.shadowRoot||t.attachShadow({mode:"open"}),!1===e.differential)return"string"!=typeof o?void console.warn("Render method with differential: false must return a string"):(t.shadowRoot.innerHTML=o,void ae(t));if(!Et(o))return void console.warn("Render method must return html`` template result");let s=t[P];if(s&&s.isSameTemplate(o.strings))return s.update(o.values),void ae(t);s&&(t.shadowRoot.innerHTML=""),s=new Dt(o),t[P]=s,t.shadowRoot.appendChild(s.renderFragment()),s.update(o.values),ae(t)}catch(t){console.error("Error rendering element:",t)}}function le(t,e=!1){const n=t[D]||{};if(!n.once||!t[P])if(e)ce(t,n);else{if(void 0!==n.debounce&&n.debounce>0)return t[F]||(t[F]={}),clearTimeout(t[F].debounce),void(t[F].debounce=setTimeout(()=>{ie.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[F]||(t[F]={lastThrottle:0});const e=t[F],r=Date.now();if(0===e.lastThrottle||r-e.lastThrottle>=n.throttle)return e.lastThrottle=r,void ie.schedule(t,n);if(!e.throttleTimer){const o=n.throttle-(r-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),ie.schedule(t,n)},o)}return}ie.schedule(t,n)}}function ue(t){const e=t[B];if(e&&!t[V]){t[V]=!0;try{const r=e.call(t);if(!(n=r)||n._$litType$!==Tt)return void console.warn("Styles method must return css`` template result");if(t.shadowRoot||t.attachShadow({mode:"open"}),!t.shadowRoot)return;if(r.styleSheet&&"adoptedStyleSheets"in t.shadowRoot)return void(t.shadowRoot.adoptedStyleSheets=[r.styleSheet]);const o=document.createElement("style");o.textContent=r.cssText,t.shadowRoot.appendChild(o)}catch(t){console.error("Error applying styles:",t)}var n}}function he(t){t.prototype[s]=!0;const e=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback,r=t.prototype.attributeChangedCallback,o=t.observedAttributes||[];o.includes("controller")||o.push("controller");const i=t[g];if(i)for(const[t,e]of i){if(!1===e.attribute)continue;const n=at(e,t);o.includes(n)||o.push(n)}Object.defineProperty(t,"observedAttributes",{get:()=>o,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get(){return this[a]||(this[a]=new Promise(t=>{this[c]=t})),this[a]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[l]},set(t){const e=this[l];this[l]=t,t!==e&&(t?ee(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):e&&ne(this).catch(t=>{console.error("Failed to detach controller:",t)}))},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[a]||(this[a]=new Promise(t=>{this[c]=t})),this[u]){Yt(this,this),wt(this,this),se(this);try{ft(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName} on reconnection:`,t)}return void(e&&e.call(this))}this[w]=!0;const n=t[g];if(n)for(const[t,e]of n){if(!1===e.attribute)continue;const n=at(e,t);if(!this.hasAttribute(n))continue;const r=this.getAttribute(n);ct(this,S).add(t),e.type===Boolean&&""===r&&this.setAttribute(n,"true"),this[t]=it(r,e)}if(this[v]){for(const[t,e]of Array.from(this[v].entries())){const r=n?.get(t),o=at(r||{},t);this[v].delete(t),this.hasAttribute(o)||(this[t]=e)}delete this[v]}ue(this),Yt(this,this),wt(this,this),se(this),this[u]=!0,e&&e.call(this);const r=t[_];await new Promise(t=>queueMicrotask(t)),this[M]&&le(this,!0);try{ft(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}if(r)for(const t of r)try{await t.method.call(this)}catch(e){console.error(`Error in @ready handler ${t.methodName}:`,e)}this[c]&&(this[c](),this[c]=null)},t.prototype.disconnectedCallback=async function(){const e=t[x];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[l]&&ne(this).catch(t=>{console.error("Failed to detach controller:",t)}),Zt(this),Nt(this),function(t){const e=t.constructor[oe];if(!e||!Array.isArray(e)||0===e.length)return;for(const n of e)n.options.debounce&&t[Q]&&(clearTimeout(t[Q]),delete t[Q]),delete t[`__wrapped_${n.methodName}`];const n=t[U];n&&"function"==typeof n[K]&&n[K](t),delete t[U],delete t[J]}(this),vt(this)},t.prototype.attributeChangedCallback=function(e,n,o){if(r?.call(this,e,n,o),"controller"===e)return void(this.controller=o);const s=t[g];if(s)for(const[n,r]of s){if(at(r,n).toLowerCase()!==e.toLowerCase())continue;const s=this[b]?.[n],i=it(o,r,s,void 0);if(s===i)break;ct(this,S).add(n),lt(this,b)[n]=i,this[k]?.has(e.toLowerCase())||(ut(this,t,n,s,i),this[M]&&this[u]&&le(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[O];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 de(t,e,n,r){if(n.metadata&&n.metadata[g]){e[g]||(e[g]=new Map);for(const[t,r]of n.metadata[g])e[g].set(t,r)}return r?.formAssociated&&(e.formAssociated=!0),he(e),customElements.get(t)?(globalThis.SNICE_DEBUG&&console.warn(`[snice] "${t}" is already registered. Skipping.`),e):(customElements.define(t,e),e)}function me(t){return!0===t[o]&&t.element?t.element:t}function fe(t,e,n,r,o){const s=r.name,i=`__${e}_init_${s}`;r.addInitializer(function(){const e=this.constructor;e[i]||(e[i]=!0,e[t]||(e[t]=[]),e[t].push({methodName:s,method:n,...o}))})}function pe(t,e,n){return function(r={}){return function(o,s){fe(t,n,o,s,{options:r});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)=>o.apply(this,t);if(r.debounce>0)return clearTimeout(n.debounceTimer),void(n.debounceTimer=setTimeout(()=>s(...t),r.debounce));if(r.throttle>0){const e=Date.now();if(0===n.lastThrottleCall||e-n.lastThrottleCall>=r.throttle)return n.lastThrottleCall=e,s(...t);if(!n.throttleTimer){const o=r.throttle-(e-n.lastThrottleCall);n.throttleTimer=setTimeout(()=>{n.throttleTimer=null,n.lastThrottleCall=Date.now(),s(...t)},o)}return}return s(...t)}}}}const ye=pe(C,$,"moved"),ge=pe(O,I,"adopted");
|
|
14
14
|
/*!
|
|
15
15
|
* pica-route v1.1.2
|
|
16
16
|
* A pure URL pattern matching library compatible with route-parser API
|
|
17
17
|
* (c) 2024
|
|
18
18
|
* Released under the MIT License.
|
|
19
19
|
*/
|
|
20
|
-
class be{constructor(t){this.parsed=this.parsePattern(t)}get spec(){return this.parsed.template}parsePattern(t){let e=t,n="",r=!1;const o=t.indexOf("?");return-1!==o&&(e=t.slice(0,o),n=t.slice(o+1),e.endsWith("(")&&n.endsWith(")")&&(r=!0,e=e.slice(0,-1),n=n.slice(0,-1))),{pathSegments:this.parseSegments(e),querySegments:n?this.parseQuerySegments(n):[],queryOptional:r,template:t}}parseSegments(t){const e=[];let n=0;for(;n<t.length;){switch(t[n]){case"(":const{segments:r,endIndex:o}=this.parseOptionalGroup(t,n);e.push({type:"optional",segments:r}),n=o+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,r=e+1;for(;r<t.length&&n>0;)"("===t[r]&&n++,")"===t[r]&&n--,r++;const o=t.slice(e+1,r-1);return{segments:this.parseSegments(o),endIndex:r-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 r=0;for(;r<e.length;)if(":"===e[r]){const{name:t,endIndex:o}=this.parseIdentifier(e,r+1);n.push({type:"param",name:t}),r=o}else{const{value:t,endIndex:o}=this.parseQueryLiteral(e,r);t&&n.push({type:"literal",value:t}),r=o}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 r of n)switch(r.type){case"param":case"splat":t.add(r.name);break;case"optional":e(r.segments)}};return e(this.parsed.pathSegments),e(this.parsed.querySegments),Array.from(t)}canMatchRemainingSegments(t,e,n){let r=e;for(const e of n)if("literal"===e.type){const n=t.indexOf(e.value,r);if(-1===n)return!1;r=n+e.value.length}return!0}match(t){const[e,n]=t.split("?"),r=this.matchPath(e,this.parsed.pathSegments);if(!1===r)return!1;const o=this.matchQuery(n||"",this.parsed.querySegments);if(!1===o)return!1;const s=this.getAllParamNames(),i={};for(const t of s)i[t]=void 0;return Object.assign(i,r,o),i}matchPath(t,e){const n={};let r=0;for(let o=0;o<e.length;o++){const s=e[o],i=e.slice(o+1),a=this.matchSegment(t,r,s,i);if(!1===a)return!1;Object.assign(n,a.params),r=a.nextIndex}return!(r<t.length)&&n}matchSegment(t,e,n,r=[]){switch(n.type){case"literal":return t.slice(e,e+n.value.length)===n.value&&{params:{},nextIndex:e+n.value.length};case"param":{let o=e;const s=r[0];let i,a=["/","?"];if(s&&"literal"===s.type){const n=s.value,r=t.indexOf(n,e);if(-1===r)return!1;o=r}else for(;o<t.length&&!a.includes(t[o]);)o++;if(o===e)return!1;try{i=decodeURIComponent(t.slice(e,o))}catch(n){i=t.slice(e,o)}return!(o<t.length&&"?"===t[o]&&r.length>0)&&{params:{[n.name]:i},nextIndex:o}}case"splat":{let o=t.length;const s=r[0];if(s)switch(s.type){case"literal":if("."===s.value){const n=t.indexOf(".",e);-1!==n&&(o=n)}else{const n=t.lastIndexOf(s.value);-1!==n&&n>=e&&(o=n)}break;case"param":let n=-1;for(let r=t.length-1;r>=e;r--)if("/"===t[r]){n=r;break}-1!==n&&(o=n);break;case"splat":let r=-1;for(let n=t.length-1;n>e;n--)if("/"===t[n]){r=n+1;break}if(-1!==r)o=r;else{const n=t.slice(e).split("/").filter(t=>t);o=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&&(o=n)}}const i=t.indexOf("?",e);let a;-1!==i&&i<o&&(o=i);try{a=decodeURIComponent(t.slice(e,o))}catch(n){a=t.slice(e,o)}return{params:{[n.name]:a},nextIndex:o}}case"optional":{let o=e,s={},i=!0;for(let e=0;e<n.segments.length;e++){const r=n.segments[e],a=n.segments.slice(e+1),c=this.matchSegment(t,o,r,a);if(!1===c){i=!1;break}Object.assign(s,c.params),o=c.nextIndex}if(i){if(this.canMatchRemainingSegments(t,o,r))return{params:s,nextIndex:o}}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 r=0;for(const o of e)switch(o.type){case"literal":if(t.slice(r,r+o.value.length)!==o.value)return!1;r+=o.value.length;break;case"param":{let e,s=r;for(;s<t.length&&"&"!==t[s];)s++;if(s===r)return!1;try{e=decodeURIComponent(t.slice(r,s))}catch(n){e=t.slice(r,s)}n[o.name]=e,r=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 r="";for(let o=0;o<t.length;o++){const s=t[o],i=t.slice(o+1);switch(s.type){case"literal":r+=s.value;break;case"param":case"splat":if(!(s.name in e))return!1;r+=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;r+=t}}}return r}hasLaterOptionalGroupNeedingParams(t,e,n){for(const r of t)if("optional"===r.type&&this.hasAnyParamInSegments(r.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 r=!1,o=!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]?r=!0:s=!0}const a=n||r&&!s;for(const n of t)if("optional"===n.type){this.hasAllParams(n.segments,e,a)&&(o=!0)}return!(!r||s)||(!(!o||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 ve(t){const e={};return t.split(";").forEach(t=>{const[n,r]=t.split(":").map(t=>t.trim());n&&r&&(e[n]=r)}),e}var we,
|
|
20
|
+
class be{constructor(t){this.parsed=this.parsePattern(t)}get spec(){return this.parsed.template}parsePattern(t){let e=t,n="",r=!1;const o=t.indexOf("?");return-1!==o&&(e=t.slice(0,o),n=t.slice(o+1),e.endsWith("(")&&n.endsWith(")")&&(r=!0,e=e.slice(0,-1),n=n.slice(0,-1))),{pathSegments:this.parseSegments(e),querySegments:n?this.parseQuerySegments(n):[],queryOptional:r,template:t}}parseSegments(t){const e=[];let n=0;for(;n<t.length;){switch(t[n]){case"(":const{segments:r,endIndex:o}=this.parseOptionalGroup(t,n);e.push({type:"optional",segments:r}),n=o+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,r=e+1;for(;r<t.length&&n>0;)"("===t[r]&&n++,")"===t[r]&&n--,r++;const o=t.slice(e+1,r-1);return{segments:this.parseSegments(o),endIndex:r-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 r=0;for(;r<e.length;)if(":"===e[r]){const{name:t,endIndex:o}=this.parseIdentifier(e,r+1);n.push({type:"param",name:t}),r=o}else{const{value:t,endIndex:o}=this.parseQueryLiteral(e,r);t&&n.push({type:"literal",value:t}),r=o}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 r of n)switch(r.type){case"param":case"splat":t.add(r.name);break;case"optional":e(r.segments)}};return e(this.parsed.pathSegments),e(this.parsed.querySegments),Array.from(t)}canMatchRemainingSegments(t,e,n){let r=e;for(const e of n)if("literal"===e.type){const n=t.indexOf(e.value,r);if(-1===n)return!1;r=n+e.value.length}return!0}match(t){const[e,n]=t.split("?"),r=this.matchPath(e,this.parsed.pathSegments);if(!1===r)return!1;const o=this.matchQuery(n||"",this.parsed.querySegments);if(!1===o)return!1;const s=this.getAllParamNames(),i={};for(const t of s)i[t]=void 0;return Object.assign(i,r,o),i}matchPath(t,e){const n={};let r=0;for(let o=0;o<e.length;o++){const s=e[o],i=e.slice(o+1),a=this.matchSegment(t,r,s,i);if(!1===a)return!1;Object.assign(n,a.params),r=a.nextIndex}return!(r<t.length)&&n}matchSegment(t,e,n,r=[]){switch(n.type){case"literal":return t.slice(e,e+n.value.length)===n.value&&{params:{},nextIndex:e+n.value.length};case"param":{let o=e;const s=r[0];let i,a=["/","?"];if(s&&"literal"===s.type){const n=s.value,r=t.indexOf(n,e);if(-1===r)return!1;o=r}else for(;o<t.length&&!a.includes(t[o]);)o++;if(o===e)return!1;try{i=decodeURIComponent(t.slice(e,o))}catch(n){i=t.slice(e,o)}return!(o<t.length&&"?"===t[o]&&r.length>0)&&{params:{[n.name]:i},nextIndex:o}}case"splat":{let o=t.length;const s=r[0];if(s)switch(s.type){case"literal":if("."===s.value){const n=t.indexOf(".",e);-1!==n&&(o=n)}else{const n=t.lastIndexOf(s.value);-1!==n&&n>=e&&(o=n)}break;case"param":let n=-1;for(let r=t.length-1;r>=e;r--)if("/"===t[r]){n=r;break}-1!==n&&(o=n);break;case"splat":let r=-1;for(let n=t.length-1;n>e;n--)if("/"===t[n]){r=n+1;break}if(-1!==r)o=r;else{const n=t.slice(e).split("/").filter(t=>t);o=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&&(o=n)}}const i=t.indexOf("?",e);let a;-1!==i&&i<o&&(o=i);try{a=decodeURIComponent(t.slice(e,o))}catch(n){a=t.slice(e,o)}return{params:{[n.name]:a},nextIndex:o}}case"optional":{let o=e,s={},i=!0;for(let e=0;e<n.segments.length;e++){const r=n.segments[e],a=n.segments.slice(e+1),c=this.matchSegment(t,o,r,a);if(!1===c){i=!1;break}Object.assign(s,c.params),o=c.nextIndex}if(i){if(this.canMatchRemainingSegments(t,o,r))return{params:s,nextIndex:o}}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 r=0;for(const o of e)switch(o.type){case"literal":if(t.slice(r,r+o.value.length)!==o.value)return!1;r+=o.value.length;break;case"param":{let e,s=r;for(;s<t.length&&"&"!==t[s];)s++;if(s===r)return!1;try{e=decodeURIComponent(t.slice(r,s))}catch(n){e=t.slice(r,s)}n[o.name]=e,r=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 r="";for(let o=0;o<t.length;o++){const s=t[o],i=t.slice(o+1);switch(s.type){case"literal":r+=s.value;break;case"param":case"splat":if(!(s.name in e))return!1;r+=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;r+=t}}}return r}hasLaterOptionalGroupNeedingParams(t,e,n){for(const r of t)if("optional"===r.type&&this.hasAnyParamInSegments(r.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 r=!1,o=!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]?r=!0:s=!0}const a=n||r&&!s;for(const n of t)if("optional"===n.type){this.hasAllParams(n.segments,e,a)&&(o=!0)}return!(!r||s)||(!(!o||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 ve(t){const e={};return t.split(";").forEach(t=>{const[n,r]=t.split(":").map(t=>t.trim());n&&r&&(e[n]=r)}),e}var we,Ne;function Se(t,e,n,r){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=`${r} ${n}ms ease-in-out`}!function(t){t.SEQUENTIAL="sequential",t.SIMULTANEOUS="simultaneous"}(we||(we={})),function(t){t.SUCCESS="success",t.GUARDS_FAILED="guards-failed",t.NOT_FOUND="not-found"}(Ne||(Ne={}));let Te=!1;async function Ee(t,e=500){if(customElements.get(t))return;let n=null;Te||(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 Ae(t,e=500){const n=t.tagName.toLowerCase();await Ee(n,e),"ready"in t&&"function"==typeof t.ready?.then&&await t.ready}const _e=n("debounce-timers"),xe=n("throttle-timers"),Ce=n("once-called"),Oe=n("memoize-cache");
|
|
21
21
|
/*!
|
|
22
|
-
* snice v4.
|
|
22
|
+
* snice v4.28.0
|
|
23
23
|
* 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.
|
|
24
24
|
* (c) 2024
|
|
25
25
|
* Released under the MIT License.
|
|
26
26
|
*/
|
|
27
|
-
var
|
|
27
|
+
var Le;return"undefined"!=typeof document&&re(),
|
|
28
28
|
/*!
|
|
29
|
-
* snice v4.
|
|
29
|
+
* snice v4.28.0
|
|
30
30
|
* 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.
|
|
31
31
|
* (c) 2024
|
|
32
32
|
* Released under the MIT License.
|
|
33
33
|
*/
|
|
34
|
-
globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0}),function(t){t.SEQUENTIAL="sequential",t.SIMULTANEOUS="simultaneous"}(ke||(ke={})),t.Context=ot,t.ContextAwareFetcher=class{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,r){const o=new Request(t,r);let s=0;const i=async()=>{if(s<e.length){return e[s++].call(this,o,i)}const t=await fetch(o);let r=0;const a=async()=>{if(r<n.length){return n[r++].call(this,t,a)}return t};return a()};return i()}.bind(t)}},t.IS_CONTROLLER_INSTANCE=o,t.Router=function(t){const e=t.window??window,n=t.document??document,r=[];let o,s,i,a=!1,c=[],l=null,u=null;const h=t.context||{},d=new ot(h,[],"",{},t.fetcher);function m(t){if(!l||!u)return null;const e=t.querySelectorAll(l);for(const t of e){if(t[A]===u)return t}return null}function f(t,e,n,c,l,u){switch(r.push({route:new be(t),tag:e,transition:n,guards:c,layout:l,placard:u}),a=!1,t){case"/404":o=e;break;case"/403":s=e;break;case"/":i=e}}function p(){const t=new Set;c=r.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[X](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[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}function w(t,e,n){if(!!!t)return!0;const r=Array.isArray(t)?t:[t];for(const t of r){if(!t(h,e))return v(n),!1}return!0}async function S(t,e,n,r,o,s,i){const a=r||m(t);if(!a)return;!function(t,e,n){"function"==typeof t.update&&t.update(h,c,e,n)}(a,s,i);const l=a.querySelector('[slot="page"]');if(!(!n||!l))return e.setAttribute("slot","page"),await C(a,l,e,n),void(o&&(t.innerHTML="",t.appendChild(a)));a.querySelectorAll('[slot="page"]').forEach(t=>t.remove()),e.setAttribute("slot","page"),a.appendChild(e),o&&(t.innerHTML="",t.appendChild(a))}async function T(e,r,o,s,i,a){const c=!1===(d=s)?null:d||(t.layout?t.layout:null);var d;const{element:f,needsNewLayout:p}=function(t){if(t===l)return{element:null,needsNewLayout:!1};if(l=t,!!t){const e=Date.now();u=e;const r=n.createElement(t);return r[E]=h,r[A]=e,{element:r,needsNewLayout:!0}}return u=null,{element:null,needsNewLayout:!0}}(c),g=o||t.transition;if(null!==f||null!==m(e))return await S(e,r,g,f,p,i,a),void y(0,i,a);await async function(t,e,n){const r=t.children[0];n&&r?await C(t,r,e,n):(t.innerHTML="",t.appendChild(e))}(e,r,g),y(0,i,a)}async function _(s){const a=n.querySelector(t.target);if(!a)throw new Error(`Target element not found: ${t.target}`);p(),e.scrollTo(0,0);if((""===s?.trim()||"/"===s)&&!!i){const t=r.find(t=>t.route.match("/"));if(!w(t?.guards,{},a))return;const{element:o,transition:c,layout:l}=function(){const t=n.createElement(i);t[E]=h;const o=e.customElements.get(i),s=o?.[N],a=r.find(t=>t.route.match("/"));return{element:t,transition:s,layout:a?.layout}}();return void await T(a,o,c,l,s,{})}if(!s)return;const c=function(t,e){for(const o of r){const r=o.route.match(t);if(!1===r)continue;if(!w(o.guards,r,e))return{result:Se.GUARDS_FAILED};const s=n.createElement(o.tag);s[E]=h,s[U]=d;const i=r;return Object.keys(i).forEach(t=>s.setAttribute(t,i[t])),{result:Se.SUCCESS,element:s,transition:o.transition,layout:o.layout,routeParams:i}}return{result:Se.NOT_FOUND}}(s,a);if(c.result===Se.GUARDS_FAILED)return;if(c.result===Se.SUCCESS){const{element:t,transition:e,layout:n,routeParams:r={}}=c;return void await T(a,t,e,n,s,r)}const{element:l,transition:u,layout:m}=function(){if(o){const t=n.createElement(o);t[E]=h;const r=e.customElements.get(o),s=r?.[N];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,l,u,m,s,{})}async function C(t,e,n,r){return async function(t,e,n,r={}){const o=r.outDuration||300,s=r.inDuration||300,i=r.mode||"sequential",a=r.out?ve(r.out):{opacity:"0"},c={opacity:"0"},l=r.in?ve(r.in):{opacity:"1"},u=t.style,h=u.position,d=t.tagName.includes("-")&&t.shadowRoot;d||(u.position="relative");const m=e.hasAttribute("slot")||n.hasAttribute("slot");switch(Te(e,m,o,"all"),Te(n,m,s,"all"),Object.assign(n.style,c),t.appendChild(n),n.offsetHeight,i){case we.SIMULTANEOUS:Object.assign(e.style,a),Object.assign(n.style,l),await new Promise(t=>setTimeout(t,Math.max(o,s)));break;case we.SEQUENTIAL:Object.assign(e.style,a),await new Promise(t=>setTimeout(t,o)),Object.assign(n.style,l),await new Promise(t=>setTimeout(t,s))}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,m),Object.keys({...c,...l}).forEach(t=>{n.style[t]=""}),d||(u.position=h)}(t,e,n,r)}return{page:function(t){return function(n,r){if(r?.metadata&&r.metadata[g]){n[g]||(n[g]=new Map);for(const[t,e]of r.metadata[g])n[g].set(t,e)}he(n),n[N]=t.transition;const o=n.prototype.connectedCallback;n.prototype.connectedCallback=function(){this[U]=d,o?.call(this)};const s=n.prototype.disconnectedCallback;return n.prototype.disconnectedCallback=function(){s?.call(this),delete this[E],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&&(r.sort((t,e)=>e.route.spec.length-t.route.spec.length),a=!0),p(),function(){const r=()=>{n.querySelector(t.target)&&_(b())};switch(t.type){case"hash":e.addEventListener("hashchange",r);break;case"pushstate":e.addEventListener("popstate",r)}}(),_(b())},navigate:_,register:f}},t.SimpleArray=Y,t.adopted=ge,t.applyElementFunctionality=he,t.clearDebounceTimers=function(t){if(t[_e]){for(const e in t[_e])t[_e][e]?.timeout&&clearTimeout(t[_e][e].timeout);t[_e]={}}},t.clearMemoizeCache=function(t,e){t[Oe]&&(e?delete t[Oe][e]:t[Oe]={})},t.clearThrottleTimers=function(t){if(t[Ce]){for(const e in t[Ce])t[Ce][e]?.timeout&&clearTimeout(t[Ce][e].timeout);t[Ce]={}}},t.context=function(t={}){return function(e,n){const r=n.name,o=`__context_init_${r}`;return n.addInitializer(function(){const n=this.constructor;n[o]||(n[o]=!0,n[oe]||(n[oe]=[]),n[oe].push({methodName:r,method:e,options:t}))}),e}},t.contextProperty=function(){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}}},t.controller=function(t){return function(e,n){const o=globalThis.snice?.controllerRegistry;if(!o)throw new Error("Snice global registry not initialized");return o.set(t,e),e.prototype[r]=!0,e}},t.css=function(t,...e){let n=t[0];for(let r=0;r<e.length;r++)n+=String(e[r])+t[r+1];const r={_$litType$:Et,cssText:n};if("undefined"!=typeof CSSStyleSheet&&"adoptedStyleSheets"in Document.prototype)try{const t=new CSSStyleSheet;t.replaceSync(n),r.styleSheet=t}catch(t){}return r},t.debounce=function(t=300,e={}){const{leading:n=!1,trailing:r=!0,maxWait:o}=e;return function(e,s){const i=s.name;return function(...s){this[_e]||(this[_e]={});const a=this[_e],c=i;a[c]&&clearTimeout(a[c].timeout);const l=Date.now(),u=!a[c],h=u?l:a[c].startTime,d=void 0!==o&&l-h>=o;if(n&&u){const t=e.apply(this,s);return a[c]={timeout:null,startTime:h,lastArgs:s},t}const m=setTimeout(()=>{(r||d)&&e.apply(this,a[c].lastArgs),delete a[c]},d?0:t);a[c]={timeout:m,startTime:h,lastArgs:s}}}},t.dispatch=function(t,e){return function(n,r){return function(...o){this[M]||(this[M]=new Map);const s=`${t}_${r.name}`;this[M].has(s)||this[M].set(s,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[M].get(s),a=n.apply(this,o),c=n=>{if(void 0===n&&!1===e?.dispatchOnUndefined)return;const r=new CustomEvent(t,{bubbles:!0,composed:!0,...e,detail:n});this.dispatchEvent(r)},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(),r=e.throttle-(n-i.throttleLastCall);if(r<=0)return clearTimeout(i.throttleTimeout),i.throttleLastCall=n,void c(t);i.throttleTimeout||(i.throttleTimeout=setTimeout(()=>{i.throttleLastCall=Date.now(),i.throttleTimeout=null,c(t)},r))};return a instanceof Promise?a.then(t=>(l(t),t)):(l(a),a)}}},t.dispose=function(){return function(t,e){fe(C,"dispose",t,e)}},t.element=function(t,e){return function(n,r){return de(t,n,r,e)}},t.getSymbol=n,t.html=function(t,...e){return{_$litType$:Tt,strings:t,values:e}},t.layout=function(t){return function(e,n){return de(t,e,n)}},t.memoize=function(t={}){const{keyGenerator:e=(...t)=>JSON.stringify(t),maxSize:n=100,ttl:r}=t;return function(t,o){const s=o.name;return function(...o){this[Oe]||(this[Oe]={}),this[Oe][s]||(this[Oe][s]=new Map);const i=this[Oe][s],a=e(...o);if(i.has(a)){const t=i.get(a);if(!(void 0!==r&&Date.now()-t.timestamp>r))return t.value;i.delete(a)}const c=t.apply(this,o);if(i.set(a,{value:c,timestamp:Date.now()}),i.size>n){const t=i.keys().next().value;i.delete(t)}return c}}},t.moved=ye,t.noChange=$t,t.nothing=At,t.observe=function(t,e,n){let r,o;return"string"==typeof e?(r=e,o=n):(r=void 0,o=e),function(e,n){const s=n.name,i=`__observe_init_${s}`;n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[k]||(n[k]=[]);const a=Array.isArray(t)?t:[t];for(const t of a){const[i,...a]=t.split(":"),c=a.join(":");n[k].push({type:i,target:c,selector:r,methodName:s,method:e,options:o})}})}},t.on=function(t,e,n){let r=null,o={};return"string"==typeof e?(r=e,o=n||{}):e&&"object"==typeof e?o=e:null===e&&n&&(o=n),function(e,n){const s=n.name,i=`__on_init_${s}_${r||""}_${JSON.stringify(t)}`;return n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[Kt]||(n[Kt]=[]);const a=Array.isArray(t)?t:[t];for(const t of a)n[Kt].push({eventName:t,selector:r,methodName:s,method:e,options:o})}),e}},t.once=function(t=!0){let e,n=!1;return function(r,o){const s=o.name;return function(...o){return t?(this[xe]||(this[xe]={}),this[xe][s]||(this[xe][s]={called:!0,result:r.apply(this,o)}),this[xe][s].result):(n||(n=!0,e=r.apply(this,o)),e)}}},t.property=function(t){return function(e,n){const r=n.name;return n.metadata||(n.metadata={}),n.metadata[g]||(n.metadata[g]=new Map),n.metadata[g].set(r,t||{}),function(e){const n=this.constructor;n[g]||(n[g]=new Map);const o={...t};if(o.type||void 0===e||(o.type=st(e)),n[g].set(r,o),!Object.hasOwn(this.constructor.prototype,r)){const t={get(){if(!1===o?.attribute)return this[b]&&r in this[b]?this[b][r]:this[v]?.has(r)?this[v].get(r):e;const t=at(o||{},r),n=this.getAttribute?.(t);if(null!==n)return it(n,o||{},void 0,e);return((o?.type||st(e))!==Boolean||!this[T]?.has(r))&&(this[v]?.has(r)?this[v].get(r):e)},set(t){const n=this[r];if(n!==t){if(!this[w])return this[v]||(this[v]=new Map),void this[v].set(r,t);if(!1===o?.attribute)lt(this,b)[r]=t;else{const n=at(o,r),s=function(t,e,n){if(null==t||!1===t||e?.type===Y&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||st(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 Y:return Array.isArray(t)?Y.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,o,e);ct(this,T).add(r),ct(this,L).add(n.toLowerCase()),null===s?this.removeAttribute?.(n):this.setAttribute?.(n,s),setTimeout(()=>{this[L]?.delete(n.toLowerCase())},0)}ut(this,this.constructor,r,n,t),this[R]&&this[u]&&le(this)}},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,r,t)}return lt(this,b)[r]=e,e}}},t.query=function(t,e={}){return function(n,r){const{light:o=!1,shadow:s=!0}=e,i=r.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=me(this);let n=null;return s&&e.shadowRoot&&(n=e.shadowRoot.querySelector(t)),!n&&o&&(n=e.querySelector(t)),n||null},set(){},configurable:!0,enumerable:!0}),e}}},t.queryAll=function(t,e={}){return function(n,r){const{light:o=!1,shadow:s=!0}=e,i=r.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=me(this),n=[];return s&&e.shadowRoot&&n.push(...e.shadowRoot.querySelectorAll(t)),o&&n.push(...e.querySelectorAll(t)),n},set(){},configurable:!0,enumerable:!0}),e}}},t.ready=function(){return function(t,e){fe(_,"ready",t,e)}},t.render=function(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[R]=e,this[D]=t}),function(...t){const n=e.apply(this,t);return ce(this,{},n),n}}},t.request=function(t,e){return function(n,r){let s,i,a=0;return async function(...r){const c=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:r}=await a.next(n);return r}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 c())}catch(t){n(t)}},e.debounce)});if(!e?.throttle)return c();const l=Date.now(),u=e.throttle-(l-a);return u<=0?(clearTimeout(i),a=l,c()):i?Promise.resolve():new Promise((t,e)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{t(await c())}catch(t){e(t)}},u)})}}},t.resetOnce=function(t,e){t[xe]&&(e?delete t[xe][e]:t[xe]={})},t.respond=function(t,e){return function(n,r){const o=r.name,s=`__respond_init_${t}_${o}`;r.addInitializer(function(){const r=this.constructor;r[s]||(r[s]=!0,r[i]||(r[i]=[]),r[i].push({channelName:t,methodName:o,method:n,options:e}))})}},t.setDisableElementReadyWarnings=function(t){Ee=t},t.styles=function(){return function(t,e){return e.addInitializer(function(){this[V]=t}),t}},t.throttle=function(t=300,e={}){const{leading:n=!0,trailing:r=!0}=e;return function(e,o){const s=o.name;return function(...o){this[Ce]||(this[Ce]={});const i=this[Ce],a=s,c=Date.now();if(!i[a])return n&&e.apply(this,o),i[a]={lastInvoke:c,timeout:null,lastArgs:o},void(r&&!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=o,i[a].timeout&&clearTimeout(i[a].timeout),l>=t)return e.apply(this,o),void(i[a].lastInvoke=c);if(r){const n=t-l;i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),i[a].lastInvoke=Date.now(),i[a].timeout=null},n)}}}},t.trackRenders=async function*(t){for(;;)await new Promise(e=>{t[F]||(t[F]=[]),t[F].push(e)}),yield},t.unsafeHTML=function(t){return{_$litType$:_t,html:t}},t.useNativeElementControllers=re,t.waitForAllCustomElements=async function(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=>Ae(t,e)))},t.waitForElementDefined=Ne,t.waitForElementReady=Ae,t.watch=function(...t){return function(e,n){const r=n.name,o=`__watch_init_${r}`;n.addInitializer(function(){const n=this.constructor;if(!n[o]){n[o]=!0,n[S]||(n[S]=new Map);for(const o of t)n[S].has(o)||n[S].set(o,[]),n[S].get(o).push({methodName:r,method:e})}})}},t}({});
|
|
34
|
+
globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0}),function(t){t.SEQUENTIAL="sequential",t.SIMULTANEOUS="simultaneous"}(Le||(Le={})),t.Context=ot,t.ContextAwareFetcher=class{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,r){const o=new Request(t,r);let s=0;const i=async()=>{if(s<e.length){return e[s++].call(this,o,i)}const t=await fetch(o);let r=0;const a=async()=>{if(r<n.length){return n[r++].call(this,t,a)}return t};return a()};return i()}.bind(t)}},t.IS_CONTROLLER_INSTANCE=o,t.Router=function(t){const e=t.window??window,n=t.document??document,r=[];let o,s,i,a=!1,c=[],l=null,u=null;const h=t.context||{},d=new ot(h,[],"",{},t.fetcher);function m(t){if(!l||!u)return null;const e=t.querySelectorAll(l);for(const t of e){if(t[A]===u)return t}return null}function f(t,e,n,c,l,u){switch(r.push({route:new be(t),tag:e,transition:n,guards:c,layout:l,placard:u}),a=!1,t){case"/404":o=e;break;case"/403":s=e;break;case"/":i=e}}function p(){const t=new Set;c=r.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[X](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[T]=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}function w(t,e,n){if(!!!t)return!0;const r=Array.isArray(t)?t:[t];for(const t of r){if(!t(h,e))return v(n),!1}return!0}async function N(t,e,n,r,o,s,i){const a=r||m(t);if(!a)return;!function(t,e,n){"function"==typeof t.update&&t.update(h,c,e,n)}(a,s,i);const l=a.querySelector('[slot="page"]');if(!(!n||!l))return e.setAttribute("slot","page"),await x(a,l,e,n),void(o&&(t.innerHTML="",t.appendChild(a)));a.querySelectorAll('[slot="page"]').forEach(t=>t.remove()),e.setAttribute("slot","page"),a.appendChild(e),o&&(t.innerHTML="",t.appendChild(a))}async function S(e,r,o,s,i,a){const c=!1===(d=s)?null:d||(t.layout?t.layout:null);var d;const{element:f,needsNewLayout:p}=function(t){if(t===l)return{element:null,needsNewLayout:!1};if(l=t,!!t){const e=Date.now();u=e;const r=n.createElement(t);return r[T]=h,r[A]=e,{element:r,needsNewLayout:!0}}return u=null,{element:null,needsNewLayout:!0}}(c),g=o||t.transition;if(null!==f||null!==m(e))return await N(e,r,g,f,p,i,a),void y(0,i,a);await async function(t,e,n){const r=t.children[0];n&&r?await x(t,r,e,n):(t.innerHTML="",t.appendChild(e))}(e,r,g),y(0,i,a)}async function _(s){const a=n.querySelector(t.target);if(!a)throw new Error(`Target element not found: ${t.target}`);p(),e.scrollTo(0,0);if((""===s?.trim()||"/"===s)&&!!i){const t=r.find(t=>t.route.match("/"));if(!w(t?.guards,{},a))return;const{element:o,transition:c,layout:l}=function(){const t=n.createElement(i);t[T]=h;const o=e.customElements.get(i),s=o?.[E],a=r.find(t=>t.route.match("/"));return{element:t,transition:s,layout:a?.layout}}();return void await S(a,o,c,l,s,{})}if(!s)return;const c=function(t,e){for(const o of r){const r=o.route.match(t);if(!1===r)continue;if(!w(o.guards,r,e))return{result:Ne.GUARDS_FAILED};const s=n.createElement(o.tag);s[T]=h,s[j]=d;const i=r;return Object.keys(i).forEach(t=>s.setAttribute(t,i[t])),{result:Ne.SUCCESS,element:s,transition:o.transition,layout:o.layout,routeParams:i}}return{result:Ne.NOT_FOUND}}(s,a);if(c.result===Ne.GUARDS_FAILED)return;if(c.result===Ne.SUCCESS){const{element:t,transition:e,layout:n,routeParams:r={}}=c;return void await S(a,t,e,n,s,r)}const{element:l,transition:u,layout:m}=function(){if(o){const t=n.createElement(o);t[T]=h;const r=e.customElements.get(o),s=r?.[E];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 S(a,l,u,m,s,{})}async function x(t,e,n,r){return async function(t,e,n,r={}){const o=r.outDuration||300,s=r.inDuration||300,i=r.mode||"sequential",a=r.out?ve(r.out):{opacity:"0"},c={opacity:"0"},l=r.in?ve(r.in):{opacity:"1"},u=t.style,h=u.position,d=t.tagName.includes("-")&&t.shadowRoot;d||(u.position="relative");const m=e.hasAttribute("slot")||n.hasAttribute("slot");switch(Se(e,m,o,"all"),Se(n,m,s,"all"),Object.assign(n.style,c),t.appendChild(n),n.offsetHeight,i){case we.SIMULTANEOUS:Object.assign(e.style,a),Object.assign(n.style,l),await new Promise(t=>setTimeout(t,Math.max(o,s)));break;case we.SEQUENTIAL:Object.assign(e.style,a),await new Promise(t=>setTimeout(t,o)),Object.assign(n.style,l),await new Promise(t=>setTimeout(t,s))}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,m),Object.keys({...c,...l}).forEach(t=>{n.style[t]=""}),d||(u.position=h)}(t,e,n,r)}return{page:function(t){return function(n,r){if(r?.metadata&&r.metadata[g]){n[g]||(n[g]=new Map);for(const[t,e]of r.metadata[g])n[g].set(t,e)}he(n),n[E]=t.transition;const o=n.prototype.connectedCallback;n.prototype.connectedCallback=function(){this[j]=d,o?.call(this)};const s=n.prototype.disconnectedCallback;return n.prototype.disconnectedCallback=function(){s?.call(this),delete this[T],delete this[j]},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&&(r.sort((t,e)=>e.route.spec.length-t.route.spec.length),a=!0),p(),function(){const r=()=>{n.querySelector(t.target)&&_(b())};switch(t.type){case"hash":e.addEventListener("hashchange",r);break;case"pushstate":e.addEventListener("popstate",r)}}(),_(b())},navigate:_,register:f}},t.SimpleArray=Y,t.adopted=ge,t.applyElementFunctionality=he,t.clearDebounceTimers=function(t){if(t[_e]){for(const e in t[_e])t[_e][e]?.timeout&&clearTimeout(t[_e][e].timeout);t[_e]={}}},t.clearMemoizeCache=function(t,e){t[Oe]&&(e?delete t[Oe][e]:t[Oe]={})},t.clearThrottleTimers=function(t){if(t[xe]){for(const e in t[xe])t[xe][e]?.timeout&&clearTimeout(t[xe][e].timeout);t[xe]={}}},t.context=function(t={}){return function(e,n){const r=n.name,o=`__context_init_${r}`;return n.addInitializer(function(){const n=this.constructor;n[o]||(n[o]=!0,n[oe]||(n[oe]=[]),n[oe].push({methodName:r,method:e,options:t}))}),e}},t.contextProperty=function(){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[T])return this[T];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[T]=e.context,e.context):void 0},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,n,t)}return t}}},t.controller=function(t){return function(e,n){const o=globalThis.snice?.controllerRegistry;if(!o)throw new Error("Snice global registry not initialized");return o.set(t,e),e.prototype[r]=!0,e}},t.createRequestHandler=function(t,e,n){const r=[];for(const[o,s]of Object.entries(e)){const e=`@request/${o}`,i=t=>{const e=t,{discovery:r,data:i,payload:a}=e.detail;n?.passive||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()),r.resolve(),Promise.resolve().then(()=>s(a)).then(t=>i.resolve(t)).catch(t=>{i.reject(t),console.error(`createRequestHandler: error in "${o}" handler:`,t)})};t.addEventListener(e,i),r.push(()=>t.removeEventListener(e,i))}return()=>{for(const t of r)t();r.length=0}},t.css=function(t,...e){let n=t[0];for(let r=0;r<e.length;r++)n+=String(e[r])+t[r+1];const r={_$litType$:Tt,cssText:n};if("undefined"!=typeof CSSStyleSheet&&"adoptedStyleSheets"in Document.prototype)try{const t=new CSSStyleSheet;t.replaceSync(n),r.styleSheet=t}catch(t){}return r},t.debounce=function(t=300,e={}){const{leading:n=!1,trailing:r=!0,maxWait:o}=e;return function(e,s){const i=s.name;return function(...s){this[_e]||(this[_e]={});const a=this[_e],c=i;a[c]&&clearTimeout(a[c].timeout);const l=Date.now(),u=!a[c],h=u?l:a[c].startTime,d=void 0!==o&&l-h>=o;if(n&&u){const t=e.apply(this,s);return a[c]={timeout:null,startTime:h,lastArgs:s},t}const m=setTimeout(()=>{(r||d)&&e.apply(this,a[c].lastArgs),delete a[c]},d?0:t);a[c]={timeout:m,startTime:h,lastArgs:s}}}},t.dispatch=function(t,e){return function(n,r){return function(...o){this[R]||(this[R]=new Map);const s=`${t}_${r.name}`;this[R].has(s)||this[R].set(s,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[R].get(s),a=n.apply(this,o),c=n=>{if(void 0===n&&!1===e?.dispatchOnUndefined)return;const r=new CustomEvent(t,{bubbles:!0,composed:!0,...e,detail:n});this.dispatchEvent(r)},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(),r=e.throttle-(n-i.throttleLastCall);if(r<=0)return clearTimeout(i.throttleTimeout),i.throttleLastCall=n,void c(t);i.throttleTimeout||(i.throttleTimeout=setTimeout(()=>{i.throttleLastCall=Date.now(),i.throttleTimeout=null,c(t)},r))};return a instanceof Promise?a.then(t=>(l(t),t)):(l(a),a)}}},t.dispose=function(){return function(t,e){fe(x,"dispose",t,e)}},t.element=function(t,e){return function(n,r){return de(t,n,r,e)}},t.getSymbol=n,t.html=function(t,...e){return{_$litType$:St,strings:t,values:e}},t.layout=function(t){return function(e,n){return de(t,e,n)}},t.memoize=function(t={}){const{keyGenerator:e=(...t)=>JSON.stringify(t),maxSize:n=100,ttl:r}=t;return function(t,o){const s=o.name;return function(...o){this[Oe]||(this[Oe]={}),this[Oe][s]||(this[Oe][s]=new Map);const i=this[Oe][s],a=e(...o);if(i.has(a)){const t=i.get(a);if(!(void 0!==r&&Date.now()-t.timestamp>r))return t.value;i.delete(a)}const c=t.apply(this,o);if(i.set(a,{value:c,timestamp:Date.now()}),i.size>n){const t=i.keys().next().value;i.delete(t)}return c}}},t.moved=ye,t.noChange=It,t.nothing=At,t.observe=function(t,e,n){let r,o;return"string"==typeof e?(r=e,o=n):(r=void 0,o=e),function(e,n){const s=n.name,i=`__observe_init_${s}`;n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[L]||(n[L]=[]);const a=Array.isArray(t)?t:[t];for(const t of a){const[i,...a]=t.split(":"),c=a.join(":");n[L].push({type:i,target:c,selector:r,methodName:s,method:e,options:o})}})}},t.on=function(t,e,n){let r=null,o={};return"string"==typeof e?(r=e,o=n||{}):e&&"object"==typeof e?o=e:null===e&&n&&(o=n),function(e,n){const s=n.name,i=`__on_init_${s}_${r||""}_${JSON.stringify(t)}`;return n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[Qt]||(n[Qt]=[]);const a=Array.isArray(t)?t:[t];for(const t of a)n[Qt].push({eventName:t,selector:r,methodName:s,method:e,options:o})}),e}},t.once=function(t=!0){let e,n=!1;return function(r,o){const s=o.name;return function(...o){return t?(this[Ce]||(this[Ce]={}),this[Ce][s]||(this[Ce][s]={called:!0,result:r.apply(this,o)}),this[Ce][s].result):(n||(n=!0,e=r.apply(this,o)),e)}}},t.property=function(t){return function(e,n){const r=n.name;return n.metadata||(n.metadata={}),n.metadata[g]||(n.metadata[g]=new Map),n.metadata[g].set(r,t||{}),function(e){const n=this.constructor;n[g]||(n[g]=new Map);const o={...t};if(o.type||void 0===e||(o.type=st(e)),n[g].set(r,o),!Object.hasOwn(this.constructor.prototype,r)){const t={get(){if(!1===o?.attribute)return this[b]&&r in this[b]?this[b][r]:this[v]?.has(r)?this[v].get(r):e;const t=at(o||{},r),n=this.getAttribute?.(t);if(null!==n)return it(n,o||{},void 0,e);return((o?.type||st(e))!==Boolean||!this[S]?.has(r))&&(this[v]?.has(r)?this[v].get(r):e)},set(t){const n=this[r];if(n!==t){if(!this[w])return this[v]||(this[v]=new Map),void this[v].set(r,t);if(!1===o?.attribute)lt(this,b)[r]=t;else{const n=at(o,r),s=function(t,e,n){if(null==t||!1===t||e?.type===Y&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||st(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 Y:return Array.isArray(t)?Y.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,o,e);ct(this,S).add(r),ct(this,k).add(n.toLowerCase()),null===s?this.removeAttribute?.(n):this.setAttribute?.(n,s),setTimeout(()=>{this[k]?.delete(n.toLowerCase())},0)}ut(this,this.constructor,r,n,t),this[M]&&this[u]&&le(this)}},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,r,t)}return lt(this,b)[r]=e,e}}},t.query=function(t,e={}){return function(n,r){const{light:o=!1,shadow:s=!0}=e,i=r.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=me(this);let n=null;return s&&e.shadowRoot&&(n=e.shadowRoot.querySelector(t)),!n&&o&&(n=e.querySelector(t)),n||null},set(){},configurable:!0,enumerable:!0}),e}}},t.queryAll=function(t,e={}){return function(n,r){const{light:o=!1,shadow:s=!0}=e,i=r.name;return function(e){return Object.hasOwn(this.constructor.prototype,i)||Object.defineProperty(this.constructor.prototype,i,{get(){const e=me(this),n=[];return s&&e.shadowRoot&&n.push(...e.shadowRoot.querySelectorAll(t)),o&&n.push(...e.querySelectorAll(t)),n},set(){},configurable:!0,enumerable:!0}),e}}},t.ready=function(){return function(t,e){fe(_,"ready",t,e)}},t.render=function(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[M]=e,this[D]=t}),function(...t){const n=e.apply(this,t);return ce(this,{},n),n}}},t.request=function(t,e){return function(n,r){let s,i,a=0;return async function(...r){const c=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:r}=await a.next(n);return r}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 c())}catch(t){n(t)}},e.debounce)});if(!e?.throttle)return c();const l=Date.now(),u=e.throttle-(l-a);return u<=0?(clearTimeout(i),a=l,c()):i?Promise.resolve():new Promise((t,e)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{t(await c())}catch(t){e(t)}},u)})}}},t.resetOnce=function(t,e){t[Ce]&&(e?delete t[Ce][e]:t[Ce]={})},t.respond=function(t,e){return function(n,r){const o=r.name,s=`__respond_init_${t}_${o}`;r.addInitializer(function(){const r=this.constructor;r[s]||(r[s]=!0,r[i]||(r[i]=[]),r[i].push({channelName:t,methodName:o,method:n,options:e}))})}},t.setDisableElementReadyWarnings=function(t){Te=t},t.styles=function(){return function(t,e){return e.addInitializer(function(){this[B]=t}),t}},t.throttle=function(t=300,e={}){const{leading:n=!0,trailing:r=!0}=e;return function(e,o){const s=o.name;return function(...o){this[xe]||(this[xe]={});const i=this[xe],a=s,c=Date.now();if(!i[a])return n&&e.apply(this,o),i[a]={lastInvoke:c,timeout:null,lastArgs:o},void(r&&!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=o,i[a].timeout&&clearTimeout(i[a].timeout),l>=t)return e.apply(this,o),void(i[a].lastInvoke=c);if(r){const n=t-l;i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),i[a].lastInvoke=Date.now(),i[a].timeout=null},n)}}}},t.trackRenders=async function*(t){for(;;)await new Promise(e=>{t[q]||(t[q]=[]),t[q].push(e)}),yield},t.unsafeHTML=function(t){return{_$litType$:_t,html:t}},t.useNativeElementControllers=re,t.waitForAllCustomElements=async function(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=>Ae(t,e)))},t.waitForElementDefined=Ee,t.waitForElementReady=Ae,t.watch=function(...t){return function(e,n){const r=n.name,o=`__watch_init_${r}`;n.addInitializer(function(){const n=this.constructor;if(!n[o]){n[o]=!0,n[N]||(n[N]=new Map);for(const o of t)n[N].has(o)||n[N].set(o,[]),n[N].get(o).push({methodName:r,method:e})}})}},t}({});
|
|
35
35
|
//# sourceMappingURL=snice-runtime.min.js.map
|