@tempots/beatui 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/beatui.css +1096 -141
- package/dist/beatui.tailwind.css +1096 -141
- package/dist/deep-merge-Bydz6jLt.cjs +1 -0
- package/dist/{deep-merge-DwXDd3iF.js → deep-merge-CzZVsVF-.js} +1 -1
- package/dist/{duration-input-CjNZyVkf.cjs → duration-input-BrYLC1js.cjs} +1 -1
- package/dist/{duration-input-CnMMvPgT.js → duration-input-CFu6vq-y.js} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +6359 -5270
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +3 -3
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +2 -2
- package/dist/types/components/form/input/index.d.ts +2 -1
- package/dist/types/components/form/input/multi-select.d.ts +98 -0
- package/dist/types/components/form/input/range-slider.d.ts +175 -0
- package/dist/types/components/media/carousel.d.ts +117 -0
- package/dist/types/components/media/index.d.ts +1 -0
- package/dist/types/components/navigation/index.d.ts +1 -0
- package/dist/types/components/navigation/navigation-progress.d.ts +72 -0
- package/dist/types/components/overlay/index.d.ts +1 -0
- package/dist/types/components/overlay/onboarding-tour.d.ts +98 -0
- package/dist/{widget-customization-D2a6SVP3.js → widget-customization-BAchyOUo.js} +1 -1
- package/dist/{widget-customization-CD_NyRQ8.cjs → widget-customization-DELy3SMQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/deep-merge-Bjv1NvKj.cjs +0 -1
- package/dist/types/components/form/input/advanced-slider.d.ts +0 -143
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Signal, TNode, Value } from '@tempots/dom';
|
|
2
|
+
import type { IconSize } from '../theme';
|
|
3
|
+
/** Transition effect for slide changes. */
|
|
4
|
+
export type CarouselTransition = 'slide' | 'fade';
|
|
5
|
+
/** Indicator style for showing slide position. */
|
|
6
|
+
export type CarouselIndicator = 'dots' | 'progress' | 'fraction' | 'none';
|
|
7
|
+
/** Slide alignment when slidesPerView shows more slots than remaining slides. */
|
|
8
|
+
export type CarouselAlignment = 'start' | 'center' | 'end';
|
|
9
|
+
/** Controller for programmatic carousel control, returned by {@link createCarousel}. */
|
|
10
|
+
export interface CarouselController {
|
|
11
|
+
/** Navigate to a specific slide index. */
|
|
12
|
+
goTo: (index: number) => void;
|
|
13
|
+
/** Navigate to the next slide. */
|
|
14
|
+
next: () => void;
|
|
15
|
+
/** Navigate to the previous slide. */
|
|
16
|
+
prev: () => void;
|
|
17
|
+
/** Start auto-play. */
|
|
18
|
+
play: () => void;
|
|
19
|
+
/** Stop auto-play. */
|
|
20
|
+
pause: () => void;
|
|
21
|
+
/** Reactive signal indicating whether auto-play is active. */
|
|
22
|
+
isPlaying: Signal<boolean>;
|
|
23
|
+
/** Reactive signal of the current slide index. */
|
|
24
|
+
currentIndex: Signal<number>;
|
|
25
|
+
/** Total number of slides. */
|
|
26
|
+
totalSlides: number;
|
|
27
|
+
}
|
|
28
|
+
/** Configuration options for the {@link Carousel} and {@link createCarousel} components. */
|
|
29
|
+
export type CarouselOptions = {
|
|
30
|
+
/** Index of the currently active slide. @default 0 */
|
|
31
|
+
currentIndex?: Value<number>;
|
|
32
|
+
/** Enable auto-play rotation. @default false */
|
|
33
|
+
autoPlay?: Value<boolean>;
|
|
34
|
+
/** Auto-play interval in milliseconds. @default 3000 */
|
|
35
|
+
interval?: Value<number>;
|
|
36
|
+
/** Whether to loop infinitely. @default false */
|
|
37
|
+
loop?: Value<boolean>;
|
|
38
|
+
/** Number of slides visible at once. @default 1 */
|
|
39
|
+
slidesPerView?: Value<number>;
|
|
40
|
+
/** Transition effect. @default 'slide' */
|
|
41
|
+
transition?: Value<CarouselTransition>;
|
|
42
|
+
/** Transition duration in milliseconds. @default 300 */
|
|
43
|
+
transitionDuration?: Value<number>;
|
|
44
|
+
/** Show navigation arrows. @default true */
|
|
45
|
+
showArrows?: Value<boolean>;
|
|
46
|
+
/** Pause auto-play on hover. @default true */
|
|
47
|
+
pauseOnHover?: Value<boolean>;
|
|
48
|
+
/** Enable keyboard navigation. @default true */
|
|
49
|
+
keyboard?: Value<boolean>;
|
|
50
|
+
/** Accessible label for the carousel. @default 'Carousel' */
|
|
51
|
+
ariaLabel?: Value<string>;
|
|
52
|
+
/** Gap between slides (CSS units, e.g. '16px', '1rem'). @default '0px' */
|
|
53
|
+
gap?: Value<string>;
|
|
54
|
+
/** Amount of next/prev slide to peek (CSS units, e.g. '40px', '10%'). @default '0px' */
|
|
55
|
+
peekAmount?: Value<string>;
|
|
56
|
+
/** Slide alignment. @default 'start' */
|
|
57
|
+
align?: Value<CarouselAlignment>;
|
|
58
|
+
/** CSS timing function for transitions. @default 'cubic-bezier(0.2, 0, 0, 1)' */
|
|
59
|
+
easing?: Value<string>;
|
|
60
|
+
/** Indicator type. @default 'dots' */
|
|
61
|
+
indicator?: Value<CarouselIndicator>;
|
|
62
|
+
/** Pixel threshold for mouse drag navigation. @default 50 */
|
|
63
|
+
dragThreshold?: Value<number>;
|
|
64
|
+
/** Iconify icon name for the previous arrow. @default 'lucide:chevron-left' */
|
|
65
|
+
prevIcon?: Value<string>;
|
|
66
|
+
/** Iconify icon name for the next arrow. @default 'lucide:chevron-right' */
|
|
67
|
+
nextIcon?: Value<string>;
|
|
68
|
+
/** Size of the arrow icons. @default 'md' */
|
|
69
|
+
arrowIconSize?: Value<IconSize>;
|
|
70
|
+
/** Called when the active slide changes. */
|
|
71
|
+
onSlideChange?: (index: number) => void;
|
|
72
|
+
/** Called when auto-play state toggles. */
|
|
73
|
+
onAutoPlayToggle?: (playing: boolean) => void;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Creates a carousel with an imperative controller for programmatic control.
|
|
77
|
+
*
|
|
78
|
+
* @param options - Carousel configuration
|
|
79
|
+
* @param children - Slide content elements (each child is one slide)
|
|
80
|
+
* @returns A tuple of [TNode, CarouselController]
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const [carousel, ctrl] = createCarousel(
|
|
85
|
+
* { autoPlay: true, loop: true },
|
|
86
|
+
* html.div('Slide 1'),
|
|
87
|
+
* html.div('Slide 2'),
|
|
88
|
+
* html.div('Slide 3')
|
|
89
|
+
* )
|
|
90
|
+
* // Later: ctrl.goTo(2), ctrl.play(), ctrl.pause()
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function createCarousel(options: CarouselOptions, ...children: TNode[]): [TNode, CarouselController];
|
|
94
|
+
/**
|
|
95
|
+
* A fully-featured carousel component for cycling through slide content.
|
|
96
|
+
*
|
|
97
|
+
* Supports auto-play, touch/swipe, mouse drag, keyboard navigation, multiple
|
|
98
|
+
* transition effects, and accessible ARIA attributes.
|
|
99
|
+
*
|
|
100
|
+
* For programmatic control, use {@link createCarousel} instead which returns
|
|
101
|
+
* a controller alongside the component.
|
|
102
|
+
*
|
|
103
|
+
* @param options - Carousel configuration
|
|
104
|
+
* @param children - Slide content elements (each child is one slide)
|
|
105
|
+
* @returns A carousel container with navigation controls
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* Carousel(
|
|
110
|
+
* { autoPlay: true, loop: true },
|
|
111
|
+
* html.div('Slide 1'),
|
|
112
|
+
* html.div('Slide 2'),
|
|
113
|
+
* html.div('Slide 3')
|
|
114
|
+
* )
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare function Carousel(options: CarouselOptions, ...children: TNode[]): TNode;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import { ThemeColorName } from '../../tokens';
|
|
3
|
+
/**
|
|
4
|
+
* Position of the navigation progress bar within the viewport.
|
|
5
|
+
*/
|
|
6
|
+
export type NavigationProgressPosition = 'top' | 'bottom';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for the {@link NavigationProgress} component.
|
|
9
|
+
*/
|
|
10
|
+
export interface NavigationProgressOptions {
|
|
11
|
+
/** Theme color for the progress bar fill. @default 'primary' */
|
|
12
|
+
color?: Value<ThemeColorName>;
|
|
13
|
+
/** Height of the progress bar in pixels. @default 3 @min 1 @max 10 @step 1 */
|
|
14
|
+
height?: Value<number>;
|
|
15
|
+
/** Position of the bar in the viewport. @default 'top' */
|
|
16
|
+
position?: Value<NavigationProgressPosition>;
|
|
17
|
+
/** Whether to show a spinner indicator alongside the bar. @default false */
|
|
18
|
+
showSpinner?: Value<boolean>;
|
|
19
|
+
/** Trickle speed in milliseconds (interval for auto-increment). @default 200 @min 50 @max 1000 @step 50 */
|
|
20
|
+
trickleSpeed?: Value<number>;
|
|
21
|
+
/** Minimum display duration in milliseconds to prevent flash. @default 300 @min 0 @max 2000 @step 100 */
|
|
22
|
+
minimumDuration?: Value<number>;
|
|
23
|
+
/** Animation speed for CSS transitions in milliseconds. @default 200 @min 50 @max 1000 @step 50 */
|
|
24
|
+
animationSpeed?: Value<number>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Controller returned by {@link NavigationProgress} for programmatic control.
|
|
28
|
+
*/
|
|
29
|
+
export interface NavigationProgressController {
|
|
30
|
+
/** Start the progress bar (resets to initial value and begins trickling). */
|
|
31
|
+
start: () => void;
|
|
32
|
+
/** Set progress to a specific value (0–100). */
|
|
33
|
+
set: (value: number) => void;
|
|
34
|
+
/** Complete the progress bar (animates to 100% then hides). */
|
|
35
|
+
done: () => void;
|
|
36
|
+
/** Reset the progress bar to hidden state without animation. */
|
|
37
|
+
reset: () => void;
|
|
38
|
+
/** Whether the progress bar is currently active. */
|
|
39
|
+
isActive: Value<boolean>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A thin progress bar fixed to the top or bottom of the viewport,
|
|
43
|
+
* indicating navigation or loading progress. Inspired by NProgress.
|
|
44
|
+
*
|
|
45
|
+
* Returns a tuple of `[TNode, NavigationProgressController]` so the
|
|
46
|
+
* caller can programmatically control the bar.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Configuration for color, height, position, and behavior
|
|
49
|
+
* @returns A tuple of the progress bar element and its controller
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const [bar, progress] = NavigationProgress({ color: 'primary' })
|
|
54
|
+
* // Mount the bar
|
|
55
|
+
* html.div(bar)
|
|
56
|
+
* // Start loading
|
|
57
|
+
* progress.start()
|
|
58
|
+
* // Complete when done
|
|
59
|
+
* progress.done()
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* // With spinner and bottom position
|
|
65
|
+
* const [bar, ctrl] = NavigationProgress({
|
|
66
|
+
* position: 'bottom',
|
|
67
|
+
* showSpinner: true,
|
|
68
|
+
* color: 'info',
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function NavigationProgress(options?: NavigationProgressOptions): [TNode, NavigationProgressController];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Placement of the tour tooltip relative to the target element.
|
|
4
|
+
*/
|
|
5
|
+
export type TourTooltipPlacement = 'top' | 'bottom' | 'left' | 'right' | 'auto';
|
|
6
|
+
/**
|
|
7
|
+
* Behavior when the backdrop area (outside the highlighted element) is clicked.
|
|
8
|
+
*/
|
|
9
|
+
export type TourBackdropAction = 'close' | 'advance' | 'ignore';
|
|
10
|
+
/**
|
|
11
|
+
* Definition of a single step in the onboarding tour.
|
|
12
|
+
*/
|
|
13
|
+
export interface TourStep {
|
|
14
|
+
/** CSS selector or direct reference to the target element to highlight. */
|
|
15
|
+
target: string | HTMLElement;
|
|
16
|
+
/** Title text for the step tooltip. */
|
|
17
|
+
title?: string;
|
|
18
|
+
/** Description text for the step tooltip. */
|
|
19
|
+
description?: string;
|
|
20
|
+
/** Rich content to render inside the tooltip (replaces description if provided). */
|
|
21
|
+
content?: TNode;
|
|
22
|
+
/** Preferred placement of the tooltip. @default 'auto' */
|
|
23
|
+
placement?: TourTooltipPlacement;
|
|
24
|
+
/** Whether the user can interact with the highlighted element. @default false */
|
|
25
|
+
allowInteraction?: boolean;
|
|
26
|
+
/** Async validation function. Return true to allow advancing, false to block. */
|
|
27
|
+
beforeNext?: () => boolean | Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Configuration options for the {@link OnboardingTour} component.
|
|
31
|
+
*/
|
|
32
|
+
export interface OnboardingTourOptions {
|
|
33
|
+
/** Array of tour steps to display. */
|
|
34
|
+
steps: TourStep[];
|
|
35
|
+
/** Behavior when backdrop is clicked. @default 'ignore' */
|
|
36
|
+
backdropAction?: TourBackdropAction;
|
|
37
|
+
/** Padding around the highlighted element in pixels. @default 8 @min 0 @max 32 @step 2 */
|
|
38
|
+
spotlightPadding?: number;
|
|
39
|
+
/** Border radius for the spotlight cutout in pixels. @default 8 @min 0 @max 24 @step 2 */
|
|
40
|
+
spotlightRadius?: number;
|
|
41
|
+
/** Whether to show step indicators (e.g. "Step 2 of 5"). @default true */
|
|
42
|
+
showStepIndicator?: boolean;
|
|
43
|
+
/** Whether to show the Skip button. @default true */
|
|
44
|
+
showSkipButton?: boolean;
|
|
45
|
+
/** Callback when the tour starts. @default undefined */
|
|
46
|
+
onStart?: () => void;
|
|
47
|
+
/** Callback when the current step changes. @default undefined */
|
|
48
|
+
onStepChange?: (stepIndex: number) => void;
|
|
49
|
+
/** Callback when the tour is completed (user clicks Finish on last step). @default undefined */
|
|
50
|
+
onComplete?: () => void;
|
|
51
|
+
/** Callback when the tour is skipped. @default undefined */
|
|
52
|
+
onSkip?: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Where to attach the overlay in the DOM.
|
|
55
|
+
* - `'body'` - Renders via a portal to the document body.
|
|
56
|
+
* - `'element'` - Renders as a child of the current element context.
|
|
57
|
+
* @default 'body'
|
|
58
|
+
*/
|
|
59
|
+
container?: 'body' | 'element';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Controller returned by {@link OnboardingTour} for programmatic control.
|
|
63
|
+
*/
|
|
64
|
+
export interface OnboardingTourController {
|
|
65
|
+
/** Start the tour from the first step. */
|
|
66
|
+
startTour: () => void;
|
|
67
|
+
/** Jump to a specific step by index. */
|
|
68
|
+
goToStep: (index: number) => void;
|
|
69
|
+
/** End the tour immediately. */
|
|
70
|
+
endTour: () => void;
|
|
71
|
+
/** Whether the tour is currently active. */
|
|
72
|
+
isActive: Value<boolean>;
|
|
73
|
+
/** The current step index (0-based). */
|
|
74
|
+
currentStep: Value<number>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A step-by-step guided tour overlay that highlights UI elements with a spotlight
|
|
78
|
+
* effect and shows tooltips with navigation controls.
|
|
79
|
+
*
|
|
80
|
+
* Returns a tuple of `[TNode, OnboardingTourController]`.
|
|
81
|
+
*
|
|
82
|
+
* @param options - Configuration for steps, behavior, and callbacks
|
|
83
|
+
* @returns A tuple of the tour overlay node and its controller
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const [tour, ctrl] = OnboardingTour({
|
|
88
|
+
* steps: [
|
|
89
|
+
* { target: '#welcome-btn', title: 'Welcome', description: 'Click here to get started.' },
|
|
90
|
+
* { target: '.sidebar', title: 'Navigation', description: 'Browse sections here.' },
|
|
91
|
+
* ],
|
|
92
|
+
* onComplete: () => console.log('Tour finished!'),
|
|
93
|
+
* })
|
|
94
|
+
* html.div(tour)
|
|
95
|
+
* ctrl.startTour()
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function OnboardingTour(options: OnboardingTourOptions): [TNode, OnboardingTourController];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Value as p, prop as ut, computedOf as D, html as _, attr as u, svg as ot, svgAttr as J, Empty as A, on as I, When as z, Fragment as j, aria as R, emitValue as at, Use as ft, input as pt, emitValueAsNullableDate as ct, emitValueAsNullableDateTime as it, Repeat as mt, emit as bt, style as wt, emitValueAsNumber as E } from "@tempots/dom";
|
|
2
|
-
import { F as yt, N as X, T as Mt, U as It, a as $t } from "./deep-merge-
|
|
2
|
+
import { F as yt, N as X, T as Mt, U as It, a as $t } from "./deep-merge-CzZVsVF-.js";
|
|
3
3
|
import { decodeBase64 as xt } from "@tempots/std";
|
|
4
4
|
import { I as P } from "./input-container-CO3DNqpp.js";
|
|
5
5
|
import { C as O, m as dt, T as _t } from "./text-input-BAn02BzO.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("@tempots/dom"),k=require("./deep-merge-Bjv1NvKj.cjs"),mt=require("@tempots/std"),B=require("./input-container-BkPcNDaZ.cjs"),N=require("./text-input-D_IxFd0M.cjs"),R=require("./translations-qefRsdGi.cjs"),ft=require("@tempots/ui"),Q=require("./notice-Q0A1gIho.cjs"),bt=require("./session-id-B5lJMzbB.cjs"),yt=require("./utils-DmEuG3Np.cjs");function Y(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function Z(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,s=e.match(n);if(!s)return!1;const[,a,o,r]=s,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(r,10);return l>=0&&l<=255&&i>=0&&i<=255&&c>=0&&c<=255}function J(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,s=e.match(n);if(!s)return!1;const[,a,o,r,l]=s,i=parseInt(a,10),c=parseInt(o,10),u=parseInt(r,10),p=parseFloat(l);return i>=0&&i<=255&&c>=0&&c<=255&&u>=0&&u<=255&&p>=0&&p<=1}function tt(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,s=e.match(n);if(!s)return!1;const[,a,o,r]=s,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(r,10);return l>=0&&l<=360&&i>=0&&i<=100&&c>=0&&c<=100}function wt(e){return Y(e)||Z(e)||J(e)||tt(e)}function et(e){if(!Y(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(s=>s+s).join("")),`#${n.toLowerCase()}`}function q(e,n,s){const a=o=>{const r=Math.round(Math.max(0,Math.min(255,o))).toString(16);return r.length===1?"0"+r:r};return`#${a(e)}${a(n)}${a(s)}`}function D(e){const n=et(e);if(!n)return null;const s=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return s?{r:parseInt(s[1],16),g:parseInt(s[2],16),b:parseInt(s[3],16)}:null}function It(e,n){const s=D(e),a=D(n);if(!s||!a)return null;const o=(u,p,d)=>{const[b,g,h]=[u,p,d].map(y=>(y=y/255,y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4)));return .2126*b+.7152*g+.0722*h},r=o(s.r,s.g,s.b),l=o(a.r,a.g,a.b),i=Math.max(r,l),c=Math.min(r,l);return(i+.05)/(c+.05)}function nt(e){if(!e)return[0,0,0,1];const s=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(s){const u=s[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),d=parseInt(u.slice(2,4),16),b=parseInt(u.slice(4,6),16),g=parseInt(u.slice(6,8),16)/255;return[p,d,b,g]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),b=parseInt(u[2]+u[2],16),g=parseInt(u[3]+u[3],16)/255;return[p,d,b,g]}if(u.length===3){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),b=parseInt(u[2]+u[2],16);return[p,d,b,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const o=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const r=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(r){const u=parseFloat(r[1]),p=parseFloat(r[2]),d=parseFloat(r[3]),b=r[4]!=null?parseFloat(r[4]):1,[g,h,y]=G(u,p/100,d/100);return[g,h,y,b]}const l=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,d=parseFloat(l[3])/100,b=l[4]!=null?parseFloat(l[4]):1,[g,h,y]=st(u,p,d);return[g,h,y,b]}const i=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(i){const u=i[1],p=parseFloat(i[2]),d=parseFloat(i[3]),b=i[4]!=null?parseFloat(i[4]):1,g=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[h,y,M]=lt(g,p,d);return[h,y,M,b]}const c=D(e);return c?[c.r,c.g,c.b,1]:[0,0,0,1]}function at(e,n,s,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(s)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function rt(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function G(e,n,s){e=(e%360+360)%360;const a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(e/60%2-1)),r=s-a/2;let l,i,c;return 0<=e&&e<60?[l,i,c]=[a,o,0]:60<=e&&e<120?[l,i,c]=[o,a,0]:120<=e&&e<180?[l,i,c]=[0,a,o]:180<=e&&e<240?[l,i,c]=[0,o,a]:240<=e&&e<300?[l,i,c]=[o,0,a]:[l,i,c]=[a,0,o],[Math.round((l+r)*255),Math.round((i+r)*255),Math.round((c+r)*255)]}function st(e,n,s){e=(e%360+360)%360;const a=n+s;a>1&&(n/=a,s/=a);const[o,r,l]=G(e,1,.5).map(d=>d/255),i=1-n-s,c=o*i+n,u=r*i+n,p=l*i+n;return[Math.round(c*255),Math.round(u*255),Math.round(p*255)]}function z(e,n,s){e/=255,n/=255,s/=255;const a=Math.max(e,n,s),o=Math.min(e,n,s);let r=0,l=0;const i=(a+o)/2,c=a-o;if(c!==0){switch(l=i>.5?c/(2-a-o):c/(a+o),a){case e:r=(n-s)/c+(n<s?6:0);break;case n:r=(s-e)/c+2;break;default:r=(e-n)/c+4}r*=60}return[Math.round(r),Math.round(l*100),Math.round(i*100)]}function ot(e,n,s){const[a]=z(e,n,s),o=e/255,r=n/255,l=s/255,i=Math.min(o,r,l),c=1-Math.max(o,r,l);return[a,Math.round(i*100),Math.round(c*100)]}function U(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function L(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function lt(e,n,s){const a=s*Math.PI/180,o=Math.cos(a)*n,r=Math.sin(a)*n,l=e+.3963377774*o+.2158037573*r,i=e-.1055613458*o-.0638541728*r,c=e-.0894841775*o-1.291485548*r,u=l*l*l,p=i*i*i,d=c*c*c,b=4.0767416621*u-3.3077115913*p+.2309699292*d,g=-1.2684380046*u+2.6097574011*p-.3413193965*d,h=-.0041960863*u-.7034186147*p+1.707614701*d;return[L(b),L(g),L(h)]}function it(e,n,s){const a=U(e),o=U(n),r=U(s),l=.4122214708*a+.5363325363*o+.0514459929*r,i=.2119034982*a+.6806995451*o+.1073969566*r,c=.0883024619*a+.2817188376*o+.6299787005*r,u=Math.cbrt(l),p=Math.cbrt(i),d=Math.cbrt(c),b=.2104542553*u+.793617785*p-.0040720468*d,g=1.9779984951*u-2.428592205*p+.4505937099*d,h=.0259040371*u+.7827717662*p-.808675766*d,y=Math.sqrt(g*g+h*h);let M=Math.atan2(h,g)*180/Math.PI;return M<0&&(M+=360),[b,y,M]}function v(e,n,s,a,o,r){switch(o){case"hex":if(r){const l=c=>c.toString(16).padStart(2,"0"),i=Math.max(0,Math.min(255,Math.round(a*255)));return`#${l(e)}${l(n)}${l(s)}${l(i)}`}return q(e,n,s);case"rgb":return`rgb(${e}, ${n}, ${s})`;case"rgba":return`rgba(${e}, ${n}, ${s}, ${Math.round(a*100)/100})`;case"hsl":{const[l,i,c]=z(e,n,s);return`hsl(${l}, ${i}%, ${c}%)`}case"hsla":{const[l,i,c]=z(e,n,s);return`hsla(${l}, ${i}%, ${c}%, ${Math.round(a*100)/100})`}case"hwb":{const[l,i,c]=ot(e,n,s);return a<1?`hwb(${l} ${i}% ${c}% / ${Math.round(a*100)/100})`:`hwb(${l} ${i}% ${c}%)`}case"oklch":{const[l,i,c]=it(e,n,s),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(i*1e3)/1e3).toFixed(3),d=(Math.round(c*10)/10).toFixed(1),b=Math.round(a*100)/100;return r||a<1?`oklch(${u} ${p} ${d} / ${b})`:`oklch(${u} ${p} ${d})`}}}function E(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}async function ct(e){return new Promise((n,s)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const o=a.result;n(o.split(",")[1])},a.onerror=o=>s(o)})}function Vt(e){return Promise.all(e.map(ct))}function xt(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function Mt(e){const n=mt.decodeBase64(e??""),s=n.length,a=new Uint8Array(s);for(let o=0;o<s;o++)a[o]=n.charCodeAt(o);return a}function ut(e){const{value:n,onChange:s,onInput:a,...o}=e,r=new Map,l=t.Value.toSignal(n).map(p=>p.map((d,b)=>{const g=r.get(d),h=Mt(d??""),y=g?.type||xt(h),M=g?.name??`file-${b}`,_=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength),w=new Blob([_],{type:y});return new File([w],M,{type:y})})),i=p=>d=>{p&&Vt(d).then(b=>{for(const[g,h]of b.entries())r.set(h,{name:d[g].name,type:d[g].type});p(b)})},c=i(s),u=i(a);return k.FilesInput({...o,value:l,onChange:c,onInput:u})}function $t(e){const{value:n,onInput:s,onChange:a,...o}=e;return ut({...o,maxFiles:1,value:t.Value.map(n,r=>r==null?[]:[r]),onChange:r=>{a?.(r[0])},onInput:r=>{s?.(r[0])}})}function _t(e,n){const[s,a,o]=e,r=s<<16^a<<8^o,l=rt(r),i=6+Math.floor(l()*5),c=.18+l()*.06,u=[];for(let g=0;g<i;g++){const h=g/i*Math.PI*2,y=n*(1+(l()*2-1)*c),M=Math.cos(h)*y,_=Math.sin(h)*y;u.push({x:M,y:_})}const p=(u[0].x+u[i-1].x)/2,d=(u[0].y+u[i-1].y)/2;let b=`M ${p.toFixed(3)} ${d.toFixed(3)}`;for(let g=0;g<i;g++){const h=u[g],y=u[(g+1)%i],M=(h.x+y.x)/2,_=(h.y+y.y)/2;b+=` Q ${h.x.toFixed(3)} ${h.y.toFixed(3)} ${M.toFixed(3)} ${_.toFixed(3)}`}return b+=" Z",b}const Ct=e=>{const{value:n,onBlur:s,onChange:a,onInput:o,displayValue:r,swatchSize:l,withAlpha:i}=e,c={xs:20,sm:26,md:32,lg:40,xl:52},u=l!=null?t.Value.map(l,m=>Number(m)):t.Value.map(e.size??"md",m=>c[m]??32),p=t.Value.map(n,m=>nt(m??"#000000")),d=t.Value.map(p,([m,V,$])=>[m,V,$]),b=t.Value.map(p,([,,,m])=>m),g=t.prop(t.Value.get(b)??1),h=t.Value.map(i??!1,m=>m),y=t.Value.map(e.colorTextFormat??"rgb",m=>m),M=t.computedOf(d,g,y,h)(([m,V,$],T,A,F)=>v(m,V,$,T??1,E(A,F),F)),_=t.Value.map(e.colorTextFormat??"hex",m=>m),w=t.Value.map(u,m=>`${-m/2} ${-m/2} ${m} ${m}`),f=t.computedOf(d,u)((m,V)=>_t(m,V/2)),I=t.computedOf(d,g,h)(([m,V,$],T,A)=>A||T<1?at(m,V,$,T):q(m,V,$)),C=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(h,m=>m?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(u)(m=>`width:${m+2}px;height:${m+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(w),t.svg.path(t.svgAttr.d(f),t.svgAttr.fill(I))),t.html.input(t.attr.type("color"),N.CommonInputAttributes(e),t.attr.value(t.Value.map(d,([m,V,$])=>q(m,V,$))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),s!=null?t.on.blur(s):t.Empty,a!=null?t.on.change(m=>{const V=m.target.value;if(!a)return;const{r:$,g:T,b:A}=D(V)??{r:0,g:0,b:0},F=t.Value.get(g)??1,S=E(t.Value.get(_),t.Value.get(h)),X=v($,T,A,F,S,t.Value.get(h));a(X)}):t.Empty,o!=null?t.on.input(m=>{const V=m.target.value;if(!o)return;const{r:$,g:T,b:A}=D(V)??{r:0,g:0,b:0},F=t.Value.get(g)??1,S=E(t.Value.get(_),t.Value.get(h)),X=v($,T,A,F,S,t.Value.get(h));o(X)}):t.Empty)),x=t.When(h,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(g,m=>String(m??1))),t.attr.disabled(e.disabled),t.on.input(m=>{const V=parseFloat(m.target.value);g.set(V);const[$,T,A]=t.Value.get(d),F=E(t.Value.get(_),t.Value.get(h)),S=v($,T,A,V,F,t.Value.get(h));o?.(S)}),t.on.change(m=>{const V=parseFloat(m.target.value);g.set(V);const[$,T,A]=t.Value.get(d),F=E(t.Value.get(_),t.Value.get(h)),S=v($,T,A,V,F,t.Value.get(h));a?.(S)}))),{swatchSize:W,displayValue:H,withAlpha:j,colorTextFormat:K,...P}=e;return B.InputContainer({baseContainer:!0,...P,growInput:!1,input:C,after:t.Fragment(t.When(r??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),M)),x,e.after)})},pt=e=>typeof e=="string"&&e.trim()===""?null:e,dt=e=>e??"";function O(e){return n=>{const{after:s,disabled:a}=n,o=N.mapInputOptions(n,dt,pt),r=k.NullableResetAfter(n.value,a,n.onChange??n.onInput);return e({...o,after:s!=null?t.Fragment(r,s):r})}}const Tt=({startEditing:e,value:n,onChange:s,placeholder:a,disabled:o})=>{const r=t.Value.deriveProp(e??!1),l=t.prop(!1),i=t.Value.map(o??!1,c=>c);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(i,c=>c?"bc-editable-text--disabled":"")),t.aria.disabled(i),t.When(r,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),ft.AutoSelect(),t.on.keydown(c=>{c.key==="Enter"?r.set(!1):c.key==="Escape"&&(l.set(!0),r.set(!1))}),t.on.blur(t.emitValue(c=>{if(r.set(!1),l.value){l.set(!1);return}s(c)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(i)||r.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,c=>c!=null&&c.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(i,c=>!c),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(R.BeatUII18n,c=>t.aria.label(c.$.editLabel)),t.on.click(()=>r.set(!0)),R.Icon({icon:"line-md/pencil",color:"neutral"}))))))},At=e=>{const{value:n,onBlur:s,onChange:a,onInput:o,after:r,disabled:l}=e,i=k.NullableResetAfter(n,l,a??o);return B.InputContainer({...e,input:t.input.date(N.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),s!=null?t.on.blur(t.emitValue(s)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDate(o)):t.Empty),after:r!=null?t.Fragment(i,r):i})},Ft=e=>{const n=e.getFullYear(),s=e.getMonth()+1,a=e.getDate(),o=e.getHours(),r=e.getMinutes(),l=e.getSeconds();return`${n}-${s.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},kt=e=>{const{value:n,onBlur:s,onChange:a,onInput:o,after:r,disabled:l}=e,i=t.Value.map(n,u=>u!=null?Ft(u):null),c=k.NullableResetAfter(n,l,a??o);return B.InputContainer({...e,input:t.input["datetime-local"](N.CommonInputAttributes(e),t.attr.value(t.Value.map(i,u=>u??null)),t.attr.class("bc-input"),s!=null?t.on.blur(t.emitValue(s)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDateTime(o)):t.Empty),after:r!=null?t.Fragment(c,r):c})},Nt=O(Q.EmailInput),St=O(N.TextInput),Rt=O(Q.PasswordInput),vt=O(k.TextArea),Et=({value:e,onChange:n,onInput:s,onBlur:a,offLabel:o,onLabel:r,disabled:l=!1,size:i="md",id:c,color:u="primary",tabIndex:p=0,matchInputHeight:d=!0,ariaLabel:b})=>{const g=c??bt.sessionId("switch");function h(w,f){const I=["bc-switch",`bc-switch--size-${f}`,`bc-switch--${f}`];return d&&I.push("bc-switch--match-input"),w&&I.push("bc-switch--disabled"),I.join(" ")}function y(w){const f=w??"primary",I=new Map,C=R.backgroundValue(f,"solid","light"),x=R.backgroundValue(f,"solid","dark");return I.set("--switch-track-on-bg",C.backgroundColor),I.set("--switch-track-on-label",C.textColor),I.set("--switch-track-on-bg-dark",x.backgroundColor),I.set("--switch-track-on-label-dark",x.textColor),I.set("--switch-track-on-border-dark",R.borderColorValue(f,"dark")),Array.from(I.entries()).map(([W,H])=>`${W}: ${H}`).join("; ")}const M=()=>{t.Value.get(l)||(n?.(!t.Value.get(e)),s?.(!t.Value.get(e)))},_=w=>{t.Value.get(l)||(w.key===" "||w.key==="Enter")&&(w.preventDefault(),M())};return t.html.div(t.attr.class(t.computedOf(l??!1,i)((w,f)=>h(w??!1,f??"md"))),t.attr.style(t.computedOf(u)(w=>y(w))),t.attr.id(g),t.attr.role("switch"),t.attr.tabindex(t.computedOf(l??!1,p)((w,f)=>w?-1:f??0)),t.aria.checked(e),t.aria.disabled(l),b!=null?t.aria.label(b):null,t.on.click(M),t.on.keydown(_),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__track--on":"bc-switch__track--off")),o!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,r!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),r):null,t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__thumb--on":"bc-switch__thumb--off")))))},Dt=O(k.UuidInput),Bt="line-md:star-alt-filled",Ot="line-md:star-alt",ht=e=>{const{value:n,onChange:s,onInput:a,disabled:o,max:r=5,fullColor:l="yellow",emptyColor:i="neutral",activeIcon:c=Bt,inactiveIcon:u=Ot,size:p="md",onBlur:d,rounding:b=1}=e,g=()=>{const f=t.Value.get(b);return f>0?f:1},h=f=>Math.min(Math.max(f,0),t.Value.get(r)),y=(f,I)=>{if(t.Value.get(o??!1))return;const x=f.currentTarget.getBoundingClientRect(),W=(f.clientX-x.left)/x.width,H=I-1+W,j=g(),K=Math.ceil(H/j)*j,P=h(K);s?.(P),a?.(P)},M=f=>{if(t.Value.get(o??!1))return;const I=g(),C=t.Value.get(n)??0;let x;switch(f.key){case"ArrowRight":case"ArrowUp":x=h(C+I);break;case"ArrowLeft":case"ArrowDown":x=h(C-I);break;case"Home":x=0;break;case"End":x=t.Value.get(r);break;default:return}f.preventDefault(),s?.(x),a?.(x)},_=t.Value.map(p,f=>`bc-icon--${f}`),w=({index:f,counter:I})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(_),t.on.click(t.emit(C=>y(C,I),{preventDefault:!0,stopPropagation:!0})),R.Icon({icon:u,size:p,color:i,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(_),t.style.width(t.Value.map(n,C=>{const x=Math.floor(C);return x>f?"100%":x<f?"0%":`${(C-f)*100}%`})),R.Icon({icon:c,size:p,color:l,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))));return B.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(N.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(o??!1,f=>f?-1:0)),t.aria.disabled(o??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(r,f=>f??0)),t.aria.valuenow(t.Value.map(n,f=>f??0)),t.aria.valuetext(t.computedOf(n,r)((f,I)=>{const C=f??0,x=I??0;return`${String(C)} / ${String(x)}`})),t.on.keydown(M),d!=null?t.on.blur(d):null,t.Repeat(r,w))})},Wt=e=>{const{after:n,disabled:s}=e,a=N.mapInputOptions(e,r=>r??0,r=>r),o=k.NullableResetAfter(e.value,s,e.onChange??e.onInput);return ht({...a,after:n!=null?t.Fragment(o,n):o})},Ht=e=>{const{value:n,step:s,min:a,max:o,onBlur:r,onChange:l,onInput:i}=e;return B.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),N.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(s),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),r!=null?t.on.blur(t.emitValueAsNumber(r)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(i)):t.Empty)})},Pt=e=>{const{value:n,step:s,min:a,max:o,onBlur:r,onChange:l,onInput:i}=e,c=t.Value.map(n,p=>{if(p!=null)return p;const d=a!=null?t.Value.get(a):void 0;return typeof d=="number"?d:0}),u=k.NullableResetAfter(n,e.disabled,l??i);return B.InputContainer({...e,focusableSelector:'input[type="range"]',after:u,input:t.html.input(t.attr.type("range"),N.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(s),t.attr.valueAsNumber(c),t.attr.class("bc-input bc-slider-input"),r!=null?t.on.blur(t.emitValueAsNumber(r)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(p=>{l(p)})):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(p=>{i(p)})):t.Empty)})},Ut=O(k.UrlInput);class gt{widgets=new Map;typeMapping=new Map;register(n,s){if(this.widgets.set(n,s),s.supportedTypes)for(const a of s.supportedTypes)this.typeMapping.has(a)||this.typeMapping.set(a,[]),this.typeMapping.get(a).push(n),this.typeMapping.get(a).sort((o,r)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(r)?.priority||0)-l})}unregister(n){const s=this.widgets.get(n);if(s&&(this.widgets.delete(n),s.supportedTypes))for(const a of s.supportedTypes){const o=this.typeMapping.get(a);if(o){const r=o.indexOf(n);r>=0&&o.splice(r,1),o.length===0&&this.typeMapping.delete(a)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(a=>this.widgets.get(a)).filter(Boolean)}findBestWidget(n){const s=yt.resolveWidget(n.definition,n.name);if(s?.widget){const o=this.widgets.get(s.widget);if(o)return{name:s.widget,registration:o,resolved:s}}const a=[];for(const[o,r]of this.widgets.entries())if(r.matcher)try{r.matcher(n)&&a.push({name:o,registration:r,priority:r.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(a.length>0){a.sort((r,l)=>l.priority-r.priority);const o=a[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,r=this.getForType(o);if(r.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:r[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Lt=new gt;function qt(e,n,s){return{factory:n,matcher:a=>{const r=a.definition["x:ui"];return r===e||typeof r=="object"&&r!==null&&r.widget===e},displayName:s?.displayName??e,priority:s?.priority??100,...s}}function zt(e,n,s){return{factory:n,matcher:a=>a.definition.format===e,displayName:s?.displayName??`${e} widget`,priority:s?.priority??75,...s}}function jt(e,n,s,a){return{factory:s,matcher:o=>{const r=o.definition;return r.type===e&&r.format===n},displayName:a?.displayName??`${e}:${n} widget`,priority:a?.priority??80,...a}}function Xt(e){const n=e?.logPrefix??"WIDGET_DIAG",s=e?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:a=>{if(!s(a))return!1;const o=a.definition,r={name:a.name,path:a.path.map(String),type:o?.type,hasRegistry:a.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${r.name??"ROOT"}" path=[${r.path.join(", ")}] type="${r.type??"unknown"}" hasRegistry=${r.hasRegistry}`),e?.onProcess?.(r),!1}}}exports.Base64Input=$t;exports.Base64sInput=ut;exports.ColorSwatchInput=Ct;exports.EditableText=Tt;exports.NullableDateInput=At;exports.NullableDateTimeInput=kt;exports.NullableEmailInput=Nt;exports.NullablePasswordInput=Rt;exports.NullableRatingInput=Wt;exports.NullableSliderInput=Pt;exports.NullableTextArea=vt;exports.NullableTextInput=St;exports.NullableUrlInput=Ut;exports.NullableUuidInput=Dt;exports.RatingInput=ht;exports.SliderInput=Ht;exports.Switch=Et;exports.WidgetRegistry=gt;exports.createDiagnosticWidget=Xt;exports.emptyToNull=pt;exports.fileToBase64=ct;exports.forFormat=zt;exports.forTypeAndFormat=jt;exports.forXUI=qt;exports.formatColor=v;exports.getContrastRatio=It;exports.globalWidgetRegistry=Lt;exports.hexToRgb=D;exports.hslToRgb=G;exports.hwbToRgb=st;exports.isValidColor=wt;exports.isValidHexColor=Y;exports.isValidHslColor=tt;exports.isValidRgbColor=Z;exports.isValidRgbaColor=J;exports.linearToSrgb=L;exports.mulberry32=rt;exports.normalizeHexColor=et;exports.nullToEmpty=dt;exports.oklchToRgb=lt;exports.parseAnyColor=nt;exports.resolveEffectiveFormat=E;exports.rgbToHex=q;exports.rgbToHsl=z;exports.rgbToHwb=ot;exports.rgbToOklch=it;exports.srgbToLinear=U;exports.toRgbaString=at;
|
|
1
|
+
"use strict";const t=require("@tempots/dom"),k=require("./deep-merge-Bydz6jLt.cjs"),mt=require("@tempots/std"),B=require("./input-container-BkPcNDaZ.cjs"),N=require("./text-input-D_IxFd0M.cjs"),R=require("./translations-qefRsdGi.cjs"),ft=require("@tempots/ui"),Q=require("./notice-Q0A1gIho.cjs"),bt=require("./session-id-B5lJMzbB.cjs"),yt=require("./utils-DmEuG3Np.cjs");function Y(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function Z(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,s=e.match(n);if(!s)return!1;const[,a,o,r]=s,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(r,10);return l>=0&&l<=255&&i>=0&&i<=255&&c>=0&&c<=255}function J(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,s=e.match(n);if(!s)return!1;const[,a,o,r,l]=s,i=parseInt(a,10),c=parseInt(o,10),u=parseInt(r,10),p=parseFloat(l);return i>=0&&i<=255&&c>=0&&c<=255&&u>=0&&u<=255&&p>=0&&p<=1}function tt(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,s=e.match(n);if(!s)return!1;const[,a,o,r]=s,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(r,10);return l>=0&&l<=360&&i>=0&&i<=100&&c>=0&&c<=100}function wt(e){return Y(e)||Z(e)||J(e)||tt(e)}function et(e){if(!Y(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(s=>s+s).join("")),`#${n.toLowerCase()}`}function q(e,n,s){const a=o=>{const r=Math.round(Math.max(0,Math.min(255,o))).toString(16);return r.length===1?"0"+r:r};return`#${a(e)}${a(n)}${a(s)}`}function D(e){const n=et(e);if(!n)return null;const s=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return s?{r:parseInt(s[1],16),g:parseInt(s[2],16),b:parseInt(s[3],16)}:null}function It(e,n){const s=D(e),a=D(n);if(!s||!a)return null;const o=(u,p,d)=>{const[b,g,h]=[u,p,d].map(y=>(y=y/255,y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4)));return .2126*b+.7152*g+.0722*h},r=o(s.r,s.g,s.b),l=o(a.r,a.g,a.b),i=Math.max(r,l),c=Math.min(r,l);return(i+.05)/(c+.05)}function nt(e){if(!e)return[0,0,0,1];const s=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(s){const u=s[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),d=parseInt(u.slice(2,4),16),b=parseInt(u.slice(4,6),16),g=parseInt(u.slice(6,8),16)/255;return[p,d,b,g]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),b=parseInt(u[2]+u[2],16),g=parseInt(u[3]+u[3],16)/255;return[p,d,b,g]}if(u.length===3){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),b=parseInt(u[2]+u[2],16);return[p,d,b,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const o=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const r=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(r){const u=parseFloat(r[1]),p=parseFloat(r[2]),d=parseFloat(r[3]),b=r[4]!=null?parseFloat(r[4]):1,[g,h,y]=G(u,p/100,d/100);return[g,h,y,b]}const l=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,d=parseFloat(l[3])/100,b=l[4]!=null?parseFloat(l[4]):1,[g,h,y]=st(u,p,d);return[g,h,y,b]}const i=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(i){const u=i[1],p=parseFloat(i[2]),d=parseFloat(i[3]),b=i[4]!=null?parseFloat(i[4]):1,g=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[h,y,M]=lt(g,p,d);return[h,y,M,b]}const c=D(e);return c?[c.r,c.g,c.b,1]:[0,0,0,1]}function at(e,n,s,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(s)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function rt(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function G(e,n,s){e=(e%360+360)%360;const a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(e/60%2-1)),r=s-a/2;let l,i,c;return 0<=e&&e<60?[l,i,c]=[a,o,0]:60<=e&&e<120?[l,i,c]=[o,a,0]:120<=e&&e<180?[l,i,c]=[0,a,o]:180<=e&&e<240?[l,i,c]=[0,o,a]:240<=e&&e<300?[l,i,c]=[o,0,a]:[l,i,c]=[a,0,o],[Math.round((l+r)*255),Math.round((i+r)*255),Math.round((c+r)*255)]}function st(e,n,s){e=(e%360+360)%360;const a=n+s;a>1&&(n/=a,s/=a);const[o,r,l]=G(e,1,.5).map(d=>d/255),i=1-n-s,c=o*i+n,u=r*i+n,p=l*i+n;return[Math.round(c*255),Math.round(u*255),Math.round(p*255)]}function z(e,n,s){e/=255,n/=255,s/=255;const a=Math.max(e,n,s),o=Math.min(e,n,s);let r=0,l=0;const i=(a+o)/2,c=a-o;if(c!==0){switch(l=i>.5?c/(2-a-o):c/(a+o),a){case e:r=(n-s)/c+(n<s?6:0);break;case n:r=(s-e)/c+2;break;default:r=(e-n)/c+4}r*=60}return[Math.round(r),Math.round(l*100),Math.round(i*100)]}function ot(e,n,s){const[a]=z(e,n,s),o=e/255,r=n/255,l=s/255,i=Math.min(o,r,l),c=1-Math.max(o,r,l);return[a,Math.round(i*100),Math.round(c*100)]}function U(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function L(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function lt(e,n,s){const a=s*Math.PI/180,o=Math.cos(a)*n,r=Math.sin(a)*n,l=e+.3963377774*o+.2158037573*r,i=e-.1055613458*o-.0638541728*r,c=e-.0894841775*o-1.291485548*r,u=l*l*l,p=i*i*i,d=c*c*c,b=4.0767416621*u-3.3077115913*p+.2309699292*d,g=-1.2684380046*u+2.6097574011*p-.3413193965*d,h=-.0041960863*u-.7034186147*p+1.707614701*d;return[L(b),L(g),L(h)]}function it(e,n,s){const a=U(e),o=U(n),r=U(s),l=.4122214708*a+.5363325363*o+.0514459929*r,i=.2119034982*a+.6806995451*o+.1073969566*r,c=.0883024619*a+.2817188376*o+.6299787005*r,u=Math.cbrt(l),p=Math.cbrt(i),d=Math.cbrt(c),b=.2104542553*u+.793617785*p-.0040720468*d,g=1.9779984951*u-2.428592205*p+.4505937099*d,h=.0259040371*u+.7827717662*p-.808675766*d,y=Math.sqrt(g*g+h*h);let M=Math.atan2(h,g)*180/Math.PI;return M<0&&(M+=360),[b,y,M]}function v(e,n,s,a,o,r){switch(o){case"hex":if(r){const l=c=>c.toString(16).padStart(2,"0"),i=Math.max(0,Math.min(255,Math.round(a*255)));return`#${l(e)}${l(n)}${l(s)}${l(i)}`}return q(e,n,s);case"rgb":return`rgb(${e}, ${n}, ${s})`;case"rgba":return`rgba(${e}, ${n}, ${s}, ${Math.round(a*100)/100})`;case"hsl":{const[l,i,c]=z(e,n,s);return`hsl(${l}, ${i}%, ${c}%)`}case"hsla":{const[l,i,c]=z(e,n,s);return`hsla(${l}, ${i}%, ${c}%, ${Math.round(a*100)/100})`}case"hwb":{const[l,i,c]=ot(e,n,s);return a<1?`hwb(${l} ${i}% ${c}% / ${Math.round(a*100)/100})`:`hwb(${l} ${i}% ${c}%)`}case"oklch":{const[l,i,c]=it(e,n,s),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(i*1e3)/1e3).toFixed(3),d=(Math.round(c*10)/10).toFixed(1),b=Math.round(a*100)/100;return r||a<1?`oklch(${u} ${p} ${d} / ${b})`:`oklch(${u} ${p} ${d})`}}}function E(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}async function ct(e){return new Promise((n,s)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const o=a.result;n(o.split(",")[1])},a.onerror=o=>s(o)})}function Vt(e){return Promise.all(e.map(ct))}function xt(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function Mt(e){const n=mt.decodeBase64(e??""),s=n.length,a=new Uint8Array(s);for(let o=0;o<s;o++)a[o]=n.charCodeAt(o);return a}function ut(e){const{value:n,onChange:s,onInput:a,...o}=e,r=new Map,l=t.Value.toSignal(n).map(p=>p.map((d,b)=>{const g=r.get(d),h=Mt(d??""),y=g?.type||xt(h),M=g?.name??`file-${b}`,_=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength),w=new Blob([_],{type:y});return new File([w],M,{type:y})})),i=p=>d=>{p&&Vt(d).then(b=>{for(const[g,h]of b.entries())r.set(h,{name:d[g].name,type:d[g].type});p(b)})},c=i(s),u=i(a);return k.FilesInput({...o,value:l,onChange:c,onInput:u})}function $t(e){const{value:n,onInput:s,onChange:a,...o}=e;return ut({...o,maxFiles:1,value:t.Value.map(n,r=>r==null?[]:[r]),onChange:r=>{a?.(r[0])},onInput:r=>{s?.(r[0])}})}function _t(e,n){const[s,a,o]=e,r=s<<16^a<<8^o,l=rt(r),i=6+Math.floor(l()*5),c=.18+l()*.06,u=[];for(let g=0;g<i;g++){const h=g/i*Math.PI*2,y=n*(1+(l()*2-1)*c),M=Math.cos(h)*y,_=Math.sin(h)*y;u.push({x:M,y:_})}const p=(u[0].x+u[i-1].x)/2,d=(u[0].y+u[i-1].y)/2;let b=`M ${p.toFixed(3)} ${d.toFixed(3)}`;for(let g=0;g<i;g++){const h=u[g],y=u[(g+1)%i],M=(h.x+y.x)/2,_=(h.y+y.y)/2;b+=` Q ${h.x.toFixed(3)} ${h.y.toFixed(3)} ${M.toFixed(3)} ${_.toFixed(3)}`}return b+=" Z",b}const Ct=e=>{const{value:n,onBlur:s,onChange:a,onInput:o,displayValue:r,swatchSize:l,withAlpha:i}=e,c={xs:20,sm:26,md:32,lg:40,xl:52},u=l!=null?t.Value.map(l,m=>Number(m)):t.Value.map(e.size??"md",m=>c[m]??32),p=t.Value.map(n,m=>nt(m??"#000000")),d=t.Value.map(p,([m,V,$])=>[m,V,$]),b=t.Value.map(p,([,,,m])=>m),g=t.prop(t.Value.get(b)??1),h=t.Value.map(i??!1,m=>m),y=t.Value.map(e.colorTextFormat??"rgb",m=>m),M=t.computedOf(d,g,y,h)(([m,V,$],T,A,F)=>v(m,V,$,T??1,E(A,F),F)),_=t.Value.map(e.colorTextFormat??"hex",m=>m),w=t.Value.map(u,m=>`${-m/2} ${-m/2} ${m} ${m}`),f=t.computedOf(d,u)((m,V)=>_t(m,V/2)),I=t.computedOf(d,g,h)(([m,V,$],T,A)=>A||T<1?at(m,V,$,T):q(m,V,$)),C=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(h,m=>m?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(u)(m=>`width:${m+2}px;height:${m+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(w),t.svg.path(t.svgAttr.d(f),t.svgAttr.fill(I))),t.html.input(t.attr.type("color"),N.CommonInputAttributes(e),t.attr.value(t.Value.map(d,([m,V,$])=>q(m,V,$))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),s!=null?t.on.blur(s):t.Empty,a!=null?t.on.change(m=>{const V=m.target.value;if(!a)return;const{r:$,g:T,b:A}=D(V)??{r:0,g:0,b:0},F=t.Value.get(g)??1,S=E(t.Value.get(_),t.Value.get(h)),X=v($,T,A,F,S,t.Value.get(h));a(X)}):t.Empty,o!=null?t.on.input(m=>{const V=m.target.value;if(!o)return;const{r:$,g:T,b:A}=D(V)??{r:0,g:0,b:0},F=t.Value.get(g)??1,S=E(t.Value.get(_),t.Value.get(h)),X=v($,T,A,F,S,t.Value.get(h));o(X)}):t.Empty)),x=t.When(h,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(g,m=>String(m??1))),t.attr.disabled(e.disabled),t.on.input(m=>{const V=parseFloat(m.target.value);g.set(V);const[$,T,A]=t.Value.get(d),F=E(t.Value.get(_),t.Value.get(h)),S=v($,T,A,V,F,t.Value.get(h));o?.(S)}),t.on.change(m=>{const V=parseFloat(m.target.value);g.set(V);const[$,T,A]=t.Value.get(d),F=E(t.Value.get(_),t.Value.get(h)),S=v($,T,A,V,F,t.Value.get(h));a?.(S)}))),{swatchSize:W,displayValue:H,withAlpha:j,colorTextFormat:K,...P}=e;return B.InputContainer({baseContainer:!0,...P,growInput:!1,input:C,after:t.Fragment(t.When(r??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),M)),x,e.after)})},pt=e=>typeof e=="string"&&e.trim()===""?null:e,dt=e=>e??"";function O(e){return n=>{const{after:s,disabled:a}=n,o=N.mapInputOptions(n,dt,pt),r=k.NullableResetAfter(n.value,a,n.onChange??n.onInput);return e({...o,after:s!=null?t.Fragment(r,s):r})}}const Tt=({startEditing:e,value:n,onChange:s,placeholder:a,disabled:o})=>{const r=t.Value.deriveProp(e??!1),l=t.prop(!1),i=t.Value.map(o??!1,c=>c);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(i,c=>c?"bc-editable-text--disabled":"")),t.aria.disabled(i),t.When(r,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),ft.AutoSelect(),t.on.keydown(c=>{c.key==="Enter"?r.set(!1):c.key==="Escape"&&(l.set(!0),r.set(!1))}),t.on.blur(t.emitValue(c=>{if(r.set(!1),l.value){l.set(!1);return}s(c)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(i)||r.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,c=>c!=null&&c.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(i,c=>!c),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(R.BeatUII18n,c=>t.aria.label(c.$.editLabel)),t.on.click(()=>r.set(!0)),R.Icon({icon:"line-md/pencil",color:"neutral"}))))))},At=e=>{const{value:n,onBlur:s,onChange:a,onInput:o,after:r,disabled:l}=e,i=k.NullableResetAfter(n,l,a??o);return B.InputContainer({...e,input:t.input.date(N.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),s!=null?t.on.blur(t.emitValue(s)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDate(o)):t.Empty),after:r!=null?t.Fragment(i,r):i})},Ft=e=>{const n=e.getFullYear(),s=e.getMonth()+1,a=e.getDate(),o=e.getHours(),r=e.getMinutes(),l=e.getSeconds();return`${n}-${s.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},kt=e=>{const{value:n,onBlur:s,onChange:a,onInput:o,after:r,disabled:l}=e,i=t.Value.map(n,u=>u!=null?Ft(u):null),c=k.NullableResetAfter(n,l,a??o);return B.InputContainer({...e,input:t.input["datetime-local"](N.CommonInputAttributes(e),t.attr.value(t.Value.map(i,u=>u??null)),t.attr.class("bc-input"),s!=null?t.on.blur(t.emitValue(s)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDateTime(o)):t.Empty),after:r!=null?t.Fragment(c,r):c})},Nt=O(Q.EmailInput),St=O(N.TextInput),Rt=O(Q.PasswordInput),vt=O(k.TextArea),Et=({value:e,onChange:n,onInput:s,onBlur:a,offLabel:o,onLabel:r,disabled:l=!1,size:i="md",id:c,color:u="primary",tabIndex:p=0,matchInputHeight:d=!0,ariaLabel:b})=>{const g=c??bt.sessionId("switch");function h(w,f){const I=["bc-switch",`bc-switch--size-${f}`,`bc-switch--${f}`];return d&&I.push("bc-switch--match-input"),w&&I.push("bc-switch--disabled"),I.join(" ")}function y(w){const f=w??"primary",I=new Map,C=R.backgroundValue(f,"solid","light"),x=R.backgroundValue(f,"solid","dark");return I.set("--switch-track-on-bg",C.backgroundColor),I.set("--switch-track-on-label",C.textColor),I.set("--switch-track-on-bg-dark",x.backgroundColor),I.set("--switch-track-on-label-dark",x.textColor),I.set("--switch-track-on-border-dark",R.borderColorValue(f,"dark")),Array.from(I.entries()).map(([W,H])=>`${W}: ${H}`).join("; ")}const M=()=>{t.Value.get(l)||(n?.(!t.Value.get(e)),s?.(!t.Value.get(e)))},_=w=>{t.Value.get(l)||(w.key===" "||w.key==="Enter")&&(w.preventDefault(),M())};return t.html.div(t.attr.class(t.computedOf(l??!1,i)((w,f)=>h(w??!1,f??"md"))),t.attr.style(t.computedOf(u)(w=>y(w))),t.attr.id(g),t.attr.role("switch"),t.attr.tabindex(t.computedOf(l??!1,p)((w,f)=>w?-1:f??0)),t.aria.checked(e),t.aria.disabled(l),b!=null?t.aria.label(b):null,t.on.click(M),t.on.keydown(_),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__track--on":"bc-switch__track--off")),o!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,r!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),r):null,t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,w=>w?"bc-switch__thumb--on":"bc-switch__thumb--off")))))},Dt=O(k.UuidInput),Bt="line-md:star-alt-filled",Ot="line-md:star-alt",ht=e=>{const{value:n,onChange:s,onInput:a,disabled:o,max:r=5,fullColor:l="yellow",emptyColor:i="neutral",activeIcon:c=Bt,inactiveIcon:u=Ot,size:p="md",onBlur:d,rounding:b=1}=e,g=()=>{const f=t.Value.get(b);return f>0?f:1},h=f=>Math.min(Math.max(f,0),t.Value.get(r)),y=(f,I)=>{if(t.Value.get(o??!1))return;const x=f.currentTarget.getBoundingClientRect(),W=(f.clientX-x.left)/x.width,H=I-1+W,j=g(),K=Math.ceil(H/j)*j,P=h(K);s?.(P),a?.(P)},M=f=>{if(t.Value.get(o??!1))return;const I=g(),C=t.Value.get(n)??0;let x;switch(f.key){case"ArrowRight":case"ArrowUp":x=h(C+I);break;case"ArrowLeft":case"ArrowDown":x=h(C-I);break;case"Home":x=0;break;case"End":x=t.Value.get(r);break;default:return}f.preventDefault(),s?.(x),a?.(x)},_=t.Value.map(p,f=>`bc-icon--${f}`),w=({index:f,counter:I})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(_),t.on.click(t.emit(C=>y(C,I),{preventDefault:!0,stopPropagation:!0})),R.Icon({icon:u,size:p,color:i,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(_),t.style.width(t.Value.map(n,C=>{const x=Math.floor(C);return x>f?"100%":x<f?"0%":`${(C-f)*100}%`})),R.Icon({icon:c,size:p,color:l,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))));return B.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(N.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(o??!1,f=>f?-1:0)),t.aria.disabled(o??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(r,f=>f??0)),t.aria.valuenow(t.Value.map(n,f=>f??0)),t.aria.valuetext(t.computedOf(n,r)((f,I)=>{const C=f??0,x=I??0;return`${String(C)} / ${String(x)}`})),t.on.keydown(M),d!=null?t.on.blur(d):null,t.Repeat(r,w))})},Wt=e=>{const{after:n,disabled:s}=e,a=N.mapInputOptions(e,r=>r??0,r=>r),o=k.NullableResetAfter(e.value,s,e.onChange??e.onInput);return ht({...a,after:n!=null?t.Fragment(o,n):o})},Ht=e=>{const{value:n,step:s,min:a,max:o,onBlur:r,onChange:l,onInput:i}=e;return B.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),N.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(s),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),r!=null?t.on.blur(t.emitValueAsNumber(r)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(i)):t.Empty)})},Pt=e=>{const{value:n,step:s,min:a,max:o,onBlur:r,onChange:l,onInput:i}=e,c=t.Value.map(n,p=>{if(p!=null)return p;const d=a!=null?t.Value.get(a):void 0;return typeof d=="number"?d:0}),u=k.NullableResetAfter(n,e.disabled,l??i);return B.InputContainer({...e,focusableSelector:'input[type="range"]',after:u,input:t.html.input(t.attr.type("range"),N.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(s),t.attr.valueAsNumber(c),t.attr.class("bc-input bc-slider-input"),r!=null?t.on.blur(t.emitValueAsNumber(r)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(p=>{l(p)})):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(p=>{i(p)})):t.Empty)})},Ut=O(k.UrlInput);class gt{widgets=new Map;typeMapping=new Map;register(n,s){if(this.widgets.set(n,s),s.supportedTypes)for(const a of s.supportedTypes)this.typeMapping.has(a)||this.typeMapping.set(a,[]),this.typeMapping.get(a).push(n),this.typeMapping.get(a).sort((o,r)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(r)?.priority||0)-l})}unregister(n){const s=this.widgets.get(n);if(s&&(this.widgets.delete(n),s.supportedTypes))for(const a of s.supportedTypes){const o=this.typeMapping.get(a);if(o){const r=o.indexOf(n);r>=0&&o.splice(r,1),o.length===0&&this.typeMapping.delete(a)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(a=>this.widgets.get(a)).filter(Boolean)}findBestWidget(n){const s=yt.resolveWidget(n.definition,n.name);if(s?.widget){const o=this.widgets.get(s.widget);if(o)return{name:s.widget,registration:o,resolved:s}}const a=[];for(const[o,r]of this.widgets.entries())if(r.matcher)try{r.matcher(n)&&a.push({name:o,registration:r,priority:r.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(a.length>0){a.sort((r,l)=>l.priority-r.priority);const o=a[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,r=this.getForType(o);if(r.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:r[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Lt=new gt;function qt(e,n,s){return{factory:n,matcher:a=>{const r=a.definition["x:ui"];return r===e||typeof r=="object"&&r!==null&&r.widget===e},displayName:s?.displayName??e,priority:s?.priority??100,...s}}function zt(e,n,s){return{factory:n,matcher:a=>a.definition.format===e,displayName:s?.displayName??`${e} widget`,priority:s?.priority??75,...s}}function jt(e,n,s,a){return{factory:s,matcher:o=>{const r=o.definition;return r.type===e&&r.format===n},displayName:a?.displayName??`${e}:${n} widget`,priority:a?.priority??80,...a}}function Xt(e){const n=e?.logPrefix??"WIDGET_DIAG",s=e?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:a=>{if(!s(a))return!1;const o=a.definition,r={name:a.name,path:a.path.map(String),type:o?.type,hasRegistry:a.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${r.name??"ROOT"}" path=[${r.path.join(", ")}] type="${r.type??"unknown"}" hasRegistry=${r.hasRegistry}`),e?.onProcess?.(r),!1}}}exports.Base64Input=$t;exports.Base64sInput=ut;exports.ColorSwatchInput=Ct;exports.EditableText=Tt;exports.NullableDateInput=At;exports.NullableDateTimeInput=kt;exports.NullableEmailInput=Nt;exports.NullablePasswordInput=Rt;exports.NullableRatingInput=Wt;exports.NullableSliderInput=Pt;exports.NullableTextArea=vt;exports.NullableTextInput=St;exports.NullableUrlInput=Ut;exports.NullableUuidInput=Dt;exports.RatingInput=ht;exports.SliderInput=Ht;exports.Switch=Et;exports.WidgetRegistry=gt;exports.createDiagnosticWidget=Xt;exports.emptyToNull=pt;exports.fileToBase64=ct;exports.forFormat=zt;exports.forTypeAndFormat=jt;exports.forXUI=qt;exports.formatColor=v;exports.getContrastRatio=It;exports.globalWidgetRegistry=Lt;exports.hexToRgb=D;exports.hslToRgb=G;exports.hwbToRgb=st;exports.isValidColor=wt;exports.isValidHexColor=Y;exports.isValidHslColor=tt;exports.isValidRgbColor=Z;exports.isValidRgbaColor=J;exports.linearToSrgb=L;exports.mulberry32=rt;exports.normalizeHexColor=et;exports.nullToEmpty=dt;exports.oklchToRgb=lt;exports.parseAnyColor=nt;exports.resolveEffectiveFormat=E;exports.rgbToHex=q;exports.rgbToHsl=z;exports.rgbToHwb=ot;exports.rgbToOklch=it;exports.srgbToLinear=U;exports.toRgbaString=at;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("@tempots/dom"),B=require("./input-container-BkPcNDaZ.cjs"),A=require("./text-input-D_IxFd0M.cjs"),O=require("./use-form-BvBkVEKi.cjs"),C=require("./translations-qefRsdGi.cjs"),ut=require("./stack-dwLevGa2.cjs"),L=require("@tempots/std"),It=require("@tempots/ui");let G=null;async function H(){const n=globalThis;return n.Temporal?n.Temporal:(G||(G=Promise.resolve().then(()=>require("./index.esm-C6lZ02yY.cjs")).then(e=>{const l=e.Temporal;return n.Temporal||(n.Temporal=l),l})),G)}const ct=(n,e)=>e?t.Task(H,{then:n,pending:e.pending,error:e.error}):t.Task(H,n);function Z({onChange:n,value:e,accept:l="*/*",enableClick:r=!0,content:o,disabled:h=!1,allowMultiple:s}){return t.Use(C.BeatUII18n,f=>{const m=t.Value.deriveProp(e??[]),x=t.prop(!1),p=u=>{u.preventDefault(),u.stopPropagation(),x.value=!0},d=u=>{u.preventDefault(),u.stopPropagation(),(!u.currentTarget||!u.currentTarget.contains(u.relatedTarget))&&(x.value=!1)},b=u=>{u.preventDefault(),u.stopPropagation(),x.value=!1;const g=Array.from(u.dataTransfer?.files||[]);g.length>0&&(m.value=g,n(g,"dragdrop"))},a=u=>{t.Value.get(r)&&u.currentTarget.querySelector('input[type="file"]')?.click()};let c=null;const I=()=>{if(c==null)return;const u=Array.from(c.files??[]);u.length>0&&(m.value=u,n(u,"click")),c.value=""},k=u=>{t.Value.get(r)&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(u))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(r,u=>u?0:-1)),t.attr.style("position: relative;"),t.on.dragover(p),t.on.dragleave(d),t.on.drop(b),t.on.click(a),t.on.keydown(k),t.html.input(t.attr.type("file"),t.attr.disabled(h),t.attr.accept(l),t.attr.multiple(s),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(I),t.WithElement(u=>(c=u,m.on(g=>{const _=globalThis.DataTransfer;if(_!=null){const w=new _;g.forEach($=>w.items.add($)),u.files=w.files}}),t.Empty))),t.aria.label(t.bind(f.$.dropZoneInstructions)(r)),o({files:m,clear:()=>m.value=[],change:u=>m.set(u)}))})}const K="$$tts-exp-",pt=(n,e)=>t.WithElement(l=>{const r=`${K}${n}`;return t.OnDispose(t.Value.on(e,o=>Reflect.set(l,r,o)))}),wt=(n,e)=>{const l=`${K}${n}`;return r=>{e(Reflect.get(r.target,l))}},X=(n,e)=>{const l=`${K}${n}`;return r=>{const o=r.target,h=o.selectedIndex,s=o.options[h];e(Reflect.get(s,l))}},ft=(n,e,l)=>t.Ensure(n,r=>t.OneOfType(r,{value:o=>{const h=t.computedOf(o,l)((s,f)=>e(s.value,f));return t.html.option(t.attr.selected(h),pt("value",o.$.value),o.$.label)},group:o=>t.html.optgroup(t.attr.label(o.$.group),t.ForEach(o.$.options,h=>ft(h,e,l))),break:()=>t.html.hr()})),dt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,options:h,unselectedLabel:s,equality:f=(p,d)=>p===d,after:m}=n;let x;return B.InputContainer({...n,after:t.Fragment(B.InputIcon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),m),input:t.html.select(t.WithElement(p=>{x=p;const d=new MutationObserver(b=>{const{removedNodes:a}=b[0];a.length>0&&(x.selectedIndex=0)});return d.observe(p,{childList:!0}),t.OnDispose(()=>d.disconnect())}),A.CommonInputAttributes(n),t.attr.class("bc-native-select bc-input"),t.Use(C.BeatUII18n,p=>t.html.option(t.attr.hidden("hidden"),t.coalesce(s,p.$.selectOne))),t.ForEach(h,p=>ft(p,f,e)),l!=null?t.on.blur(l):t.Empty,r!=null?t.on.change(X("value",p=>r(p))):t.Empty,o!=null?t.on.input(X("value",p=>o(p))):t.Empty)},t.on.click(()=>{if(x?.focus(),typeof x?.showPicker=="function")try{x.showPicker()}catch{}}))};function mt(n){const{controller:e,onChange:l,onBlur:r,...o}=n;return dt({...o,value:e.signal,onChange:O.makeOnChangeHandler(e,l),onBlur:O.makeOnBlurHandler(e,r)})}function Ct(n){return O.InputWrapper({...n,content:mt(n)})}function tt(n,e,l){const r=t.Value.map(n,s=>s!=null),o=t.computedOf(r,e??!1)((s,f)=>!s||f),h=C.defaultMessages.clearValue;return t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(h),t.attr.title(h),t.attr.disabled(o),C.Icon({icon:"mdi:close",size:"sm"}),t.on.click(s=>{s.stopPropagation(),l?.(null)}))}function Q(...n){return t.html.div(t.attr.class("bc-group"),...n)}function _t(n){const e=String(n),l=e.indexOf(".");return l===-1?0:e.length-l-1}function N(n,e){const l=_t(e);if(l===0)return Math.round(n);const r=Math.pow(10,l);return Math.round(n*r)/r}const kt=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:s,onInput:f,after:m}=n,x=b=>{const a=r!=null?t.Value.get(r):void 0,c=o!=null?t.Value.get(o):void 0;return a!=null&&b<a?a:c!=null&&b>c?c:b},p=l!=null?t.Use(C.BeatUII18n,b=>{const a=t.computedOf(e,r)((u,g)=>g==null?!0:(u??0)>g),c=t.computedOf(e,o)((u,g)=>g==null?!0:(u??0)<g),I=u=>{const g=t.Value.get(e)??0,_=t.Value.get(l),w=u?.shiftKey?10:1,$=N(g-_*w,_),V=r!=null?t.Value.get(r):void 0;if(V!=null&&$<V)return;const i=x($);i!==g&&(s?.(i),f?.(i))},k=u=>{const g=t.Value.get(e)??0,_=t.Value.get(l),w=u?.shiftKey?10:1,$=N(g+_*w,_),V=o!=null?t.Value.get(o):void 0;if(V!=null&&$>V)return;const i=x($);i!==g&&(s?.(i),f?.(i))};return ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(c,n.disabled??!1)((u,g)=>!u||g)),t.on.click(u=>k(u)),t.aria.label(b.$.incrementValue),C.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(a,n.disabled??!1)((u,g)=>!u||g)),t.on.click(u=>I(u)),t.aria.label(b.$.decrementValue),C.Icon({icon:"line-md:minus",size:"xs"})))}):null,d=m!=null&&p!=null?t.Fragment(p,m):m??p;return B.InputContainer({...n,input:t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,A.CommonInputAttributes(n),t.attr.valueAsNumber(e),t.attr.step(l),t.attr.class("bc-input bc-number-input"),h!=null?t.on.blur(t.emitValue(h)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,f!=null?t.on.input(t.emitValueAsNumber(f)):t.Empty,l!=null?t.on.wheel(b=>{b.preventDefault();const a=t.Value.get(e)??0,c=t.Value.get(l),I=b.shiftKey?10:1,k=b.deltaY<0?c*I:-c*I,u=x(N(a+k,c));u!==a&&(s?.(u),f?.(u))}):t.Empty),after:d})};function Et(n,e){return n.length===e.length&&n.every((l,r)=>l===e[r])}function Dt(n,e,l){const r=["bc-segmented-input",`bc-segmented-input--size-${n}`];return l==="squared"&&r.push("bc-segmented-input--squared"),e&&r.push("bc-segmented-input--disabled"),r.join(" ")}function Ut(n){if(n==null)return"";const e=new Map,l=C.backgroundValue(n,"solid","light"),r=C.backgroundValue(n,"solid","dark");return e.set("--si-indicator-bg",l.backgroundColor),e.set("--si-active-text",l.textColor),e.set("--si-indicator-bg-dark",r.backgroundColor),e.set("--si-active-text-dark",r.textColor),Array.from(e.entries()).map(([o,h])=>`${o}: ${h}`).join("; ")}function $t({options:n,value:e,onChange:l,size:r="md",disabled:o=!1,variant:h="pill",color:s},...f){const m=L.objectEntries(n).map(([x,p])=>({key:x,label:p}));return t.WithElement(()=>{const x=Object.fromEntries(m.map((d,b)=>[d.key,b])),p=t.prop(m.map(()=>({left:0,width:0})),Et);return t.html.div(t.attr.class(t.computedOf(r,o,h)((d,b,a)=>Dt(d??"md",b??!1,a??"pill"))),t.attr.style(s!=null?t.Value.map(s,d=>Ut(d)):""),t.html.div(t.attr.class("bc-segmented-input__container"),t.html.div(t.attr.class("bc-segmented-input__indicator"),t.style.width(t.computedOf(e,p)((d,b)=>{const{width:a}=b[x[d]??0];return`${a}px`})),t.style.left(t.computedOf(e,p)((d,b)=>{const{left:a}=b[x[d]??0];return`${a}px`}))),m.map(({label:d,key:b},a)=>t.html.button(t.attr.type("button"),t.on.click(c=>{c.preventDefault(),t.Value.get(o)||l?.(b)}),t.attr.disabled(o),t.attr.class("bc-segmented-input__segment"),t.attr.class(t.Value.map(e,c=>c===b?"bc-segmented-input__segment--active":"bc-segmented-input__segment--inactive")),It.ElementRect(c=>{function I(){p.update(u=>{const g=[...u];return g[a]={width:c.value.width,left:c.value.localLeft},g})}const k=L.delayedAnimationFrame(I);return t.OnDispose(k,c.on(I))}),d))),...f)})}function Mt(n){const e=n.type.toLowerCase();return e.startsWith("image/")&&(e.includes("jpeg")||e.includes("jpg")||e.includes("png")||e.includes("gif")||e.includes("webp")||e.includes("svg"))}function Ot(n){const e=n.type.toLowerCase();return e.startsWith("image/")?"vscode-icons:file-type-image":e.startsWith("video/")?"vscode-icons:file-type-video":e.startsWith("audio/")?"vscode-icons:file-type-audio":e.includes("pdf")?"vscode-icons:file-type-pdf2":e.includes("word")||e.includes("document")?"vscode-icons:file-type-word":e.includes("excel")||e.includes("spreadsheet")?"vscode-icons:file-type-excel":e.includes("powerpoint")||e.includes("presentation")?"vscode-icons:file-type-powerpoint":e.includes("zip")||e.includes("archive")?"vscode-icons:file-type-zip":e.includes("text")?"vscode-icons:file-type-text":e.includes("json")?"vscode-icons:file-type-json-official":e.includes("csv")?"vscode-icons:file-type-csv":e.includes("xml")?"vscode-icons:file-type-xml":e.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function J(n){return t.When(n.map(Mt),()=>{const e=t.prop(null);return n.on(l=>{e.value&&URL.revokeObjectURL(e.value);const r=URL.createObjectURL(l);e.value=r}),t.html.div(t.OnDispose(()=>{e.value&&URL.revokeObjectURL(e.value)}),t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(e),t.attr.alt(n.map(l=>l.name)),t.attr.class("bc-file-input__thumbnail")))},()=>C.Icon({icon:n.map(Ot)}))}const Bt=(n,...e)=>{const{value:l=t.prop([]),accept:r="*/*",maxFiles:o,maxFileSize:h,onChange:s,onBlur:f,disabled:m,hasError:x,mode:p="default",showFileList:d=!0,...b}=n,a=l,c=t.Value.map(p,V=>V==="input"),I=t.Value.map(p,V=>V==="compact"),k=V=>{let i=V;if(o!=null){const v=t.Value.get(o);i=i.slice(0,v)}if(h){const v=t.Value.get(h);i=i.filter(E=>E.size<=v)}s?.(i)},u=V=>{const v=a.value.filter((E,D)=>D!==V);s?.(v)},g=()=>{s?.([])},_=({files:V,clear:i,change:v})=>t.Use(C.BeatUII18n,E=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),C.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(E.$.filesInputInstructions)(o,h,E.$.fileSizeUnits.value))))),w=({files:V})=>t.Use(C.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-drop-zone"),t.When(V.map(v=>v.length>0),()=>t.html.div(t.attr.class("bc-file-input__compact-file-list"),t.ForEach(V,(v,E)=>{const D=E.index;return t.html.div(t.attr.class("bc-file-input__compact-file-item"),t.html.div(t.attr.class("bc-file-input__compact-file-icon"),J(v)),t.html.div(t.attr.class("bc-file-input__compact-file-info"),t.html.div(t.attr.class("bc-file-input__compact-file-name"),t.attr.title(v.$.name),v.$.name),t.html.div(t.attr.class("bc-file-input__compact-file-meta"),t.computedOf(v.$.size,i.$.fileSizeUnits)((y,U)=>C.formatFileSize(y,{units:U}))," • ",t.computedOf(v.$.type,i.$.unknownType)((y,U)=>y||U))),O.CloseButton({size:"sm",label:i.$.removeFile,disabled:m,onClick:()=>u(D)},t.attr.class("bc-file-input__compact-remove-button")))})),()=>t.html.div(t.attr.class("bc-file-input__compact-placeholder"),C.Icon({icon:"mdi:cloud-upload-outline",size:"lg"}),t.html.div(t.attr.class("bc-file-input__compact-placeholder-text"),t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))))),$=({files:V})=>t.Use(C.BeatUII18n,i=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(V.map(v=>v.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(V,v=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),J(v),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),v.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),C.Icon({icon:"mdi:cloud-upload-outline",size:"md"})," ",t.bind(i.$.filesInputInstructions)(o,h,i.$.fileSizeUnits.value)))));return t.Use(C.BeatUII18n,V=>B.InputContainer({baseContainer:t.Value.map(c,i=>!i),disabled:m,hasError:x,after:t.When(c,()=>t.When(a.map(({length:i})=>i>0),()=>O.CloseButton({size:"sm",label:V.$.clearAllFiles,disabled:m,onClick:g},t.attr.class("bc-file-input__compact-clear")))),...b,input:t.When(c,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--input"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:$})),()=>t.When(I,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:w})),()=>t.html.div(t.attr.class("bc-file-input"),Z({value:a,accept:r,enableClick:!0,allowMultiple:t.Value.map(o??1/0,i=>i>1),disabled:m,onChange:k,content:_}),t.When(d,()=>t.NotEmpty(a,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(a,(i,v)=>{const E=v.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),J(i)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(i.$.name),i.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(i.$.size,V.$.fileSizeUnits)((D,y)=>C.formatFileSize(D,{units:y}))," • ",t.computedOf(i.$.type,V.$.unknownType)((D,y)=>D||y))),O.CloseButton({size:"sm",label:V.$.removeFile,disabled:m,onClick:()=>u(E)},t.attr.class("bc-file-input__remove-button")))})),t.When(a.map(({length:i})=>i>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(m),V.$.clearAllFiles,t.on.click(i=>{i.preventDefault(),i.stopPropagation(),g()}))))))))))},...e))};function ht(n,e,l){const r=n.length.map(o=>o);return t.Repeat(r,o=>{const h=n.item(o.index),s=[];return t.Fragment(t.OnDispose(()=>{s.forEach(f=>f())}),e({list:n,item:h,position:o,remove:()=>n.removeAt(o.index),move:f=>{switch(f){case"up":if(o.index===0)return;n.move(o.index,o.index-1);break;case"down":if(o.index===n.length.value-1)return;n.move(o.index,o.index+1);break;case"first":n.move(o.index,0);break;case"last":n.move(o.index,n.length.value-1)}},canMove:f=>{const m=(()=>{switch(f){case"up":return t.signal(o.index>0);case"down":return n.length.map(x=>o.index<x-1)}})();return s.push(()=>m.dispose()),m},cannotMove:f=>{const m=(()=>{switch(f){case"up":return t.signal(o.index===0);case"down":return n.length.map(x=>o.index===x-1)}})();return s.push(()=>m.dispose()),m}}))},l)}const rt={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:n=>n.toUpperCase()},"*":{pattern:/^.$/}},St=n=>n instanceof RegExp;function bt(n,e,l){if(n==null)return[];const r=l?{...rt,...e}:e??rt,o=(s,f)=>{const m=r[f];m?s.push({type:"pattern",name:f,...m}):s.push({type:"literal",char:f})},h=[];if(typeof n=="string"){for(const s of n)o(h,s);return h}for(const s of n)if(typeof s=="string")if(s.length<=1)o(h,s);else for(const f of s)o(h,f);else St(s)?h.push({type:"pattern",pattern:s}):typeof s=="object"&&s&&h.push(s);return h}function Tt(n,e){return l=>{switch(n){case"digits":return/[0-9]/.test(l);case"letters":return/[A-Za-z]/.test(l);case"alphanumeric":return/[A-Za-z0-9]/.test(l);case"custom":return e?.(l)??!0;default:return!0}}}function ot(n,e,l,r,o,h){const s={raw:n,previousConformed:e,cursor:o??n.length,completed:!1},f=r.definitions??{},m=typeof l=="function"?l(n,s):l,x=bt(m,f,r.useDefaultDefinitions??!0),p=Tt(r.allowMode,r.allow),d=new Set;for(const y of x)y.type==="literal"&&d.add(y.char);if(r.prefix)for(const y of r.prefix)d.add(y);if(r.suffix)for(const y of r.suffix)d.add(y);const b=Array.from(n).filter(y=>p(y)&&!d.has(y));if(b.length===0)return{value:"",cursor:0,completed:!1};const a=[],c=[];let I=0,k=0,u=0,g=-1;for(const y of x){if(y.type==="literal"){a.push(y.char),c.push({kind:"literal",filled:!0});continue}k+=y.optional?0:1;const U=b[I];if(U==null)break;if(y.type==="any"){u++,a.push(y.transform?y.transform(U):U),c.push({kind:"slot",filled:!0}),g=c.length-1,I++;continue}if(y.type==="pattern")if(y.pattern.test(U)){u++;const S=y.transform?y.transform(U):U;a.push(S),c.push({kind:"slot",filled:!0}),g=c.length-1,I++}else{I++;continue}}const _=a.join(""),w=(r.prefix??"")+_+(r.suffix??"");let V=(r.prefix??"").length;if(g>=0){let y=g+1;if((h?.policy??"smart")!=="sticky")for(;y<c.length&&c[y].kind==="literal";)y++;V+=y}const i=r.completion?.mode==="min"?(r.completion.minChars??0)<=u:r.completion?.mode==="custom"?!!r.completion.isComplete?.(w):k>0&&u>=k,v=r.pipe?.(w,{...s,completed:i});let E,D=V;return v===!1?(E=e,D=e.length):typeof v=="string"?(E=v,D=v.length):typeof v=="object"&&v?(E=v.value,D=v.cursor??v.value.length):E=w,{value:E,cursor:D,completed:i}}function At(n,e){const l=e?.strategy??"none";return l==="custom"&&e?.unmask?e.unmask(n):l==="strip"?n.replace(/[^A-Za-z0-9]/g,""):n}const et=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,onAccept:h,onComplete:s,mask:f,definitions:m,useDefaultDefinitions:x,extraLiterals:p,prefix:d,suffix:b,autofix:a,pipe:c,completion:I,unmask:k,allowMode:u,allow:g,placeholder:_,placeholderOptions:w}=n,$=t.computedOf(e,f,m,x,p,d,b,a,I,k,u,_,w)((i,v,E,D,y,U,S,R,P,W,F,j,T)=>v?ot(i??"","",v,{definitions:E??{},useDefaultDefinitions:D??!0,extraLiterals:y??[],autofix:R??"none",completion:P??{mode:"mask"},pipe:c??(M=>M),unmask:W??{strategy:"none"},allowMode:F??"all",allow:g,prefix:U,suffix:S}).value:i??""),V=(i,v)=>{const E=i.value??"",D=t.Value.get(e)??"",y=f!=null?t.Value.get(f):null,U=m!=null?t.Value.get(m):void 0,S=x!=null?t.Value.get(x):void 0,R=p!=null?t.Value.get(p):void 0,P=a!=null?t.Value.get(a):void 0,W=I!=null?t.Value.get(I):void 0,F=k!=null?t.Value.get(k):void 0,j=u!=null?t.Value.get(u):void 0,T=d!=null?t.Value.get(d):void 0,M=b!=null?t.Value.get(b):void 0,{value:z,cursor:Y,completed:nt}=y?ot(E,D,y,{definitions:U??{},useDefaultDefinitions:S??!0,extraLiterals:R??[],autofix:P??"none",completion:W??{mode:"mask"},pipe:c??(Vt=>Vt),unmask:F??{strategy:"none"},allowMode:j??"all",allow:g,prefix:T,suffix:M},i.selectionStart??E.length,n.cursor?t.Value.get(n.cursor):void 0):{value:E,cursor:E.length,completed:!0};if(z!==E){i.value=z;try{i.setSelectionRange(Y,Y)}catch{}}const lt=At(z,F);h?.({raw:lt,conformed:z,completed:nt,cursor:Y}),v==="input"?o?.(z):(r?.(z),nt&&s?.({raw:lt,conformed:z}))};return B.InputContainer({...n,input:t.input.text(A.CommonInputAttributes(n),t.attr.value($),t.attr.class("bc-input"),l!=null?t.on.blur(l):t.Empty,t.WithElement(i=>i instanceof HTMLInputElement?t.Fragment(t.on.input(()=>V(i,"input")),t.on.change(()=>V(i,"change")),t.on.keydown(v=>{if(v.key!=="Backspace"||!(n.cursor?t.Value.get(n.cursor)?.backspaceRubberBand??!0:!0))return;const D=i.selectionStart??0,y=i.selectionEnd??D;if(D!==y||D<=0)return;const U=i.value??"",S=f!=null?t.Value.get(f):null;if(!S)return;const R=m!=null?t.Value.get(m):void 0,P=x!=null?t.Value.get(x):!0,W=d!=null?t.Value.get(d):void 0,F=b!=null?t.Value.get(b):void 0,j=bt(typeof S=="function"?S(U,{raw:U,previousConformed:U,cursor:D,completed:!1}):S,R??{},P??!0),T=new Set;for(const M of j)M.type==="literal"&&T.add(M.char);if(W)for(const M of W)T.add(M);if(F)for(const M of F)T.add(M);if(T.has(U[D-1])){let M=D-1;for(;M>=0&&T.has(U[M]);)M--;M>=0&&(v.preventDefault(),v.stopPropagation(),i.value=U.slice(0,M)+U.slice(M+1),V(i,"input"))}})):t.Empty))})},Ft=n=>{const{value:e,onBlur:l,onChange:r,onInput:o,rows:h}=n;return B.InputContainer({...n,input:t.html.textarea(A.CommonInputAttributes(n),t.attr.rows(h??3),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})},at=n=>{if(n==null||n==="")return null;const e=Number(n);return Number.isNaN(e)?null:e},zt=n=>{const{value:e,step:l,min:r,max:o,onBlur:h,onChange:s,onInput:f,after:m}=n,x=a=>{const c=r!=null?t.Value.get(r):void 0,I=o!=null?t.Value.get(o):void 0;return c!=null&&a<c?c:I!=null&&a>I?I:a},p=(()=>{if(l==null)return null;const a=t.computedOf(e,r)((g,_)=>{const w=g??0;return _==null?!0:w>_}),c=t.computedOf(e,o)((g,_)=>{const w=g??0;return _==null?!0:w<_}),I=g=>{const _=t.Value.get(e)??0,w=t.Value.get(l),$=g?.shiftKey?10:1,V=N(_-w*$,w),i=r!=null?t.Value.get(r):void 0;if(i!=null&&V<i)return;const v=x(V);v!==_&&(s?.(v),f?.(v))},k=g=>{const _=t.Value.get(e)??0,w=t.Value.get(l),$=g?.shiftKey?10:1,V=N(_+w*$,w),i=o!=null?t.Value.get(o):void 0;if(i!=null&&V>i)return;const v=x(V);v!==_&&(s?.(v),f?.(v))};return((g,_)=>ut.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(c,n.disabled??!1)((w,$)=>!w||$)),t.on.click(w=>k(w)),t.aria.label(g),C.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(a,n.disabled??!1)((w,$)=>!w||$)),t.on.click(w=>I(w)),t.aria.label(_),C.Icon({icon:"line-md:minus",size:"xs"}))))(C.defaultMessages.incrementValue,C.defaultMessages.decrementValue)})(),d=tt(e,n.disabled,s??f),b=m!=null&&p!=null?t.Fragment(p,d,m):m!=null?t.Fragment(d,m):p!=null?t.Fragment(p,d):d;return B.InputContainer({...n,input:t.input.number(r!=null?t.attr.min(r):t.Empty,o!=null?t.attr.max(o):t.Empty,A.CommonInputAttributes(n),t.attr.value(t.Value.map(e,a=>a==null?"":String(a))),t.attr.step(l),t.attr.class("bc-input bc-number-input"),h!=null?t.on.blur(t.emitValue(h)):t.Empty,s!=null?t.on.change(t.emitValue(a=>{const c=at(a);s(c)})):t.Empty,f!=null?t.on.input(t.emitValue(a=>{const c=at(a);f(c)})):t.Empty,l!=null?t.on.wheel(a=>{a.preventDefault();const c=t.Value.get(e)??0,I=t.Value.get(l),k=a.shiftKey?10:1,u=a.deltaY<0?I*k:-I*k,g=x(N(c+u,I));g!==c&&(s?.(g),f?.(g))}):t.Empty),after:b})},Lt=n=>{const e={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:o=>o.toLowerCase()},l=[e,e,e,e,e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,"-",e,e,e,e,e,e,e,e,e,e,e,e],r=n.class?t.Value.map(n.class,o=>`bc-uuid-input ${o}`):"bc-uuid-input";return et({...n,class:r,mask:l,placeholder:n.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Nt=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,Wt=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function gt(n){return{mask:null,allowMode:"custom",allow:e=>/[0-9ptwdhms]/i.test(e),pipe:e=>{const l=e.toUpperCase();return l.length===0?l:!l.startsWith("P")||!Nt.test(l)?!1:l},completion:{mode:"custom",isComplete:e=>{const l=e.toUpperCase();if(!Wt.test(l))return!1;try{return n(l),!0}catch{return!1}}}}}const st=(n,e)=>{if(n==null)return null;try{return n.Duration.from(e)}catch{return null}},Rt=n=>{const{value:e,onChange:l,onInput:r,after:o,disabled:h,onBlur:s}=n,f=()=>{const p=tt(e,h,l??r);return o!=null?t.Fragment(p,o):p},m=n.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return ct(p=>{const d=A.mapInputOptions(n,b=>b?.toString()??"",b=>b===""?null:p.Duration.from(b));return et({...d,onInput:void 0,...gt(p.Duration.from),placeholder:"P0DT0H0M0S",after:f()})},{pending:()=>{const p=d=>b=>{const c=b.currentTarget?.value??"";if(c===""){d(null);return}const I=globalThis.Temporal,k=st(I,c);if(k!=null){d(k);return}H().then(u=>{const g=st(u,c);g!=null&&d(g)}).catch(()=>{})};return B.InputContainer({...n,input:t.input.text(A.CommonInputAttributes(n),t.attr.value(t.Value.map(e,d=>d?.toString()??"")),t.attr.class("bc-input"),m,s!=null?t.on.blur(()=>s()):t.Empty,l!=null?t.on.change(p(l)):t.Empty,r!=null?t.on.input(p(r)):t.Empty),after:f()})}})},Pt=n=>{const{value:e,onBlur:l,onChange:r,onInput:o}=n;return B.InputContainer({...n,input:t.input.url(A.CommonInputAttributes(n),t.attr.value(e),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,r!=null?t.on.change(t.emitValue(r)):t.Empty,o!=null?t.on.input(t.emitValue(o)):t.Empty)})};function vt(n,e){const{onMove:l,cannotMoveUp:r,cannotMoveDown:o,onRemove:h,showMove:s=!0,showRemove:f=!0,removeDisabled:m,showMoveButtons:x=!0,layout:p="aside"}=n,d=t.Value.toSignal(p).map(c=>c==="aside"),b=t.When(s,()=>t.html.div(t.attr.class("bc-list-item-controls__move"),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("up"),disabled:r},t.Use(C.BeatUII18n,c=>C.Icon({size:"xs",icon:"line-md:arrow-up",title:c.$.incrementValue}))),B.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>l("down"),disabled:o},t.Use(C.BeatUII18n,c=>C.Icon({size:"xs",icon:"line-md:arrow-down",title:c.$.decrementValue}))))),a=t.When(f,()=>t.Use(C.BeatUII18n,c=>O.CloseButton({size:"xs",label:t.Value.map(c.$.removeItem,I=>I.toLowerCase()),color:"danger",disabled:m,onClick:h})));return t.When(d,()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--aside"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(x,()=>b),a)),()=>t.html.div(t.attr.class("bc-list-item-controls bc-list-item-controls--below"),t.html.div(t.attr.class("bc-list-item-controls__content"),e),t.html.div(t.attr.class("bc-list-item-controls__actions"),t.When(x,()=>b,()=>t.html.div()),a)))}const xt=n=>{const{controller:e,element:l,separator:r,showMove:o=!0,showRemove:h=!0,showAdd:s=!0,createItem:f,addLabel:m,controlsLayout:x="aside",removeDisabled:p,addDisabled:d}=n,b=t.When(t.computedOf(s,f)((a,c)=>a&&c!=null),()=>Q(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),B.Button({size:"sm",variant:"filled",onClick:()=>e.push(f()),disabled:t.computedOf(e.disabled,d??!1)((a,c)=>a||c)},t.Use(C.BeatUII18n,a=>Q(t.attr.class("bc-group--gap-2"),C.Icon({icon:"line-md:plus"}),m??a.$.addLabel)))));return t.Fragment(ht(e,a=>vt({onMove:a.move,cannotMoveUp:a.cannotMove("up"),cannotMoveDown:a.cannotMove("down"),onRemove:a.remove,showMove:o,showRemove:h,removeDisabled:p,showMoveButtons:e.signal.map(c=>c.length>1),layout:x},l(a)),r),b)},jt=(n,...e)=>{const{controller:l,element:r,separator:o,showMove:h,showRemove:s,showAdd:f,createItem:m,addLabel:x,controlsLayout:p,removeDisabled:d,addDisabled:b,...a}=n;return O.InputWrapper({...a,content:xt({controller:l,element:r,separator:o,showMove:h,showRemove:s,showAdd:f,createItem:m,addLabel:x,controlsLayout:p,removeDisabled:d,addDisabled:b})},...e)};class qt extends O.Controller{branches;activeBranch;#e;#t=new Map;constructor(e,l,r,o,h,s,f=L.strictEqual){super(e,l,r,o,h,f),this.branches=s;const m=p=>{for(const d of s)if(d.detect(p))return d.key;return s[0]?.key??"unknown"};this.activeBranch=r.map(m,L.strictEqual);const x=p=>{if(this.#t.has(p))return this.#t.get(p);const d=s.find(a=>a.key===p);if(!d)throw new Error(`Unknown branch: ${p}`);const b=new O.Controller([...e,p],a=>{this.change(a)},this.signal.map(a=>d.detect(a)?a:d.defaultValue(),f),o.map(O.makeMapValidation([p])),{disabled:this.disabled,validationMode:this.parent.validationMode},f);return this.#t.set(p,b),b};this.#e=this.activeBranch.map(p=>x(p),L.strictEqual),this.onDispose(()=>{for(const p of this.#t.values())p.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(e){const l=this.branches.find(o=>o.key===e);if(!l)throw new Error(`Unknown branch: ${e}`);if(this.#t.has(e))return this.#t.get(e);const r=new O.Controller([...this.path,e],o=>{this.change(o)},this.signal.map(o=>l.detect(o)?o:l.defaultValue(),L.strictEqual),this.status.map(O.makeMapValidation([e])),{disabled:this.disabled,validationMode:this.parent.validationMode},L.strictEqual);return this.#t.set(e,r),r}switchToBranch(e,l=!1){const r=this.branches.find(s=>s.key===e);if(!r)throw new Error(`Unknown branch: ${e}`);const o=t.Value.get(this.signal);if(r.detect(o))return!0;if(r.convert){const s=r.convert(o);if(s.ok)return this.change(s.value),!0}if(l&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm(C.defaultMessages.changeTypeConfirmation))return!1;const h=r.defaultValue();return this.change(h),!0}get activeBranchDefinition(){const e=t.Value.get(this.activeBranch);return this.branches.find(l=>l.key===e)}}function Zt(n){return n.transform(e=>e??null,e=>e??void 0)}function Ht(n){return n.transform(e=>e??"",e=>e===""?void 0:e)}function Yt(n){return n.transform(e=>e??void 0,e=>e??null)}function q(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)&&Object.prototype.toString.call(n)==="[object Object]"}function yt(n,e){if(e==null)return it(n);if(n==null)return e;if(q(n)&&q(e)){const l={...e};for(const r of Object.keys(n))l[r]===void 0?l[r]=it(n[r]):q(n[r])&&q(l[r])&&(l[r]=yt(n[r],l[r]));return l}return e}function it(n){return typeof structuredClone=="function"?structuredClone(n):JSON.parse(JSON.stringify(n))}exports.BaseListControl=xt;exports.BaseNativeSelectControl=mt;exports.Expando=pt;exports.FilesInput=Bt;exports.Group=Q;exports.ListControl=jt;exports.ListInput=ht;exports.ListItemControls=vt;exports.MaskInput=et;exports.NativeSelect=dt;exports.NativeSelectControl=Ct;exports.NullableDurationInput=Rt;exports.NullableNumberInput=zt;exports.NullableResetAfter=tt;exports.NumberInput=kt;exports.SegmentedInput=$t;exports.TextArea=Ft;exports.UnionController=qt;exports.UnstyledDropZone=Z;exports.UrlInput=Pt;exports.UuidInput=Lt;exports.WithTemporal=ct;exports.deepMergeDefaults=yt;exports.durationMaskConfig=gt;exports.emitExpando=wt;exports.emitOptionExpando=X;exports.ensureTemporal=H;exports.roundToStep=N;exports.transformEmptyStringToUndefined=Ht;exports.transformNullToUndefined=Zt;exports.transformUndefinedToNull=Yt;
|