@serendie/ui 0.1.15 → 0.2.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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -9
  3. package/dist/components/{Accordion.d.ts → Accordion/Accordion.d.ts} +2 -2
  4. package/dist/components/{Accordion.js → Accordion/Accordion.js} +10 -10
  5. package/dist/components/Accordion/index.d.ts +1 -0
  6. package/dist/components/AccordionGroup.js +4 -4
  7. package/dist/components/Avatar.js +4 -4
  8. package/dist/components/Badge.js +4 -4
  9. package/dist/components/Banner.js +4 -4
  10. package/dist/components/BottomNavigation.js +3 -3
  11. package/dist/components/BottomNavigationItem.js +4 -4
  12. package/dist/components/Button.js +10 -9
  13. package/dist/components/CheckBox.js +4 -4
  14. package/dist/components/ChoiceBox.js +10 -10
  15. package/dist/components/DashboardWidget.js +4 -4
  16. package/dist/components/Divider.js +4 -4
  17. package/dist/components/Drawer.js +4 -4
  18. package/dist/components/DropdownMenu.js +7 -6
  19. package/dist/components/IconButton.js +4 -4
  20. package/dist/components/ListItem.js +4 -4
  21. package/dist/components/ModalDialog.js +4 -4
  22. package/dist/components/NotificationBadge.js +4 -4
  23. package/dist/components/PasswordField.js +44 -0
  24. package/dist/components/ProgressIndicator.js +4 -4
  25. package/dist/components/RadioButton.js +4 -4
  26. package/dist/components/Search.js +6 -6
  27. package/dist/components/Select.js +4 -4
  28. package/dist/components/Switch.js +4 -4
  29. package/dist/components/TabItem.js +4 -4
  30. package/dist/components/Tabs.js +4 -4
  31. package/dist/components/TextArea.js +4 -4
  32. package/dist/components/TextField.js +4 -4
  33. package/dist/components/Toast.js +3 -3
  34. package/dist/components/TopAppBar.js +4 -4
  35. package/dist/index.d.ts +2 -1
  36. package/dist/index.js +81 -79
  37. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-content.js +3 -4
  38. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-indicator.js +4 -5
  39. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-trigger.js +0 -1
  40. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item.js +3 -4
  41. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-root.js +2 -3
  42. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-fallback.js +6 -7
  43. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-image.js +5 -6
  44. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-root.js +2 -3
  45. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-control.js +5 -6
  46. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js +0 -1
  47. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-label.js +0 -1
  48. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-root.js +4 -5
  49. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-content.js +8 -9
  50. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-root.js +0 -1
  51. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-content.js +3 -4
  52. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-control.js +5 -6
  53. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-input.js +6 -7
  54. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-group.js +0 -1
  55. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-text.js +3 -4
  56. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item.js +0 -1
  57. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-positioner.js +5 -6
  58. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-root.js +4 -5
  59. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-trigger.js +5 -6
  60. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-backdrop.js +4 -5
  61. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-close-trigger.js +5 -6
  62. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-content.js +0 -1
  63. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-description.js +0 -1
  64. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-positioner.js +5 -6
  65. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-root.js +4 -5
  66. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-title.js +0 -1
  67. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-content.js +3 -4
  68. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item-group.js +0 -1
  69. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item.js +2 -3
  70. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-positioner.js +3 -4
  71. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +2 -3
  72. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-trigger.js +3 -4
  73. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js +3 -4
  74. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-hidden-input.js +0 -1
  75. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js +4 -5
  76. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js +3 -4
  77. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-root.js +3 -4
  78. package/dist/node_modules/@ark-ui/react/dist/components/select/select-content.js +3 -4
  79. package/dist/node_modules/@ark-ui/react/dist/components/select/select-control.js +6 -7
  80. package/dist/node_modules/@ark-ui/react/dist/components/select/select-item.js +0 -1
  81. package/dist/node_modules/@ark-ui/react/dist/components/select/select-label.js +4 -5
  82. package/dist/node_modules/@ark-ui/react/dist/components/select/select-positioner.js +4 -5
  83. package/dist/node_modules/@ark-ui/react/dist/components/select/select-root.js +7 -7
  84. package/dist/node_modules/@ark-ui/react/dist/components/select/select-trigger.js +5 -6
  85. package/dist/node_modules/@ark-ui/react/dist/components/select/select-value-text.js +5 -6
  86. package/dist/node_modules/@ark-ui/react/dist/components/select/use-select.js +35 -31
  87. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-control.js +4 -5
  88. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js +4 -5
  89. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-label.js +4 -5
  90. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-root.js +8 -9
  91. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-thumb.js +4 -5
  92. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tab-list.js +3 -4
  93. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tab-trigger.js +3 -4
  94. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tabs-root.js +10 -10
  95. package/dist/node_modules/@ark-ui/react/dist/components/toast/toast-root.js +0 -1
  96. package/dist/node_modules/@ark-ui/react/dist/components/toast/toast-title.js +0 -1
  97. package/dist/node_modules/@ark-ui/react/dist/components/toast/toaster.js +4 -4
  98. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +361 -303
  99. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +229 -216
  100. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +19 -19
  101. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +39 -38
  102. package/dist/node_modules/@serendie/design-token/dist/panda-tokens.js +823 -20
  103. package/dist/node_modules/@serendie/design-token/dist/tokens.js +346 -25
  104. package/dist/node_modules/@zag-js/accordion/dist/index.js +12 -12
  105. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +13 -62
  106. package/dist/node_modules/@zag-js/avatar/dist/index.js +12 -10
  107. package/dist/node_modules/@zag-js/checkbox/dist/index.js +99 -92
  108. package/dist/node_modules/@zag-js/collapsible/dist/index.js +5 -5
  109. package/dist/node_modules/@zag-js/collection/dist/index.js +21 -21
  110. package/dist/node_modules/@zag-js/combobox/dist/index.js +30 -31
  111. package/dist/node_modules/@zag-js/core/dist/index.js +285 -320
  112. package/dist/node_modules/@zag-js/dialog/dist/index.js +56 -62
  113. package/dist/node_modules/@zag-js/dismissable/dist/index.js +3 -3
  114. package/dist/node_modules/@zag-js/dom-event/dist/index.js +88 -115
  115. package/dist/node_modules/@zag-js/dom-query/dist/index.js +2 -2
  116. package/dist/node_modules/@zag-js/focus-visible/dist/index.js +73 -0
  117. package/dist/node_modules/@zag-js/interact-outside/dist/index.js +33 -33
  118. package/dist/node_modules/@zag-js/menu/dist/index.js +81 -77
  119. package/dist/node_modules/@zag-js/popper/dist/index.js +86 -79
  120. package/dist/node_modules/@zag-js/radio-group/dist/index.js +116 -109
  121. package/dist/node_modules/@zag-js/react/dist/index.js +44 -43
  122. package/dist/node_modules/@zag-js/select/dist/index.js +203 -231
  123. package/dist/node_modules/@zag-js/store/dist/index.js +110 -110
  124. package/dist/node_modules/@zag-js/switch/dist/index.js +62 -55
  125. package/dist/node_modules/@zag-js/tabs/dist/index.js +64 -61
  126. package/dist/node_modules/@zag-js/toast/dist/index.js +174 -173
  127. package/dist/node_modules/@zag-js/utils/dist/index.js +93 -71
  128. package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
  129. package/dist/node_modules/focus-trap/dist/focus-trap.esm.js +217 -219
  130. package/dist/preset.d.ts +807 -4
  131. package/dist/{ui/styled-system → styled-system}/css/css.js +5 -6
  132. package/dist/{ui/styled-system → styled-system}/css/cva.js +4 -4
  133. package/dist/{ui/styled-system → styled-system}/css/sva.js +3 -3
  134. package/dist/styled-system/jsx/is-valid-prop.js +6 -0
  135. package/dist/styles.css +1 -1
  136. package/dist/tokens/getToken.d.ts +324 -3
  137. package/dist/tokens/index.d.ts +806 -3
  138. package/package.json +31 -5
  139. package/styled-system/css/css.js +1 -1
  140. package/styled-system/jsx/is-valid-prop.js +1 -1
  141. package/styled-system/themes/theme-asagi.json +1 -1
  142. package/styled-system/themes/theme-kurikawa.json +1 -1
  143. package/styled-system/themes/theme-sumire.json +1 -1
  144. package/styled-system/themes/theme-tsutsuji.json +1 -1
  145. package/styled-system/tokens/index.js +1238 -54
  146. package/styled-system/tokens/tokens.d.ts +3 -3
  147. package/styled-system/types/conditions.d.ts +2 -2
  148. package/styled-system/types/prop-type.d.ts +1 -1
  149. package/dist/ui/styled-system/jsx/is-valid-prop.js +0 -6
  150. /package/dist/{ui/styled-system → styled-system}/css/conditions.js +0 -0
  151. /package/dist/{ui/styled-system → styled-system}/css/cx.js +0 -0
  152. /package/dist/{ui/styled-system → styled-system}/helpers.js +0 -0
  153. /package/dist/{ui/styled-system → styled-system}/jsx/box.js +0 -0
  154. /package/dist/{ui/styled-system → styled-system}/jsx/factory-helper.js +0 -0
  155. /package/dist/{ui/styled-system → styled-system}/jsx/factory.js +0 -0
  156. /package/dist/{ui/styled-system → styled-system}/patterns/box.js +0 -0
@@ -1,156 +1,121 @@
1
- import { snapshot as M, proxy as V, proxyWithComputed as R, subscribe as O, ref as L } from "../../store/dist/index.js";
2
- import { klona as q } from "../../../klona/full/index.js";
3
- var B = Object.defineProperty, H = (t, s, r) => s in t ? B(t, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[s] = r, a = (t, s, r) => H(t, typeof s != "symbol" ? s + "" : s, r);
4
- function J(t) {
5
- for (; t.length > 0; ) t.pop();
6
- return t;
7
- }
8
- var P = (t, ...s) => (typeof t == "function" ? t(...s) : t) ?? void 0, m = (t) => t, K = () => {
9
- }, X = (...t) => (...s) => {
10
- t.forEach(function(r) {
11
- r == null || r(...s);
12
- });
13
- }, $ = /* @__PURE__ */ (() => {
14
- let t = 0;
15
- return () => (t++, t.toString(36));
16
- })(), Q = () => process.env.NODE_ENV !== "production", w = (t) => Array.isArray(t), A = (t) => !(t == null || typeof t != "object" || w(t)), U = (t) => typeof t == "number" && !Number.isNaN(t), v = (t) => typeof t == "string", N = (t) => typeof t == "function", Y = (t, s) => Object.prototype.hasOwnProperty.call(t, s);
17
- function D(t) {
18
- if (!Z(t) || t === void 0)
19
- return t;
20
- const s = Reflect.ownKeys(t).filter((o) => typeof o == "string"), r = {};
21
- for (const o of s) {
22
- const u = t[o];
23
- u !== void 0 && (r[o] = D(u));
1
+ import { snapshot as C, proxy as R, proxyWithComputed as V, subscribe as _, ref as P } from "../../store/dist/index.js";
2
+ import { callAll as q, isString as v, uuid as $, cast as m, isFunction as T, noop as B, isObject as M, runIfFn as F, invariant as b, clear as H, compact as j, isArray as N, hasProp as J, warn as w, isDev as X, isPlainObject as K, isNumber as Q } from "../../utils/dist/index.js";
3
+ import { klona as U } from "../../../klona/full/index.js";
4
+ var Y = Object.defineProperty, Z = (e, n, o) => n in e ? Y(e, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[n] = o, a = (e, n, o) => Z(e, typeof n != "symbol" ? n + "" : n, o);
5
+ function I(e, ...n) {
6
+ for (const o of n) {
7
+ const h = j(o);
8
+ for (const l in h)
9
+ K(o[l]) ? (e[l] || (e[l] = {}), I(e[l], o[l])) : e[l] = o[l];
24
10
  }
25
- return r;
11
+ return e;
26
12
  }
27
- var Z = (t) => t && typeof t == "object" && t.constructor === Object;
28
- function T(...t) {
29
- const s = t.length === 1 ? t[0] : t[1];
30
- (t.length === 2 ? t[0] : !0) && process.env.NODE_ENV !== "production" && console.warn(s);
13
+ function O(e) {
14
+ return U(e);
31
15
  }
32
- function b(...t) {
33
- const s = t.length === 1 ? t[0] : t[1];
34
- if ((t.length === 2 ? t[0] : !0) && process.env.NODE_ENV !== "production")
35
- throw new Error(s);
36
- }
37
- function z(t, ...s) {
38
- for (const r of s) {
39
- const o = D(r);
40
- for (const u in o)
41
- A(r[u]) ? (t[u] || (t[u] = {}), z(t[u], r[u])) : t[u] = r[u];
42
- }
43
- return t;
16
+ function g(e) {
17
+ return v(e) ? { type: e } : e;
44
18
  }
45
- function F(t) {
46
- return q(t);
19
+ function x(e) {
20
+ return e ? N(e) ? e.slice() : [e] : [];
47
21
  }
48
- function g(t) {
49
- return v(t) ? { type: t } : t;
50
- }
51
- function x(t) {
52
- return t ? w(t) ? t.slice() : [t] : [];
53
- }
54
- function W(t) {
55
- return A(t) && t.predicate != null;
22
+ function W(e) {
23
+ return M(e) && e.predicate != null;
56
24
  }
57
25
  var tt = () => !0;
58
- function _(t, s, r, o) {
59
- return (u) => {
60
- var p;
61
- return v(u) ? !!((p = t[u]) != null && p.call(t, s, r, o)) : N(u) ? u(s, r, o) : u.predicate(t)(s, r, o);
26
+ function L(e, n, o, h) {
27
+ return (l) => {
28
+ var f;
29
+ return v(l) ? !!((f = e[l]) != null && f.call(e, n, o, h)) : T(l) ? l(n, o, h) : l.predicate(e)(n, o, h);
62
30
  };
63
31
  }
64
- function et(...t) {
32
+ function et(...e) {
65
33
  return {
66
- predicate: (s) => (r, o, u) => t.map(_(s, r, o, u)).some(Boolean)
34
+ predicate: (n) => (o, h, l) => e.map(L(n, o, h, l)).some(Boolean)
67
35
  };
68
36
  }
69
- function it(...t) {
37
+ function it(...e) {
70
38
  return {
71
- predicate: (s) => (r, o, u) => t.map(_(s, r, o, u)).every(Boolean)
39
+ predicate: (n) => (o, h, l) => e.map(L(n, o, h, l)).every(Boolean)
72
40
  };
73
41
  }
74
- function st(t) {
42
+ function st(e) {
75
43
  return {
76
- predicate: (s) => (r, o, u) => !_(s, r, o, u)(t)
44
+ predicate: (n) => (o, h, l) => !L(n, o, h, l)(e)
77
45
  };
78
46
  }
79
- function nt(...t) {
80
- return (s, r, o) => o.state.matches(...t);
81
- }
82
- var vt = { or: et, and: it, not: st, stateIn: nt };
83
- function k(t, s) {
84
- return t = t ?? tt, (r, o, u) => {
85
- if (v(t)) {
86
- const p = s[t];
87
- return N(p) ? p(r, o, u) : p;
47
+ var vt = { or: et, and: it, not: st };
48
+ function G(e, n) {
49
+ return e = e ?? tt, (o, h, l) => {
50
+ if (v(e)) {
51
+ const f = n[e];
52
+ return T(f) ? f(o, h, l) : f;
88
53
  }
89
- return W(t) ? t.predicate(s)(r, o, u) : t == null ? void 0 : t(r, o, u);
54
+ return W(e) ? e.predicate(n)(o, h, l) : e == null ? void 0 : e(o, h, l);
90
55
  };
91
56
  }
92
- function j(t, s) {
93
- return (r, o, u) => W(t) ? t.predicate(s)(r, o, u) : t;
57
+ function D(e, n) {
58
+ return (o, h, l) => W(e) ? e.predicate(n)(o, h, l) : e;
94
59
  }
95
- function rt(t) {
96
- var p, S;
97
- const s = t.computed ?? m({}), r = t.context ?? m({}), o = t.initial ? (S = (p = t.states) == null ? void 0 : p[t.initial]) == null ? void 0 : S.tags : [], u = V({
98
- value: t.initial ?? "",
60
+ function nt(e) {
61
+ var f, S;
62
+ const n = e.computed ?? m({}), o = e.context ?? m({}), h = e.initial ? (S = (f = e.states) == null ? void 0 : f[e.initial]) == null ? void 0 : S.tags : [], l = R({
63
+ value: e.initial ?? "",
99
64
  previousValue: "",
100
65
  event: m({}),
101
66
  previousEvent: m({}),
102
- context: R(r, s),
67
+ context: V(o, n),
103
68
  done: !1,
104
- tags: o ?? [],
105
- hasTag(e) {
106
- return this.tags.includes(e);
69
+ tags: h ?? [],
70
+ hasTag(t) {
71
+ return this.tags.includes(t);
107
72
  },
108
- matches(...e) {
109
- return e.includes(this.value);
73
+ matches(...t) {
74
+ return t.includes(this.value);
110
75
  },
111
- can(e) {
112
- return m(this).nextEvents.includes(e);
76
+ can(t) {
77
+ return m(this).nextEvents.includes(t);
113
78
  },
114
79
  get nextEvents() {
115
- var i, h;
116
- const e = ((h = (i = t.states) == null ? void 0 : i[this.value]) == null ? void 0 : h.on) ?? {}, n = (t == null ? void 0 : t.on) ?? {};
117
- return Object.keys({ ...e, ...n });
80
+ var i, r;
81
+ const t = ((r = (i = e.states) == null ? void 0 : i[this.value]) == null ? void 0 : r.on) ?? {}, s = (e == null ? void 0 : e.on) ?? {};
82
+ return Object.keys({ ...t, ...s });
118
83
  },
119
84
  get changed() {
120
85
  return this.event.value === "machine.init" || !this.previousValue ? !1 : this.value !== this.previousValue;
121
86
  }
122
87
  });
123
- return m(u);
88
+ return m(l);
124
89
  }
125
- function E(t, s) {
126
- return (r, o) => {
127
- if (U(t)) return t;
128
- if (N(t))
129
- return t(r, o);
130
- if (v(t)) {
131
- const u = Number.parseFloat(t);
132
- if (!Number.isNaN(u))
133
- return u;
134
- if (s) {
135
- const p = s == null ? void 0 : s[t];
90
+ function E(e, n) {
91
+ return (o, h) => {
92
+ if (Q(e)) return e;
93
+ if (T(e))
94
+ return e(o, h);
95
+ if (v(e)) {
96
+ const l = Number.parseFloat(e);
97
+ if (!Number.isNaN(l))
98
+ return l;
99
+ if (n) {
100
+ const f = n == null ? void 0 : n[e];
136
101
  return b(
137
- p == null,
138
- `[@zag-js/core > determine-delay] Cannot determine delay for \`${t}\`. It doesn't exist in \`options.delays\``
139
- ), N(p) ? p(r, o) : p;
102
+ f == null,
103
+ `[@zag-js/core > determine-delay] Cannot determine delay for \`${e}\`. It doesn't exist in \`options.delays\``
104
+ ), T(f) ? f(o, h) : f;
140
105
  }
141
106
  }
142
107
  };
143
108
  }
144
- function at(t) {
145
- return v(t) ? { target: t } : t;
109
+ function at(e) {
110
+ return v(e) ? { target: e } : e;
146
111
  }
147
- function ot(t, s) {
148
- return (r, o, u) => x(t).map(at).find((p) => k(p.guard, s)(r, o, u) ?? p.target ?? p.actions);
112
+ function rt(e, n) {
113
+ return (o, h, l) => x(e).map(at).find((f) => G(f.guard, n)(o, h, l) ?? f.target ?? f.actions);
149
114
  }
150
- var G = class {
115
+ var k = class {
151
116
  // Let's get started!
152
- constructor(t, s) {
153
- var r, o, u, p, S;
117
+ constructor(e, n) {
118
+ var o, h, l, f, S;
154
119
  a(
155
120
  this,
156
121
  "status",
@@ -161,21 +126,21 @@ var G = class {
161
126
  "type",
162
127
  "machine"
163
128
  /* Machine */
164
- ), a(this, "activityEvents", /* @__PURE__ */ new Map()), a(this, "delayedEvents", /* @__PURE__ */ new Map()), a(this, "stateListeners", /* @__PURE__ */ new Set()), a(this, "doneListeners", /* @__PURE__ */ new Set()), a(this, "contextWatchers", /* @__PURE__ */ new Set()), a(this, "removeStateListener", K), a(this, "parent"), a(this, "children", /* @__PURE__ */ new Map()), a(this, "guardMap"), a(this, "actionMap"), a(this, "delayMap"), a(this, "activityMap"), a(this, "sync"), a(this, "options"), a(this, "config"), a(this, "_created", () => {
165
- var n;
166
- const e = g(
129
+ ), a(this, "activityEvents", /* @__PURE__ */ new Map()), a(this, "delayedEvents", /* @__PURE__ */ new Map()), a(this, "stateListeners", /* @__PURE__ */ new Set()), a(this, "doneListeners", /* @__PURE__ */ new Set()), a(this, "contextWatchers", /* @__PURE__ */ new Set()), a(this, "removeStateListener", B), a(this, "parent"), a(this, "children", /* @__PURE__ */ new Map()), a(this, "guardMap"), a(this, "actionMap"), a(this, "delayMap"), a(this, "activityMap"), a(this, "sync"), a(this, "options"), a(this, "config"), a(this, "_created", () => {
130
+ var s;
131
+ const t = g(
167
132
  "machine.created"
168
133
  /* Created */
169
134
  );
170
- this.executeActions((n = this.config) == null ? void 0 : n.created, e);
171
- }), a(this, "start", (e) => {
135
+ this.executeActions((s = this.config) == null ? void 0 : s.created, t);
136
+ }), a(this, "start", (t) => {
172
137
  if (this.state.value = "", this.state.tags = [], this.status === "Running")
173
138
  return this;
174
- this.status = "Running", this.removeStateListener = O(
139
+ this.status = "Running", this.removeStateListener = _(
175
140
  this.state,
176
141
  () => {
177
- this.stateListeners.forEach((f) => {
178
- f(this.stateSnapshot);
142
+ this.stateListeners.forEach((d) => {
143
+ d(this.stateSnapshot);
179
144
  });
180
145
  },
181
146
  this.sync
@@ -191,25 +156,25 @@ var G = class {
191
156
  "machine.start"
192
157
  /* Start */
193
158
  ));
194
- const n = g(
159
+ const s = g(
195
160
  "machine.init"
196
161
  /* Init */
197
- ), i = A(e) ? e.value : e, h = A(e) ? e.context : void 0;
198
- h && this.setContext(h);
162
+ ), i = M(t) ? t.value : t, r = M(t) ? t.context : void 0;
163
+ r && this.setContext(r);
199
164
  const c = {
200
165
  target: i ?? this.config.initial
201
- }, l = this.getNextStateInfo(c, n);
202
- return this.initialState = l, this.performStateChangeEffects(this.state.value, l, n), this;
166
+ }, u = this.getNextStateInfo(c, s);
167
+ return this.initialState = u, this.performStateChangeEffects(this.state.value, u, s), this;
203
168
  }), a(this, "setupContextWatchers", () => {
204
- const { watch: e } = this.config;
205
- if (!e) return;
206
- let n = M(this.state.context);
207
- const i = O(this.state.context, () => {
169
+ const { watch: t } = this.config;
170
+ if (!t) return;
171
+ let s = C(this.state.context);
172
+ const i = _(this.state.context, () => {
208
173
  var c;
209
- const h = M(this.state.context);
210
- for (const [l, f] of Object.entries(e))
211
- (((c = this.options.compareFns) == null ? void 0 : c[l]) ?? Object.is)(n[l], h[l]) || this.executeActions(f, this.state.event);
212
- n = h;
174
+ const r = C(this.state.context);
175
+ for (const [u, d] of Object.entries(t))
176
+ (((c = this.options.compareFns) == null ? void 0 : c[u]) ?? Object.is)(s[u], r[u]) || this.executeActions(d, this.state.event);
177
+ s = r;
213
178
  });
214
179
  this.contextWatchers.add(i);
215
180
  }), a(this, "stop", () => {
@@ -227,208 +192,208 @@ var G = class {
227
192
  }), a(this, "stopStateListeners", () => {
228
193
  this.removeStateListener(), this.stateListeners.clear();
229
194
  }), a(this, "stopContextWatchers", () => {
230
- this.contextWatchers.forEach((e) => e()), this.contextWatchers.clear();
195
+ this.contextWatchers.forEach((t) => t()), this.contextWatchers.clear();
231
196
  }), a(this, "stopDelayedEvents", () => {
232
- this.delayedEvents.forEach((e) => {
233
- e.forEach((n) => n());
197
+ this.delayedEvents.forEach((t) => {
198
+ t.forEach((s) => s());
234
199
  }), this.delayedEvents.clear();
235
- }), a(this, "stopActivities", (e) => {
236
- var n, i;
237
- e ? ((n = this.activityEvents.get(e)) == null || n.forEach((h) => h()), (i = this.activityEvents.get(e)) == null || i.clear(), this.activityEvents.delete(e)) : (this.activityEvents.forEach((h) => {
238
- h.forEach((c) => c()), h.clear();
200
+ }), a(this, "stopActivities", (t) => {
201
+ var s, i;
202
+ t ? ((s = this.activityEvents.get(t)) == null || s.forEach((r) => r()), (i = this.activityEvents.get(t)) == null || i.clear(), this.activityEvents.delete(t)) : (this.activityEvents.forEach((r) => {
203
+ r.forEach((c) => c()), r.clear();
239
204
  }), this.activityEvents.clear());
240
- }), a(this, "sendChild", (e, n) => {
241
- const i = g(e), h = P(n, this.contextSnapshot), c = this.children.get(h);
205
+ }), a(this, "sendChild", (t, s) => {
206
+ const i = g(t), r = F(s, this.contextSnapshot), c = this.children.get(r);
242
207
  c || b(`[@zag-js/core] Cannot send '${i.type}' event to unknown child`), c.send(i);
243
- }), a(this, "stopChild", (e) => {
244
- this.children.has(e) || b(`[@zag-js/core > stop-child] Cannot stop unknown child ${e}`), this.children.get(e).stop(), this.children.delete(e);
245
- }), a(this, "removeChild", (e) => {
246
- this.children.delete(e);
208
+ }), a(this, "stopChild", (t) => {
209
+ this.children.has(t) || b(`[@zag-js/core > stop-child] Cannot stop unknown child ${t}`), this.children.get(t).stop(), this.children.delete(t);
210
+ }), a(this, "removeChild", (t) => {
211
+ this.children.delete(t);
247
212
  }), a(this, "stopChildren", () => {
248
- this.children.forEach((e) => e.stop()), this.children.clear();
249
- }), a(this, "setParent", (e) => {
250
- this.parent = e;
251
- }), a(this, "spawn", (e, n) => {
252
- const i = P(e);
253
- return n && (i.id = n), i.type = "machine.actor", i.setParent(this), this.children.set(i.id, m(i)), i.onDone(() => {
213
+ this.children.forEach((t) => t.stop()), this.children.clear();
214
+ }), a(this, "setParent", (t) => {
215
+ this.parent = t;
216
+ }), a(this, "spawn", (t, s) => {
217
+ const i = F(t);
218
+ return s && (i.id = s), i.type = "machine.actor", i.setParent(this), this.children.set(i.id, m(i)), i.onDone(() => {
254
219
  this.removeChild(i.id);
255
- }).start(), m(L(i));
256
- }), a(this, "stopActivity", (e) => {
220
+ }).start(), m(P(i));
221
+ }), a(this, "stopActivity", (t) => {
257
222
  var i;
258
223
  if (!this.state.value) return;
259
- const n = this.activityEvents.get(this.state.value);
260
- (i = n == null ? void 0 : n.get(e)) == null || i(), n == null || n.delete(e);
261
- }), a(this, "addActivityCleanup", (e, n, i) => {
262
- var h;
263
- e && (this.activityEvents.has(e) ? (h = this.activityEvents.get(e)) == null || h.set(n, i) : this.activityEvents.set(e, /* @__PURE__ */ new Map([[n, i]])));
264
- }), a(this, "setState", (e) => {
265
- this.state.previousValue = this.state.value, this.state.value = e;
266
- const n = this.getStateNode(e);
267
- e == null ? J(this.state.tags) : this.state.tags = x(n == null ? void 0 : n.tags);
268
- }), a(this, "setContext", (e) => {
269
- e && z(this.state.context, D(e));
270
- }), a(this, "setOptions", (e) => {
271
- const n = D(e);
272
- this.actionMap = { ...this.actionMap, ...n.actions }, this.delayMap = { ...this.delayMap, ...n.delays }, this.activityMap = { ...this.activityMap, ...n.activities }, this.guardMap = { ...this.guardMap, ...n.guards };
273
- }), a(this, "getStateNode", (e) => {
274
- var n;
275
- if (e)
276
- return (n = this.config.states) == null ? void 0 : n[e];
277
- }), a(this, "getNextStateInfo", (e, n) => {
278
- const i = this.determineTransition(e, n), h = !(i != null && i.target), c = (i == null ? void 0 : i.target) ?? this.state.value, l = this.state.value !== c, f = this.getStateNode(c), y = {
279
- reenter: !h && !l && !(i != null && i.internal),
224
+ const s = this.activityEvents.get(this.state.value);
225
+ (i = s == null ? void 0 : s.get(t)) == null || i(), s == null || s.delete(t);
226
+ }), a(this, "addActivityCleanup", (t, s, i) => {
227
+ var r;
228
+ t && (this.activityEvents.has(t) ? (r = this.activityEvents.get(t)) == null || r.set(s, i) : this.activityEvents.set(t, /* @__PURE__ */ new Map([[s, i]])));
229
+ }), a(this, "setState", (t) => {
230
+ this.state.previousValue = this.state.value, this.state.value = t;
231
+ const s = this.getStateNode(t);
232
+ t == null ? H(this.state.tags) : this.state.tags = x(s == null ? void 0 : s.tags);
233
+ }), a(this, "setContext", (t) => {
234
+ t && I(this.state.context, j(t));
235
+ }), a(this, "setOptions", (t) => {
236
+ const s = j(t);
237
+ this.actionMap = { ...this.actionMap, ...s.actions }, this.delayMap = { ...this.delayMap, ...s.delays }, this.activityMap = { ...this.activityMap, ...s.activities }, this.guardMap = { ...this.guardMap, ...s.guards };
238
+ }), a(this, "getStateNode", (t) => {
239
+ var s;
240
+ if (t)
241
+ return (s = this.config.states) == null ? void 0 : s[t];
242
+ }), a(this, "getNextStateInfo", (t, s) => {
243
+ const i = this.determineTransition(t, s), r = !(i != null && i.target), c = (i == null ? void 0 : i.target) ?? this.state.value, u = this.state.value !== c, d = this.getStateNode(c), y = {
244
+ reenter: !r && !u && !(i != null && i.internal),
280
245
  transition: i,
281
- stateNode: f,
246
+ stateNode: d,
282
247
  target: c,
283
- changed: l
248
+ changed: u
284
249
  };
285
- return this.log("NextState:", `[${n.type}]`, this.state.value, "---->", y.target), y;
286
- }), a(this, "getAfterActions", (e, n) => {
250
+ return this.log("NextState:", `[${s.type}]`, this.state.value, "---->", y.target), y;
251
+ }), a(this, "getAfterActions", (t, s) => {
287
252
  let i;
288
253
  return {
289
254
  entry: () => {
290
255
  i = globalThis.setTimeout(() => {
291
- const h = this.getNextStateInfo(e, this.state.event);
292
- this.performStateChangeEffects(this.state.value, h, this.state.event);
293
- }, n);
256
+ const r = this.getNextStateInfo(t, this.state.event);
257
+ this.performStateChangeEffects(this.state.value, r, this.state.event);
258
+ }, s);
294
259
  },
295
260
  exit: () => {
296
261
  globalThis.clearTimeout(i);
297
262
  }
298
263
  };
299
- }), a(this, "getDelayedEventActions", (e) => {
300
- const n = this.getStateNode(e), i = this.state.event;
301
- if (!n || !n.after) return;
302
- const h = [], c = [];
303
- if (w(n.after)) {
304
- const l = this.determineTransition(n.after, i);
305
- if (!l) return;
306
- if (!Y(l, "delay"))
307
- throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(l)}`);
308
- const d = E(l.delay, this.delayMap)(this.contextSnapshot, i), y = this.getAfterActions(l, d);
309
- return h.push(y.entry), c.push(y.exit), { entries: h, exits: c };
264
+ }), a(this, "getDelayedEventActions", (t) => {
265
+ const s = this.getStateNode(t), i = this.state.event;
266
+ if (!s || !s.after) return;
267
+ const r = [], c = [];
268
+ if (N(s.after)) {
269
+ const u = this.determineTransition(s.after, i);
270
+ if (!u) return;
271
+ if (!J(u, "delay"))
272
+ throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(u)}`);
273
+ const p = E(u.delay, this.delayMap)(this.contextSnapshot, i), y = this.getAfterActions(u, p);
274
+ return r.push(y.entry), c.push(y.exit), { entries: r, exits: c };
310
275
  }
311
- if (A(n.after))
312
- for (const l in n.after) {
313
- const f = n.after[l], y = E(l, this.delayMap)(this.contextSnapshot, i), C = this.getAfterActions(f, y);
314
- h.push(C.entry), c.push(C.exit);
276
+ if (M(s.after))
277
+ for (const u in s.after) {
278
+ const d = s.after[u], y = E(u, this.delayMap)(this.contextSnapshot, i), A = this.getAfterActions(d, y);
279
+ r.push(A.entry), c.push(A.exit);
315
280
  }
316
- return { entries: h, exits: c };
317
- }), a(this, "executeActions", (e, n) => {
318
- var h;
319
- const i = j(e, this.guardMap)(this.contextSnapshot, n, this.guardMeta);
281
+ return { entries: r, exits: c };
282
+ }), a(this, "executeActions", (t, s) => {
283
+ var r;
284
+ const i = D(t, this.guardMap)(this.contextSnapshot, s, this.guardMeta);
320
285
  for (const c of x(i)) {
321
- const l = v(c) ? (h = this.actionMap) == null ? void 0 : h[c] : c;
322
- T(
323
- v(c) && !l,
286
+ const u = v(c) ? (r = this.actionMap) == null ? void 0 : r[c] : c;
287
+ w(
288
+ v(c) && !u,
324
289
  `[@zag-js/core > execute-actions] No implementation found for action: \`${c}\``
325
- ), l == null || l(this.state.context, n, this.meta);
290
+ ), u == null || u(this.state.context, s, this.meta);
326
291
  }
327
- }), a(this, "executeActivities", (e, n, i) => {
328
- var h;
329
- for (const c of n) {
330
- const l = v(c) ? (h = this.activityMap) == null ? void 0 : h[c] : c;
331
- if (!l) {
332
- T(`[@zag-js/core > execute-activity] No implementation found for activity: \`${c}\``);
292
+ }), a(this, "executeActivities", (t, s, i) => {
293
+ var r;
294
+ for (const c of s) {
295
+ const u = v(c) ? (r = this.activityMap) == null ? void 0 : r[c] : c;
296
+ if (!u) {
297
+ w(`[@zag-js/core > execute-activity] No implementation found for activity: \`${c}\``);
333
298
  continue;
334
299
  }
335
- const f = l(this.state.context, e, this.meta);
336
- if (f) {
337
- const d = v(c) ? c : c.name || $();
338
- this.addActivityCleanup(i ?? this.state.value, d, f);
300
+ const d = u(this.state.context, t, this.meta);
301
+ if (d) {
302
+ const p = v(c) ? c : c.name || $();
303
+ this.addActivityCleanup(i ?? this.state.value, p, d);
339
304
  }
340
305
  }
341
- }), a(this, "createEveryActivities", (e, n) => {
342
- if (e)
343
- if (w(e)) {
344
- const i = x(e).find((f) => {
345
- const d = f.delay, C = E(d, this.delayMap)(this.contextSnapshot, this.state.event);
346
- return k(f.guard, this.guardMap)(this.contextSnapshot, this.state.event, this.guardMeta) ?? C != null;
306
+ }), a(this, "createEveryActivities", (t, s) => {
307
+ if (t)
308
+ if (N(t)) {
309
+ const i = x(t).find((d) => {
310
+ const p = d.delay, A = E(p, this.delayMap)(this.contextSnapshot, this.state.event);
311
+ return G(d.guard, this.guardMap)(this.contextSnapshot, this.state.event, this.guardMeta) ?? A != null;
347
312
  });
348
313
  if (!i) return;
349
314
  const c = E(i.delay, this.delayMap)(this.contextSnapshot, this.state.event);
350
- n(() => {
351
- const f = globalThis.setInterval(() => {
315
+ s(() => {
316
+ const d = globalThis.setInterval(() => {
352
317
  this.executeActions(i.actions, this.state.event);
353
318
  }, c);
354
319
  return () => {
355
- globalThis.clearInterval(f);
320
+ globalThis.clearInterval(d);
356
321
  };
357
322
  });
358
323
  } else
359
- for (const i in e) {
360
- const h = e == null ? void 0 : e[i], l = E(i, this.delayMap)(this.contextSnapshot, this.state.event);
361
- n(() => {
362
- const d = globalThis.setInterval(() => {
363
- this.executeActions(h, this.state.event);
364
- }, l);
324
+ for (const i in t) {
325
+ const r = t == null ? void 0 : t[i], u = E(i, this.delayMap)(this.contextSnapshot, this.state.event);
326
+ s(() => {
327
+ const p = globalThis.setInterval(() => {
328
+ this.executeActions(r, this.state.event);
329
+ }, u);
365
330
  return () => {
366
- globalThis.clearInterval(d);
331
+ globalThis.clearInterval(p);
367
332
  };
368
333
  });
369
334
  }
370
- }), a(this, "setEvent", (e) => {
371
- this.state.previousEvent = this.state.event, this.state.event = L(g(e));
372
- }), a(this, "performExitEffects", (e, n) => {
335
+ }), a(this, "setEvent", (t) => {
336
+ this.state.previousEvent = this.state.event, this.state.event = P(g(t));
337
+ }), a(this, "performExitEffects", (t, s) => {
373
338
  const i = this.state.value;
374
339
  if (i === "") return;
375
- const h = e ? this.getStateNode(e) : void 0;
340
+ const r = t ? this.getStateNode(t) : void 0;
376
341
  this.stopActivities(i);
377
- const c = j(h == null ? void 0 : h.exit, this.guardMap)(this.contextSnapshot, n, this.guardMeta), l = x(c), f = this.delayedEvents.get(i);
378
- f && l.push(...f), this.executeActions(l, n);
379
- }), a(this, "performEntryEffects", (e, n) => {
380
- const i = this.getStateNode(e), h = x(i == null ? void 0 : i.activities);
381
- this.createEveryActivities(i == null ? void 0 : i.every, (d) => {
382
- h.unshift(d);
383
- }), h.length > 0 && this.executeActivities(n, h);
384
- const c = j(i == null ? void 0 : i.entry, this.guardMap)(
342
+ const c = D(r == null ? void 0 : r.exit, this.guardMap)(this.contextSnapshot, s, this.guardMeta), u = x(c), d = this.delayedEvents.get(i);
343
+ d && u.push(...d), this.executeActions(u, s);
344
+ }), a(this, "performEntryEffects", (t, s) => {
345
+ const i = this.getStateNode(t), r = x(i == null ? void 0 : i.activities);
346
+ this.createEveryActivities(i == null ? void 0 : i.every, (p) => {
347
+ r.unshift(p);
348
+ }), r.length > 0 && this.executeActivities(s, r);
349
+ const c = D(i == null ? void 0 : i.entry, this.guardMap)(
385
350
  this.contextSnapshot,
386
- n,
351
+ s,
387
352
  this.guardMeta
388
- ), l = x(c), f = this.getDelayedEventActions(e);
389
- i != null && i.after && f && (this.delayedEvents.set(e, f == null ? void 0 : f.exits), l.push(...f.entries)), this.executeActions(l, n), (i == null ? void 0 : i.type) === "final" && (this.state.done = !0, this.doneListeners.forEach((d) => {
390
- d(this.stateSnapshot);
353
+ ), u = x(c), d = this.getDelayedEventActions(t);
354
+ i != null && i.after && d && (this.delayedEvents.set(t, d == null ? void 0 : d.exits), u.push(...d.entries)), this.executeActions(u, s), (i == null ? void 0 : i.type) === "final" && (this.state.done = !0, this.doneListeners.forEach((p) => {
355
+ p(this.stateSnapshot);
391
356
  }), this.stop());
392
- }), a(this, "performTransitionEffects", (e, n) => {
393
- const i = this.determineTransition(e, n);
394
- this.executeActions(i == null ? void 0 : i.actions, n);
395
- }), a(this, "performStateChangeEffects", (e, n, i) => {
357
+ }), a(this, "performTransitionEffects", (t, s) => {
358
+ const i = this.determineTransition(t, s);
359
+ this.executeActions(i == null ? void 0 : i.actions, s);
360
+ }), a(this, "performStateChangeEffects", (t, s, i) => {
396
361
  this.setEvent(i);
397
- const h = n.changed || n.reenter;
398
- h && this.performExitEffects(e, i), this.performTransitionEffects(n.transition, i), this.setState(n.target), h && this.performEntryEffects(n.target, i);
399
- }), a(this, "determineTransition", (e, n) => {
400
- const i = ot(e, this.guardMap);
401
- return i == null ? void 0 : i(this.contextSnapshot, n, this.guardMeta);
402
- }), a(this, "sendParent", (e) => {
362
+ const r = s.changed || s.reenter;
363
+ r && this.performExitEffects(t, i), this.performTransitionEffects(s.transition, i), this.setState(s.target), r && this.performEntryEffects(s.target, i);
364
+ }), a(this, "determineTransition", (t, s) => {
365
+ const i = rt(t, this.guardMap);
366
+ return i == null ? void 0 : i(this.contextSnapshot, s, this.guardMeta);
367
+ }), a(this, "sendParent", (t) => {
403
368
  var i;
404
369
  this.parent || b("[@zag-js/core > send-parent] Cannot send event to an unknown parent");
405
- const n = g(e);
406
- (i = this.parent) == null || i.send(n);
407
- }), a(this, "log", (...e) => {
408
- Q() && this.options.debug && console.log(...e);
409
- }), a(this, "send", (e) => {
410
- const n = g(e);
411
- this.transition(this.state.value, n);
412
- }), a(this, "transition", (e, n) => {
413
- var f, d;
414
- const i = v(e) ? this.getStateNode(e) : e == null ? void 0 : e.stateNode, h = g(n);
370
+ const s = g(t);
371
+ (i = this.parent) == null || i.send(s);
372
+ }), a(this, "log", (...t) => {
373
+ X() && this.options.debug && console.log(...t);
374
+ }), a(this, "send", (t) => {
375
+ const s = g(t);
376
+ this.transition(this.state.value, s);
377
+ }), a(this, "transition", (t, s) => {
378
+ var d, p;
379
+ const i = v(t) ? this.getStateNode(t) : t == null ? void 0 : t.stateNode, r = g(s);
415
380
  if (!i && !this.config.on) {
416
- const y = this.status === "Stopped" ? "[@zag-js/core > transition] Cannot transition a stopped machine" : `[@zag-js/core > transition] State does not have a definition for \`state\`: ${e}, \`event\`: ${h.type}`;
417
- T(y);
381
+ const y = this.status === "Stopped" ? "[@zag-js/core > transition] Cannot transition a stopped machine" : `[@zag-js/core > transition] State does not have a definition for \`state\`: ${t}, \`event\`: ${r.type}`;
382
+ w(y);
418
383
  return;
419
384
  }
420
385
  const c = (
421
386
  // @ts-expect-error - Fix this
422
- ((f = i == null ? void 0 : i.on) == null ? void 0 : f[h.type]) ?? ((d = this.config.on) == null ? void 0 : d[h.type])
423
- ), l = this.getNextStateInfo(c, h);
424
- return this.performStateChangeEffects(this.state.value, l, h), l.stateNode;
425
- }), a(this, "subscribe", (e) => (this.stateListeners.add(e), this.status === "Running" && e(this.stateSnapshot), () => {
426
- this.stateListeners.delete(e);
427
- })), a(this, "onDone", (e) => (this.doneListeners.add(e), this)), a(this, "onTransition", (e) => (this.stateListeners.add(e), this.status === "Running" && e(this.stateSnapshot), this)), this.config = F(t), this.options = F(s ?? {}), this.id = this.config.id ?? `machine-${$()}`, this.guardMap = ((r = this.options) == null ? void 0 : r.guards) ?? {}, this.actionMap = ((o = this.options) == null ? void 0 : o.actions) ?? {}, this.delayMap = ((u = this.options) == null ? void 0 : u.delays) ?? {}, this.activityMap = ((p = this.options) == null ? void 0 : p.activities) ?? {}, this.sync = ((S = this.options) == null ? void 0 : S.sync) ?? !1, this.state = rt(this.config), this.initialContext = M(this.state.context);
387
+ ((d = i == null ? void 0 : i.on) == null ? void 0 : d[r.type]) ?? ((p = this.config.on) == null ? void 0 : p[r.type])
388
+ ), u = this.getNextStateInfo(c, r);
389
+ return this.performStateChangeEffects(this.state.value, u, r), u.stateNode;
390
+ }), a(this, "subscribe", (t) => (this.stateListeners.add(t), this.status === "Running" && t(this.stateSnapshot), () => {
391
+ this.stateListeners.delete(t);
392
+ })), a(this, "onDone", (t) => (this.doneListeners.add(t), this)), a(this, "onTransition", (t) => (this.stateListeners.add(t), this.status === "Running" && t(this.stateSnapshot), this)), this.config = O(e), this.options = O(n ?? {}), this.id = this.config.id ?? `machine-${$()}`, this.guardMap = ((o = this.options) == null ? void 0 : o.guards) ?? {}, this.actionMap = ((h = this.options) == null ? void 0 : h.actions) ?? {}, this.delayMap = ((l = this.options) == null ? void 0 : l.delays) ?? {}, this.activityMap = ((f = this.options) == null ? void 0 : f.activities) ?? {}, this.sync = ((S = this.options) == null ? void 0 : S.sync) ?? !1, this.state = nt(this.config), this.initialContext = C(this.state.context);
428
393
  }
429
394
  // immutable state value
430
395
  get stateSnapshot() {
431
- return m(M(this.state));
396
+ return m(C(this.state));
432
397
  }
433
398
  getState() {
434
399
  return this.stateSnapshot;
@@ -442,7 +407,7 @@ var G = class {
442
407
  * Useful when spawning child machines and managing the communication between them.
443
408
  */
444
409
  get self() {
445
- const t = this;
410
+ const e = this;
446
411
  return {
447
412
  id: this.id,
448
413
  send: this.send.bind(this),
@@ -453,29 +418,29 @@ var G = class {
453
418
  spawn: this.spawn.bind(this),
454
419
  stopActivity: this.stopActivity.bind(this),
455
420
  get state() {
456
- return t.stateSnapshot;
421
+ return e.stateSnapshot;
457
422
  },
458
423
  get initialContext() {
459
- return t.initialContext;
424
+ return e.initialContext;
460
425
  },
461
426
  get initialState() {
462
- var s;
463
- return ((s = t.initialState) == null ? void 0 : s.target) ?? "";
427
+ var n;
428
+ return ((n = e.initialState) == null ? void 0 : n.target) ?? "";
464
429
  }
465
430
  };
466
431
  }
467
432
  get meta() {
468
- var t;
433
+ var e;
469
434
  return {
470
435
  state: this.stateSnapshot,
471
436
  guards: this.guardMap,
472
437
  send: this.send.bind(this),
473
438
  self: this.self,
474
439
  initialContext: this.initialContext,
475
- initialState: ((t = this.initialState) == null ? void 0 : t.target) ?? "",
440
+ initialState: ((e = this.initialState) == null ? void 0 : e.target) ?? "",
476
441
  getState: () => this.stateSnapshot,
477
- getAction: (s) => this.actionMap[s],
478
- getGuard: (s) => this.guardMap[s]
442
+ getAction: (n) => this.actionMap[n],
443
+ getGuard: (n) => this.guardMap[n]
479
444
  };
480
445
  }
481
446
  get guardMeta() {
@@ -487,60 +452,60 @@ var G = class {
487
452
  return "Machine";
488
453
  }
489
454
  getHydrationState() {
490
- const t = this.getState();
455
+ const e = this.getState();
491
456
  return {
492
- value: t.value,
493
- tags: t.tags
457
+ value: e.value,
458
+ tags: e.tags
494
459
  };
495
460
  }
496
- }, gt = (t, s) => new G(t, s), yt = (t) => t instanceof G || (t == null ? void 0 : t.type) === "machine", ht = (...t) => t.map((s) => {
497
- var r;
498
- return (r = s == null ? void 0 : s.trim) == null ? void 0 : r.call(s);
499
- }).filter(Boolean).join(" "), ct = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g, I = (t) => {
500
- const s = {};
501
- let r;
502
- for (; r = ct.exec(t); )
503
- s[r[1]] = r[2];
504
- return s;
505
- }, ut = (t, s) => {
506
- if (v(t)) {
507
- if (v(s)) return `${t};${s}`;
508
- t = I(t);
509
- } else v(s) && (s = I(s));
510
- return Object.assign({}, t ?? {}, s ?? {});
461
+ }, gt = (e, n) => new k(e, n), yt = (e) => e instanceof k || (e == null ? void 0 : e.type) === "machine", ot = (...e) => e.map((n) => {
462
+ var o;
463
+ return (o = n == null ? void 0 : n.trim) == null ? void 0 : o.call(n);
464
+ }).filter(Boolean).join(" "), ht = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g, z = (e) => {
465
+ const n = {};
466
+ let o;
467
+ for (; o = ht.exec(e); )
468
+ n[o[1]] = o[2];
469
+ return n;
470
+ }, ct = (e, n) => {
471
+ if (v(e)) {
472
+ if (v(n)) return `${e};${n}`;
473
+ e = z(e);
474
+ } else v(n) && (n = z(n));
475
+ return Object.assign({}, e ?? {}, n ?? {});
511
476
  };
512
- function mt(...t) {
513
- let s = {};
514
- for (let r of t) {
515
- for (let o in s) {
516
- if (o.startsWith("on") && typeof s[o] == "function" && typeof r[o] == "function") {
517
- s[o] = X(r[o], s[o]);
477
+ function mt(...e) {
478
+ let n = {};
479
+ for (let o of e) {
480
+ for (let h in n) {
481
+ if (h.startsWith("on") && typeof n[h] == "function" && typeof o[h] == "function") {
482
+ n[h] = q(o[h], n[h]);
518
483
  continue;
519
484
  }
520
- if (o === "className" || o === "class") {
521
- s[o] = ht(s[o], r[o]);
485
+ if (h === "className" || h === "class") {
486
+ n[h] = ot(n[h], o[h]);
522
487
  continue;
523
488
  }
524
- if (o === "style") {
525
- s[o] = ut(s[o], r[o]);
489
+ if (h === "style") {
490
+ n[h] = ct(n[h], o[h]);
526
491
  continue;
527
492
  }
528
- s[o] = r[o] !== void 0 ? r[o] : s[o];
493
+ n[h] = o[h] !== void 0 ? o[h] : n[h];
529
494
  }
530
- for (let o in r)
531
- s[o] === void 0 && (s[o] = r[o]);
495
+ for (let h in o)
496
+ n[h] === void 0 && (n[h] = o[h]);
532
497
  }
533
- return s;
498
+ return n;
534
499
  }
535
500
  export {
536
- G as Machine,
501
+ k as Machine,
537
502
  gt as createMachine,
538
- z as deepMerge,
503
+ I as deepMerge,
539
504
  vt as guards,
540
505
  yt as isMachine,
541
506
  mt as mergeProps,
542
- V as proxy,
543
- L as ref,
544
- M as snapshot,
545
- O as subscribe
507
+ R as proxy,
508
+ P as ref,
509
+ C as snapshot,
510
+ _ as subscribe
546
511
  };