@saas-ui/react 3.0.0-alpha.4 → 3.0.0-alpha.6

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 (84) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/chunk-2EUACKRH.js +26 -0
  3. package/dist/chunk-3Z2C27LI.js +51 -0
  4. package/dist/chunk-4TR3AOMG.js +33 -0
  5. package/dist/chunk-6LOMIKR5.js +69 -0
  6. package/dist/chunk-6ZNR6N2K.js +45 -0
  7. package/dist/chunk-7C3IZBNJ.js +38 -0
  8. package/dist/chunk-BCNPBZZK.js +45 -0
  9. package/dist/{chunk-KHRLZUV4.js → chunk-BFA5FCA2.js} +16 -1
  10. package/dist/chunk-CTOVNZVS.js +1 -0
  11. package/dist/chunk-DPMEXCSG.js +137 -0
  12. package/dist/chunk-F3CVOMG5.js +160 -0
  13. package/dist/chunk-FJFNGSPL.js +23 -0
  14. package/dist/chunk-GEPWRHHH.js +65 -0
  15. package/dist/chunk-HELHPHIQ.js +35 -0
  16. package/dist/chunk-I2RXEKTB.js +38 -0
  17. package/dist/chunk-L356FPLY.js +20 -0
  18. package/dist/chunk-LIYUBUOP.js +119 -0
  19. package/dist/chunk-M7FOBCOV.js +184 -0
  20. package/dist/chunk-NSD5HRIP.js +46 -0
  21. package/dist/chunk-QMG6HP7Z.js +87 -0
  22. package/dist/chunk-QSNSWCTM.js +32 -0
  23. package/dist/chunk-S3CQW7GD.js +100 -0
  24. package/dist/chunk-SA3OGTOO.js +23 -0
  25. package/dist/chunk-UCQ3LZIE.js +43 -0
  26. package/dist/chunk-ULAJ3JEO.js +32 -0
  27. package/dist/chunk-VF3BV2BY.js +87 -0
  28. package/dist/chunk-WYLMBMAH.js +22 -0
  29. package/dist/chunk-YWJZWB6I.js +1892 -0
  30. package/dist/chunk-ZWSZQZ5G.js +73 -0
  31. package/dist/components/app-shell/index.js +3 -40
  32. package/dist/components/avatar/index.cjs +69 -0
  33. package/dist/components/avatar/index.d.cts +18 -0
  34. package/dist/components/avatar/index.d.ts +18 -0
  35. package/dist/components/avatar/index.js +10 -0
  36. package/dist/components/breadcrumbs/index.js +3 -32
  37. package/dist/components/button/index.js +3 -40
  38. package/dist/components/checkbox/index.js +3 -15
  39. package/dist/components/command/index.js +3 -28
  40. package/dist/components/dialog/index.js +5 -67
  41. package/dist/components/drawer/index.d.cts +2 -2
  42. package/dist/components/drawer/index.d.ts +2 -2
  43. package/dist/components/drawer/index.js +5 -59
  44. package/dist/components/empty-state/index.js +3 -18
  45. package/dist/components/grid-list/index.js +3 -40
  46. package/dist/components/icon-badge/index.js +3 -33
  47. package/dist/components/link/index.js +2 -14
  48. package/dist/components/loading-overlay/index.js +5 -1885
  49. package/dist/components/menu/index.cjs +263 -0
  50. package/dist/components/menu/index.d.cts +30 -0
  51. package/dist/components/menu/index.d.ts +30 -0
  52. package/dist/components/menu/index.js +9 -0
  53. package/dist/components/navbar/index.d.cts +4 -4
  54. package/dist/components/navbar/index.d.ts +4 -4
  55. package/dist/components/navbar/index.js +3 -45
  56. package/dist/components/number-input/index.js +3 -26
  57. package/dist/components/password-input/index.js +4 -225
  58. package/dist/components/persona/index.js +6 -178
  59. package/dist/components/pin-input/index.js +3 -21
  60. package/dist/components/radio/index.js +4 -16
  61. package/dist/components/search-input/index.js +4 -114
  62. package/dist/components/segmented-control/index.cjs +2 -0
  63. package/dist/components/segmented-control/index.d.cts +2 -0
  64. package/dist/components/segmented-control/index.d.ts +2 -0
  65. package/dist/components/segmented-control/index.js +2 -0
  66. package/dist/components/select/index.js +4 -94
  67. package/dist/components/sidebar/index.d.cts +11 -11
  68. package/dist/components/sidebar/index.d.ts +11 -11
  69. package/dist/components/sidebar/index.js +7 -129
  70. package/dist/components/steps/index.js +5 -64
  71. package/dist/components/switch/index.js +3 -18
  72. package/dist/components/toaster/index.cjs +54 -0
  73. package/dist/components/toaster/index.d.cts +10 -0
  74. package/dist/components/toaster/index.d.ts +10 -0
  75. package/dist/components/toaster/index.js +10 -0
  76. package/dist/components/tooltip/index.cjs +57 -0
  77. package/dist/components/tooltip/index.d.cts +14 -0
  78. package/dist/components/tooltip/index.d.ts +14 -0
  79. package/dist/components/tooltip/index.js +8 -0
  80. package/dist/index.cjs +3707 -8
  81. package/dist/index.d.cts +37 -2
  82. package/dist/index.d.ts +37 -2
  83. package/dist/index.js +285 -4
  84. package/package.json +4 -4
@@ -0,0 +1,1892 @@
1
+ 'use client'
2
+ import {
3
+ Spinner
4
+ } from "./chunk-32JGENDB.js";
5
+ import {
6
+ __export
7
+ } from "./chunk-RTMS5TJN.js";
8
+
9
+ // src/components/loading-overlay/loading-overlay.tsx
10
+ var loading_overlay_exports = {};
11
+ __export(loading_overlay_exports, {
12
+ Root: () => LoadingOverlayRoot,
13
+ Spinner: () => LoadingOverlaySpinner,
14
+ Text: () => LoadingOverlayText
15
+ });
16
+
17
+ // ../../node_modules/@ark-ui/react/dist/components/presence/presence.js
18
+ import { jsx as jsx2 } from "react/jsx-runtime";
19
+ import { forwardRef as forwardRef2 } from "react";
20
+
21
+ // ../../node_modules/@ark-ui/react/dist/utils/compose-refs.js
22
+ function setRef(ref2, value) {
23
+ if (typeof ref2 === "function") {
24
+ ref2(value);
25
+ } else if (ref2 !== null && ref2 !== void 0) {
26
+ ref2.current = value;
27
+ }
28
+ }
29
+ function composeRefs(...refs) {
30
+ return (node) => {
31
+ for (const ref2 of refs) {
32
+ setRef(ref2, node);
33
+ }
34
+ };
35
+ }
36
+
37
+ // ../../node_modules/proxy-compare/dist/index.js
38
+ var TRACK_MEMO_SYMBOL = Symbol();
39
+ var GET_ORIGINAL_SYMBOL = Symbol();
40
+ var AFFECTED_PROPERTY = "a";
41
+ var IS_TARGET_COPIED_PROPERTY = "f";
42
+ var PROXY_PROPERTY = "p";
43
+ var PROXY_CACHE_PROPERTY = "c";
44
+ var TARGET_CACHE_PROPERTY = "t";
45
+ var NEXT_OBJECT_PROPERTY = "n";
46
+ var CHANGED_PROPERTY = "g";
47
+ var HAS_KEY_PROPERTY = "h";
48
+ var ALL_OWN_KEYS_PROPERTY = "w";
49
+ var HAS_OWN_KEY_PROPERTY = "o";
50
+ var KEYS_PROPERTY = "k";
51
+ var newProxy = (target, handler) => new Proxy(target, handler);
52
+ var getProto = Object.getPrototypeOf;
53
+ var objectsToTrack = /* @__PURE__ */ new WeakMap();
54
+ var isObjectToTrack = (obj) => obj && (objectsToTrack.has(obj) ? objectsToTrack.get(obj) : getProto(obj) === Object.prototype || getProto(obj) === Array.prototype);
55
+ var isObject = (x) => typeof x === "object" && x !== null;
56
+ var needsToCopyTargetObject = (obj) => Object.values(Object.getOwnPropertyDescriptors(obj)).some((descriptor) => !descriptor.configurable && !descriptor.writable);
57
+ var copyTargetObject = (obj) => {
58
+ if (Array.isArray(obj)) {
59
+ return Array.from(obj);
60
+ }
61
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
62
+ Object.values(descriptors).forEach((desc) => {
63
+ desc.configurable = true;
64
+ });
65
+ return Object.create(getProto(obj), descriptors);
66
+ };
67
+ var createProxyHandler = (origObj, isTargetCopied) => {
68
+ const state = {
69
+ [IS_TARGET_COPIED_PROPERTY]: isTargetCopied
70
+ };
71
+ let trackObject = false;
72
+ const recordUsage = (type, key) => {
73
+ if (!trackObject) {
74
+ let used = state[AFFECTED_PROPERTY].get(origObj);
75
+ if (!used) {
76
+ used = {};
77
+ state[AFFECTED_PROPERTY].set(origObj, used);
78
+ }
79
+ if (type === ALL_OWN_KEYS_PROPERTY) {
80
+ used[ALL_OWN_KEYS_PROPERTY] = true;
81
+ } else {
82
+ let set2 = used[type];
83
+ if (!set2) {
84
+ set2 = /* @__PURE__ */ new Set();
85
+ used[type] = set2;
86
+ }
87
+ set2.add(key);
88
+ }
89
+ }
90
+ };
91
+ const recordObjectAsUsed = () => {
92
+ trackObject = true;
93
+ state[AFFECTED_PROPERTY].delete(origObj);
94
+ };
95
+ const handler = {
96
+ get(target, key) {
97
+ if (key === GET_ORIGINAL_SYMBOL) {
98
+ return origObj;
99
+ }
100
+ recordUsage(KEYS_PROPERTY, key);
101
+ return createProxy(Reflect.get(target, key), state[AFFECTED_PROPERTY], state[PROXY_CACHE_PROPERTY], state[TARGET_CACHE_PROPERTY]);
102
+ },
103
+ has(target, key) {
104
+ if (key === TRACK_MEMO_SYMBOL) {
105
+ recordObjectAsUsed();
106
+ return true;
107
+ }
108
+ recordUsage(HAS_KEY_PROPERTY, key);
109
+ return Reflect.has(target, key);
110
+ },
111
+ getOwnPropertyDescriptor(target, key) {
112
+ recordUsage(HAS_OWN_KEY_PROPERTY, key);
113
+ return Reflect.getOwnPropertyDescriptor(target, key);
114
+ },
115
+ ownKeys(target) {
116
+ recordUsage(ALL_OWN_KEYS_PROPERTY);
117
+ return Reflect.ownKeys(target);
118
+ }
119
+ };
120
+ if (isTargetCopied) {
121
+ handler.set = handler.deleteProperty = () => false;
122
+ }
123
+ return [handler, state];
124
+ };
125
+ var getOriginalObject = (obj) => (
126
+ // unwrap proxy
127
+ obj[GET_ORIGINAL_SYMBOL] || // otherwise
128
+ obj
129
+ );
130
+ var createProxy = (obj, affected, proxyCache, targetCache2) => {
131
+ if (!isObjectToTrack(obj))
132
+ return obj;
133
+ let targetAndCopied = targetCache2 && targetCache2.get(obj);
134
+ if (!targetAndCopied) {
135
+ const target2 = getOriginalObject(obj);
136
+ if (needsToCopyTargetObject(target2)) {
137
+ targetAndCopied = [target2, copyTargetObject(target2)];
138
+ } else {
139
+ targetAndCopied = [target2];
140
+ }
141
+ targetCache2 === null || targetCache2 === void 0 ? void 0 : targetCache2.set(obj, targetAndCopied);
142
+ }
143
+ const [target, copiedTarget] = targetAndCopied;
144
+ let handlerAndState = proxyCache && proxyCache.get(target);
145
+ if (!handlerAndState || handlerAndState[1][IS_TARGET_COPIED_PROPERTY] !== !!copiedTarget) {
146
+ handlerAndState = createProxyHandler(target, !!copiedTarget);
147
+ handlerAndState[1][PROXY_PROPERTY] = newProxy(copiedTarget || target, handlerAndState[0]);
148
+ if (proxyCache) {
149
+ proxyCache.set(target, handlerAndState);
150
+ }
151
+ }
152
+ handlerAndState[1][AFFECTED_PROPERTY] = affected;
153
+ handlerAndState[1][PROXY_CACHE_PROPERTY] = proxyCache;
154
+ handlerAndState[1][TARGET_CACHE_PROPERTY] = targetCache2;
155
+ return handlerAndState[1][PROXY_PROPERTY];
156
+ };
157
+ var isAllOwnKeysChanged = (prevObj, nextObj) => {
158
+ const prevKeys = Reflect.ownKeys(prevObj);
159
+ const nextKeys = Reflect.ownKeys(nextObj);
160
+ return prevKeys.length !== nextKeys.length || prevKeys.some((k, i) => k !== nextKeys[i]);
161
+ };
162
+ var isChanged = (prevObj, nextObj, affected, cache, isEqual2 = Object.is) => {
163
+ if (isEqual2(prevObj, nextObj)) {
164
+ return false;
165
+ }
166
+ if (!isObject(prevObj) || !isObject(nextObj))
167
+ return true;
168
+ const used = affected.get(getOriginalObject(prevObj));
169
+ if (!used)
170
+ return true;
171
+ if (cache) {
172
+ const hit = cache.get(prevObj);
173
+ if (hit && hit[NEXT_OBJECT_PROPERTY] === nextObj) {
174
+ return hit[CHANGED_PROPERTY];
175
+ }
176
+ cache.set(prevObj, {
177
+ [NEXT_OBJECT_PROPERTY]: nextObj,
178
+ [CHANGED_PROPERTY]: false
179
+ });
180
+ }
181
+ let changed = null;
182
+ try {
183
+ for (const key of used[HAS_KEY_PROPERTY] || []) {
184
+ changed = Reflect.has(prevObj, key) !== Reflect.has(nextObj, key);
185
+ if (changed)
186
+ return changed;
187
+ }
188
+ if (used[ALL_OWN_KEYS_PROPERTY] === true) {
189
+ changed = isAllOwnKeysChanged(prevObj, nextObj);
190
+ if (changed)
191
+ return changed;
192
+ } else {
193
+ for (const key of used[HAS_OWN_KEY_PROPERTY] || []) {
194
+ const hasPrev = !!Reflect.getOwnPropertyDescriptor(prevObj, key);
195
+ const hasNext = !!Reflect.getOwnPropertyDescriptor(nextObj, key);
196
+ changed = hasPrev !== hasNext;
197
+ if (changed)
198
+ return changed;
199
+ }
200
+ }
201
+ for (const key of used[KEYS_PROPERTY] || []) {
202
+ changed = isChanged(prevObj[key], nextObj[key], affected, cache, isEqual2);
203
+ if (changed)
204
+ return changed;
205
+ }
206
+ if (changed === null)
207
+ changed = true;
208
+ return changed;
209
+ } finally {
210
+ if (cache) {
211
+ cache.set(prevObj, {
212
+ [NEXT_OBJECT_PROPERTY]: nextObj,
213
+ [CHANGED_PROPERTY]: changed
214
+ });
215
+ }
216
+ }
217
+ };
218
+ var getUntracked = (obj) => {
219
+ if (isObjectToTrack(obj)) {
220
+ return obj[GET_ORIGINAL_SYMBOL] || null;
221
+ }
222
+ return null;
223
+ };
224
+ var markToTrack = (obj, mark = true) => {
225
+ objectsToTrack.set(obj, mark);
226
+ };
227
+
228
+ // ../../node_modules/@zag-js/store/dist/index.mjs
229
+ function getGlobal() {
230
+ if (typeof globalThis !== "undefined") return globalThis;
231
+ if (typeof self !== "undefined") return self;
232
+ if (typeof window !== "undefined") return window;
233
+ if (typeof global !== "undefined") return global;
234
+ }
235
+ function makeGlobal(key, value) {
236
+ const g = getGlobal();
237
+ if (!g) return value();
238
+ g[key] || (g[key] = value());
239
+ return g[key];
240
+ }
241
+ var isDev = () => process.env.NODE_ENV !== "production";
242
+ var isObject2 = (x) => typeof x === "object" && x !== null;
243
+ var proxyStateMap = makeGlobal("__zag__proxyStateMap", () => /* @__PURE__ */ new WeakMap());
244
+ var refSet = makeGlobal("__zag__refSet", () => /* @__PURE__ */ new WeakSet());
245
+ var isReactElement = (x) => typeof x === "object" && x !== null && "$$typeof" in x;
246
+ var isVueElement = (x) => typeof x === "object" && x !== null && "__v_isVNode" in x;
247
+ var isDOMElement = (x) => typeof x === "object" && x !== null && "nodeType" in x && typeof x.nodeName === "string";
248
+ var isElement = (x) => isReactElement(x) || isVueElement(x) || isDOMElement(x);
249
+ var buildProxyFunction = (objectIs = Object.is, newProxy2 = (target, handler) => new Proxy(target, handler), canProxy = (x) => isObject2(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !isElement(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) => {
250
+ switch (promise.status) {
251
+ case "fulfilled":
252
+ return promise.value;
253
+ case "rejected":
254
+ throw promise.reason;
255
+ default:
256
+ throw promise;
257
+ }
258
+ }, snapCache = /* @__PURE__ */ new WeakMap(), createSnapshot = (target, version, handlePromise = defaultHandlePromise) => {
259
+ const cache = snapCache.get(target);
260
+ if ((cache == null ? void 0 : cache[0]) === version) {
261
+ return cache[1];
262
+ }
263
+ const snap = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
264
+ markToTrack(snap, true);
265
+ snapCache.set(target, [version, snap]);
266
+ Reflect.ownKeys(target).forEach((key) => {
267
+ const value = Reflect.get(target, key);
268
+ if (refSet.has(value)) {
269
+ markToTrack(value, false);
270
+ snap[key] = value;
271
+ } else if (value instanceof Promise) {
272
+ Object.defineProperty(snap, key, {
273
+ get() {
274
+ return handlePromise(value);
275
+ }
276
+ });
277
+ } else if (proxyStateMap.has(value)) {
278
+ snap[key] = snapshot(value, handlePromise);
279
+ } else {
280
+ snap[key] = value;
281
+ }
282
+ });
283
+ return Object.freeze(snap);
284
+ }, proxyCache = /* @__PURE__ */ new WeakMap(), versionHolder = [1, 1], proxyFunction2 = (initialObject) => {
285
+ if (!isObject2(initialObject)) {
286
+ throw new Error("object required");
287
+ }
288
+ const found = proxyCache.get(initialObject);
289
+ if (found) {
290
+ return found;
291
+ }
292
+ let version = versionHolder[0];
293
+ const listeners = /* @__PURE__ */ new Set();
294
+ const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
295
+ if (version !== nextVersion) {
296
+ version = nextVersion;
297
+ listeners.forEach((listener) => listener(op, nextVersion));
298
+ }
299
+ };
300
+ let checkVersion = versionHolder[1];
301
+ const ensureVersion = (nextCheckVersion = ++versionHolder[1]) => {
302
+ if (checkVersion !== nextCheckVersion && !listeners.size) {
303
+ checkVersion = nextCheckVersion;
304
+ propProxyStates.forEach(([propProxyState]) => {
305
+ const propVersion = propProxyState[1](nextCheckVersion);
306
+ if (propVersion > version) {
307
+ version = propVersion;
308
+ }
309
+ });
310
+ }
311
+ return version;
312
+ };
313
+ const createPropListener = (prop) => (op, nextVersion) => {
314
+ const newOp = [...op];
315
+ newOp[1] = [prop, ...newOp[1]];
316
+ notifyUpdate(newOp, nextVersion);
317
+ };
318
+ const propProxyStates = /* @__PURE__ */ new Map();
319
+ const addPropListener = (prop, propProxyState) => {
320
+ if (isDev() && propProxyStates.has(prop)) {
321
+ throw new Error("prop listener already exists");
322
+ }
323
+ if (listeners.size) {
324
+ const remove = propProxyState[3](createPropListener(prop));
325
+ propProxyStates.set(prop, [propProxyState, remove]);
326
+ } else {
327
+ propProxyStates.set(prop, [propProxyState]);
328
+ }
329
+ };
330
+ const removePropListener = (prop) => {
331
+ var _a;
332
+ const entry = propProxyStates.get(prop);
333
+ if (entry) {
334
+ propProxyStates.delete(prop);
335
+ (_a = entry[1]) == null ? void 0 : _a.call(entry);
336
+ }
337
+ };
338
+ const addListener = (listener) => {
339
+ listeners.add(listener);
340
+ if (listeners.size === 1) {
341
+ propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
342
+ if (isDev() && prevRemove) {
343
+ throw new Error("remove already exists");
344
+ }
345
+ const remove = propProxyState[3](createPropListener(prop));
346
+ propProxyStates.set(prop, [propProxyState, remove]);
347
+ });
348
+ }
349
+ const removeListener = () => {
350
+ listeners.delete(listener);
351
+ if (listeners.size === 0) {
352
+ propProxyStates.forEach(([propProxyState, remove], prop) => {
353
+ if (remove) {
354
+ remove();
355
+ propProxyStates.set(prop, [propProxyState]);
356
+ }
357
+ });
358
+ }
359
+ };
360
+ return removeListener;
361
+ };
362
+ const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
363
+ const handler = {
364
+ deleteProperty(target, prop) {
365
+ const prevValue = Reflect.get(target, prop);
366
+ removePropListener(prop);
367
+ const deleted = Reflect.deleteProperty(target, prop);
368
+ if (deleted) {
369
+ notifyUpdate(["delete", [prop], prevValue]);
370
+ }
371
+ return deleted;
372
+ },
373
+ set(target, prop, value, receiver) {
374
+ var _a;
375
+ const hasPrevValue = Reflect.has(target, prop);
376
+ const prevValue = Reflect.get(target, prop, receiver);
377
+ if (hasPrevValue && (objectIs(prevValue, value) || proxyCache.has(value) && objectIs(prevValue, proxyCache.get(value)))) {
378
+ return true;
379
+ }
380
+ removePropListener(prop);
381
+ if (isObject2(value)) {
382
+ value = getUntracked(value) || value;
383
+ }
384
+ let nextValue = value;
385
+ if ((_a = Object.getOwnPropertyDescriptor(target, prop)) == null ? void 0 : _a.set) ;
386
+ else if (value instanceof Promise) {
387
+ value.then((v) => {
388
+ Object.assign(value, { status: "fulfilled", value: v });
389
+ notifyUpdate(["resolve", [prop], v]);
390
+ }).catch((e) => {
391
+ Object.assign(value, { status: "rejected", reason: e });
392
+ notifyUpdate(["reject", [prop], e]);
393
+ });
394
+ } else {
395
+ if (!proxyStateMap.has(value) && canProxy(value)) {
396
+ nextValue = proxy(value);
397
+ }
398
+ const childProxyState = !refSet.has(nextValue) && proxyStateMap.get(nextValue);
399
+ if (childProxyState) {
400
+ addPropListener(prop, childProxyState);
401
+ }
402
+ }
403
+ Reflect.set(target, prop, nextValue, receiver);
404
+ notifyUpdate(["set", [prop], value, prevValue]);
405
+ return true;
406
+ }
407
+ };
408
+ const proxyObject = newProxy2(baseObject, handler);
409
+ proxyCache.set(initialObject, proxyObject);
410
+ const proxyState = [baseObject, ensureVersion, createSnapshot, addListener];
411
+ proxyStateMap.set(proxyObject, proxyState);
412
+ Reflect.ownKeys(initialObject).forEach((key) => {
413
+ const desc = Object.getOwnPropertyDescriptor(initialObject, key);
414
+ if (desc.get || desc.set) {
415
+ Object.defineProperty(baseObject, key, desc);
416
+ } else {
417
+ proxyObject[key] = initialObject[key];
418
+ }
419
+ });
420
+ return proxyObject;
421
+ }) => [
422
+ // public functions
423
+ proxyFunction2,
424
+ // shared state
425
+ proxyStateMap,
426
+ refSet,
427
+ // internal things
428
+ objectIs,
429
+ newProxy2,
430
+ canProxy,
431
+ defaultHandlePromise,
432
+ snapCache,
433
+ createSnapshot,
434
+ proxyCache,
435
+ versionHolder
436
+ ];
437
+ var [proxyFunction] = buildProxyFunction();
438
+ function proxy(initialObject = {}) {
439
+ return proxyFunction(initialObject);
440
+ }
441
+ function subscribe(proxyObject, callback, notifyInSync) {
442
+ const proxyState = proxyStateMap.get(proxyObject);
443
+ if (isDev() && !proxyState) {
444
+ console.warn("Please use proxy object");
445
+ }
446
+ let promise;
447
+ const ops = [];
448
+ const addListener = proxyState[3];
449
+ let isListenerActive = false;
450
+ const listener = (op) => {
451
+ ops.push(op);
452
+ if (notifyInSync) {
453
+ callback(ops.splice(0));
454
+ return;
455
+ }
456
+ if (!promise) {
457
+ promise = Promise.resolve().then(() => {
458
+ promise = void 0;
459
+ if (isListenerActive) {
460
+ callback(ops.splice(0));
461
+ }
462
+ });
463
+ }
464
+ };
465
+ const removeListener = addListener(listener);
466
+ isListenerActive = true;
467
+ return () => {
468
+ isListenerActive = false;
469
+ removeListener();
470
+ };
471
+ }
472
+ function snapshot(proxyObject, handlePromise) {
473
+ const proxyState = proxyStateMap.get(proxyObject);
474
+ if (isDev() && !proxyState) {
475
+ console.warn("Please use proxy object");
476
+ }
477
+ const [target, ensureVersion, createSnapshot] = proxyState;
478
+ return createSnapshot(target, ensureVersion(), handlePromise);
479
+ }
480
+ function ref(obj) {
481
+ refSet.add(obj);
482
+ return obj;
483
+ }
484
+ function proxyWithComputed(initialObject, computedFns) {
485
+ const keys = Object.keys(computedFns);
486
+ keys.forEach((key) => {
487
+ if (Object.getOwnPropertyDescriptor(initialObject, key)) {
488
+ throw new Error("object property already defined");
489
+ }
490
+ const computedFn = computedFns[key];
491
+ const { get, set: set2 } = typeof computedFn === "function" ? { get: computedFn } : computedFn;
492
+ const desc = {};
493
+ desc.get = () => get(snapshot(proxyObject));
494
+ if (set2) {
495
+ desc.set = (newValue) => set2(proxyObject, newValue);
496
+ }
497
+ Object.defineProperty(initialObject, key, desc);
498
+ });
499
+ const proxyObject = proxy(initialObject);
500
+ return proxyObject;
501
+ }
502
+
503
+ // ../../node_modules/@zag-js/utils/dist/index.mjs
504
+ function clear(v) {
505
+ while (v.length > 0) v.pop();
506
+ return v;
507
+ }
508
+ var runIfFn = (v, ...a) => {
509
+ const res = typeof v === "function" ? v(...a) : v;
510
+ return res != null ? res : void 0;
511
+ };
512
+ var cast = (v) => v;
513
+ var noop = () => {
514
+ };
515
+ var callAll = (...fns) => (...a) => {
516
+ fns.forEach(function(fn) {
517
+ fn == null ? void 0 : fn(...a);
518
+ });
519
+ };
520
+ var uuid = /* @__PURE__ */ (() => {
521
+ let id = 0;
522
+ return () => {
523
+ id++;
524
+ return id.toString(36);
525
+ };
526
+ })();
527
+ var isDev2 = () => process.env.NODE_ENV !== "production";
528
+ var isArray = (v) => Array.isArray(v);
529
+ var isObjectLike = (v) => v != null && typeof v === "object";
530
+ var isObject3 = (v) => isObjectLike(v) && !isArray(v);
531
+ var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
532
+ var isString = (v) => typeof v === "string";
533
+ var isFunction = (v) => typeof v === "function";
534
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
535
+ var baseGetTag = (v) => Object.prototype.toString.call(v);
536
+ var fnToString = Function.prototype.toString;
537
+ var objectCtorString = fnToString.call(Object);
538
+ var isPlainObject = (v) => {
539
+ if (!isObjectLike(v) || baseGetTag(v) != "[object Object]") return false;
540
+ const proto = Object.getPrototypeOf(v);
541
+ if (proto === null) return true;
542
+ const Ctor = hasProp(proto, "constructor") && proto.constructor;
543
+ return typeof Ctor == "function" && Ctor instanceof Ctor && fnToString.call(Ctor) == objectCtorString;
544
+ };
545
+ function compact(obj) {
546
+ if (!isPlainObject2(obj) || obj === void 0) {
547
+ return obj;
548
+ }
549
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
550
+ const filtered = {};
551
+ for (const key of keys) {
552
+ const value = obj[key];
553
+ if (value !== void 0) {
554
+ filtered[key] = compact(value);
555
+ }
556
+ }
557
+ return filtered;
558
+ }
559
+ var isPlainObject2 = (value) => {
560
+ return value && typeof value === "object" && value.constructor === Object;
561
+ };
562
+ function warn(...a) {
563
+ const m = a.length === 1 ? a[0] : a[1];
564
+ const c = a.length === 2 ? a[0] : true;
565
+ if (c && process.env.NODE_ENV !== "production") {
566
+ console.warn(m);
567
+ }
568
+ }
569
+ function invariant(...a) {
570
+ const m = a.length === 1 ? a[0] : a[1];
571
+ const c = a.length === 2 ? a[0] : true;
572
+ if (c && process.env.NODE_ENV !== "production") {
573
+ throw new Error(m);
574
+ }
575
+ }
576
+
577
+ // ../../node_modules/klona/full/index.mjs
578
+ function set(obj, key, val) {
579
+ if (typeof val.value === "object") val.value = klona(val.value);
580
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
581
+ Object.defineProperty(obj, key, val);
582
+ } else obj[key] = val.value;
583
+ }
584
+ function klona(x) {
585
+ if (typeof x !== "object") return x;
586
+ var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
587
+ if (str === "[object Object]") {
588
+ tmp = Object.create(x.__proto__ || null);
589
+ } else if (str === "[object Array]") {
590
+ tmp = Array(x.length);
591
+ } else if (str === "[object Set]") {
592
+ tmp = /* @__PURE__ */ new Set();
593
+ x.forEach(function(val) {
594
+ tmp.add(klona(val));
595
+ });
596
+ } else if (str === "[object Map]") {
597
+ tmp = /* @__PURE__ */ new Map();
598
+ x.forEach(function(val, key) {
599
+ tmp.set(klona(key), klona(val));
600
+ });
601
+ } else if (str === "[object Date]") {
602
+ tmp = /* @__PURE__ */ new Date(+x);
603
+ } else if (str === "[object RegExp]") {
604
+ tmp = new RegExp(x.source, x.flags);
605
+ } else if (str === "[object DataView]") {
606
+ tmp = new x.constructor(klona(x.buffer));
607
+ } else if (str === "[object ArrayBuffer]") {
608
+ tmp = x.slice(0);
609
+ } else if (str.slice(-6) === "Array]") {
610
+ tmp = new x.constructor(x);
611
+ }
612
+ if (tmp) {
613
+ for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
614
+ set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
615
+ }
616
+ for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
617
+ if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k]) continue;
618
+ set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
619
+ }
620
+ }
621
+ return tmp || x;
622
+ }
623
+
624
+ // ../../node_modules/@zag-js/core/dist/index.mjs
625
+ var __defProp = Object.defineProperty;
626
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
627
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
628
+ function deepMerge(source, ...objects) {
629
+ for (const obj of objects) {
630
+ const target = compact(obj);
631
+ for (const key in target) {
632
+ if (isPlainObject(obj[key])) {
633
+ if (!source[key]) {
634
+ source[key] = {};
635
+ }
636
+ deepMerge(source[key], obj[key]);
637
+ } else {
638
+ source[key] = obj[key];
639
+ }
640
+ }
641
+ }
642
+ return source;
643
+ }
644
+ function structuredClone(v) {
645
+ return klona(v);
646
+ }
647
+ function toEvent(event) {
648
+ const obj = isString(event) ? { type: event } : event;
649
+ return obj;
650
+ }
651
+ function toArray(value) {
652
+ if (!value) return [];
653
+ return isArray(value) ? value.slice() : [value];
654
+ }
655
+ function isGuardHelper(value) {
656
+ return isObject3(value) && value.predicate != null;
657
+ }
658
+ var Truthy = () => true;
659
+ function determineGuardFn(guard, guardMap) {
660
+ guard = guard != null ? guard : Truthy;
661
+ return (context, event, meta) => {
662
+ if (isString(guard)) {
663
+ const value = guardMap[guard];
664
+ return isFunction(value) ? value(context, event, meta) : value;
665
+ }
666
+ if (isGuardHelper(guard)) {
667
+ return guard.predicate(guardMap)(context, event, meta);
668
+ }
669
+ return guard == null ? void 0 : guard(context, event, meta);
670
+ };
671
+ }
672
+ function determineActionsFn(values, guardMap) {
673
+ return (context, event, meta) => {
674
+ if (isGuardHelper(values)) {
675
+ return values.predicate(guardMap)(context, event, meta);
676
+ }
677
+ return values;
678
+ };
679
+ }
680
+ function createProxy2(config) {
681
+ var _a, _b, _c, _d, _e;
682
+ const computedContext = (_a = config.computed) != null ? _a : cast({});
683
+ const initialContext = (_b = config.context) != null ? _b : cast({});
684
+ const initialTags = config.initial ? (_d = (_c = config.states) == null ? void 0 : _c[config.initial]) == null ? void 0 : _d.tags : [];
685
+ const state = proxy({
686
+ value: (_e = config.initial) != null ? _e : "",
687
+ previousValue: "",
688
+ event: cast({}),
689
+ previousEvent: cast({}),
690
+ context: proxyWithComputed(initialContext, computedContext),
691
+ done: false,
692
+ tags: initialTags != null ? initialTags : [],
693
+ hasTag(tag) {
694
+ return this.tags.includes(tag);
695
+ },
696
+ matches(...value) {
697
+ return value.includes(this.value);
698
+ },
699
+ can(event) {
700
+ return cast(this).nextEvents.includes(event);
701
+ },
702
+ get nextEvents() {
703
+ var _a2, _b2, _c2, _d2;
704
+ const stateEvents = (_c2 = (_b2 = (_a2 = config.states) == null ? void 0 : _a2[this.value]) == null ? void 0 : _b2["on"]) != null ? _c2 : {};
705
+ const globalEvents = (_d2 = config == null ? void 0 : config.on) != null ? _d2 : {};
706
+ return Object.keys({ ...stateEvents, ...globalEvents });
707
+ },
708
+ get changed() {
709
+ if (this.event.value === "machine.init" || !this.previousValue) return false;
710
+ return this.value !== this.previousValue;
711
+ }
712
+ });
713
+ return cast(state);
714
+ }
715
+ function determineDelayFn(delay, delaysMap) {
716
+ return (context, event) => {
717
+ if (isNumber(delay)) return delay;
718
+ if (isFunction(delay)) {
719
+ return delay(context, event);
720
+ }
721
+ if (isString(delay)) {
722
+ const value = Number.parseFloat(delay);
723
+ if (!Number.isNaN(value)) {
724
+ return value;
725
+ }
726
+ if (delaysMap) {
727
+ const valueOrFn = delaysMap == null ? void 0 : delaysMap[delay];
728
+ invariant(
729
+ valueOrFn == null,
730
+ `[@zag-js/core > determine-delay] Cannot determine delay for \`${delay}\`. It doesn't exist in \`options.delays\``
731
+ );
732
+ return isFunction(valueOrFn) ? valueOrFn(context, event) : valueOrFn;
733
+ }
734
+ }
735
+ };
736
+ }
737
+ function toTarget(target) {
738
+ return isString(target) ? { target } : target;
739
+ }
740
+ function determineTransitionFn(transitions, guardMap) {
741
+ return (context, event, meta) => {
742
+ return toArray(transitions).map(toTarget).find((transition) => {
743
+ var _a;
744
+ const determineGuard = determineGuardFn(transition.guard, guardMap);
745
+ const guard = determineGuard(context, event, meta);
746
+ return (_a = guard != null ? guard : transition.target) != null ? _a : transition.actions;
747
+ });
748
+ };
749
+ }
750
+ var Machine = class {
751
+ // Let's get started!
752
+ constructor(config, options) {
753
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
754
+ __publicField(
755
+ this,
756
+ "status",
757
+ "Not Started"
758
+ /* NotStarted */
759
+ );
760
+ __publicField(this, "state");
761
+ __publicField(this, "initialState");
762
+ __publicField(this, "initialContext");
763
+ __publicField(this, "id");
764
+ __publicField(
765
+ this,
766
+ "type",
767
+ "machine"
768
+ /* Machine */
769
+ );
770
+ __publicField(this, "activityEvents", /* @__PURE__ */ new Map());
771
+ __publicField(this, "delayedEvents", /* @__PURE__ */ new Map());
772
+ __publicField(this, "stateListeners", /* @__PURE__ */ new Set());
773
+ __publicField(this, "doneListeners", /* @__PURE__ */ new Set());
774
+ __publicField(this, "contextWatchers", /* @__PURE__ */ new Set());
775
+ __publicField(this, "removeStateListener", noop);
776
+ __publicField(this, "parent");
777
+ __publicField(this, "children", /* @__PURE__ */ new Map());
778
+ __publicField(this, "guardMap");
779
+ __publicField(this, "actionMap");
780
+ __publicField(this, "delayMap");
781
+ __publicField(this, "activityMap");
782
+ __publicField(this, "sync");
783
+ __publicField(this, "options");
784
+ __publicField(this, "config");
785
+ __publicField(this, "_created", () => {
786
+ var _a2;
787
+ const event = toEvent(
788
+ "machine.created"
789
+ /* Created */
790
+ );
791
+ this.executeActions((_a2 = this.config) == null ? void 0 : _a2.created, event);
792
+ });
793
+ __publicField(this, "start", (init) => {
794
+ this.state.value = "";
795
+ this.state.tags = [];
796
+ if (this.status === "Running") {
797
+ return this;
798
+ }
799
+ this.status = "Running";
800
+ this.removeStateListener = subscribe(
801
+ this.state,
802
+ () => {
803
+ this.stateListeners.forEach((listener) => {
804
+ listener(this.stateSnapshot);
805
+ });
806
+ },
807
+ this.sync
808
+ );
809
+ this.setupContextWatchers();
810
+ this.executeActivities(
811
+ toEvent(
812
+ "machine.start"
813
+ /* Start */
814
+ ),
815
+ toArray(this.config.activities),
816
+ "machine.start"
817
+ /* Start */
818
+ );
819
+ this.executeActions(this.config.entry, toEvent(
820
+ "machine.start"
821
+ /* Start */
822
+ ));
823
+ const event = toEvent(
824
+ "machine.init"
825
+ /* Init */
826
+ );
827
+ const target = isObject3(init) ? init.value : init;
828
+ const context = isObject3(init) ? init.context : void 0;
829
+ if (context) {
830
+ this.setContext(context);
831
+ }
832
+ const transition = {
833
+ target: target != null ? target : this.config.initial
834
+ };
835
+ const next = this.getNextStateInfo(transition, event);
836
+ this.initialState = next;
837
+ this.performStateChangeEffects(this.state.value, next, event);
838
+ return this;
839
+ });
840
+ __publicField(this, "setupContextWatchers", () => {
841
+ const { watch } = this.config;
842
+ if (!watch) return;
843
+ let prev = snapshot(this.state.context);
844
+ const cleanup = subscribe(this.state.context, () => {
845
+ var _a2, _b2;
846
+ const next = snapshot(this.state.context);
847
+ for (const [key, fn] of Object.entries(watch)) {
848
+ const isEqual2 = (_b2 = (_a2 = this.options.compareFns) == null ? void 0 : _a2[key]) != null ? _b2 : Object.is;
849
+ if (isEqual2(prev[key], next[key])) continue;
850
+ this.executeActions(fn, this.state.event);
851
+ }
852
+ prev = next;
853
+ });
854
+ this.contextWatchers.add(cleanup);
855
+ });
856
+ __publicField(this, "stop", () => {
857
+ if (this.status === "Stopped") return;
858
+ this.performExitEffects(this.state.value, toEvent(
859
+ "machine.stop"
860
+ /* Stop */
861
+ ));
862
+ this.executeActions(this.config.exit, toEvent(
863
+ "machine.stop"
864
+ /* Stop */
865
+ ));
866
+ this.setState("");
867
+ this.setEvent(
868
+ "machine.stop"
869
+ /* Stop */
870
+ );
871
+ this.stopStateListeners();
872
+ this.stopChildren();
873
+ this.stopActivities();
874
+ this.stopDelayedEvents();
875
+ this.stopContextWatchers();
876
+ this.status = "Stopped";
877
+ return this;
878
+ });
879
+ __publicField(this, "stopStateListeners", () => {
880
+ this.removeStateListener();
881
+ this.stateListeners.clear();
882
+ });
883
+ __publicField(this, "stopContextWatchers", () => {
884
+ this.contextWatchers.forEach((fn) => fn());
885
+ this.contextWatchers.clear();
886
+ });
887
+ __publicField(this, "stopDelayedEvents", () => {
888
+ this.delayedEvents.forEach((state) => {
889
+ state.forEach((stop) => stop());
890
+ });
891
+ this.delayedEvents.clear();
892
+ });
893
+ __publicField(this, "stopActivities", (state) => {
894
+ var _a2, _b2;
895
+ if (state) {
896
+ (_a2 = this.activityEvents.get(state)) == null ? void 0 : _a2.forEach((stop) => stop());
897
+ (_b2 = this.activityEvents.get(state)) == null ? void 0 : _b2.clear();
898
+ this.activityEvents.delete(state);
899
+ } else {
900
+ this.activityEvents.forEach((state2) => {
901
+ state2.forEach((stop) => stop());
902
+ state2.clear();
903
+ });
904
+ this.activityEvents.clear();
905
+ }
906
+ });
907
+ __publicField(this, "sendChild", (evt, to) => {
908
+ const event = toEvent(evt);
909
+ const id = runIfFn(to, this.contextSnapshot);
910
+ const child = this.children.get(id);
911
+ if (!child) {
912
+ invariant(`[@zag-js/core] Cannot send '${event.type}' event to unknown child`);
913
+ }
914
+ child.send(event);
915
+ });
916
+ __publicField(this, "stopChild", (id) => {
917
+ if (!this.children.has(id)) {
918
+ invariant(`[@zag-js/core > stop-child] Cannot stop unknown child ${id}`);
919
+ }
920
+ this.children.get(id).stop();
921
+ this.children.delete(id);
922
+ });
923
+ __publicField(this, "removeChild", (id) => {
924
+ this.children.delete(id);
925
+ });
926
+ __publicField(this, "stopChildren", () => {
927
+ this.children.forEach((child) => child.stop());
928
+ this.children.clear();
929
+ });
930
+ __publicField(this, "setParent", (parent) => {
931
+ this.parent = parent;
932
+ });
933
+ __publicField(this, "spawn", (src, id) => {
934
+ const actor = runIfFn(src);
935
+ if (id) actor.id = id;
936
+ actor.type = "machine.actor";
937
+ actor.setParent(this);
938
+ this.children.set(actor.id, cast(actor));
939
+ actor.onDone(() => {
940
+ this.removeChild(actor.id);
941
+ }).start();
942
+ return cast(ref(actor));
943
+ });
944
+ __publicField(this, "stopActivity", (key) => {
945
+ var _a2;
946
+ if (!this.state.value) return;
947
+ const cleanups = this.activityEvents.get(this.state.value);
948
+ (_a2 = cleanups == null ? void 0 : cleanups.get(key)) == null ? void 0 : _a2();
949
+ cleanups == null ? void 0 : cleanups.delete(key);
950
+ });
951
+ __publicField(this, "addActivityCleanup", (state, key, cleanup) => {
952
+ var _a2;
953
+ if (!state) return;
954
+ if (!this.activityEvents.has(state)) {
955
+ this.activityEvents.set(state, /* @__PURE__ */ new Map([[key, cleanup]]));
956
+ } else {
957
+ (_a2 = this.activityEvents.get(state)) == null ? void 0 : _a2.set(key, cleanup);
958
+ }
959
+ });
960
+ __publicField(this, "setState", (target) => {
961
+ this.state.previousValue = this.state.value;
962
+ this.state.value = target;
963
+ const stateNode = this.getStateNode(target);
964
+ if (target == null) {
965
+ clear(this.state.tags);
966
+ } else {
967
+ this.state.tags = toArray(stateNode == null ? void 0 : stateNode.tags);
968
+ }
969
+ });
970
+ __publicField(this, "setContext", (context) => {
971
+ if (!context) return;
972
+ deepMerge(this.state.context, compact(context));
973
+ });
974
+ __publicField(this, "setOptions", (options2) => {
975
+ const opts = compact(options2);
976
+ this.actionMap = { ...this.actionMap, ...opts.actions };
977
+ this.delayMap = { ...this.delayMap, ...opts.delays };
978
+ this.activityMap = { ...this.activityMap, ...opts.activities };
979
+ this.guardMap = { ...this.guardMap, ...opts.guards };
980
+ });
981
+ __publicField(this, "getStateNode", (state) => {
982
+ var _a2;
983
+ if (!state) return;
984
+ return (_a2 = this.config.states) == null ? void 0 : _a2[state];
985
+ });
986
+ __publicField(this, "getNextStateInfo", (transitions, event) => {
987
+ var _a2;
988
+ const transition = this.determineTransition(transitions, event);
989
+ const isTargetless = !(transition == null ? void 0 : transition.target);
990
+ const target = (_a2 = transition == null ? void 0 : transition.target) != null ? _a2 : this.state.value;
991
+ const changed = this.state.value !== target;
992
+ const stateNode = this.getStateNode(target);
993
+ const reenter = !isTargetless && !changed && !(transition == null ? void 0 : transition.internal);
994
+ const info = {
995
+ reenter,
996
+ transition,
997
+ stateNode,
998
+ target,
999
+ changed
1000
+ };
1001
+ this.log("NextState:", `[${event.type}]`, this.state.value, "---->", info.target);
1002
+ return info;
1003
+ });
1004
+ __publicField(this, "getAfterActions", (transition, delay) => {
1005
+ let id;
1006
+ const current = this.state.value;
1007
+ return {
1008
+ entry: () => {
1009
+ id = globalThis.setTimeout(() => {
1010
+ const next = this.getNextStateInfo(transition, this.state.event);
1011
+ this.performStateChangeEffects(current, next, this.state.event);
1012
+ }, delay);
1013
+ },
1014
+ exit: () => {
1015
+ globalThis.clearTimeout(id);
1016
+ }
1017
+ };
1018
+ });
1019
+ __publicField(this, "getDelayedEventActions", (state) => {
1020
+ const stateNode = this.getStateNode(state);
1021
+ const event = this.state.event;
1022
+ if (!stateNode || !stateNode.after) return;
1023
+ const entries = [];
1024
+ const exits = [];
1025
+ if (isArray(stateNode.after)) {
1026
+ const transition = this.determineTransition(stateNode.after, event);
1027
+ if (!transition) return;
1028
+ if (!hasProp(transition, "delay")) {
1029
+ throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(transition)}`);
1030
+ }
1031
+ const determineDelay = determineDelayFn(transition.delay, this.delayMap);
1032
+ const __delay = determineDelay(this.contextSnapshot, event);
1033
+ const actions = this.getAfterActions(transition, __delay);
1034
+ entries.push(actions.entry);
1035
+ exits.push(actions.exit);
1036
+ return { entries, exits };
1037
+ }
1038
+ if (isObject3(stateNode.after)) {
1039
+ for (const delay in stateNode.after) {
1040
+ const transition = stateNode.after[delay];
1041
+ const determineDelay = determineDelayFn(delay, this.delayMap);
1042
+ const __delay = determineDelay(this.contextSnapshot, event);
1043
+ const actions = this.getAfterActions(transition, __delay);
1044
+ entries.push(actions.entry);
1045
+ exits.push(actions.exit);
1046
+ }
1047
+ }
1048
+ return { entries, exits };
1049
+ });
1050
+ __publicField(this, "executeActions", (actions, event) => {
1051
+ var _a2;
1052
+ const pickedActions = determineActionsFn(actions, this.guardMap)(this.contextSnapshot, event, this.guardMeta);
1053
+ for (const action of toArray(pickedActions)) {
1054
+ const fn = isString(action) ? (_a2 = this.actionMap) == null ? void 0 : _a2[action] : action;
1055
+ warn(
1056
+ isString(action) && !fn,
1057
+ `[@zag-js/core > execute-actions] No implementation found for action: \`${action}\``
1058
+ );
1059
+ fn == null ? void 0 : fn(this.state.context, event, this.meta);
1060
+ }
1061
+ });
1062
+ __publicField(this, "executeActivities", (event, activities, state) => {
1063
+ var _a2;
1064
+ for (const activity of activities) {
1065
+ const fn = isString(activity) ? (_a2 = this.activityMap) == null ? void 0 : _a2[activity] : activity;
1066
+ if (!fn) {
1067
+ warn(`[@zag-js/core > execute-activity] No implementation found for activity: \`${activity}\``);
1068
+ continue;
1069
+ }
1070
+ const cleanup = fn(this.state.context, event, this.meta);
1071
+ if (cleanup) {
1072
+ const key = isString(activity) ? activity : activity.name || uuid();
1073
+ this.addActivityCleanup(state != null ? state : this.state.value, key, cleanup);
1074
+ }
1075
+ }
1076
+ });
1077
+ __publicField(this, "createEveryActivities", (every, callbackfn) => {
1078
+ if (!every) return;
1079
+ if (isArray(every)) {
1080
+ const picked = toArray(every).find((transition) => {
1081
+ const delayOrFn = transition.delay;
1082
+ const determineDelay2 = determineDelayFn(delayOrFn, this.delayMap);
1083
+ const delay2 = determineDelay2(this.contextSnapshot, this.state.event);
1084
+ const determineGuard = determineGuardFn(transition.guard, this.guardMap);
1085
+ const guard = determineGuard(this.contextSnapshot, this.state.event, this.guardMeta);
1086
+ return guard != null ? guard : delay2 != null;
1087
+ });
1088
+ if (!picked) return;
1089
+ const determineDelay = determineDelayFn(picked.delay, this.delayMap);
1090
+ const delay = determineDelay(this.contextSnapshot, this.state.event);
1091
+ const activity = () => {
1092
+ const id = globalThis.setInterval(() => {
1093
+ this.executeActions(picked.actions, this.state.event);
1094
+ }, delay);
1095
+ return () => {
1096
+ globalThis.clearInterval(id);
1097
+ };
1098
+ };
1099
+ callbackfn(activity);
1100
+ } else {
1101
+ for (const interval in every) {
1102
+ const actions = every == null ? void 0 : every[interval];
1103
+ const determineDelay = determineDelayFn(interval, this.delayMap);
1104
+ const delay = determineDelay(this.contextSnapshot, this.state.event);
1105
+ const activity = () => {
1106
+ const id = globalThis.setInterval(() => {
1107
+ this.executeActions(actions, this.state.event);
1108
+ }, delay);
1109
+ return () => {
1110
+ globalThis.clearInterval(id);
1111
+ };
1112
+ };
1113
+ callbackfn(activity);
1114
+ }
1115
+ }
1116
+ });
1117
+ __publicField(this, "setEvent", (event) => {
1118
+ this.state.previousEvent = this.state.event;
1119
+ this.state.event = ref(toEvent(event));
1120
+ });
1121
+ __publicField(this, "performExitEffects", (current, event) => {
1122
+ const currentState = this.state.value;
1123
+ if (currentState === "") return;
1124
+ const stateNode = current ? this.getStateNode(current) : void 0;
1125
+ this.stopActivities(currentState);
1126
+ const _exit = determineActionsFn(stateNode == null ? void 0 : stateNode.exit, this.guardMap)(this.contextSnapshot, event, this.guardMeta);
1127
+ const exitActions = toArray(_exit);
1128
+ const afterExitActions = this.delayedEvents.get(currentState);
1129
+ if (afterExitActions) {
1130
+ exitActions.push(...afterExitActions);
1131
+ }
1132
+ this.executeActions(exitActions, event);
1133
+ this.delayedEvents.delete(currentState);
1134
+ });
1135
+ __publicField(this, "performEntryEffects", (next, event) => {
1136
+ const stateNode = this.getStateNode(next);
1137
+ const activities = toArray(stateNode == null ? void 0 : stateNode.activities);
1138
+ this.createEveryActivities(stateNode == null ? void 0 : stateNode.every, (activity) => {
1139
+ activities.unshift(activity);
1140
+ });
1141
+ if (activities.length > 0) {
1142
+ this.executeActivities(event, activities);
1143
+ }
1144
+ const pickedActions = determineActionsFn(stateNode == null ? void 0 : stateNode.entry, this.guardMap)(
1145
+ this.contextSnapshot,
1146
+ event,
1147
+ this.guardMeta
1148
+ );
1149
+ const entryActions = toArray(pickedActions);
1150
+ const afterActions = this.getDelayedEventActions(next);
1151
+ if ((stateNode == null ? void 0 : stateNode.after) && afterActions) {
1152
+ this.delayedEvents.set(next, afterActions == null ? void 0 : afterActions.exits);
1153
+ entryActions.push(...afterActions.entries);
1154
+ }
1155
+ this.executeActions(entryActions, event);
1156
+ if ((stateNode == null ? void 0 : stateNode.type) === "final") {
1157
+ this.state.done = true;
1158
+ this.doneListeners.forEach((listener) => {
1159
+ listener(this.stateSnapshot);
1160
+ });
1161
+ this.stop();
1162
+ }
1163
+ });
1164
+ __publicField(this, "performTransitionEffects", (transitions, event) => {
1165
+ const transition = this.determineTransition(transitions, event);
1166
+ this.executeActions(transition == null ? void 0 : transition.actions, event);
1167
+ });
1168
+ __publicField(this, "performStateChangeEffects", (current, next, event) => {
1169
+ this.setEvent(event);
1170
+ const changed = next.changed || next.reenter;
1171
+ if (changed) {
1172
+ this.performExitEffects(current, event);
1173
+ }
1174
+ this.performTransitionEffects(next.transition, event);
1175
+ this.setState(next.target);
1176
+ if (changed) {
1177
+ this.performEntryEffects(next.target, event);
1178
+ }
1179
+ });
1180
+ __publicField(this, "determineTransition", (transition, event) => {
1181
+ const fn = determineTransitionFn(transition, this.guardMap);
1182
+ return fn == null ? void 0 : fn(this.contextSnapshot, event, this.guardMeta);
1183
+ });
1184
+ __publicField(this, "sendParent", (evt) => {
1185
+ var _a2;
1186
+ if (!this.parent) {
1187
+ invariant("[@zag-js/core > send-parent] Cannot send event to an unknown parent");
1188
+ }
1189
+ const event = toEvent(evt);
1190
+ (_a2 = this.parent) == null ? void 0 : _a2.send(event);
1191
+ });
1192
+ __publicField(this, "log", (...args) => {
1193
+ if (isDev2() && this.options.debug) {
1194
+ console.log(...args);
1195
+ }
1196
+ });
1197
+ __publicField(this, "send", (evt) => {
1198
+ const event = toEvent(evt);
1199
+ this.transition(this.state.value, event);
1200
+ });
1201
+ __publicField(this, "transition", (state, evt) => {
1202
+ var _a2, _b2, _c2;
1203
+ const stateNode = isString(state) ? this.getStateNode(state) : state == null ? void 0 : state.stateNode;
1204
+ const event = toEvent(evt);
1205
+ if (!stateNode && !this.config.on) {
1206
+ const msg = this.status === "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}`;
1207
+ warn(msg);
1208
+ return;
1209
+ }
1210
+ const transitions = (
1211
+ // @ts-expect-error - Fix this
1212
+ (_c2 = (_a2 = stateNode == null ? void 0 : stateNode.on) == null ? void 0 : _a2[event.type]) != null ? _c2 : (_b2 = this.config.on) == null ? void 0 : _b2[event.type]
1213
+ );
1214
+ const next = this.getNextStateInfo(transitions, event);
1215
+ this.performStateChangeEffects(this.state.value, next, event);
1216
+ return next.stateNode;
1217
+ });
1218
+ __publicField(this, "subscribe", (listener) => {
1219
+ this.stateListeners.add(listener);
1220
+ if (this.status === "Running") {
1221
+ listener(this.stateSnapshot);
1222
+ }
1223
+ return () => {
1224
+ this.stateListeners.delete(listener);
1225
+ };
1226
+ });
1227
+ __publicField(this, "onDone", (listener) => {
1228
+ this.doneListeners.add(listener);
1229
+ return this;
1230
+ });
1231
+ __publicField(this, "onTransition", (listener) => {
1232
+ this.stateListeners.add(listener);
1233
+ if (this.status === "Running") {
1234
+ listener(this.stateSnapshot);
1235
+ }
1236
+ return this;
1237
+ });
1238
+ this.config = structuredClone(config);
1239
+ this.options = structuredClone(options != null ? options : {});
1240
+ this.id = (_a = this.config.id) != null ? _a : `machine-${uuid()}`;
1241
+ this.guardMap = (_c = (_b = this.options) == null ? void 0 : _b.guards) != null ? _c : {};
1242
+ this.actionMap = (_e = (_d = this.options) == null ? void 0 : _d.actions) != null ? _e : {};
1243
+ this.delayMap = (_g = (_f = this.options) == null ? void 0 : _f.delays) != null ? _g : {};
1244
+ this.activityMap = (_i = (_h = this.options) == null ? void 0 : _h.activities) != null ? _i : {};
1245
+ this.sync = (_k = (_j = this.options) == null ? void 0 : _j.sync) != null ? _k : false;
1246
+ this.state = createProxy2(this.config);
1247
+ this.initialContext = snapshot(this.state.context);
1248
+ }
1249
+ // immutable state value
1250
+ get stateSnapshot() {
1251
+ return cast(snapshot(this.state));
1252
+ }
1253
+ getState() {
1254
+ return this.stateSnapshot;
1255
+ }
1256
+ // immutable context value
1257
+ get contextSnapshot() {
1258
+ return this.stateSnapshot.context;
1259
+ }
1260
+ /**
1261
+ * A reference to the instance methods of the machine.
1262
+ * Useful when spawning child machines and managing the communication between them.
1263
+ */
1264
+ get self() {
1265
+ const self2 = this;
1266
+ return {
1267
+ id: this.id,
1268
+ send: this.send.bind(this),
1269
+ sendParent: this.sendParent.bind(this),
1270
+ sendChild: this.sendChild.bind(this),
1271
+ stop: this.stop.bind(this),
1272
+ stopChild: this.stopChild.bind(this),
1273
+ spawn: this.spawn.bind(this),
1274
+ stopActivity: this.stopActivity.bind(this),
1275
+ get state() {
1276
+ return self2.stateSnapshot;
1277
+ },
1278
+ get initialContext() {
1279
+ return self2.initialContext;
1280
+ },
1281
+ get initialState() {
1282
+ var _a, _b;
1283
+ return (_b = (_a = self2.initialState) == null ? void 0 : _a.target) != null ? _b : "";
1284
+ }
1285
+ };
1286
+ }
1287
+ get meta() {
1288
+ var _a, _b;
1289
+ return {
1290
+ state: this.stateSnapshot,
1291
+ guards: this.guardMap,
1292
+ send: this.send.bind(this),
1293
+ self: this.self,
1294
+ initialContext: this.initialContext,
1295
+ initialState: (_b = (_a = this.initialState) == null ? void 0 : _a.target) != null ? _b : "",
1296
+ getState: () => this.stateSnapshot,
1297
+ getAction: (key) => this.actionMap[key],
1298
+ getGuard: (key) => this.guardMap[key]
1299
+ };
1300
+ }
1301
+ get guardMeta() {
1302
+ return {
1303
+ state: this.stateSnapshot
1304
+ };
1305
+ }
1306
+ get [Symbol.toStringTag]() {
1307
+ return "Machine";
1308
+ }
1309
+ getHydrationState() {
1310
+ const state = this.getState();
1311
+ return {
1312
+ value: state.value,
1313
+ tags: state.tags
1314
+ };
1315
+ }
1316
+ };
1317
+ var createMachine = (config, options) => new Machine(config, options);
1318
+ var clsx = (...args) => args.map((str) => {
1319
+ var _a;
1320
+ return (_a = str == null ? void 0 : str.trim) == null ? void 0 : _a.call(str);
1321
+ }).filter(Boolean).join(" ");
1322
+ var CSS_REGEX = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;
1323
+ var serialize = (style) => {
1324
+ const res = {};
1325
+ let match;
1326
+ while (match = CSS_REGEX.exec(style)) {
1327
+ res[match[1]] = match[2];
1328
+ }
1329
+ return res;
1330
+ };
1331
+ var css = (a, b) => {
1332
+ if (isString(a)) {
1333
+ if (isString(b)) return `${a};${b}`;
1334
+ a = serialize(a);
1335
+ } else if (isString(b)) {
1336
+ b = serialize(b);
1337
+ }
1338
+ return Object.assign({}, a != null ? a : {}, b != null ? b : {});
1339
+ };
1340
+ function mergeProps(...args) {
1341
+ let result = {};
1342
+ for (let props2 of args) {
1343
+ for (let key in result) {
1344
+ if (key.startsWith("on") && typeof result[key] === "function" && typeof props2[key] === "function") {
1345
+ result[key] = callAll(props2[key], result[key]);
1346
+ continue;
1347
+ }
1348
+ if (key === "className" || key === "class") {
1349
+ result[key] = clsx(result[key], props2[key]);
1350
+ continue;
1351
+ }
1352
+ if (key === "style") {
1353
+ result[key] = css(result[key], props2[key]);
1354
+ continue;
1355
+ }
1356
+ result[key] = props2[key] !== void 0 ? props2[key] : result[key];
1357
+ }
1358
+ for (let key in props2) {
1359
+ if (result[key] === void 0) {
1360
+ result[key] = props2[key];
1361
+ }
1362
+ }
1363
+ }
1364
+ return result;
1365
+ }
1366
+
1367
+ // ../../node_modules/@ark-ui/react/dist/components/factory.js
1368
+ import { memo, forwardRef, createElement, Children, isValidElement, cloneElement } from "react";
1369
+ function getRef(element) {
1370
+ var _a, _b;
1371
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
1372
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1373
+ if (mayWarn) {
1374
+ return element.ref;
1375
+ }
1376
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
1377
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1378
+ if (mayWarn) {
1379
+ return element.props.ref;
1380
+ }
1381
+ return element.props.ref || element.ref;
1382
+ }
1383
+ var withAsChild = (Component) => {
1384
+ const Comp = memo(
1385
+ forwardRef((props2, ref2) => {
1386
+ const { asChild, children, ...restProps } = props2;
1387
+ if (!asChild) {
1388
+ return createElement(Component, { ...restProps, ref: ref2 }, children);
1389
+ }
1390
+ const onlyChild = Children.only(children);
1391
+ if (!isValidElement(onlyChild)) {
1392
+ return null;
1393
+ }
1394
+ const childRef = getRef(onlyChild);
1395
+ return cloneElement(onlyChild, {
1396
+ ...mergeProps(restProps, onlyChild.props),
1397
+ ref: ref2 ? composeRefs(ref2, childRef) : childRef
1398
+ });
1399
+ })
1400
+ );
1401
+ Comp.displayName = Component.displayName || Component.name;
1402
+ return Comp;
1403
+ };
1404
+ var jsxFactory = () => {
1405
+ const cache = /* @__PURE__ */ new Map();
1406
+ return new Proxy(withAsChild, {
1407
+ apply(_target, _thisArg, argArray) {
1408
+ return withAsChild(argArray[0]);
1409
+ },
1410
+ get(_, element) {
1411
+ const asElement = element;
1412
+ if (!cache.has(asElement)) {
1413
+ cache.set(asElement, withAsChild(asElement));
1414
+ }
1415
+ return cache.get(asElement);
1416
+ }
1417
+ });
1418
+ };
1419
+ var ark = jsxFactory();
1420
+
1421
+ // ../../node_modules/@ark-ui/react/dist/utils/create-split-props.js
1422
+ var createSplitProps = () => (props2, keys) => keys.reduce(
1423
+ (previousValue, currentValue) => {
1424
+ const [target, source] = previousValue;
1425
+ const key = currentValue;
1426
+ if (source[key] !== void 0) {
1427
+ target[key] = source[key];
1428
+ }
1429
+ delete source[key];
1430
+ return [target, source];
1431
+ },
1432
+ [{}, { ...props2 }]
1433
+ );
1434
+
1435
+ // ../../node_modules/@ark-ui/react/dist/components/presence/split-presence-props.js
1436
+ var splitPresenceProps = (props2) => createSplitProps()(props2, [
1437
+ "immediate",
1438
+ "lazyMount",
1439
+ "onExitComplete",
1440
+ "present",
1441
+ "unmountOnExit"
1442
+ ]);
1443
+
1444
+ // ../../node_modules/@zag-js/types/dist/index.mjs
1445
+ function createNormalizer(fn) {
1446
+ return new Proxy({}, {
1447
+ get() {
1448
+ return fn;
1449
+ }
1450
+ });
1451
+ }
1452
+ var createProps = () => (props2) => Array.from(new Set(props2));
1453
+
1454
+ // ../../node_modules/@zag-js/presence/dist/index.mjs
1455
+ function connect(state, send, _normalize) {
1456
+ const present = state.matches("mounted", "unmountSuspended");
1457
+ return {
1458
+ skip: !state.context.initial && present,
1459
+ present,
1460
+ setNode(node) {
1461
+ if (!node) return;
1462
+ send({ type: "NODE.SET", node });
1463
+ },
1464
+ unmount() {
1465
+ send({ type: "UNMOUNT" });
1466
+ }
1467
+ };
1468
+ }
1469
+ function machine(ctx) {
1470
+ return createMachine(
1471
+ {
1472
+ initial: ctx.present ? "mounted" : "unmounted",
1473
+ context: {
1474
+ node: null,
1475
+ styles: null,
1476
+ unmountAnimationName: null,
1477
+ prevAnimationName: null,
1478
+ present: false,
1479
+ initial: false,
1480
+ ...ctx
1481
+ },
1482
+ exit: ["clearInitial"],
1483
+ watch: {
1484
+ present: ["setInitial", "syncPresence"]
1485
+ },
1486
+ on: {
1487
+ "NODE.SET": {
1488
+ actions: ["setNode", "setStyles"]
1489
+ }
1490
+ },
1491
+ states: {
1492
+ mounted: {
1493
+ on: {
1494
+ UNMOUNT: {
1495
+ target: "unmounted",
1496
+ actions: ["invokeOnExitComplete"]
1497
+ },
1498
+ "UNMOUNT.SUSPEND": "unmountSuspended"
1499
+ }
1500
+ },
1501
+ unmountSuspended: {
1502
+ activities: ["trackAnimationEvents"],
1503
+ after: {
1504
+ // Fallback to timeout to ensure we exit this state even if the `animationend` event
1505
+ // did not get trigger
1506
+ ANIMATION_DURATION: {
1507
+ target: "unmounted",
1508
+ actions: ["invokeOnExitComplete"]
1509
+ }
1510
+ },
1511
+ on: {
1512
+ MOUNT: {
1513
+ target: "mounted",
1514
+ actions: ["setPrevAnimationName"]
1515
+ },
1516
+ UNMOUNT: {
1517
+ target: "unmounted",
1518
+ actions: ["invokeOnExitComplete"]
1519
+ }
1520
+ }
1521
+ },
1522
+ unmounted: {
1523
+ entry: ["clearPrevAnimationName"],
1524
+ on: {
1525
+ MOUNT: {
1526
+ target: "mounted",
1527
+ actions: ["setPrevAnimationName"]
1528
+ }
1529
+ }
1530
+ }
1531
+ }
1532
+ },
1533
+ {
1534
+ delays: {
1535
+ ANIMATION_DURATION(ctx2) {
1536
+ var _a, _b;
1537
+ return parseMs((_a = ctx2.styles) == null ? void 0 : _a.animationDuration) + parseMs((_b = ctx2.styles) == null ? void 0 : _b.animationDelay) + ANIMATION_TIMEOUT_MARGIN;
1538
+ }
1539
+ },
1540
+ actions: {
1541
+ setInitial(ctx2) {
1542
+ ctx2.initial = true;
1543
+ },
1544
+ clearInitial(ctx2) {
1545
+ ctx2.initial = false;
1546
+ },
1547
+ invokeOnExitComplete(ctx2) {
1548
+ var _a;
1549
+ (_a = ctx2.onExitComplete) == null ? void 0 : _a.call(ctx2);
1550
+ },
1551
+ setNode(ctx2, evt) {
1552
+ ctx2.node = ref(evt.node);
1553
+ },
1554
+ setStyles(ctx2, evt) {
1555
+ const win = evt.node.ownerDocument.defaultView || window;
1556
+ ctx2.styles = ref(win.getComputedStyle(evt.node));
1557
+ },
1558
+ syncPresence(ctx2, _evt, { send }) {
1559
+ var _a;
1560
+ if (ctx2.present) {
1561
+ send({ type: "MOUNT", src: "presence.changed" });
1562
+ return;
1563
+ }
1564
+ if (!ctx2.present && ((_a = ctx2.node) == null ? void 0 : _a.ownerDocument.visibilityState) === "hidden") {
1565
+ send({ type: "UNMOUNT", src: "visibilitychange" });
1566
+ return;
1567
+ }
1568
+ const animationName = getAnimationName(ctx2.styles);
1569
+ const exec = ctx2.immediate ? queueMicrotask : requestAnimationFrame;
1570
+ exec(() => {
1571
+ var _a2, _b;
1572
+ ctx2.unmountAnimationName = animationName;
1573
+ if (animationName === "none" || animationName === ctx2.prevAnimationName || ((_a2 = ctx2.styles) == null ? void 0 : _a2.display) === "none" || ((_b = ctx2.styles) == null ? void 0 : _b.animationDuration) === "0s") {
1574
+ send({ type: "UNMOUNT", src: "presence.changed" });
1575
+ } else {
1576
+ send({ type: "UNMOUNT.SUSPEND" });
1577
+ }
1578
+ });
1579
+ },
1580
+ setPrevAnimationName(ctx2) {
1581
+ const exec = ctx2.immediate ? queueMicrotask : requestAnimationFrame;
1582
+ exec(() => {
1583
+ ctx2.prevAnimationName = getAnimationName(ctx2.styles);
1584
+ });
1585
+ },
1586
+ clearPrevAnimationName(ctx2) {
1587
+ ctx2.prevAnimationName = null;
1588
+ }
1589
+ },
1590
+ activities: {
1591
+ trackAnimationEvents(ctx2, _evt, { send }) {
1592
+ const node = ctx2.node;
1593
+ if (!node) return;
1594
+ const onStart = (event) => {
1595
+ var _a, _b, _c;
1596
+ const target = (_c = (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)) == null ? void 0 : _b[0]) != null ? _c : event.target;
1597
+ if (target === node) {
1598
+ ctx2.prevAnimationName = getAnimationName(ctx2.styles);
1599
+ }
1600
+ };
1601
+ const onEnd = (event) => {
1602
+ var _a, _b, _c;
1603
+ const animationName = getAnimationName(ctx2.styles);
1604
+ const target = (_c = (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)) == null ? void 0 : _b[0]) != null ? _c : event.target;
1605
+ if (target === node && animationName === ctx2.unmountAnimationName) {
1606
+ send({ type: "UNMOUNT", src: "animationend" });
1607
+ }
1608
+ };
1609
+ node.addEventListener("animationstart", onStart);
1610
+ node.addEventListener("animationcancel", onEnd);
1611
+ node.addEventListener("animationend", onEnd);
1612
+ return () => {
1613
+ node.removeEventListener("animationstart", onStart);
1614
+ node.removeEventListener("animationcancel", onEnd);
1615
+ node.removeEventListener("animationend", onEnd);
1616
+ };
1617
+ }
1618
+ }
1619
+ }
1620
+ );
1621
+ }
1622
+ function getAnimationName(styles) {
1623
+ return (styles == null ? void 0 : styles.animationName) || "none";
1624
+ }
1625
+ function parseMs(value) {
1626
+ return parseFloat(value || "0") * 1e3;
1627
+ }
1628
+ var ANIMATION_TIMEOUT_MARGIN = 16.667;
1629
+ var props = createProps()(["onExitComplete", "present", "immediate"]);
1630
+
1631
+ // ../../node_modules/@zag-js/react/dist/index.mjs
1632
+ import ReactExport, { Children as Children2, useRef, useSyncExternalStore, useCallback, useMemo, useEffect, useLayoutEffect } from "react";
1633
+ import { createPortal } from "react-dom";
1634
+ import { jsx, Fragment } from "react/jsx-runtime";
1635
+ var normalizeProps = createNormalizer((v) => v);
1636
+ var isArrayLike = (value) => (value == null ? void 0 : value.constructor.name) === "Array";
1637
+ var isArrayEqual = (a, b) => {
1638
+ if (a.length !== b.length) return false;
1639
+ for (let i = 0; i < a.length; i++) {
1640
+ if (!isEqual(a[i], b[i])) return false;
1641
+ }
1642
+ return true;
1643
+ };
1644
+ var isEqual = (a, b) => {
1645
+ if (Object.is(a, b)) return true;
1646
+ if (a == null && b != null || a != null && b == null) return false;
1647
+ if (typeof (a == null ? void 0 : a.isEqual) === "function" && typeof (b == null ? void 0 : b.isEqual) === "function") {
1648
+ return a.isEqual(b);
1649
+ }
1650
+ if (typeof a === "function" && typeof b === "function") {
1651
+ return a.toString() === b.toString();
1652
+ }
1653
+ if (isArrayLike(a) && isArrayLike(b)) {
1654
+ return isArrayEqual(Array.from(a), Array.from(b));
1655
+ }
1656
+ if (!(typeof a === "object") || !(typeof b === "object")) return false;
1657
+ const keys = Object.keys(b != null ? b : /* @__PURE__ */ Object.create(null));
1658
+ const length = keys.length;
1659
+ for (let i = 0; i < length; i++) {
1660
+ const hasKey = Reflect.has(a, keys[i]);
1661
+ if (!hasKey) return false;
1662
+ }
1663
+ for (let i = 0; i < length; i++) {
1664
+ const key = keys[i];
1665
+ if (!isEqual(a[key], b[key])) return false;
1666
+ }
1667
+ return true;
1668
+ };
1669
+ var isDev3 = () => process.env.NODE_ENV !== "production";
1670
+ var fnToString2 = Function.prototype.toString;
1671
+ fnToString2.call(Object);
1672
+ function compact2(obj) {
1673
+ if (!isPlainObject3(obj) || obj === void 0) {
1674
+ return obj;
1675
+ }
1676
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
1677
+ const filtered = {};
1678
+ for (const key of keys) {
1679
+ const value = obj[key];
1680
+ if (value !== void 0) {
1681
+ filtered[key] = compact2(value);
1682
+ }
1683
+ }
1684
+ return filtered;
1685
+ }
1686
+ var isPlainObject3 = (value) => {
1687
+ return value && typeof value === "object" && value.constructor === Object;
1688
+ };
1689
+ function useUpdateEffect(callback, deps) {
1690
+ const render = useRef(false);
1691
+ const effect = useRef(false);
1692
+ useEffect(() => {
1693
+ const mounted = render.current;
1694
+ const run = mounted && effect.current;
1695
+ if (run) {
1696
+ return callback();
1697
+ }
1698
+ effect.current = true;
1699
+ }, deps);
1700
+ useEffect(() => {
1701
+ render.current = true;
1702
+ return () => {
1703
+ render.current = false;
1704
+ };
1705
+ }, []);
1706
+ }
1707
+ var { use } = ReactExport;
1708
+ var targetCache = makeGlobal("__zag__targetCache", () => /* @__PURE__ */ new WeakMap());
1709
+ function useSnapshot(service, options) {
1710
+ const { actions, context, sync: notifyInSync } = options != null ? options : {};
1711
+ const lastSnapshot = useRef();
1712
+ const lastAffected = useRef();
1713
+ const currSnapshot = useSyncExternalStore(
1714
+ useCallback((callback) => subscribe(service.state, callback, notifyInSync), [notifyInSync]),
1715
+ () => {
1716
+ const nextSnapshot = snapshot(service.state, use);
1717
+ try {
1718
+ if (lastSnapshot.current && lastAffected.current && !isChanged(lastSnapshot.current, nextSnapshot, lastAffected.current, /* @__PURE__ */ new WeakMap())) {
1719
+ return lastSnapshot.current;
1720
+ }
1721
+ } catch {
1722
+ }
1723
+ return nextSnapshot;
1724
+ },
1725
+ () => snapshot(service.state, use)
1726
+ );
1727
+ service.setOptions({ actions });
1728
+ const ctx = useMemo(() => compact2(context != null ? context : {}), [context]);
1729
+ useUpdateEffect(() => {
1730
+ var _a;
1731
+ const entries = Object.entries(ctx);
1732
+ const previousCtx = (_a = service.contextSnapshot) != null ? _a : {};
1733
+ const equality = entries.map(([key, value]) => ({
1734
+ key,
1735
+ curr: value,
1736
+ prev: previousCtx[key],
1737
+ equal: isEqual(previousCtx[key], value)
1738
+ }));
1739
+ const allEqual = equality.every(({ equal }) => equal);
1740
+ if (!allEqual) {
1741
+ service.setContext(ctx);
1742
+ }
1743
+ }, [ctx]);
1744
+ const currAffected = /* @__PURE__ */ new WeakMap();
1745
+ useEffect(() => {
1746
+ lastSnapshot.current = currSnapshot;
1747
+ lastAffected.current = currAffected;
1748
+ });
1749
+ const proxyCache = useMemo(() => /* @__PURE__ */ new WeakMap(), []);
1750
+ return createProxy(currSnapshot, currAffected, proxyCache, targetCache);
1751
+ }
1752
+ function useConstant(fn) {
1753
+ const ref2 = useRef();
1754
+ if (!ref2.current) ref2.current = { v: fn() };
1755
+ return ref2.current.v;
1756
+ }
1757
+ var useSafeLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
1758
+ function useService(machine2, options) {
1759
+ const { state: hydratedState, context } = options != null ? options : {};
1760
+ const service = useConstant(() => {
1761
+ const instance = typeof machine2 === "function" ? machine2() : machine2;
1762
+ if (context) instance.setContext(context);
1763
+ instance._created();
1764
+ return instance;
1765
+ });
1766
+ const snapshotRef = useRef();
1767
+ useSafeLayoutEffect(() => {
1768
+ const stateInit = hydratedState != null ? hydratedState : snapshotRef.current;
1769
+ service.start(stateInit);
1770
+ return () => {
1771
+ if (isDev3()) {
1772
+ snapshotRef.current = service.getHydrationState();
1773
+ }
1774
+ service.stop();
1775
+ };
1776
+ }, []);
1777
+ return service;
1778
+ }
1779
+ function useMachine(machine2, options) {
1780
+ const service = useService(machine2, options);
1781
+ const state = useSnapshot(service, options);
1782
+ return [state, service.send, service];
1783
+ }
1784
+
1785
+ // ../../node_modules/@ark-ui/react/dist/components/presence/use-presence.js
1786
+ import { useRef as useRef3 } from "react";
1787
+
1788
+ // ../../node_modules/@ark-ui/react/dist/utils/use-event.js
1789
+ import { useCallback as useCallback2, useRef as useRef2 } from "react";
1790
+ function useEvent(callback, opts = {}) {
1791
+ const { sync = false } = opts;
1792
+ const callbackRef = useLatestRef(callback);
1793
+ return useCallback2(
1794
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
1795
+ (...args) => {
1796
+ var _a;
1797
+ if (sync) return queueMicrotask(() => {
1798
+ var _a2;
1799
+ return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
1800
+ });
1801
+ return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
1802
+ },
1803
+ [sync, callbackRef]
1804
+ );
1805
+ }
1806
+ function useLatestRef(value) {
1807
+ const ref2 = useRef2(value);
1808
+ ref2.current = value;
1809
+ return ref2;
1810
+ }
1811
+
1812
+ // ../../node_modules/@ark-ui/react/dist/components/presence/use-presence.js
1813
+ var usePresence = (props2) => {
1814
+ const { lazyMount, unmountOnExit, ...rest } = props2;
1815
+ const wasEverPresent = useRef3(false);
1816
+ const context = {
1817
+ ...rest,
1818
+ onExitComplete: useEvent(props2.onExitComplete)
1819
+ };
1820
+ const [state, send] = useMachine(machine(context), { context });
1821
+ const api = connect(state, send, normalizeProps);
1822
+ if (api.present) {
1823
+ wasEverPresent.current = true;
1824
+ }
1825
+ const unmounted = !api.present && !wasEverPresent.current && lazyMount || unmountOnExit && !api.present && wasEverPresent.current;
1826
+ const getPresenceProps = () => ({
1827
+ "data-state": props2.present ? "open" : "closed",
1828
+ hidden: !api.present
1829
+ });
1830
+ return {
1831
+ ref: api.setNode,
1832
+ getPresenceProps,
1833
+ present: api.present,
1834
+ unmounted
1835
+ };
1836
+ };
1837
+
1838
+ // ../../node_modules/@ark-ui/react/dist/components/presence/presence.js
1839
+ var Presence = forwardRef2((props2, ref2) => {
1840
+ const [presenceProps, localProps] = splitPresenceProps(props2);
1841
+ const presence = usePresence(presenceProps);
1842
+ if (presence.unmounted) {
1843
+ return null;
1844
+ }
1845
+ return /* @__PURE__ */ jsx2(
1846
+ ark.div,
1847
+ {
1848
+ ...localProps,
1849
+ ...presence.getPresenceProps(),
1850
+ "data-scope": "presence",
1851
+ "data-part": "root",
1852
+ ref: composeRefs(presence.ref, ref2)
1853
+ }
1854
+ );
1855
+ });
1856
+ Presence.displayName = "Presence";
1857
+
1858
+ // src/components/loading-overlay/loading-overlay.tsx
1859
+ import { chakra } from "@chakra-ui/react";
1860
+
1861
+ // src/components/loading-overlay/loading-overlay.context.ts
1862
+ import { createSlotRecipeContext } from "@chakra-ui/react";
1863
+ var {
1864
+ useStyles: useLoadingOverlayStyles,
1865
+ withContext,
1866
+ withProvider
1867
+ } = createSlotRecipeContext({
1868
+ key: "suiLoadingOverlay"
1869
+ });
1870
+
1871
+ // src/components/loading-overlay/loading-overlay.tsx
1872
+ import { jsx as jsx3 } from "react/jsx-runtime";
1873
+ var LoadingOverlay = (props2) => {
1874
+ const { children, loading = true, ...rest } = props2;
1875
+ const [presenceProps, rootProps] = splitPresenceProps(rest);
1876
+ return /* @__PURE__ */ jsx3(Presence, { present: loading, ...presenceProps, asChild: true, children: /* @__PURE__ */ jsx3(chakra.div, { ...rootProps, children }) });
1877
+ };
1878
+ var LoadingOverlayRoot = withProvider(
1879
+ LoadingOverlay,
1880
+ "root"
1881
+ );
1882
+ LoadingOverlayRoot.displayName = "LoadingOverlay";
1883
+ var LoadingOverlaySpinner = Spinner;
1884
+ var LoadingOverlayText = withContext(
1885
+ "p",
1886
+ "text"
1887
+ );
1888
+
1889
+ export {
1890
+ useLoadingOverlayStyles,
1891
+ loading_overlay_exports
1892
+ };