@saas-ui/react 3.0.0-alpha.1 → 3.0.0-alpha.11

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