@ark-ui/solid 3.2.2 → 3.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.
Files changed (76) hide show
  1. package/README.md +19 -14
  2. package/dist/cjs/index.js +2005 -33
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/esm/index.js +1970 -23
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/source/components/checkbox/checkbox-group.jsx +18 -0
  7. package/dist/source/components/checkbox/checkbox.js +1 -0
  8. package/dist/source/components/checkbox/index.js +3 -0
  9. package/dist/source/components/checkbox/use-checkbox-group-context.jsx +6 -0
  10. package/dist/source/components/checkbox/use-checkbox-group.js +52 -0
  11. package/dist/source/components/checkbox/use-checkbox.js +9 -4
  12. package/dist/source/components/index.js +2 -0
  13. package/dist/source/components/presence/split-presence-props.js +1 -0
  14. package/dist/source/components/qr-code/index.js +9 -0
  15. package/dist/source/components/qr-code/qr-code-context.js +2 -0
  16. package/dist/source/components/qr-code/qr-code-frame.jsx +8 -0
  17. package/dist/source/components/qr-code/qr-code-overlay.jsx +8 -0
  18. package/dist/source/components/qr-code/qr-code-pattern.jsx +8 -0
  19. package/dist/source/components/qr-code/qr-code-root-provider.jsx +11 -0
  20. package/dist/source/components/qr-code/qr-code-root.jsx +18 -0
  21. package/dist/source/components/qr-code/qr-code.js +6 -0
  22. package/dist/source/components/qr-code/use-qr-code-context.js +5 -0
  23. package/dist/source/components/qr-code/use-qr-code.js +19 -0
  24. package/dist/source/components/select/index.js +1 -0
  25. package/dist/source/components/select/select-list.jsx +8 -0
  26. package/dist/source/components/select/select.js +1 -0
  27. package/dist/source/components/signature-pad/index.js +11 -0
  28. package/dist/source/components/signature-pad/signature-pad-clear-trigger.jsx +8 -0
  29. package/dist/source/components/signature-pad/signature-pad-context.jsx +2 -0
  30. package/dist/source/components/signature-pad/signature-pad-control.jsx +8 -0
  31. package/dist/source/components/signature-pad/signature-pad-guide.jsx +8 -0
  32. package/dist/source/components/signature-pad/signature-pad-label.jsx +8 -0
  33. package/dist/source/components/signature-pad/signature-pad-root-provider.jsx +13 -0
  34. package/dist/source/components/signature-pad/signature-pad-root.jsx +22 -0
  35. package/dist/source/components/signature-pad/signature-pad-segment.jsx +18 -0
  36. package/dist/source/components/signature-pad/signature-pad.js +8 -0
  37. package/dist/source/components/signature-pad/use-signature-pad-context.js +5 -0
  38. package/dist/source/components/signature-pad/use-signature-pad.js +17 -0
  39. package/dist/source/components/tabs/tab-content.jsx +4 -1
  40. package/dist/source/components/toast/toast-root.jsx +3 -1
  41. package/dist/source/utils/use-controllable-state.js +18 -0
  42. package/dist/types/components/checkbox/checkbox-group.d.ts +6 -0
  43. package/dist/types/components/checkbox/checkbox.d.ts +1 -0
  44. package/dist/types/components/checkbox/index.d.ts +3 -0
  45. package/dist/types/components/checkbox/use-checkbox-group-context.d.ts +4 -0
  46. package/dist/types/components/checkbox/use-checkbox-group.d.ts +42 -0
  47. package/dist/types/components/checkbox/use-checkbox.d.ts +1 -1
  48. package/dist/types/components/index.d.ts +2 -0
  49. package/dist/types/components/presence/split-presence-props.d.ts +1 -1
  50. package/dist/types/components/qr-code/index.d.ts +10 -0
  51. package/dist/types/components/qr-code/qr-code-context.d.ts +6 -0
  52. package/dist/types/components/qr-code/qr-code-frame.d.ts +4 -0
  53. package/dist/types/components/qr-code/qr-code-overlay.d.ts +4 -0
  54. package/dist/types/components/qr-code/qr-code-pattern.d.ts +4 -0
  55. package/dist/types/components/qr-code/qr-code-root-provider.d.ts +9 -0
  56. package/dist/types/components/qr-code/qr-code-root.d.ts +6 -0
  57. package/dist/types/components/qr-code/qr-code.d.ts +7 -0
  58. package/dist/types/components/qr-code/use-qr-code-context.d.ts +4 -0
  59. package/dist/types/components/qr-code/use-qr-code.d.ts +9 -0
  60. package/dist/types/components/select/index.d.ts +1 -0
  61. package/dist/types/components/select/select-list.d.ts +4 -0
  62. package/dist/types/components/select/select.d.ts +1 -0
  63. package/dist/types/components/signature-pad/index.d.ts +12 -0
  64. package/dist/types/components/signature-pad/signature-pad-clear-trigger.d.ts +4 -0
  65. package/dist/types/components/signature-pad/signature-pad-context.d.ts +6 -0
  66. package/dist/types/components/signature-pad/signature-pad-control.d.ts +4 -0
  67. package/dist/types/components/signature-pad/signature-pad-guide.d.ts +4 -0
  68. package/dist/types/components/signature-pad/signature-pad-label.d.ts +4 -0
  69. package/dist/types/components/signature-pad/signature-pad-root-provider.d.ts +9 -0
  70. package/dist/types/components/signature-pad/signature-pad-root.d.ts +6 -0
  71. package/dist/types/components/signature-pad/signature-pad-segment.d.ts +4 -0
  72. package/dist/types/components/signature-pad/signature-pad.d.ts +9 -0
  73. package/dist/types/components/signature-pad/use-signature-pad-context.d.ts +4 -0
  74. package/dist/types/components/signature-pad/use-signature-pad.d.ts +9 -0
  75. package/dist/types/utils/use-controllable-state.d.ts +7 -0
  76. package/package.json +45 -44
package/dist/esm/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { createContext as createContext$1, useContext, splitProps, Show, createSignal, createMemo, createUniqueId, createEffect, children, Index, For } from 'solid-js';
1
+ import { createContext as createContext$1, useContext, splitProps, Show, createSignal, createMemo, createUniqueId, createEffect, untrack, children, Index, For } from 'solid-js';
2
2
  import { createComponent, Dynamic, mergeProps, memo, use, template, insert, effect, spread } from 'solid-js/web';
3
3
  import { mergeProps as mergeProps$1, useMachine, normalizeProps, useActor } from '@zag-js/solid';
4
4
  import * as collapsible$1 from '@zag-js/collapsible';
5
5
  import * as accordion$1 from '@zag-js/accordion';
6
6
  import * as avatar$1 from '@zag-js/avatar';
7
- import { carouselAnatomy, colorPickerAnatomy, datePickerAnatomy, segmentGroupAnatomy, selectAnatomy } from '@ark-ui/anatomy';
7
+ import { carouselAnatomy, checkboxAnatomy, colorPickerAnatomy, datePickerAnatomy, segmentGroupAnatomy, selectAnatomy } from '@ark-ui/anatomy';
8
8
  import * as carousel$1 from '@zag-js/carousel';
9
9
  import * as checkbox$1 from '@zag-js/checkbox';
10
10
  import * as clipboard$1 from '@zag-js/clipboard';
@@ -23,9 +23,12 @@ import * as pagination$1 from '@zag-js/pagination';
23
23
  import * as pinInput$1 from '@zag-js/pin-input';
24
24
  import * as popover$1 from '@zag-js/popover';
25
25
  import * as progress$1 from '@zag-js/progress';
26
+ import * as qrCode$1 from '@zag-js/qr-code';
26
27
  import * as radio from '@zag-js/radio-group';
27
28
  import * as rating from '@zag-js/rating-group';
28
29
  import * as select$1 from '@zag-js/select';
30
+ import { getDocument, getWindow, isIos, nextTick, raf, createScope, query, getDataUrl, dataAttr, getEventTarget } from '@zag-js/dom-query';
31
+ import { createProps } from '@zag-js/types';
29
32
  import * as slider$1 from '@zag-js/slider';
30
33
  import * as splitter$1 from '@zag-js/splitter';
31
34
  import * as zagSwitch from '@zag-js/switch';
@@ -35,7 +38,6 @@ import * as toast$1 from '@zag-js/toast';
35
38
  import * as toggleGroup$1 from '@zag-js/toggle-group';
36
39
  import * as tooltip$1 from '@zag-js/tooltip';
37
40
  import * as treeView$1 from '@zag-js/tree-view';
38
- import { getDocument, getWindow } from '@zag-js/dom-query';
39
41
 
40
42
  function getErrorMessage(hook, provider) {
41
43
  return `${hook} returned \`undefined\`. Seems you forgot to wrap component within ${provider}`;
@@ -132,8 +134,8 @@ const CollapsibleContent = props => {
132
134
 
133
135
  const CollapsibleContext = props => props.children(useCollapsibleContext());
134
136
 
135
- const isFunction = value => typeof value === 'function';
136
- const runIfFn = (valueOrFn, ...args) => isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
137
+ const isFunction$1 = value => typeof value === 'function';
138
+ const runIfFn$1 = (valueOrFn, ...args) => isFunction$1(valueOrFn) ? valueOrFn(...args) : valueOrFn;
137
139
 
138
140
  const [EnvironmentContextProvider, useEnvironmentContext] = createContext({
139
141
  hookName: 'useEnvironmentContext',
@@ -146,10 +148,10 @@ const [EnvironmentContextProvider, useEnvironmentContext] = createContext({
146
148
  })
147
149
  });
148
150
 
149
- var _tmpl$$4 = /*#__PURE__*/template(`<span hidden>`);
151
+ var _tmpl$$5 = /*#__PURE__*/template(`<span hidden>`);
150
152
  const EnvironmentProvider = props => {
151
153
  const [spanRef, setSpanRef] = createSignal();
152
- const getRootNode = () => runIfFn(props.value) ?? spanRef()?.ownerDocument ?? document;
154
+ const getRootNode = () => runIfFn$1(props.value) ?? spanRef()?.ownerDocument ?? document;
153
155
  const environment = createMemo(() => ({
154
156
  getRootNode,
155
157
  getDocument: () => getDocument(getRootNode()),
@@ -163,7 +165,7 @@ const EnvironmentProvider = props => {
163
165
  return !props.value;
164
166
  },
165
167
  get children() {
166
- var _el$ = _tmpl$$4();
168
+ var _el$ = _tmpl$$5();
167
169
  use(setSpanRef, _el$);
168
170
  return _el$;
169
171
  }
@@ -594,6 +596,88 @@ const CheckboxControl = props => {
594
596
  return createComponent(ark.div, mergedProps);
595
597
  };
596
598
 
599
+ function useControllableState(props) {
600
+ const [uncontrolledValue, setUncontrolledValue] = createSignal(runIfFn$1(props.defaultValue));
601
+ const controlled = createMemo(() => props.value?.() !== undefined);
602
+ const currentValue = createMemo(() => controlled() ? props.value?.() : uncontrolledValue());
603
+ const setValue = next => {
604
+ untrack(() => {
605
+ const nextValue = runIfFn$1(next, currentValue());
606
+ if (controlled()) {
607
+ return props.onChange?.(nextValue);
608
+ }
609
+ setUncontrolledValue(nextValue);
610
+ return props.onChange?.(nextValue);
611
+ });
612
+ };
613
+ return [currentValue, setValue];
614
+ }
615
+
616
+ function useCheckboxGroup(props = {}) {
617
+ const interative = createMemo(() => !(props.disabled || props.readOnly));
618
+ const [value, setValue] = useControllableState({
619
+ value: props.value,
620
+ defaultValue: props.defaultValue || [],
621
+ onChange: props.onValueChange
622
+ });
623
+ return createMemo(() => {
624
+ const isChecked = val => {
625
+ return value().some(v => String(v) === String(val));
626
+ };
627
+ const toggleValue = val => {
628
+ isChecked(val) ? removeValue(val) : addValue(val);
629
+ };
630
+ const addValue = val => {
631
+ if (!interative()) return;
632
+ if (isChecked(val)) return;
633
+ setValue(value().concat(val));
634
+ };
635
+ const removeValue = val => {
636
+ if (!interative()) return;
637
+ setValue(value().filter(v => String(v) !== String(val)));
638
+ };
639
+ const getItemProps = itemProps => {
640
+ return {
641
+ checked: itemProps.value != null ? isChecked(itemProps.value) : undefined,
642
+ onCheckedChange() {
643
+ if (itemProps.value != null) {
644
+ toggleValue(itemProps.value);
645
+ }
646
+ },
647
+ disabled: props.disabled,
648
+ readOnly: props.readOnly
649
+ };
650
+ };
651
+ return {
652
+ isChecked,
653
+ value,
654
+ disabled: props.disabled,
655
+ readOnly: props.readOnly,
656
+ setValue,
657
+ addValue,
658
+ toggleValue,
659
+ getItemProps
660
+ };
661
+ });
662
+ }
663
+
664
+ const [CheckboxGroupContextProvider, useCheckboxGroupContext] = createContext({
665
+ hookName: 'useCheckboxGroupContext',
666
+ providerName: '<CheckboxGroupProvider />',
667
+ strict: false
668
+ });
669
+
670
+ const CheckboxGroup = props => {
671
+ const [checkboxGroupProps, localProps] = createSplitProps()(props, ['defaultValue', 'value', 'onValueChange', 'disabled', 'readOnly']);
672
+ const checkboxGroup = useCheckboxGroup(checkboxGroupProps);
673
+ return createComponent(CheckboxGroupContextProvider, {
674
+ value: checkboxGroup,
675
+ get children() {
676
+ return createComponent(ark.div, mergeProps(localProps, () => checkboxAnatomy.build().group.attrs));
677
+ }
678
+ });
679
+ };
680
+
597
681
  const CheckboxHiddenInput = props => {
598
682
  const checkbox = useCheckboxContext();
599
683
  const mergedProps = mergeProps$1(() => checkbox().getHiddenInputProps(), props);
@@ -617,7 +701,13 @@ const CheckboxLabel = props => {
617
701
  return createComponent(ark.span, mergedProps);
618
702
  };
619
703
 
620
- const useCheckbox = props => {
704
+ const useCheckbox = ownProps => {
705
+ const checkboxGroup = useCheckboxGroupContext();
706
+ const props = createMemo(() => {
707
+ return mergeProps$1(ownProps, checkboxGroup?.().getItemProps({
708
+ value: ownProps.value
709
+ }) ?? {});
710
+ }, [ownProps, checkboxGroup]);
621
711
  const locale = useLocaleContext();
622
712
  const environment = useEnvironmentContext();
623
713
  const id = createUniqueId();
@@ -625,8 +715,8 @@ const useCheckbox = props => {
625
715
  id,
626
716
  dir: locale().dir,
627
717
  getRootNode: environment().getRootNode,
628
- checked: props.defaultChecked,
629
- ...props
718
+ checked: props().defaultChecked,
719
+ ...props()
630
720
  }));
631
721
  const [state, send] = useMachine(checkbox$1.machine(context()), {
632
722
  context
@@ -663,6 +753,7 @@ var checkbox = /*#__PURE__*/Object.freeze({
663
753
  __proto__: null,
664
754
  Context: CheckboxContext,
665
755
  Control: CheckboxControl,
756
+ Group: CheckboxGroup,
666
757
  HiddenInput: CheckboxHiddenInput,
667
758
  Indicator: CheckboxIndicator,
668
759
  Label: CheckboxLabel,
@@ -850,7 +941,7 @@ const ColorPickerChannelSliderTrack = props => {
850
941
  return createComponent(ark.div, mergedProps);
851
942
  };
852
943
 
853
- const splitPresenceProps = props => createSplitProps()(props, ['lazyMount', 'onExitComplete', 'present', 'unmountOnExit']);
944
+ const splitPresenceProps = props => createSplitProps()(props, ['immediate', 'lazyMount', 'onExitComplete', 'present', 'unmountOnExit']);
854
945
 
855
946
  const usePresence = props => {
856
947
  const [renderStrategyProps, context] = splitRenderStrategyProps(props);
@@ -1422,14 +1513,14 @@ const DatePickerLabel = props => {
1422
1513
  return createComponent(ark.label, mergedProps);
1423
1514
  };
1424
1515
 
1425
- var _tmpl$$3 = /*#__PURE__*/template(`<option>`);
1516
+ var _tmpl$$4 = /*#__PURE__*/template(`<option>`);
1426
1517
  const DatePickerMonthSelect = props => {
1427
1518
  const api = useDatePickerContext();
1428
1519
  const mergedProps = mergeProps$1(() => api().getMonthSelectProps(), props);
1429
1520
  return createComponent(ark.select, mergeProps(mergedProps, {
1430
1521
  get children() {
1431
1522
  return api().getMonths().map(month => (() => {
1432
- var _el$ = _tmpl$$3();
1523
+ var _el$ = _tmpl$$4();
1433
1524
  insert(_el$, () => month.label);
1434
1525
  effect(() => _el$.value = month.value);
1435
1526
  return _el$;
@@ -1694,7 +1785,7 @@ const DatePickerViewTrigger = props => {
1694
1785
  return createComponent(ark.button, mergedProps);
1695
1786
  };
1696
1787
 
1697
- var _tmpl$$2 = /*#__PURE__*/template(`<option>`);
1788
+ var _tmpl$$3 = /*#__PURE__*/template(`<option>`);
1698
1789
  const DatePickerYearSelect = props => {
1699
1790
  const api = useDatePickerContext();
1700
1791
  const mergedProps = mergeProps$1(() => api().getYearSelectProps(), props);
@@ -1704,7 +1795,7 @@ const DatePickerYearSelect = props => {
1704
1795
  from: 1_000,
1705
1796
  to: 4_000
1706
1797
  }).map(year => (() => {
1707
- var _el$ = _tmpl$$2();
1798
+ var _el$ = _tmpl$$3();
1708
1799
  _el$.value = year;
1709
1800
  insert(_el$, year);
1710
1801
  return _el$;
@@ -3227,6 +3318,82 @@ var progress = /*#__PURE__*/Object.freeze({
3227
3318
  View: ProgressView
3228
3319
  });
3229
3320
 
3321
+ const [QrCodeProvider, useQrCodeContext] = createContext({
3322
+ hookName: 'useQrCodeContext',
3323
+ providerName: '<QrCodeProvider />'
3324
+ });
3325
+
3326
+ const QrCodeContext = props => props.children(useQrCodeContext());
3327
+
3328
+ const QrCodeFrame = props => {
3329
+ const qrCode = useQrCodeContext();
3330
+ const mergedProps = mergeProps$1(() => qrCode().getFrameProps(), props);
3331
+ return createComponent(ark.svg, mergedProps);
3332
+ };
3333
+
3334
+ const QrCodeOverlay = props => {
3335
+ const qrCode = useQrCodeContext();
3336
+ const mergedProps = mergeProps$1(() => qrCode().getOverlayProps(), props);
3337
+ return createComponent(ark.div, mergedProps);
3338
+ };
3339
+
3340
+ const QrCodePattern = props => {
3341
+ const qrCode = useQrCodeContext();
3342
+ const mergedProps = mergeProps$1(() => qrCode().getPatternProps(), props);
3343
+ return createComponent(ark.path, mergedProps);
3344
+ };
3345
+
3346
+ const useQrCode = props => {
3347
+ const locale = useLocaleContext();
3348
+ const environment = useEnvironmentContext();
3349
+ const id = createUniqueId();
3350
+ const context = createMemo(() => ({
3351
+ id,
3352
+ dir: locale().dir,
3353
+ getRootNode: environment().getRootNode,
3354
+ ...props
3355
+ }));
3356
+ const [state, send] = useMachine(qrCode$1.machine(context()), {
3357
+ context
3358
+ });
3359
+ return createMemo(() => qrCode$1.connect(state, send, normalizeProps));
3360
+ };
3361
+
3362
+ const QrCodeRoot = props => {
3363
+ const [useQrCodeProps, restProps] = createSplitProps()(props, ['encoding', 'id', 'ids', 'value']);
3364
+ const api = useQrCode(useQrCodeProps);
3365
+ const mergedProps = mergeProps$1(() => api().getRootProps(), restProps);
3366
+ return createComponent(QrCodeProvider, {
3367
+ value: api,
3368
+ get children() {
3369
+ return createComponent(ark.div, mergedProps);
3370
+ }
3371
+ });
3372
+ };
3373
+
3374
+ const QrCodeRootProvider = props => {
3375
+ const [{
3376
+ value: qrCode
3377
+ }, localProps] = createSplitProps()(props, ['value']);
3378
+ const mergedProps = mergeProps$1(() => qrCode().getRootProps(), localProps);
3379
+ return createComponent(QrCodeProvider, {
3380
+ value: qrCode,
3381
+ get children() {
3382
+ return createComponent(ark.div, mergedProps);
3383
+ }
3384
+ });
3385
+ };
3386
+
3387
+ var qrCode = /*#__PURE__*/Object.freeze({
3388
+ __proto__: null,
3389
+ Frame: QrCodeFrame,
3390
+ Overlay: QrCodeOverlay,
3391
+ Pattern: QrCodePattern,
3392
+ QrCodeContext: QrCodeContext,
3393
+ Root: QrCodeRoot,
3394
+ RootProvider: QrCodeRootProvider
3395
+ });
3396
+
3230
3397
  const [RadioGroupProvider, useRadioGroupContext] = createContext({
3231
3398
  hookName: 'useRadioGroupContext',
3232
3399
  providerName: '<RadioGroupProvider />'
@@ -3610,8 +3777,8 @@ const SelectControl = props => {
3610
3777
  return createComponent(ark.div, mergedProps);
3611
3778
  };
3612
3779
 
3613
- var _tmpl$$1 = /*#__PURE__*/template(`<option value="">`),
3614
- _tmpl$2 = /*#__PURE__*/template(`<option>`);
3780
+ var _tmpl$$2 = /*#__PURE__*/template(`<option value="">`),
3781
+ _tmpl$2$1 = /*#__PURE__*/template(`<option>`);
3615
3782
  const SelectHiddenSelect = props => {
3616
3783
  const select = useSelectContext();
3617
3784
  const mergedProps = mergeProps$1(() => select().getControlProps(), props);
@@ -3623,14 +3790,14 @@ const SelectHiddenSelect = props => {
3623
3790
  return isValueEmpty();
3624
3791
  },
3625
3792
  get children() {
3626
- return _tmpl$$1();
3793
+ return _tmpl$$2();
3627
3794
  }
3628
3795
  }), createComponent(Index, {
3629
3796
  get each() {
3630
3797
  return select().collection.toArray();
3631
3798
  },
3632
3799
  children: option => (() => {
3633
- var _el$2 = _tmpl$2();
3800
+ var _el$2 = _tmpl$2$1();
3634
3801
  insert(_el$2, () => option().label);
3635
3802
  effect(() => _el$2.value = option().value);
3636
3803
  return _el$2;
@@ -3725,6 +3892,12 @@ const SelectLabel = props => {
3725
3892
  return createComponent(ark.label, mergedProps);
3726
3893
  };
3727
3894
 
3895
+ const SelectList = props => {
3896
+ const select = useSelectContext();
3897
+ const mergedProps = mergeProps$1(() => select().getListProps(), props);
3898
+ return createComponent(ark.div, mergedProps);
3899
+ };
3900
+
3728
3901
  const SelectPositioner = props => {
3729
3902
  const select = useSelectContext();
3730
3903
  const presenceApi = usePresenceContext();
@@ -3835,6 +4008,7 @@ var select = /*#__PURE__*/Object.freeze({
3835
4008
  ItemIndicator: SelectItemIndicator,
3836
4009
  ItemText: SelectItemText,
3837
4010
  Label: SelectLabel,
4011
+ List: SelectList,
3838
4012
  Positioner: SelectPositioner,
3839
4013
  Root: SelectRoot,
3840
4014
  RootProvider: SelectRootProvider,
@@ -3842,6 +4016,1777 @@ var select = /*#__PURE__*/Object.freeze({
3842
4016
  ValueText: SelectValueText
3843
4017
  });
3844
4018
 
4019
+ const [SignaturePadProvider, useSignaturePadContext] = createContext({
4020
+ hookName: 'useSignaturePadContext',
4021
+ providerName: '<SignaturePadProvider />'
4022
+ });
4023
+
4024
+ const SignaturePadClearTrigger = props => {
4025
+ const signaturePad = useSignaturePadContext();
4026
+ const mergedProps = mergeProps$1(() => signaturePad().getClearTriggerProps(), props);
4027
+ return createComponent(ark.button, mergedProps);
4028
+ };
4029
+
4030
+ const SignaturePadContext = props => props.children(useSignaturePadContext());
4031
+
4032
+ const SignaturePadControl = props => {
4033
+ const signaturePad = useSignaturePadContext();
4034
+ const mergedProps = mergeProps$1(() => signaturePad().getControlProps(), props);
4035
+ return createComponent(ark.div, mergeProps({
4036
+ role: "application"
4037
+ }, mergedProps));
4038
+ };
4039
+
4040
+ const SignaturePadGuide = props => {
4041
+ const signaturePad = useSignaturePadContext();
4042
+ const mergedProps = mergeProps$1(() => signaturePad().getGuideProps(), props);
4043
+ return createComponent(ark.div, mergedProps);
4044
+ };
4045
+
4046
+ const SignaturePadLabel = props => {
4047
+ const signaturePad = useSignaturePadContext();
4048
+ const mergedProps = mergeProps$1(() => signaturePad().getLabelProps(), props);
4049
+ return createComponent(ark.label, mergedProps);
4050
+ };
4051
+
4052
+ // src/create-anatomy.ts
4053
+ var createAnatomy = (name, parts = []) => ({
4054
+ parts: (...values) => {
4055
+ if (isEmpty(parts)) {
4056
+ return createAnatomy(name, values);
4057
+ }
4058
+ throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?");
4059
+ },
4060
+ extendWith: (...values) => createAnatomy(name, [...parts, ...values]),
4061
+ rename: (newName) => createAnatomy(newName, parts),
4062
+ keys: () => parts,
4063
+ build: () => [...new Set(parts)].reduce(
4064
+ (prev, part) => Object.assign(prev, {
4065
+ [part]: {
4066
+ selector: [
4067
+ `&[data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`,
4068
+ `& [data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`
4069
+ ].join(", "),
4070
+ attrs: { "data-scope": toKebabCase(name), "data-part": toKebabCase(part) }
4071
+ }
4072
+ }),
4073
+ {}
4074
+ )
4075
+ });
4076
+ var toKebabCase = (value) => value.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
4077
+ var isEmpty = (v) => v.length === 0;
4078
+
4079
+ // src/index.ts
4080
+ var state = "default";
4081
+ var userSelect = "";
4082
+ var elementMap = /* @__PURE__ */ new WeakMap();
4083
+ function disableTextSelectionImpl(options = {}) {
4084
+ const { target, doc } = options;
4085
+ const docNode = doc ?? document;
4086
+ const rootEl = docNode.documentElement;
4087
+ if (isIos()) {
4088
+ if (state === "default") {
4089
+ userSelect = rootEl.style.webkitUserSelect;
4090
+ rootEl.style.webkitUserSelect = "none";
4091
+ }
4092
+ state = "disabled";
4093
+ } else if (target) {
4094
+ elementMap.set(target, target.style.userSelect);
4095
+ target.style.userSelect = "none";
4096
+ }
4097
+ return () => restoreTextSelection({ target, doc: docNode });
4098
+ }
4099
+ function restoreTextSelection(options = {}) {
4100
+ const { target, doc } = options;
4101
+ const docNode = doc ?? document;
4102
+ const rootEl = docNode.documentElement;
4103
+ if (isIos()) {
4104
+ if (state !== "disabled") return;
4105
+ state = "restoring";
4106
+ setTimeout(() => {
4107
+ nextTick(() => {
4108
+ if (state === "restoring") {
4109
+ if (rootEl.style.webkitUserSelect === "none") {
4110
+ rootEl.style.webkitUserSelect = userSelect || "";
4111
+ }
4112
+ userSelect = "";
4113
+ state = "default";
4114
+ }
4115
+ });
4116
+ }, 300);
4117
+ } else {
4118
+ if (target && elementMap.has(target)) {
4119
+ const prevUserSelect = elementMap.get(target);
4120
+ if (target.style.userSelect === "none") {
4121
+ target.style.userSelect = prevUserSelect ?? "";
4122
+ }
4123
+ if (target.getAttribute("style") === "") {
4124
+ target.removeAttribute("style");
4125
+ }
4126
+ elementMap.delete(target);
4127
+ }
4128
+ }
4129
+ }
4130
+ function disableTextSelection(options = {}) {
4131
+ const { defer, target, ...restOptions } = options;
4132
+ const func = defer ? raf : (v) => v();
4133
+ const cleanups = [];
4134
+ cleanups.push(
4135
+ func(() => {
4136
+ const node = typeof target === "function" ? target() : target;
4137
+ cleanups.push(disableTextSelectionImpl({ ...restOptions, target: node }));
4138
+ })
4139
+ );
4140
+ return () => {
4141
+ cleanups.forEach((fn) => fn?.());
4142
+ };
4143
+ }
4144
+
4145
+ // src/add-dom-event.ts
4146
+ var addDomEvent = (target, eventName, handler, options) => {
4147
+ const node = typeof target === "function" ? target() : target;
4148
+ node?.addEventListener(eventName, handler, options);
4149
+ return () => {
4150
+ node?.removeEventListener(eventName, handler, options);
4151
+ };
4152
+ };
4153
+ var isLeftClick = (e) => e.button === 0;
4154
+ var isModifierKey = (e) => e.ctrlKey || e.altKey || e.metaKey;
4155
+
4156
+ // src/get-event-point.ts
4157
+ function pointFromTouch(e, type = "client") {
4158
+ const point = e.touches[0] || e.changedTouches[0];
4159
+ return { x: point[`${type}X`], y: point[`${type}Y`] };
4160
+ }
4161
+ function pointFromMouse(point, type = "client") {
4162
+ return { x: point[`${type}X`], y: point[`${type}Y`] };
4163
+ }
4164
+ var isTouchEvent = (event) => "touches" in event && event.touches.length > 0;
4165
+ function getEventPoint(event, type = "client") {
4166
+ return isTouchEvent(event) ? pointFromTouch(event, type) : pointFromMouse(event, type);
4167
+ }
4168
+
4169
+ // src/get-point-value.ts
4170
+ function clamp(value) {
4171
+ return Math.max(0, Math.min(1, value));
4172
+ }
4173
+ function getRelativePoint(point, element) {
4174
+ const { left, top, width, height } = element.getBoundingClientRect();
4175
+ const offset = { x: point.x - left, y: point.y - top };
4176
+ const percent = { x: clamp(offset.x / width), y: clamp(offset.y / height) };
4177
+ function getPercentValue(options = {}) {
4178
+ const { dir = "ltr", orientation = "horizontal", inverted } = options;
4179
+ const invertX = typeof inverted === "object" ? inverted.x : inverted;
4180
+ const invertY = typeof inverted === "object" ? inverted.y : inverted;
4181
+ if (orientation === "horizontal") {
4182
+ return dir === "rtl" || invertX ? 1 - percent.x : percent.x;
4183
+ }
4184
+ return invertY ? 1 - percent.y : percent.y;
4185
+ }
4186
+ return { offset, percent, getPercentValue };
4187
+ }
4188
+ function trackPointerMove(doc, handlers) {
4189
+ const { onPointerMove, onPointerUp } = handlers;
4190
+ const history = [];
4191
+ const handleMove = (event) => {
4192
+ const point = getEventPoint(event);
4193
+ history.push({ ...point, timestamp: performance.now() });
4194
+ const distance = Math.sqrt(point.x ** 2 + point.y ** 2);
4195
+ const moveBuffer = event.pointerType === "touch" ? 10 : 5;
4196
+ if (distance < moveBuffer) return;
4197
+ if (event.pointerType === "mouse" && event.button === 0) {
4198
+ onPointerUp();
4199
+ return;
4200
+ }
4201
+ onPointerMove({ point, event, velocity: getVelocity(history, 0.1) });
4202
+ };
4203
+ const cleanups = [
4204
+ addDomEvent(doc, "pointermove", handleMove, false),
4205
+ addDomEvent(doc, "pointerup", onPointerUp, false),
4206
+ addDomEvent(doc, "pointercancel", onPointerUp, false),
4207
+ addDomEvent(doc, "contextmenu", onPointerUp, false),
4208
+ disableTextSelection({ doc })
4209
+ ];
4210
+ return () => {
4211
+ cleanups.forEach((cleanup) => cleanup());
4212
+ history.length = 0;
4213
+ };
4214
+ }
4215
+ function lastDevicePoint(history) {
4216
+ return history[history.length - 1];
4217
+ }
4218
+ function ms(seconds) {
4219
+ return seconds * 1e3;
4220
+ }
4221
+ function sec(milliseconds) {
4222
+ return milliseconds / 1e3;
4223
+ }
4224
+ function getVelocity(history, timeDelta) {
4225
+ if (history.length < 2) return { x: 0, y: 0 };
4226
+ let i = history.length - 1;
4227
+ let timestampedPoint = null;
4228
+ const lastPoint = lastDevicePoint(history);
4229
+ while (i >= 0) {
4230
+ timestampedPoint = history[i];
4231
+ if (lastPoint.timestamp - timestampedPoint.timestamp > ms(timeDelta)) {
4232
+ break;
4233
+ }
4234
+ i--;
4235
+ }
4236
+ if (!timestampedPoint) return { x: 0, y: 0 };
4237
+ const time = sec(lastPoint.timestamp - timestampedPoint.timestamp);
4238
+ if (time === 0) return { x: 0, y: 0 };
4239
+ const currentVelocity = {
4240
+ x: (lastPoint.x - timestampedPoint.x) / time,
4241
+ y: (lastPoint.y - timestampedPoint.y) / time
4242
+ };
4243
+ if (currentVelocity.x === Infinity) currentVelocity.x = 0;
4244
+ if (currentVelocity.y === Infinity) currentVelocity.y = 0;
4245
+ return {
4246
+ x: Math.abs(currentVelocity.x),
4247
+ y: Math.abs(currentVelocity.y)
4248
+ };
4249
+ }
4250
+
4251
+ /* eslint @typescript-eslint/no-explicit-any: off */
4252
+ // symbols
4253
+ const GET_ORIGINAL_SYMBOL = Symbol();
4254
+ // get object prototype
4255
+ const getProto = Object.getPrototypeOf;
4256
+ const objectsToTrack = new WeakMap();
4257
+ // check if obj is a plain object or an array
4258
+ const isObjectToTrack = obj => obj && (objectsToTrack.has(obj) ? objectsToTrack.get(obj) : getProto(obj) === Object.prototype || getProto(obj) === Array.prototype);
4259
+ /**
4260
+ * Unwrap proxy to get the original object.
4261
+ *
4262
+ * Used to retrieve the original object used to create the proxy instance with `createProxy`.
4263
+ *
4264
+ * @param {Proxy<object>} obj - The proxy wrapper of the originial object.
4265
+ * @returns {object | null} - Return either the unwrapped object if exists.
4266
+ *
4267
+ * @example
4268
+ * import { createProxy, getUntracked } from 'proxy-compare';
4269
+ *
4270
+ * const original = { a: "1", c: "2", d: { e: "3" } };
4271
+ * const affected = new WeakMap();
4272
+ *
4273
+ * const proxy = createProxy(original, affected);
4274
+ * const originalFromProxy = getUntracked(proxy)
4275
+ *
4276
+ * Object.is(original, originalFromProxy) // true
4277
+ * isChanged(original, originalFromProxy, affected) // false
4278
+ */
4279
+ const getUntracked = obj => {
4280
+ if (isObjectToTrack(obj)) {
4281
+ return obj[GET_ORIGINAL_SYMBOL] || null;
4282
+ }
4283
+ return null;
4284
+ };
4285
+ /**
4286
+ * Mark object to be tracked.
4287
+ *
4288
+ * This function marks an object that will be passed into `createProxy`
4289
+ * as marked to track or not. By default only Array and Object are marked to track,
4290
+ * so this is useful for example to mark a class instance to track or to mark a object
4291
+ * to be untracked when creating your proxy.
4292
+ *
4293
+ * @param obj - Object to mark as tracked or not.
4294
+ * @param mark - Boolean indicating whether you want to track this object or not.
4295
+ * @returns - No return.
4296
+ *
4297
+ * @example
4298
+ * import { createProxy, markToTrack, isChanged } from 'proxy-compare';
4299
+ *
4300
+ * const nested = { e: "3" }
4301
+ *
4302
+ * markToTrack(nested, false)
4303
+ *
4304
+ * const original = { a: "1", c: "2", d: nested };
4305
+ * const affected = new WeakMap();
4306
+ *
4307
+ * const proxy = createProxy(original, affected);
4308
+ *
4309
+ * proxy.d.e
4310
+ *
4311
+ * isChanged(original, { d: { e: "3" } }, affected) // true
4312
+ */
4313
+ const markToTrack = (obj, mark = true) => {
4314
+ objectsToTrack.set(obj, mark);
4315
+ };
4316
+
4317
+ // src/global.ts
4318
+ function getGlobal() {
4319
+ if (typeof globalThis !== "undefined") return globalThis;
4320
+ if (typeof self !== "undefined") return self;
4321
+ if (typeof window !== "undefined") return window;
4322
+ if (typeof global !== "undefined") return global;
4323
+ }
4324
+ function makeGlobal(key, value) {
4325
+ const g = getGlobal();
4326
+ if (!g) return value();
4327
+ g[key] || (g[key] = value());
4328
+ return g[key];
4329
+ }
4330
+ var isDev$1 = process.env.NODE_ENV !== "production";
4331
+ var isObject$1 = (x) => typeof x === "object" && x !== null;
4332
+ var proxyStateMap = makeGlobal("__zag__proxyStateMap", () => /* @__PURE__ */ new WeakMap());
4333
+ var refSet = makeGlobal("__zag__refSet", () => /* @__PURE__ */ new WeakSet());
4334
+ var buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) => new Proxy(target, handler), canProxy = (x) => isObject$1(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer), defaultHandlePromise = (promise) => {
4335
+ switch (promise.status) {
4336
+ case "fulfilled":
4337
+ return promise.value;
4338
+ case "rejected":
4339
+ throw promise.reason;
4340
+ default:
4341
+ throw promise;
4342
+ }
4343
+ }, snapCache = /* @__PURE__ */ new WeakMap(), createSnapshot = (target, version, handlePromise = defaultHandlePromise) => {
4344
+ const cache = snapCache.get(target);
4345
+ if (cache?.[0] === version) {
4346
+ return cache[1];
4347
+ }
4348
+ const snap = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
4349
+ markToTrack(snap, true);
4350
+ snapCache.set(target, [version, snap]);
4351
+ Reflect.ownKeys(target).forEach((key) => {
4352
+ const value = Reflect.get(target, key);
4353
+ if (refSet.has(value)) {
4354
+ markToTrack(value, false);
4355
+ snap[key] = value;
4356
+ } else if (value instanceof Promise) {
4357
+ Object.defineProperty(snap, key, {
4358
+ get() {
4359
+ return handlePromise(value);
4360
+ }
4361
+ });
4362
+ } else if (proxyStateMap.has(value)) {
4363
+ snap[key] = snapshot(value, handlePromise);
4364
+ } else {
4365
+ snap[key] = value;
4366
+ }
4367
+ });
4368
+ return Object.freeze(snap);
4369
+ }, proxyCache = /* @__PURE__ */ new WeakMap(), versionHolder = [1, 1], proxyFunction2 = (initialObject) => {
4370
+ if (!isObject$1(initialObject)) {
4371
+ throw new Error("object required");
4372
+ }
4373
+ const found = proxyCache.get(initialObject);
4374
+ if (found) {
4375
+ return found;
4376
+ }
4377
+ let version = versionHolder[0];
4378
+ const listeners = /* @__PURE__ */ new Set();
4379
+ const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
4380
+ if (version !== nextVersion) {
4381
+ version = nextVersion;
4382
+ listeners.forEach((listener) => listener(op, nextVersion));
4383
+ }
4384
+ };
4385
+ let checkVersion = versionHolder[1];
4386
+ const ensureVersion = (nextCheckVersion = ++versionHolder[1]) => {
4387
+ if (checkVersion !== nextCheckVersion && !listeners.size) {
4388
+ checkVersion = nextCheckVersion;
4389
+ propProxyStates.forEach(([propProxyState]) => {
4390
+ const propVersion = propProxyState[1](nextCheckVersion);
4391
+ if (propVersion > version) {
4392
+ version = propVersion;
4393
+ }
4394
+ });
4395
+ }
4396
+ return version;
4397
+ };
4398
+ const createPropListener = (prop) => (op, nextVersion) => {
4399
+ const newOp = [...op];
4400
+ newOp[1] = [prop, ...newOp[1]];
4401
+ notifyUpdate(newOp, nextVersion);
4402
+ };
4403
+ const propProxyStates = /* @__PURE__ */ new Map();
4404
+ const addPropListener = (prop, propProxyState) => {
4405
+ if (isDev$1 && propProxyStates.has(prop)) {
4406
+ throw new Error("prop listener already exists");
4407
+ }
4408
+ if (listeners.size) {
4409
+ const remove = propProxyState[3](createPropListener(prop));
4410
+ propProxyStates.set(prop, [propProxyState, remove]);
4411
+ } else {
4412
+ propProxyStates.set(prop, [propProxyState]);
4413
+ }
4414
+ };
4415
+ const removePropListener = (prop) => {
4416
+ const entry = propProxyStates.get(prop);
4417
+ if (entry) {
4418
+ propProxyStates.delete(prop);
4419
+ entry[1]?.();
4420
+ }
4421
+ };
4422
+ const addListener = (listener) => {
4423
+ listeners.add(listener);
4424
+ if (listeners.size === 1) {
4425
+ propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
4426
+ if (isDev$1 && prevRemove) {
4427
+ throw new Error("remove already exists");
4428
+ }
4429
+ const remove = propProxyState[3](createPropListener(prop));
4430
+ propProxyStates.set(prop, [propProxyState, remove]);
4431
+ });
4432
+ }
4433
+ const removeListener = () => {
4434
+ listeners.delete(listener);
4435
+ if (listeners.size === 0) {
4436
+ propProxyStates.forEach(([propProxyState, remove], prop) => {
4437
+ if (remove) {
4438
+ remove();
4439
+ propProxyStates.set(prop, [propProxyState]);
4440
+ }
4441
+ });
4442
+ }
4443
+ };
4444
+ return removeListener;
4445
+ };
4446
+ const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
4447
+ const handler = {
4448
+ deleteProperty(target, prop) {
4449
+ const prevValue = Reflect.get(target, prop);
4450
+ removePropListener(prop);
4451
+ const deleted = Reflect.deleteProperty(target, prop);
4452
+ if (deleted) {
4453
+ notifyUpdate(["delete", [prop], prevValue]);
4454
+ }
4455
+ return deleted;
4456
+ },
4457
+ set(target, prop, value, receiver) {
4458
+ const hasPrevValue = Reflect.has(target, prop);
4459
+ const prevValue = Reflect.get(target, prop, receiver);
4460
+ if (hasPrevValue && (objectIs(prevValue, value) || proxyCache.has(value) && objectIs(prevValue, proxyCache.get(value)))) {
4461
+ return true;
4462
+ }
4463
+ removePropListener(prop);
4464
+ if (isObject$1(value)) {
4465
+ value = getUntracked(value) || value;
4466
+ }
4467
+ let nextValue = value;
4468
+ if (Object.getOwnPropertyDescriptor(target, prop)?.set) ; else if (value instanceof Promise) {
4469
+ value.then((v) => {
4470
+ Object.assign(value, { status: "fulfilled", value: v });
4471
+ notifyUpdate(["resolve", [prop], v]);
4472
+ }).catch((e) => {
4473
+ Object.assign(value, { status: "rejected", reason: e });
4474
+ notifyUpdate(["reject", [prop], e]);
4475
+ });
4476
+ } else {
4477
+ if (!proxyStateMap.has(value) && canProxy(value)) {
4478
+ nextValue = proxy(value);
4479
+ }
4480
+ const childProxyState = !refSet.has(nextValue) && proxyStateMap.get(nextValue);
4481
+ if (childProxyState) {
4482
+ addPropListener(prop, childProxyState);
4483
+ }
4484
+ }
4485
+ Reflect.set(target, prop, nextValue, receiver);
4486
+ notifyUpdate(["set", [prop], value, prevValue]);
4487
+ return true;
4488
+ }
4489
+ };
4490
+ const proxyObject = newProxy(baseObject, handler);
4491
+ proxyCache.set(initialObject, proxyObject);
4492
+ const proxyState = [baseObject, ensureVersion, createSnapshot, addListener];
4493
+ proxyStateMap.set(proxyObject, proxyState);
4494
+ Reflect.ownKeys(initialObject).forEach((key) => {
4495
+ const desc = Object.getOwnPropertyDescriptor(initialObject, key);
4496
+ if (desc.get || desc.set) {
4497
+ Object.defineProperty(baseObject, key, desc);
4498
+ } else {
4499
+ proxyObject[key] = initialObject[key];
4500
+ }
4501
+ });
4502
+ return proxyObject;
4503
+ }) => [
4504
+ // public functions
4505
+ proxyFunction2,
4506
+ // shared state
4507
+ proxyStateMap,
4508
+ refSet,
4509
+ // internal things
4510
+ objectIs,
4511
+ newProxy,
4512
+ canProxy,
4513
+ defaultHandlePromise,
4514
+ snapCache,
4515
+ createSnapshot,
4516
+ proxyCache,
4517
+ versionHolder
4518
+ ];
4519
+ var [proxyFunction] = buildProxyFunction();
4520
+ function proxy(initialObject = {}) {
4521
+ return proxyFunction(initialObject);
4522
+ }
4523
+ function subscribe(proxyObject, callback, notifyInSync) {
4524
+ const proxyState = proxyStateMap.get(proxyObject);
4525
+ if (isDev$1 && !proxyState) {
4526
+ console.warn("Please use proxy object");
4527
+ }
4528
+ let promise;
4529
+ const ops = [];
4530
+ const addListener = proxyState[3];
4531
+ let isListenerActive = false;
4532
+ const listener = (op) => {
4533
+ ops.push(op);
4534
+ if (notifyInSync) {
4535
+ callback(ops.splice(0));
4536
+ return;
4537
+ }
4538
+ if (!promise) {
4539
+ promise = Promise.resolve().then(() => {
4540
+ promise = void 0;
4541
+ if (isListenerActive) {
4542
+ callback(ops.splice(0));
4543
+ }
4544
+ });
4545
+ }
4546
+ };
4547
+ const removeListener = addListener(listener);
4548
+ isListenerActive = true;
4549
+ return () => {
4550
+ isListenerActive = false;
4551
+ removeListener();
4552
+ };
4553
+ }
4554
+ function snapshot(proxyObject, handlePromise) {
4555
+ const proxyState = proxyStateMap.get(proxyObject);
4556
+ if (isDev$1 && !proxyState) {
4557
+ console.warn("Please use proxy object");
4558
+ }
4559
+ const [target, ensureVersion, createSnapshot] = proxyState;
4560
+ return createSnapshot(target, ensureVersion(), handlePromise);
4561
+ }
4562
+ function ref(obj) {
4563
+ refSet.add(obj);
4564
+ return obj;
4565
+ }
4566
+
4567
+ // src/proxy-computed.ts
4568
+ function proxyWithComputed(initialObject, computedFns) {
4569
+ const keys = Object.keys(computedFns);
4570
+ keys.forEach((key) => {
4571
+ if (Object.getOwnPropertyDescriptor(initialObject, key)) {
4572
+ throw new Error("object property already defined");
4573
+ }
4574
+ const computedFn = computedFns[key];
4575
+ const { get, set } = typeof computedFn === "function" ? { get: computedFn } : computedFn;
4576
+ const desc = {};
4577
+ desc.get = () => get(snapshot(proxyObject));
4578
+ if (set) {
4579
+ desc.set = (newValue) => set(proxyObject, newValue);
4580
+ }
4581
+ Object.defineProperty(initialObject, key, desc);
4582
+ });
4583
+ const proxyObject = proxy(initialObject);
4584
+ return proxyObject;
4585
+ }
4586
+
4587
+ function set(obj, key, val) {
4588
+ if (typeof val.value === 'object') val.value = klona(val.value);
4589
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {
4590
+ Object.defineProperty(obj, key, val);
4591
+ } else obj[key] = val.value;
4592
+ }
4593
+
4594
+ function klona(x) {
4595
+ if (typeof x !== 'object') return x;
4596
+
4597
+ var i=0, k, list, tmp, str=Object.prototype.toString.call(x);
4598
+
4599
+ if (str === '[object Object]') {
4600
+ tmp = Object.create(x.__proto__ || null);
4601
+ } else if (str === '[object Array]') {
4602
+ tmp = Array(x.length);
4603
+ } else if (str === '[object Set]') {
4604
+ tmp = new Set;
4605
+ x.forEach(function (val) {
4606
+ tmp.add(klona(val));
4607
+ });
4608
+ } else if (str === '[object Map]') {
4609
+ tmp = new Map;
4610
+ x.forEach(function (val, key) {
4611
+ tmp.set(klona(key), klona(val));
4612
+ });
4613
+ } else if (str === '[object Date]') {
4614
+ tmp = new Date(+x);
4615
+ } else if (str === '[object RegExp]') {
4616
+ tmp = new RegExp(x.source, x.flags);
4617
+ } else if (str === '[object DataView]') {
4618
+ tmp = new x.constructor( klona(x.buffer) );
4619
+ } else if (str === '[object ArrayBuffer]') {
4620
+ tmp = x.slice(0);
4621
+ } else if (str.slice(-6) === 'Array]') {
4622
+ // ArrayBuffer.isView(x)
4623
+ // ~> `new` bcuz `Buffer.slice` => ref
4624
+ tmp = new x.constructor(x);
4625
+ }
4626
+
4627
+ if (tmp) {
4628
+ for (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {
4629
+ set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
4630
+ }
4631
+
4632
+ for (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {
4633
+ if (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;
4634
+ set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
4635
+ }
4636
+ }
4637
+
4638
+ return tmp || x;
4639
+ }
4640
+
4641
+ var __defProp = Object.defineProperty;
4642
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4643
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4644
+
4645
+ // ../utilities/core/src/array.ts
4646
+ function clear(v) {
4647
+ while (v.length > 0) v.pop();
4648
+ return v;
4649
+ }
4650
+
4651
+ // ../utilities/core/src/functions.ts
4652
+ var runIfFn = (v, ...a) => {
4653
+ const res = typeof v === "function" ? v(...a) : v;
4654
+ return res ?? void 0;
4655
+ };
4656
+ var cast = (v) => v;
4657
+ var noop = () => {
4658
+ };
4659
+ var uuid = /* @__PURE__ */ (() => {
4660
+ let id = 0;
4661
+ return () => {
4662
+ id++;
4663
+ return id.toString(36);
4664
+ };
4665
+ })();
4666
+
4667
+ // ../utilities/core/src/guard.ts
4668
+ var isDev = () => process.env.NODE_ENV !== "production";
4669
+ var isArray = (v) => Array.isArray(v);
4670
+ var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
4671
+ var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
4672
+ var isString = (v) => typeof v === "string";
4673
+ var isFunction = (v) => typeof v === "function";
4674
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
4675
+
4676
+ // ../utilities/core/src/object.ts
4677
+ function compact$1(obj) {
4678
+ if (!isPlainObject$1(obj) || obj === void 0) {
4679
+ return obj;
4680
+ }
4681
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
4682
+ const filtered = {};
4683
+ for (const key of keys) {
4684
+ const value = obj[key];
4685
+ if (value !== void 0) {
4686
+ filtered[key] = compact$1(value);
4687
+ }
4688
+ }
4689
+ return filtered;
4690
+ }
4691
+ var isPlainObject$1 = (value) => {
4692
+ return value && typeof value === "object" && value.constructor === Object;
4693
+ };
4694
+
4695
+ // ../utilities/core/src/warning.ts
4696
+ function warn(...a) {
4697
+ const m = a.length === 1 ? a[0] : a[1];
4698
+ const c = a.length === 2 ? a[0] : true;
4699
+ if (c && process.env.NODE_ENV !== "production") {
4700
+ console.warn(m);
4701
+ }
4702
+ }
4703
+ function invariant(...a) {
4704
+ const m = a.length === 1 ? a[0] : a[1];
4705
+ const c = a.length === 2 ? a[0] : true;
4706
+ if (c && process.env.NODE_ENV !== "production") {
4707
+ throw new Error(m);
4708
+ }
4709
+ }
4710
+
4711
+ // src/deep-merge.ts
4712
+ function deepMerge(source, ...objects) {
4713
+ for (const obj of objects) {
4714
+ const target = compact$1(obj);
4715
+ for (const key in target) {
4716
+ if (isObject(obj[key])) {
4717
+ if (!source[key]) {
4718
+ source[key] = {};
4719
+ }
4720
+ deepMerge(source[key], obj[key]);
4721
+ } else {
4722
+ source[key] = obj[key];
4723
+ }
4724
+ }
4725
+ }
4726
+ return source;
4727
+ }
4728
+ function structuredClone(v) {
4729
+ return klona(v);
4730
+ }
4731
+ function toEvent(event) {
4732
+ const obj = isString(event) ? { type: event } : event;
4733
+ return obj;
4734
+ }
4735
+ function toArray(value) {
4736
+ if (!value) return [];
4737
+ return isArray(value) ? value.slice() : [value];
4738
+ }
4739
+ function isGuardHelper(value) {
4740
+ return isObject(value) && value.predicate != null;
4741
+ }
4742
+
4743
+ // src/guard-utils.ts
4744
+ var Truthy = () => true;
4745
+ function determineGuardFn(guard, guardMap) {
4746
+ guard = guard ?? Truthy;
4747
+ return (context, event, meta) => {
4748
+ if (isString(guard)) {
4749
+ const value = guardMap[guard];
4750
+ return isFunction(value) ? value(context, event, meta) : value;
4751
+ }
4752
+ if (isGuardHelper(guard)) {
4753
+ return guard.predicate(guardMap)(context, event, meta);
4754
+ }
4755
+ return guard?.(context, event, meta);
4756
+ };
4757
+ }
4758
+ function determineActionsFn(values, guardMap) {
4759
+ return (context, event, meta) => {
4760
+ if (isGuardHelper(values)) {
4761
+ return values.predicate(guardMap)(context, event, meta);
4762
+ }
4763
+ return values;
4764
+ };
4765
+ }
4766
+ function createProxy(config) {
4767
+ const computedContext = config.computed ?? cast({});
4768
+ const initialContext = config.context ?? cast({});
4769
+ const initialTags = config.initial ? config.states?.[config.initial]?.tags : [];
4770
+ const state = proxy({
4771
+ value: config.initial ?? "",
4772
+ previousValue: "",
4773
+ event: cast({}),
4774
+ previousEvent: cast({}),
4775
+ context: proxyWithComputed(initialContext, computedContext),
4776
+ done: false,
4777
+ tags: initialTags ?? [],
4778
+ hasTag(tag) {
4779
+ return this.tags.includes(tag);
4780
+ },
4781
+ matches(...value) {
4782
+ return value.includes(this.value);
4783
+ },
4784
+ can(event) {
4785
+ return cast(this).nextEvents.includes(event);
4786
+ },
4787
+ get nextEvents() {
4788
+ const stateEvents = config.states?.[this.value]?.["on"] ?? {};
4789
+ const globalEvents = config?.on ?? {};
4790
+ return Object.keys({ ...stateEvents, ...globalEvents });
4791
+ },
4792
+ get changed() {
4793
+ if (this.event.value === "machine.init" /* Init */ || !this.previousValue) return false;
4794
+ return this.value !== this.previousValue;
4795
+ }
4796
+ });
4797
+ return cast(state);
4798
+ }
4799
+
4800
+ // src/delay-utils.ts
4801
+ function determineDelayFn(delay, delaysMap) {
4802
+ return (context, event) => {
4803
+ if (isNumber(delay)) return delay;
4804
+ if (isFunction(delay)) {
4805
+ return delay(context, event);
4806
+ }
4807
+ if (isString(delay)) {
4808
+ const value = Number.parseFloat(delay);
4809
+ if (!Number.isNaN(value)) {
4810
+ return value;
4811
+ }
4812
+ if (delaysMap) {
4813
+ const valueOrFn = delaysMap?.[delay];
4814
+ invariant(
4815
+ valueOrFn == null,
4816
+ `[@zag-js/core > determine-delay] Cannot determine delay for \`${delay}\`. It doesn't exist in \`options.delays\``
4817
+ );
4818
+ return isFunction(valueOrFn) ? valueOrFn(context, event) : valueOrFn;
4819
+ }
4820
+ }
4821
+ };
4822
+ }
4823
+
4824
+ // src/transition-utils.ts
4825
+ function toTarget(target) {
4826
+ return isString(target) ? { target } : target;
4827
+ }
4828
+ function determineTransitionFn(transitions, guardMap) {
4829
+ return (context, event, meta) => {
4830
+ return toArray(transitions).map(toTarget).find((transition) => {
4831
+ const determineGuard = determineGuardFn(transition.guard, guardMap);
4832
+ const guard = determineGuard(context, event, meta);
4833
+ return guard ?? transition.target ?? transition.actions;
4834
+ });
4835
+ };
4836
+ }
4837
+
4838
+ // src/machine.ts
4839
+ var Machine = class {
4840
+ // Let's get started!
4841
+ constructor(config, options) {
4842
+ __publicField(this, "status", "Not Started" /* NotStarted */);
4843
+ __publicField(this, "state");
4844
+ __publicField(this, "initialState");
4845
+ __publicField(this, "initialContext");
4846
+ __publicField(this, "id");
4847
+ __publicField(this, "type", "machine" /* Machine */);
4848
+ // Cleanup function map (per state)
4849
+ __publicField(this, "activityEvents", /* @__PURE__ */ new Map());
4850
+ __publicField(this, "delayedEvents", /* @__PURE__ */ new Map());
4851
+ // state update listeners the user can opt-in for
4852
+ __publicField(this, "stateListeners", /* @__PURE__ */ new Set());
4853
+ __publicField(this, "doneListeners", /* @__PURE__ */ new Set());
4854
+ __publicField(this, "contextWatchers", /* @__PURE__ */ new Set());
4855
+ // Cleanup functions (for `subscribe`)
4856
+ __publicField(this, "removeStateListener", noop);
4857
+ // For Parent <==> Spawned Actor relationship
4858
+ __publicField(this, "parent");
4859
+ __publicField(this, "children", /* @__PURE__ */ new Map());
4860
+ // A map of guard, action, delay implementations
4861
+ __publicField(this, "guardMap");
4862
+ __publicField(this, "actionMap");
4863
+ __publicField(this, "delayMap");
4864
+ __publicField(this, "activityMap");
4865
+ __publicField(this, "sync");
4866
+ __publicField(this, "options");
4867
+ __publicField(this, "config");
4868
+ __publicField(this, "_created", () => {
4869
+ const event = toEvent("machine.created" /* Created */);
4870
+ this.executeActions(this.config?.created, event);
4871
+ });
4872
+ // Starts the interpreted machine.
4873
+ __publicField(this, "start", (init) => {
4874
+ this.state.value = "";
4875
+ this.state.tags = [];
4876
+ if (this.status === "Running" /* Running */) {
4877
+ return this;
4878
+ }
4879
+ this.status = "Running" /* Running */;
4880
+ this.removeStateListener = subscribe(
4881
+ this.state,
4882
+ () => {
4883
+ this.stateListeners.forEach((listener) => {
4884
+ listener(this.stateSnapshot);
4885
+ });
4886
+ },
4887
+ this.sync
4888
+ );
4889
+ this.setupContextWatchers();
4890
+ this.executeActivities(toEvent("machine.start" /* Start */), toArray(this.config.activities), "machine.start" /* Start */);
4891
+ this.executeActions(this.config.entry, toEvent("machine.start" /* Start */));
4892
+ const event = toEvent("machine.init" /* Init */);
4893
+ const target = isObject(init) ? init.value : init;
4894
+ const context = isObject(init) ? init.context : void 0;
4895
+ if (context) {
4896
+ this.setContext(context);
4897
+ }
4898
+ const transition = {
4899
+ target: target ?? this.config.initial
4900
+ };
4901
+ const next = this.getNextStateInfo(transition, event);
4902
+ this.initialState = next;
4903
+ this.performStateChangeEffects(this.state.value, next, event);
4904
+ return this;
4905
+ });
4906
+ __publicField(this, "setupContextWatchers", () => {
4907
+ const { watch } = this.config;
4908
+ if (!watch) return;
4909
+ let prev = snapshot(this.state.context);
4910
+ const cleanup = subscribe(this.state.context, () => {
4911
+ const next = snapshot(this.state.context);
4912
+ for (const [key, fn] of Object.entries(watch)) {
4913
+ const isEqual = this.options.compareFns?.[key] ?? Object.is;
4914
+ if (isEqual(prev[key], next[key])) continue;
4915
+ this.executeActions(fn, this.state.event);
4916
+ }
4917
+ prev = next;
4918
+ });
4919
+ this.contextWatchers.add(cleanup);
4920
+ });
4921
+ // Stops the interpreted machine
4922
+ __publicField(this, "stop", () => {
4923
+ if (this.status === "Stopped" /* Stopped */) return;
4924
+ this.performExitEffects(this.state.value, toEvent("machine.stop" /* Stop */));
4925
+ this.executeActions(this.config.exit, toEvent("machine.stop" /* Stop */));
4926
+ this.setState("");
4927
+ this.setEvent("machine.stop" /* Stop */);
4928
+ this.stopStateListeners();
4929
+ this.stopChildren();
4930
+ this.stopActivities();
4931
+ this.stopDelayedEvents();
4932
+ this.stopContextWatchers();
4933
+ this.status = "Stopped" /* Stopped */;
4934
+ return this;
4935
+ });
4936
+ __publicField(this, "stopStateListeners", () => {
4937
+ this.removeStateListener();
4938
+ this.stateListeners.clear();
4939
+ });
4940
+ __publicField(this, "stopContextWatchers", () => {
4941
+ this.contextWatchers.forEach((fn) => fn());
4942
+ this.contextWatchers.clear();
4943
+ });
4944
+ __publicField(this, "stopDelayedEvents", () => {
4945
+ this.delayedEvents.forEach((state) => {
4946
+ state.forEach((stop) => stop());
4947
+ });
4948
+ this.delayedEvents.clear();
4949
+ });
4950
+ // Cleanup running activities (e.g `setInterval`, invoked callbacks, promises)
4951
+ __publicField(this, "stopActivities", (state) => {
4952
+ if (state) {
4953
+ this.activityEvents.get(state)?.forEach((stop) => stop());
4954
+ this.activityEvents.get(state)?.clear();
4955
+ this.activityEvents.delete(state);
4956
+ } else {
4957
+ this.activityEvents.forEach((state2) => {
4958
+ state2.forEach((stop) => stop());
4959
+ state2.clear();
4960
+ });
4961
+ this.activityEvents.clear();
4962
+ }
4963
+ });
4964
+ /**
4965
+ * Function to send event to spawned child machine or actor
4966
+ */
4967
+ __publicField(this, "sendChild", (evt, to) => {
4968
+ const event = toEvent(evt);
4969
+ const id = runIfFn(to, this.contextSnapshot);
4970
+ const child = this.children.get(id);
4971
+ if (!child) {
4972
+ invariant(`[@zag-js/core] Cannot send '${event.type}' event to unknown child`);
4973
+ }
4974
+ child.send(event);
4975
+ });
4976
+ /**
4977
+ * Function to stop a running child machine or actor
4978
+ */
4979
+ __publicField(this, "stopChild", (id) => {
4980
+ if (!this.children.has(id)) {
4981
+ invariant(`[@zag-js/core > stop-child] Cannot stop unknown child ${id}`);
4982
+ }
4983
+ this.children.get(id).stop();
4984
+ this.children.delete(id);
4985
+ });
4986
+ __publicField(this, "removeChild", (id) => {
4987
+ this.children.delete(id);
4988
+ });
4989
+ // Stop and delete spawned actors
4990
+ __publicField(this, "stopChildren", () => {
4991
+ this.children.forEach((child) => child.stop());
4992
+ this.children.clear();
4993
+ });
4994
+ __publicField(this, "setParent", (parent) => {
4995
+ this.parent = parent;
4996
+ });
4997
+ __publicField(this, "spawn", (src, id) => {
4998
+ const actor = runIfFn(src);
4999
+ if (id) actor.id = id;
5000
+ actor.type = "machine.actor" /* Actor */;
5001
+ actor.setParent(this);
5002
+ this.children.set(actor.id, cast(actor));
5003
+ actor.onDone(() => {
5004
+ this.removeChild(actor.id);
5005
+ }).start();
5006
+ return cast(ref(actor));
5007
+ });
5008
+ __publicField(this, "stopActivity", (key) => {
5009
+ if (!this.state.value) return;
5010
+ const cleanups = this.activityEvents.get(this.state.value);
5011
+ cleanups?.get(key)?.();
5012
+ cleanups?.delete(key);
5013
+ });
5014
+ __publicField(this, "addActivityCleanup", (state, key, cleanup) => {
5015
+ if (!state) return;
5016
+ if (!this.activityEvents.has(state)) {
5017
+ this.activityEvents.set(state, /* @__PURE__ */ new Map([[key, cleanup]]));
5018
+ } else {
5019
+ this.activityEvents.get(state)?.set(key, cleanup);
5020
+ }
5021
+ });
5022
+ __publicField(this, "setState", (target) => {
5023
+ this.state.previousValue = this.state.value;
5024
+ this.state.value = target;
5025
+ const stateNode = this.getStateNode(target);
5026
+ if (target == null) {
5027
+ clear(this.state.tags);
5028
+ } else {
5029
+ this.state.tags = toArray(stateNode?.tags);
5030
+ }
5031
+ });
5032
+ /**
5033
+ * To used within side effects for React or Vue to update context
5034
+ */
5035
+ __publicField(this, "setContext", (context) => {
5036
+ if (!context) return;
5037
+ deepMerge(this.state.context, compact$1(context));
5038
+ });
5039
+ __publicField(this, "setOptions", (options) => {
5040
+ const opts = compact$1(options);
5041
+ this.actionMap = { ...this.actionMap, ...opts.actions };
5042
+ this.delayMap = { ...this.delayMap, ...opts.delays };
5043
+ this.activityMap = { ...this.activityMap, ...opts.activities };
5044
+ this.guardMap = { ...this.guardMap, ...opts.guards };
5045
+ });
5046
+ __publicField(this, "getStateNode", (state) => {
5047
+ if (!state) return;
5048
+ return this.config.states?.[state];
5049
+ });
5050
+ __publicField(this, "getNextStateInfo", (transitions, event) => {
5051
+ const transition = this.determineTransition(transitions, event);
5052
+ const isTargetless = !transition?.target;
5053
+ const target = transition?.target ?? this.state.value;
5054
+ const changed = this.state.value !== target;
5055
+ const stateNode = this.getStateNode(target);
5056
+ const reenter = !isTargetless && !changed && !transition?.internal;
5057
+ const info = {
5058
+ reenter,
5059
+ transition,
5060
+ stateNode,
5061
+ target,
5062
+ changed
5063
+ };
5064
+ this.log("NextState:", `[${event.type}]`, this.state.value, "---->", info.target);
5065
+ return info;
5066
+ });
5067
+ __publicField(this, "getAfterActions", (transition, delay) => {
5068
+ let id;
5069
+ return {
5070
+ entry: () => {
5071
+ id = globalThis.setTimeout(() => {
5072
+ const next = this.getNextStateInfo(transition, this.state.event);
5073
+ this.performStateChangeEffects(this.state.value, next, this.state.event);
5074
+ }, delay);
5075
+ },
5076
+ exit: () => {
5077
+ globalThis.clearTimeout(id);
5078
+ }
5079
+ };
5080
+ });
5081
+ /**
5082
+ * All `after` events leverage `setTimeout` and `clearTimeout`,
5083
+ * we invoke the `clearTimeout` on exit and `setTimeout` on entry.
5084
+ *
5085
+ * To achieve this, we split the `after` defintion into `entry` and `exit`
5086
+ * functions and append them to the state's `entry` and `exit` actions
5087
+ */
5088
+ __publicField(this, "getDelayedEventActions", (state) => {
5089
+ const stateNode = this.getStateNode(state);
5090
+ const event = this.state.event;
5091
+ if (!stateNode || !stateNode.after) return;
5092
+ const entries = [];
5093
+ const exits = [];
5094
+ if (isArray(stateNode.after)) {
5095
+ const transition = this.determineTransition(stateNode.after, event);
5096
+ if (!transition) return;
5097
+ if (!hasProp(transition, "delay")) {
5098
+ throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(transition)}`);
5099
+ }
5100
+ const determineDelay = determineDelayFn(transition.delay, this.delayMap);
5101
+ const __delay = determineDelay(this.contextSnapshot, event);
5102
+ const actions = this.getAfterActions(transition, __delay);
5103
+ entries.push(actions.entry);
5104
+ exits.push(actions.exit);
5105
+ return { entries, exits };
5106
+ }
5107
+ if (isObject(stateNode.after)) {
5108
+ for (const delay in stateNode.after) {
5109
+ const transition = stateNode.after[delay];
5110
+ const determineDelay = determineDelayFn(delay, this.delayMap);
5111
+ const __delay = determineDelay(this.contextSnapshot, event);
5112
+ const actions = this.getAfterActions(transition, __delay);
5113
+ entries.push(actions.entry);
5114
+ exits.push(actions.exit);
5115
+ }
5116
+ }
5117
+ return { entries, exits };
5118
+ });
5119
+ /**
5120
+ * Function to executes defined actions. It can accept actions as string
5121
+ * (referencing `options.actions`) or actual functions.
5122
+ */
5123
+ __publicField(this, "executeActions", (actions, event) => {
5124
+ const pickedActions = determineActionsFn(actions, this.guardMap)(this.contextSnapshot, event, this.guardMeta);
5125
+ for (const action of toArray(pickedActions)) {
5126
+ const fn = isString(action) ? this.actionMap?.[action] : action;
5127
+ warn(
5128
+ isString(action) && !fn,
5129
+ `[@zag-js/core > execute-actions] No implementation found for action: \`${action}\``
5130
+ );
5131
+ fn?.(this.state.context, event, this.meta);
5132
+ }
5133
+ });
5134
+ /**
5135
+ * Function to execute running activities and registers
5136
+ * their cleanup function internally (to be called later on when we exit the state)
5137
+ */
5138
+ __publicField(this, "executeActivities", (event, activities, state) => {
5139
+ for (const activity of activities) {
5140
+ const fn = isString(activity) ? this.activityMap?.[activity] : activity;
5141
+ if (!fn) {
5142
+ warn(`[@zag-js/core > execute-activity] No implementation found for activity: \`${activity}\``);
5143
+ continue;
5144
+ }
5145
+ const cleanup = fn(this.state.context, event, this.meta);
5146
+ if (cleanup) {
5147
+ const key = isString(activity) ? activity : activity.name || uuid();
5148
+ this.addActivityCleanup(state ?? this.state.value, key, cleanup);
5149
+ }
5150
+ }
5151
+ });
5152
+ /**
5153
+ * Normalizes the `every` definition to transition. `every` can be:
5154
+ * - An array of possible actions to run (we need to pick the first match based on guard)
5155
+ * - An object of intervals and actions
5156
+ */
5157
+ __publicField(this, "createEveryActivities", (every, callbackfn) => {
5158
+ if (!every) return;
5159
+ if (isArray(every)) {
5160
+ const picked = toArray(every).find((transition) => {
5161
+ const delayOrFn = transition.delay;
5162
+ const determineDelay2 = determineDelayFn(delayOrFn, this.delayMap);
5163
+ const delay2 = determineDelay2(this.contextSnapshot, this.state.event);
5164
+ const determineGuard = determineGuardFn(transition.guard, this.guardMap);
5165
+ const guard = determineGuard(this.contextSnapshot, this.state.event, this.guardMeta);
5166
+ return guard ?? delay2 != null;
5167
+ });
5168
+ if (!picked) return;
5169
+ const determineDelay = determineDelayFn(picked.delay, this.delayMap);
5170
+ const delay = determineDelay(this.contextSnapshot, this.state.event);
5171
+ const activity = () => {
5172
+ const id = globalThis.setInterval(() => {
5173
+ this.executeActions(picked.actions, this.state.event);
5174
+ }, delay);
5175
+ return () => {
5176
+ globalThis.clearInterval(id);
5177
+ };
5178
+ };
5179
+ callbackfn(activity);
5180
+ } else {
5181
+ for (const interval in every) {
5182
+ const actions = every?.[interval];
5183
+ const determineDelay = determineDelayFn(interval, this.delayMap);
5184
+ const delay = determineDelay(this.contextSnapshot, this.state.event);
5185
+ const activity = () => {
5186
+ const id = globalThis.setInterval(() => {
5187
+ this.executeActions(actions, this.state.event);
5188
+ }, delay);
5189
+ return () => {
5190
+ globalThis.clearInterval(id);
5191
+ };
5192
+ };
5193
+ callbackfn(activity);
5194
+ }
5195
+ }
5196
+ });
5197
+ __publicField(this, "setEvent", (event) => {
5198
+ this.state.previousEvent = this.state.event;
5199
+ this.state.event = ref(toEvent(event));
5200
+ });
5201
+ __publicField(this, "performExitEffects", (current, event) => {
5202
+ const currentState = this.state.value;
5203
+ if (currentState === "") return;
5204
+ const stateNode = current ? this.getStateNode(current) : void 0;
5205
+ this.stopActivities(currentState);
5206
+ const _exit = determineActionsFn(stateNode?.exit, this.guardMap)(this.contextSnapshot, event, this.guardMeta);
5207
+ const exitActions = toArray(_exit);
5208
+ const afterExitActions = this.delayedEvents.get(currentState);
5209
+ if (afterExitActions) {
5210
+ exitActions.push(...afterExitActions);
5211
+ }
5212
+ this.executeActions(exitActions, event);
5213
+ });
5214
+ __publicField(this, "performEntryEffects", (next, event) => {
5215
+ const stateNode = this.getStateNode(next);
5216
+ const activities = toArray(stateNode?.activities);
5217
+ this.createEveryActivities(stateNode?.every, (activity) => {
5218
+ activities.unshift(activity);
5219
+ });
5220
+ if (activities.length > 0) {
5221
+ this.executeActivities(event, activities);
5222
+ }
5223
+ const pickedActions = determineActionsFn(stateNode?.entry, this.guardMap)(
5224
+ this.contextSnapshot,
5225
+ event,
5226
+ this.guardMeta
5227
+ );
5228
+ const entryActions = toArray(pickedActions);
5229
+ const afterActions = this.getDelayedEventActions(next);
5230
+ if (stateNode?.after && afterActions) {
5231
+ this.delayedEvents.set(next, afterActions?.exits);
5232
+ entryActions.push(...afterActions.entries);
5233
+ }
5234
+ this.executeActions(entryActions, event);
5235
+ if (stateNode?.type === "final") {
5236
+ this.state.done = true;
5237
+ this.doneListeners.forEach((listener) => {
5238
+ listener(this.stateSnapshot);
5239
+ });
5240
+ this.stop();
5241
+ }
5242
+ });
5243
+ __publicField(this, "performTransitionEffects", (transitions, event) => {
5244
+ const transition = this.determineTransition(transitions, event);
5245
+ this.executeActions(transition?.actions, event);
5246
+ });
5247
+ /**
5248
+ * Performs all the requires side-effects or reactions when
5249
+ * we move from state A => state B.
5250
+ *
5251
+ * The Effect order:
5252
+ * Exit actions (current state) => Transition actions => Go to state => Entry actions (next state)
5253
+ */
5254
+ __publicField(this, "performStateChangeEffects", (current, next, event) => {
5255
+ this.setEvent(event);
5256
+ const changed = next.changed || next.reenter;
5257
+ if (changed) {
5258
+ this.performExitEffects(current, event);
5259
+ }
5260
+ this.performTransitionEffects(next.transition, event);
5261
+ this.setState(next.target);
5262
+ if (changed) {
5263
+ this.performEntryEffects(next.target, event);
5264
+ }
5265
+ });
5266
+ __publicField(this, "determineTransition", (transition, event) => {
5267
+ const fn = determineTransitionFn(transition, this.guardMap);
5268
+ return fn?.(this.contextSnapshot, event, this.guardMeta);
5269
+ });
5270
+ /**
5271
+ * Function to send event to parent machine from spawned child
5272
+ */
5273
+ __publicField(this, "sendParent", (evt) => {
5274
+ if (!this.parent) {
5275
+ invariant("[@zag-js/core > send-parent] Cannot send event to an unknown parent");
5276
+ }
5277
+ const event = toEvent(evt);
5278
+ this.parent?.send(event);
5279
+ });
5280
+ __publicField(this, "log", (...args) => {
5281
+ if (isDev() && this.options.debug) {
5282
+ console.log(...args);
5283
+ }
5284
+ });
5285
+ /**
5286
+ * Function to send an event to current machine
5287
+ */
5288
+ __publicField(this, "send", (evt) => {
5289
+ const event = toEvent(evt);
5290
+ this.transition(this.state.value, event);
5291
+ });
5292
+ __publicField(this, "transition", (state, evt) => {
5293
+ const stateNode = isString(state) ? this.getStateNode(state) : state?.stateNode;
5294
+ const event = toEvent(evt);
5295
+ if (!stateNode && !this.config.on) {
5296
+ const msg = this.status === "Stopped" /* Stopped */ ? "[@zag-js/core > transition] Cannot transition a stopped machine" : `[@zag-js/core > transition] State does not have a definition for \`state\`: ${state}, \`event\`: ${event.type}`;
5297
+ warn(msg);
5298
+ return;
5299
+ }
5300
+ const transitions = stateNode?.on?.[event.type] ?? this.config.on?.[event.type];
5301
+ const next = this.getNextStateInfo(transitions, event);
5302
+ this.performStateChangeEffects(this.state.value, next, event);
5303
+ return next.stateNode;
5304
+ });
5305
+ __publicField(this, "subscribe", (listener) => {
5306
+ this.stateListeners.add(listener);
5307
+ if (this.status === "Running" /* Running */) {
5308
+ listener(this.stateSnapshot);
5309
+ }
5310
+ return () => {
5311
+ this.stateListeners.delete(listener);
5312
+ };
5313
+ });
5314
+ __publicField(this, "onDone", (listener) => {
5315
+ this.doneListeners.add(listener);
5316
+ return this;
5317
+ });
5318
+ __publicField(this, "onTransition", (listener) => {
5319
+ this.stateListeners.add(listener);
5320
+ if (this.status === "Running" /* Running */) {
5321
+ listener(this.stateSnapshot);
5322
+ }
5323
+ return this;
5324
+ });
5325
+ this.config = structuredClone(config);
5326
+ this.options = structuredClone(options ?? {});
5327
+ this.id = this.config.id ?? `machine-${uuid()}`;
5328
+ this.guardMap = this.options?.guards ?? {};
5329
+ this.actionMap = this.options?.actions ?? {};
5330
+ this.delayMap = this.options?.delays ?? {};
5331
+ this.activityMap = this.options?.activities ?? {};
5332
+ this.sync = this.options?.sync ?? false;
5333
+ this.state = createProxy(this.config);
5334
+ this.initialContext = snapshot(this.state.context);
5335
+ }
5336
+ // immutable state value
5337
+ get stateSnapshot() {
5338
+ return cast(snapshot(this.state));
5339
+ }
5340
+ getState() {
5341
+ return this.stateSnapshot;
5342
+ }
5343
+ // immutable context value
5344
+ get contextSnapshot() {
5345
+ return this.stateSnapshot.context;
5346
+ }
5347
+ /**
5348
+ * A reference to the instance methods of the machine.
5349
+ * Useful when spawning child machines and managing the communication between them.
5350
+ */
5351
+ get self() {
5352
+ const self = this;
5353
+ return {
5354
+ id: this.id,
5355
+ send: this.send.bind(this),
5356
+ sendParent: this.sendParent.bind(this),
5357
+ sendChild: this.sendChild.bind(this),
5358
+ stop: this.stop.bind(this),
5359
+ stopChild: this.stopChild.bind(this),
5360
+ spawn: this.spawn.bind(this),
5361
+ stopActivity: this.stopActivity.bind(this),
5362
+ get state() {
5363
+ return self.stateSnapshot;
5364
+ },
5365
+ get initialContext() {
5366
+ return self.initialContext;
5367
+ },
5368
+ get initialState() {
5369
+ return self.initialState?.target ?? "";
5370
+ }
5371
+ };
5372
+ }
5373
+ get meta() {
5374
+ return {
5375
+ state: this.stateSnapshot,
5376
+ guards: this.guardMap,
5377
+ send: this.send.bind(this),
5378
+ self: this.self,
5379
+ initialContext: this.initialContext,
5380
+ initialState: this.initialState?.target ?? "",
5381
+ getState: () => this.stateSnapshot,
5382
+ getAction: (key) => this.actionMap[key],
5383
+ getGuard: (key) => this.guardMap[key]
5384
+ };
5385
+ }
5386
+ get guardMeta() {
5387
+ return {
5388
+ state: this.stateSnapshot
5389
+ };
5390
+ }
5391
+ get [Symbol.toStringTag]() {
5392
+ return "Machine";
5393
+ }
5394
+ };
5395
+ var createMachine = (config, options) => new Machine(config, options);
5396
+
5397
+ // src/array.ts
5398
+
5399
+ // src/object.ts
5400
+ function compact(obj) {
5401
+ if (!isPlainObject(obj) || obj === void 0) {
5402
+ return obj;
5403
+ }
5404
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
5405
+ const filtered = {};
5406
+ for (const key of keys) {
5407
+ const value = obj[key];
5408
+ if (value !== void 0) {
5409
+ filtered[key] = compact(value);
5410
+ }
5411
+ }
5412
+ return filtered;
5413
+ }
5414
+ var isPlainObject = (value) => {
5415
+ return value && typeof value === "object" && value.constructor === Object;
5416
+ };
5417
+
5418
+ function $(e,t,u,x=h=>h){return e*x(.5-t*(.5-u))}function se(e){return [-e[0],-e[1]]}function l(e,t){return [e[0]+t[0],e[1]+t[1]]}function a(e,t){return [e[0]-t[0],e[1]-t[1]]}function b(e,t){return [e[0]*t,e[1]*t]}function he(e,t){return [e[0]/t,e[1]/t]}function R(e){return [e[1],-e[0]]}function B(e,t){return e[0]*t[0]+e[1]*t[1]}function ue(e,t){return e[0]===t[0]&&e[1]===t[1]}function ge(e){return Math.hypot(e[0],e[1])}function de(e){return e[0]*e[0]+e[1]*e[1]}function A(e,t){return de(a(e,t))}function G(e){return he(e,ge(e))}function ie(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function L(e,t,u){let x=Math.sin(u),h=Math.cos(u),y=e[0]-t[0],n=e[1]-t[1],f=y*h-n*x,d=y*x+n*h;return [f+t[0],d+t[1]]}function K(e,t,u){return l(e,b(a(t,e),u))}function ee(e,t,u){return l(e,b(t,u))}var{min:C,PI:xe}=Math,pe=.275,V=xe+1e-4;function ce(e,t={}){let{size:u=16,smoothing:x=.5,thinning:h=.5,simulatePressure:y=!0,easing:n=r=>r,start:f={},end:d={},last:D=!1}=t,{cap:S=!0,easing:j=r=>r*(2-r)}=f,{cap:q=!0,easing:c=r=>--r*r*r+1}=d;if(e.length===0||u<=0)return [];let p=e[e.length-1].runningLength,g=f.taper===!1?0:f.taper===!0?Math.max(u,p):f.taper,T=d.taper===!1?0:d.taper===!0?Math.max(u,p):d.taper,te=Math.pow(u*x,2),_=[],M=[],H=e.slice(0,10).reduce((r,i)=>{let o=i.pressure;if(y){let s=C(1,i.distance/u),W=C(1,1-s);o=C(1,r+(W-r)*(s*pe));}return (r+o)/2},e[0].pressure),m=$(u,h,e[e.length-1].pressure,n),U,X=e[0].vector,z=e[0].point,F=z,O=z,E=F,J=!1;for(let r=0;r<e.length;r++){let{pressure:i}=e[r],{point:o,vector:s,distance:W,runningLength:I}=e[r];if(r<e.length-1&&p-I<3)continue;if(h){if(y){let v=C(1,W/u),Z=C(1,1-v);i=C(1,H+(Z-H)*(v*pe));}m=$(u,h,i,n);}else m=u/2;U===void 0&&(U=m);let le=I<g?j(I/g):1,fe=p-I<T?c((p-I)/T):1;m=Math.max(.01,m*Math.min(le,fe));let re=(r<e.length-1?e[r+1]:e[r]).vector,Y=r<e.length-1?B(s,re):1,be=B(s,X)<0&&!J,ne=Y!==null&&Y<0;if(be||ne){let v=b(R(X),m);for(let Z=1/13,w=0;w<=1;w+=Z)O=L(a(o,v),o,V*w),_.push(O),E=L(l(o,v),o,V*-w),M.push(E);z=O,F=E,ne&&(J=!0);continue}if(J=!1,r===e.length-1){let v=b(R(s),m);_.push(a(o,v)),M.push(l(o,v));continue}let oe=b(R(K(re,s,Y)),m);O=a(o,oe),(r<=1||A(z,O)>te)&&(_.push(O),z=O),E=l(o,oe),(r<=1||A(F,E)>te)&&(M.push(E),F=E),H=i,X=s;}let P=e[0].point.slice(0,2),k=e.length>1?e[e.length-1].point.slice(0,2):l(e[0].point,[1,1]),Q=[],N=[];if(e.length===1){if(!(g||T)||D){let r=ee(P,G(R(a(P,k))),-(U||m)),i=[];for(let o=1/13,s=o;s<=1;s+=o)i.push(L(r,P,V*2*s));return i}}else {if(!(g||T&&e.length===1))if(S)for(let i=1/13,o=i;o<=1;o+=i){let s=L(M[0],P,V*o);Q.push(s);}else {let i=a(_[0],M[0]),o=b(i,.5),s=b(i,.51);Q.push(a(P,o),a(P,s),l(P,s),l(P,o));}let r=R(se(e[e.length-1].vector));if(T||g&&e.length===1)N.push(k);else if(q){let i=ee(k,r,m);for(let o=1/29,s=o;s<1;s+=o)N.push(L(i,k,V*3*s));}else N.push(l(k,b(r,m)),l(k,b(r,m*.99)),a(k,b(r,m*.99)),a(k,b(r,m)));}return _.concat(N,M.reverse(),Q)}function me(e,t={}){var q;let{streamline:u=.5,size:x=16,last:h=!1}=t;if(e.length===0)return [];let y=.15+(1-u)*.85,n=Array.isArray(e[0])?e:e.map(({x:c,y:p,pressure:g=.5})=>[c,p,g]);if(n.length===2){let c=n[1];n=n.slice(0,-1);for(let p=1;p<5;p++)n.push(K(n[0],c,p/4));}n.length===1&&(n=[...n,[...l(n[0],[1,1]),...n[0].slice(2)]]);let f=[{point:[n[0][0],n[0][1]],pressure:n[0][2]>=0?n[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],d=!1,D=0,S=f[0],j=n.length-1;for(let c=1;c<n.length;c++){let p=h&&c===j?n[c].slice(0,2):K(S.point,n[c],y);if(ue(S.point,p))continue;let g=ie(p,S.point);if(D+=g,c<j&&!d){if(D<x)continue;d=!0;}S={point:p,pressure:n[c][2]>=0?n[c][2]:.5,vector:G(a(S.point,p)),distance:g,runningLength:D},f.push(S);}return f[0].vector=((q=f[1])==null?void 0:q.vector)||[0,0],f}function ae(e,t={}){return ce(me(e,t),t)}var _e=ae;
5419
+
5420
+ // src/signature-pad.anatomy.ts
5421
+ var anatomy = createAnatomy("signature-pad").parts(
5422
+ "root",
5423
+ "control",
5424
+ "segment",
5425
+ "segmentPath",
5426
+ "guide",
5427
+ "clearTrigger",
5428
+ "label"
5429
+ );
5430
+ var parts = anatomy.build();
5431
+ var dom = createScope({
5432
+ getRootId: (ctx) => ctx.ids?.root ?? `signature-${ctx.id}`,
5433
+ getControlId: (ctx) => ctx.ids?.control ?? `signature-control-${ctx.id}`,
5434
+ getHiddenInputId: (ctx) => ctx.ids?.hiddenInput ?? `signature-input-${ctx.id}`,
5435
+ getControlEl: (ctx) => dom.getById(ctx, dom.getControlId(ctx)),
5436
+ getSegmentEl: (ctx) => query(dom.getControlEl(ctx), "[data-part=segment]"),
5437
+ getHiddenInputEl: (ctx) => dom.getById(ctx, dom.getHiddenInputId(ctx)),
5438
+ getDataUrl: (ctx, options) => {
5439
+ if (ctx.isEmpty) return Promise.resolve("");
5440
+ return getDataUrl(dom.getSegmentEl(ctx), options);
5441
+ }
5442
+ });
5443
+
5444
+ // src/signature-pad.connect.ts
5445
+ function connect(state, send, normalize) {
5446
+ const drawing = state.matches("drawing");
5447
+ const empty = state.context.isEmpty;
5448
+ const interactive = state.context.isInteractive;
5449
+ const disabled = !!state.context.disabled;
5450
+ return {
5451
+ empty,
5452
+ drawing,
5453
+ currentPath: state.context.currentPath,
5454
+ paths: state.context.paths,
5455
+ clear() {
5456
+ send({ type: "CLEAR" });
5457
+ },
5458
+ getDataUrl(type, quality) {
5459
+ return dom.getDataUrl(state.context, { type, quality });
5460
+ },
5461
+ getLabelProps() {
5462
+ return normalize.element({
5463
+ ...parts.label.attrs,
5464
+ "data-disabled": dataAttr(disabled),
5465
+ htmlFor: dom.getControlId(state.context)
5466
+ });
5467
+ },
5468
+ getRootProps() {
5469
+ return normalize.element({
5470
+ ...parts.root.attrs,
5471
+ "data-disabled": dataAttr(disabled),
5472
+ id: dom.getRootId(state.context)
5473
+ });
5474
+ },
5475
+ getControlProps() {
5476
+ return normalize.element({
5477
+ ...parts.control.attrs,
5478
+ tabIndex: disabled ? void 0 : 0,
5479
+ id: dom.getControlId(state.context),
5480
+ "aria-label": "Signature Pad",
5481
+ "aria-roledescription": "signature pad",
5482
+ "aria-disabled": disabled,
5483
+ "data-disabled": dataAttr(disabled),
5484
+ onPointerDown(event) {
5485
+ if (!isLeftClick(event)) return;
5486
+ if (isModifierKey(event)) return;
5487
+ if (!interactive) return;
5488
+ const target = getEventTarget(event);
5489
+ if (target?.closest("[data-part=clear-trigger]")) return;
5490
+ event.currentTarget.setPointerCapture(event.pointerId);
5491
+ const point = { x: event.clientX, y: event.clientY };
5492
+ const { offset } = getRelativePoint(point, dom.getControlEl(state.context));
5493
+ send({ type: "POINTER_DOWN", point: offset, pressure: event.pressure });
5494
+ },
5495
+ onPointerUp(event) {
5496
+ if (!interactive) return;
5497
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {
5498
+ event.currentTarget.releasePointerCapture(event.pointerId);
5499
+ }
5500
+ },
5501
+ style: {
5502
+ position: "relative",
5503
+ touchAction: "none",
5504
+ userSelect: "none"
5505
+ }
5506
+ });
5507
+ },
5508
+ getSegmentProps() {
5509
+ return normalize.svg({
5510
+ ...parts.segment.attrs,
5511
+ style: {
5512
+ position: "absolute",
5513
+ top: 0,
5514
+ left: 0,
5515
+ width: "100%",
5516
+ height: "100%",
5517
+ pointerEvents: "none",
5518
+ fill: state.context.drawing.fill
5519
+ }
5520
+ });
5521
+ },
5522
+ getSegmentPathProps(props2) {
5523
+ return normalize.path({
5524
+ ...parts.segmentPath.attrs,
5525
+ d: props2.path
5526
+ });
5527
+ },
5528
+ getGuideProps() {
5529
+ return normalize.element({
5530
+ ...parts.guide.attrs,
5531
+ "data-disabled": dataAttr(disabled)
5532
+ });
5533
+ },
5534
+ getClearTriggerProps() {
5535
+ return normalize.button({
5536
+ ...parts.clearTrigger.attrs,
5537
+ type: "button",
5538
+ "aria-label": "Clear Signature",
5539
+ hidden: !state.context.paths.length || drawing,
5540
+ disabled,
5541
+ onClick() {
5542
+ send({ type: "CLEAR" });
5543
+ }
5544
+ });
5545
+ },
5546
+ getHiddenInputProps(props2) {
5547
+ return normalize.input({
5548
+ type: "text",
5549
+ hidden: true,
5550
+ disabled,
5551
+ name: state.context.name,
5552
+ value: props2.value
5553
+ });
5554
+ }
5555
+ };
5556
+ }
5557
+
5558
+ // src/get-svg-path.ts
5559
+ var average = (a, b) => (a + b) / 2;
5560
+ function getSvgPathFromStroke(points, closed = true) {
5561
+ const len = points.length;
5562
+ if (len < 4) {
5563
+ return "";
5564
+ }
5565
+ let a = points[0];
5566
+ let b = points[1];
5567
+ const c = points[2];
5568
+ let result = `M${a[0].toFixed(2)},${a[1].toFixed(2)} Q${b[0].toFixed(2)},${b[1].toFixed(2)} ${average(b[0], c[0]).toFixed(2)},${average(
5569
+ b[1],
5570
+ c[1]
5571
+ ).toFixed(2)} T`;
5572
+ for (let i = 2, max = len - 1; i < max; i++) {
5573
+ a = points[i];
5574
+ b = points[i + 1];
5575
+ result += `${average(a[0], b[0]).toFixed(2)},${average(a[1], b[1]).toFixed(2)} `;
5576
+ }
5577
+ if (closed) {
5578
+ result += "Z";
5579
+ }
5580
+ return result;
5581
+ }
5582
+
5583
+ // src/signature-pad.machine.ts
5584
+ function machine(userContext) {
5585
+ const ctx = compact(userContext);
5586
+ return createMachine(
5587
+ {
5588
+ id: "signature-pad",
5589
+ initial: "idle",
5590
+ context: {
5591
+ readOnly: false,
5592
+ disabled: false,
5593
+ ...ctx,
5594
+ paths: [],
5595
+ currentPoints: [],
5596
+ currentPath: null,
5597
+ drawing: {
5598
+ size: 2,
5599
+ simulatePressure: false,
5600
+ thinning: 0.7,
5601
+ smoothing: 0.4,
5602
+ streamline: 0.6,
5603
+ ...ctx.drawing
5604
+ }
5605
+ },
5606
+ computed: {
5607
+ isInteractive: (ctx2) => !(ctx2.disabled || ctx2.readOnly),
5608
+ isEmpty: (ctx2) => ctx2.paths.length === 0
5609
+ },
5610
+ on: {
5611
+ CLEAR: {
5612
+ actions: ["clearPoints", "invokeOnDrawEnd", "focusCanvasEl"]
5613
+ }
5614
+ },
5615
+ states: {
5616
+ idle: {
5617
+ on: {
5618
+ POINTER_DOWN: {
5619
+ target: "drawing",
5620
+ actions: ["addPoint"]
5621
+ }
5622
+ }
5623
+ },
5624
+ drawing: {
5625
+ activities: ["trackPointerMove"],
5626
+ on: {
5627
+ POINTER_MOVE: {
5628
+ actions: ["addPoint", "invokeOnDraw"]
5629
+ },
5630
+ POINTER_UP: {
5631
+ target: "idle",
5632
+ actions: ["endStroke", "invokeOnDrawEnd"]
5633
+ }
5634
+ }
5635
+ }
5636
+ }
5637
+ },
5638
+ {
5639
+ activities: {
5640
+ trackPointerMove(ctx2, _evt, { send }) {
5641
+ const doc = dom.getDoc(ctx2);
5642
+ return trackPointerMove(doc, {
5643
+ onPointerMove({ event, point }) {
5644
+ const { offset } = getRelativePoint(point, dom.getControlEl(ctx2));
5645
+ send({ type: "POINTER_MOVE", point: offset, pressure: event.pressure });
5646
+ },
5647
+ onPointerUp() {
5648
+ send({ type: "POINTER_UP" });
5649
+ }
5650
+ });
5651
+ }
5652
+ },
5653
+ actions: {
5654
+ addPoint(ctx2, evt) {
5655
+ ctx2.currentPoints.push(evt.point);
5656
+ const stroke = _e(ctx2.currentPoints, ctx2.drawing);
5657
+ ctx2.currentPath = getSvgPathFromStroke(stroke);
5658
+ },
5659
+ endStroke(ctx2) {
5660
+ ctx2.paths.push(ctx2.currentPath);
5661
+ ctx2.currentPoints = [];
5662
+ ctx2.currentPath = null;
5663
+ },
5664
+ clearPoints(ctx2) {
5665
+ ctx2.currentPoints = [];
5666
+ ctx2.paths = [];
5667
+ },
5668
+ focusCanvasEl(ctx2) {
5669
+ queueMicrotask(() => {
5670
+ dom.getControlEl(ctx2)?.focus({ preventScroll: true });
5671
+ });
5672
+ },
5673
+ invokeOnDraw(ctx2) {
5674
+ ctx2.onDraw?.({
5675
+ paths: [...ctx2.paths, ctx2.currentPath]
5676
+ });
5677
+ },
5678
+ invokeOnDrawEnd(ctx2) {
5679
+ ctx2.onDrawEnd?.({
5680
+ paths: [...ctx2.paths],
5681
+ getDataUrl(type, quality = 0.92) {
5682
+ return dom.getDataUrl(ctx2, { type, quality });
5683
+ }
5684
+ });
5685
+ }
5686
+ }
5687
+ }
5688
+ );
5689
+ }
5690
+ createProps()([
5691
+ "dir",
5692
+ "disabled",
5693
+ "getRootNode",
5694
+ "id",
5695
+ "ids",
5696
+ "onDraw",
5697
+ "onDrawEnd",
5698
+ "readOnly",
5699
+ "drawing",
5700
+ "name"
5701
+ ]);
5702
+
5703
+ const useSignaturePad = props => {
5704
+ const locale = useLocaleContext();
5705
+ const environment = useEnvironmentContext();
5706
+ const id = createUniqueId();
5707
+ const context = createMemo(() => ({
5708
+ id,
5709
+ dir: locale().dir,
5710
+ getRootNode: environment().getRootNode,
5711
+ ...props
5712
+ }));
5713
+ const [state, send] = useMachine(machine(context()), {
5714
+ context
5715
+ });
5716
+ return createMemo(() => connect(state, send, normalizeProps));
5717
+ };
5718
+
5719
+ const SignaturePadRoot = props => {
5720
+ const [useSignaturePadProps, localProps] = createSplitProps()(props, ['id', 'ids', 'drawing', 'disabled', 'readOnly', 'name', 'onDraw', 'onDrawEnd']);
5721
+ const signaturePad = useSignaturePad(useSignaturePadProps);
5722
+ const mergedProps = mergeProps$1(() => signaturePad().getRootProps(), localProps);
5723
+ return createComponent(SignaturePadProvider, {
5724
+ value: signaturePad,
5725
+ get children() {
5726
+ return createComponent(ark.div, mergedProps);
5727
+ }
5728
+ });
5729
+ };
5730
+
5731
+ const SignaturePadRootProvider = props => {
5732
+ const [{
5733
+ value: signaturePad
5734
+ }, localProps] = createSplitProps()(props, ['value']);
5735
+ const mergedProps = mergeProps$1(() => signaturePad().getRootProps(), localProps);
5736
+ return createComponent(SignaturePadProvider, {
5737
+ value: signaturePad,
5738
+ get children() {
5739
+ return createComponent(ark.div, mergedProps);
5740
+ }
5741
+ });
5742
+ };
5743
+
5744
+ var _tmpl$$1 = /*#__PURE__*/template(`<title>Signature`),
5745
+ _tmpl$2 = /*#__PURE__*/template(`<svg><path></svg>`, false, true);
5746
+ const SignaturePadSegment = props => {
5747
+ const signaturePad = useSignaturePadContext();
5748
+ const mergedProps = mergeProps$1(() => signaturePad().getSegmentProps(), props);
5749
+ return createComponent(ark.svg, mergeProps(mergedProps, {
5750
+ get children() {
5751
+ return [_tmpl$$1(), createComponent(For, {
5752
+ get each() {
5753
+ return signaturePad().paths;
5754
+ },
5755
+ children: path => (() => {
5756
+ var _el$3 = _tmpl$2();
5757
+ spread(_el$3, mergeProps(() => signaturePad().getSegmentPathProps({
5758
+ path
5759
+ })), true, false);
5760
+ return _el$3;
5761
+ })()
5762
+ }), createComponent(Show, {
5763
+ get when() {
5764
+ return signaturePad().currentPath;
5765
+ },
5766
+ get children() {
5767
+ var _el$2 = _tmpl$2();
5768
+ spread(_el$2, mergeProps(() => signaturePad().getSegmentPathProps({
5769
+ path: signaturePad().currentPath
5770
+ })), true, false);
5771
+ return _el$2;
5772
+ }
5773
+ })];
5774
+ }
5775
+ }));
5776
+ };
5777
+
5778
+ var signaturePad = /*#__PURE__*/Object.freeze({
5779
+ __proto__: null,
5780
+ ClearTrigger: SignaturePadClearTrigger,
5781
+ Context: SignaturePadContext,
5782
+ Control: SignaturePadControl,
5783
+ Guide: SignaturePadGuide,
5784
+ Label: SignaturePadLabel,
5785
+ Root: SignaturePadRoot,
5786
+ RootProvider: SignaturePadRootProvider,
5787
+ Segment: SignaturePadSegment
5788
+ });
5789
+
3845
5790
  const [SliderProvider, useSliderContext] = createContext({
3846
5791
  hookName: 'useSliderContext',
3847
5792
  providerName: '<SliderProvider />'
@@ -4144,7 +6089,8 @@ const TabContent = props => {
4144
6089
  const api = useTabsContext();
4145
6090
  const renderStrategyProps = useRenderStrategyContext();
4146
6091
  const presenceApi = usePresence(mergeProps$1(renderStrategyProps, () => ({
4147
- present: api().value === contentProps.value
6092
+ present: api().value === contentProps.value,
6093
+ immediate: true
4148
6094
  })));
4149
6095
  const mergedProps = mergeProps$1(() => api().getContentProps(contentProps), () => presenceApi().presenceProps, localProps);
4150
6096
  return createComponent(PresenceProvider, {
@@ -4443,11 +6389,12 @@ const ToastDescription = props => {
4443
6389
  var _tmpl$ = /*#__PURE__*/template(`<div><div></div><div>`);
4444
6390
  const ToastRoot = props => {
4445
6391
  const toast = useToastContext();
6392
+ const mergedProps = mergeProps$1(() => toast().getRootProps(), props);
4446
6393
  return (() => {
4447
6394
  var _el$ = _tmpl$(),
4448
6395
  _el$2 = _el$.firstChild,
4449
6396
  _el$3 = _el$2.nextSibling;
4450
- spread(_el$, mergeProps(() => toast().getRootProps()), false, true);
6397
+ spread(_el$, mergedProps, false, true);
4451
6398
  spread(_el$2, mergeProps(() => toast().getGhostBeforeProps()), false, false);
4452
6399
  insert(_el$, () => props.children, _el$3);
4453
6400
  spread(_el$3, mergeProps(() => toast().getGhostAfterProps()), false, false);
@@ -4892,5 +6839,5 @@ var treeView = /*#__PURE__*/Object.freeze({
4892
6839
  Tree: TreeViewTree
4893
6840
  });
4894
6841
 
4895
- export { accordion as Accordion, AccordionContext, AccordionItem, AccordionItemContent, AccordionItemContext, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot, AccordionRootProvider, avatar as Avatar, AvatarContext, AvatarFallback, AvatarImage, AvatarRoot, AvatarRootProvider, carousel as Carousel, CarouselContext, CarouselControl, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup, CarouselNextTrigger, CarouselPrevTrigger, CarouselRoot, CarouselRootProvider, CarouselViewport, checkbox as Checkbox, CheckboxContext, CheckboxControl, CheckboxHiddenInput, CheckboxIndicator, CheckboxLabel, CheckboxRoot, CheckboxRootProvider, clipboard as Clipboard, ClipboardContext, ClipboardControl, ClipboardIndicator, ClipboardInput, ClipboardLabel, ClipboardRoot, ClipboardRootProvider, ClipboardTrigger, collapsible as Collapsible, CollapsibleContent, CollapsibleContext, CollapsibleRoot, CollapsibleRootProvider, CollapsibleTrigger, colorPicker as ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerContext, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerFormatSelect, ColorPickerFormatTrigger, ColorPickerHiddenInput, ColorPickerLabel, ColorPickerPositioner, ColorPickerRoot, ColorPickerRootProvider, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchIndicator, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, ColorPickerView, combobox as Combobox, ComboboxClearTrigger, ComboboxContent, ComboboxContext, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxItemContext, ComboboxItemGroup, ComboboxItemGroupLabel, ComboboxItemIndicator, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxPositioner, ComboboxRoot, ComboboxRootProvider, ComboboxTrigger, datePicker as DatePicker, DatePickerClearTrigger, DatePickerContent, DatePickerContext, DatePickerControl, DatePickerInput, DatePickerLabel, DatePickerMonthSelect, DatePickerNextTrigger, DatePickerPositioner, DatePickerPresetTrigger, DatePickerPrevTrigger, DatePickerRangeText, DatePickerRoot, DatePickerRootProvider, DatePickerTable, DatePickerTableBody, DatePickerTableCell, DatePickerTableCellTrigger, DatePickerTableHead, DatePickerTableHeader, DatePickerTableRow, DatePickerTrigger, DatePickerView, DatePickerViewControl, DatePickerViewTrigger, DatePickerYearSelect, dialog as Dialog, DialogBackdrop, DialogCloseTrigger, DialogContent, DialogContext, DialogDescription, DialogPositioner, DialogRoot, DialogRootProvider, DialogTitle, DialogTrigger, editable as Editable, EditableArea, EditableCancelTrigger, EditableContext, EditableControl, EditableEditTrigger, EditableInput, EditableLabel, EditablePreview, EditableRoot, EditableRootProvider, EditableSubmitTrigger, EnvironmentProvider, fileUpload as FileUpload, FileUploadContext, FileUploadDropzone, FileUploadHiddenInput, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName, FileUploadItemPreview, FileUploadItemPreviewImage, FileUploadItemSizeText, FileUploadLabel, FileUploadRoot, FileUploadRootProvider, FileUploadTrigger, format as Format, FormatByte, FormatNumber, hoverCard as HoverCard, HoverCardArrow, HoverCardArrowTip, HoverCardContent, HoverCardContext, HoverCardPositioner, HoverCardRoot, HoverCardRootProvider, HoverCardTrigger, LocaleProvider, menu as Menu, MenuArrow, MenuArrowTip, MenuCheckboxItem, MenuContent, MenuContext, MenuContextTrigger, MenuIndicator, MenuItem, MenuItemContext, MenuItemGroup, MenuItemGroupLabel, MenuItemIndicator, MenuItemText, MenuPositioner, MenuRadioItem, MenuRadioItemGroup, MenuRoot, MenuRootProvider, MenuSeparator, MenuTrigger, MenuTriggerItem, numberInput as NumberInput, NumberInputContext, NumberInputControl, NumberInputDecrementTrigger, NumberInputIncrementTrigger, NumberInputInput, NumberInputLabel, NumberInputRoot, NumberInputRootProvider, NumberInputScrubber, pagination as Pagination, PaginationContext, PaginationEllipsis, PaginationItem, PaginationNextTrigger, PaginationPrevTrigger, PaginationRoot, PaginationRootProvider, pinInput as PinInput, PinInputContext, PinInputControl, PinInputHiddenInput, PinInputInput, PinInputLabel, PinInputRoot, PinInputRootProvider, popover as Popover, PopoverAnchor, PopoverArrow, PopoverArrowTip, PopoverCloseTrigger, PopoverContent, PopoverContext, PopoverDescription, PopoverIndicator, PopoverPositioner, PopoverRoot, PopoverRootProvider, PopoverTitle, PopoverTrigger, Presence, PresenceProvider, progress as Progress, ProgressCircle, ProgressCircleRange, ProgressCircleTrack, ProgressContext, ProgressLabel, ProgressRange, ProgressRoot, ProgressRootProvider, ProgressTrack, ProgressValueText, ProgressView, radioGroup as RadioGroup, RadioGroupContext, RadioGroupIndicator, RadioGroupItem, RadioGroupItemContext, RadioGroupItemControl, RadioGroupItemHiddenInput, RadioGroupItemText, RadioGroupLabel, RadioGroupRoot, RadioGroupRootProvider, ratingGroup as RatingGroup, RatingGroupContext, RatingGroupControl, RatingGroupHiddenInput, RatingGroupItem, RatingGroupItemContext, RatingGroupLabel, RatingGroupRoot, RatingGroupRootProvider, segmentGroup as SegmentGroup, SegmentGroupContext, SegmentGroupIndicator, SegmentGroupItem, SegmentGroupItemContext, SegmentGroupItemControl, SegmentGroupItemHiddenInput, SegmentGroupItemText, SegmentGroupLabel, SegmentGroupRoot, SegmentGroupRootProvider, select as Select, SelectClearTrigger, SelectContent, SelectContext, SelectControl, SelectHiddenSelect, SelectIndicator, SelectItem, SelectItemContext, SelectItemGroup, SelectItemGroupLabel, SelectItemIndicator, SelectItemText, SelectLabel, SelectPositioner, SelectRoot, SelectRootProvider, SelectTrigger, SelectValueText, slider as Slider, SliderContext, SliderControl, SliderHiddenInput, SliderLabel, SliderMarker, SliderMarkerGroup, SliderRange, SliderRoot, SliderRootProvider, SliderThumb, SliderTrack, SliderValueText, splitter as Splitter, SplitterContext, SplitterPanel, SplitterResizeTrigger, SplitterRoot, SplitterRootProvider, _switch as Switch, SwitchContext, SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchRootProvider, SwitchThumb, TabContent, TabIndicator, TabList, TabTrigger, tabs as Tabs, TabsContext, TabsRoot, TabsRootProvider, tagsInput as TagsInput, TagsInputClearTrigger, TagsInputContext, TagsInputControl, TagsInputHiddenInput, TagsInputInput, TagsInputItem, TagsInputItemContext, TagsInputItemDeleteTrigger, TagsInputItemInput, TagsInputItemPreview, TagsInputItemText, TagsInputLabel, TagsInputRoot, TagsInputRootProvider, toast as Toast, ToastActionTrigger, ToastCloseTrigger, ToastContext, ToastDescription, ToastRoot, ToastTitle, Toaster, toggleGroup as ToggleGroup, ToggleGroupContext, ToggleGroupItem, ToggleGroupRoot, ToggleGroupRootProvider, tooltip as Tooltip, TooltipArrow, TooltipArrowTip, TooltipContent, TooltipContext, TooltipPositioner, TooltipRoot, TooltipRootProvider, TooltipTrigger, treeView as TreeView, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewContext, TreeViewItem, TreeViewItemContext, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewRoot, TreeViewRootProvider, TreeViewTree, ark, createToaster, splitPresenceProps, useAccordion, useAccordionContext, useAccordionItemContext, useAvatar, useAvatarContext, useCarousel, useCarouselContext, useCheckbox, useCheckboxContext, useClipboard, useClipboardContext, useCollapsible, useCollapsibleContext, useColorPicker, useColorPickerContext, useCombobox, useComboboxContext, useComboboxItemContext, useDatePicker, useDatePickerContext, useDialog, useDialogContext, useEditable, useEditableContext, useEnvironmentContext, useFileUpload, useFileUploadContext, useHoverCard, useHoverCardContext, useLocaleContext, useMenu, useMenuContext, useMenuItemContext, useNumberInput, useNumberInputContext, usePagination, usePaginationContext, usePinInput, usePinInputContext, usePopover, usePopoverContext, usePresence, usePresenceContext, useProgress, useProgressContext, useRadioGroup, useRadioGroupContext, useRadioGroupItemContext, useRatingGroup, useRatingGroupContext, useRatingGroupItemContext, useSegmentGroup, useSegmentGroupContext, useSegmentGroupItemContext, useSelect, useSelectContext, useSelectItemContext, useSlider, useSliderContext, useSplitter, useSplitterContext, useSwitch, useSwitchContext, useTabs, useTabsContext, useTagsInput, useTagsInputContext, useTagsInputItemContext, useToastContext, useToggleGroup, useToggleGroupContext, useTooltip, useTooltipContext, useTreeView, useTreeViewContext, useTreeViewItemContext };
6842
+ export { accordion as Accordion, AccordionContext, AccordionItem, AccordionItemContent, AccordionItemContext, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot, AccordionRootProvider, avatar as Avatar, AvatarContext, AvatarFallback, AvatarImage, AvatarRoot, AvatarRootProvider, carousel as Carousel, CarouselContext, CarouselControl, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup, CarouselNextTrigger, CarouselPrevTrigger, CarouselRoot, CarouselRootProvider, CarouselViewport, checkbox as Checkbox, CheckboxContext, CheckboxControl, CheckboxGroup, CheckboxHiddenInput, CheckboxIndicator, CheckboxLabel, CheckboxRoot, CheckboxRootProvider, clipboard as Clipboard, ClipboardContext, ClipboardControl, ClipboardIndicator, ClipboardInput, ClipboardLabel, ClipboardRoot, ClipboardRootProvider, ClipboardTrigger, collapsible as Collapsible, CollapsibleContent, CollapsibleContext, CollapsibleRoot, CollapsibleRootProvider, CollapsibleTrigger, colorPicker as ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerContext, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerFormatSelect, ColorPickerFormatTrigger, ColorPickerHiddenInput, ColorPickerLabel, ColorPickerPositioner, ColorPickerRoot, ColorPickerRootProvider, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchIndicator, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, ColorPickerView, combobox as Combobox, ComboboxClearTrigger, ComboboxContent, ComboboxContext, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxItemContext, ComboboxItemGroup, ComboboxItemGroupLabel, ComboboxItemIndicator, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxPositioner, ComboboxRoot, ComboboxRootProvider, ComboboxTrigger, datePicker as DatePicker, DatePickerClearTrigger, DatePickerContent, DatePickerContext, DatePickerControl, DatePickerInput, DatePickerLabel, DatePickerMonthSelect, DatePickerNextTrigger, DatePickerPositioner, DatePickerPresetTrigger, DatePickerPrevTrigger, DatePickerRangeText, DatePickerRoot, DatePickerRootProvider, DatePickerTable, DatePickerTableBody, DatePickerTableCell, DatePickerTableCellTrigger, DatePickerTableHead, DatePickerTableHeader, DatePickerTableRow, DatePickerTrigger, DatePickerView, DatePickerViewControl, DatePickerViewTrigger, DatePickerYearSelect, dialog as Dialog, DialogBackdrop, DialogCloseTrigger, DialogContent, DialogContext, DialogDescription, DialogPositioner, DialogRoot, DialogRootProvider, DialogTitle, DialogTrigger, editable as Editable, EditableArea, EditableCancelTrigger, EditableContext, EditableControl, EditableEditTrigger, EditableInput, EditableLabel, EditablePreview, EditableRoot, EditableRootProvider, EditableSubmitTrigger, EnvironmentProvider, fileUpload as FileUpload, FileUploadContext, FileUploadDropzone, FileUploadHiddenInput, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName, FileUploadItemPreview, FileUploadItemPreviewImage, FileUploadItemSizeText, FileUploadLabel, FileUploadRoot, FileUploadRootProvider, FileUploadTrigger, format as Format, FormatByte, FormatNumber, hoverCard as HoverCard, HoverCardArrow, HoverCardArrowTip, HoverCardContent, HoverCardContext, HoverCardPositioner, HoverCardRoot, HoverCardRootProvider, HoverCardTrigger, LocaleProvider, menu as Menu, MenuArrow, MenuArrowTip, MenuCheckboxItem, MenuContent, MenuContext, MenuContextTrigger, MenuIndicator, MenuItem, MenuItemContext, MenuItemGroup, MenuItemGroupLabel, MenuItemIndicator, MenuItemText, MenuPositioner, MenuRadioItem, MenuRadioItemGroup, MenuRoot, MenuRootProvider, MenuSeparator, MenuTrigger, MenuTriggerItem, numberInput as NumberInput, NumberInputContext, NumberInputControl, NumberInputDecrementTrigger, NumberInputIncrementTrigger, NumberInputInput, NumberInputLabel, NumberInputRoot, NumberInputRootProvider, NumberInputScrubber, pagination as Pagination, PaginationContext, PaginationEllipsis, PaginationItem, PaginationNextTrigger, PaginationPrevTrigger, PaginationRoot, PaginationRootProvider, pinInput as PinInput, PinInputContext, PinInputControl, PinInputHiddenInput, PinInputInput, PinInputLabel, PinInputRoot, PinInputRootProvider, popover as Popover, PopoverAnchor, PopoverArrow, PopoverArrowTip, PopoverCloseTrigger, PopoverContent, PopoverContext, PopoverDescription, PopoverIndicator, PopoverPositioner, PopoverRoot, PopoverRootProvider, PopoverTitle, PopoverTrigger, Presence, PresenceProvider, progress as Progress, ProgressCircle, ProgressCircleRange, ProgressCircleTrack, ProgressContext, ProgressLabel, ProgressRange, ProgressRoot, ProgressRootProvider, ProgressTrack, ProgressValueText, ProgressView, qrCode as QrCode, QrCodeContext, QrCodeFrame, QrCodeOverlay, QrCodePattern, QrCodeRoot, QrCodeRootProvider, radioGroup as RadioGroup, RadioGroupContext, RadioGroupIndicator, RadioGroupItem, RadioGroupItemContext, RadioGroupItemControl, RadioGroupItemHiddenInput, RadioGroupItemText, RadioGroupLabel, RadioGroupRoot, RadioGroupRootProvider, ratingGroup as RatingGroup, RatingGroupContext, RatingGroupControl, RatingGroupHiddenInput, RatingGroupItem, RatingGroupItemContext, RatingGroupLabel, RatingGroupRoot, RatingGroupRootProvider, segmentGroup as SegmentGroup, SegmentGroupContext, SegmentGroupIndicator, SegmentGroupItem, SegmentGroupItemContext, SegmentGroupItemControl, SegmentGroupItemHiddenInput, SegmentGroupItemText, SegmentGroupLabel, SegmentGroupRoot, SegmentGroupRootProvider, select as Select, SelectClearTrigger, SelectContent, SelectContext, SelectControl, SelectHiddenSelect, SelectIndicator, SelectItem, SelectItemContext, SelectItemGroup, SelectItemGroupLabel, SelectItemIndicator, SelectItemText, SelectLabel, SelectList, SelectPositioner, SelectRoot, SelectRootProvider, SelectTrigger, SelectValueText, signaturePad as SignaturePad, SignaturePadClearTrigger, SignaturePadContext, SignaturePadControl, SignaturePadGuide, SignaturePadLabel, SignaturePadRoot, SignaturePadRootProvider, SignaturePadSegment, slider as Slider, SliderContext, SliderControl, SliderHiddenInput, SliderLabel, SliderMarker, SliderMarkerGroup, SliderRange, SliderRoot, SliderRootProvider, SliderThumb, SliderTrack, SliderValueText, splitter as Splitter, SplitterContext, SplitterPanel, SplitterResizeTrigger, SplitterRoot, SplitterRootProvider, _switch as Switch, SwitchContext, SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchRootProvider, SwitchThumb, TabContent, TabIndicator, TabList, TabTrigger, tabs as Tabs, TabsContext, TabsRoot, TabsRootProvider, tagsInput as TagsInput, TagsInputClearTrigger, TagsInputContext, TagsInputControl, TagsInputHiddenInput, TagsInputInput, TagsInputItem, TagsInputItemContext, TagsInputItemDeleteTrigger, TagsInputItemInput, TagsInputItemPreview, TagsInputItemText, TagsInputLabel, TagsInputRoot, TagsInputRootProvider, toast as Toast, ToastActionTrigger, ToastCloseTrigger, ToastContext, ToastDescription, ToastRoot, ToastTitle, Toaster, toggleGroup as ToggleGroup, ToggleGroupContext, ToggleGroupItem, ToggleGroupRoot, ToggleGroupRootProvider, tooltip as Tooltip, TooltipArrow, TooltipArrowTip, TooltipContent, TooltipContext, TooltipPositioner, TooltipRoot, TooltipRootProvider, TooltipTrigger, treeView as TreeView, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewContext, TreeViewItem, TreeViewItemContext, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewRoot, TreeViewRootProvider, TreeViewTree, ark, createToaster, splitPresenceProps, useAccordion, useAccordionContext, useAccordionItemContext, useAvatar, useAvatarContext, useCarousel, useCarouselContext, useCheckbox, useCheckboxContext, useCheckboxGroup, useCheckboxGroupContext, useClipboard, useClipboardContext, useCollapsible, useCollapsibleContext, useColorPicker, useColorPickerContext, useCombobox, useComboboxContext, useComboboxItemContext, useDatePicker, useDatePickerContext, useDialog, useDialogContext, useEditable, useEditableContext, useEnvironmentContext, useFileUpload, useFileUploadContext, useHoverCard, useHoverCardContext, useLocaleContext, useMenu, useMenuContext, useMenuItemContext, useNumberInput, useNumberInputContext, usePagination, usePaginationContext, usePinInput, usePinInputContext, usePopover, usePopoverContext, usePresence, usePresenceContext, useProgress, useProgressContext, useQrCode, useQrCodeContext, useRadioGroup, useRadioGroupContext, useRadioGroupItemContext, useRatingGroup, useRatingGroupContext, useRatingGroupItemContext, useSegmentGroup, useSegmentGroupContext, useSegmentGroupItemContext, useSelect, useSelectContext, useSelectItemContext, useSignaturePad, useSignaturePadContext, useSlider, useSliderContext, useSplitter, useSplitterContext, useSwitch, useSwitchContext, useTabs, useTabsContext, useTagsInput, useTagsInputContext, useTagsInputItemContext, useToastContext, useToggleGroup, useToggleGroupContext, useTooltip, useTooltipContext, useTreeView, useTreeViewContext, useTreeViewItemContext };
4896
6843
  //# sourceMappingURL=index.js.map