@domphy/ui 0.1.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.
@@ -0,0 +1,422 @@
1
+ import { PartialElement, ValueOrState, DomphyElement, Notifier, Handler } from '@domphy/core';
2
+ import { ThemeColor, ElementTone } from '@domphy/theme';
3
+ import { Placement as Placement$1 } from '@floating-ui/dom';
4
+
5
+ declare function abbreviation(props?: {
6
+ color?: ThemeColor;
7
+ accentColor?: ThemeColor;
8
+ }): PartialElement;
9
+
10
+ declare function card(props?: {
11
+ color?: ThemeColor;
12
+ }): PartialElement;
13
+
14
+ declare function splitter(props?: {
15
+ direction?: "horizontal" | "vertical";
16
+ defaultSize?: number;
17
+ min?: number;
18
+ max?: number;
19
+ }): PartialElement;
20
+ declare function splitterPanel(): PartialElement;
21
+ declare function splitterHandle(): PartialElement;
22
+
23
+ declare function command(): PartialElement;
24
+ declare function commandSearch(props?: {
25
+ color?: ThemeColor;
26
+ accentColor?: ThemeColor;
27
+ }): PartialElement;
28
+ declare function commandItem(props?: {
29
+ color?: ThemeColor;
30
+ accentColor?: ThemeColor;
31
+ }): PartialElement;
32
+
33
+ declare function toggle(props?: {
34
+ color?: ThemeColor;
35
+ accentColor?: ThemeColor;
36
+ }): PartialElement;
37
+
38
+ declare function toggleGroup(props?: {
39
+ value?: ValueOrState<string | string[]>;
40
+ multiple?: boolean;
41
+ color?: ThemeColor;
42
+ }): PartialElement;
43
+
44
+ declare function inputOTP(): PartialElement;
45
+
46
+ declare function alert(props?: {
47
+ color?: ThemeColor;
48
+ }): PartialElement;
49
+
50
+ declare function avatar(props?: {
51
+ color?: ThemeColor;
52
+ }): PartialElement;
53
+
54
+ declare function badge(props?: {
55
+ color?: ThemeColor;
56
+ label?: ValueOrState<string | number>;
57
+ }): PartialElement;
58
+
59
+ declare function breadcrumb(props?: {
60
+ color?: ThemeColor;
61
+ separator?: string;
62
+ }): PartialElement;
63
+
64
+ declare function breadcrumbEllipsis(props?: {
65
+ color?: ThemeColor;
66
+ }): PartialElement;
67
+
68
+ declare function combobox(props: {
69
+ multiple?: boolean;
70
+ value?: ValueOrState<Array<number | string | null | undefined> | number | string | null | undefined>;
71
+ options?: Array<{
72
+ label: string;
73
+ value: string;
74
+ }>;
75
+ placement?: ValueOrState<Placement$1>;
76
+ content: DomphyElement;
77
+ color?: ThemeColor;
78
+ open?: ValueOrState<boolean>;
79
+ onPlacement?: (anchor: HTMLElement, popover: HTMLElement, placement: Placement$1) => void;
80
+ input?: DomphyElement;
81
+ }): PartialElement;
82
+
83
+ declare function popoverArrow(props?: {
84
+ placement?: ValueOrState<Placement$1>;
85
+ sideOffset?: string;
86
+ color?: ThemeColor;
87
+ bordered?: boolean;
88
+ }): PartialElement;
89
+
90
+ declare function blockquote(props?: {
91
+ color?: ThemeColor;
92
+ }): PartialElement;
93
+
94
+ declare function button(props?: {
95
+ color?: ThemeColor;
96
+ }): PartialElement;
97
+
98
+ declare function inputCheckbox(props?: {
99
+ color?: ThemeColor;
100
+ accentColor?: ThemeColor;
101
+ }): PartialElement;
102
+
103
+ declare function code(props?: {
104
+ color?: ThemeColor;
105
+ }): PartialElement;
106
+
107
+ declare function details(props?: {
108
+ color?: ThemeColor;
109
+ accentColor?: ThemeColor;
110
+ duration?: number;
111
+ }): PartialElement;
112
+
113
+ declare function descriptionList(props?: {
114
+ color?: ThemeColor;
115
+ }): PartialElement;
116
+
117
+ declare function dialog(props?: {
118
+ color?: ThemeColor;
119
+ open?: ValueOrState<boolean>;
120
+ }): PartialElement;
121
+
122
+ declare function emphasis(props?: {
123
+ color?: ThemeColor;
124
+ }): PartialElement;
125
+
126
+ declare function figure(props?: {
127
+ color?: ThemeColor;
128
+ }): PartialElement;
129
+
130
+ declare function formGroup(props?: {
131
+ color?: ThemeColor;
132
+ layout?: "horizontal" | "vertical";
133
+ }): PartialElement;
134
+
135
+ declare function heading(props?: {
136
+ color?: ThemeColor;
137
+ }): PartialElement;
138
+
139
+ declare function horizontalRule(props?: {
140
+ color?: ThemeColor;
141
+ }): PartialElement;
142
+
143
+ declare function image(props?: {
144
+ color?: ThemeColor;
145
+ }): PartialElement;
146
+
147
+ declare function icon(): PartialElement;
148
+
149
+ declare function inputColor(props?: {
150
+ color?: ThemeColor;
151
+ accentColor?: ThemeColor;
152
+ }): PartialElement;
153
+
154
+ type InputDateTimeMode = "date" | "time" | "week" | "month" | "datetime-local";
155
+ declare function inputDateTime(props?: {
156
+ mode?: InputDateTimeMode;
157
+ color?: ThemeColor;
158
+ accentColor?: ThemeColor;
159
+ }): PartialElement;
160
+
161
+ declare function inputFile(props?: {
162
+ color?: ThemeColor;
163
+ accentColor?: ThemeColor;
164
+ }): PartialElement;
165
+
166
+ declare function inputSearch(props?: {
167
+ color?: ThemeColor;
168
+ accentColor?: ThemeColor;
169
+ }): PartialElement;
170
+
171
+ declare function inputText(props?: {
172
+ color?: ThemeColor;
173
+ accentColor?: ThemeColor;
174
+ }): PartialElement;
175
+
176
+ declare function inputRange(props?: {
177
+ color?: ThemeColor;
178
+ accentColor?: ThemeColor;
179
+ }): PartialElement;
180
+
181
+ declare function inputNumber(props?: {
182
+ color?: ThemeColor;
183
+ accentColor?: ThemeColor;
184
+ }): PartialElement;
185
+
186
+ declare function keyboard(props?: {
187
+ color?: ThemeColor;
188
+ }): PartialElement;
189
+
190
+ declare function label(props?: {
191
+ color?: ThemeColor;
192
+ accentColor?: ThemeColor;
193
+ }): PartialElement;
194
+
195
+ declare function link(props?: {
196
+ color?: ThemeColor;
197
+ accentColor?: ThemeColor;
198
+ }): PartialElement;
199
+
200
+ declare function mark(props?: {
201
+ accentColor?: ThemeColor;
202
+ tone?: ElementTone;
203
+ }): PartialElement;
204
+
205
+ declare function paragraph(props?: {
206
+ color?: ThemeColor;
207
+ }): PartialElement;
208
+
209
+ declare function preformated(props?: {
210
+ color?: ThemeColor;
211
+ }): PartialElement;
212
+
213
+ declare function progress(props?: {
214
+ color?: ThemeColor;
215
+ accentColor?: ThemeColor;
216
+ }): PartialElement;
217
+
218
+ declare function inputRadio(props?: {
219
+ color?: ThemeColor;
220
+ accentColor?: ThemeColor;
221
+ }): PartialElement;
222
+
223
+ declare function select(props?: {
224
+ color?: ThemeColor;
225
+ accentColor?: ThemeColor;
226
+ }): PartialElement;
227
+
228
+ declare function skeleton(props?: {
229
+ color?: ThemeColor;
230
+ }): PartialElement;
231
+
232
+ declare function spinner(props?: {
233
+ color?: ThemeColor;
234
+ }): PartialElement;
235
+
236
+ declare function selectList(props?: {
237
+ multiple?: boolean;
238
+ value?: ValueOrState<Array<number | string | null> | number | string | null>;
239
+ color?: ThemeColor;
240
+ name?: string;
241
+ }): PartialElement;
242
+
243
+ declare function selectItem(props?: {
244
+ accentColor?: ThemeColor;
245
+ color?: ThemeColor;
246
+ value?: number | string;
247
+ }): PartialElement;
248
+
249
+ declare function selectBox(props: {
250
+ multiple?: boolean;
251
+ value?: ValueOrState<Array<number | string | null | undefined> | number | string | null | undefined>;
252
+ options?: Array<{
253
+ label: string;
254
+ value: string;
255
+ }>;
256
+ placement?: ValueOrState<Placement$1>;
257
+ content: DomphyElement;
258
+ color?: ThemeColor;
259
+ open?: ValueOrState<boolean>;
260
+ onPlacement?: (anchor: HTMLElement, popover: HTMLElement, placement: Placement$1) => void;
261
+ }): PartialElement;
262
+
263
+ declare function inputSwitch(props?: {
264
+ accentColor?: ThemeColor;
265
+ }): PartialElement;
266
+
267
+ declare function buttonSwitch(props?: {
268
+ checked?: ValueOrState<boolean>;
269
+ accentColor?: ThemeColor;
270
+ color?: ThemeColor;
271
+ }): PartialElement;
272
+
273
+ declare function small(props?: {
274
+ color?: ThemeColor;
275
+ }): PartialElement;
276
+
277
+ declare function strong(props?: {
278
+ color?: ThemeColor;
279
+ }): PartialElement;
280
+
281
+ declare function subscript(props?: {
282
+ color?: ThemeColor;
283
+ }): PartialElement;
284
+
285
+ declare function superscript(props?: {
286
+ color?: ThemeColor;
287
+ }): PartialElement;
288
+
289
+ declare function table(props?: {
290
+ color?: ThemeColor;
291
+ }): PartialElement;
292
+
293
+ declare function textarea(props?: {
294
+ color?: ThemeColor;
295
+ accentColor?: ThemeColor;
296
+ }): PartialElement;
297
+
298
+ declare function unorderedList(props?: {
299
+ color?: ThemeColor;
300
+ }): PartialElement;
301
+
302
+ declare function orderedList(props?: {
303
+ color?: ThemeColor;
304
+ }): PartialElement;
305
+
306
+ declare function pagination(props: {
307
+ value?: ValueOrState<number>;
308
+ total: number;
309
+ color?: ThemeColor;
310
+ accentColor?: ThemeColor;
311
+ }): PartialElement;
312
+
313
+ declare function divider(props?: {
314
+ color?: ThemeColor;
315
+ }): PartialElement;
316
+
317
+ type Placement = "left" | "right" | "top" | "bottom";
318
+ declare function drawer(props?: {
319
+ color?: ThemeColor;
320
+ open?: ValueOrState<boolean>;
321
+ placement?: Placement;
322
+ size?: string;
323
+ }): PartialElement;
324
+
325
+ declare function popover(props: {
326
+ openOn: "click" | "hover";
327
+ open?: ValueOrState<boolean>;
328
+ placement?: ValueOrState<Placement$1>;
329
+ content: DomphyElement;
330
+ onPlacement?: (anchor: HTMLElement, popover: HTMLElement, placement: Placement$1) => void;
331
+ }): PartialElement;
332
+
333
+ type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
334
+ declare function toast(props?: {
335
+ position?: ToastPosition;
336
+ color?: ThemeColor;
337
+ }): PartialElement;
338
+
339
+ declare function tooltip(props?: {
340
+ open?: ValueOrState<boolean>;
341
+ placement?: ValueOrState<Placement$1>;
342
+ content?: DomphyElement | string;
343
+ }): PartialElement;
344
+
345
+ declare function transitionGroup(props?: {
346
+ duration?: number;
347
+ delay?: number;
348
+ }): PartialElement;
349
+
350
+ declare function tabs(props?: {
351
+ activeKey?: ValueOrState<number | string>;
352
+ }): PartialElement;
353
+
354
+ declare function tab(props?: {
355
+ accentColor?: ThemeColor;
356
+ color?: ThemeColor;
357
+ }): PartialElement;
358
+
359
+ declare function tabPanel(): PartialElement;
360
+
361
+ declare function tag(props?: {
362
+ color?: ThemeColor;
363
+ removable?: boolean;
364
+ }): PartialElement;
365
+
366
+ declare function menu(props?: {
367
+ activeKey?: ValueOrState<number | string>;
368
+ color?: ThemeColor;
369
+ }): PartialElement;
370
+
371
+ declare function menuItem(props?: {
372
+ accentColor?: ThemeColor;
373
+ color?: ThemeColor;
374
+ }): PartialElement;
375
+
376
+ type FieldStatus = "error" | "warning" | "success" | undefined;
377
+ type FieldMessages = {
378
+ error?: string;
379
+ warning?: string;
380
+ success?: string;
381
+ };
382
+ type FieldValidator = (value: unknown) => FieldMessages | null | Promise<FieldMessages | null>;
383
+ declare class FieldState {
384
+ _notifier: Notifier;
385
+ _value: unknown;
386
+ _initValue: unknown;
387
+ _messages: FieldMessages;
388
+ _touched: boolean;
389
+ _validator: FieldValidator | undefined;
390
+ _pending: boolean;
391
+ _validationToken: number;
392
+ constructor(initValue: unknown, validator?: FieldValidator);
393
+ value(listener?: Handler): unknown;
394
+ setValue(val: unknown): void;
395
+ dirty(listener?: Handler): boolean;
396
+ touched(listener?: Handler): boolean;
397
+ setTouched(): void;
398
+ configure(initValue?: unknown, validator?: FieldValidator): void;
399
+ message(type: keyof FieldMessages, listener?: Handler): string | undefined;
400
+ status(listener?: Handler): FieldStatus;
401
+ setMessages(next: FieldMessages): void;
402
+ reset(): void;
403
+ validate(): void;
404
+ _dispose(): void;
405
+ }
406
+
407
+ declare class FormState {
408
+ fields: Map<string, FieldState>;
409
+ setField(path: string, initValue?: unknown, validator?: FieldValidator): FieldState;
410
+ getField(path: string): FieldState;
411
+ removeField(path: string): void;
412
+ get valid(): boolean;
413
+ reset(): void;
414
+ snapshot(): Record<string, unknown>;
415
+ _dispose(): void;
416
+ }
417
+
418
+ declare function form(state: FormState): PartialElement;
419
+
420
+ declare function field(path: string, validator?: FieldValidator): PartialElement;
421
+
422
+ export { type FieldMessages, FieldState, type FieldStatus, type FieldValidator, FormState, abbreviation, alert, avatar, badge, blockquote, breadcrumb, breadcrumbEllipsis, button, buttonSwitch, card, code, combobox, command, commandItem, commandSearch, descriptionList, details, dialog, divider, drawer, emphasis, field, figure, form, formGroup, heading, horizontalRule, icon, image, inputCheckbox, inputColor, inputDateTime, inputFile, inputNumber, inputOTP, inputRadio, inputRange, inputSearch, inputSwitch, inputText, keyboard, label, link, mark, menu, menuItem, orderedList, pagination, paragraph, popover, popoverArrow, preformated, progress, select, selectBox, selectItem, selectList, skeleton, small, spinner, splitter, splitterHandle, splitterPanel, strong, subscript, superscript, tab, tabPanel, table, tabs, tag, textarea, toast, toggle, toggleGroup, tooltip, transitionGroup, unorderedList };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ var oo=Object.defineProperty,ro=Object.defineProperties;var no=Object.getOwnPropertyDescriptors;var at=Object.getOwnPropertySymbols;var io=Object.prototype.hasOwnProperty,lo=Object.prototype.propertyIsEnumerable;var st=(n,o,t)=>o in n?oo(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,mt=(n,o)=>{for(var t in o||(o={}))io.call(o,t)&&st(n,t,o[t]);if(at)for(var t of at(o))lo.call(o,t)&&st(n,t,o[t]);return n},ct=(n,o)=>ro(n,no(o));import{themeColor as xe,themeSpacing as ao}from"@domphy/theme";function dn(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{_onInsert:e=>{e.tagName!="abbr"&&console.warn('"abbreviation" primitive patch must use abbr tag')},style:{color:e=>xe(e,"shift-7",o),textDecorationLine:"underline",textDecorationStyle:"dotted",textDecorationColor:e=>xe(e,"shift-4",o),textUnderlineOffset:ao(.72),cursor:"help","&:hover":{color:e=>xe(e,"shift-8",t),textDecorationColor:e=>xe(e,"shift-6",t)}}}}import{themeColor as U,themeSpacing as z}from"@domphy/theme";function hn(n={}){let{color:o="neutral"}=n;return{style:{display:"grid",gridTemplateColumns:"1fr auto",gridTemplateAreas:'"image image" "title aside" "desc aside" "content content" "footer footer"',borderRadius:z(2),backgroundColor:t=>U(t,"inherit",o),color:t=>U(t,"shift-7",o),outline:t=>`1px solid ${U(t,"shift-3",o)}`,outlineOffset:"-1px",overflow:"hidden","& > img":{gridArea:"image",width:"100%",height:"auto",display:"block"},"& > :is(h1,h2,h3,h4,h5,h6)":{gridArea:"title",paddingBlock:z(2),paddingInline:z(4),fontWeight:"600",margin:0},"& > p":{gridArea:"desc",paddingInline:z(4),color:t=>U(t,"shift-6",o),margin:0},"& > aside":{gridArea:"aside",alignSelf:"center",padding:z(2),height:"auto"},"& > div":{gridArea:"content",padding:z(4),color:t=>U(t,"shift-7",o)},"& > footer":{gridArea:"footer",display:"flex",gap:z(2),paddingBlock:z(2),paddingInline:z(4),borderTop:t=>`1px solid ${U(t,"shift-2",o)}`}}}}import{merge as so,toState as mo}from"@domphy/core";import{themeColor as De,themeSpacing as co}from"@domphy/theme";function yn(n={}){let{direction:o="horizontal",defaultSize:t=50,min:e=10,max:r=90}=n;return{_onSchedule:(i,s)=>{so(s,{_context:{splitter:{direction:o,size:mo(t),min:e,max:r}}})},style:{display:"flex",flexDirection:o==="horizontal"?"row":"column",overflow:"hidden"}}}function Cn(){return{_onMount:n=>{let o=n.getContext("splitter"),t=n.domElement,e=o.direction==="horizontal"?"width":"height";t.style[e]=`${o.size.get()}%`,t.style.flexShrink="0",t.style.overflow="auto";let r=o.size.onChange(i=>{t.style[e]=`${i}%`});n.addHook("Remove",r)}}}function vn(){return{_onMount:n=>{let o=n.getContext("splitter"),t=n.domElement,e=o.direction==="horizontal";t.style.cursor=e?"col-resize":"row-resize";let r=i=>{i.preventDefault();let s=t.parentElement,a=d=>{let m=s.getBoundingClientRect(),c=e?(d.clientX-m.left)/m.width*100:(d.clientY-m.top)/m.height*100;o.size.set(Math.min(Math.max(c,o.min),o.max))},l=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",l)};t.addEventListener("mousedown",r),n.addHook("Remove",()=>t.removeEventListener("mousedown",r))},style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:n=>De(n,"shift-2"),"&:hover":{backgroundColor:n=>De(n,"shift-3")},"&::after":{content:'""',borderRadius:co(999),backgroundColor:n=>De(n,"shift-4")}}}}import{merge as uo,toState as po}from"@domphy/core";import{themeColor as $,themeSize as dt,themeSpacing as X}from"@domphy/theme";function kn(){return{_onSchedule:(n,o)=>{uo(o,{_context:{command:{query:po("")}}})},style:{display:"flex",flexDirection:"column",overflow:"hidden"}}}function Tn(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{_onInsert:e=>{e.tagName!=="input"&&console.warn('"commandSearch" patch must use input tag')},_onMount:e=>{let r=e.getContext("command"),i=e.domElement,s=()=>r.query.set(i.value);i.addEventListener("input",s),e.addHook("Remove",()=>i.removeEventListener("input",s))},style:{fontFamily:"inherit",fontSize:e=>dt(e,"inherit"),paddingInline:X(3),paddingBlock:X(2),border:"none",borderBottom:e=>`1px solid ${$(e,"shift-2",o)}`,outline:"none",color:e=>$(e,"shift-7",o),backgroundColor:e=>$(e,"inherit",o),"&::placeholder":{color:e=>$(e,"shift-4")},"&:focus-visible":{borderBottomColor:e=>$(e,"shift-5",t)}}}}function Pn(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{role:"option",_onMount:e=>{var l,d;let r=e.getContext("command"),i=e.domElement,s=(d=(l=i.textContent)==null?void 0:l.toLowerCase())!=null?d:"",a=r.query.onChange(m=>{i.hidden=m.length>0&&!s.includes(m.toLowerCase())});e.addHook("Remove",a)},style:{cursor:"pointer",display:"flex",alignItems:"center",width:"100%",fontSize:e=>dt(e,"inherit"),height:X(8),paddingInline:X(3),border:"none",outline:"none",color:e=>$(e,"shift-6",o),backgroundColor:e=>$(e,"inherit",o),"&:hover:not([disabled])":{backgroundColor:e=>$(e,"shift-1",o)},"&:focus-visible":{outline:e=>`${X(.5)} solid ${$(e,"shift-5",t)}`,outlineOffset:`-${X(.5)}`}}}}import{themeColor as me,themeSize as ho,themeSpacing as J}from"@domphy/theme";function In(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{role:"button",_onInsert:e=>{var l;e.tagName!=="button"&&console.warn('"toggle" patch must use button tag');let r=e.getContext("toggleGroup"),s=((l=e.parent)==null?void 0:l.children.items).filter(d=>d.type==="ElementNode"&&d.attributes.get("role")==="button"),a=String(s.findIndex(d=>d===e));e.attributes.set("ariaPressed",d=>{let m=r.value.get(d);return Array.isArray(m)?m.includes(a):m===a}),e.addEvent("click",()=>{let d=r.value.get();if(r.multiple){let m=Array.isArray(d)?[...d]:[];r.value.set(m.includes(a)?m.filter(c=>c!==a):[...m,a])}else r.value.set(d===a?"":a)})},style:{cursor:"pointer",fontSize:e=>ho(e,"inherit"),height:J(6),paddingBlock:J(1),paddingInline:J(2),border:"none",borderRadius:J(1),color:e=>me(e,"shift-6",o),backgroundColor:e=>me(e,"inherit",o),transition:"background-color 300ms ease","&:hover:not([disabled])":{backgroundColor:e=>me(e,"shift-1",o)},"&[aria-pressed=true]":{backgroundColor:e=>me(e,"shift-1",o)},"&:focus-visible":{outline:e=>`${J(.5)} solid ${me(e,"shift-5",t)}`,outlineOffset:`-${J(.5)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed"}}}}import{toState as fo}from"@domphy/core";import{themeSpacing as Ee,themeColor as ut,themeSize as go}from"@domphy/theme";function Rn(n={}){var e;let{multiple:o=!1,color:t="neutral"}=n;return{role:"group",dataTone:"shift-1",_context:{toggleGroup:{value:fo((e=n.value)!=null?e:o?[]:""),multiple:o}},style:{display:"flex",paddingBlock:Ee(1),paddingInline:Ee(1),gap:Ee(1),borderRadius:Ee(2),fontSize:r=>go(r,"inherit"),backgroundColor:r=>ut(r,"inherit",t),outline:r=>`1px solid ${ut(r,"shift-1",t)}`,outlineOffset:"-1px"}}}import{themeSpacing as pt}from"@domphy/theme";function On(){return{style:{display:"flex",alignItems:"center",gap:pt(2),"& > *":{minWidth:pt(8)+"!important"}},_onMount:n=>{let o=n.domElement,t=()=>Array.from(o.querySelectorAll("input")),e=s=>{let a=t(),l=s.target,d=a.indexOf(l);l.value&&d<a.length-1&&a[d+1].focus()},r=s=>{let a=t(),l=s.target,d=a.indexOf(l);s.key==="Backspace"&&!l.value&&d>0&&a[d-1].focus(),s.key==="ArrowLeft"&&d>0&&a[d-1].focus(),s.key==="ArrowRight"&&d<a.length-1&&a[d+1].focus()},i=s=>{var c,u,g;s.preventDefault();let a=(u=(c=s.clipboardData)==null?void 0:c.getData("text"))!=null?u:"",l=t(),d=l.indexOf(s.target);[...a].forEach((h,f)=>{l[d+f]&&(l[d+f].value=h)});let m=Math.min(d+a.length-1,l.length-1);(g=l[m])==null||g.focus()};o.addEventListener("input",e),o.addEventListener("keydown",r),o.addEventListener("paste",i),n.addHook("Remove",()=>{o.removeEventListener("input",e),o.removeEventListener("keydown",r),o.removeEventListener("paste",i)})}}}import{themeColor as Fe,themeSize as bo,themeSpacing as Se}from"@domphy/theme";function Fn(n={}){let{color:o="primary"}=n;return{role:"alert",style:{display:"flex",alignItems:"flex-start",gap:Se(3),paddingBlock:Se(2),paddingInline:Se(4),boxShadow:t=>`inset ${Se(1)} 0 0 0 ${Fe(t,"shift-5",o)}`,backgroundColor:t=>Fe(t,"shift-1",o),color:t=>Fe(t,"shift-7",o),fontSize:t=>bo(t,"inherit")}}}import{themeColor as ht,themeSize as yo,themeSpacing as ft}from"@domphy/theme";function Wn(n={}){let{color:o="primary"}=n;return{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",borderRadius:"50%",flexShrink:0,width:ft(8),height:ft(8),fontSize:t=>yo(t,"inherit"),fontWeight:"600",userSelect:"none",backgroundColor:t=>ht(t,"shift-3",o),color:t=>ht(t,"shift-8",o),"& img":{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover"}}}}import{toState as Co}from"@domphy/core";import{themeSpacing as Ve,themeColor as gt,themeSize as vo}from"@domphy/theme";function Gn(n={}){let{color:o="danger",label:t=999}=n,e=Co(t);return{style:{position:"relative","&::after":{content:r=>`"${e.get(r)}"`,position:"absolute",top:0,right:0,transform:"translate(50%,-50%)",paddingInline:Ve(1),minWidth:Ve(6),display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:r=>vo(r,"decrease-1"),borderRadius:Ve(999),backgroundColor:r=>gt(r,"shift-6",o),color:r=>gt(r,"shift-0",o)}}}}import{themeColor as ce,themeSize as xo,themeSpacing as bt}from"@domphy/theme";function Jn(n={}){let{color:o="neutral",separator:t="/"}=n;return{_onInsert:e=>{e.tagName!=="nav"&&console.warn('"breadcrumb" patch must use nav tag')},ariaLabel:"breadcrumb",style:{display:"flex",alignItems:"center",flexWrap:"wrap",fontSize:e=>xo(e,"inherit"),gap:bt(1),color:e=>ce(e,"shift-6",o),backgroundColor:e=>ce(e,"inherit",o),"& > *":{display:"inline-flex",alignItems:"center",color:e=>ce(e,"shift-5",o)},"& > *:not(:last-child)::after":{content:`"${t}"`,color:e=>ce(e,"shift-3",o),paddingInlineStart:bt(1)},"& > [aria-current=page]":{color:e=>ce(e,"shift-7",o),pointerEvents:"none"}}}}import{themeColor as ke,themeSize as Eo,themeSpacing as Te}from"@domphy/theme";function ei(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!=="button"&&console.warn('"breadcrumbEllipsis" patch must use button tag')},ariaLabel:"More breadcrumb items",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:t=>Eo(t,"inherit"),paddingInline:Te(1),border:"none",background:"none",cursor:"pointer",color:t=>ke(t,"shift-5",o),borderRadius:Te(1),"&:hover":{color:t=>ke(t,"shift-7",o),backgroundColor:t=>ke(t,"shift-1",o)},"&:focus-visible":{outline:t=>`${Te(.5)} solid ${ke(t,"shift-5",o)}`,outlineOffset:Te(.5)}}}}import{toState as Ct,merge as Ae}from"@domphy/core";import{themeSpacing as j,themeColor as de,themeSize as vt}from"@domphy/theme";import{themeColor as Pe,themeSize as So,themeSpacing as M}from"@domphy/theme";var ko='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6.707 5.293l5.293 5.292l5.293 -5.292a1 1 0 0 1 1.414 1.414l-5.292 5.293l5.292 5.293a1 1 0 0 1 -1.414 1.414l-5.293 -5.292l-5.293 5.292a1 1 0 1 1 -1.414 -1.414l5.292 -5.293l-5.292 -5.293a1 1 0 0 1 1.414 -1.414" /></svg>';function we(n={}){let{color:o="neutral",removable:t=!1}=n;return{dataTone:"shift-1",_onInit:e=>{let r={span:ko,onClick:i=>{i.stopPropagation(),e.remove()},style:{display:"inline-flex",alignItems:"center",cursor:"pointer",borderRadius:M(1),width:M(4),height:M(4),flexShrink:0,"&:hover":{backgroundColor:i=>Pe(i,"shift-3",o)}}};t&&e.children.insert(r)},style:{display:"inline-flex",alignItems:"center",whiteSpace:"nowrap",userSelect:"none",height:M(6),paddingBlock:"0px",borderRadius:M(1),paddingInlineStart:M(2),paddingInlineEnd:t?M(1):M(2),gap:M(2),fontSize:e=>So(e,"inherit"),backgroundColor:e=>Pe(e,"inherit",o),color:e=>Pe(e,"shift-6",o),border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${Pe(e,"shift-3",o)}`}}}import{toState as yt,merge as To}from"@domphy/core";import{computePosition as Po,autoUpdate as wo,offset as _o,flip as Io,shift as zo}from"@floating-ui/dom";function H(n){let{open:o=!1,placement:t="bottom"}=n,e=null,r=null,i=null,s=null,a=yt(o),l=yt(t),d=()=>{i&&s&&(r&&r(),r=wo(i,s,()=>{Po(i,s,{placement:l.get(),middleware:[_o(12),Io(),zo()],strategy:"fixed"}).then(({x:f,y:p,placement:b})=>{var y;Object.assign(s.style,{left:`${f}px`,top:`${p}px`}),b!==l.get()&&l.set(b),(y=n.onPlacement)==null||y.call(n,i,s,b)})}),a.set(!0))},m=()=>{r&&r(),r=null,a.set(!1)},c=()=>{e&&clearTimeout(e),e=setTimeout(d,100)},u=()=>{e&&clearTimeout(e),e=setTimeout(m,100)},g={style:{position:"fixed",pointerEvents:"auto",visibility:f=>a.get(f)?"visible":"hidden"},_onMount:f=>s=f.domElement,_portal:f=>{let p=f.domElement.querySelector("#domphy-floating");if(!p){let b={div:[],id:"domphy-floating",style:{position:"fixed",inset:0,zIndex:20,pointerEvents:"none"}};p=f.children.insert(b).domElement}return p}};return To(n.content,g),{show:c,hide:u,anchorPartial:{onKeyDown:f=>f.key==="Escape"&&u(),_onSchedule:f=>{let p=null;f.getRoot().addHook("Init",b=>{p=b.children.insert(n.content)}),f.addHook("BeforeRemove",()=>{u(),e&&clearTimeout(e),p&&p.remove()})},_onMount:f=>{i=f.domElement;let p=b=>{if(!a.get()||!i||!s)return;let y=b.target;!i.contains(y)&&!s.contains(y)&&u()};f.getRoot().domElement.addEventListener("click",p),f.addHook("BeforeRemove",()=>f.getRoot().domElement.removeEventListener("click",p))}}}}function fi(n){let{options:o=[],placement:t="bottom",color:e="neutral",open:r=!1,multiple:i=!1}=n,s=Ct(n.value),a=Ct(r),{show:l,hide:d,anchorPartial:m}=H({open:a,placement:t,content:n.content,onPlacement:n.onPlacement}),c={onClick:()=>!i&&d()};Ae(n.content,c);let u={border:"none",outline:"none",padding:0,margin:0,flex:1,height:j(6),marginInlineStart:j(2),fontSize:p=>vt(p,"inherit"),color:p=>de(p,"shift-6",e),backgroundColor:p=>de(p,"inherit",e)},g;n.input?(Ae(n.input,{onFocus:()=>l(),style:u,_key:"combobox-input"}),g=n.input):g={input:null,onFocus:()=>l(),value:p=>(s.get(p),""),style:u,_key:"combobox-input"};let h={div:p=>{let b=s.get(p),y=Array.isArray(b)?b:[b],T=o.filter(G=>y.includes(G.value)).map(G=>({span:G.label,$:[we({color:e,removable:!0})],_key:G.value,_onRemove:Be=>{let se=s.get(),lt=(Array.isArray(se)?se:[se]).filter(to=>to!==G.value);i?s.set(lt):s.set(lt[0])}}));return T.push(g),T},style:{display:"flex",flexWrap:"wrap",gap:j(1)}},f={_onInsert:p=>{p.tagName!="div"&&console.warn('"combobox" primitive patch must use div tag')},_onInit:p=>p.children.insert(h),style:{minWidth:j(32),outlineOffset:"-1px",outline:p=>`1px solid ${de(p,"shift-3","neutral")}`,paddingBlock:j(1),paddingInline:j(1),borderRadius:j(2),fontSize:p=>vt(p,"inherit"),color:p=>de(p,"shift-6",e),backgroundColor:p=>de(p,"inherit",e)}};return Ae(m,f),m}import{toState as xt}from"@domphy/core";import{themeSpacing as We,themeColor as Et}from"@domphy/theme";function St(n={}){let{placement:o="bottom-end",color:t="neutral",sideOffset:e=We(6),bordered:r=!0}=n,i=xt(o),s={top:"bottom",bottom:"top",left:"right",right:"left","top-start":"bottom-end","top-end":"bottom-start","bottom-start":"top-end","bottom-end":"top-start","left-start":"right-end","left-end":"right-start","right-start":"left-end","right-end":"left-start"},a=xt(s[i.get()]);i.onChange(m=>a.set(s[m]));let l=m=>m.includes("start")?e:m.includes("end")?"auto":"50%",d=m=>m.includes("end")?e:m.includes("start")?"auto":"50%";return{style:{position:"relative","&::after":{content:'""',position:"absolute",width:We(1.5),height:We(1.5),backgroundColor:m=>Et(m,"inherit",t),borderWidth:r?"0px":"1px",borderColor:m=>Et(m,"inherit",t),borderTopStyle:m=>{let c=a.get(m);return c.includes("top")||c.includes("right")?"solid":"none"},borderBottomStyle:m=>{let c=a.get(m);return c.includes("bottom")||c.includes("left")?"solid":"none"},borderLeftStyle:m=>{let c=a.get(m);return c.includes("top")||c.includes("left")?"solid":"none"},borderRightStyle:m=>{let c=a.get(m);return c.includes("bottom")||c.includes("right")?"solid":"none"},top:m=>{let c=a.get(m);return c.includes("top")?0:c.includes("bottom")?"auto":l(c)},right:m=>{let c=a.get(m);return c.includes("right")?0:c.includes("left")?"auto":d(c)},bottom:m=>{let c=a.get(m);return c.includes("bottom")?0:c.includes("top")?"auto":d(c)},left:m=>{let c=a.get(m);return c.includes("left")?0:c.includes("right")?"auto":l(c)},transform:m=>{let c=a.get(m),u=c.includes("right")||c.includes("end")&&!c.includes("left")?"50%":"-50%",g=c.includes("bottom")||c.includes("end")&&!c.includes("top")?"50%":"-50%";return`translate(${u},${g}) rotate(45deg)`}}}}}import{themeSpacing as je,themeColor as kt,themeSize as $o}from"@domphy/theme";function ki(n={}){let{color:o="inherit"}=n;return{_onInsert:t=>{t.tagName!="blockquote"&&console.warn('"blockquote" primitive patch must use blockquote tag')},dataTone:"shift-1",style:{fontSize:t=>$o(t,"inherit"),backgroundColor:t=>kt(t,"inherit",o),boxShadow:t=>`inset ${je(1)} 0 0 0 ${kt(t,"shift-3",o)}`,border:"none",paddingBlock:je(2),paddingInline:je(4),margin:0}}}import{themeSpacing as _e,themeColor as N,themeSize as Mo}from"@domphy/theme";function wi(n={}){let{color:o="primary"}=n;return{_onInsert:t=>{t.tagName!="button"&&console.warn('"button" primitive patch must use button tag')},style:{appearance:"none",fontSize:t=>Mo(t,"inherit"),paddingBlock:_e(1),paddingInline:_e(3),borderRadius:_e(2),width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",userSelect:"none",fontFamily:"inherit",lineHeight:"inherit",border:"none",outlineOffset:"-1px",outlineWidth:"1px",outline:t=>`1px solid ${N(t,"shift-3",o)}`,color:t=>N(t,"shift-6",o),backgroundColor:t=>N(t,"inherit",o),"&:hover:not([disabled]):not([aria-busy=true])":{color:t=>N(t,"shift-7",o),backgroundColor:t=>N(t,"shift-1",o)},"&:focus-visible":{boxShadow:t=>`inset 0 0 0 ${_e(.5)} ${N(t,"shift-6",o)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",backgroundColor:t=>N(t,"shift-1","neutral"),outline:t=>`1px solid ${N(t,"shift-3","neutral")}`,color:t=>N(t,"shift-5","neutral")},"&[aria-busy=true]":{opacity:.7,cursor:"wait",pointerEvents:"none"}}}}import{themeColor as x,themeSpacing as O,themeSize as No}from"@domphy/theme";function $i(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"checkbox",_onInsert:e=>{e.tagName!=="input"&&console.warn('"inputCheckbox" primitive patch must use input tag')},style:{appearance:"none",fontSize:e=>No(e,"inherit"),display:"inline-flex",position:"relative",width:O(6),height:O(6),justifyContent:"center",alignItems:"center",transition:"background-color 300ms, outline-color 300ms",margin:0,padding:0,"&::before":{content:'""',display:"block",borderRadius:O(1),lineHeight:1,cursor:"pointer",border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${x(e,"shift-4",o)}`,color:e=>x(e,"shift-6",o),width:O(4),height:O(4)},"&:hover::before":{backgroundColor:e=>x(e,"shift-2",o)},"&:checked::before":{outline:e=>`1px solid ${x(e,"shift-5",t)}`,backgroundColor:e=>x(e,"shift-5",t)},"&:checked:hover:not([disabled])::before":{backgroundColor:e=>x(e,"shift-4",t)},"&:checked::after":{content:'""',display:"block",position:"absolute",top:"25%",insetInlineStart:"37%",width:"20%",height:"30%",border:e=>`${O(.5)} solid ${x(e,"inherit",t)}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg)"},"&:indeterminate::before":{outline:e=>`1px solid ${x(e,"shift-4",t)}`,backgroundColor:e=>x(e,"inherit",t)},"&:indeterminate::after":{content:'""',position:"absolute",inset:"30%",backgroundColor:e=>x(e,"shift-5",t)},"&:indeterminate:hover:not([disabled])::after":{backgroundColor:e=>x(e,"shift-4",t)},"&:focus-visible":{borderRadius:O(1.5),outline:e=>`${O(.5)} solid ${x(e,"shift-5",t)}`},"&[disabled]":{cursor:"not-allowed"},"&[disabled]::before, &[disabled]::after":{outline:"none",backgroundColor:e=>x(e,"shift-3","neutral"),pointerEvents:"none"}}}}import{themeSpacing as Ke,themeColor as Tt,themeSize as Ro}from"@domphy/theme";function Li(n={}){let{color:o="neutral"}=n;return{dataTone:"shift-2",_onInsert:t=>{t.tagName!="code"&&console.warn('"code" primitive patch must use code tag')},style:{display:"inline-flex",alignItems:"center",fontSize:t=>Ro(t,"inherit"),color:t=>Tt(t,"shift-6",o),backgroundColor:t=>Tt(t,"inherit",o),height:Ke(6),paddingInline:Ke(1.5),borderRadius:Ke(1)}}}import{themeColor as B,themeSize as Pt,themeSpacing as v}from"@domphy/theme";function Di(n={}){let{color:o="neutral",accentColor:t="primary",duration:e=240}=n;return{_onInsert:r=>{r.tagName!="details"&&console.warn('"details" primitive patch must use details tag')},style:{fontSize:r=>Pt(r,"inherit"),color:r=>B(r,"shift-6",o),backgroundColor:r=>B(r,"inherit",o),overflow:"hidden","& > summary":{backgroundColor:r=>B(r,"shift-1",o),color:r=>B(r,"shift-7",o),fontSize:r=>Pt(r,"inherit"),listStyle:"none",display:"flex",justifyContent:"space-between",alignItems:"center",gap:v(2),cursor:"pointer",userSelect:"none",fontWeight:500,paddingInline:v(4),height:v(10)},"& > summary::-webkit-details-marker":{display:"none"},"& > summary::marker":{content:'""'},"& > summary::after":{content:'""',width:v(2),height:v(2),flexShrink:0,marginTop:`-${v(.5)}`,borderInlineEnd:r=>`${v(.5)} solid ${B(r,"shift-6",o)}`,borderBottom:r=>`${v(.5)} solid ${B(r,"shift-6",o)}`,transform:"rotate(45deg)",transition:`transform ${e}ms ease`},"&[open] > summary::after":{transform:"rotate(-135deg)"},"& > summary:hover":{backgroundColor:r=>B(r,"shift-2",o)},"& > summary:focus-visible":{borderRadius:v(2),outlineOffset:`-${v(.5)}`,outline:r=>`${v(.5)} solid ${B(r,"shift-5",t)}`},"& > :not(summary)":{maxHeight:"0px",opacity:0,overflow:"hidden",paddingInline:v(3),paddingTop:0,paddingBottom:0,transition:`max-height ${e}ms ease, opacity ${e}ms ease, padding ${e}ms ease`},"&[open] > :not(summary)":{maxHeight:v(250),opacity:1,paddingTop:v(1),paddingBottom:v(3)}}}}import{themeColor as wt,themeSpacing as _t,themeSize as It}from"@domphy/theme";function Wi(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="dl"&&console.warn('"descriptionList" primitive patch must use dl tag')},style:{display:"grid",gridTemplateColumns:`minmax(${_t(24)}, max-content) 1fr`,columnGap:_t(4),margin:0,"& dt":{margin:0,fontWeight:600,fontSize:t=>It(t,"inherit"),color:t=>wt(t,"shift-7",o)},"& dd":{margin:0,fontSize:t=>It(t,"inherit"),color:t=>wt(t,"shift-6",o)}}}}import{toState as Lo}from"@domphy/core";import{themeColor as Ie,themeSize as Ho,themeSpacing as qe}from"@domphy/theme";function Gi(n={}){let{color:o="neutral",open:t=!1}=n,e=Lo(t);return{_onInsert:r=>{r.tagName!="dialog"&&console.warn('"dialog" primitive patch must use dialog tag')},onClick:(r,i)=>{if(r.target!==i.domElement)return;let s=i.domElement.getBoundingClientRect();r.clientX>=s.left&&r.clientX<=s.right&&r.clientY>=s.top&&r.clientY<=s.bottom||e.set(!1)},onTransitionEnd:(r,i)=>{let s=i.domElement;s.style.opacity==="0"&&(s.close(),document.body.style.overflow="")},_onMount:r=>{let i=r.domElement,s=a=>{a?(i.showModal(),document.body.style.overflow="hidden",requestAnimationFrame(()=>{i.style.opacity="1";let l=i.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');l==null||l.focus()})):i.style.opacity="0"};s(e.get()),e.onChange(s)},style:{opacity:"0",transition:"opacity 200ms ease",fontSize:r=>Ho(r,"inherit"),color:r=>Ie(r,"shift-7",o),backgroundColor:r=>Ie(r,"inherit",o),border:"none",padding:qe(3),boxShadow:r=>`0 ${qe(8)} ${qe(16)} ${Ie(r,"shift-3","neutral")}`,"&::backdrop":{backgroundColor:r=>Ie(r,"shift-1","neutral"),opacity:.75}}}}import{themeColor as Oo,themeSize as Bo}from"@domphy/theme";function Qi(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="em"&&console.warn('"emphasis" primitive patch must use em tag')},style:{fontSize:t=>Bo(t,"inherit"),fontStyle:"italic",color:t=>Oo(t,"shift-7",o)}}}import{themeColor as zt,themeSize as Do,themeSpacing as ze}from"@domphy/theme";function ol(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="figure"&&console.warn('"figure" primitive patch must use figure tag')},style:{display:"flex",flexDirection:"column",gap:ze(2),marginInline:0,marginTop:ze(3),marginBottom:ze(3),color:t=>zt(t,"shift-6",o),"& img, & svg, & video, & canvas":{display:"block",maxWidth:"100%",borderRadius:ze(2)},"& figcaption":{fontSize:t=>Do(t,"decrease-1"),color:t=>zt(t,"shift-5",o),lineHeight:1.45}}}}import{themeColor as $e,themeSpacing as R,themeSize as Ye}from"@domphy/theme";function il(n={}){let{color:o="neutral",layout:t="horizontal"}=n,e=t==="vertical";return{_onInsert:r=>{r.tagName!="fieldset"&&console.warn('"formGroup" patch must use fieldset tag')},style:{margin:0,paddingInline:R(3),paddingBlock:R(3),border:"none",borderRadius:R(2),fontSize:r=>Ye(r,"inherit"),backgroundColor:r=>$e(r,"inherit",o),display:"grid",gridTemplateColumns:e?"minmax(0, 1fr)":"max-content minmax(0, 1fr)",columnGap:R(4),rowGap:R(3),alignItems:"start","& > legend":{gridColumn:"1 / -1",margin:0,fontSize:r=>Ye(r,"inherit"),fontWeight:600,paddingBlock:R(1),borderRadius:R(2),color:r=>$e(r,"shift-6",o),backgroundColor:r=>$e(r,"inherit",o)},"& > label":{gridColumn:"1",alignSelf:"start",margin:0,paddingBlock:e?0:R(1)},"& > label:has(+ :not(legend, label, p) + p)":{gridRow:e?"auto":"span 2"},"& > :not(legend, label, p)":{gridColumn:e?"1":"2",minWidth:0,width:"100%",boxSizing:"border-box"},"& > p":{gridColumn:e?"1":"2",minWidth:0,margin:0,marginBlockStart:`calc(${R(2)} * -1)`,fontSize:r=>Ye(r,"decrease-1"),color:r=>$e(r,"shift-6",o)}}}}import{themeColor as Fo,themeSize as Vo,themeSpacing as Ao}from"@domphy/theme";var Wo={h6:"decrease-1",h5:"inherit",h4:"increase-1",h3:"increase-2",h2:"increase-3",h1:"increase-4"};function ml(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{["h1","h2","h3","h4","h5","h6"].includes(t.tagName)||console.warn('"heading" primitive patch must use heading tags [h1...h6]')},style:{color:t=>Fo(t,"shift-8",o),marginTop:0,marginBottom:Ao(2),fontSize:t=>{let e=Wo[t.elementNode.tagName]||"inherit";return Vo(t,e)}}}}import{themeColor as jo,themeSpacing as $t}from"@domphy/theme";function pl(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="hr"&&console.warn('"horizontalRule" primitive patch must use hr tag')},style:{border:0,height:"1px",marginInline:0,marginTop:$t(3),marginBottom:$t(3),backgroundColor:t=>jo(t,"shift-3",o)}}}import{themeColor as Ko,themeSpacing as qo}from"@domphy/theme";function bl(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="img"&&console.warn('"image" primitive patch must use img tag')},style:{display:"block",width:"100%",maxWidth:"100%",height:"auto",objectFit:"cover",borderRadius:qo(2),backgroundColor:t=>Ko(t,"shift-1",o)}}}import{themeSpacing as Mt}from"@domphy/theme";function vl(){return{_onInsert:n=>{n.tagName!="span"&&console.warn('"icon" primitive patch should use span tag')},style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:Mt(6),height:Mt(6)}}}import{themeColor as Nt,themeSpacing as Q,themeSize as Yo}from"@domphy/theme";function Sl(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"color",_onSchedule:(e,r)=>{e.tagName!="input"&&console.warn('"inputColor" primitive patch must use input tag'),r.type="color"},style:{appearance:"none",border:"none",cursor:"pointer",fontSize:e=>Yo(e,"inherit"),paddingBlock:Q(1),paddingInline:Q(1),blockSize:Q(8),inlineSize:Q(8),backgroundColor:"transparent","&::-webkit-color-swatch-wrapper":{margin:0,padding:0},"&::-webkit-color-swatch":{borderRadius:Q(1)},"&::-moz-color-swatch":{borderRadius:Q(1)},"&:hover:not([disabled]), &:focus-visible":{},"&[disabled]":{opacity:.7,cursor:"not-allowed",backgroundColor:e=>Nt(e,"shift-1","neutral"),outline:e=>`1px solid ${Nt(e,"shift-3","neutral")}`}}}}import{themeColor as D,themeSpacing as ue,themeSize as Go}from"@domphy/theme";function wl(n={}){let{mode:o="datetime-local",color:t="neutral",accentColor:e="primary"}=n;return{type:o,_onSchedule:(r,i)=>{r.tagName!="input"&&console.warn('"inputDateTime" primitive patch must use input tag'),i.type=o},style:{fontFamily:"inherit",fontSize:r=>Go(r,"inherit"),lineHeight:"inherit",color:r=>D(r,"shift-6",t),backgroundColor:r=>D(r,"inherit",t),border:"none",outlineOffset:"-1px",outline:r=>`1px solid ${D(r,"shift-3",t)}`,borderRadius:ue(2),paddingInline:ue(3),height:ue(8),"&::-webkit-calendar-picker-indicator":{cursor:"pointer",opacity:.85},"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible":{outline:r=>`${ue(.5)} solid ${D(r,"shift-5",e)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",color:r=>D(r,"shift-5","neutral"),backgroundColor:r=>D(r,"shift-1","neutral"),outline:r=>`1px solid ${D(r,"shift-3","neutral")}`},"&:invalid":{outline:r=>`${ue(.5)} solid ${D(r,"shift-5","error")}`}}}}import{themeColor as E,themeSpacing as P,themeSize as Uo}from"@domphy/theme";function $l(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"file",_onSchedule:(e,r)=>{e.tagName!="input"&&console.warn('"inputFile" primitive patch must use input tag'),r.type="file"},style:{fontFamily:"inherit",fontSize:e=>Uo(e,"inherit"),lineHeight:"inherit",color:e=>E(e,"shift-6",o),backgroundColor:e=>E(e,"inherit",o),border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${E(e,"shift-3",o)}`,borderRadius:P(2),height:P(8),paddingInline:P(1),"&::file-selector-button":{marginBlock:"auto",fontFamily:"inherit",fontSize:"inherit",border:"none",borderRadius:P(1),height:P(6),paddingInline:P(2),cursor:"pointer",color:e=>E(e,"shift-7",t),backgroundColor:e=>E(e,"shift-2",t)},"&::-webkit-file-upload-button":{marginTop:P(1),fontFamily:"inherit",fontSize:"inherit",border:"none",borderRadius:P(1),height:P(6),paddingInline:P(2),cursor:"pointer",color:e=>E(e,"shift-7",o),backgroundColor:e=>E(e,"shift-2",o)},"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible":{outline:e=>`${P(.5)} solid ${E(e,"shift-5",t)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",color:e=>E(e,"shift-5","neutral"),outline:e=>`1px solid ${E(e,"shift-3","neutral")}`,backgroundColor:e=>E(e,"shift-1","neutral")},"&[disabled]::file-selector-button, &[disabled]::-webkit-file-upload-button":{cursor:"not-allowed",color:e=>E(e,"shift-5","neutral"),backgroundColor:e=>E(e,"shift-2","neutral")}}}}import{themeColor as F,themeSpacing as pe,themeSize as Xo}from"@domphy/theme";function Ll(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"search",_onSchedule:(e,r)=>{e.tagName!="input"&&console.warn('"inputSearch" primitive patch must use input tag'),r.type="search"},style:{fontFamily:"inherit",fontSize:e=>Xo(e,"inherit"),lineHeight:"inherit",color:e=>F(e,"shift-6",o),backgroundColor:e=>F(e,"inherit",o),border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${F(e,"shift-3",o)}`,borderRadius:pe(2),minWidth:pe(32),paddingInline:pe(3),paddingBlock:pe(1),"&::placeholder":{color:e=>F(e,"shift-4",o)},"&::-webkit-search-decoration":{display:"none"},"&::-webkit-search-cancel-button":{cursor:"pointer"},"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible":{outline:e=>`${pe(.5)} solid ${F(e,"shift-5",t)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",color:e=>F(e,"shift-5","neutral"),backgroundColor:e=>F(e,"shift-1","neutral"),outline:e=>`1px solid ${F(e,"shift-3","neutral")}`}}}}import{themeColor as S,themeSpacing as V,themeSize as Jo}from"@domphy/theme";function Dl(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"text",_onSchedule:(e,r)=>{e.tagName!="input"&&console.warn('"inputText" primitive patch must use input tag and text type'),r.type="text"},style:{fontFamily:"inherit",lineHeight:"inherit",minWidth:V(32),paddingInline:V(3),paddingBlock:V(1),borderRadius:V(2),fontSize:e=>Jo(e,"inherit"),border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${S(e,"shift-3",o)}`,color:e=>S(e,"shift-6",o),backgroundColor:e=>S(e,"inherit",o),"&::placeholder":{color:e=>S(e,"shift-4")},"&:not(:placeholder-shown)":{color:e=>S(e,"shift-7")},"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible":{outline:e=>`${V(.5)} solid ${S(e,"shift-5",t)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",backgroundColor:e=>S(e,"shift-1","neutral"),outline:e=>`1px solid ${S(e,"shift-3","neutral")}`,color:e=>S(e,"shift-5","neutral")},"&:invalid:not(:placeholder-shown)":{outline:e=>`${V(.5)} solid ${S(e,"shift-5","error")}`},"&[data-status=error]":{outline:e=>`${V(.5)} solid ${S(e,"shift-5","error")}`},"&[data-status=warning]":{outline:e=>`${V(.5)} solid ${S(e,"shift-5","warning")}`}}}}import{themeColor as K,themeSpacing as C}from"@domphy/theme";function Wl(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"range",_onInsert:e=>{e.tagName!="input"&&console.warn('"inputRange" primitive patch must use input tag')},style:{appearance:"none",width:"100%",margin:0,padding:0,height:C(4),background:"transparent",cursor:"pointer","&::-webkit-slider-runnable-track":{height:C(1.5),borderRadius:C(999),backgroundColor:e=>K(e,"shift-2",o)},"&::-moz-range-track":{height:C(1.5),borderRadius:C(999),backgroundColor:e=>K(e,"shift-2",o)},"&::-webkit-slider-thumb":{appearance:"none",width:C(4),height:C(4),borderRadius:C(999),border:"none",marginTop:`calc((${C(1.5)} - ${C(4)}) / 2)`,backgroundColor:e=>K(e,"shift-6",t)},"&::-moz-range-thumb":{width:C(4),height:C(4),borderRadius:C(999),border:"none",backgroundColor:e=>K(e,"shift-6",t)},"&:hover:not([disabled])::-webkit-slider-thumb":{backgroundColor:e=>K(e,"shift-7",t)},"&:hover:not([disabled])::-moz-range-thumb":{backgroundColor:e=>K(e,"shift-7",t)},"&:focus-visible":{outline:e=>`${C(.5)} solid ${K(e,"shift-4",t)}`,outlineOffset:C(1),borderRadius:C(2)},"&[disabled]":{opacity:.7,cursor:"not-allowed"}}}}import{themeColor as q,themeSpacing as he,themeSize as Qo}from"@domphy/theme";function Yl(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"number",_onSchedule:(e,r)=>{e.tagName!="input"&&console.warn('"inputNumber" primitive patch must use input tag'),r.type="number"},style:{fontFamily:"inherit",lineHeight:"inherit",minWidth:he(32),paddingInline:he(3),paddingBlock:he(1),borderRadius:he(2),fontSize:e=>Qo(e,"inherit"),border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${q(e,"shift-3",o)}`,color:e=>q(e,"shift-6",o),backgroundColor:e=>q(e,"inherit",o),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{opacity:1},"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible":{outline:e=>`${he(.5)} solid ${q(e,"shift-5",t)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",backgroundColor:e=>q(e,"shift-1","neutral"),outline:e=>`1px solid ${q(e,"shift-3","neutral")}`,color:e=>q(e,"shift-5","neutral")}}}}import{themeColor as Ge,themeSize as Zo,themeSpacing as Ue}from"@domphy/theme";function Jl(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="kbd"&&console.warn('"keyboard" primitive patch must use kbd tag')},style:{fontSize:t=>Zo(t,"inherit"),color:t=>Ge(t,"shift-6",o),backgroundColor:t=>Ge(t,"inherit",o),paddingBlock:Ue(.5),paddingInline:Ue(1.5),borderRadius:Ue(1),outline:t=>`1px solid ${Ge(t,"shift-3",o)}`}}}import{themeColor as Xe,themeSize as er,themeSpacing as tr}from"@domphy/theme";function ta(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{_onInsert:e=>{e.tagName!="label"&&console.warn('"label" primitive patch must use label tag')},style:{display:"inline-flex",alignItems:"center",gap:tr(2),fontSize:e=>er(e,"inherit"),color:e=>Xe(e,"shift-6",o),cursor:"pointer","&:focus-within":{color:e=>Xe(e,"shift-7",t)},"&[aria-disabled=true]":{opacity:.7,cursor:"not-allowed",color:e=>Xe(e,"shift-5","neutral")}}}}import{themeColor as fe,themeSize as or,themeSpacing as Je}from"@domphy/theme";function na(n={}){let{color:o="primary",accentColor:t="secondary"}=n;return{_onInsert:e=>{e.tagName!="a"&&console.warn('"link" primitive patch must use a tag')},style:{fontSize:e=>or(e,"inherit"),color:e=>fe(e,"shift-6",o),textDecoration:"none","&:visited":{color:e=>fe(e,"shift-6",t)},"&:hover:not([disabled])":{color:e=>fe(e,"shift-7",o),textDecoration:"underline"},"&:focus-visible":{borderRadius:Je(1),outlineOffset:Je(1),outline:e=>`${Je(.5)} solid ${fe(e,"shift-6",t)}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",color:e=>fe(e,"shift-5","neutral")}}}}import{themeSpacing as Qe,themeSize as rr,themeColor as Rt}from"@domphy/theme";function ma(n={}){let{accentColor:o="highlight",tone:t="shift-1"}=n;return{_onInsert:e=>{e.tagName!="mark"&&console.warn('"mark" primitive patch must use mark tag')},dataTone:t,style:{display:"inline-flex",alignItems:"center",fontSize:e=>rr(e,"inherit"),color:e=>Rt(e,"shift-6",o),backgroundColor:e=>Rt(e,"inherit",o),height:Qe(6),borderRadius:Qe(1),paddingInline:Qe(1.5)}}}import{themeColor as nr,themeSize as ir}from"@domphy/theme";function ha(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="p"&&console.warn('"paragraph" primitive patch must use p tag')},style:{fontSize:t=>ir(t,"inherit"),color:t=>nr(t,"shift-6",o),lineHeight:1.5,marginTop:0,marginBottom:0}}}import{themeColor as Lt,themeSpacing as Ze,themeSize as lr}from"@domphy/theme";function ya(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="pre"&&console.warn('"preformated" primitive patch must use pre tag')},style:{fontSize:t=>lr(t,"inherit"),color:t=>Lt(t,"shift-6",o),backgroundColor:t=>Lt(t,"shift-1",o),border:"none",paddingBlock:Ze(2),paddingInline:Ze(3),borderRadius:Ze(2)}}}import{themeColor as Me,themeSpacing as ge}from"@domphy/theme";function Ea(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{_onInsert:e=>{e.tagName!="progress"&&console.warn('"progress" primitive patch must use progress tag')},style:{appearance:"none",width:"100%",height:ge(2),border:0,borderRadius:ge(999),overflow:"hidden",backgroundColor:e=>Me(e,"shift-2",o),"&::-webkit-progress-bar":{backgroundColor:e=>Me(e,"shift-2",o),borderRadius:ge(999)},"&::-webkit-progress-value":{backgroundColor:e=>Me(e,"shift-6",t),borderRadius:ge(999),transition:"width 220ms ease"},"&::-moz-progress-bar":{backgroundColor:e=>Me(e,"shift-6",t),borderRadius:ge(999)}}}}import{themeColor as A,themeSize as ar,themeSpacing as be}from"@domphy/theme";function Pa(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{type:"radio",_onInsert:e=>{if(e.tagName!="input"){console.warn('"inputRadio" primitive patch must use input tag and radio type');return}},style:{fontSize:e=>ar(e,"inherit"),appearance:"none",display:"inline-flex",position:"relative",width:be(6),height:be(6),justifyContent:"center",alignItems:"center",transition:"background-color 300ms, outline-color 300ms",margin:0,padding:0,"&::before":{content:'""',display:"block",borderRadius:"50%",lineHeight:1,cursor:"pointer",border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${A(e,"shift-4",o)}`,color:e=>A(e,"shift-6",o),width:be(4),height:be(4)},"&:hover::before":{backgroundColor:e=>A(e,"shift-2",o)},"&:checked::before":{outline:e=>`1px solid ${A(e,"shift-5",t)}`},"&:checked::after":{content:'""',position:"absolute",inset:"30%",borderRadius:"50%",backgroundColor:e=>A(e,"shift-5",t)},"&:checked:hover:not([disabled])::before":{backgroundColor:e=>A(e,"shift-4",t)},"&:focus-visible":{borderRadius:"50%",outline:e=>`${be(.5)} solid ${A(e,"shift-5",t)}`},"&[disabled]":{cursor:"not-allowed"},"&[disabled]::before, &[disabled]::after":{outline:"none",backgroundColor:e=>A(e,"shift-3","neutral"),pointerEvents:"none"}}}}import{themeColor as w,themeSize as sr,themeSpacing as Y}from"@domphy/theme";function Ia(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{_onInsert:e=>{e.tagName!="select"&&console.warn('"select" primitive patch must use select tag')},style:{fontFamily:"inherit",fontSize:e=>sr(e,"inherit"),lineHeight:"inherit",color:e=>w(e,"shift-6",o),backgroundColor:e=>w(e,"inherit",o),border:"none",outlineOffset:"-1px",outline:e=>`1px solid ${w(e,"shift-3",o)}`,borderRadius:Y(2),paddingBlock:Y(1),paddingLeft:Y(3),paddingRight:Y(1),"&:not([multiple])":{height:Y(8)},"&:hover:not([disabled]):not([aria-busy=true])":{outline:e=>`${Y(.5)} solid ${w(e,"shift-4",t)}`},"&:focus-visible":{outline:e=>`${Y(.5)} solid ${w(e,"shift-5",t)}`},"& optgroup":{color:e=>w(e,"shift-8",o)},"& option[disabled]":{color:e=>w(e,"shift-4","neutral")},"&[disabled]":{opacity:.7,cursor:"not-allowed",color:e=>w(e,"shift-5","neutral"),outline:e=>`1px solid ${w(e,"shift-3","neutral")}`,backgroundColor:e=>w(e,"shift-1","neutral")}}}}import{hashString as mr}from"@domphy/core";import{themeColor as cr,themeSpacing as Ht}from"@domphy/theme";function Na(n={}){let{color:o="neutral"}=n,t={"0%,100%":{opacity:1},"50%":{opacity:.4}},e=mr(JSON.stringify(t));return{ariaHidden:"true",style:{height:Ht(6),display:"block",borderRadius:Ht(1),backgroundColor:r=>cr(r,"shift-2",o),animation:`${e} 1.5s ease-in-out infinite`,[`@keyframes ${e}`]:t}}}import{hashString as dr}from"@domphy/core";import{themeColor as Ot,themeSpacing as et}from"@domphy/theme";var Dt={to:{transform:"rotate(360deg)"}},Bt=dr(JSON.stringify(Dt));function Oa(n={}){let{color:o="neutral"}=n;return{role:"status",ariaLabel:"loading",_onInsert:t=>{t.tagName!="span"&&console.warn('"spinner" patch must use span tag')},style:{display:"inline-block",margin:0,flexShrink:0,width:et(6),height:et(6),borderRadius:"50%",border:t=>`${et(.5)} solid ${Ot(t,"shift-3",o)}`,borderTopColor:t=>Ot(t,"shift-6",o),boxSizing:"border-box",padding:0,animation:`${Bt} 0.7s linear infinite`,[`@keyframes ${Bt}`]:Dt}}}import{toState as ur}from"@domphy/core";import{themeColor as pr,themeSize as hr,themeSpacing as Ft}from"@domphy/theme";function Aa(n={}){var s;let{color:o="neutral",multiple:t=!1}=n,e=ur((s=n.value)!=null?s:t?[]:null),r={div:a=>{let l=e.get(a);return(Array.isArray(l)?l:[l]).map(m=>({input:null,name:n.name,value:m||""}))},hidden:!0};return{dataTone:"shift-11",_context:{select:{value:e,multiple:t}},_onInit:a=>{a.tagName!="div"&&console.warn('"selectList" patch must use a div tag'),a.children.insert(r)},style:{display:"flex",flexDirection:"column",paddingBlock:Ft(2),paddingInline:Ft(2),fontSize:a=>hr(a,"inherit"),backgroundColor:a=>pr(a,"inherit",o)}}}import{themeSpacing as Ne,themeColor as Z,themeSize as fr}from"@domphy/theme";function qa(n={}){let{accentColor:o="primary",color:t="neutral",value:e=null}=n;return{role:"option",_onInit:i=>{i.tagName!="div"&&console.warn('"selectItem" patch must use div tag');let s=i.getContext("select");if(s){let a=s.value;i.attributes.set("ariaSelected",l=>{let d=a.get(l);return s.multiple?d.includes(e):d==e}),i.addEvent("click",()=>{let l=a.get();s.multiple?l.includes(e)?a.set(l.filter(d=>d!==e)):a.set(l.concat([e])):l!=e&&a.set(e)})}},style:{cursor:"pointer",display:"flex",alignItems:"center",fontSize:i=>fr(i,"inherit"),height:Ne(8),paddingInline:Ne(3),border:"none",outline:"none",color:i=>Z(i,"shift-6",t),backgroundColor:i=>Z(i,"inherit",t),"&:hover:not([disabled]):not([aria-selected=true])":{backgroundColor:i=>Z(i,"shift-1",t)},"&[aria-selected=true]":{backgroundColor:i=>Z(i,"shift-2",o),color:i=>Z(i,"shift-8")},"&:focus-visible":{outline:i=>`${Ne(.5)} solid ${Z(i,"shift-5",o)}`,outlineOffset:`-${Ne(.5)}`}}}}import{toState as Vt,merge as At}from"@domphy/core";import{themeSpacing as ye,themeColor as tt,themeSize as gr}from"@domphy/theme";function Qa(n){let{options:o=[],placement:t="bottom",color:e="neutral",open:r=!1,multiple:i=!1}=n,s=Vt(n.value),a=Vt(r),{show:l,hide:d,anchorPartial:m}=H({open:a,placement:t,content:n.content,onPlacement:n.onPlacement}),c={onClick:()=>!i&&d()};At(n.content,c);let u={div:h=>{let f=s.get(h),p=Array.isArray(f)?f:[f];return o.filter(y=>p.includes(y.value)).map(y=>({span:y.label,$:[we({color:e,removable:i})],_key:y.value,_onRemove:ve=>{let T=s.get(),Be=(Array.isArray(T)?T:[T]).filter(se=>se!==y.value);i?s.set(Be):s.set(Be[0])}}))},style:{display:"flex",flexWrap:"wrap",gap:ye(1),flex:1}},g={_onInsert:h=>{h.tagName!="div"&&console.warn('"selectBox" patch must use div tag')},_onInit:h=>h.children.insert(u),onClick:()=>a.get()?d():l(),style:{cursor:"pointer",display:"flex",alignItems:"center",minHeight:ye(8),minWidth:ye(32),outlineOffset:"-1px",outline:h=>`1px solid ${tt(h,"shift-3","neutral")}`,paddingInline:ye(2),borderRadius:ye(2),fontSize:h=>gr(h,"inherit"),color:h=>tt(h,"shift-6",e),backgroundColor:h=>tt(h,"inherit",e)}};return At(m,g),m}import{themeColor as ot,themeSize as Wt,themeSpacing as L}from"@domphy/theme";function os(n={}){let{accentColor:o="primary"}=n;return{dataTone:"increase-2",type:"checkbox",_onSchedule:t=>{if(t.tagName!="input"){console.warn('"inputSwitch" primitive patch must use input tag');return}},style:{fontSize:t=>Wt(t,"inherit"),appearance:"none",position:"relative",display:"inline-flex",width:L(8),height:L(6),cursor:"pointer",margin:"0",paddingBlock:L(1),"&:checked":{"&::before":{backgroundColor:t=>ot(t,"increase-3",o)},"&::after":{left:`calc(100% - ${L(3.5)})`}},"&::after":{content:'""',aspectRatio:"1/1",position:"absolute",width:L(3),height:L(3),borderRadius:L(999),left:L(.5),top:"50%",transform:"translateY(-50%)",transition:"left 0.3s",backgroundColor:t=>ot(t,"decrease-3")},"&::before":{content:'""',width:"100%",borderRadius:L(999),display:"inline-block",fontSize:t=>Wt(t,"inherit"),lineHeight:1,backgroundColor:t=>ot(t)},"&[disabled]":{opacity:.7,cursor:"not-allowed"}}}}import{toState as br}from"@domphy/core";import{themeColor as ee,themeSize as yr,themeSpacing as k}from"@domphy/theme";function ls(n={}){let{checked:o=!1,accentColor:t="primary",color:e="neutral"}=n,r=br(o);return{_onSchedule:i=>{i.tagName!="button"&&console.warn('"buttonSwitch" primitive patch must use button tag')},role:"switch",ariaChecked:i=>r.get(i),dataTone:"increase-2",onClick:()=>r.set(!r.get()),style:{position:"relative",display:"inline-flex",alignItems:"center",fontSize:i=>yr(i),border:"none",outlineWidth:"1px",outline:i=>`1px solid ${ee(i,"shift-2",e)}`,minWidth:k(12),minHeight:k(6),borderRadius:k(999),paddingLeft:k(7),paddingRight:k(2),transition:"padding-left 0.3s, padding-right 0.3s",backgroundColor:i=>ee(i,"inherit",e),"& > :first-child":{content:'""',position:"absolute",display:"inline-flex",alignItems:"center",left:k(.5),top:"50%",transform:"translateY(-50%)",transition:"left 0.3s",width:k(5),height:k(5),borderRadius:k(999),color:i=>ee(i,"shift-6"),backgroundColor:i=>ee(i,"decrease-2",e)},"&[aria-checked=true]":{backgroundColor:i=>ee(i,"increase-3",t),outline:"none",color:i=>ee(i,"decrease-2"),paddingLeft:k(2),paddingRight:k(7)},"&[aria-checked=true] > :first-child":{left:`calc(100% - ${k(5.5)})`},"&[disabled]":{opacity:.7,cursor:"not-allowed"}}}}import{themeColor as Cr,themeSize as vr}from"@domphy/theme";function cs(n={}){let{color:o="neutral"}=n;return{dataSize:"decrease-1",_onInsert:t=>{t.tagName!="small"&&console.warn('"small" primitive patch must use small tag')},style:{fontSize:t=>vr(t,"inherit"),color:t=>Cr(t,"shift-6",o)}}}import{themeColor as xr,themeSize as Er}from"@domphy/theme";function hs(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="strong"&&console.warn('"strong" primitive patch must use strong tag')},style:{fontSize:t=>Er(t,"inherit"),fontWeight:700,color:t=>xr(t,"shift-8",o)}}}import{themeColor as Sr,themeSize as kr}from"@domphy/theme";function ys(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="sub"&&console.warn('"subscript" primitive patch must use sub tag')},style:{fontSize:t=>kr(t,"decrease-1"),verticalAlign:"sub",lineHeight:0,color:t=>Sr(t,"shift-6",o)}}}import{themeColor as Tr,themeSize as Pr}from"@domphy/theme";function Es(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="sup"&&console.warn('"superscript" primitive patch must use sup tag')},style:{fontSize:t=>Pr(t,"decrease-1"),verticalAlign:"super",lineHeight:0,color:t=>Tr(t,"shift-6",o)}}}import{themeColor as _,themeSpacing as te,themeSize as jt}from"@domphy/theme";function Ts(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="table"&&console.warn('"table" primitive patch must use table tag')},style:{fontSize:t=>jt(t,"inherit"),color:t=>_(t,"shift-6",o),width:"100%",borderCollapse:"collapse","& caption":{captionSide:"bottom"},"& th, & thead td":{textAlign:"left",fontWeight:500,paddingInline:te(3),paddingBlock:te(1),color:t=>_(t,"shift-7",o),backgroundColor:t=>_(t,"inherit")},"& td":{textAlign:"left",paddingInline:te(3),paddingBlock:te(1),color:t=>_(t,"shift-6",o),boxShadow:t=>`inset 0 1px 0 ${_(t,"shift-3",o)}`,fontSize:t=>jt(t,"inherit")},"& tfoot th, & tfoot td":{textAlign:"left",fontWeight:500,paddingInline:te(3),paddingBlock:te(1),color:t=>_(t,"shift-7",o),backgroundColor:t=>_(t,"inherit"),boxShadow:t=>`inset 0 -1px 0 ${_(t,"shift-3",o)}`},"& tr":{backgroundColor:t=>_(t,"inherit")},"& tbody tr:hover":{backgroundColor:t=>_(t,"shift-2")+"!important"}}}}import{themeColor as I,themeSpacing as oe,themeSize as wr}from"@domphy/theme";function Is(n={}){let{color:o="neutral",accentColor:t="primary"}=n;return{_onInsert:e=>{e.tagName!="textarea"&&console.warn('"textarea" primitive patch must use textarea tag')},style:{fontFamily:"inherit",lineHeight:"inherit",resize:"vertical",paddingInline:oe(4),paddingBlock:oe(2),border:"none",borderRadius:oe(2),fontSize:e=>wr(e,"inherit"),color:e=>I(e,"shift-6",o),outlineOffset:"-1px",outline:e=>`1px solid ${I(e,"shift-3",o)}`,backgroundColor:e=>I(e,"inherit",o),"&::placeholder":{color:e=>I(e,"shift-4")},"&:hover:not([disabled]):not([aria-busy=true])":{outline:e=>`${oe(.5)} solid ${I(e,"shift-4",t)}`},"&:focus-visible":{outline:e=>`${oe(.5)} solid ${I(e,"shift-5",t)}`},"&:invalid":{outline:e=>`${oe(.5)} solid ${I(e,"shift-4","error")}`},"&[disabled]":{opacity:.7,cursor:"not-allowed",color:e=>I(e,"shift-5","neutral"),outline:e=>`1px solid ${I(e,"shift-3","neutral")}`,backgroundColor:e=>I(e,"shift-1","neutral")}}}}import{themeColor as _r,themeSize as Ir,themeSpacing as zr}from"@domphy/theme";function Ns(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="ul"&&console.warn('"unorderedList" primitive patch must use ul tag')},style:{fontSize:t=>Ir(t,"inherit"),color:t=>_r(t,"shift-6",o),marginTop:0,marginBottom:0,paddingLeft:zr(3),listStyleType:"disc",listStylePosition:"outside"}}}import{themeColor as $r,themeSize as Mr,themeSpacing as Nr}from"@domphy/theme";function Os(n={}){let{color:o="neutral"}=n;return{_onInsert:t=>{t.tagName!="ol"&&console.warn('"orderedList" primitive patch must use ol tag')},style:{fontSize:t=>Mr(t,"inherit"),color:t=>$r(t,"shift-6",o),marginTop:0,marginBottom:0,paddingLeft:Nr(3),listStyleType:"decimal",listStylePosition:"outside"}}}import{toState as Rr}from"@domphy/core";import{themeColor as re,themeSize as Lr,themeSpacing as ne}from"@domphy/theme";function Hr(n,o){if(o<=7)return Array.from({length:o},(i,s)=>s+1);let t=[1];n>3&&t.push("...");let e=Math.max(2,n-1),r=Math.min(o-1,n+1);for(let i=e;i<=r;i++)t.push(i);return n<o-2&&t.push("..."),t.push(o),t}function Vs(n){var a;let{total:o,color:t="neutral",accentColor:e="primary"}=n,r=Rr((a=n.value)!=null?a:1),i={display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:ne(8),height:ne(8),paddingInline:ne(2),borderRadius:ne(2),border:"none",cursor:"pointer",fontSize:l=>Lr(l,"inherit"),backgroundColor:"transparent",color:l=>re(l,"shift-6",t),"&:hover:not([disabled])":{backgroundColor:l=>re(l,"shift-1",t)},"&[disabled]":{opacity:.4,cursor:"not-allowed"}},s=ct(mt({},i),{backgroundColor:l=>re(l,"shift-2",e),color:l=>re(l,"shift-8",e),fontWeight:"600",cursor:"default","&:hover:not([disabled])":{backgroundColor:l=>re(l,"shift-2",e)}});return{_onInsert:l=>{l.tagName!=="div"&&console.warn('"pagination" patch must use div tag')},_onInit:l=>{let d={div:m=>{let c=r.get(m),u=[];u.push({button:"\u2039",type:"button",ariaLabel:"Previous page",disabled:c<=1,onClick:()=>c>1&&r.set(c-1),style:i});for(let g of Hr(c,o))if(g==="...")u.push({span:"\u2026",style:{display:"inline-flex",alignItems:"center",paddingInline:ne(2),color:h=>re(h,"shift-4",t)}});else{let h=g===c;u.push({button:String(g),type:"button",ariaLabel:`Page ${g}`,ariaCurrent:h?"page":void 0,disabled:h,onClick:()=>r.set(g),style:h?s:i})}return u.push({button:"\u203A",type:"button",ariaLabel:"Next page",disabled:c>=o,onClick:()=>c<o&&r.set(c+1),style:i}),u},style:{display:"flex",alignItems:"center",gap:ne(1)}};l.children.insert(d)},style:{display:"inline-flex"}}}import{themeColor as Kt,themeSize as Or,themeSpacing as Br}from"@domphy/theme";function Ks(n={}){let{color:o="neutral"}=n;return{role:"separator",_onInsert:t=>{t.tagName!=="div"&&console.warn('"divider" patch should be used with <div>')},style:{display:"flex",justifyContent:"center",alignItems:"baseline",gap:Br(2),fontSize:t=>Or(t,"inherit"),minHeight:"1lh","&::before":{content:'""',flex:1,borderColor:t=>Kt(t,"shift-3",o),borderWidth:"1px",borderBottomStyle:"solid"},"&::after":{content:'""',flex:1,borderColor:t=>Kt(t,"shift-3",o),borderWidth:"1px",borderBottomStyle:"solid"}}}}import{toState as Dr}from"@domphy/core";import{themeColor as Re,themeSize as Fr,themeSpacing as Ce}from"@domphy/theme";var qt={left:"translateX(-100%)",right:"translateX(100%)",top:"translateY(-100%)",bottom:"translateY(100%)"},Vr={left:"0 auto 0 0",right:"0 0 0 auto",top:"0 0 auto 0",bottom:"auto 0 0 0"},rt=n=>n==="left"||n==="right";function Us(n={}){let{color:o="neutral",open:t=!1,placement:e="right",size:r}=n,i=Dr(t),s=rt(e)?Ce(80):Ce(64),a=r!=null?r:s;return{_onInsert:l=>{l.tagName!=="dialog"&&console.warn('"drawer" patch must use dialog tag')},onClick:(l,d)=>{l.target===d.domElement&&i.set(!1)},onTransitionEnd:(l,d)=>{let m=d.domElement;i.get()||(m.close(),document.body.style.overflow="")},_onMount:l=>{let d=l.domElement,m=c=>{c?(d.showModal(),document.body.style.overflow="hidden",requestAnimationFrame(()=>{d.style.transform="translate(0, 0)"})):d.style.transform=qt[e]};m(i.get()),i.onChange(m)},style:{transform:qt[e],transition:"transform 0.25s ease",fontSize:l=>Fr(l,"inherit"),color:l=>Re(l,"shift-7",o),backgroundColor:l=>Re(l,"inherit",o),border:"none",padding:Ce(3),margin:Vr[e],width:rt(e)?a:"100dvw",height:rt(e)?"100dvh":a,maxWidth:"100dvw",maxHeight:"100dvh",boxShadow:l=>`0 ${Ce(4)} ${Ce(12)} ${Re(l,"shift-3","neutral")}`,"&::backdrop":{backgroundColor:l=>Re(l,"shift-1","neutral"),opacity:.75}}}}import{toState as Ar,merge as Yt}from"@domphy/core";function om(n){let{open:o=!1,placement:t="bottom",openOn:e="click"}=n,r=null,i=Ar(o),{show:s,hide:a,anchorPartial:l}=H({open:i,placement:t,content:n.content,onPlacement:n.onPlacement}),d={role:"dialog",dataTone:"shift-6",onMouseEnter:()=>e==="hover"&&s(),onMouseLeave:()=>e==="hover"&&a(),_onInsert:c=>{let u=c.attributes.get("id");r=u||c.nodeId,!u&&c.attributes.set("id",r)}};return Yt(n.content,d),Yt(l,{ariaHaspopup:"dialog",ariaExpanded:c=>i.get(c),onMouseEnter:()=>e==="hover"&&s(),onMouseLeave:()=>e==="hover"&&a(),onClick:()=>e==="click"&&(i.get()?a():s()),onFocus:()=>s(),onBlur:()=>a(),_onMount:c=>r&&c.attributes.set("ariaControls",r)}),l}import{toState as Wr}from"@domphy/core";import{themeColor as nt,themeSize as jr,themeSpacing as W}from"@domphy/theme";function lm(n={}){let{position:o="top-center",color:t="neutral"}=n,e=Wr(!1),r=o.startsWith("top"),i=o.endsWith("center"),s=o.endsWith("right"),a={div:[],id:`domphy-toast-${o}`,style:{position:"fixed",display:"flex",flexDirection:r?"column":"column-reverse",alignItems:i?"center":s?"end":"start",inset:0,gap:W(4),zIndex:30,padding:W(6),pointerEvents:"none"}};return{_portal:l=>{let d=l.domElement.querySelector(`#domphy-toast-${o}`);return d||(d=l.children.insert(a).domElement),d},role:"status",ariaAtomic:"true",style:{minWidth:W(32),pointerEvents:"auto",paddingBlock:W(2),paddingInline:W(4),borderRadius:W(2),fontSize:l=>jr(l,"inherit"),color:l=>nt(l,"shift-1",t),backgroundColor:l=>nt(l,"shift-9",t),boxShadow:l=>`0 ${W(2)} ${W(8)} ${nt(l,"shift-3","neutral")}`,opacity:l=>Number(e.get(l)),transform:l=>e.get(l)?"translateY(0)":r?"translateY(-100%)":"translateY(100%)",transition:"opacity 300ms ease, transform 300ms ease"},_onMount:()=>requestAnimationFrame(()=>e.set(!0)),_onBeforeRemove:(l,d)=>{let m=c=>{c.propertyName==="transform"&&(l.domElement.removeEventListener("transitionend",m),d())};l.domElement.addEventListener("transitionend",m),e.set(!1)}}}import{toState as Kr,merge as Gt}from"@domphy/core";import{themeSpacing as it,themeColor as Ut,themeSize as qr}from"@domphy/theme";function Yr(n,o){return{span:n,dataSize:"decrease-1",dataTone:"shift-6",style:{paddingBlock:it(1),paddingInline:it(3),borderRadius:it(2),color:t=>Ut(t,"shift-6"),backgroundColor:t=>Ut(t),fontSize:t=>qr(t,"inherit")},$:[St({placement:o,bordered:!1})]}}function gm(n={}){let{open:o=!1,placement:t="top",content:e="Tooltip Content"}=n,r=null,i=Kr(t),s=typeof e=="string"?Yr(e,i):e,{show:a,hide:l,anchorPartial:d}=H({open:o,placement:t,content:s});return Gt(s,{role:"tooltip",_onInsert:u=>{let g=u.attributes.get("id");r=g||u.nodeId,!g&&u.attributes.set("id",r)}}),Gt(d,{onMouseEnter:()=>a(),onMouseLeave:()=>l(),onFocus:()=>a(),onBlur:()=>l(),onKeyDown:u=>u.key==="Escape"&&l(),_onMount:u=>r&&u.attributes.set("ariaDescribedby",r)}),d}import{ElementNode as Xt}from"@domphy/core";function Jt(n,o){return n.key!==void 0&&n.key!==null?String(n.key):`index-${o}`}function vm(n={}){let{duration:o=300,delay:t=0}=n,e=new Map;return{_onBeforeUpdate:r=>{e=new Map,r.children.items.forEach((i,s)=>{if(!(i instanceof Xt))return;let a=i.domElement;a&&e.set(Jt(i,s),a.getBoundingClientRect())})},_onUpdate:r=>{r.children.items.forEach((i,s)=>{if(!(i instanceof Xt))return;let a=i.domElement;if(!a)return;let l=Jt(i,s),d=e.get(l);if(!d)return;let m=a.getBoundingClientRect(),c=d.left-m.left,u=d.top-m.top;if(Math.abs(c)<.5&&Math.abs(u)<.5)return;let g=a.style.transition,h=a.style.transform;a.style.transition="none",a.style.transform=`translate(${c}px, ${u}px)`,a.getBoundingClientRect(),requestAnimationFrame(()=>{a.style.transition=`transform ${o}ms ease ${t}ms`,a.style.transform="translate(0px, 0px)"});let f=()=>{a.style.transition=g,a.style.transform=h,a.removeEventListener("transitionend",p)},p=b=>{b.propertyName==="transform"&&f()};a.addEventListener("transitionend",p),setTimeout(f,o+t+34)}),e.clear()}}}import{merge as Gr}from"@domphy/core";import{toState as Ur}from"@domphy/core";function Pm(n={}){return{role:"tablist",_onSchedule:(t,e)=>{let r={_context:{tabs:{activeKey:Ur(n.activeKey||0),path:t.key}}};Gr(e,r)}}}import{themeSpacing as ie,themeColor as le,themeSize as Xr}from"@domphy/theme";function zm(n={}){let{accentColor:o="primary",color:t="neutral"}=n;return{role:"tab",_onInsert:r=>{var d;r.tagName!="button"&&console.warn('"tab" patch must use button tag');let i=r.getContext("tabs"),s=(d=r.parent)==null?void 0:d.children.items;s=s.filter(m=>m.type=="ElementNode"&&m.attributes.get("role")=="tab");let a=r.key||s.findIndex(m=>m==r),l={id:"tab"+i.path+a,ariaControls:"tabpanel"+i.path+a,ariaSelected:m=>i.activeKey.get(m)==a,onClick:()=>i.activeKey.set(a),onKeyDown:m=>{var p,b,y,ve;let c=m.key;if(!["ArrowLeft","ArrowRight","Home","End"].includes(c))return;m.preventDefault();let u=((b=(p=r.parent)==null?void 0:p.children.items)!=null?b:[]).filter(T=>T.type==="ElementNode"&&T.attributes.get("role")==="tab"),g=u.findIndex(T=>T===r),h=g;c==="ArrowRight"?h=(g+1)%u.length:c==="ArrowLeft"?h=(g-1+u.length)%u.length:c==="Home"?h=0:c==="End"&&(h=u.length-1);let f=u[h];i.activeKey.set((y=f.key)!=null?y:h),(ve=f.domElement)==null||ve.focus()}};r.merge(l)},style:{cursor:"pointer",fontSize:r=>Xr(r,"inherit"),height:ie(8),paddingInline:ie(4),border:"none",outline:"none",color:r=>le(r,"shift-6"),backgroundColor:r=>le(r,"inherit"),boxShadow:r=>`inset 0 -${ie(.5)} 0 0 ${le(r,"shift-2",t)}`,"&:hover:not([disabled])":{boxShadow:r=>`inset 0 -${ie(.5)} 0 0 ${le(r,"shift-3",t)}`},"&[aria-selected=true]:not([disabled])":{boxShadow:r=>`inset 0 -${ie(.5)} 0 0 ${le(r,"shift-4",o)}`},"&:focus-visible":{boxShadow:r=>`inset 0 -${ie(.5)} 0 0 ${le(r,"shift-6",o)}`}}}}import{themeSpacing as Qt}from"@domphy/theme";function Rm(){return{role:"tabpanel",style:{paddingBlock:Qt(2),paddingInline:Qt(2)},_onInsert:o=>{var s;let t=o.getContext("tabs"),e=(s=o.parent)==null?void 0:s.children.items;e=e.filter(a=>a.type=="ElementNode"&&a.attributes.get("role")=="tabpanel");let r=o.key||e.findIndex(a=>a==o),i={id:"tabpanel"+t.path+r,ariaLabelledby:"tab"+t.path+r,hidden:a=>t.activeKey.get(a)!=r};o.merge(i)}}}import{merge as Jr}from"@domphy/core";import{toState as Qr}from"@domphy/core";import{themeColor as Zr,themeSize as en,themeSpacing as Zt}from"@domphy/theme";function Vm(n={}){let{color:o="neutral"}=n;return{role:"menu",dataTone:"shift-11",_onSchedule:(e,r)=>{let i={_context:{menu:{activeKey:Qr(n.activeKey||0)}}};Jr(r,i)},style:{display:"flex",flexDirection:"column",paddingBlock:Zt(2),paddingInline:Zt(2),fontSize:e=>en(e,"inherit"),backgroundColor:e=>Zr(e,"inherit",o)}}}import{themeSpacing as Le,themeColor as ae,themeSize as tn}from"@domphy/theme";function Km(n={}){let{accentColor:o="primary",color:t="neutral"}=n;return{role:"menuitem",_onInsert:r=>{var l;r.tagName!="button"&&console.warn('"menuItem" patch must use button tag');let i=r.getContext("menu"),s=(l=r.parent)==null?void 0:l.children.items;s=s.filter(d=>d.type=="ElementNode"&&d.attributes.get("role")=="menuitem");let a=r.key||s.findIndex(d=>d==r);r.attributes.set("ariaCurrent",d=>i.activeKey.get(d)==a||void 0),r.addEvent("click",()=>i.activeKey.set(a)),r.addEvent("keydown",d=>{var h,f,p;let m=d.key;if(!["ArrowDown","ArrowUp","Home","End"].includes(m))return;d.preventDefault();let c=((f=(h=r.parent)==null?void 0:h.children.items)!=null?f:[]).filter(b=>b.type==="ElementNode"&&b.attributes.get("role")==="menuitem"),u=c.findIndex(b=>b===r),g=u;m==="ArrowDown"?g=(u+1)%c.length:m==="ArrowUp"?g=(u-1+c.length)%c.length:m==="Home"?g=0:m==="End"&&(g=c.length-1),(p=c[g].domElement)==null||p.focus()})},style:{cursor:"pointer",display:"flex",alignItems:"center",width:"100%",fontSize:r=>tn(r,"inherit"),height:Le(8),paddingInline:Le(3),border:"none",outline:"none",color:r=>ae(r,"shift-6"),backgroundColor:r=>ae(r,"inherit"),"&:hover:not([disabled]):not([aria-current=true])":{backgroundColor:r=>ae(r,"shift-1")},"&[aria-current=true]":{backgroundColor:r=>ae(r,"shift-1",o),color:r=>ae(r,"shift-7")},"&:focus-visible":{outline:r=>`${Le(.5)} solid ${ae(r,"shift-5",o)}`,outlineOffset:`-${Le(.5)}`}}}}import{merge as on}from"@domphy/core";function Um(n){return{_onSchedule:(o,t)=>{on(t,{_context:{form:n}})}}}function Jm(n,o){return{_onInsert:t=>{let r=t.getContext("form").setField(n,void 0,o),i=t.tagName,s=t.attributes.get("type");["input","select","textarea"].includes(i)||console.warn('"field" patch must use input, select, or textarea tag');let a={onBlur:()=>r.setTouched(),ariaInvalid:l=>!!r.message("error",l)||void 0,dataStatus:l=>r.status(l)};i==="input"&&s==="checkbox"?(a.checked=r.value(),a.onChange=l=>r.setValue(l.target.checked)):i==="input"&&s==="radio"?a.onChange=l=>r.setValue(l.target.value):i==="select"?(a.value=r.value(),a.onChange=l=>r.setValue(l.target.value)):i==="textarea"?(a.value=r.value(),a.onInput=l=>r.setValue(l.target.value)):(a.value=r.value(),a.onInput=l=>r.setValue(l.target.value)),t.merge(a)}}}import{Notifier as rn}from"@domphy/core";function nn(n){return!!n&&typeof n.then=="function"}var Oe=class{constructor(o,t){this._notifier=new rn;this._messages={};this._touched=!1;this._pending=!1;this._validationToken=0;this._value=o,this._initValue=o,this._validator=t,t&&this.validate()}value(o){return o&&this._notifier.addListener("value",o),this._value}setValue(o){this._value=o,this._notifier.notify("value",o),this._notifier.notify("dirty",o!==this._initValue),this.validate()}dirty(o){return o&&this._notifier.addListener("dirty",o),this._value!==this._initValue}touched(o){return o&&this._notifier.addListener("touched",o),this._touched}setTouched(){this._touched||(this._touched=!0,this._notifier.notify("touched",!0))}configure(o,t){let e=!1;o!==void 0&&this._value===void 0&&this._initValue===void 0&&(this._value=o,this._initValue=o,this._notifier.notify("value",o),this._notifier.notify("dirty",!1),e=!0),t!==void 0&&t!==this._validator&&(this._validator=t,e=!0),e&&this.validate()}message(o,t){return t&&this._notifier.addListener(o,t),this._messages[o]}status(o){return o&&this._notifier.addListener("status",o),He(this._messages)}setMessages(o){let t=this._messages;this._messages=o;for(let e of["error","warning","success"])t[e]!==o[e]&&this._notifier.notify(e,o[e]);He(t)!==He(o)&&this._notifier.notify("status",He(o))}reset(){this._value=this._initValue,this._touched=!1,this._notifier.notify("value",this._value),this._notifier.notify("dirty",!1),this._notifier.notify("touched",!1),this.setMessages({}),this.validate()}validate(){let o=++this._validationToken;if(!this._validator){this._pending=!1,this.setMessages({});return}try{let t=this._validator(this._value);nn(t)?(this._pending=!0,Promise.resolve(t).then(e=>{o===this._validationToken&&(this._pending=!1,this.setMessages(e!=null?e:{}))}).catch(e=>{o===this._validationToken&&(this._pending=!1,console.error(e))})):(this._pending=!1,this.setMessages(t!=null?t:{}))}catch(t){o===this._validationToken&&(this._pending=!1),console.error(t)}}_dispose(){this._validationToken+=1,this._pending=!1,this._notifier._dispose()}};function He(n){if(n.error)return"error";if(n.warning)return"warning";if(n.success)return"success"}var eo=class{constructor(){this.fields=new Map}setField(o,t,e){let r=this.fields.get(o);return r?r.configure(t,e):(r=new Oe(t,e),this.fields.set(o,r)),r}getField(o){return this.setField(o)}removeField(o){var t;(t=this.fields.get(o))==null||t._dispose(),this.fields.delete(o)}get valid(){for(let o of this.fields.values())if(o._pending||o._messages.error)return!1;return!0}reset(){for(let o of this.fields.values())o.reset()}snapshot(){let o={};for(let[t,e]of this.fields)ln(o,t,e._value);return o}_dispose(){for(let o of this.fields.values())o._dispose();this.fields.clear()}};function ln(n,o,t){let e=o.split("."),r=n;for(let i=0;i<e.length-1;i++){let s=e[i];r[s]==null&&(r[s]=isNaN(Number(e[i+1]))?{}:[]),r=r[s]}r[e[e.length-1]]=t}export{Oe as FieldState,eo as FormState,dn as abbreviation,Fn as alert,Wn as avatar,Gn as badge,ki as blockquote,Jn as breadcrumb,ei as breadcrumbEllipsis,wi as button,ls as buttonSwitch,hn as card,Li as code,fi as combobox,kn as command,Pn as commandItem,Tn as commandSearch,Wi as descriptionList,Di as details,Gi as dialog,Ks as divider,Us as drawer,Qi as emphasis,Jm as field,ol as figure,Um as form,il as formGroup,ml as heading,pl as horizontalRule,vl as icon,bl as image,$i as inputCheckbox,Sl as inputColor,wl as inputDateTime,$l as inputFile,Yl as inputNumber,On as inputOTP,Pa as inputRadio,Wl as inputRange,Ll as inputSearch,os as inputSwitch,Dl as inputText,Jl as keyboard,ta as label,na as link,ma as mark,Vm as menu,Km as menuItem,Os as orderedList,Vs as pagination,ha as paragraph,om as popover,St as popoverArrow,ya as preformated,Ea as progress,Ia as select,Qa as selectBox,qa as selectItem,Aa as selectList,Na as skeleton,cs as small,Oa as spinner,yn as splitter,vn as splitterHandle,Cn as splitterPanel,hs as strong,ys as subscript,Es as superscript,zm as tab,Rm as tabPanel,Ts as table,Pm as tabs,we as tag,Is as textarea,lm as toast,In as toggle,Rn as toggleGroup,gm as tooltip,vm as transitionGroup,Ns as unorderedList};
2
+ //# sourceMappingURL=index.js.map