@sanity/ui 3.3.1 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (651) hide show
  1. package/dist/_visual-editing.d.mts +2 -1126
  2. package/dist/_visual-editing.d.ts +2 -1126
  3. package/dist/_visual-editing.js +3 -31
  4. package/dist/_visual-editing.mjs +2 -31
  5. package/dist/index.d.mts +555 -2769
  6. package/dist/index.d.mts.map +1 -0
  7. package/dist/index.d.ts +555 -2769
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +2982 -1934
  10. package/dist/index.mjs +2950 -1903
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/refractor.js +16 -0
  13. package/dist/refractor.mjs +21 -0
  14. package/dist/refractor.mjs.map +1 -0
  15. package/dist/tabList.js +3804 -0
  16. package/dist/tabList.mjs +3355 -0
  17. package/dist/tabList.mjs.map +1 -0
  18. package/dist/theme.d.mts +927 -1227
  19. package/dist/theme.d.mts.map +1 -0
  20. package/dist/theme.d.ts +927 -1227
  21. package/dist/theme.d.ts.map +1 -0
  22. package/dist/theme.js +3 -4127
  23. package/dist/theme.mjs +2 -4127
  24. package/dist/theme2.d.mts +2 -0
  25. package/dist/theme2.d.ts +2 -0
  26. package/dist/theme2.js +4104 -0
  27. package/dist/theme2.mjs +3851 -0
  28. package/dist/theme2.mjs.map +1 -0
  29. package/dist/useTheme.d.mts +1451 -0
  30. package/dist/useTheme.d.mts.map +1 -0
  31. package/dist/useTheme.d.ts +1451 -0
  32. package/dist/useTheme.d.ts.map +1 -0
  33. package/package.json +48 -106
  34. package/dist/_chunks-cjs/_visual-editing.js +0 -5899
  35. package/dist/_chunks-cjs/_visual-editing.js.map +0 -1
  36. package/dist/_chunks-cjs/refractor.js +0 -23
  37. package/dist/_chunks-cjs/refractor.js.map +0 -1
  38. package/dist/_chunks-es/_visual-editing.mjs +0 -5905
  39. package/dist/_chunks-es/_visual-editing.mjs.map +0 -1
  40. package/dist/_chunks-es/refractor.mjs +0 -26
  41. package/dist/_chunks-es/refractor.mjs.map +0 -1
  42. package/dist/_visual-editing.js.map +0 -1
  43. package/dist/_visual-editing.mjs.map +0 -1
  44. package/dist/index.js.map +0 -1
  45. package/dist/theme.js.map +0 -1
  46. package/dist/theme.mjs.map +0 -1
  47. package/exports/_visual-editing.ts +0 -31
  48. package/exports/index.ts +0 -1
  49. package/exports/theme.ts +0 -1
  50. package/src/core/__workshop__/constants.ts +0 -293
  51. package/src/core/_compat.ts +0 -264
  52. package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
  53. package/src/core/components/autocomplete/__mocks__/countries.ts +0 -245
  54. package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
  55. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -137
  56. package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
  57. package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
  58. package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
  59. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -294
  60. package/src/core/components/autocomplete/__workshop__/index.ts +0 -39
  61. package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
  62. package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -39
  63. package/src/core/components/autocomplete/autocomplete.tsx +0 -767
  64. package/src/core/components/autocomplete/autocompleteOption.tsx +0 -45
  65. package/src/core/components/autocomplete/autocompleteReducer.ts +0 -47
  66. package/src/core/components/autocomplete/constants.ts +0 -28
  67. package/src/core/components/autocomplete/index.ts +0 -2
  68. package/src/core/components/autocomplete/types.ts +0 -108
  69. package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -62
  70. package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -14
  71. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -18
  72. package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +0 -51
  73. package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -133
  74. package/src/core/components/breadcrumbs/index.ts +0 -1
  75. package/src/core/components/dialog/__workshop__/activate.tsx +0 -134
  76. package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
  77. package/src/core/components/dialog/__workshop__/index.ts +0 -19
  78. package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
  79. package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
  80. package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
  81. package/src/core/components/dialog/__workshop__/panes.tsx +0 -82
  82. package/src/core/components/dialog/__workshop__/position.tsx +0 -30
  83. package/src/core/components/dialog/__workshop__/props.tsx +0 -75
  84. package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
  85. package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
  86. package/src/core/components/dialog/dialog.tsx +0 -430
  87. package/src/core/components/dialog/dialogContext.ts +0 -20
  88. package/src/core/components/dialog/dialogProvider.tsx +0 -35
  89. package/src/core/components/dialog/index.ts +0 -4
  90. package/src/core/components/dialog/styles.ts +0 -77
  91. package/src/core/components/dialog/useDialog.ts +0 -11
  92. package/src/core/components/hotkeys/__workshop__/index.ts +0 -14
  93. package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
  94. package/src/core/components/hotkeys/hotkeys.test.tsx +0 -42
  95. package/src/core/components/hotkeys/hotkeys.tsx +0 -66
  96. package/src/core/components/hotkeys/index.ts +0 -1
  97. package/src/core/components/index.ts +0 -9
  98. package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
  99. package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -51
  100. package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -46
  101. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
  102. package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
  103. package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -39
  104. package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
  105. package/src/core/components/menu/__workshop__/groups.tsx +0 -156
  106. package/src/core/components/menu/__workshop__/index.ts +0 -89
  107. package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
  108. package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -65
  109. package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
  110. package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
  111. package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
  112. package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -47
  113. package/src/core/components/menu/__workshop__/tones.tsx +0 -25
  114. package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
  115. package/src/core/components/menu/helpers.ts +0 -82
  116. package/src/core/components/menu/index.ts +0 -5
  117. package/src/core/components/menu/menu.spacing.test.tsx +0 -63
  118. package/src/core/components/menu/menu.test.tsx +0 -125
  119. package/src/core/components/menu/menu.tsx +0 -178
  120. package/src/core/components/menu/menuButton.tsx +0 -268
  121. package/src/core/components/menu/menuContext.ts +0 -18
  122. package/src/core/components/menu/menuDivider.ts +0 -23
  123. package/src/core/components/menu/menuGroup.spacing.test.tsx +0 -63
  124. package/src/core/components/menu/menuGroup.tsx +0 -233
  125. package/src/core/components/menu/menuItem.spacing.test.tsx +0 -59
  126. package/src/core/components/menu/menuItem.tsx +0 -197
  127. package/src/core/components/menu/useMenu.ts +0 -21
  128. package/src/core/components/menu/useMenuController.ts +0 -231
  129. package/src/core/components/skeleton/__workshop__/delay.tsx +0 -70
  130. package/src/core/components/skeleton/__workshop__/index.ts +0 -11
  131. package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -64
  132. package/src/core/components/skeleton/index.ts +0 -2
  133. package/src/core/components/skeleton/skeleton.tsx +0 -57
  134. package/src/core/components/skeleton/styles.ts +0 -50
  135. package/src/core/components/skeleton/textSkeleton.tsx +0 -122
  136. package/src/core/components/tab/__workshop__/example.tsx +0 -79
  137. package/src/core/components/tab/__workshop__/index.ts +0 -14
  138. package/src/core/components/tab/index.ts +0 -3
  139. package/src/core/components/tab/tab.tsx +0 -101
  140. package/src/core/components/tab/tabList.test.tsx +0 -48
  141. package/src/core/components/tab/tabList.tsx +0 -70
  142. package/src/core/components/tab/tabPanel.tsx +0 -39
  143. package/src/core/components/toast/__workshop__/hook.tsx +0 -71
  144. package/src/core/components/toast/__workshop__/index.ts +0 -19
  145. package/src/core/components/toast/__workshop__/toast.tsx +0 -26
  146. package/src/core/components/toast/index.ts +0 -4
  147. package/src/core/components/toast/styles.ts +0 -77
  148. package/src/core/components/toast/toast.test.tsx +0 -101
  149. package/src/core/components/toast/toast.tsx +0 -198
  150. package/src/core/components/toast/toastContext.ts +0 -7
  151. package/src/core/components/toast/toastLayer.tsx +0 -51
  152. package/src/core/components/toast/toastProvider.tsx +0 -113
  153. package/src/core/components/toast/toastState.ts +0 -6
  154. package/src/core/components/toast/types.ts +0 -26
  155. package/src/core/components/toast/useToast.ts +0 -25
  156. package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
  157. package/src/core/components/tree/__workshop__/basic.tsx +0 -105
  158. package/src/core/components/tree/__workshop__/index.ts +0 -21
  159. package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
  160. package/src/core/components/tree/helpers.ts +0 -105
  161. package/src/core/components/tree/index.ts +0 -4
  162. package/src/core/components/tree/style.ts +0 -105
  163. package/src/core/components/tree/tree.test.tsx +0 -55
  164. package/src/core/components/tree/tree.tsx +0 -240
  165. package/src/core/components/tree/treeContext.ts +0 -10
  166. package/src/core/components/tree/treeGroup.tsx +0 -28
  167. package/src/core/components/tree/treeItem.test.tsx +0 -65
  168. package/src/core/components/tree/treeItem.tsx +0 -224
  169. package/src/core/components/tree/types.ts +0 -25
  170. package/src/core/components/tree/useTree.ts +0 -17
  171. package/src/core/constants.ts +0 -79
  172. package/src/core/helpers/animation.ts +0 -27
  173. package/src/core/helpers/element.ts +0 -55
  174. package/src/core/helpers/focus.ts +0 -100
  175. package/src/core/helpers/index.ts +0 -4
  176. package/src/core/helpers/scroll.ts +0 -15
  177. package/src/core/hooks/index.ts +0 -12
  178. package/src/core/hooks/useArrayProp.ts +0 -17
  179. package/src/core/hooks/useClickOutside.test.tsx +0 -482
  180. package/src/core/hooks/useClickOutside.ts +0 -118
  181. package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -115
  182. package/src/core/hooks/useClickOutsideEvent.ts +0 -73
  183. package/src/core/hooks/useCustomValidity.ts +0 -13
  184. package/src/core/hooks/useDelayed.test.ts +0 -88
  185. package/src/core/hooks/useDelayedState.ts +0 -36
  186. package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -32
  187. package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
  188. package/src/core/hooks/useElementRect/index.ts +0 -1
  189. package/src/core/hooks/useElementRect/useElementRect.ts +0 -13
  190. package/src/core/hooks/useElementSize.ts +0 -19
  191. package/src/core/hooks/useForwardedRef.ts +0 -19
  192. package/src/core/hooks/useGlobalKeyDown.ts +0 -24
  193. package/src/core/hooks/useIsomorphicEffect.ts +0 -7
  194. package/src/core/hooks/useMatchMedia.ts +0 -28
  195. package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -14
  196. package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
  197. package/src/core/hooks/useMediaIndex/index.ts +0 -1
  198. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -36
  199. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -102
  200. package/src/core/hooks/useMounted.ts +0 -15
  201. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -56
  202. package/src/core/hooks/usePrefersDark.test.tsx +0 -19
  203. package/src/core/hooks/usePrefersDark.ts +0 -16
  204. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -56
  205. package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -19
  206. package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
  207. package/src/core/index.ts +0 -10
  208. package/src/core/lib/createGlobalScopedContext.ts +0 -36
  209. package/src/core/lib/globalScope.ts +0 -19
  210. package/src/core/lib/isRecord.ts +0 -3
  211. package/src/core/middleware/origin.ts +0 -47
  212. package/src/core/observers/elementSizeObserver.ts +0 -116
  213. package/src/core/observers/index.ts +0 -2
  214. package/src/core/observers/resizeObserver.ts +0 -9
  215. package/src/core/primitives/_selectable/index.ts +0 -1
  216. package/src/core/primitives/_selectable/selectable.tsx +0 -15
  217. package/src/core/primitives/_selectable/style.ts +0 -115
  218. package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
  219. package/src/core/primitives/avatar/__workshop__/index.ts +0 -29
  220. package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
  221. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -63
  222. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -70
  223. package/src/core/primitives/avatar/avatar.tsx +0 -200
  224. package/src/core/primitives/avatar/avatarCounter.tsx +0 -91
  225. package/src/core/primitives/avatar/avatarStack.tsx +0 -100
  226. package/src/core/primitives/avatar/index.ts +0 -4
  227. package/src/core/primitives/avatar/styles.ts +0 -167
  228. package/src/core/primitives/avatar/types.ts +0 -17
  229. package/src/core/primitives/badge/__workshop__/index.ts +0 -19
  230. package/src/core/primitives/badge/__workshop__/props.tsx +0 -30
  231. package/src/core/primitives/badge/__workshop__/tones.tsx +0 -21
  232. package/src/core/primitives/badge/badge.test.tsx +0 -16
  233. package/src/core/primitives/badge/badge.tsx +0 -70
  234. package/src/core/primitives/badge/index.ts +0 -1
  235. package/src/core/primitives/badge/styles.ts +0 -20
  236. package/src/core/primitives/badge/types.ts +0 -8
  237. package/src/core/primitives/box/__workshop__/asComponent.tsx +0 -31
  238. package/src/core/primitives/box/__workshop__/index.ts +0 -24
  239. package/src/core/primitives/box/__workshop__/props.tsx +0 -20
  240. package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
  241. package/src/core/primitives/box/box.test.tsx +0 -142
  242. package/src/core/primitives/box/box.tsx +0 -154
  243. package/src/core/primitives/box/index.ts +0 -1
  244. package/src/core/primitives/button/__workshop__/custom.tsx +0 -51
  245. package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
  246. package/src/core/primitives/button/__workshop__/disabled.tsx +0 -74
  247. package/src/core/primitives/button/__workshop__/index.ts +0 -59
  248. package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
  249. package/src/core/primitives/button/__workshop__/props.tsx +0 -55
  250. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
  251. package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
  252. package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
  253. package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
  254. package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -28
  255. package/src/core/primitives/button/button.test.tsx +0 -82
  256. package/src/core/primitives/button/button.tsx +0 -210
  257. package/src/core/primitives/button/index.ts +0 -1
  258. package/src/core/primitives/button/styles.ts +0 -117
  259. package/src/core/primitives/card/__workshop__/allTones.tsx +0 -25
  260. package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
  261. package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
  262. package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
  263. package/src/core/primitives/card/__workshop__/index.ts +0 -18
  264. package/src/core/primitives/card/__workshop__/interactive.tsx +0 -30
  265. package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -80
  266. package/src/core/primitives/card/__workshop__/props.tsx +0 -53
  267. package/src/core/primitives/card/__workshop__/selected.tsx +0 -94
  268. package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
  269. package/src/core/primitives/card/card.tsx +0 -128
  270. package/src/core/primitives/card/index.ts +0 -2
  271. package/src/core/primitives/card/styles.ts +0 -147
  272. package/src/core/primitives/card/types.ts +0 -11
  273. package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
  274. package/src/core/primitives/checkbox/__workshop__/index.ts +0 -13
  275. package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -33
  276. package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
  277. package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -28
  278. package/src/core/primitives/checkbox/checkbox.tsx +0 -73
  279. package/src/core/primitives/checkbox/index.ts +0 -1
  280. package/src/core/primitives/checkbox/styles.ts +0 -128
  281. package/src/core/primitives/code/__workshop__/index.ts +0 -19
  282. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
  283. package/src/core/primitives/code/__workshop__/props.tsx +0 -21
  284. package/src/core/primitives/code/code.tsx +0 -55
  285. package/src/core/primitives/code/index.ts +0 -1
  286. package/src/core/primitives/code/refractor.tsx +0 -20
  287. package/src/core/primitives/code/styles.ts +0 -77
  288. package/src/core/primitives/container/__workshop__/example.tsx +0 -20
  289. package/src/core/primitives/container/__workshop__/index.ts +0 -8
  290. package/src/core/primitives/container/container.tsx +0 -54
  291. package/src/core/primitives/container/index.ts +0 -2
  292. package/src/core/primitives/container/styles.ts +0 -23
  293. package/src/core/primitives/container/types.ts +0 -6
  294. package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
  295. package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
  296. package/src/core/primitives/flex/__workshop__/index.ts +0 -11
  297. package/src/core/primitives/flex/flex.tsx +0 -64
  298. package/src/core/primitives/flex/index.ts +0 -1
  299. package/src/core/primitives/grid/__workshop__/index.ts +0 -10
  300. package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
  301. package/src/core/primitives/grid/grid.test.tsx +0 -80
  302. package/src/core/primitives/grid/grid.tsx +0 -74
  303. package/src/core/primitives/grid/index.ts +0 -1
  304. package/src/core/primitives/heading/__workshop__/index.ts +0 -19
  305. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
  306. package/src/core/primitives/heading/__workshop__/plain.tsx +0 -32
  307. package/src/core/primitives/heading/heading.tsx +0 -88
  308. package/src/core/primitives/heading/index.ts +0 -1
  309. package/src/core/primitives/heading/styles.ts +0 -64
  310. package/src/core/primitives/heading/types.ts +0 -7
  311. package/src/core/primitives/index.ts +0 -27
  312. package/src/core/primitives/inline/__workshop__/index.ts +0 -8
  313. package/src/core/primitives/inline/__workshop__/plain.tsx +0 -27
  314. package/src/core/primitives/inline/index.ts +0 -1
  315. package/src/core/primitives/inline/inline.test.tsx +0 -51
  316. package/src/core/primitives/inline/inline.tsx +0 -63
  317. package/src/core/primitives/inline/styles.ts +0 -32
  318. package/src/core/primitives/inline/types.ts +0 -6
  319. package/src/core/primitives/kbd/__workshop__/index.ts +0 -8
  320. package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
  321. package/src/core/primitives/kbd/index.ts +0 -1
  322. package/src/core/primitives/kbd/kbd.tsx +0 -69
  323. package/src/core/primitives/label/__workshop__/index.ts +0 -19
  324. package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
  325. package/src/core/primitives/label/__workshop__/plain.tsx +0 -24
  326. package/src/core/primitives/label/index.ts +0 -1
  327. package/src/core/primitives/label/label.tsx +0 -87
  328. package/src/core/primitives/label/styles.ts +0 -45
  329. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
  330. package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
  331. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
  332. package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
  333. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
  334. package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -71
  335. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -89
  336. package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
  337. package/src/core/primitives/popover/__workshop__/index.ts +0 -49
  338. package/src/core/primitives/popover/constants.ts +0 -22
  339. package/src/core/primitives/popover/floating-ui/size.ts +0 -99
  340. package/src/core/primitives/popover/helpers.ts +0 -31
  341. package/src/core/primitives/popover/index.ts +0 -2
  342. package/src/core/primitives/popover/popover.tsx +0 -511
  343. package/src/core/primitives/popover/popoverCard.tsx +0 -166
  344. package/src/core/primitives/popover/types.ts +0 -7
  345. package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
  346. package/src/core/primitives/radio/__workshop__/index.ts +0 -11
  347. package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
  348. package/src/core/primitives/radio/index.ts +0 -1
  349. package/src/core/primitives/radio/radio.tsx +0 -51
  350. package/src/core/primitives/radio/styles.ts +0 -117
  351. package/src/core/primitives/select/__workshop__/index.ts +0 -11
  352. package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
  353. package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
  354. package/src/core/primitives/select/index.ts +0 -1
  355. package/src/core/primitives/select/select.test.tsx +0 -52
  356. package/src/core/primitives/select/select.tsx +0 -94
  357. package/src/core/primitives/select/styles.ts +0 -166
  358. package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
  359. package/src/core/primitives/spinner/__workshop__/index.ts +0 -14
  360. package/src/core/primitives/spinner/index.ts +0 -1
  361. package/src/core/primitives/spinner/spinner.tsx +0 -46
  362. package/src/core/primitives/stack/__workshop__/index.ts +0 -14
  363. package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
  364. package/src/core/primitives/stack/index.ts +0 -1
  365. package/src/core/primitives/stack/stack.test.tsx +0 -57
  366. package/src/core/primitives/stack/stack.tsx +0 -57
  367. package/src/core/primitives/stack/styles.ts +0 -32
  368. package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
  369. package/src/core/primitives/switch/__workshop__/index.ts +0 -11
  370. package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
  371. package/src/core/primitives/switch/index.ts +0 -1
  372. package/src/core/primitives/switch/styles.ts +0 -173
  373. package/src/core/primitives/switch/switch.tsx +0 -68
  374. package/src/core/primitives/text/__workshop__/colored.tsx +0 -30
  375. package/src/core/primitives/text/__workshop__/example.tsx +0 -39
  376. package/src/core/primitives/text/__workshop__/index.ts +0 -24
  377. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
  378. package/src/core/primitives/text/index.ts +0 -1
  379. package/src/core/primitives/text/styles.ts +0 -74
  380. package/src/core/primitives/text/text.tsx +0 -89
  381. package/src/core/primitives/textArea/__workshop__/index.ts +0 -14
  382. package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -50
  383. package/src/core/primitives/textArea/index.ts +0 -1
  384. package/src/core/primitives/textArea/textArea.tsx +0 -120
  385. package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
  386. package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
  387. package/src/core/primitives/textInput/__workshop__/index.ts +0 -44
  388. package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
  389. package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
  390. package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
  391. package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
  392. package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
  393. package/src/core/primitives/textInput/index.ts +0 -1
  394. package/src/core/primitives/textInput/textInput.test.tsx +0 -48
  395. package/src/core/primitives/textInput/textInput.tsx +0 -395
  396. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
  397. package/src/core/primitives/tooltip/__workshop__/index.ts +0 -29
  398. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
  399. package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -107
  400. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
  401. package/src/core/primitives/tooltip/constants.ts +0 -23
  402. package/src/core/primitives/tooltip/index.ts +0 -2
  403. package/src/core/primitives/tooltip/tooltip.test.tsx +0 -452
  404. package/src/core/primitives/tooltip/tooltip.tsx +0 -495
  405. package/src/core/primitives/tooltip/tooltipCard.tsx +0 -109
  406. package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
  407. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -11
  408. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
  409. package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -10
  410. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -13
  411. package/src/core/primitives/types.ts +0 -179
  412. package/src/core/styles/border/borderStyle.ts +0 -56
  413. package/src/core/styles/border/index.ts +0 -2
  414. package/src/core/styles/border/types.ts +0 -10
  415. package/src/core/styles/box/boxStyle.ts +0 -69
  416. package/src/core/styles/box/index.ts +0 -2
  417. package/src/core/styles/box/types.ts +0 -11
  418. package/src/core/styles/card/_cardColorStyle.ts +0 -108
  419. package/src/core/styles/card/index.ts +0 -1
  420. package/src/core/styles/flex/flexItemStyle.ts +0 -27
  421. package/src/core/styles/flex/flexStyle.ts +0 -70
  422. package/src/core/styles/flex/index.ts +0 -3
  423. package/src/core/styles/flex/types.ts +0 -25
  424. package/src/core/styles/focusRing/index.ts +0 -25
  425. package/src/core/styles/font/codeFontStyle.ts +0 -13
  426. package/src/core/styles/font/headingFontStyle.ts +0 -13
  427. package/src/core/styles/font/index.ts +0 -6
  428. package/src/core/styles/font/labelFontStyle.ts +0 -13
  429. package/src/core/styles/font/responsiveFont.ts +0 -103
  430. package/src/core/styles/font/textAlignStyle.ts +0 -19
  431. package/src/core/styles/font/textFontStyle.ts +0 -13
  432. package/src/core/styles/font/types.ts +0 -35
  433. package/src/core/styles/grid/gridItemStyle.ts +0 -82
  434. package/src/core/styles/grid/gridStyle.ts +0 -108
  435. package/src/core/styles/grid/index.ts +0 -3
  436. package/src/core/styles/grid/types.ts +0 -37
  437. package/src/core/styles/helpers.ts +0 -72
  438. package/src/core/styles/index.ts +0 -5
  439. package/src/core/styles/input/index.ts +0 -2
  440. package/src/core/styles/input/responsiveInputPaddingStyle.ts +0 -78
  441. package/src/core/styles/input/textInputStyle.ts +0 -263
  442. package/src/core/styles/internal.ts +0 -12
  443. package/src/core/styles/margin/index.ts +0 -2
  444. package/src/core/styles/margin/marginStyle.ts +0 -21
  445. package/src/core/styles/margin/marginsStyle.test.ts +0 -33
  446. package/src/core/styles/margin/types.ts +0 -9
  447. package/src/core/styles/padding/index.ts +0 -2
  448. package/src/core/styles/padding/paddingStyle.test.ts +0 -33
  449. package/src/core/styles/padding/paddingStyle.ts +0 -21
  450. package/src/core/styles/padding/types.ts +0 -12
  451. package/src/core/styles/radius/index.ts +0 -2
  452. package/src/core/styles/radius/radiusStyle.ts +0 -23
  453. package/src/core/styles/radius/types.ts +0 -8
  454. package/src/core/styles/shadow/index.ts +0 -2
  455. package/src/core/styles/shadow/shadowStyle.ts +0 -29
  456. package/src/core/styles/shadow/types.ts +0 -6
  457. package/src/core/styles/types.ts +0 -8
  458. package/src/core/theme/__workshop__/build/Root.tsx +0 -367
  459. package/src/core/theme/__workshop__/build/helpers.ts +0 -46
  460. package/src/core/theme/__workshop__/build/story.tsx +0 -465
  461. package/src/core/theme/__workshop__/canvas.tsx +0 -352
  462. package/src/core/theme/__workshop__/color.tsx +0 -62
  463. package/src/core/theme/__workshop__/debug/story.tsx +0 -408
  464. package/src/core/theme/__workshop__/index.ts +0 -39
  465. package/src/core/theme/__workshop__/layer.tsx +0 -78
  466. package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
  467. package/src/core/theme/index.ts +0 -5
  468. package/src/core/theme/theme.test.tsx +0 -73
  469. package/src/core/theme/themeColorProvider.tsx +0 -29
  470. package/src/core/theme/themeContext.ts +0 -10
  471. package/src/core/theme/themeProvider.tsx +0 -62
  472. package/src/core/theme/types.ts +0 -12
  473. package/src/core/theme/useRootTheme.ts +0 -17
  474. package/src/core/theme/useTheme.ts +0 -16
  475. package/src/core/types/avatar.ts +0 -14
  476. package/src/core/types/badge.ts +0 -12
  477. package/src/core/types/box.ts +0 -19
  478. package/src/core/types/button.ts +0 -21
  479. package/src/core/types/card.ts +0 -6
  480. package/src/core/types/component.ts +0 -32
  481. package/src/core/types/dialog.ts +0 -4
  482. package/src/core/types/flex.ts +0 -30
  483. package/src/core/types/grid.ts +0 -14
  484. package/src/core/types/gridItem.ts +0 -29
  485. package/src/core/types/index.ts +0 -15
  486. package/src/core/types/placement.ts +0 -18
  487. package/src/core/types/popover.ts +0 -4
  488. package/src/core/types/radius.ts +0 -4
  489. package/src/core/types/selectable.ts +0 -6
  490. package/src/core/types/text.ts +0 -4
  491. package/src/core/utils/arrow/arrow.tsx +0 -123
  492. package/src/core/utils/arrow/cmds.ts +0 -91
  493. package/src/core/utils/arrow/index.ts +0 -1
  494. package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -14
  495. package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
  496. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -100
  497. package/src/core/utils/boundaryElement/boundaryElementContext.ts +0 -7
  498. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -24
  499. package/src/core/utils/boundaryElement/index.ts +0 -3
  500. package/src/core/utils/boundaryElement/types.ts +0 -7
  501. package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -26
  502. package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
  503. package/src/core/utils/conditionalWrapper/index.ts +0 -1
  504. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
  505. package/src/core/utils/elementQuery/__workshop__/index.ts +0 -14
  506. package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
  507. package/src/core/utils/elementQuery/helpers.ts +0 -27
  508. package/src/core/utils/elementQuery/index.ts +0 -1
  509. package/src/core/utils/errorBoundary.tsx +0 -48
  510. package/src/core/utils/getElementRef.ts +0 -26
  511. package/src/core/utils/index.ts +0 -9
  512. package/src/core/utils/layer/__workshop__/_debug.tsx +0 -17
  513. package/src/core/utils/layer/__workshop__/index.ts +0 -24
  514. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -49
  515. package/src/core/utils/layer/__workshop__/nested.tsx +0 -98
  516. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
  517. package/src/core/utils/layer/getLayerContext.test.ts +0 -30
  518. package/src/core/utils/layer/getLayerContext.ts +0 -21
  519. package/src/core/utils/layer/index.ts +0 -4
  520. package/src/core/utils/layer/layer.test.tsx +0 -108
  521. package/src/core/utils/layer/layer.tsx +0 -98
  522. package/src/core/utils/layer/layerContext.ts +0 -7
  523. package/src/core/utils/layer/layerProvider.tsx +0 -111
  524. package/src/core/utils/layer/types.ts +0 -9
  525. package/src/core/utils/layer/useLayer.ts +0 -26
  526. package/src/core/utils/portal/__workshop__/index.ts +0 -14
  527. package/src/core/utils/portal/__workshop__/named.tsx +0 -63
  528. package/src/core/utils/portal/index.ts +0 -4
  529. package/src/core/utils/portal/portal.test.tsx +0 -103
  530. package/src/core/utils/portal/portal.ts +0 -32
  531. package/src/core/utils/portal/portalContext.ts +0 -31
  532. package/src/core/utils/portal/portalProvider.tsx +0 -47
  533. package/src/core/utils/portal/types.ts +0 -9
  534. package/src/core/utils/portal/usePortal.ts +0 -25
  535. package/src/core/utils/spanWithTextOverflow.tsx +0 -10
  536. package/src/core/utils/srOnly/index.ts +0 -1
  537. package/src/core/utils/srOnly/srOnly.tsx +0 -36
  538. package/src/core/utils/virtualList/__workshop__/changingProps.tsx +0 -36
  539. package/src/core/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
  540. package/src/core/utils/virtualList/__workshop__/index.ts +0 -29
  541. package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
  542. package/src/core/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
  543. package/src/core/utils/virtualList/index.ts +0 -1
  544. package/src/core/utils/virtualList/virtualList.tsx +0 -200
  545. package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
  546. package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
  547. package/src/theme/build/_deprecated/color/button/createButtonModes.ts +0 -22
  548. package/src/theme/build/_deprecated/color/button/createButtonTones.ts +0 -55
  549. package/src/theme/build/_deprecated/color/card/createCardStates.ts +0 -60
  550. package/src/theme/build/_deprecated/color/color.test.ts +0 -63
  551. package/src/theme/build/_deprecated/color/defaults.ts +0 -390
  552. package/src/theme/build/_deprecated/color/factory.ts +0 -142
  553. package/src/theme/build/_deprecated/color/index.ts +0 -1
  554. package/src/theme/build/_deprecated/color/input/createInputModes.ts +0 -81
  555. package/src/theme/build/_deprecated/color/muted/createMuted.ts +0 -54
  556. package/src/theme/build/_deprecated/color/spot/createSpot.ts +0 -20
  557. package/src/theme/build/buildColorTheme.test.ts +0 -183
  558. package/src/theme/build/buildColorTheme.ts +0 -499
  559. package/src/theme/build/buildTheme.test.ts +0 -87
  560. package/src/theme/build/buildTheme.ts +0 -36
  561. package/src/theme/build/colorToken/colorToken.ts +0 -19
  562. package/src/theme/build/colorToken/compileColorToken.ts +0 -21
  563. package/src/theme/build/colorToken/index.ts +0 -2
  564. package/src/theme/build/colorToken/types.ts +0 -6
  565. package/src/theme/build/index.ts +0 -3
  566. package/src/theme/build/lib/color-fns/blend/index.ts +0 -3
  567. package/src/theme/build/lib/color-fns/blend/mix.ts +0 -21
  568. package/src/theme/build/lib/color-fns/blend/multiply.ts +0 -18
  569. package/src/theme/build/lib/color-fns/blend/screen.ts +0 -18
  570. package/src/theme/build/lib/color-fns/color-fns.test.ts +0 -68
  571. package/src/theme/build/lib/color-fns/contrastRatio.ts +0 -31
  572. package/src/theme/build/lib/color-fns/convert.ts +0 -150
  573. package/src/theme/build/lib/color-fns/index.ts +0 -6
  574. package/src/theme/build/lib/color-fns/parse.ts +0 -60
  575. package/src/theme/build/lib/color-fns/rgba.ts +0 -10
  576. package/src/theme/build/lib/color-fns/types.ts +0 -28
  577. package/src/theme/build/lib/isRecord.ts +0 -3
  578. package/src/theme/build/lib/lazy.ts +0 -30
  579. package/src/theme/build/lib/utils.ts +0 -19
  580. package/src/theme/build/merge.ts +0 -26
  581. package/src/theme/build/mixThemeColor.test.ts +0 -21
  582. package/src/theme/build/mixThemeColor.ts +0 -53
  583. package/src/theme/build/renderColorTheme.ts +0 -532
  584. package/src/theme/build/renderColorValue.ts +0 -85
  585. package/src/theme/build/resolveColorTokens.ts +0 -268
  586. package/src/theme/build/theme.test.ts +0 -27
  587. package/src/theme/config/helpers.ts +0 -55
  588. package/src/theme/config/index.ts +0 -4
  589. package/src/theme/config/system.ts +0 -115
  590. package/src/theme/config/tokens/color/index.ts +0 -1
  591. package/src/theme/config/tokens/color/types.ts +0 -133
  592. package/src/theme/config/tokens/index.ts +0 -4
  593. package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
  594. package/src/theme/config/tokens/parseTokenKey.ts +0 -67
  595. package/src/theme/config/tokens/parseTokenValue.test.ts +0 -42
  596. package/src/theme/config/tokens/parseTokenValue.ts +0 -133
  597. package/src/theme/config/tokens/types.ts +0 -53
  598. package/src/theme/config/types.ts +0 -46
  599. package/src/theme/defaults/colorPalette.ts +0 -5
  600. package/src/theme/defaults/colorTokens.ts +0 -648
  601. package/src/theme/defaults/config.ts +0 -84
  602. package/src/theme/defaults/fonts.ts +0 -227
  603. package/src/theme/getScopedTheme.ts +0 -98
  604. package/src/theme/index.ts +0 -5
  605. package/src/theme/system/avatar.ts +0 -14
  606. package/src/theme/system/color/_constants.ts +0 -45
  607. package/src/theme/system/color/_helpers.ts +0 -24
  608. package/src/theme/system/color/_system.ts +0 -40
  609. package/src/theme/system/color/avatar.ts +0 -15
  610. package/src/theme/system/color/badge.ts +0 -16
  611. package/src/theme/system/color/button.ts +0 -17
  612. package/src/theme/system/color/color.ts +0 -34
  613. package/src/theme/system/color/index.ts +0 -13
  614. package/src/theme/system/color/input.ts +0 -25
  615. package/src/theme/system/color/kbd.ts +0 -8
  616. package/src/theme/system/color/selectable.ts +0 -12
  617. package/src/theme/system/color/shadow.ts +0 -7
  618. package/src/theme/system/color/state.ts +0 -43
  619. package/src/theme/system/color/syntax.ts +0 -41
  620. package/src/theme/system/css.ts +0 -14
  621. package/src/theme/system/focusRing.ts +0 -7
  622. package/src/theme/system/font.ts +0 -52
  623. package/src/theme/system/index.ts +0 -11
  624. package/src/theme/system/input.ts +0 -33
  625. package/src/theme/system/layer.ts +0 -8
  626. package/src/theme/system/shadow.ts +0 -19
  627. package/src/theme/system/styles.ts +0 -13
  628. package/src/theme/system/theme.ts +0 -138
  629. package/src/theme/system/v0/avatar.ts +0 -10
  630. package/src/theme/system/v0/color/_generic.ts +0 -35
  631. package/src/theme/system/v0/color/_system.ts +0 -17
  632. package/src/theme/system/v0/color/base.ts +0 -21
  633. package/src/theme/system/v0/color/button.ts +0 -42
  634. package/src/theme/system/v0/color/card.ts +0 -19
  635. package/src/theme/system/v0/color/color.ts +0 -40
  636. package/src/theme/system/v0/color/index.ts +0 -11
  637. package/src/theme/system/v0/color/input.ts +0 -34
  638. package/src/theme/system/v0/color/muted.ts +0 -26
  639. package/src/theme/system/v0/color/selectable.ts +0 -31
  640. package/src/theme/system/v0/color/solid.ts +0 -26
  641. package/src/theme/system/v0/color/spot.ts +0 -13
  642. package/src/theme/system/v0/index.ts +0 -3
  643. package/src/theme/system/v0/input.ts +0 -23
  644. package/src/theme/versioning/getTheme_v2.ts +0 -57
  645. package/src/theme/versioning/index.ts +0 -5
  646. package/src/theme/versioning/is_v0.ts +0 -6
  647. package/src/theme/versioning/is_v2.ts +0 -6
  648. package/src/theme/versioning/themeColor_v0_v2.ts +0 -243
  649. package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
  650. package/src/theme/versioning/v0_v2.ts +0 -94
  651. package/src/theme/versioning/v2_v0.ts +0 -135
@@ -0,0 +1,3355 @@
1
+ import { X as getTheme_v2, Z as createColorTheme$1, a as parseColor$1, c as rgbToHex$1, d as screen$1, f as multiply$1, l as rgbToHsl$1, n as buildTheme, o as hexToRgb$1, r as rgba$1, s as hslToRgb$1, t as getScopedTheme } from "./theme2.mjs";
2
+ import { c } from "react-compiler-runtime";
3
+ import { ChevronRightIcon, CloseIcon, SpinnerIcon } from "@sanity/icons";
4
+ import { Children, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useDebugValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
5
+ import { isValidElementType } from "react-is";
6
+ import { ThemeProvider, css, keyframes, styled, useTheme } from "styled-components";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { useEffectEvent } from "use-effect-event";
9
+ import { ResizeObserver } from "@juggle/resize-observer";
10
+ import { arrow, autoPlacement, autoUpdate, detectOverflow, flip, hide, offset, shift, useFloating } from "@floating-ui/react-dom";
11
+ import { AnimatePresence, motion } from "motion/react";
12
+ import { createPortal } from "react-dom";
13
+ /**
14
+ * @public
15
+ * @deprecated Use `createColorTheme` from `@sanity/ui/theme` instead.
16
+ */
17
+ const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = hslToRgb$1, multiply = multiply$1, parseColor = parseColor$1, rgbToHex = rgbToHex$1, rgbToHsl = rgbToHsl$1, rgba = rgba$1, screen = screen$1, studioTheme = buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_DURATION = .2, POPOVER_MOTION_PROPS = {
18
+ card: {
19
+ initial: {
20
+ scale: .97,
21
+ willChange: "transform"
22
+ },
23
+ hidden: { opacity: 0 },
24
+ visible: {
25
+ opacity: 1,
26
+ transition: {
27
+ when: "beforeChildren",
28
+ duration: POPOVER_MOTION_DURATION / 2
29
+ }
30
+ },
31
+ scaleIn: { scale: 1 },
32
+ scaleOut: { scale: .97 }
33
+ },
34
+ children: {
35
+ hidden: { opacity: 0 },
36
+ visible: { opacity: 1 }
37
+ },
38
+ transition: {
39
+ type: "spring",
40
+ visualDuration: POPOVER_MOTION_DURATION,
41
+ bounce: .25
42
+ }
43
+ };
44
+ /**
45
+ * @internal
46
+ */
47
+ function _isEnterToClickElement(element) {
48
+ return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
49
+ }
50
+ /**
51
+ * @internal
52
+ */
53
+ function isHTMLElement(node) {
54
+ return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
55
+ }
56
+ /**
57
+ * @internal
58
+ */
59
+ function isHTMLAnchorElement(element) {
60
+ return isHTMLElement(element) && element.nodeName === "A";
61
+ }
62
+ /**
63
+ * @internal
64
+ */
65
+ function isHTMLInputElement(element) {
66
+ return isHTMLElement(element) && element.nodeName === "INPUT";
67
+ }
68
+ /**
69
+ * @internal
70
+ */
71
+ function isHTMLButtonElement(element) {
72
+ return isHTMLElement(element) && element.nodeName === "BUTTON";
73
+ }
74
+ /**
75
+ * @internal
76
+ */
77
+ function isHTMLSelectElement(element) {
78
+ return isHTMLElement(element) && element.nodeName === "SELECT";
79
+ }
80
+ /**
81
+ * @internal
82
+ */
83
+ function isHTMLTextAreaElement(element) {
84
+ return isHTMLElement(element) && element.nodeName === "TEXTAREA";
85
+ }
86
+ /**
87
+ * @internal
88
+ */
89
+ function containsOrEqualsElement(element, node) {
90
+ return element.contains(node) || element === node;
91
+ }
92
+ /**
93
+ * @internal
94
+ */
95
+ function _fillCSSObject(keys, value) {
96
+ return keys.reduce((style, key) => (style[key] = value, style), {});
97
+ }
98
+ /**
99
+ * @public
100
+ */
101
+ function rem(pixelValue) {
102
+ return pixelValue === 0 ? 0 : `${pixelValue / 16}rem`;
103
+ }
104
+ /**
105
+ * @internal
106
+ */
107
+ function _responsive(media, values, callback) {
108
+ return (values?.map(callback) || []).map((statement, mediaIndex) => mediaIndex === 0 ? statement : { [`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement });
109
+ }
110
+ /**
111
+ * @internal
112
+ */
113
+ function _getArrayProp(val, defaultVal) {
114
+ return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
115
+ }
116
+ /**
117
+ * @internal
118
+ */
119
+ function _getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
120
+ if (!Array.isArray(spaceIndexes)) throw Error("the property must be array of numbers");
121
+ if (spaceIndexes.length === 0) return null;
122
+ let { media, space } = getTheme_v2(theme);
123
+ return _responsive(media, spaceIndexes, (spaceIndex) => _fillCSSObject(props, rem(space[spaceIndex])));
124
+ }
125
+ /**
126
+ * A utility function getting responsive font styles.
127
+ * @internal
128
+ */
129
+ function responsiveFont(fontKey, props) {
130
+ let { $size, $weight } = props, { font, media } = getTheme_v2(props.theme), { family, sizes, weights } = font[fontKey], fontWeight = $weight && weights[$weight] || weights.regular, defaultSize = sizes[2], base = {
131
+ position: "relative",
132
+ fontFamily: family,
133
+ fontWeight: `${fontWeight}`,
134
+ padding: "1px 0",
135
+ margin: 0,
136
+ "&:before": {
137
+ content: "\"\"",
138
+ display: "block",
139
+ height: 0
140
+ },
141
+ "&:after": {
142
+ content: "\"\"",
143
+ display: "block",
144
+ height: 0
145
+ },
146
+ "& > code, & > span": { display: "block" },
147
+ "&:not([hidden])": { display: "block" }
148
+ };
149
+ return $size ? [base, ..._responsive(media, $size, (sizeIndex) => fontSize(sizes[sizeIndex] || defaultSize))] : (responsiveFont.warned ||= (console.warn("No size specified for responsive font", {
150
+ fontKey,
151
+ $size,
152
+ props,
153
+ base
154
+ }), !0), [base]);
155
+ }
156
+ function fontSize(size) {
157
+ let { ascenderHeight, descenderHeight, fontSize, iconSize, letterSpacing, lineHeight } = size, negHeight = ascenderHeight + descenderHeight, capHeight = lineHeight - negHeight, iconOffset = (capHeight - iconSize) / 2, customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1, customIconOffset = (capHeight - customIconSize) / 2;
158
+ return {
159
+ fontSize: rem(fontSize),
160
+ lineHeight: `calc(${lineHeight} / ${fontSize})`,
161
+ letterSpacing: rem(letterSpacing),
162
+ transform: `translateY(${rem(descenderHeight)})`,
163
+ "&:before": { marginTop: `calc(${rem(0 - negHeight)} - 1px)` },
164
+ "&:after": { marginBottom: "-1px" },
165
+ "& svg:not([data-sanity-icon])": {
166
+ fontSize: `calc(${customIconSize} / 16 * 1rem)`,
167
+ margin: rem(customIconOffset)
168
+ },
169
+ "& [data-sanity-icon]": {
170
+ fontSize: `calc(${iconSize} / 16 * 1rem)`,
171
+ margin: rem(iconOffset)
172
+ }
173
+ };
174
+ }
175
+ /**
176
+ * Get responsive text align styles.
177
+ * @internal
178
+ */
179
+ function responsiveTextAlignStyle(props) {
180
+ let { media } = getTheme_v2(props.theme);
181
+ return _responsive(media, props.$align, (textAlign) => ({ textAlign }));
182
+ }
183
+ /**
184
+ * Get responsive CSS for the `text` font style.
185
+ * @internal
186
+ */
187
+ function responsiveTextFont(props) {
188
+ return responsiveFont("text", props);
189
+ }
190
+ /**
191
+ * Gets the global scope instance in a given environment.
192
+ *
193
+ * The strategy is to return the most modern, and if not, the most common:
194
+ * - The `globalThis` variable is the modern approach to accessing the global scope
195
+ * - The `window` variable is the global scope in a web browser
196
+ * - The `self` variable is the global scope in workers and others
197
+ * - The `global` variable is the global scope in Node.js
198
+ */
199
+ function getGlobalScope() {
200
+ if (typeof globalThis < "u") return globalThis;
201
+ if (typeof window < "u") return window;
202
+ if (typeof self < "u") return self;
203
+ if (typeof global < "u") return global;
204
+ throw Error("@sanity/ui: could not locate global scope");
205
+ }
206
+ const globalScope = getGlobalScope();
207
+ /**
208
+ * As `@sanity/ui` is declared as a dependency, and may be duplicated, sometimes across major versions
209
+ * it's critical that vital react contexts are shared even when there is a duplicate.
210
+ * If we used a model similar to `sanity` itself, or `styled-components`, this would be unnecessary as
211
+ * those libraries enforce single instances.
212
+ * Since we don't enforce it we have to support a sanity plugin being able to call hooks like `useToast`, and then
213
+ * read the context setup by `sanity`, which calls `ToastProvider`, even if the provider and hook are different instances in memory.
214
+ * It's also why it's vital that all changes to globally scoped providers remain fully backwards compatible to v1.
215
+ */
216
+ function createGlobalScopedContext(key, defaultValue) {
217
+ let symbol = Symbol.for(key);
218
+ /**
219
+ * Prevent errors about re-renders on React SSR on Next.js App Router
220
+ */
221
+ if (typeof document > "u") {
222
+ let context = createContext(defaultValue);
223
+ return context.displayName = key, context;
224
+ }
225
+ return globalScope[symbol] = globalScope[symbol] || createContext(defaultValue), globalScope[symbol];
226
+ }
227
+ /**
228
+ * @internal
229
+ */
230
+ const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
231
+ /**
232
+ * @public
233
+ */
234
+ function ThemeProvider$1(props) {
235
+ let $ = c(15), parentTheme = useContext(ThemeContext), { children } = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default"), t0;
236
+ bb0: {
237
+ if (!rootTheme) {
238
+ t0 = null;
239
+ break bb0;
240
+ }
241
+ let t1;
242
+ $[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t1 = {
243
+ version: 0,
244
+ theme: rootTheme,
245
+ scheme,
246
+ tone
247
+ }, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t1) : t1 = $[3], t0 = t1;
248
+ }
249
+ let themeContext = t0, t1;
250
+ bb1: {
251
+ if (!rootTheme) {
252
+ t1 = null;
253
+ break bb1;
254
+ }
255
+ let t2;
256
+ $[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t2 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t2) : t2 = $[7], t1 = t2;
257
+ }
258
+ let theme = t1;
259
+ if (!theme) {
260
+ let t2;
261
+ return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx("pre", { children: "ThemeProvider: no \"theme\" property provided" }), $[8] = t2) : t2 = $[8], t2;
262
+ }
263
+ let t2;
264
+ $[9] !== children || $[10] !== theme ? (t2 = /* @__PURE__ */ jsx(ThemeProvider, {
265
+ theme,
266
+ children
267
+ }), $[9] = children, $[10] = theme, $[11] = t2) : t2 = $[11];
268
+ let t3;
269
+ return $[12] !== t2 || $[13] !== themeContext ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, {
270
+ value: themeContext,
271
+ children: t2
272
+ }), $[12] = t2, $[13] = themeContext, $[14] = t3) : t3 = $[14], t3;
273
+ }
274
+ ThemeProvider$1.displayName = "ThemeProvider";
275
+ /**
276
+ * @public
277
+ */
278
+ function useRootTheme() {
279
+ let value = useContext(ThemeContext);
280
+ if (!value) throw Error("useRootTheme(): missing context value");
281
+ return value;
282
+ }
283
+ /**
284
+ * @public
285
+ */
286
+ function ThemeColorProvider(props) {
287
+ let $ = c(5), { children, scheme, tone } = props, root = useRootTheme(), t0 = scheme || root.scheme, t1;
288
+ return $[0] !== children || $[1] !== root.theme || $[2] !== t0 || $[3] !== tone ? (t1 = /* @__PURE__ */ jsx(ThemeProvider$1, {
289
+ scheme: t0,
290
+ theme: root.theme,
291
+ tone,
292
+ children
293
+ }), $[0] = children, $[1] = root.theme, $[2] = t0, $[3] = tone, $[4] = t1) : t1 = $[4], t1;
294
+ }
295
+ ThemeColorProvider.displayName = "ThemeColorProvider";
296
+ /**
297
+ * @public
298
+ */
299
+ function useTheme$1() {
300
+ return useTheme();
301
+ }
302
+ /**
303
+ * @public
304
+ */
305
+ function useTheme_v2() {
306
+ return getTheme_v2(useTheme());
307
+ }
308
+ function responsiveBorderStyle() {
309
+ return [
310
+ border,
311
+ borderTop,
312
+ borderRight,
313
+ borderBottom,
314
+ borderLeft
315
+ ];
316
+ }
317
+ function border(props) {
318
+ let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
319
+ return _responsive(media, props.$border, (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } });
320
+ }
321
+ function borderTop(props) {
322
+ let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
323
+ return _responsive(media, props.$borderTop, (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } });
324
+ }
325
+ function borderRight(props) {
326
+ let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
327
+ return _responsive(media, props.$borderRight, (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } });
328
+ }
329
+ function borderBottom(props) {
330
+ let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
331
+ return _responsive(media, props.$borderBottom, (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } });
332
+ }
333
+ function borderLeft(props) {
334
+ let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
335
+ return _responsive(media, props.$borderLeft, (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } });
336
+ }
337
+ const BASE_STYLE$3 = { "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" } }, BOX_SIZING = {
338
+ content: "content-box",
339
+ border: "border-box"
340
+ }, BOX_HEIGHT = {
341
+ stretch: "stretch",
342
+ fill: "100%"
343
+ };
344
+ function boxStyle() {
345
+ return BASE_STYLE$3;
346
+ }
347
+ function responsiveBoxStyle() {
348
+ return [
349
+ responsiveBoxSizingStyle,
350
+ responsiveBoxHeightStyle,
351
+ responsiveBoxOverflowStyle,
352
+ responsiveBoxDisplayStyle
353
+ ];
354
+ }
355
+ function responsiveBoxDisplayStyle(props) {
356
+ let { media } = getTheme_v2(props.theme);
357
+ return _responsive(media, props.$display, (display) => ({ "&:not([hidden])": { display } }));
358
+ }
359
+ function responsiveBoxSizingStyle(props) {
360
+ let { media } = getTheme_v2(props.theme);
361
+ return _responsive(media, props.$sizing, (sizing) => ({ boxSizing: BOX_SIZING[sizing] }));
362
+ }
363
+ function responsiveBoxHeightStyle(props) {
364
+ let { media } = getTheme_v2(props.theme);
365
+ return _responsive(media, props.$height, (height) => ({ height: BOX_HEIGHT[height] }));
366
+ }
367
+ function responsiveBoxOverflowStyle(props) {
368
+ let { media } = getTheme_v2(props.theme);
369
+ return _responsive(media, props.$overflow, (overflow) => ({ overflow }));
370
+ }
371
+ const BASE_STYLE$2 = {
372
+ minWidth: 0,
373
+ minHeight: 0
374
+ };
375
+ function flexItemStyle() {
376
+ return [BASE_STYLE$2, responsiveFlexItemStyle];
377
+ }
378
+ function responsiveFlexItemStyle(props) {
379
+ let { media } = getTheme_v2(props.theme);
380
+ return props.$flex ? _responsive(media, props.$flex, (flex) => ({ flex: `${flex}` })) : EMPTY_ARRAY;
381
+ }
382
+ const BASE_STYLE$1 = { "&&:not([hidden])": { display: "flex" } };
383
+ function responsiveFlexStyle() {
384
+ return [
385
+ BASE_STYLE$1,
386
+ responsiveFlexAlignStyle,
387
+ responsiveFlexGapStyle,
388
+ responsiveFlexWrapStyle,
389
+ responsiveFlexJustifyStyle,
390
+ responsiveFlexDirectionStyle
391
+ ];
392
+ }
393
+ function responsiveFlexAlignStyle(props) {
394
+ let { media } = getTheme_v2(props.theme);
395
+ return _responsive(media, props.$align, (align) => ({ alignItems: align }));
396
+ }
397
+ function responsiveFlexGapStyle(props) {
398
+ let { media, space } = getTheme_v2(props.theme);
399
+ return _responsive(media, props.$gap, (gap) => ({ gap: gap ? rem(space[gap]) : void 0 }));
400
+ }
401
+ function responsiveFlexWrapStyle(props) {
402
+ let { media } = getTheme_v2(props.theme);
403
+ return _responsive(media, props.$wrap, (wrap) => ({ flexWrap: wrap }));
404
+ }
405
+ function responsiveFlexJustifyStyle(props) {
406
+ let { media } = getTheme_v2(props.theme);
407
+ return _responsive(media, props.$justify, (justify) => ({ justifyContent: justify }));
408
+ }
409
+ function responsiveFlexDirectionStyle(props) {
410
+ let { media } = getTheme_v2(props.theme);
411
+ return _responsive(media, props.$direction, (direction) => ({ flexDirection: direction }));
412
+ }
413
+ function focusRingBorderStyle(border) {
414
+ return `inset 0 0 0 ${border.width}px ${border.color}`;
415
+ }
416
+ function focusRingStyle(opts) {
417
+ let { base, border, focusRing } = opts, focusRingOutsetWidth = focusRing.offset + focusRing.width, focusRingInsetWidth = 0 - focusRing.offset, bgColor = base ? base.bg : "var(--card-bg-color)";
418
+ return [
419
+ focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
420
+ border && focusRingBorderStyle(border),
421
+ focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
422
+ focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`
423
+ ].filter(Boolean).join(",");
424
+ }
425
+ function responsiveGridItemStyle() {
426
+ return [
427
+ responsiveGridItemRowStyle,
428
+ responsiveGridItemRowStartStyle,
429
+ responsiveGridItemRowEndStyle,
430
+ responsiveGridItemColumnStyle,
431
+ responsiveGridItemColumnStartStyle,
432
+ responsiveGridItemColumnEndStyle
433
+ ];
434
+ }
435
+ const GRID_ITEM_ROW = {
436
+ auto: "auto",
437
+ full: "1 / -1"
438
+ }, GRID_ITEM_COLUMN = {
439
+ auto: "auto",
440
+ full: "1 / -1"
441
+ };
442
+ function responsiveGridItemRowStyle(props) {
443
+ let { media } = getTheme_v2(props.theme);
444
+ return _responsive(media, props.$row, (row) => typeof row == "number" ? { gridRow: `span ${row} / span ${row}` } : { gridRow: GRID_ITEM_ROW[row] });
445
+ }
446
+ function responsiveGridItemRowStartStyle(props) {
447
+ let { media } = getTheme_v2(props.theme);
448
+ return _responsive(media, props.$rowStart, (rowStart) => ({ gridRowStart: `${rowStart}` }));
449
+ }
450
+ function responsiveGridItemRowEndStyle(props) {
451
+ let { media } = getTheme_v2(props.theme);
452
+ return _responsive(media, props.$rowEnd, (rowEnd) => ({ gridRowEnd: `${rowEnd}` }));
453
+ }
454
+ function responsiveGridItemColumnStyle(props) {
455
+ let { media } = getTheme_v2(props.theme);
456
+ return _responsive(media, props.$column, (column) => typeof column == "number" ? { gridColumn: `span ${column} / span ${column}` } : { gridColumn: GRID_ITEM_COLUMN[column] });
457
+ }
458
+ function responsiveGridItemColumnStartStyle(props) {
459
+ let { media } = getTheme_v2(props.theme);
460
+ return _responsive(media, props.$columnStart, (columnStart) => ({ gridColumnStart: `${columnStart}` }));
461
+ }
462
+ function responsiveGridItemColumnEndStyle(props) {
463
+ let { media } = getTheme_v2(props.theme);
464
+ return _responsive(media, props.$columnEnd, (columnEnd) => ({ gridColumnEnd: `${columnEnd}` }));
465
+ }
466
+ const GRID_CSS = {
467
+ "&&:not([hidden])": { display: "grid" },
468
+ "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" }
469
+ }, GRID_AUTO_COLUMS = {
470
+ auto: "auto",
471
+ min: "min-content",
472
+ max: "max-content",
473
+ fr: "minmax(0, 1fr)"
474
+ }, GRID_AUTO_ROWS = {
475
+ auto: "auto",
476
+ min: "min-content",
477
+ max: "max-content",
478
+ fr: "minmax(0, 1fr)"
479
+ };
480
+ function responsiveGridStyle() {
481
+ return [
482
+ GRID_CSS,
483
+ responsiveGridAutoFlowStyle,
484
+ responsiveGridAutoRowsStyle,
485
+ responsiveGridAutoColsStyle,
486
+ responsiveGridColumnsStyle,
487
+ responsiveGridRowsStyle,
488
+ responsiveGridGapStyle,
489
+ responsiveGridGapXStyle,
490
+ responsiveGridGapYStyle
491
+ ];
492
+ }
493
+ function responsiveGridAutoFlowStyle(props) {
494
+ let { media } = getTheme_v2(props.theme);
495
+ return _responsive(media, props.$autoFlow, (autoFlow) => ({ gridAutoFlow: autoFlow }));
496
+ }
497
+ function responsiveGridAutoRowsStyle(props) {
498
+ let { media } = getTheme_v2(props.theme);
499
+ return _responsive(media, props.$autoRows, (autoRows) => ({ gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows] }));
500
+ }
501
+ function responsiveGridAutoColsStyle(props) {
502
+ let { media } = getTheme_v2(props.theme);
503
+ return _responsive(media, props.$autoCols, (autoCols) => ({ gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols] }));
504
+ }
505
+ function responsiveGridColumnsStyle(props) {
506
+ let { media } = getTheme_v2(props.theme);
507
+ return _responsive(media, props.$columns, (columns) => ({ gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));` }));
508
+ }
509
+ function responsiveGridRowsStyle(props) {
510
+ let { media } = getTheme_v2(props.theme);
511
+ return _responsive(media, props.$rows, (rows) => ({ gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));` }));
512
+ }
513
+ function responsiveGridGapStyle(props) {
514
+ let { media, space } = getTheme_v2(props.theme);
515
+ return _responsive(media, props.$gap, (gap) => ({ gridGap: gap ? rem(space[gap]) : void 0 }));
516
+ }
517
+ function responsiveGridGapXStyle(props) {
518
+ let { media, space } = getTheme_v2(props.theme);
519
+ return _responsive(media, props.$gapX, (gapX) => ({ columnGap: gapX ? rem(space[gapX]) : void 0 }));
520
+ }
521
+ function responsiveGridGapYStyle(props) {
522
+ let { media, space } = getTheme_v2(props.theme);
523
+ return _responsive(media, props.$gapY, (gapY) => ({ rowGap: gapY ? rem(space[gapY]) : void 0 }));
524
+ }
525
+ function responsiveInputPaddingStyle(props) {
526
+ let { $fontSize, $iconLeft, $iconRight, $padding, $space } = props, { font, media, space } = getTheme_v2(props.theme), len = Math.max($padding.length, $space.length, $fontSize.length), _padding = [], _space = [], _fontSize = [];
527
+ for (let i = 0; i < len; i += 1) _fontSize[i] = $fontSize[i] === void 0 ? _fontSize[i - 1] : $fontSize[i], _padding[i] = $padding[i] === void 0 ? _padding[i - 1] : $padding[i], _space[i] = $space[i] === void 0 ? _space[i - 1] : $space[i];
528
+ return _responsive(media, _padding, (_, i) => {
529
+ let size = font.text.sizes[_fontSize[i]] || font.text.sizes[2], emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight, p = space[_padding[i]], s = space[_space[i]], styles = {
530
+ paddingTop: rem(p - size.ascenderHeight),
531
+ paddingRight: rem(p),
532
+ paddingBottom: rem(p - size.descenderHeight),
533
+ paddingLeft: rem(p)
534
+ };
535
+ return $iconRight && (styles.paddingRight = rem(p + emSize + s)), $iconLeft && (styles.paddingLeft = rem(p + emSize + s)), styles;
536
+ });
537
+ }
538
+ function responsiveInputPaddingIconRightStyle(props) {
539
+ return responsiveInputPaddingStyle({
540
+ ...props,
541
+ $iconRight: !0
542
+ });
543
+ }
544
+ const ROOT_STYLE = css`&:not([hidden]){display:flex;}align-items:center;`;
545
+ function textInputRootStyle() {
546
+ return ROOT_STYLE;
547
+ }
548
+ function textInputBaseStyle(props) {
549
+ let { $scheme, $tone, $weight } = props, { color, font } = getTheme_v2(props.theme);
550
+ return css`appearance:none;background:none;border:0;border-radius:0;outline:none;width:100%;box-sizing:border-box;font-family:${font.text.family};font-weight:${$weight && font.text.weights[$weight] || font.text.weights.regular};margin:0;position:relative;z-index:1;display:block;&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus,&:-webkit-autofill:active{-webkit-text-fill-color:var(--input-fg-color) !important;transition:background-color 5000s;transition-delay:86400s;}&[data-as='textarea']{resize:none;}color:var(--input-fg-color);&::placeholder{color:var(--input-placeholder-color);}&[data-scheme='${$scheme}'][data-tone='${$tone}']{--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};&:not(:invalid):not(:disabled):not(:read-only){--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};}&:not(:invalid):disabled{--input-fg-color:${color.input.default.disabled.fg};--input-placeholder-color:${color.input.default.disabled.placeholder};}&:invalid{--input-fg-color:${color.input.invalid.enabled.fg};--input-placeholder-color:${color.input.invalid.enabled.placeholder};}&:read-only{--input-fg-color:${color.input.default.readOnly.fg};--input-placeholder-color:${color.input.default.readOnly.placeholder};}}`;
551
+ }
552
+ function textInputFontSizeStyle(props) {
553
+ let { font, media } = getTheme_v2(props.theme);
554
+ return _responsive(media, props.$fontSize, (sizeIndex) => {
555
+ let size = font.text.sizes[sizeIndex] || font.text.sizes[2];
556
+ return {
557
+ fontSize: rem(size.fontSize),
558
+ lineHeight: `${size.lineHeight / size.fontSize}`
559
+ };
560
+ });
561
+ }
562
+ function textInputRepresentationStyle(props) {
563
+ let { $hasPrefix, $hasSuffix, $scheme, $tone, $unstableDisableFocusRing } = props, { color, input } = getTheme_v2(props.theme);
564
+ return css`--input-box-shadow:none;position:absolute;top:0;left:0;right:0;bottom:0;display:block;pointer-events:none;z-index:0;background-color:var(--card-bg-color);box-shadow:var(--input-box-shadow);border-top-left-radius:${$hasPrefix ? 0 : void 0};border-bottom-left-radius:${$hasPrefix ? 0 : void 0};border-top-right-radius:${$hasSuffix ? 0 : void 0};border-bottom-right-radius:${$hasSuffix ? 0 : void 0};&[data-scheme='${$scheme}'][data-tone='${$tone}']{--card-bg-color:${color.input.default.enabled.bg};--card-fg-color:${color.input.default.enabled.fg};*:not(:disabled) + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
565
+ color: color.input.default.enabled.border,
566
+ width: input.border.width
567
+ })};}*:not(:disabled):invalid + &{--card-bg-color:${color.input.invalid.enabled.bg};--card-fg-color:${color.input.invalid.enabled.fg};&[data-border]{--input-box-shadow:${focusRingBorderStyle({
568
+ color: color.input.invalid.enabled.border,
569
+ width: input.border.width
570
+ })};}}*:not(:disabled):focus + &{&[data-border]{--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({
571
+ border: {
572
+ color: color.input.default.enabled.border,
573
+ width: input.border.width
574
+ },
575
+ focusRing: input.text.focusRing
576
+ })};}&:not([data-border]){--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({ focusRing: input.text.focusRing })};}}*:not(:invalid):disabled + &{--card-bg-color:${color.input.default.disabled.bg} !important;--card-fg-color:${color.input.default.disabled.fg} !important;--card-icon-color:${color.input.default.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
577
+ color: color.input.default.disabled.border,
578
+ width: input.border.width
579
+ })};}}*:invalid:disabled + &{--card-bg-color:${color.input.invalid.disabled.bg} !important;--card-fg-color:${color.input.invalid.disabled.fg} !important;--card-icon-color:${color.input.invalid.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
580
+ color: color.input.invalid.disabled.border,
581
+ width: input.border.width
582
+ })};}}*:not(:invalid):read-only + &{--card-bg-color:${color.input.default.readOnly.bg} !important;--card-fg-color:${color.input.default.readOnly.fg} !important;}*:invalid:read-only + &{--card-bg-color:${color.input.invalid.readOnly.bg} !important;--card-fg-color:${color.input.invalid.readOnly.fg} !important;}@media (hover:hover){*:not(:disabled):not(:read-only):not(:invalid):hover + &{--card-bg-color:${color.input.default.hovered.bg};--card-fg-color:${color.input.default.hovered.fg};}*:invalid:not(:disabled):not(:read-only):hover + &{--card-bg-color:${color.input.invalid.hovered.bg};--card-fg-color:${color.input.invalid.hovered.fg};}*:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
583
+ color: color.input.default.hovered.border,
584
+ width: input.border.width
585
+ })};}*:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
586
+ color: color.input.invalid.hovered.border,
587
+ width: input.border.width
588
+ })};}}}`;
589
+ }
590
+ function responsiveMarginStyle(props) {
591
+ let { theme } = props;
592
+ return [
593
+ _getResponsiveSpace(theme, ["margin"], props.$margin),
594
+ _getResponsiveSpace(theme, ["marginLeft", "marginRight"], props.$marginX),
595
+ _getResponsiveSpace(theme, ["marginTop", "marginBottom"], props.$marginY),
596
+ _getResponsiveSpace(theme, ["marginTop"], props.$marginTop),
597
+ _getResponsiveSpace(theme, ["marginRight"], props.$marginRight),
598
+ _getResponsiveSpace(theme, ["marginBottom"], props.$marginBottom),
599
+ _getResponsiveSpace(theme, ["marginLeft"], props.$marginLeft)
600
+ ].filter(Boolean);
601
+ }
602
+ function responsivePaddingStyle(props) {
603
+ let { theme } = props;
604
+ return [
605
+ _getResponsiveSpace(theme, ["padding"], props.$padding),
606
+ _getResponsiveSpace(theme, ["paddingLeft", "paddingRight"], props.$paddingX),
607
+ _getResponsiveSpace(theme, ["paddingTop", "paddingBottom"], props.$paddingY),
608
+ _getResponsiveSpace(theme, ["paddingTop"], props.$paddingTop),
609
+ _getResponsiveSpace(theme, ["paddingRight"], props.$paddingRight),
610
+ _getResponsiveSpace(theme, ["paddingBottom"], props.$paddingBottom),
611
+ _getResponsiveSpace(theme, ["paddingLeft"], props.$paddingLeft)
612
+ ].filter(Boolean);
613
+ }
614
+ function responsiveRadiusStyle(props) {
615
+ let { media, radius } = getTheme_v2(props.theme);
616
+ return _responsive(media, props.$radius, (value) => {
617
+ let borderRadius = 0;
618
+ return typeof value == "number" && (borderRadius = rem(radius[value])), value === "full" && (borderRadius = "9999px"), { borderRadius };
619
+ });
620
+ }
621
+ function toBoxShadow(shadow, color) {
622
+ return `${shadow.map(rem).join(" ")} ${color}`;
623
+ }
624
+ function shadowStyle(shadow, outlineWidth = 1) {
625
+ return shadow ? { boxShadow: `${`0 0 0 ${rem(outlineWidth)} var(--card-shadow-outline-color)`}, ${toBoxShadow(shadow.umbra, "var(--card-shadow-umbra-color)")}, ${toBoxShadow(shadow.penumbra, "var(--card-shadow-penumbra-color)")}, ${toBoxShadow(shadow.ambient, "var(--card-shadow-ambient-color)")}` } : EMPTY_RECORD;
626
+ }
627
+ function responsiveShadowStyle(props) {
628
+ let { card, media, shadow } = getTheme_v2(props.theme);
629
+ return _responsive(media, props.$shadow, (index) => shadowStyle(shadow[index], card.shadow.outline));
630
+ }
631
+ /** @internal */
632
+ const SpanWithTextOverflow = styled.span.withConfig({
633
+ displayName: "SpanWithTextOverflow",
634
+ componentId: "sc-xkyu3h-0"
635
+ })`display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;overflow:clip;`, StyledBox = /* @__PURE__ */ styled.div.withConfig({
636
+ displayName: "StyledBox",
637
+ componentId: "sc-7yq461-0"
638
+ })(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), BoxComponent = forwardRef(function(props, ref) {
639
+ let $ = c(115), deprecated_column, deprecated_columnEnd, deprecated_columnStart, deprecated_row, deprecated_rowEnd, deprecated_rowStart, flex, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, height, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, overflow, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, restProps, sizing, t0, t1, t2, t3;
640
+ $[0] === props ? (deprecated_column = $[1], deprecated_columnEnd = $[2], deprecated_columnStart = $[3], deprecated_row = $[4], deprecated_rowEnd = $[5], deprecated_rowStart = $[6], flex = $[7], gridColumn = $[8], gridColumnEnd = $[9], gridColumnStart = $[10], gridRow = $[11], gridRowEnd = $[12], gridRowStart = $[13], height = $[14], marginBottom = $[15], marginLeft = $[16], marginRight = $[17], marginTop = $[18], marginX = $[19], marginY = $[20], overflow = $[21], paddingBottom = $[22], paddingLeft = $[23], paddingRight = $[24], paddingTop = $[25], paddingX = $[26], paddingY = $[27], restProps = $[28], sizing = $[29], t0 = $[30], t1 = $[31], t2 = $[32], t3 = $[33]) : ({as: t0, gridColumn, column: deprecated_column, gridColumnStart, columnStart: deprecated_columnStart, gridColumnEnd, columnEnd: deprecated_columnEnd, display: t1, flex, height, margin: t2, marginX, marginY, marginTop, marginRight, marginBottom, marginLeft, overflow, padding: t3, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, gridRow, row: deprecated_row, gridRowStart, rowStart: deprecated_rowStart, gridRowEnd, rowEnd: deprecated_rowEnd, sizing, ...restProps} = props, $[0] = props, $[1] = deprecated_column, $[2] = deprecated_columnEnd, $[3] = deprecated_columnStart, $[4] = deprecated_row, $[5] = deprecated_rowEnd, $[6] = deprecated_rowStart, $[7] = flex, $[8] = gridColumn, $[9] = gridColumnEnd, $[10] = gridColumnStart, $[11] = gridRow, $[12] = gridRowEnd, $[13] = gridRowStart, $[14] = height, $[15] = marginBottom, $[16] = marginLeft, $[17] = marginRight, $[18] = marginTop, $[19] = marginX, $[20] = marginY, $[21] = overflow, $[22] = paddingBottom, $[23] = paddingLeft, $[24] = paddingRight, $[25] = paddingTop, $[26] = paddingX, $[27] = paddingY, $[28] = restProps, $[29] = sizing, $[30] = t0, $[31] = t1, $[32] = t2, $[33] = t3);
641
+ let asProp = t0 === void 0 ? "div" : t0, display = t1 === void 0 ? "block" : t1, margin = t2 === void 0 ? 0 : t2, padding = t3 === void 0 ? 0 : t3, column = gridColumn === void 0 ? deprecated_column : gridColumn, columnStart = gridColumnStart === void 0 ? deprecated_columnStart : gridColumnStart, columnEnd = gridColumnEnd === void 0 ? deprecated_columnEnd : gridColumnEnd, row = gridRow === void 0 ? deprecated_row : gridRow, rowStart = gridRowStart === void 0 ? deprecated_rowStart : gridRowStart, rowEnd = gridRowEnd === void 0 ? deprecated_rowEnd : gridRowEnd, t4 = typeof asProp == "string" ? asProp : void 0, t5;
642
+ $[34] === column ? t5 = $[35] : (t5 = _getArrayProp(column), $[34] = column, $[35] = t5);
643
+ let t6;
644
+ $[36] === columnStart ? t6 = $[37] : (t6 = _getArrayProp(columnStart), $[36] = columnStart, $[37] = t6);
645
+ let t7;
646
+ $[38] === columnEnd ? t7 = $[39] : (t7 = _getArrayProp(columnEnd), $[38] = columnEnd, $[39] = t7);
647
+ let t8;
648
+ $[40] === display ? t8 = $[41] : (t8 = _getArrayProp(display), $[40] = display, $[41] = t8);
649
+ let t9;
650
+ $[42] === flex ? t9 = $[43] : (t9 = _getArrayProp(flex), $[42] = flex, $[43] = t9);
651
+ let t10;
652
+ $[44] === height ? t10 = $[45] : (t10 = _getArrayProp(height), $[44] = height, $[45] = t10);
653
+ let t11;
654
+ $[46] === margin ? t11 = $[47] : (t11 = _getArrayProp(margin), $[46] = margin, $[47] = t11);
655
+ let t12;
656
+ $[48] === marginX ? t12 = $[49] : (t12 = _getArrayProp(marginX), $[48] = marginX, $[49] = t12);
657
+ let t13;
658
+ $[50] === marginY ? t13 = $[51] : (t13 = _getArrayProp(marginY), $[50] = marginY, $[51] = t13);
659
+ let t14;
660
+ $[52] === marginTop ? t14 = $[53] : (t14 = _getArrayProp(marginTop), $[52] = marginTop, $[53] = t14);
661
+ let t15;
662
+ $[54] === marginRight ? t15 = $[55] : (t15 = _getArrayProp(marginRight), $[54] = marginRight, $[55] = t15);
663
+ let t16;
664
+ $[56] === marginBottom ? t16 = $[57] : (t16 = _getArrayProp(marginBottom), $[56] = marginBottom, $[57] = t16);
665
+ let t17;
666
+ $[58] === marginLeft ? t17 = $[59] : (t17 = _getArrayProp(marginLeft), $[58] = marginLeft, $[59] = t17);
667
+ let t18;
668
+ $[60] === overflow ? t18 = $[61] : (t18 = _getArrayProp(overflow), $[60] = overflow, $[61] = t18);
669
+ let t19;
670
+ $[62] === padding ? t19 = $[63] : (t19 = _getArrayProp(padding), $[62] = padding, $[63] = t19);
671
+ let t20;
672
+ $[64] === paddingX ? t20 = $[65] : (t20 = _getArrayProp(paddingX), $[64] = paddingX, $[65] = t20);
673
+ let t21;
674
+ $[66] === paddingY ? t21 = $[67] : (t21 = _getArrayProp(paddingY), $[66] = paddingY, $[67] = t21);
675
+ let t22;
676
+ $[68] === paddingTop ? t22 = $[69] : (t22 = _getArrayProp(paddingTop), $[68] = paddingTop, $[69] = t22);
677
+ let t23;
678
+ $[70] === paddingRight ? t23 = $[71] : (t23 = _getArrayProp(paddingRight), $[70] = paddingRight, $[71] = t23);
679
+ let t24;
680
+ $[72] === paddingBottom ? t24 = $[73] : (t24 = _getArrayProp(paddingBottom), $[72] = paddingBottom, $[73] = t24);
681
+ let t25;
682
+ $[74] === paddingLeft ? t25 = $[75] : (t25 = _getArrayProp(paddingLeft), $[74] = paddingLeft, $[75] = t25);
683
+ let t26;
684
+ $[76] === row ? t26 = $[77] : (t26 = _getArrayProp(row), $[76] = row, $[77] = t26);
685
+ let t27;
686
+ $[78] === rowStart ? t27 = $[79] : (t27 = _getArrayProp(rowStart), $[78] = rowStart, $[79] = t27);
687
+ let t28;
688
+ $[80] === rowEnd ? t28 = $[81] : (t28 = _getArrayProp(rowEnd), $[80] = rowEnd, $[81] = t28);
689
+ let t29;
690
+ $[82] === sizing ? t29 = $[83] : (t29 = _getArrayProp(sizing), $[82] = sizing, $[83] = t29);
691
+ let t30;
692
+ return $[84] !== asProp || $[85] !== props.children || $[86] !== ref || $[87] !== restProps || $[88] !== t10 || $[89] !== t11 || $[90] !== t12 || $[91] !== t13 || $[92] !== t14 || $[93] !== t15 || $[94] !== t16 || $[95] !== t17 || $[96] !== t18 || $[97] !== t19 || $[98] !== t20 || $[99] !== t21 || $[100] !== t22 || $[101] !== t23 || $[102] !== t24 || $[103] !== t25 || $[104] !== t26 || $[105] !== t27 || $[106] !== t28 || $[107] !== t29 || $[108] !== t4 || $[109] !== t5 || $[110] !== t6 || $[111] !== t7 || $[112] !== t8 || $[113] !== t9 ? (t30 = /* @__PURE__ */ jsx(StyledBox, {
693
+ "data-as": t4,
694
+ "data-ui": "Box",
695
+ ...restProps,
696
+ $column: t5,
697
+ $columnStart: t6,
698
+ $columnEnd: t7,
699
+ $display: t8,
700
+ $flex: t9,
701
+ $height: t10,
702
+ $margin: t11,
703
+ $marginX: t12,
704
+ $marginY: t13,
705
+ $marginTop: t14,
706
+ $marginRight: t15,
707
+ $marginBottom: t16,
708
+ $marginLeft: t17,
709
+ $overflow: t18,
710
+ $padding: t19,
711
+ $paddingX: t20,
712
+ $paddingY: t21,
713
+ $paddingTop: t22,
714
+ $paddingRight: t23,
715
+ $paddingBottom: t24,
716
+ $paddingLeft: t25,
717
+ $row: t26,
718
+ $rowStart: t27,
719
+ $rowEnd: t28,
720
+ $sizing: t29,
721
+ as: asProp,
722
+ ref,
723
+ children: props.children
724
+ }), $[84] = asProp, $[85] = props.children, $[86] = ref, $[87] = restProps, $[88] = t10, $[89] = t11, $[90] = t12, $[91] = t13, $[92] = t14, $[93] = t15, $[94] = t16, $[95] = t17, $[96] = t18, $[97] = t19, $[98] = t20, $[99] = t21, $[100] = t22, $[101] = t23, $[102] = t24, $[103] = t25, $[104] = t26, $[105] = t27, $[106] = t28, $[107] = t29, $[108] = t4, $[109] = t5, $[110] = t6, $[111] = t7, $[112] = t8, $[113] = t9, $[114] = t30) : t30 = $[114], t30;
725
+ });
726
+ BoxComponent.displayName = "ForwardRef(Box)";
727
+ /**
728
+ * The `Box` component is a basic layout wrapper component which provides utility properties
729
+ * for flex, margins and padding.
730
+ *
731
+ * @public
732
+ */
733
+ const Box = BoxComponent;
734
+ function textBaseStyle(props) {
735
+ let { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
736
+ return css`color:var(--card-fg-color);${$accent && css`color:var(--card-accent-fg-color);`} ${$muted && css`color:var(--card-muted-fg-color);`} & code{font-family:${font.code.family};border-radius:1px;background-color:var(--card-code-bg-color);color:var(--card-code-fg-color);}& a{text-decoration:none;border-radius:1px;color:var(--card-link-color);outline:none;@media (hover:hover){&:hover{text-decoration:underline;}}&:focus{box-shadow:0 0 0 1px var(--card-bg-color),0 0 0 3px var(--card-focus-ring-color);}&:focus:not(:focus-visible){box-shadow:none;}}& strong{font-weight:${font.text.weights.bold};}& svg{display:inline;}& [data-sanity-icon]{vertical-align:baseline;color:var(--card-icon-color);& path{vector-effect:non-scaling-stroke !important;}}`;
737
+ }
738
+ const StyledText = /* @__PURE__ */ styled.div.withConfig({
739
+ displayName: "StyledText",
740
+ componentId: "sc-aca14k-0"
741
+ })(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle), TextComponent = forwardRef(function(props, ref) {
742
+ let $ = c(26), align, childrenProp, restProps, t0, t1, t2, textOverflow, weight;
743
+ $[0] === props ? (align = $[1], childrenProp = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], textOverflow = $[7], weight = $[8]) : ({accent: t0, align, children: childrenProp, muted: t1, size: t2, textOverflow, weight, ...restProps} = props, $[0] = props, $[1] = align, $[2] = childrenProp, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = textOverflow, $[8] = weight);
744
+ let accent = t0 === void 0 ? !1 : t0, muted = t1 === void 0 ? !1 : t1, size = t2 === void 0 ? 2 : t2, children = childrenProp;
745
+ if (textOverflow === "ellipsis") {
746
+ let t3;
747
+ $[9] === children ? t3 = $[10] : (t3 = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children }), $[9] = children, $[10] = t3), children = t3;
748
+ }
749
+ let t3;
750
+ $[11] === align ? t3 = $[12] : (t3 = _getArrayProp(align), $[11] = align, $[12] = t3);
751
+ let t4;
752
+ $[13] === size ? t4 = $[14] : (t4 = _getArrayProp(size), $[13] = size, $[14] = t4);
753
+ let t5;
754
+ $[15] === children ? t5 = $[16] : (t5 = /* @__PURE__ */ jsx("span", { children }), $[15] = children, $[16] = t5);
755
+ let t6;
756
+ return $[17] !== accent || $[18] !== muted || $[19] !== ref || $[20] !== restProps || $[21] !== t3 || $[22] !== t4 || $[23] !== t5 || $[24] !== weight ? (t6 = /* @__PURE__ */ jsx(StyledText, {
757
+ "data-ui": "Text",
758
+ ...restProps,
759
+ $accent: accent,
760
+ $align: t3,
761
+ $muted: muted,
762
+ ref,
763
+ $size: t4,
764
+ $weight: weight,
765
+ children: t5
766
+ }), $[17] = accent, $[18] = muted, $[19] = ref, $[20] = restProps, $[21] = t3, $[22] = t4, $[23] = t5, $[24] = weight, $[25] = t6) : t6 = $[25], t6;
767
+ });
768
+ TextComponent.displayName = "ForwardRef(Text)";
769
+ /**
770
+ * The `Text` component is an agile, themed typographic element.
771
+ *
772
+ * @public
773
+ */
774
+ const Text = TextComponent, StyledFlex = /* @__PURE__ */ styled(Box).withConfig({
775
+ displayName: "StyledFlex",
776
+ componentId: "sc-r9nqck-0"
777
+ })(flexItemStyle, responsiveFlexStyle), FlexComponent = forwardRef(function(props, ref) {
778
+ let $ = c(27), align, as, gap, justify, restProps, t0, wrap;
779
+ $[0] === props ? (align = $[1], as = $[2], gap = $[3], justify = $[4], restProps = $[5], t0 = $[6], wrap = $[7]) : ({align, as, direction: t0, gap, justify, wrap, ...restProps} = props, $[0] = props, $[1] = align, $[2] = as, $[3] = gap, $[4] = justify, $[5] = restProps, $[6] = t0, $[7] = wrap);
780
+ let direction = t0 === void 0 ? "row" : t0, t1;
781
+ $[8] === align ? t1 = $[9] : (t1 = _getArrayProp(align), $[8] = align, $[9] = t1);
782
+ let t2;
783
+ $[10] === direction ? t2 = $[11] : (t2 = _getArrayProp(direction), $[10] = direction, $[11] = t2);
784
+ let t3;
785
+ $[12] === gap ? t3 = $[13] : (t3 = _getArrayProp(gap), $[12] = gap, $[13] = t3);
786
+ let t4;
787
+ $[14] === justify ? t4 = $[15] : (t4 = _getArrayProp(justify), $[14] = justify, $[15] = t4);
788
+ let t5;
789
+ $[16] === wrap ? t5 = $[17] : (t5 = _getArrayProp(wrap), $[16] = wrap, $[17] = t5);
790
+ let t6;
791
+ return $[18] !== as || $[19] !== ref || $[20] !== restProps || $[21] !== t1 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledFlex, {
792
+ "data-ui": "Flex",
793
+ ...restProps,
794
+ $align: t1,
795
+ $direction: t2,
796
+ $gap: t3,
797
+ $justify: t4,
798
+ $wrap: t5,
799
+ forwardedAs: as,
800
+ ref
801
+ }), $[18] = as, $[19] = ref, $[20] = restProps, $[21] = t1, $[22] = t2, $[23] = t3, $[24] = t4, $[25] = t5, $[26] = t6) : t6 = $[26], t6;
802
+ });
803
+ FlexComponent.displayName = "ForwardRef(Flex)";
804
+ /**
805
+ * The `Flex` component is a wrapper component for flexible elements (`Box`, `Card` and `Flex`).
806
+ *
807
+ * @public
808
+ */
809
+ const Flex = FlexComponent, rotate = keyframes`from{transform:rotate(0deg);}to{transform:rotate(360deg);}`, StyledSpinner = styled(Text).withConfig({
810
+ displayName: "StyledSpinner",
811
+ componentId: "sc-jtkakc-0"
812
+ })`& > span > svg{animation:${rotate} 500ms linear infinite;}`, Spinner = forwardRef(function(props, ref) {
813
+ let $ = c(4), t0;
814
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(SpinnerIcon, {}), $[0] = t0) : t0 = $[0];
815
+ let t1;
816
+ return $[1] !== props || $[2] !== ref ? (t1 = /* @__PURE__ */ jsx(StyledSpinner, {
817
+ "data-ui": "Spinner",
818
+ ...props,
819
+ ref,
820
+ children: t0
821
+ }), $[1] = props, $[2] = ref, $[3] = t1) : t1 = $[3], t1;
822
+ });
823
+ Spinner.displayName = "ForwardRef(Spinner)";
824
+ /**
825
+ * @internal
826
+ */
827
+ function _cardColorStyle(base, color, checkered = !1) {
828
+ return {
829
+ "--card-backdrop-color": base.backdrop,
830
+ "--card-focus-ring-color": base.focusRing,
831
+ "--card-shadow-outline-color": base.shadow.outline,
832
+ "--card-shadow-umbra-color": base.shadow.umbra,
833
+ "--card-shadow-penumbra-color": base.shadow.penumbra,
834
+ "--card-shadow-ambient-color": base.shadow.ambient,
835
+ "--card-accent-fg-color": color.accent.fg,
836
+ "--card-avatar-gray-bg-color": color.avatar.gray.bg,
837
+ "--card-avatar-gray-fg-color": color.avatar.gray.fg,
838
+ "--card-avatar-blue-bg-color": color.avatar.blue.bg,
839
+ "--card-avatar-blue-fg-color": color.avatar.blue.fg,
840
+ "--card-avatar-purple-bg-color": color.avatar.purple.bg,
841
+ "--card-avatar-purple-fg-color": color.avatar.purple.fg,
842
+ "--card-avatar-magenta-bg-color": color.avatar.magenta.bg,
843
+ "--card-avatar-magenta-fg-color": color.avatar.magenta.fg,
844
+ "--card-avatar-red-bg-color": color.avatar.red.bg,
845
+ "--card-avatar-red-fg-color": color.avatar.red.fg,
846
+ "--card-avatar-orange-bg-color": color.avatar.orange.bg,
847
+ "--card-avatar-orange-fg-color": color.avatar.orange.fg,
848
+ "--card-avatar-yellow-bg-color": color.avatar.yellow.bg,
849
+ "--card-avatar-yellow-fg-color": color.avatar.yellow.fg,
850
+ "--card-avatar-green-bg-color": color.avatar.green.bg,
851
+ "--card-avatar-green-fg-color": color.avatar.green.fg,
852
+ "--card-avatar-cyan-bg-color": color.avatar.cyan.bg,
853
+ "--card-avatar-cyan-fg-color": color.avatar.cyan.fg,
854
+ "--card-bg-color": color.bg,
855
+ "--card-bg-image": checkered ? `repeating-conic-gradient(${color.bg} 0% 25%, ${color.muted.bg} 0% 50%)` : void 0,
856
+ "--card-border-color": color.border,
857
+ "--card-badge-default-bg-color": color.badge.default.bg,
858
+ "--card-badge-default-dot-color": color.badge.default.dot,
859
+ "--card-badge-default-fg-color": color.badge.default.fg,
860
+ "--card-badge-default-icon-color": color.badge.default.icon,
861
+ "--card-badge-neutral-bg-color": color.badge.neutral?.bg,
862
+ "--card-badge-neutral-dot-color": color.badge.neutral?.dot,
863
+ "--card-badge-neutral-fg-color": color.badge.neutral?.fg,
864
+ "--card-badge-neutral-icon-color": color.badge.neutral?.icon,
865
+ "--card-badge-primary-bg-color": color.badge.primary.bg,
866
+ "--card-badge-primary-dot-color": color.badge.primary.dot,
867
+ "--card-badge-primary-fg-color": color.badge.primary.fg,
868
+ "--card-badge-primary-icon-color": color.badge.primary.icon,
869
+ "--card-badge-suggest-bg-color": color.badge.suggest?.bg,
870
+ "--card-badge-suggest-dot-color": color.badge.suggest?.dot,
871
+ "--card-badge-suggest-fg-color": color.badge.suggest?.fg,
872
+ "--card-badge-suggest-icon-color": color.badge.suggest?.icon,
873
+ "--card-badge-positive-bg-color": color.badge.positive.bg,
874
+ "--card-badge-positive-dot-color": color.badge.positive.dot,
875
+ "--card-badge-positive-fg-color": color.badge.positive.fg,
876
+ "--card-badge-positive-icon-color": color.badge.positive.icon,
877
+ "--card-badge-caution-bg-color": color.badge.caution.bg,
878
+ "--card-badge-caution-dot-color": color.badge.caution.dot,
879
+ "--card-badge-caution-fg-color": color.badge.caution.fg,
880
+ "--card-badge-caution-icon-color": color.badge.caution.icon,
881
+ "--card-badge-critical-bg-color": color.badge.critical.bg,
882
+ "--card-badge-critical-dot-color": color.badge.critical.dot,
883
+ "--card-badge-critical-fg-color": color.badge.critical.fg,
884
+ "--card-badge-critical-icon-color": color.badge.critical.icon,
885
+ "--card-code-bg-color": color.code.bg,
886
+ "--card-code-fg-color": color.code.fg,
887
+ "--card-fg-color": color.fg,
888
+ "--card-icon-color": color.icon,
889
+ "--card-kbd-bg-color": color.kbd.bg,
890
+ "--card-kbd-border-color": color.kbd.border,
891
+ "--card-kbd-fg-color": color.kbd.fg,
892
+ "--card-link-fg-color": color.link.fg,
893
+ "--card-muted-bg-color": color.muted.bg,
894
+ "--card-muted-fg-color": color.muted.fg,
895
+ "--card-skeleton-color-from": color.skeleton.from,
896
+ "--card-skeleton-color-to": color.skeleton.to,
897
+ "--card-bg2-color": color.muted.bg,
898
+ "--card-link-color": color.link.fg,
899
+ "--card-hairline-soft-color": color.border,
900
+ "--card-hairline-hard-color": color.border
901
+ };
902
+ }
903
+ /**
904
+ * @internal
905
+ */
906
+ function buttonBaseStyles(props) {
907
+ let { $width } = props, { style } = getTheme_v2(props.theme);
908
+ return css`${style?.button};-webkit-font-smoothing:inherit;appearance:none;display:inline-flex;align-items:center;font:inherit;border:0;outline:none;user-select:none;text-decoration:none;border:0;box-sizing:border-box;padding:0;margin:0;white-space:nowrap;text-align:left;position:relative;vertical-align:top;${$width === "fill" && css`width:-moz-available;width:-webkit-fill-available;width:stretch;`} & > span{display:block;flex:1;min-width:0;border-radius:inherit;}&::-moz-focus-inner{border:0;padding:0;}`;
909
+ }
910
+ function combineBoxShadow(...boxShadows) {
911
+ return boxShadows.filter(Boolean).join(",");
912
+ }
913
+ /**
914
+ * @internal
915
+ */
916
+ function buttonColorStyles(props) {
917
+ let { $mode } = props, { button, color: baseColor, style } = getTheme_v2(props.theme);
918
+ props.$mode;
919
+ let mode = baseColor.button[$mode] || baseColor.button.default, color = mode[props.$tone] || mode.default, border = {
920
+ width: button.border.width,
921
+ color: "var(--card-border-color)"
922
+ };
923
+ return [
924
+ _cardColorStyle(baseColor, color.enabled),
925
+ {
926
+ backgroundColor: "var(--card-bg-color)",
927
+ color: "var(--card-fg-color)",
928
+ boxShadow: focusRingBorderStyle(border),
929
+ "&:disabled, &[data-disabled=\"true\"]": _cardColorStyle(baseColor, color.disabled),
930
+ "&:not([data-disabled='true'])": {
931
+ boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0),
932
+ "&:focus": { boxShadow: focusRingStyle({
933
+ base: baseColor,
934
+ border: {
935
+ width: 2,
936
+ color: baseColor.bg
937
+ },
938
+ focusRing: button.focusRing
939
+ }) },
940
+ "&:focus:not(:focus-visible)": { boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0) },
941
+ "@media (hover: hover)": {
942
+ "&:hover": _cardColorStyle(baseColor, color.hovered),
943
+ "&:active": _cardColorStyle(baseColor, color.pressed),
944
+ "&[data-hovered]": _cardColorStyle(baseColor, color.hovered)
945
+ },
946
+ "&[data-selected]": _cardColorStyle(baseColor, color.pressed)
947
+ }
948
+ },
949
+ style?.button?.root
950
+ ].filter(Boolean);
951
+ }
952
+ const StyledButton = /* @__PURE__ */ styled.button.withConfig({
953
+ displayName: "StyledButton",
954
+ componentId: "sc-czwr2e-0"
955
+ })(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styled.div.withConfig({
956
+ displayName: "LoadingBox",
957
+ componentId: "sc-czwr2e-1"
958
+ })`position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:var(--card-bg-color);border-radius:inherit;z-index:1;box-shadow:inherit;`, ButtonComponent = forwardRef(function(props, ref) {
959
+ let $ = c(87), IconComponent, IconRightComponent, children, disabled, gap, loading, paddingBottomProp, paddingLeftProp, paddingRightProp, paddingTopProp, paddingXProp, paddingYProp, restProps, selected, t0, t1, t2, t3, t4, t5, t6, t7, t8, text, textAlign, textWeight, width;
960
+ $[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], gap = $[5], loading = $[6], paddingBottomProp = $[7], paddingLeftProp = $[8], paddingRightProp = $[9], paddingTopProp = $[10], paddingXProp = $[11], paddingYProp = $[12], restProps = $[13], selected = $[14], t0 = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], t8 = $[23], text = $[24], textAlign = $[25], textWeight = $[26], width = $[27]) : ({children, disabled, fontSize: t0, icon: IconComponent, iconRight: IconRightComponent, justify: t1, loading, mode: t2, padding: t3, paddingX: paddingXProp, paddingY: paddingYProp, paddingTop: paddingTopProp, paddingBottom: paddingBottomProp, paddingLeft: paddingLeftProp, paddingRight: paddingRightProp, radius: t4, selected, gap, space: t5, text, textAlign, textWeight, tone: t6, type: t7, muted: t8, width, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = gap, $[6] = loading, $[7] = paddingBottomProp, $[8] = paddingLeftProp, $[9] = paddingRightProp, $[10] = paddingTopProp, $[11] = paddingXProp, $[12] = paddingYProp, $[13] = restProps, $[14] = selected, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = t8, $[24] = text, $[25] = textAlign, $[26] = textWeight, $[27] = width);
961
+ let fontSize = t0 === void 0 ? 1 : t0, justifyProp = t1 === void 0 ? "center" : t1, mode = t2 === void 0 ? "default" : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, deprecated_space = t5 === void 0 ? 3 : t5, tone = t6 === void 0 ? "default" : t6, type = t7 === void 0 ? "button" : t7, muted = t8 === void 0 ? !1 : t8, { button } = useTheme_v2(), t9;
962
+ $[28] === justifyProp ? t9 = $[29] : (t9 = _getArrayProp(justifyProp), $[28] = justifyProp, $[29] = t9);
963
+ let justify = t9, t10;
964
+ $[30] === paddingProp ? t10 = $[31] : (t10 = _getArrayProp(paddingProp), $[30] = paddingProp, $[31] = t10);
965
+ let padding = t10, t11;
966
+ $[32] === paddingXProp ? t11 = $[33] : (t11 = _getArrayProp(paddingXProp), $[32] = paddingXProp, $[33] = t11);
967
+ let paddingX = t11, t12;
968
+ $[34] === paddingYProp ? t12 = $[35] : (t12 = _getArrayProp(paddingYProp), $[34] = paddingYProp, $[35] = t12);
969
+ let paddingY = t12, t13;
970
+ $[36] === paddingTopProp ? t13 = $[37] : (t13 = _getArrayProp(paddingTopProp), $[36] = paddingTopProp, $[37] = t13);
971
+ let paddingTop = t13, t14;
972
+ $[38] === paddingBottomProp ? t14 = $[39] : (t14 = _getArrayProp(paddingBottomProp), $[38] = paddingBottomProp, $[39] = t14);
973
+ let paddingBottom = t14, t15;
974
+ $[40] === paddingLeftProp ? t15 = $[41] : (t15 = _getArrayProp(paddingLeftProp), $[40] = paddingLeftProp, $[41] = t15);
975
+ let paddingLeft = t15, t16;
976
+ $[42] === paddingRightProp ? t16 = $[43] : (t16 = _getArrayProp(paddingRightProp), $[42] = paddingRightProp, $[43] = t16);
977
+ let paddingRight = t16, t17;
978
+ $[44] === radiusProp ? t17 = $[45] : (t17 = _getArrayProp(radiusProp), $[44] = radiusProp, $[45] = t17);
979
+ let radius = t17, t18 = gap === void 0 ? deprecated_space : gap, t19;
980
+ $[46] === t18 ? t19 = $[47] : (t19 = _getArrayProp(t18), $[46] = t18, $[47] = t19);
981
+ let spacing = t19, t20;
982
+ $[48] !== padding || $[49] !== paddingBottom || $[50] !== paddingLeft || $[51] !== paddingRight || $[52] !== paddingTop || $[53] !== paddingX || $[54] !== paddingY ? (t20 = {
983
+ padding,
984
+ paddingX,
985
+ paddingY,
986
+ paddingTop,
987
+ paddingBottom,
988
+ paddingLeft,
989
+ paddingRight
990
+ }, $[48] = padding, $[49] = paddingBottom, $[50] = paddingLeft, $[51] = paddingRight, $[52] = paddingTop, $[53] = paddingX, $[54] = paddingY, $[55] = t20) : t20 = $[55];
991
+ let boxProps = t20, t21 = !!(loading || disabled), t22 = selected ? "" : void 0, t23 = !!(loading || disabled), t24;
992
+ $[56] === loading ? t24 = $[57] : (t24 = !!loading && /* @__PURE__ */ jsx(LoadingBox, { children: /* @__PURE__ */ jsx(Spinner, {}) }), $[56] = loading, $[57] = t24);
993
+ let t25;
994
+ $[58] !== IconComponent || $[59] !== IconRightComponent || $[60] !== boxProps || $[61] !== button || $[62] !== fontSize || $[63] !== justify || $[64] !== muted || $[65] !== spacing || $[66] !== text || $[67] !== textAlign || $[68] !== textWeight ? (t25 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsx(Box, {
995
+ as: "span",
996
+ ...boxProps,
997
+ children: /* @__PURE__ */ jsxs(Flex, {
998
+ as: "span",
999
+ justify,
1000
+ gap: spacing,
1001
+ children: [
1002
+ IconComponent && /* @__PURE__ */ jsxs(Text, {
1003
+ size: fontSize,
1004
+ children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
1005
+ }),
1006
+ text && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
1007
+ muted,
1008
+ align: textAlign,
1009
+ size: fontSize,
1010
+ textOverflow: "ellipsis",
1011
+ weight: textWeight ?? button.textWeight,
1012
+ children: text
1013
+ }) }),
1014
+ IconRightComponent && /* @__PURE__ */ jsxs(Text, {
1015
+ size: fontSize,
1016
+ children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
1017
+ })
1018
+ ]
1019
+ })
1020
+ }), $[58] = IconComponent, $[59] = IconRightComponent, $[60] = boxProps, $[61] = button, $[62] = fontSize, $[63] = justify, $[64] = muted, $[65] = spacing, $[66] = text, $[67] = textAlign, $[68] = textWeight, $[69] = t25) : t25 = $[69];
1021
+ let t26;
1022
+ $[70] !== boxProps || $[71] !== children ? (t26 = children && /* @__PURE__ */ jsx(Box, {
1023
+ as: "span",
1024
+ ...boxProps,
1025
+ children
1026
+ }), $[70] = boxProps, $[71] = children, $[72] = t26) : t26 = $[72];
1027
+ let t27;
1028
+ return $[73] !== mode || $[74] !== radius || $[75] !== ref || $[76] !== restProps || $[77] !== t21 || $[78] !== t22 || $[79] !== t23 || $[80] !== t24 || $[81] !== t25 || $[82] !== t26 || $[83] !== tone || $[84] !== type || $[85] !== width ? (t27 = /* @__PURE__ */ jsxs(StyledButton, {
1029
+ "data-ui": "Button",
1030
+ ...restProps,
1031
+ $mode: mode,
1032
+ $radius: radius,
1033
+ $tone: tone,
1034
+ "data-disabled": t21,
1035
+ "data-selected": t22,
1036
+ disabled: t23,
1037
+ ref,
1038
+ type,
1039
+ $width: width,
1040
+ children: [
1041
+ t24,
1042
+ t25,
1043
+ t26
1044
+ ]
1045
+ }), $[73] = mode, $[74] = radius, $[75] = ref, $[76] = restProps, $[77] = t21, $[78] = t22, $[79] = t23, $[80] = t24, $[81] = t25, $[82] = t26, $[83] = tone, $[84] = type, $[85] = width, $[86] = t27) : t27 = $[86], t27;
1046
+ });
1047
+ ButtonComponent.displayName = "ForwardRef(Button)";
1048
+ /**
1049
+ * @public
1050
+ */
1051
+ const Button = ButtonComponent;
1052
+ function cardStyle(props) {
1053
+ return [cardBaseStyle(props), cardColorStyle(props)];
1054
+ }
1055
+ function cardBaseStyle(props) {
1056
+ let { $checkered } = props, { space } = getTheme_v2(props.theme);
1057
+ return css`${$checkered && css`background-size:${space[3]}px ${space[3]}px;background-position:50% 50%;background-image:var(--card-bg-image);`} &[data-as='button']{-webkit-font-smoothing:inherit;appearance:none;outline:none;font:inherit;text-align:inherit;border:0;width:-moz-available;width:-webkit-fill-available;width:stretch;}&[data-as='a']{outline:none;text-decoration:none;}&[data-as='pre']{font:inherit;}`;
1058
+ }
1059
+ function cardColorStyle(props) {
1060
+ let { $checkered, $focusRing, $muted } = props, { card, color, style } = getTheme_v2(props.theme), border = {
1061
+ width: card.border.width,
1062
+ color: "var(--card-border-color)"
1063
+ };
1064
+ return css`color-scheme:${color._dark ? "dark" : "light"};${_cardColorStyle(color, color, $checkered)} background-color:${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};color:var(--card-fg-color);&[data-as='button']{--card-focus-ring-box-shadow:none;cursor:default;box-shadow:var(--card-focus-ring-box-shadow);&:disabled{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not(:disabled){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
1065
+ base: color,
1066
+ border,
1067
+ focusRing: card.focusRing
1068
+ }) : void 0};}}}&[data-as='a']{cursor:pointer;box-shadow:var(--card-focus-ring-box-shadow);&[data-disabled]{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not([data-disabled]){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
1069
+ base: color,
1070
+ border,
1071
+ focusRing: card.focusRing
1072
+ }) : void 0};}}}${style?.card?.root}`;
1073
+ }
1074
+ const StyledCard = /* @__PURE__ */ styled(Box).withConfig({
1075
+ displayName: "StyledCard",
1076
+ componentId: "sc-5721dn-0"
1077
+ })(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), CardComponent = forwardRef(function(props, ref) {
1078
+ let $ = c(56), asProp, border, borderBottom, borderLeft, borderRight, borderTop, muted, pressed, restProps, scheme, selected, shadow, t0, t1, t2, t3;
1079
+ $[0] === props ? (asProp = $[1], border = $[2], borderBottom = $[3], borderLeft = $[4], borderRight = $[5], borderTop = $[6], muted = $[7], pressed = $[8], restProps = $[9], scheme = $[10], selected = $[11], shadow = $[12], t0 = $[13], t1 = $[14], t2 = $[15], t3 = $[16]) : ({__unstable_checkered: t0, __unstable_focusRing: t1, as: asProp, border, borderTop, borderRight, borderBottom, borderLeft, muted, pressed, radius: t2, scheme, selected, shadow, tone: t3, ...restProps} = props, $[0] = props, $[1] = asProp, $[2] = border, $[3] = borderBottom, $[4] = borderLeft, $[5] = borderRight, $[6] = borderTop, $[7] = muted, $[8] = pressed, $[9] = restProps, $[10] = scheme, $[11] = selected, $[12] = shadow, $[13] = t0, $[14] = t1, $[15] = t2, $[16] = t3);
1080
+ let checkered = t0 === void 0 ? !1 : t0, focusRing = t1 === void 0 ? !1 : t1, radius = t2 === void 0 ? 0 : t2, toneProp = t3 === void 0 ? "default" : t3, as = isValidElementType(asProp) ? asProp : "div", rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp, t4 = typeof as == "string" ? as : void 0, t5 = rootTheme.scheme, t6;
1081
+ $[17] === border ? t6 = $[18] : (t6 = _getArrayProp(border), $[17] = border, $[18] = t6);
1082
+ let t7;
1083
+ $[19] === borderTop ? t7 = $[20] : (t7 = _getArrayProp(borderTop), $[19] = borderTop, $[20] = t7);
1084
+ let t8;
1085
+ $[21] === borderRight ? t8 = $[22] : (t8 = _getArrayProp(borderRight), $[21] = borderRight, $[22] = t8);
1086
+ let t9;
1087
+ $[23] === borderBottom ? t9 = $[24] : (t9 = _getArrayProp(borderBottom), $[23] = borderBottom, $[24] = t9);
1088
+ let t10;
1089
+ $[25] === borderLeft ? t10 = $[26] : (t10 = _getArrayProp(borderLeft), $[25] = borderLeft, $[26] = t10);
1090
+ let t11;
1091
+ $[27] === radius ? t11 = $[28] : (t11 = _getArrayProp(radius), $[27] = radius, $[28] = t11);
1092
+ let t12;
1093
+ $[29] === shadow ? t12 = $[30] : (t12 = _getArrayProp(shadow), $[29] = shadow, $[30] = t12);
1094
+ let t13 = checkered ? "" : void 0, t14 = pressed ? "" : void 0, t15 = selected ? "" : void 0, t16;
1095
+ $[31] !== as || $[32] !== checkered || $[33] !== focusRing || $[34] !== muted || $[35] !== ref || $[36] !== restProps || $[37] !== rootTheme.scheme || $[38] !== selected || $[39] !== t10 || $[40] !== t11 || $[41] !== t12 || $[42] !== t13 || $[43] !== t14 || $[44] !== t15 || $[45] !== t4 || $[46] !== t6 || $[47] !== t7 || $[48] !== t8 || $[49] !== t9 || $[50] !== tone ? (t16 = /* @__PURE__ */ jsx(StyledCard, {
1096
+ "data-as": t4,
1097
+ "data-scheme": t5,
1098
+ "data-ui": "Card",
1099
+ "data-tone": tone,
1100
+ ...restProps,
1101
+ $border: t6,
1102
+ $borderTop: t7,
1103
+ $borderRight: t8,
1104
+ $borderBottom: t9,
1105
+ $borderLeft: t10,
1106
+ $checkered: checkered,
1107
+ $focusRing: focusRing,
1108
+ $muted: muted,
1109
+ $radius: t11,
1110
+ $shadow: t12,
1111
+ $tone: tone,
1112
+ "data-checkered": t13,
1113
+ "data-pressed": t14,
1114
+ "data-selected": t15,
1115
+ forwardedAs: as,
1116
+ ref,
1117
+ selected
1118
+ }), $[31] = as, $[32] = checkered, $[33] = focusRing, $[34] = muted, $[35] = ref, $[36] = restProps, $[37] = rootTheme.scheme, $[38] = selected, $[39] = t10, $[40] = t11, $[41] = t12, $[42] = t13, $[43] = t14, $[44] = t15, $[45] = t4, $[46] = t6, $[47] = t7, $[48] = t8, $[49] = t9, $[50] = tone, $[51] = t16) : t16 = $[51];
1119
+ let t17;
1120
+ return $[52] !== scheme || $[53] !== t16 || $[54] !== tone ? (t17 = /* @__PURE__ */ jsx(ThemeColorProvider, {
1121
+ scheme,
1122
+ tone,
1123
+ children: t16
1124
+ }), $[52] = scheme, $[53] = t16, $[54] = tone, $[55] = t17) : t17 = $[55], t17;
1125
+ });
1126
+ CardComponent.displayName = "ForwardRef(Card)";
1127
+ /**
1128
+ * The `Card` component acts much like a `Box`, but with a background and foreground color.
1129
+ * Components within a `Card` inherit its colors.
1130
+ *
1131
+ * @public
1132
+ */
1133
+ const Card = CardComponent;
1134
+ /**
1135
+ * @public
1136
+ */
1137
+ function useClickOutsideEvent(listener, elementsArg = () => EMPTY_ARRAY, boundaryElement) {
1138
+ /**
1139
+ * The `useEffectEvent` hook allow us to always see the latest value of `listener`, `elementsArg` and `boundaryElement` without needing to
1140
+ * juggle `useState`, `useRef` and `useState` to make sure the `mousedown` event listener isn't constantly being added and removed.
1141
+ */
1142
+ let onEvent = useEffectEvent((evt) => {
1143
+ if (!listener) return;
1144
+ let target = evt.target;
1145
+ if (!(target instanceof Node)) return;
1146
+ let resolvedBoundaryElement = boundaryElement?.();
1147
+ if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) return;
1148
+ let elements = elementsArg().flat();
1149
+ for (let el of elements) if (el && (target === el || el.contains(target))) return;
1150
+ listener(evt);
1151
+ }), hasListener = !!listener;
1152
+ useEffect(() => {
1153
+ if (!hasListener) return;
1154
+ let handleEvent = (evt) => onEvent(evt);
1155
+ return document.addEventListener("mousedown", handleEvent), () => {
1156
+ document.removeEventListener("mousedown", handleEvent);
1157
+ };
1158
+ }, [hasListener]), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
1159
+ }
1160
+ /**
1161
+ * @beta
1162
+ */
1163
+ function useCustomValidity(ref, customValidity) {
1164
+ useEffect(() => {
1165
+ ref.current?.setCustomValidity(customValidity || "");
1166
+ }, [customValidity, ref]);
1167
+ }
1168
+ /**
1169
+ * @internal
1170
+ */
1171
+ const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
1172
+ function _createElementRectValueListener() {
1173
+ return { subscribe(element, subscriber) {
1174
+ let resizeObserver = new _ResizeObserver(([entry]) => {
1175
+ subscriber({
1176
+ _contentRect: entry.contentRect,
1177
+ border: {
1178
+ width: entry.borderBoxSize[0].inlineSize,
1179
+ height: entry.borderBoxSize[0].blockSize
1180
+ },
1181
+ content: {
1182
+ width: entry.contentRect.width,
1183
+ height: entry.contentRect.height
1184
+ }
1185
+ });
1186
+ });
1187
+ return resizeObserver.observe(element), () => {
1188
+ resizeObserver.unobserve(element), resizeObserver.disconnect();
1189
+ };
1190
+ } };
1191
+ }
1192
+ function _createElementSizeObserver() {
1193
+ let disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
1194
+ return { subscribe(element, subscriber) {
1195
+ let subscribers = subscribersCache.get(element) || [], dispose = disposeCache.get(element);
1196
+ return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
1197
+ for (let sub of subscribers) sub(elementRect);
1198
+ })), subscribers.push(subscriber), () => {
1199
+ let idx = subscribers.indexOf(subscriber);
1200
+ idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
1201
+ };
1202
+ } };
1203
+ }
1204
+ /**
1205
+ * Subscribe to the size of a DOM element.
1206
+ * @beta
1207
+ */
1208
+ function useElementSize(element) {
1209
+ let [size, setSize] = useState(null);
1210
+ return useEffect(() => {
1211
+ if (element) return _elementSizeObserver.subscribe(element, setSize);
1212
+ }, [element]), size;
1213
+ }
1214
+ /**
1215
+ * Adds global keydown event listener to the window.
1216
+ *
1217
+ * @param onKeyDown - The function to call when a keydown event is triggered.
1218
+ * @param options - The options to pass to the addEventListener function (example, capture: true)
1219
+ * @beta
1220
+ */
1221
+ function useGlobalKeyDown(onKeyDown, options) {
1222
+ let handleKeyDown = useEffectEvent((event) => onKeyDown(event));
1223
+ useEffect(() => {
1224
+ let handler = (event) => handleKeyDown(event);
1225
+ return window.addEventListener("keydown", handler, options), () => window.removeEventListener("keydown", handler, options);
1226
+ }, [options]);
1227
+ }
1228
+ /**
1229
+ * Efficiently subscribes to `window.matchMedia` queries
1230
+ *
1231
+ * @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Required if the hook is called during SSR (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
1232
+ *
1233
+ * @public
1234
+ */
1235
+ function useMatchMedia(mediaQueryString, getServerSnapshot) {
1236
+ return useDebugValue(mediaQueryString), useSyncExternalStore(useCallback((onStoreChange) => {
1237
+ let media = window.matchMedia(mediaQueryString);
1238
+ return media.addEventListener("change", onStoreChange), () => media.removeEventListener("change", onStoreChange);
1239
+ }, [mediaQueryString]), () => window.matchMedia(mediaQueryString).matches, getServerSnapshot);
1240
+ }
1241
+ function _getMediaQuery(media, index) {
1242
+ return index === 0 ? `screen and (max-width: ${media[index] - 1}px)` : index === media.length ? `screen and (min-width: ${media[index - 1]}px)` : `screen and (min-width: ${media[index - 1]}px) and (max-width: ${media[index] - 1}px)`;
1243
+ }
1244
+ function _createMediaStore(media) {
1245
+ let mediaLen = media.length, sizes, getSizes = () => {
1246
+ if (!sizes) {
1247
+ sizes = [];
1248
+ for (let index = mediaLen; index > -1; --index) {
1249
+ let mediaQuery = _getMediaQuery(media, index);
1250
+ sizes.push({
1251
+ index,
1252
+ mq: window.matchMedia(mediaQuery)
1253
+ });
1254
+ }
1255
+ }
1256
+ return sizes;
1257
+ };
1258
+ return {
1259
+ getSnapshot: () => {
1260
+ for (let { index, mq } of getSizes()) if (mq.matches) return index;
1261
+ return 0;
1262
+ },
1263
+ subscribe: (onStoreChange) => {
1264
+ let disposeFns = [];
1265
+ for (let { mq } of getSizes()) {
1266
+ let handleChange = () => {
1267
+ mq.matches && onStoreChange();
1268
+ };
1269
+ mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
1270
+ }
1271
+ return () => {
1272
+ for (let disposeFn of disposeFns) disposeFn();
1273
+ };
1274
+ }
1275
+ };
1276
+ }
1277
+ /**
1278
+ * Only called during server-side rendering, and hydration if using hydrateRoot
1279
+ * Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query
1280
+ * and we assume `(prefers-color-scheme: light)` since it's the most common scheme
1281
+ *
1282
+ * @link https://beta.reactjs.org/apis/react/useSyncExternalStore#adding-support-for-server-rendering
1283
+ */
1284
+ function getServerSnapshot() {
1285
+ return 0;
1286
+ }
1287
+ /**
1288
+ * This API might change. DO NOT USE IN PRODUCTION.
1289
+ * @beta
1290
+ */
1291
+ function useMediaIndex() {
1292
+ let { media } = useTheme_v2(), store = useMemo(() => _createMediaStore(media), [media]);
1293
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
1294
+ }
1295
+ /**
1296
+ * Returns true if a dark color scheme is preferred, false if a light color scheme is preferred or the preference is not known.
1297
+ *
1298
+ * @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-color-scheme: light)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
1299
+ *
1300
+ * If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
1301
+ * Chrome supports reading the `prefers-color-scheme` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
1302
+ * @example https://gist.github.com/stipsan/13c0cccf8dfc34f4b44bb1b984baf7df
1303
+ *
1304
+ * @public
1305
+ */
1306
+ function usePrefersDark(getServerSnapshot = () => !1) {
1307
+ return useMatchMedia("(prefers-color-scheme: dark)", getServerSnapshot);
1308
+ }
1309
+ /**
1310
+ * Returns true if motion should be reduced
1311
+ *
1312
+ * @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-reduced-motion: no-preference)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
1313
+ *
1314
+ * If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
1315
+ * Chrome supports reading the `prefers-reduced-motion` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Motion
1316
+ * @example https://gist.github.com/stipsan/0c0f839a27842249cada893e9fb7767b
1317
+ *
1318
+ * @public
1319
+ */
1320
+ function usePrefersReducedMotion(getServerSnapshot = () => !1) {
1321
+ return useMatchMedia("(prefers-reduced-motion: reduce)", getServerSnapshot);
1322
+ }
1323
+ const StyledGrid = /* @__PURE__ */ styled(Box).withConfig({
1324
+ displayName: "StyledGrid",
1325
+ componentId: "sc-p9qx07-0"
1326
+ })(responsiveGridStyle), GridComponent = forwardRef(function(props, ref) {
1327
+ let $ = c(44), as, autoCols, autoFlow, autoRows, children, columns, gap, gapX, gapY, gridTemplateColumns, gridTemplateRows, restProps, rows;
1328
+ $[0] === props ? (as = $[1], autoCols = $[2], autoFlow = $[3], autoRows = $[4], children = $[5], columns = $[6], gap = $[7], gapX = $[8], gapY = $[9], gridTemplateColumns = $[10], gridTemplateRows = $[11], restProps = $[12], rows = $[13]) : ({as, autoRows, autoCols, autoFlow, columns, gridTemplateColumns, gap, gapX, gapY, rows, gridTemplateRows, children, ...restProps} = props, $[0] = props, $[1] = as, $[2] = autoCols, $[3] = autoFlow, $[4] = autoRows, $[5] = children, $[6] = columns, $[7] = gap, $[8] = gapX, $[9] = gapY, $[10] = gridTemplateColumns, $[11] = gridTemplateRows, $[12] = restProps, $[13] = rows);
1329
+ let t0 = typeof as == "string" ? as : void 0, t1;
1330
+ $[14] === autoRows ? t1 = $[15] : (t1 = _getArrayProp(autoRows), $[14] = autoRows, $[15] = t1);
1331
+ let t2;
1332
+ $[16] === autoCols ? t2 = $[17] : (t2 = _getArrayProp(autoCols), $[16] = autoCols, $[17] = t2);
1333
+ let t3;
1334
+ $[18] === autoFlow ? t3 = $[19] : (t3 = _getArrayProp(autoFlow), $[18] = autoFlow, $[19] = t3);
1335
+ let t4 = gridTemplateColumns === void 0 ? columns : gridTemplateColumns, t5;
1336
+ $[20] === t4 ? t5 = $[21] : (t5 = _getArrayProp(t4), $[20] = t4, $[21] = t5);
1337
+ let t6;
1338
+ $[22] === gap ? t6 = $[23] : (t6 = _getArrayProp(gap), $[22] = gap, $[23] = t6);
1339
+ let t7;
1340
+ $[24] === gapX ? t7 = $[25] : (t7 = _getArrayProp(gapX), $[24] = gapX, $[25] = t7);
1341
+ let t8;
1342
+ $[26] === gapY ? t8 = $[27] : (t8 = _getArrayProp(gapY), $[26] = gapY, $[27] = t8);
1343
+ let t9 = gridTemplateRows === void 0 ? rows : gridTemplateRows, t10;
1344
+ $[28] === t9 ? t10 = $[29] : (t10 = _getArrayProp(t9), $[28] = t9, $[29] = t10);
1345
+ let t11;
1346
+ return $[30] !== as || $[31] !== children || $[32] !== ref || $[33] !== restProps || $[34] !== t0 || $[35] !== t1 || $[36] !== t10 || $[37] !== t2 || $[38] !== t3 || $[39] !== t5 || $[40] !== t6 || $[41] !== t7 || $[42] !== t8 ? (t11 = /* @__PURE__ */ jsx(StyledGrid, {
1347
+ "data-as": t0,
1348
+ "data-ui": "Grid",
1349
+ ...restProps,
1350
+ $autoRows: t1,
1351
+ $autoCols: t2,
1352
+ $autoFlow: t3,
1353
+ $columns: t5,
1354
+ $gap: t6,
1355
+ $gapX: t7,
1356
+ $gapY: t8,
1357
+ $rows: t10,
1358
+ forwardedAs: as,
1359
+ ref,
1360
+ children
1361
+ }), $[30] = as, $[31] = children, $[32] = ref, $[33] = restProps, $[34] = t0, $[35] = t1, $[36] = t10, $[37] = t2, $[38] = t3, $[39] = t5, $[40] = t6, $[41] = t7, $[42] = t8, $[43] = t11) : t11 = $[43], t11;
1362
+ });
1363
+ GridComponent.displayName = "ForwardRef(Grid)";
1364
+ /**
1365
+ * The `Grid` component is for building 2-dimensional layers (based on CSS grid).
1366
+ *
1367
+ * @public
1368
+ */
1369
+ const Grid = GridComponent;
1370
+ function inlineBaseStyle() {
1371
+ return {
1372
+ lineHeight: "0",
1373
+ "&&:not([hidden])": { display: "block" },
1374
+ "& > div": {
1375
+ display: "inline-block",
1376
+ verticalAlign: "middle"
1377
+ }
1378
+ };
1379
+ }
1380
+ function inlineSpaceStyle(props) {
1381
+ let { media, space } = getTheme_v2(props.theme);
1382
+ return _responsive(media, props.$space, (spaceIndex) => {
1383
+ let _space = rem(spaceIndex === .5 ? space[1] / 2 : space[spaceIndex]);
1384
+ return {
1385
+ margin: `-${_space} 0 0 -${_space}`,
1386
+ "& > div": { padding: `${_space} 0 0 ${_space}` }
1387
+ };
1388
+ });
1389
+ }
1390
+ const StyledInline = /* @__PURE__ */ styled(Box).withConfig({
1391
+ displayName: "StyledInline",
1392
+ componentId: "sc-aabqmb-0"
1393
+ })(inlineBaseStyle, inlineSpaceStyle), InlineComponent = forwardRef(function(props, ref) {
1394
+ let $ = c(16), as, childrenProp, deprecated_space, gap, restProps;
1395
+ $[0] === props ? (as = $[1], childrenProp = $[2], deprecated_space = $[3], gap = $[4], restProps = $[5]) : ({as, children: childrenProp, gap, space: deprecated_space, ...restProps} = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = deprecated_space, $[4] = gap, $[5] = restProps);
1396
+ let spacing = gap === void 0 ? deprecated_space : gap, t0;
1397
+ $[6] === childrenProp ? t0 = $[7] : (t0 = Children.map(childrenProp, _temp$4), $[6] = childrenProp, $[7] = t0);
1398
+ let children = t0, t1;
1399
+ $[8] === spacing ? t1 = $[9] : (t1 = _getArrayProp(spacing), $[8] = spacing, $[9] = t1);
1400
+ let t2 = ref, t3;
1401
+ return $[10] !== as || $[11] !== children || $[12] !== restProps || $[13] !== t1 || $[14] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledInline, {
1402
+ "data-ui": "Inline",
1403
+ ...restProps,
1404
+ $space: t1,
1405
+ forwardedAs: as,
1406
+ ref: t2,
1407
+ children
1408
+ }), $[10] = as, $[11] = children, $[12] = restProps, $[13] = t1, $[14] = t2, $[15] = t3) : t3 = $[15], t3;
1409
+ });
1410
+ InlineComponent.displayName = "ForwardRef(Inline)";
1411
+ /**
1412
+ * The `Inline` component is a layout utility for aligning and spacing items horizontally.
1413
+ *
1414
+ * @public
1415
+ */
1416
+ const Inline = InlineComponent;
1417
+ function _temp$4(child) {
1418
+ return child && /* @__PURE__ */ jsx("div", { children: child });
1419
+ }
1420
+ function kbdStyle() {
1421
+ return css`--card-bg-color:var(--card-kbd-bg-color);--card-border-color:var(--card-kbd-border-color);--card-fg-color:var(--card-kbd-fg-color);box-shadow:inset 0 0 0 1px var(--card-border-color);background:var(--card-bg-color);font:inherit;vertical-align:top;&:not([hidden]){display:inline-block;}`;
1422
+ }
1423
+ const StyledKBD = /* @__PURE__ */ styled.kbd.withConfig({
1424
+ displayName: "StyledKBD",
1425
+ componentId: "sc-ielwjm-0"
1426
+ })(responsiveRadiusStyle, kbdStyle), KBDComponent = forwardRef(function(props, ref) {
1427
+ let $ = c(19), children, restProps, t0, t1, t2;
1428
+ $[0] === props ? (children = $[1], restProps = $[2], t0 = $[3], t1 = $[4], t2 = $[5]) : ({children, fontSize: t0, padding: t1, radius: t2, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0, $[4] = t1, $[5] = t2);
1429
+ let fontSize = t0 === void 0 ? 0 : t0, padding = t1 === void 0 ? 1 : t1, radius = t2 === void 0 ? 2 : t2, t3;
1430
+ $[6] === radius ? t3 = $[7] : (t3 = _getArrayProp(radius), $[6] = radius, $[7] = t3);
1431
+ let t4;
1432
+ $[8] !== children || $[9] !== fontSize ? (t4 = /* @__PURE__ */ jsx(Text, {
1433
+ as: "span",
1434
+ size: fontSize,
1435
+ weight: "semibold",
1436
+ children
1437
+ }), $[8] = children, $[9] = fontSize, $[10] = t4) : t4 = $[10];
1438
+ let t5;
1439
+ $[11] !== padding || $[12] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, {
1440
+ as: "span",
1441
+ padding,
1442
+ children: t4
1443
+ }), $[11] = padding, $[12] = t4, $[13] = t5) : t5 = $[13];
1444
+ let t6;
1445
+ return $[14] !== ref || $[15] !== restProps || $[16] !== t3 || $[17] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledKBD, {
1446
+ "data-ui": "KBD",
1447
+ ...restProps,
1448
+ $radius: t3,
1449
+ ref,
1450
+ children: t5
1451
+ }), $[14] = ref, $[15] = restProps, $[16] = t3, $[17] = t5, $[18] = t6) : t6 = $[18], t6;
1452
+ });
1453
+ KBDComponent.displayName = "ForwardRef(KBD)";
1454
+ /**
1455
+ * Used to define some text as keyboard input.
1456
+ *
1457
+ * @public
1458
+ */
1459
+ const KBD = KBDComponent, origin = {
1460
+ name: "@sanity/ui/origin",
1461
+ fn({ middlewareData, placement, rects }) {
1462
+ let [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
1463
+ if (floatingWidth <= 0 || floatingHeight <= 0) return {};
1464
+ let { originX, originY } = ["bottom", "top"].includes(side) ? {
1465
+ originX: clamp(.5 - shiftX / floatingWidth, 0, 1),
1466
+ originY: side === "bottom" ? 0 : 1
1467
+ } : {
1468
+ originX: +(side === "left"),
1469
+ originY: clamp(.5 - shiftY / floatingHeight, 0, 1)
1470
+ };
1471
+ return { data: {
1472
+ originX,
1473
+ originY
1474
+ } };
1475
+ }
1476
+ };
1477
+ function clamp(num, min, max) {
1478
+ return Math.min(Math.max(num, min), max);
1479
+ }
1480
+ function moveTowardsLength(movingPoint, targetPoint, amount) {
1481
+ let width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
1482
+ return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
1483
+ }
1484
+ function moveTowardsFractional(movingPoint, targetPoint, fraction) {
1485
+ return {
1486
+ x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
1487
+ y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
1488
+ };
1489
+ }
1490
+ function getRoundedCommands(points) {
1491
+ let len = points.length, cmds = [];
1492
+ for (let i = 0; i < len; i += 1) {
1493
+ let point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
1494
+ if (prevPoint && point.radius) {
1495
+ let curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, .5), endControl = moveTowardsFractional(point, curveEnd, .5);
1496
+ cmds.push({
1497
+ type: "point",
1498
+ ...curveStart
1499
+ }), cmds.push({
1500
+ type: "curve",
1501
+ curveEnd,
1502
+ startControl,
1503
+ endControl
1504
+ });
1505
+ } else cmds.push({
1506
+ type: "point",
1507
+ ...point
1508
+ });
1509
+ }
1510
+ return cmds;
1511
+ }
1512
+ function compileCommands(cmds) {
1513
+ return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
1514
+ }
1515
+ const StyledArrow = /* @__PURE__ */ styled.div.withConfig({
1516
+ displayName: "StyledArrow",
1517
+ componentId: "sc-d20m08-0"
1518
+ })(({ $w: w }) => css`position:absolute;width:${w}px;height:${w}px;:empty + &{display:none;}& > svg{display:block;line-height:0;transform-origin:${w / 2}px ${w / 2}px;}[data-placement^='top'] > &{bottom:-${w}px;& > svg{transform:rotate(0);}}[data-placement^='right'] > &{left:-${w}px;& > svg{transform:rotate(90deg);}}[data-placement^='left'] > &{right:-${w}px;& > svg{transform:rotate(-90deg);}}[data-placement^='bottom'] > &{top:-${w}px;& > svg{transform:rotate(180deg);}}`), StrokePath = styled.path.withConfig({
1519
+ displayName: "StrokePath",
1520
+ componentId: "sc-d20m08-1"
1521
+ })`stroke:var(--card-shadow-outline-color);`, ShapePath = styled.path.withConfig({
1522
+ displayName: "ShapePath",
1523
+ componentId: "sc-d20m08-2"
1524
+ })`fill:var(--card-bg-color);`, Arrow = forwardRef(function(props, ref) {
1525
+ let $ = c(29), h, restProps, t0, w;
1526
+ $[0] === props ? (h = $[1], restProps = $[2], t0 = $[3], w = $[4]) : ({width: w, height: h, radius: t0, ...restProps} = props, $[0] = props, $[1] = h, $[2] = restProps, $[3] = t0, $[4] = w);
1527
+ let radius = t0 === void 0 ? 0 : t0, { card } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2, t1;
1528
+ $[5] !== center || $[6] !== h || $[7] !== radius || $[8] !== w ? (t1 = compileCommands(getRoundedCommands([
1529
+ {
1530
+ x: 0,
1531
+ y: 0
1532
+ },
1533
+ {
1534
+ x: radius,
1535
+ y: 0,
1536
+ radius
1537
+ },
1538
+ {
1539
+ x: center,
1540
+ y: h - 1,
1541
+ radius
1542
+ },
1543
+ {
1544
+ x: w - radius,
1545
+ y: 0,
1546
+ radius
1547
+ },
1548
+ {
1549
+ x: w,
1550
+ y: 0
1551
+ }
1552
+ ])), $[5] = center, $[6] = h, $[7] = radius, $[8] = w, $[9] = t1) : t1 = $[9];
1553
+ let path = t1, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`, t2 = `0 0 ${w} ${w}`, t3;
1554
+ $[10] !== strokeWidth || $[11] !== w ? (t3 = /* @__PURE__ */ jsx("mask", {
1555
+ id: "stroke-mask",
1556
+ children: /* @__PURE__ */ jsx("rect", {
1557
+ x: 0,
1558
+ y: strokeWidth,
1559
+ width: w,
1560
+ height: w,
1561
+ fill: "white"
1562
+ })
1563
+ }), $[10] = strokeWidth, $[11] = w, $[12] = t3) : t3 = $[12];
1564
+ let t4 = strokeWidth * 2, t5;
1565
+ $[13] !== strokePath || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx(StrokePath, {
1566
+ d: strokePath,
1567
+ mask: "url(#stroke-mask)",
1568
+ strokeWidth: t4
1569
+ }), $[13] = strokePath, $[14] = t4, $[15] = t5) : t5 = $[15];
1570
+ let t6;
1571
+ $[16] === fillPath ? t6 = $[17] : (t6 = /* @__PURE__ */ jsx(ShapePath, { d: fillPath }), $[16] = fillPath, $[17] = t6);
1572
+ let t7;
1573
+ $[18] !== t2 || $[19] !== t3 || $[20] !== t5 || $[21] !== t6 || $[22] !== w ? (t7 = /* @__PURE__ */ jsxs("svg", {
1574
+ width: w,
1575
+ height: w,
1576
+ viewBox: t2,
1577
+ children: [
1578
+ t3,
1579
+ t5,
1580
+ t6
1581
+ ]
1582
+ }), $[18] = t2, $[19] = t3, $[20] = t5, $[21] = t6, $[22] = w, $[23] = t7) : t7 = $[23];
1583
+ let t8;
1584
+ return $[24] !== ref || $[25] !== restProps || $[26] !== t7 || $[27] !== w ? (t8 = /* @__PURE__ */ jsx(StyledArrow, {
1585
+ ...restProps,
1586
+ $w: w,
1587
+ ref,
1588
+ children: t7
1589
+ }), $[24] = ref, $[25] = restProps, $[26] = t7, $[27] = w, $[28] = t8) : t8 = $[28], t8;
1590
+ });
1591
+ Arrow.displayName = "ForwardRef(Arrow)";
1592
+ const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null);
1593
+ function isRecord(value) {
1594
+ return !!(value && typeof value == "object" && !Array.isArray(value));
1595
+ }
1596
+ const DEFAULT_VALUE = {
1597
+ version: 0,
1598
+ element: null
1599
+ };
1600
+ /**
1601
+ * @public
1602
+ */
1603
+ function useBoundaryElement() {
1604
+ let value = useContext(BoundaryElementContext);
1605
+ if (value && (!isRecord(value) || value.version !== 0)) throw Error("useBoundaryElement(): the context value is not compatible");
1606
+ return value || DEFAULT_VALUE;
1607
+ }
1608
+ function getLayerContext(contextValue) {
1609
+ if (!isRecord(contextValue) || contextValue.version !== 0) throw Error("the context value is not compatible");
1610
+ if (!contextValue) throw Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
1611
+ if (contextValue.version === 0) return contextValue;
1612
+ throw Error("could not get layer context");
1613
+ }
1614
+ const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null);
1615
+ /**
1616
+ * @public
1617
+ */
1618
+ function LayerProvider(props) {
1619
+ let $ = c(21), { children, zOffset: t0 } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext), t1;
1620
+ $[0] === parentContextValue ? t1 = $[1] : (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1);
1621
+ let parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, t2;
1622
+ $[2] === zOffsetProp ? t2 = $[3] : (t2 = _getArrayProp(zOffsetProp), $[2] = zOffsetProp, $[3] = t2);
1623
+ let zOffset = t2, maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], t3;
1624
+ $[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[4] = t3) : t3 = $[4];
1625
+ let [, setChildLayers] = useState(t3), [size, setSize] = useState(0), isTopLayer = size === 0, t4;
1626
+ $[5] !== parentRegisterChild || $[6] !== setChildLayers ? (t4 = (childLevel) => {
1627
+ let parentDispose = parentRegisterChild?.(childLevel);
1628
+ return childLevel === void 0 ? setSize(_temp$3) : setChildLayers((state) => {
1629
+ let prevLen = state[childLevel] ?? 0, nextState = {
1630
+ ...state,
1631
+ [childLevel]: prevLen + 1
1632
+ };
1633
+ return setSize(Object.keys(nextState).length), nextState;
1634
+ }), () => {
1635
+ childLevel === void 0 ? setSize(_temp2$2) : setChildLayers((state_0) => {
1636
+ let nextState_0 = { ...state_0 };
1637
+ return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
1638
+ }), parentDispose?.();
1639
+ };
1640
+ }, $[5] = parentRegisterChild, $[6] = setChildLayers, $[7] = t4) : t4 = $[7];
1641
+ let registerChild = t4, t5, t6;
1642
+ $[8] !== level || $[9] !== parentRegisterChild ? (t5 = () => parentRegisterChild?.(level), t6 = [level, parentRegisterChild], $[8] = level, $[9] = parentRegisterChild, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), useEffect(t5, t6);
1643
+ let t7;
1644
+ $[12] !== isTopLayer || $[13] !== level || $[14] !== registerChild || $[15] !== size || $[16] !== zIndex ? (t7 = {
1645
+ version: 0,
1646
+ isTopLayer,
1647
+ level,
1648
+ registerChild,
1649
+ size,
1650
+ zIndex
1651
+ }, $[12] = isTopLayer, $[13] = level, $[14] = registerChild, $[15] = size, $[16] = zIndex, $[17] = t7) : t7 = $[17];
1652
+ let value = t7, t8;
1653
+ return $[18] !== children || $[19] !== value ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, {
1654
+ value,
1655
+ children
1656
+ }), $[18] = children, $[19] = value, $[20] = t8) : t8 = $[20], t8;
1657
+ }
1658
+ function _temp2$2(v_0) {
1659
+ return v_0 - 1;
1660
+ }
1661
+ function _temp$3(v) {
1662
+ return v + 1;
1663
+ }
1664
+ LayerProvider.displayName = "LayerProvider";
1665
+ /**
1666
+ * @public
1667
+ */
1668
+ function useLayer() {
1669
+ let value = useContext(LayerContext);
1670
+ if (!value) throw Error("useLayer(): missing context value");
1671
+ try {
1672
+ return getLayerContext(value);
1673
+ } catch (err) {
1674
+ throw err instanceof Error ? Error(`useLayer(): ${err.message}`) : Error(`useLayer(): ${err}`);
1675
+ }
1676
+ }
1677
+ const StyledLayer = /* @__PURE__ */ styled.div.withConfig({
1678
+ displayName: "StyledLayer",
1679
+ componentId: "sc-h90030-0"
1680
+ })({ position: "relative" }), LayerChildren = forwardRef(function(props, forwardedRef) {
1681
+ let $ = c(22), children, onActivate, onFocus, restProps, t0;
1682
+ $[0] === props ? (children = $[1], onActivate = $[2], onFocus = $[3], restProps = $[4], t0 = $[5]) : ({children, onActivate, onFocus, style: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = onActivate, $[3] = onFocus, $[4] = restProps, $[5] = t0);
1683
+ let style = t0 === void 0 ? EMPTY_RECORD : t0, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer), t1;
1684
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[6] = t1) : t1 = $[6], useImperativeHandle(forwardedRef, t1);
1685
+ let t2, t3;
1686
+ $[7] !== isTopLayer || $[8] !== onActivate ? (t2 = () => {
1687
+ isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({ activeElement: lastFocusedRef.current }), isTopLayerRef.current = isTopLayer;
1688
+ }, t3 = [isTopLayer, onActivate], $[7] = isTopLayer, $[8] = onActivate, $[9] = t2, $[10] = t3) : (t2 = $[9], t3 = $[10]), useEffect(t2, t3);
1689
+ let t4;
1690
+ $[11] !== isTopLayer || $[12] !== onFocus ? (t4 = (event) => {
1691
+ onFocus?.(event);
1692
+ let rootElement = ref.current, target = document.activeElement;
1693
+ !isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
1694
+ }, $[11] = isTopLayer, $[12] = onFocus, $[13] = t4) : t4 = $[13];
1695
+ let handleFocus = t4, t5;
1696
+ $[14] !== style || $[15] !== zIndex ? (t5 = {
1697
+ ...style,
1698
+ zIndex
1699
+ }, $[14] = style, $[15] = zIndex, $[16] = t5) : t5 = $[16];
1700
+ let t6;
1701
+ return $[17] !== children || $[18] !== handleFocus || $[19] !== restProps || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledLayer, {
1702
+ ...restProps,
1703
+ "data-ui": "Layer",
1704
+ onFocus: handleFocus,
1705
+ ref,
1706
+ style: t5,
1707
+ children
1708
+ }), $[17] = children, $[18] = handleFocus, $[19] = restProps, $[20] = t5, $[21] = t6) : t6 = $[21], t6;
1709
+ }), Layer = forwardRef(function(props, ref) {
1710
+ let $ = c(11), children, restProps, t0;
1711
+ $[0] === props ? (children = $[1], restProps = $[2], t0 = $[3]) : ({children, zOffset: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0);
1712
+ let zOffset = t0 === void 0 ? 1 : t0, t1;
1713
+ $[4] !== children || $[5] !== ref || $[6] !== restProps ? (t1 = /* @__PURE__ */ jsx(LayerChildren, {
1714
+ ...restProps,
1715
+ ref,
1716
+ children
1717
+ }), $[4] = children, $[5] = ref, $[6] = restProps, $[7] = t1) : t1 = $[7];
1718
+ let t2;
1719
+ return $[8] !== t1 || $[9] !== zOffset ? (t2 = /* @__PURE__ */ jsx(LayerProvider, {
1720
+ zOffset,
1721
+ children: t1
1722
+ }), $[8] = t1, $[9] = zOffset, $[10] = t2) : t2 = $[10], t2;
1723
+ });
1724
+ Layer.displayName = "ForwardRef(Layer)";
1725
+ const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
1726
+ globalScope[elementKey] = null;
1727
+ const PortalContext = createGlobalScopedContext(key, {
1728
+ version: 0,
1729
+ boundaryElement: null,
1730
+ get element() {
1731
+ return typeof document > "u" ? null : globalScope[elementKey] ? globalScope[elementKey] : (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey]), globalScope[elementKey]);
1732
+ }
1733
+ });
1734
+ /**
1735
+ * @public
1736
+ */
1737
+ function usePortal() {
1738
+ let value = useContext(PortalContext);
1739
+ if (!value) throw Error("usePortal(): missing context value");
1740
+ if (!isRecord(value) || value.version !== 0) throw Error("usePortal(): the context value is not compatible");
1741
+ return value;
1742
+ }
1743
+ /**
1744
+ * @public
1745
+ */
1746
+ function Portal(props) {
1747
+ let { children, __unstable_name: name } = props, portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
1748
+ return portalElement ? createPortal(children, portalElement) : null;
1749
+ }
1750
+ Portal.displayName = "Portal";
1751
+ /**
1752
+ * @public
1753
+ */
1754
+ function PortalProvider(props) {
1755
+ let $ = c(7), { boundaryElement, children, element, __unstable_elements: elements } = props, fallbackElement = useSyncExternalStore(emptySubscribe, _temp$2, _temp2$1), t0 = boundaryElement || null, t1 = element || fallbackElement, t2;
1756
+ $[0] !== elements || $[1] !== t0 || $[2] !== t1 ? (t2 = {
1757
+ version: 0,
1758
+ boundaryElement: t0,
1759
+ element: t1,
1760
+ elements
1761
+ }, $[0] = elements, $[1] = t0, $[2] = t1, $[3] = t2) : t2 = $[3];
1762
+ let value = t2, t3;
1763
+ return $[4] !== children || $[5] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext.Provider, {
1764
+ value,
1765
+ children
1766
+ }), $[4] = children, $[5] = value, $[6] = t3) : t3 = $[6], t3;
1767
+ }
1768
+ function _temp2$1() {
1769
+ return null;
1770
+ }
1771
+ function _temp$2() {
1772
+ return document.body;
1773
+ }
1774
+ PortalProvider.displayName = "PortalProvider";
1775
+ const emptySubscribe = () => () => {};
1776
+ function getElementRef(element) {
1777
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1778
+ return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
1779
+ }
1780
+ const DEFAULT_POPOVER_MARGINS = [
1781
+ 0,
1782
+ 0,
1783
+ 0,
1784
+ 0
1785
+ ], DEFAULT_FALLBACK_PLACEMENTS$1 = {
1786
+ top: [
1787
+ "bottom",
1788
+ "left",
1789
+ "right"
1790
+ ],
1791
+ "top-start": [
1792
+ "bottom-start",
1793
+ "left-start",
1794
+ "right-start"
1795
+ ],
1796
+ "top-end": [
1797
+ "bottom-end",
1798
+ "left-end",
1799
+ "right-end"
1800
+ ],
1801
+ bottom: [
1802
+ "top",
1803
+ "left",
1804
+ "right"
1805
+ ],
1806
+ "bottom-start": [
1807
+ "top-start",
1808
+ "left-start",
1809
+ "right-start"
1810
+ ],
1811
+ "bottom-end": [
1812
+ "top-end",
1813
+ "left-end",
1814
+ "right-end"
1815
+ ],
1816
+ left: [
1817
+ "right",
1818
+ "top",
1819
+ "bottom"
1820
+ ],
1821
+ "left-start": [
1822
+ "right-start",
1823
+ "top-start",
1824
+ "bottom-start"
1825
+ ],
1826
+ "left-end": [
1827
+ "right-end",
1828
+ "top-end",
1829
+ "bottom-end"
1830
+ ],
1831
+ right: [
1832
+ "left",
1833
+ "top",
1834
+ "bottom"
1835
+ ],
1836
+ "right-start": [
1837
+ "left-start",
1838
+ "top-start",
1839
+ "bottom-start"
1840
+ ],
1841
+ "right-end": [
1842
+ "left-end",
1843
+ "top-end",
1844
+ "bottom-end"
1845
+ ]
1846
+ };
1847
+ function size(options) {
1848
+ let { constrainSize, margins, matchReferenceWidth, maxWidthRef, padding = 0, referenceWidthRef, setReferenceWidth, widthRef } = options;
1849
+ return {
1850
+ name: "@sanity/ui/size",
1851
+ async fn(args) {
1852
+ let { elements, placement, platform, rects } = args, { floating, reference } = rects, overflow = await detectOverflow(args, {
1853
+ altBoundary: !0,
1854
+ boundary: options.boundaryElement || void 0,
1855
+ elementContext: "floating",
1856
+ padding,
1857
+ rootBoundary: "viewport"
1858
+ }), maxWidth = Infinity, maxHeight = Infinity, floatingW = floating.width, floatingH = floating.height;
1859
+ placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom));
1860
+ let availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
1861
+ referenceWidthRef.current = referenceWidth, setReferenceWidth(referenceWidth), matchReferenceWidth ? elements.floating.style.width = `${referenceWidth}px` : widthRef.current !== void 0 && (elements.floating.style.width = `${widthRef.current}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, maxWidthRef.current ?? Infinity)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
1862
+ let nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height;
1863
+ return floatingW !== nextDimensions.width || floatingH !== targetH ? { reset: { rects: !0 } } : {};
1864
+ }
1865
+ };
1866
+ }
1867
+ function calcCurrentWidth(params) {
1868
+ let { container, mediaIndex, width } = params, w = width[mediaIndex], currentWidth = w === void 0 ? width[width.length - 1] : w;
1869
+ return typeof currentWidth == "number" ? container[currentWidth] : void 0;
1870
+ }
1871
+ function calcMaxWidth(params) {
1872
+ let { boundaryWidth, currentWidth } = params;
1873
+ if (!(currentWidth === void 0 && boundaryWidth === void 0)) return Math.min(currentWidth ?? Infinity, (boundaryWidth || Infinity) - 8);
1874
+ }
1875
+ const MotionCard$1 = styled(motion.create(Card)).withConfig({
1876
+ displayName: "MotionCard",
1877
+ componentId: "sc-5mkek4-0"
1878
+ })`&:not([hidden]){display:flex;}flex-direction:column;width:max-content;min-width:min-content;will-change:transform;`, MotionFlex = styled(motion.create(Flex)).withConfig({
1879
+ displayName: "MotionFlex",
1880
+ componentId: "sc-5mkek4-1"
1881
+ })`will-change:opacity;`, PopoverCard = forwardRef(function(props, ref) {
1882
+ let $ = c(66), animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, originX, originY, overflow, padding, placement, radius, restProps, scheme, shadow, strategy, style, tone, width, xProp, yProp;
1883
+ $[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], originX = $[8], originY = $[9], overflow = $[10], padding = $[11], placement = $[12], radius = $[13], restProps = $[14], scheme = $[15], shadow = $[16], strategy = $[17], style = $[18], tone = $[19], width = $[20], xProp = $[21], yProp = $[22]) : ({__unstable_margins: marginsProp, animate, arrow, arrowRef, arrowX, arrowY, children, padding, placement, originX, originY, overflow, radius, scheme, shadow, strategy, style, tone, width, x: xProp, y: yProp, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = originX, $[9] = originY, $[10] = overflow, $[11] = padding, $[12] = placement, $[13] = radius, $[14] = restProps, $[15] = scheme, $[16] = shadow, $[17] = strategy, $[18] = style, $[19] = tone, $[20] = width, $[21] = xProp, $[22] = yProp);
1884
+ let { zIndex } = useLayer(), margins = marginsProp || DEFAULT_POPOVER_MARGINS, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0], t0 = animate ? "transform" : void 0, t1;
1885
+ $[23] !== originX || $[24] !== originY || $[25] !== strategy || $[26] !== style || $[27] !== t0 || $[28] !== width || $[29] !== x || $[30] !== y || $[31] !== zIndex ? (t1 = {
1886
+ left: x,
1887
+ originX,
1888
+ originY,
1889
+ position: strategy,
1890
+ top: y,
1891
+ width,
1892
+ zIndex,
1893
+ willChange: t0,
1894
+ ...style
1895
+ }, $[23] = originX, $[24] = originY, $[25] = strategy, $[26] = style, $[27] = t0, $[28] = width, $[29] = x, $[30] = y, $[31] = zIndex, $[32] = t1) : t1 = $[32];
1896
+ let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
1897
+ $[33] !== t2 || $[34] !== t3 ? (t4 = {
1898
+ left: t2,
1899
+ top: t3,
1900
+ right: void 0,
1901
+ bottom: void 0
1902
+ }, $[33] = t2, $[34] = t3, $[35] = t4) : t4 = $[35];
1903
+ let arrowStyle = t4, t5 = restProps, t6;
1904
+ $[36] === animate ? t6 = $[37] : (t6 = animate ? ["hidden", "initial"] : void 0, $[36] = animate, $[37] = t6);
1905
+ let t7;
1906
+ $[38] === animate ? t7 = $[39] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[38] = animate, $[39] = t7);
1907
+ let t8;
1908
+ $[40] === animate ? t8 = $[41] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[40] = animate, $[41] = t8);
1909
+ let t9;
1910
+ $[42] !== children || $[43] !== padding ? (t9 = /* @__PURE__ */ jsx(Flex, {
1911
+ direction: "column",
1912
+ flex: 1,
1913
+ padding,
1914
+ children
1915
+ }), $[42] = children, $[43] = padding, $[44] = t9) : t9 = $[44];
1916
+ let t10;
1917
+ $[45] !== overflow || $[46] !== t9 ? (t10 = /* @__PURE__ */ jsx(MotionFlex, {
1918
+ "data-ui": "Popover__wrapper",
1919
+ direction: "column",
1920
+ flex: 1,
1921
+ overflow,
1922
+ variants: POPOVER_MOTION_PROPS.children,
1923
+ transition: POPOVER_MOTION_PROPS.transition,
1924
+ children: t9
1925
+ }), $[45] = overflow, $[46] = t9, $[47] = t10) : t10 = $[47];
1926
+ let t11;
1927
+ $[48] !== arrow || $[49] !== arrowRef || $[50] !== arrowStyle ? (t11 = arrow && /* @__PURE__ */ jsx(Arrow, {
1928
+ ref: arrowRef,
1929
+ style: arrowStyle,
1930
+ width: 19,
1931
+ height: 8,
1932
+ radius: 2
1933
+ }), $[48] = arrow, $[49] = arrowRef, $[50] = arrowStyle, $[51] = t11) : t11 = $[51];
1934
+ let t12;
1935
+ return $[52] !== placement || $[53] !== radius || $[54] !== ref || $[55] !== rootStyle || $[56] !== scheme || $[57] !== shadow || $[58] !== t10 || $[59] !== t11 || $[60] !== t5 || $[61] !== t6 || $[62] !== t7 || $[63] !== t8 || $[64] !== tone ? (t12 = /* @__PURE__ */ jsxs(MotionCard$1, {
1936
+ "data-ui": "Popover",
1937
+ ...t5,
1938
+ "data-placement": placement,
1939
+ radius,
1940
+ ref,
1941
+ scheme,
1942
+ shadow,
1943
+ sizing: "border",
1944
+ style: rootStyle,
1945
+ tone,
1946
+ variants: POPOVER_MOTION_PROPS.card,
1947
+ transition: POPOVER_MOTION_PROPS.transition,
1948
+ initial: t6,
1949
+ animate: t7,
1950
+ exit: t8,
1951
+ children: [t10, t11]
1952
+ }), $[52] = placement, $[53] = radius, $[54] = ref, $[55] = rootStyle, $[56] = scheme, $[57] = shadow, $[58] = t10, $[59] = t11, $[60] = t5, $[61] = t6, $[62] = t7, $[63] = t8, $[64] = tone, $[65] = t12) : t12 = $[65], t12;
1953
+ });
1954
+ PopoverCard.displayName = "ForwardRef(PopoverCard)";
1955
+ const ViewportOverlay = () => {
1956
+ let $ = c(2), { zIndex } = useLayer(), t0;
1957
+ return $[0] === zIndex ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("div", { style: {
1958
+ height: "100vh",
1959
+ inset: 0,
1960
+ position: "fixed",
1961
+ width: "100vw",
1962
+ zIndex
1963
+ } }), $[0] = zIndex, $[1] = t0), t0;
1964
+ }, Popover = forwardRef(function(props, forwardedRef) {
1965
+ let $ = c(126), { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), _boundaryElement, _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, childProp, content, disabled, matchReferenceWidth, modal, open, paddingProp, portal, referenceElement, restProps, scheme, t0, t1, t10, t11, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
1966
+ if ($[0] !== props) {
1967
+ let { __unstable_margins: t12, animate: t13, arrow: t14, boundaryElement: t15, children: t16, constrainSize: t17, content: t18, disabled: t19, fallbackPlacements: t20, matchReferenceWidth: t21, floatingBoundary: t22, modal: t23, onActivate, open: t24, overflow: t25, padding: t26, placement: t27, placementStrategy: t28, portal: t29, preventOverflow: t30, radius: t31, referenceBoundary: t32, referenceElement: t33, scheme: t34, shadow: t35, tone: t36, width: t37, zOffset: t38, updateRef: t39, ...t40 } = props;
1968
+ t0 = t12, t1 = t13, t2 = t14, _boundaryElement = t15, childProp = t16, t3 = t17, content = t18, disabled = t19, _fallbackPlacements = t20, matchReferenceWidth = t21, _floatingBoundary = t22, modal = t23, open = t24, t4 = t25, paddingProp = t26, t5 = t27, t6 = t28, portal = t29, t7 = t30, t8 = t31, _referenceBoundary = t32, referenceElement = t33, scheme = t34, t9 = t35, t10 = t36, t11 = t37, _zOffsetProp = t38, updateRef = t39, restProps = t40, $[0] = props, $[1] = _boundaryElement, $[2] = _fallbackPlacements, $[3] = _floatingBoundary, $[4] = _referenceBoundary, $[5] = _zOffsetProp, $[6] = childProp, $[7] = content, $[8] = disabled, $[9] = matchReferenceWidth, $[10] = modal, $[11] = open, $[12] = paddingProp, $[13] = portal, $[14] = referenceElement, $[15] = restProps, $[16] = scheme, $[17] = t0, $[18] = t1, $[19] = t10, $[20] = t11, $[21] = t2, $[22] = t3, $[23] = t4, $[24] = t5, $[25] = t6, $[26] = t7, $[27] = t8, $[28] = t9, $[29] = updateRef;
1969
+ } else _boundaryElement = $[1], _fallbackPlacements = $[2], _floatingBoundary = $[3], _referenceBoundary = $[4], _zOffsetProp = $[5], childProp = $[6], content = $[7], disabled = $[8], matchReferenceWidth = $[9], modal = $[10], open = $[11], paddingProp = $[12], portal = $[13], referenceElement = $[14], restProps = $[15], scheme = $[16], t0 = $[17], t1 = $[18], t10 = $[19], t11 = $[20], t2 = $[21], t3 = $[22], t4 = $[23], t5 = $[24], t6 = $[25], t7 = $[26], t8 = $[27], t9 = $[28], updateRef = $[29];
1970
+ let margins = t0 === void 0 ? DEFAULT_POPOVER_MARGINS : t0, _animate = t1 === void 0 ? !1 : t1, arrowProp = t2 === void 0 ? !1 : t2, constrainSize = t3 === void 0 ? !1 : t3, overflow = t4 === void 0 ? "hidden" : t4, placementProp = t5 === void 0 ? "bottom" : t5, placementStrategy = t6 === void 0 ? "flip" : t6, preventOverflow = t7 === void 0 ? !0 : t7, radiusProp = t8 === void 0 ? 3 : t8, shadowProp = t9 === void 0 ? 3 : t9, tone = t10 === void 0 ? "inherit" : t10, widthProp = t11 === void 0 ? "auto" : t11, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? props.boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? props.boundaryElement ?? boundaryElementContext.element, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, t12;
1971
+ $[30] === paddingProp ? t12 = $[31] : (t12 = _getArrayProp(paddingProp), $[30] = paddingProp, $[31] = t12);
1972
+ let padding = t12, t13;
1973
+ $[32] === radiusProp ? t13 = $[33] : (t13 = _getArrayProp(radiusProp), $[32] = radiusProp, $[33] = t13);
1974
+ let radius = t13, t14;
1975
+ $[34] === shadowProp ? t14 = $[35] : (t14 = _getArrayProp(shadowProp), $[34] = shadowProp, $[35] = t14);
1976
+ let shadow = t14, widthArrayProp = _getArrayProp(widthProp), t15;
1977
+ $[36] === zOffsetProp ? t15 = $[37] : (t15 = _getArrayProp(zOffsetProp), $[36] = zOffsetProp, $[37] = t15);
1978
+ let zOffset = t15, ref = useRef(null), arrowRef = useRef(null), t16;
1979
+ $[38] === Symbol.for("react.memo_cache_sentinel") ? (t16 = () => ref.current, $[38] = t16) : t16 = $[38], useImperativeHandle(forwardedRef, t16);
1980
+ let mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
1981
+ container,
1982
+ mediaIndex,
1983
+ width: widthArrayProp
1984
+ }), widthRef = useRef(width), t17, t18;
1985
+ $[39] === width ? (t17 = $[40], t18 = $[41]) : (t17 = () => {
1986
+ widthRef.current = width;
1987
+ }, t18 = [width], $[39] = width, $[40] = t17, $[41] = t18), useEffect(t17, t18);
1988
+ let t19;
1989
+ $[42] !== boundaryWidth || $[43] !== width ? (t19 = calcMaxWidth({
1990
+ boundaryWidth,
1991
+ currentWidth: width
1992
+ }), $[42] = boundaryWidth, $[43] = width, $[44] = t19) : t19 = $[44];
1993
+ let maxWidth = t19, maxWidthRef = useRef(maxWidth), t20, t21;
1994
+ $[45] === maxWidth ? (t20 = $[46], t21 = $[47]) : (t20 = () => {
1995
+ maxWidthRef.current = maxWidth;
1996
+ }, t21 = [maxWidth], $[45] = maxWidth, $[46] = t20, $[47] = t21), useEffect(t20, t21);
1997
+ let referenceWidthRef = useRef(void 0), t22, t23;
1998
+ $[48] !== matchReferenceWidth || $[49] !== maxWidth || $[50] !== open || $[51] !== width ? (t22 = () => {
1999
+ let floatingElement = ref.current;
2000
+ if (!open || !floatingElement) return;
2001
+ let referenceWidth = referenceWidthRef.current;
2002
+ matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
2003
+ }, t23 = [
2004
+ width,
2005
+ matchReferenceWidth,
2006
+ maxWidth,
2007
+ open
2008
+ ], $[48] = matchReferenceWidth, $[49] = maxWidth, $[50] = open, $[51] = width, $[52] = t22, $[53] = t23) : (t22 = $[52], t23 = $[53]), useEffect(t22, t23);
2009
+ let [referenceWidth_0, setReferenceWidth] = useState(void 0), t24;
2010
+ $[54] !== animate || $[55] !== arrowProp || $[56] !== constrainSize || $[57] !== fallbackPlacements || $[58] !== floatingBoundary || $[59] !== margins || $[60] !== matchReferenceWidth || $[61] !== placementProp || $[62] !== placementStrategy || $[63] !== preventOverflow || $[64] !== referenceBoundary ? (t24 = {
2011
+ animate,
2012
+ arrowProp,
2013
+ arrowRef,
2014
+ constrainSize,
2015
+ fallbackPlacements,
2016
+ floatingBoundary,
2017
+ margins,
2018
+ matchReferenceWidth,
2019
+ maxWidthRef,
2020
+ placementProp,
2021
+ placementStrategy,
2022
+ preventOverflow,
2023
+ referenceBoundary,
2024
+ referenceWidthRef,
2025
+ rootBoundary: "viewport",
2026
+ setReferenceWidth,
2027
+ widthRef
2028
+ }, $[54] = animate, $[55] = arrowProp, $[56] = constrainSize, $[57] = fallbackPlacements, $[58] = floatingBoundary, $[59] = margins, $[60] = matchReferenceWidth, $[61] = placementProp, $[62] = placementStrategy, $[63] = preventOverflow, $[64] = referenceBoundary, $[65] = t24) : t24 = $[65];
2029
+ let middleware = useMiddleware$1(t24), t25;
2030
+ $[66] === referenceElement ? t25 = $[67] : (t25 = referenceElement ? { reference: referenceElement } : void 0, $[66] = referenceElement, $[67] = t25);
2031
+ let t26;
2032
+ $[68] !== middleware || $[69] !== placementProp || $[70] !== t25 ? (t26 = {
2033
+ middleware,
2034
+ placement: placementProp,
2035
+ whileElementsMounted: autoUpdate,
2036
+ elements: t25
2037
+ }, $[68] = middleware, $[69] = placementProp, $[70] = t25, $[71] = t26) : t26 = $[71];
2038
+ let { x, y, middlewareData, placement, refs, strategy, update } = useFloating(t26), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, t27;
2039
+ $[72] === Symbol.for("react.memo_cache_sentinel") ? (t27 = (arrowEl) => {
2040
+ arrowRef.current = arrowEl;
2041
+ }, $[72] = t27) : t27 = $[72];
2042
+ let setArrow = t27, t28;
2043
+ $[73] === refs ? t28 = $[74] : (t28 = (node) => {
2044
+ ref.current = node, refs.setFloating(node);
2045
+ }, $[73] = refs, $[74] = t28);
2046
+ let setFloating = t28, t29;
2047
+ $[75] === childProp ? t29 = $[76] : (t29 = childProp ? getElementRef(childProp) : null, $[75] = childProp, $[76] = t29);
2048
+ let t30;
2049
+ $[77] === refs.reference.current ? t30 = $[78] : (t30 = () => refs.reference.current, $[77] = refs.reference.current, $[78] = t30), useImperativeHandle(t29, t30);
2050
+ let t31;
2051
+ bb0: {
2052
+ if (referenceElement) {
2053
+ t31 = childProp;
2054
+ break bb0;
2055
+ }
2056
+ if (!childProp) {
2057
+ t31 = null;
2058
+ break bb0;
2059
+ }
2060
+ let t32;
2061
+ $[79] !== childProp || $[80] !== refs.setReference ? (t32 = cloneElement(childProp, { ref: refs.setReference }), $[79] = childProp, $[80] = refs.setReference, $[81] = t32) : t32 = $[81], t31 = t32;
2062
+ }
2063
+ let child = t31, t32, t33;
2064
+ if ($[82] === update ? (t32 = $[83], t33 = $[84]) : (t32 = () => update, t33 = [update], $[82] = update, $[83] = t32, $[84] = t33), useImperativeHandle(updateRef, t32, t33), disabled) {
2065
+ let t34;
2066
+ return $[85] === childProp ? t34 = $[86] : (t34 = childProp || /* @__PURE__ */ jsx(Fragment$1, {}), $[85] = childProp, $[86] = t34), t34;
2067
+ }
2068
+ let t34;
2069
+ $[87] === modal ? t34 = $[88] : (t34 = modal && /* @__PURE__ */ jsx(ViewportOverlay, {}), $[87] = modal, $[88] = t34);
2070
+ let t35 = matchReferenceWidth ? referenceWidth_0 : width, t36;
2071
+ $[89] !== animate || $[90] !== arrowProp || $[91] !== arrowX || $[92] !== arrowY || $[93] !== content || $[94] !== margins || $[95] !== originX || $[96] !== originY || $[97] !== overflow || $[98] !== padding || $[99] !== placement || $[100] !== radius || $[101] !== referenceHidden || $[102] !== restProps || $[103] !== scheme || $[104] !== setFloating || $[105] !== shadow || $[106] !== strategy || $[107] !== t35 || $[108] !== tone || $[109] !== x || $[110] !== y ? (t36 = /* @__PURE__ */ jsx(PopoverCard, {
2072
+ ...restProps,
2073
+ __unstable_margins: margins,
2074
+ animate,
2075
+ arrow: arrowProp,
2076
+ arrowRef: setArrow,
2077
+ arrowX,
2078
+ arrowY,
2079
+ hidden: referenceHidden,
2080
+ overflow,
2081
+ padding,
2082
+ placement,
2083
+ radius,
2084
+ ref: setFloating,
2085
+ scheme,
2086
+ shadow,
2087
+ originX,
2088
+ originY,
2089
+ strategy,
2090
+ tone,
2091
+ width: t35,
2092
+ x,
2093
+ y,
2094
+ children: content
2095
+ }), $[89] = animate, $[90] = arrowProp, $[91] = arrowX, $[92] = arrowY, $[93] = content, $[94] = margins, $[95] = originX, $[96] = originY, $[97] = overflow, $[98] = padding, $[99] = placement, $[100] = radius, $[101] = referenceHidden, $[102] = restProps, $[103] = scheme, $[104] = setFloating, $[105] = shadow, $[106] = strategy, $[107] = t35, $[108] = tone, $[109] = x, $[110] = y, $[111] = t36) : t36 = $[111];
2096
+ let t37;
2097
+ $[112] !== t34 || $[113] !== t36 || $[114] !== zOffset ? (t37 = /* @__PURE__ */ jsxs(LayerProvider, {
2098
+ zOffset,
2099
+ children: [t34, t36]
2100
+ }), $[112] = t34, $[113] = t36, $[114] = zOffset, $[115] = t37) : t37 = $[115];
2101
+ let popover = t37, t38;
2102
+ $[116] !== open || $[117] !== popover || $[118] !== portal ? (t38 = open && (portal ? /* @__PURE__ */ jsx(Portal, {
2103
+ __unstable_name: typeof portal == "string" ? portal : void 0,
2104
+ children: popover
2105
+ }) : popover), $[116] = open, $[117] = popover, $[118] = portal, $[119] = t38) : t38 = $[119];
2106
+ let children = t38, t39;
2107
+ $[120] !== animate || $[121] !== children ? (t39 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[120] = animate, $[121] = children, $[122] = t39) : t39 = $[122];
2108
+ let t40;
2109
+ return $[123] !== child || $[124] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[123] = child, $[124] = t39, $[125] = t40) : t40 = $[125], t40;
2110
+ });
2111
+ Popover.displayName = "ForwardRef(Popover)";
2112
+ function useMiddleware$1(t0) {
2113
+ let $ = c(42), { animate, arrowProp, arrowRef, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, maxWidthRef, placementProp, placementStrategy, preventOverflow, referenceBoundary, referenceWidthRef, rootBoundary, setReferenceWidth, widthRef } = t0, ret;
2114
+ if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== maxWidthRef || $[9] !== placementProp || $[10] !== placementStrategy || $[11] !== preventOverflow || $[12] !== referenceBoundary || $[13] !== referenceWidthRef || $[14] !== rootBoundary || $[15] !== setReferenceWidth || $[16] !== widthRef) {
2115
+ if (ret = [], constrainSize || preventOverflow) if (placementStrategy === "autoPlacement") {
2116
+ let t1;
2117
+ $[18] !== fallbackPlacements || $[19] !== placementProp ? (t1 = autoPlacement({ allowedPlacements: [placementProp].concat(fallbackPlacements) }), $[18] = fallbackPlacements, $[19] = placementProp, $[20] = t1) : t1 = $[20], ret.push(t1);
2118
+ } else {
2119
+ let t1 = floatingBoundary || void 0, t2;
2120
+ $[21] !== fallbackPlacements || $[22] !== rootBoundary || $[23] !== t1 ? (t2 = flip({
2121
+ boundary: t1,
2122
+ fallbackPlacements,
2123
+ padding: 4,
2124
+ rootBoundary
2125
+ }), $[21] = fallbackPlacements, $[22] = rootBoundary, $[23] = t1, $[24] = t2) : t2 = $[24], ret.push(t2);
2126
+ }
2127
+ let t1;
2128
+ if ($[25] === Symbol.for("react.memo_cache_sentinel") ? (t1 = offset({ mainAxis: 4 }), $[25] = t1) : t1 = $[25], ret.push(t1), constrainSize || matchReferenceWidth) {
2129
+ let t2 = floatingBoundary || void 0, t3;
2130
+ $[26] !== constrainSize || $[27] !== margins || $[28] !== matchReferenceWidth || $[29] !== maxWidthRef || $[30] !== referenceWidthRef || $[31] !== setReferenceWidth || $[32] !== t2 || $[33] !== widthRef ? (t3 = size({
2131
+ boundaryElement: t2,
2132
+ constrainSize,
2133
+ margins,
2134
+ matchReferenceWidth,
2135
+ maxWidthRef,
2136
+ padding: 4,
2137
+ referenceWidthRef,
2138
+ setReferenceWidth,
2139
+ widthRef
2140
+ }), $[26] = constrainSize, $[27] = margins, $[28] = matchReferenceWidth, $[29] = maxWidthRef, $[30] = referenceWidthRef, $[31] = setReferenceWidth, $[32] = t2, $[33] = widthRef, $[34] = t3) : t3 = $[34], ret.push(t3);
2141
+ }
2142
+ if (preventOverflow) {
2143
+ let t2 = floatingBoundary || void 0, t3;
2144
+ $[35] !== rootBoundary || $[36] !== t2 ? (t3 = shift({
2145
+ boundary: t2,
2146
+ rootBoundary,
2147
+ padding: 4
2148
+ }), $[35] = rootBoundary, $[36] = t2, $[37] = t3) : t3 = $[37], ret.push(t3);
2149
+ }
2150
+ if (arrowProp) {
2151
+ let t2;
2152
+ $[38] === arrowRef ? t2 = $[39] : (t2 = arrow({
2153
+ element: arrowRef,
2154
+ padding: 4
2155
+ }), $[38] = arrowRef, $[39] = t2), ret.push(t2);
2156
+ }
2157
+ animate && ret.push(origin);
2158
+ let t2 = referenceBoundary || void 0, t3;
2159
+ $[40] === t2 ? t3 = $[41] : (t3 = hide({
2160
+ boundary: t2,
2161
+ padding: 4,
2162
+ strategy: "referenceHidden"
2163
+ }), $[40] = t2, $[41] = t3), ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = maxWidthRef, $[9] = placementProp, $[10] = placementStrategy, $[11] = preventOverflow, $[12] = referenceBoundary, $[13] = referenceWidthRef, $[14] = rootBoundary, $[15] = setReferenceWidth, $[16] = widthRef, $[17] = ret;
2164
+ } else ret = $[17];
2165
+ return ret;
2166
+ }
2167
+ const BASE_STYLE = {
2168
+ "&&:not([hidden])": { display: "grid" },
2169
+ "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" },
2170
+ gridTemplateColumns: "minmax(0, 1fr)",
2171
+ gridAutoRows: "min-content"
2172
+ };
2173
+ function stackBaseStyle() {
2174
+ return BASE_STYLE;
2175
+ }
2176
+ function responsiveStackSpaceStyle(props) {
2177
+ let { media, space } = getTheme_v2(props.theme);
2178
+ return _responsive(media, props.$space, (spaceIndex) => ({ gridGap: rem(space[spaceIndex]) }));
2179
+ }
2180
+ const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
2181
+ displayName: "StyledStack",
2182
+ componentId: "sc-tusrcx-0"
2183
+ })(stackBaseStyle, responsiveStackSpaceStyle), StackComponent = forwardRef(function(props, ref) {
2184
+ let $ = c(13), as, deprecated_space, gap, restProps;
2185
+ $[0] === props ? (as = $[1], deprecated_space = $[2], gap = $[3], restProps = $[4]) : ({as, gap, space: deprecated_space, ...restProps} = props, $[0] = props, $[1] = as, $[2] = deprecated_space, $[3] = gap, $[4] = restProps);
2186
+ let spacing = gap === void 0 ? deprecated_space : gap, t0 = typeof as == "string" ? as : void 0, t1;
2187
+ $[5] === spacing ? t1 = $[6] : (t1 = _getArrayProp(spacing), $[5] = spacing, $[6] = t1);
2188
+ let t2;
2189
+ return $[7] !== as || $[8] !== ref || $[9] !== restProps || $[10] !== t0 || $[11] !== t1 ? (t2 = /* @__PURE__ */ jsx(StyledStack, {
2190
+ "data-as": t0,
2191
+ "data-ui": "Stack",
2192
+ ...restProps,
2193
+ $space: t1,
2194
+ forwardedAs: as,
2195
+ ref
2196
+ }), $[7] = as, $[8] = ref, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2) : t2 = $[12], t2;
2197
+ });
2198
+ StackComponent.displayName = "ForwardRef(Stack)";
2199
+ /**
2200
+ * The `Stack` component is used to place elements on top of each other.
2201
+ *
2202
+ * @public
2203
+ */
2204
+ const Stack = StackComponent, CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, StyledTextInput = /* @__PURE__ */ styled(Card).attrs({ forwardedAs: "span" }).withConfig({
2205
+ displayName: "StyledTextInput",
2206
+ componentId: "sc-p5vqj0-0"
2207
+ })(textInputRootStyle), InputRoot = styled.span.withConfig({
2208
+ displayName: "InputRoot",
2209
+ componentId: "sc-p5vqj0-1"
2210
+ })`flex:1;min-width:0;display:block;position:relative;`, Prefix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
2211
+ displayName: "Prefix",
2212
+ componentId: "sc-p5vqj0-2"
2213
+ })`border-top-right-radius:0;border-bottom-right-radius:0;& > span{display:block;margin:-1px;}`, Suffix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
2214
+ displayName: "Suffix",
2215
+ componentId: "sc-p5vqj0-3"
2216
+ })`border-top-left-radius:0;border-bottom-left-radius:0;& > span{display:block;margin:-1px;}`, Input = /* @__PURE__ */ styled.input.withConfig({
2217
+ displayName: "Input",
2218
+ componentId: "sc-p5vqj0-4"
2219
+ })(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle), Presentation = /* @__PURE__ */ styled.span.withConfig({
2220
+ displayName: "Presentation",
2221
+ componentId: "sc-p5vqj0-5"
2222
+ })(responsiveRadiusStyle, textInputRepresentationStyle), LeftBox = styled(Box).withConfig({
2223
+ displayName: "LeftBox",
2224
+ componentId: "sc-p5vqj0-6"
2225
+ })`position:absolute;top:0;left:0;`, RightBox = styled(Box).withConfig({
2226
+ displayName: "RightBox",
2227
+ componentId: "sc-p5vqj0-7"
2228
+ })`position:absolute;top:0;right:0;`, RightCard = styled(Card).withConfig({
2229
+ displayName: "RightCard",
2230
+ componentId: "sc-p5vqj0-8"
2231
+ })`background-color:transparent;position:absolute;top:0;right:0;`, TextInputClearButton = /* @__PURE__ */ styled(Button).withConfig({
2232
+ displayName: "TextInputClearButton",
2233
+ componentId: "sc-p5vqj0-9"
2234
+ })({ "&:not([hidden])": { display: "block" } }), TextInput = forwardRef(function(props, forwardedRef) {
2235
+ let $ = c(93), IconComponent, IconRightComponent, __unstable_disableFocusRing, clearButton, customValidity, gap, onClear, prefix, readOnly, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, weight;
2236
+ $[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], clearButton = $[4], customValidity = $[5], gap = $[6], onClear = $[7], prefix = $[8], readOnly = $[9], restProps = $[10], suffix = $[11], t0 = $[12], t1 = $[13], t2 = $[14], t3 = $[15], t4 = $[16], t5 = $[17], t6 = $[18], weight = $[19]) : ({__unstable_disableFocusRing, border: t0, clearButton, disabled: t1, fontSize: t2, gap, icon: IconComponent, iconRight: IconRightComponent, onClear, padding: t3, prefix, radius: t4, readOnly, space: t5, suffix, customValidity, type: t6, weight, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = clearButton, $[5] = customValidity, $[6] = gap, $[7] = onClear, $[8] = prefix, $[9] = readOnly, $[10] = restProps, $[11] = suffix, $[12] = t0, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = weight);
2237
+ let border = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSizeProp = t2 === void 0 ? 2 : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, deprecated_space = t5 === void 0 ? 3 : t5, type = t6 === void 0 ? "text" : t6, ref = useRef(null), rootTheme = useRootTheme(), t7;
2238
+ $[20] === fontSizeProp ? t7 = $[21] : (t7 = _getArrayProp(fontSizeProp), $[20] = fontSizeProp, $[21] = t7);
2239
+ let fontSize = t7, t8;
2240
+ $[22] === paddingProp ? t8 = $[23] : (t8 = _getArrayProp(paddingProp), $[22] = paddingProp, $[23] = t8);
2241
+ let padding = t8, t9;
2242
+ $[24] === radiusProp ? t9 = $[25] : (t9 = _getArrayProp(radiusProp), $[24] = radiusProp, $[25] = t9);
2243
+ let radius = t9, t10 = gap === void 0 ? deprecated_space : gap, t11;
2244
+ $[26] === t10 ? t11 = $[27] : (t11 = _getArrayProp(t10), $[26] = t10, $[27] = t11);
2245
+ let space = t11, $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix, t12;
2246
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => ref.current, $[28] = t12) : t12 = $[28], useImperativeHandle(forwardedRef, t12), useCustomValidity(ref, customValidity);
2247
+ let handleClearMouseDown = _temp$1, t13;
2248
+ $[29] === onClear ? t13 = $[30] : (t13 = (event_0) => {
2249
+ event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
2250
+ }, $[29] = onClear, $[30] = t13);
2251
+ let handleClearClick = t13, t14;
2252
+ $[31] !== prefix || $[32] !== radius ? (t14 = prefix && /* @__PURE__ */ jsx(Prefix, {
2253
+ borderTop: !0,
2254
+ borderLeft: !0,
2255
+ borderBottom: !0,
2256
+ radius,
2257
+ sizing: "border",
2258
+ tone: "inherit",
2259
+ children: /* @__PURE__ */ jsx("span", { children: prefix })
2260
+ }), $[31] = prefix, $[32] = radius, $[33] = t14) : t14 = $[33];
2261
+ let prefixNode = t14, t15 = border ? "" : void 0, t16;
2262
+ $[34] !== IconComponent || $[35] !== fontSize || $[36] !== padding ? (t16 = IconComponent && /* @__PURE__ */ jsx(LeftBox, {
2263
+ padding,
2264
+ children: /* @__PURE__ */ jsxs(Text, {
2265
+ size: fontSize,
2266
+ children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
2267
+ })
2268
+ }), $[34] = IconComponent, $[35] = fontSize, $[36] = padding, $[37] = t16) : t16 = $[37];
2269
+ let t17;
2270
+ $[38] !== $hasClearButton || $[39] !== IconRightComponent || $[40] !== fontSize || $[41] !== padding ? (t17 = !$hasClearButton && IconRightComponent && /* @__PURE__ */ jsx(RightBox, {
2271
+ padding,
2272
+ children: /* @__PURE__ */ jsxs(Text, {
2273
+ size: fontSize,
2274
+ children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
2275
+ })
2276
+ }), $[38] = $hasClearButton, $[39] = IconRightComponent, $[40] = fontSize, $[41] = padding, $[42] = t17) : t17 = $[42];
2277
+ let t18;
2278
+ $[43] !== $hasPrefix || $[44] !== $hasSuffix || $[45] !== __unstable_disableFocusRing || $[46] !== radius || $[47] !== rootTheme.scheme || $[48] !== rootTheme.tone || $[49] !== t15 || $[50] !== t16 || $[51] !== t17 ? (t18 = /* @__PURE__ */ jsxs(Presentation, {
2279
+ $hasPrefix,
2280
+ $unstableDisableFocusRing: __unstable_disableFocusRing,
2281
+ $hasSuffix,
2282
+ $radius: radius,
2283
+ $scheme: rootTheme.scheme,
2284
+ $tone: rootTheme.tone,
2285
+ "data-border": t15,
2286
+ "data-scheme": rootTheme.scheme,
2287
+ "data-tone": rootTheme.tone,
2288
+ children: [t16, t17]
2289
+ }), $[43] = $hasPrefix, $[44] = $hasSuffix, $[45] = __unstable_disableFocusRing, $[46] = radius, $[47] = rootTheme.scheme, $[48] = rootTheme.tone, $[49] = t15, $[50] = t16, $[51] = t17, $[52] = t18) : t18 = $[52];
2290
+ let presentationNode = t18, t19;
2291
+ $[53] === padding ? t19 = $[54] : (t19 = padding.map(_temp2), $[53] = padding, $[54] = t19);
2292
+ let clearButtonBoxPadding = t19, t20;
2293
+ $[55] === padding ? t20 = $[56] : (t20 = padding.map(_temp3), $[55] = padding, $[56] = t20);
2294
+ let clearButtonPadding = t20, clearButtonProps = typeof clearButton == "object" ? clearButton : EMPTY_RECORD, t21;
2295
+ $[57] !== clearButton || $[58] !== clearButtonBoxPadding || $[59] !== clearButtonPadding || $[60] !== clearButtonProps || $[61] !== customValidity || $[62] !== disabled || $[63] !== fontSize || $[64] !== handleClearClick || $[65] !== radius || $[66] !== readOnly ? (t21 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsx(RightCard, {
2296
+ forwardedAs: "span",
2297
+ padding: clearButtonBoxPadding,
2298
+ style: CLEAR_BUTTON_BOX_STYLE,
2299
+ tone: customValidity ? "critical" : "inherit",
2300
+ children: /* @__PURE__ */ jsx(TextInputClearButton, {
2301
+ "aria-label": "Clear",
2302
+ "data-qa": "clear-button",
2303
+ fontSize,
2304
+ icon: CloseIcon,
2305
+ mode: "bleed",
2306
+ padding: clearButtonPadding,
2307
+ radius,
2308
+ ...clearButtonProps,
2309
+ onClick: handleClearClick,
2310
+ onMouseDown: handleClearMouseDown
2311
+ })
2312
+ }), $[57] = clearButton, $[58] = clearButtonBoxPadding, $[59] = clearButtonPadding, $[60] = clearButtonProps, $[61] = customValidity, $[62] = disabled, $[63] = fontSize, $[64] = handleClearClick, $[65] = radius, $[66] = readOnly, $[67] = t21) : t21 = $[67];
2313
+ let clearButtonNode = t21, t22;
2314
+ $[68] !== radius || $[69] !== suffix ? (t22 = suffix && /* @__PURE__ */ jsx(Suffix, {
2315
+ borderTop: !0,
2316
+ borderRight: !0,
2317
+ borderBottom: !0,
2318
+ radius,
2319
+ sizing: "border",
2320
+ tone: "inherit",
2321
+ children: /* @__PURE__ */ jsx("span", { children: suffix })
2322
+ }), $[68] = radius, $[69] = suffix, $[70] = t22) : t22 = $[70];
2323
+ let suffixNode = t22, t23 = $hasIconRight || $hasClearButton, t24;
2324
+ $[71] !== $hasIcon || $[72] !== disabled || $[73] !== fontSize || $[74] !== padding || $[75] !== readOnly || $[76] !== restProps || $[77] !== rootTheme.scheme || $[78] !== rootTheme.tone || $[79] !== space || $[80] !== t23 || $[81] !== type || $[82] !== weight ? (t24 = /* @__PURE__ */ jsx(Input, {
2325
+ "data-as": "input",
2326
+ "data-scheme": rootTheme.scheme,
2327
+ "data-tone": rootTheme.tone,
2328
+ ...restProps,
2329
+ $fontSize: fontSize,
2330
+ $iconLeft: $hasIcon,
2331
+ $iconRight: t23,
2332
+ $padding: padding,
2333
+ $scheme: rootTheme.scheme,
2334
+ $space: space,
2335
+ $tone: rootTheme.tone,
2336
+ $weight: weight,
2337
+ disabled,
2338
+ readOnly,
2339
+ ref,
2340
+ type
2341
+ }), $[71] = $hasIcon, $[72] = disabled, $[73] = fontSize, $[74] = padding, $[75] = readOnly, $[76] = restProps, $[77] = rootTheme.scheme, $[78] = rootTheme.tone, $[79] = space, $[80] = t23, $[81] = type, $[82] = weight, $[83] = t24) : t24 = $[83];
2342
+ let t25;
2343
+ $[84] !== clearButtonNode || $[85] !== presentationNode || $[86] !== t24 ? (t25 = /* @__PURE__ */ jsxs(InputRoot, { children: [
2344
+ t24,
2345
+ presentationNode,
2346
+ clearButtonNode
2347
+ ] }), $[84] = clearButtonNode, $[85] = presentationNode, $[86] = t24, $[87] = t25) : t25 = $[87];
2348
+ let t26;
2349
+ return $[88] !== prefixNode || $[89] !== rootTheme.tone || $[90] !== suffixNode || $[91] !== t25 ? (t26 = /* @__PURE__ */ jsxs(StyledTextInput, {
2350
+ "data-ui": "TextInput",
2351
+ tone: rootTheme.tone,
2352
+ children: [
2353
+ prefixNode,
2354
+ t25,
2355
+ suffixNode
2356
+ ]
2357
+ }), $[88] = prefixNode, $[89] = rootTheme.tone, $[90] = suffixNode, $[91] = t25, $[92] = t26) : t26 = $[92], t26;
2358
+ });
2359
+ TextInput.displayName = "ForwardRef(TextInput)";
2360
+ function _temp$1(event) {
2361
+ event.preventDefault(), event.stopPropagation();
2362
+ }
2363
+ function _temp2(v) {
2364
+ return v === 0 ? 0 : v === 1 || v === 2 ? 1 : v - 2;
2365
+ }
2366
+ function _temp3(v_0) {
2367
+ return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : v_0 - 1;
2368
+ }
2369
+ /**
2370
+ * @beta
2371
+ */
2372
+ function useDelayedState(initialState) {
2373
+ let [state, setState] = useState(initialState), delayedAction = useRef(void 0), onStateChange = useCallback((nextState, delay) => {
2374
+ let action = () => {
2375
+ setState(nextState);
2376
+ };
2377
+ if (delayedAction.current &&= (clearTimeout(delayedAction.current), void 0), !delay) return action();
2378
+ delayedAction.current = setTimeout(action, delay);
2379
+ }, []);
2380
+ return useEffect(() => () => {
2381
+ delayedAction.current && clearTimeout(delayedAction.current);
2382
+ }, []), [state, onStateChange];
2383
+ }
2384
+ const DEFAULT_FALLBACK_PLACEMENTS = {
2385
+ top: [
2386
+ "top-end",
2387
+ "top-start",
2388
+ "bottom",
2389
+ "left",
2390
+ "right"
2391
+ ],
2392
+ "top-start": [
2393
+ "top",
2394
+ "top-end",
2395
+ "bottom-start",
2396
+ "left-start",
2397
+ "right-start"
2398
+ ],
2399
+ "top-end": [
2400
+ "top",
2401
+ "top-start",
2402
+ "bottom-end",
2403
+ "left-end",
2404
+ "right-end"
2405
+ ],
2406
+ bottom: [
2407
+ "bottom-end",
2408
+ "bottom-start",
2409
+ "top",
2410
+ "left",
2411
+ "right"
2412
+ ],
2413
+ "bottom-start": [
2414
+ "bottom",
2415
+ "bottom-end",
2416
+ "top-start",
2417
+ "left-start",
2418
+ "right-start"
2419
+ ],
2420
+ "bottom-end": [
2421
+ "bottom",
2422
+ "bottom-start",
2423
+ "top-end",
2424
+ "left-end",
2425
+ "right-end"
2426
+ ],
2427
+ left: [
2428
+ "left-end",
2429
+ "left-start",
2430
+ "right",
2431
+ "top",
2432
+ "bottom"
2433
+ ],
2434
+ "left-start": [
2435
+ "left",
2436
+ "left-end",
2437
+ "right-start",
2438
+ "top-start",
2439
+ "bottom-start"
2440
+ ],
2441
+ "left-end": [
2442
+ "left",
2443
+ "left-start",
2444
+ "right-end",
2445
+ "top-end",
2446
+ "bottom-end"
2447
+ ],
2448
+ right: [
2449
+ "right-end",
2450
+ "right-start",
2451
+ "left",
2452
+ "top",
2453
+ "bottom"
2454
+ ],
2455
+ "right-start": [
2456
+ "right",
2457
+ "right-end",
2458
+ "left-start",
2459
+ "top-start",
2460
+ "bottom-start"
2461
+ ],
2462
+ "right-end": [
2463
+ "right",
2464
+ "right-start",
2465
+ "left-end",
2466
+ "top-end",
2467
+ "bottom-end"
2468
+ ]
2469
+ }, MotionCard = styled(motion.create(Card)).withConfig({
2470
+ displayName: "MotionCard",
2471
+ componentId: "sc-ae1zod-0"
2472
+ })`will-change:transform;`, TooltipCard = forwardRef(function(props, ref) {
2473
+ let $ = c(48), animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, restProps, scheme, shadow, style;
2474
+ $[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], restProps = $[12], scheme = $[13], shadow = $[14], style = $[15]) : ({animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, scheme, shadow, style, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = restProps, $[13] = scheme, $[14] = shadow, $[15] = style);
2475
+ let t0 = animate ? "transform" : void 0, t1;
2476
+ $[16] !== originX || $[17] !== originY || $[18] !== style || $[19] !== t0 ? (t1 = {
2477
+ originX,
2478
+ originY,
2479
+ willChange: t0,
2480
+ ...style
2481
+ }, $[16] = originX, $[17] = originY, $[18] = style, $[19] = t0, $[20] = t1) : t1 = $[20];
2482
+ let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
2483
+ $[21] !== t2 || $[22] !== t3 ? (t4 = {
2484
+ left: t2,
2485
+ top: t3,
2486
+ right: void 0,
2487
+ bottom: void 0
2488
+ }, $[21] = t2, $[22] = t3, $[23] = t4) : t4 = $[23];
2489
+ let arrowStyle = t4, t5 = restProps, t6;
2490
+ $[24] === animate ? t6 = $[25] : (t6 = animate ? ["hidden", "initial"] : void 0, $[24] = animate, $[25] = t6);
2491
+ let t7;
2492
+ $[26] === animate ? t7 = $[27] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[26] = animate, $[27] = t7);
2493
+ let t8;
2494
+ $[28] === animate ? t8 = $[29] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[28] = animate, $[29] = t8);
2495
+ let t9;
2496
+ $[30] !== arrow || $[31] !== arrowRef || $[32] !== arrowStyle ? (t9 = arrow && /* @__PURE__ */ jsx(Arrow, {
2497
+ ref: arrowRef,
2498
+ style: arrowStyle,
2499
+ width: 15,
2500
+ height: 6,
2501
+ radius: 2
2502
+ }), $[30] = arrow, $[31] = arrowRef, $[32] = arrowStyle, $[33] = t9) : t9 = $[33];
2503
+ let t10;
2504
+ return $[34] !== children || $[35] !== padding || $[36] !== placement || $[37] !== radius || $[38] !== ref || $[39] !== rootStyle || $[40] !== scheme || $[41] !== shadow || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t8 || $[46] !== t9 ? (t10 = /* @__PURE__ */ jsxs(MotionCard, {
2505
+ "data-ui": "Tooltip__card",
2506
+ ...t5,
2507
+ "data-placement": placement,
2508
+ padding,
2509
+ radius,
2510
+ ref,
2511
+ scheme,
2512
+ shadow,
2513
+ style: rootStyle,
2514
+ variants: POPOVER_MOTION_PROPS.card,
2515
+ transition: POPOVER_MOTION_PROPS.transition,
2516
+ initial: t6,
2517
+ animate: t7,
2518
+ exit: t8,
2519
+ children: [children, t9]
2520
+ }), $[34] = children, $[35] = padding, $[36] = placement, $[37] = radius, $[38] = ref, $[39] = rootStyle, $[40] = scheme, $[41] = shadow, $[42] = t5, $[43] = t6, $[44] = t7, $[45] = t8, $[46] = t9, $[47] = t10) : t10 = $[47], t10;
2521
+ });
2522
+ TooltipCard.displayName = "ForwardRef(TooltipCard)";
2523
+ /**
2524
+ * @beta
2525
+ */
2526
+ const TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
2527
+ /**
2528
+ * @beta
2529
+ */
2530
+ function useTooltipDelayGroup() {
2531
+ return useContext(TooltipDelayGroupContext);
2532
+ }
2533
+ const StyledTooltip = styled(Layer).withConfig({
2534
+ displayName: "StyledTooltip",
2535
+ componentId: "sc-hx8o7p-0"
2536
+ })`pointer-events:none;`, Tooltip = forwardRef(function(props, forwardedRef) {
2537
+ let $ = c(137), boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), _boundaryElement, _fallbackPlacementsProp, _zOffset, childProp, content, delay, disabled, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5;
2538
+ $[0] === props ? (_boundaryElement = $[1], _fallbackPlacementsProp = $[2], _zOffset = $[3], childProp = $[4], content = $[5], delay = $[6], disabled = $[7], portalProp = $[8], restProps = $[9], scheme = $[10], t0 = $[11], t1 = $[12], t2 = $[13], t3 = $[14], t4 = $[15], t5 = $[16]) : ({animate: t0, arrow: t1, boundaryElement: _boundaryElement, children: childProp, content, disabled, fallbackPlacements: _fallbackPlacementsProp, padding: t2, placement: t3, portal: portalProp, radius: t4, scheme, shadow: t5, zOffset: _zOffset, delay, ...restProps} = props, $[0] = props, $[1] = _boundaryElement, $[2] = _fallbackPlacementsProp, $[3] = _zOffset, $[4] = childProp, $[5] = content, $[6] = delay, $[7] = disabled, $[8] = portalProp, $[9] = restProps, $[10] = scheme, $[11] = t0, $[12] = t1, $[13] = t2, $[14] = t3, $[15] = t4, $[16] = t5);
2539
+ let _animate = t0 === void 0 ? !1 : t0, arrowProp = t1 === void 0 ? !1 : t1, padding = t2 === void 0 ? 2 : t2, placementProp = t3 === void 0 ? "bottom" : t3, radius = t4 === void 0 ? 2 : t4, shadow = t5 === void 0 ? 2 : t5, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacementsProp = _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], zOffset = _zOffset ?? layer.tooltip.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, t6;
2540
+ $[17] === fallbackPlacementsProp ? t6 = $[18] : (t6 = _getArrayProp(fallbackPlacementsProp), $[17] = fallbackPlacementsProp, $[18] = t6);
2541
+ let fallbackPlacements = t6, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), [tooltipMaxWidth, setTooltipMaxWidth] = useState(0), t7;
2542
+ $[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], useImperativeHandle(forwardedRef, t7);
2543
+ let portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, t8;
2544
+ $[20] !== animate || $[21] !== arrowProp || $[22] !== boundaryElement || $[23] !== fallbackPlacements ? (t8 = {
2545
+ animate,
2546
+ arrowProp,
2547
+ arrowRef,
2548
+ boundaryElement,
2549
+ fallbackPlacements,
2550
+ rootBoundary: "viewport"
2551
+ }, $[20] = animate, $[21] = arrowProp, $[22] = boundaryElement, $[23] = fallbackPlacements, $[24] = t8) : t8 = $[24];
2552
+ let middleware = useMiddleware(t8), t9;
2553
+ $[25] === referenceElement ? t9 = $[26] : (t9 = { reference: referenceElement }, $[25] = referenceElement, $[26] = t9);
2554
+ let t10;
2555
+ $[27] !== middleware || $[28] !== placementProp || $[29] !== t9 ? (t10 = {
2556
+ middleware,
2557
+ placement: placementProp,
2558
+ whileElementsMounted: autoUpdate,
2559
+ elements: t9
2560
+ }, $[27] = middleware, $[28] = placementProp, $[29] = t9, $[30] = t10) : t10 = $[30];
2561
+ let { floatingStyles, placement, middlewareData, refs, update } = useFloating(t10), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), t11;
2562
+ $[31] === delayGroupContext ? t11 = $[32] : (t11 = delayGroupContext || {}, $[31] = delayGroupContext, $[32] = t11);
2563
+ let { setIsGroupActive, setOpenTooltipId } = t11, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, t12;
2564
+ $[33] !== closeDelay || $[34] !== isInsideGroup || $[35] !== openDelay || $[36] !== setIsGroupActive || $[37] !== setIsOpen || $[38] !== setOpenTooltipId || $[39] !== tooltipId ? (t12 = (open, immediate) => {
2565
+ if (isInsideGroup) if (open) {
2566
+ let groupedOpenDelay = immediate ? 0 : openDelay;
2567
+ setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
2568
+ } else setIsGroupActive?.(open, closeDelay > 200 ? closeDelay : 200), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
2569
+ else setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
2570
+ }, $[33] = closeDelay, $[34] = isInsideGroup, $[35] = openDelay, $[36] = setIsGroupActive, $[37] = setIsOpen, $[38] = setOpenTooltipId, $[39] = tooltipId, $[40] = t12) : t12 = $[40];
2571
+ let handleIsOpenChange = t12, t13;
2572
+ $[41] !== childProp?.props || $[42] !== handleIsOpenChange ? (t13 = (e) => {
2573
+ handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
2574
+ }, $[41] = childProp?.props, $[42] = handleIsOpenChange, $[43] = t13) : t13 = $[43], childProp?.props;
2575
+ let handleBlur = t13, t14;
2576
+ $[44] !== childProp?.props || $[45] !== handleIsOpenChange ? (t14 = (e_0) => {
2577
+ handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
2578
+ }, $[44] = childProp?.props, $[45] = handleIsOpenChange, $[46] = t14) : t14 = $[46], childProp?.props;
2579
+ let handleClick = t14, t15;
2580
+ $[47] !== childProp?.props || $[48] !== handleIsOpenChange ? (t15 = (e_1) => {
2581
+ handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
2582
+ }, $[47] = childProp?.props, $[48] = handleIsOpenChange, $[49] = t15) : t15 = $[49], childProp?.props;
2583
+ let handleContextMenu = t15, t16;
2584
+ $[50] !== childProp?.props || $[51] !== handleIsOpenChange ? (t16 = (e_2) => {
2585
+ handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
2586
+ }, $[50] = childProp?.props, $[51] = handleIsOpenChange, $[52] = t16) : t16 = $[52], childProp?.props;
2587
+ let handleFocus = t16, t17;
2588
+ $[53] !== childProp?.props || $[54] !== handleIsOpenChange ? (t17 = (e_3) => {
2589
+ handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
2590
+ }, $[53] = childProp?.props, $[54] = handleIsOpenChange, $[55] = t17) : t17 = $[55], childProp?.props;
2591
+ let handleMouseEnter = t17, t18;
2592
+ $[56] !== childProp?.props || $[57] !== handleIsOpenChange ? (t18 = (e_4) => {
2593
+ handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
2594
+ }, $[56] = childProp?.props, $[57] = handleIsOpenChange, $[58] = t18) : t18 = $[58], childProp?.props;
2595
+ let handleMouseLeave = t18, t19;
2596
+ $[59] !== handleIsOpenChange || $[60] !== isInsideGroup || $[61] !== referenceElement || $[62] !== showTooltip ? (t19 = {
2597
+ handleIsOpenChange,
2598
+ referenceElement,
2599
+ showTooltip,
2600
+ isInsideGroup
2601
+ }, $[59] = handleIsOpenChange, $[60] = isInsideGroup, $[61] = referenceElement, $[62] = showTooltip, $[63] = t19) : t19 = $[63], useCloseOnMouseLeave(t19);
2602
+ let t20, t21;
2603
+ $[64] !== disabled || $[65] !== handleIsOpenChange || $[66] !== showTooltip ? (t20 = () => {
2604
+ disabled && showTooltip && handleIsOpenChange(!1);
2605
+ }, t21 = [
2606
+ disabled,
2607
+ handleIsOpenChange,
2608
+ showTooltip
2609
+ ], $[64] = disabled, $[65] = handleIsOpenChange, $[66] = showTooltip, $[67] = t20, $[68] = t21) : (t20 = $[67], t21 = $[68]), useEffect(t20, t21);
2610
+ let t22, t23;
2611
+ $[69] !== content || $[70] !== handleIsOpenChange || $[71] !== showTooltip ? (t22 = () => {
2612
+ !content && showTooltip && handleIsOpenChange(!1);
2613
+ }, t23 = [
2614
+ content,
2615
+ handleIsOpenChange,
2616
+ showTooltip
2617
+ ], $[69] = content, $[70] = handleIsOpenChange, $[71] = showTooltip, $[72] = t22, $[73] = t23) : (t22 = $[72], t23 = $[73]), useEffect(t22, t23);
2618
+ let t24, t25;
2619
+ $[74] !== handleIsOpenChange || $[75] !== showTooltip ? (t24 = () => {
2620
+ if (!showTooltip) return;
2621
+ let handleWindowKeyDown = function(event) {
2622
+ event.key === "Escape" && handleIsOpenChange(!1, !0);
2623
+ };
2624
+ return window.addEventListener("keydown", handleWindowKeyDown), () => {
2625
+ window.removeEventListener("keydown", handleWindowKeyDown);
2626
+ };
2627
+ }, t25 = [handleIsOpenChange, showTooltip], $[74] = handleIsOpenChange, $[75] = showTooltip, $[76] = t24, $[77] = t25) : (t24 = $[76], t25 = $[77]), useEffect(t24, t25);
2628
+ let t26;
2629
+ $[78] !== boundaryElement || $[79] !== portalElement?.offsetWidth ? (t26 = () => {
2630
+ let availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
2631
+ setTooltipMaxWidth(Math.min(...availableWidths) - 8);
2632
+ }, $[78] = boundaryElement, $[79] = portalElement?.offsetWidth, $[80] = t26) : t26 = $[80];
2633
+ let t27;
2634
+ $[81] !== boundaryElement || $[82] !== portalElement ? (t27 = [boundaryElement, portalElement], $[81] = boundaryElement, $[82] = portalElement, $[83] = t27) : t27 = $[83], useLayoutEffect(t26, t27);
2635
+ let t28;
2636
+ $[84] === update ? t28 = $[85] : (t28 = (arrowEl) => {
2637
+ arrowRef.current = arrowEl, update();
2638
+ }, $[84] = update, $[85] = t28);
2639
+ let setArrow = t28, t29;
2640
+ $[86] === refs ? t29 = $[87] : (t29 = (node) => {
2641
+ ref.current = node, refs.setFloating(node);
2642
+ }, $[86] = refs, $[87] = t29);
2643
+ let setFloating = t29, t30;
2644
+ bb0: {
2645
+ if (!childProp) {
2646
+ t30 = null;
2647
+ break bb0;
2648
+ }
2649
+ let t31;
2650
+ $[88] !== childProp || $[89] !== handleBlur || $[90] !== handleClick || $[91] !== handleContextMenu || $[92] !== handleFocus || $[93] !== handleMouseEnter || $[94] !== handleMouseLeave ? (t31 = cloneElement(childProp, {
2651
+ onBlur: handleBlur,
2652
+ onFocus: handleFocus,
2653
+ onMouseEnter: handleMouseEnter,
2654
+ onMouseLeave: handleMouseLeave,
2655
+ onClick: handleClick,
2656
+ onContextMenu: handleContextMenu,
2657
+ ref: setReferenceElement
2658
+ }), $[88] = childProp, $[89] = handleBlur, $[90] = handleClick, $[91] = handleContextMenu, $[92] = handleFocus, $[93] = handleMouseEnter, $[94] = handleMouseLeave, $[95] = t31) : t31 = $[95], t30 = t31;
2659
+ }
2660
+ let child = t30, t31;
2661
+ $[96] === childProp ? t31 = $[97] : (t31 = childProp ? getElementRef(childProp) : null, $[96] = childProp, $[97] = t31);
2662
+ let t32, t33;
2663
+ if ($[98] === referenceElement ? (t32 = $[99], t33 = $[100]) : (t32 = () => referenceElement, t33 = [referenceElement], $[98] = referenceElement, $[99] = t32, $[100] = t33), useImperativeHandle(t31, t32, t33), !child) {
2664
+ let t34;
2665
+ return $[101] === Symbol.for("react.memo_cache_sentinel") ? (t34 = /* @__PURE__ */ jsx(Fragment$1, {}), $[101] = t34) : t34 = $[101], t34;
2666
+ }
2667
+ if (disabled) return child;
2668
+ let t34 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0, t35;
2669
+ $[102] !== floatingStyles || $[103] !== t34 ? (t35 = {
2670
+ ...floatingStyles,
2671
+ maxWidth: t34
2672
+ }, $[102] = floatingStyles, $[103] = t34, $[104] = t35) : t35 = $[104];
2673
+ let t36;
2674
+ $[105] !== animate || $[106] !== arrowProp || $[107] !== arrowX || $[108] !== arrowY || $[109] !== content || $[110] !== originX || $[111] !== originY || $[112] !== padding || $[113] !== placement || $[114] !== radius || $[115] !== restProps || $[116] !== scheme || $[117] !== setArrow || $[118] !== setFloating || $[119] !== shadow ? (t36 = /* @__PURE__ */ jsx(TooltipCard, {
2675
+ ...restProps,
2676
+ animate,
2677
+ arrow: arrowProp,
2678
+ arrowRef: setArrow,
2679
+ arrowX,
2680
+ arrowY,
2681
+ originX,
2682
+ originY,
2683
+ padding,
2684
+ placement,
2685
+ radius,
2686
+ ref: setFloating,
2687
+ scheme,
2688
+ shadow,
2689
+ children: content
2690
+ }), $[105] = animate, $[106] = arrowProp, $[107] = arrowX, $[108] = arrowY, $[109] = content, $[110] = originX, $[111] = originY, $[112] = padding, $[113] = placement, $[114] = radius, $[115] = restProps, $[116] = scheme, $[117] = setArrow, $[118] = setFloating, $[119] = shadow, $[120] = t36) : t36 = $[120];
2691
+ let t37;
2692
+ $[121] !== restProps || $[122] !== setFloating || $[123] !== t35 || $[124] !== t36 || $[125] !== zOffset ? (t37 = /* @__PURE__ */ jsx(StyledTooltip, {
2693
+ "data-ui": "Tooltip",
2694
+ ...restProps,
2695
+ ref: setFloating,
2696
+ style: t35,
2697
+ zOffset,
2698
+ children: t36
2699
+ }), $[121] = restProps, $[122] = setFloating, $[123] = t35, $[124] = t36, $[125] = zOffset, $[126] = t37) : t37 = $[126];
2700
+ let tooltip = t37, t38;
2701
+ $[127] !== portalProp || $[128] !== showTooltip || $[129] !== tooltip ? (t38 = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, {
2702
+ __unstable_name: typeof portalProp == "string" ? portalProp : void 0,
2703
+ children: tooltip
2704
+ }) : tooltip), $[127] = portalProp, $[128] = showTooltip, $[129] = tooltip, $[130] = t38) : t38 = $[130];
2705
+ let children = t38, t39;
2706
+ $[131] !== animate || $[132] !== children ? (t39 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[131] = animate, $[132] = children, $[133] = t39) : t39 = $[133];
2707
+ let t40;
2708
+ return $[134] !== child || $[135] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[134] = child, $[135] = t39, $[136] = t40) : t40 = $[136], t40;
2709
+ });
2710
+ Tooltip.displayName = "ForwardRef(Tooltip)";
2711
+ function useMiddleware(t0) {
2712
+ let $ = c(17), { animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary } = t0, ret;
2713
+ if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryElement || $[4] !== fallbackPlacements || $[5] !== rootBoundary) {
2714
+ ret = [];
2715
+ let t1 = boundaryElement || void 0, t2;
2716
+ $[7] !== fallbackPlacements || $[8] !== rootBoundary || $[9] !== t1 ? (t2 = flip({
2717
+ boundary: t1,
2718
+ fallbackPlacements,
2719
+ padding: 4,
2720
+ rootBoundary
2721
+ }), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
2722
+ let t3;
2723
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = offset({ mainAxis: 4 }), $[11] = t3) : t3 = $[11], ret.push(t3);
2724
+ let t4 = boundaryElement || void 0, t5;
2725
+ if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
2726
+ boundary: t4,
2727
+ rootBoundary,
2728
+ padding: 4
2729
+ }), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
2730
+ let t6;
2731
+ $[15] === arrowRef ? t6 = $[16] : (t6 = arrow({
2732
+ element: arrowRef,
2733
+ padding: 4
2734
+ }), $[15] = arrowRef, $[16] = t6), ret.push(t6);
2735
+ }
2736
+ animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryElement, $[4] = fallbackPlacements, $[5] = rootBoundary, $[6] = ret;
2737
+ } else ret = $[6];
2738
+ return ret;
2739
+ }
2740
+ /**
2741
+ * As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.
2742
+ * @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks
2743
+ */
2744
+ function useCloseOnMouseLeave(t0) {
2745
+ let $ = c(10), { handleIsOpenChange, referenceElement, showTooltip, isInsideGroup } = t0, t1;
2746
+ $[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
2747
+ referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
2748
+ }, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
2749
+ let onMouseMove = useEffectEvent(t1), t2;
2750
+ $[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
2751
+ if (!showTooltip || isInsideGroup) return;
2752
+ let handleMouseMove = (event) => {
2753
+ onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
2754
+ };
2755
+ return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
2756
+ }, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
2757
+ let t3;
2758
+ $[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
2759
+ }
2760
+ const StyledHotkeys = styled.kbd.withConfig({
2761
+ displayName: "StyledHotkeys",
2762
+ componentId: "sc-j9kh17-0"
2763
+ })`font:inherit;padding:1px;&:not([hidden]){display:block;}`, Key = styled(KBD).withConfig({
2764
+ displayName: "Key",
2765
+ componentId: "sc-j9kh17-1"
2766
+ })`&:not([hidden]){display:block;}`, Hotkeys = forwardRef(function(props, ref) {
2767
+ let $ = c(27), fontSize, gap, keys, padding, radius, restProps, t0;
2768
+ $[0] === props ? (fontSize = $[1], gap = $[2], keys = $[3], padding = $[4], radius = $[5], restProps = $[6], t0 = $[7]) : ({fontSize, gap, keys, padding, radius, space: t0, ...restProps} = props, $[0] = props, $[1] = fontSize, $[2] = gap, $[3] = keys, $[4] = padding, $[5] = radius, $[6] = restProps, $[7] = t0);
2769
+ let t1 = gap === void 0 ? t0 === void 0 ? .5 : t0 : gap, t2;
2770
+ $[8] === t1 ? t2 = $[9] : (t2 = _getArrayProp(t1), $[8] = t1, $[9] = t2);
2771
+ let spacing = t2;
2772
+ if (!keys || keys.length === 0) {
2773
+ let t3;
2774
+ return $[10] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(Fragment$1, {}), $[10] = t3) : t3 = $[10], t3;
2775
+ }
2776
+ let t3;
2777
+ if ($[11] !== fontSize || $[12] !== keys || $[13] !== padding || $[14] !== radius) {
2778
+ let t4;
2779
+ $[16] !== fontSize || $[17] !== padding || $[18] !== radius ? (t4 = (key, i) => /* @__PURE__ */ jsx(Key, {
2780
+ fontSize,
2781
+ padding,
2782
+ radius,
2783
+ children: key
2784
+ }, i), $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t4) : t4 = $[19], t3 = keys.map(t4), $[11] = fontSize, $[12] = keys, $[13] = padding, $[14] = radius, $[15] = t3;
2785
+ } else t3 = $[15];
2786
+ let t4;
2787
+ $[20] !== spacing || $[21] !== t3 ? (t4 = /* @__PURE__ */ jsx(Inline, {
2788
+ as: "span",
2789
+ gap: spacing,
2790
+ children: t3
2791
+ }), $[20] = spacing, $[21] = t3, $[22] = t4) : t4 = $[22];
2792
+ let t5;
2793
+ return $[23] !== ref || $[24] !== restProps || $[25] !== t4 ? (t5 = /* @__PURE__ */ jsx(StyledHotkeys, {
2794
+ "data-ui": "Hotkeys",
2795
+ ...restProps,
2796
+ ref,
2797
+ children: t4
2798
+ }), $[23] = ref, $[24] = restProps, $[25] = t4, $[26] = t5) : t5 = $[26], t5;
2799
+ });
2800
+ Hotkeys.displayName = "ForwardRef(Hotkeys)";
2801
+ const MenuContext = createGlobalScopedContext("@sanity/ui/context/menu", null);
2802
+ /**
2803
+ * @internal
2804
+ */
2805
+ function _isFocusable(element) {
2806
+ return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
2807
+ }
2808
+ /**
2809
+ * @internal
2810
+ */
2811
+ function _getFocusableElements(elements) {
2812
+ return elements.filter(_isFocusable);
2813
+ }
2814
+ /**
2815
+ * @internal
2816
+ */
2817
+ function _getDOMPath(rootElement, el) {
2818
+ let path = [], e = el;
2819
+ for (; e !== rootElement;) {
2820
+ let parentElement = e.parentElement;
2821
+ if (!parentElement) return path;
2822
+ let index = Array.from(parentElement.childNodes).indexOf(e);
2823
+ if (path.unshift(index), parentElement === rootElement) return path;
2824
+ e = parentElement;
2825
+ }
2826
+ return path;
2827
+ }
2828
+ const EMPTY_PATH = [];
2829
+ /**
2830
+ * @internal
2831
+ */
2832
+ function _sortElements(rootElement, elements) {
2833
+ if (!rootElement) return;
2834
+ let map = /* @__PURE__ */ new WeakMap();
2835
+ for (let el of elements) map.set(el, _getDOMPath(rootElement, el));
2836
+ elements.sort((a, b) => {
2837
+ let _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
2838
+ for (let i = 0; i < len; i += 1) {
2839
+ let aIndex = _a[i] || -1, bIndex = _b[i] || -1;
2840
+ if (aIndex !== bIndex) return aIndex - bIndex;
2841
+ }
2842
+ return 0;
2843
+ });
2844
+ }
2845
+ /**
2846
+ * This controller is responsible for controlling UI menu state.
2847
+ *
2848
+ * @internal
2849
+ */
2850
+ function useMenuController(props) {
2851
+ let { onKeyDown, originElement, shouldFocus, rootElementRef } = props, elementsRef = useRef([]), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), [activeElement, setActiveElement] = useState(null), setActiveIndex = useCallback((nextActiveIndex) => {
2852
+ _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex, setActiveElement(elementsRef.current[nextActiveIndex] || null);
2853
+ }, []), mount = useCallback((element, selected) => {
2854
+ if (!element) return () => void 0;
2855
+ if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
2856
+ let selectedIndex = elementsRef.current.indexOf(element);
2857
+ setActiveIndex(selectedIndex);
2858
+ }
2859
+ return () => {
2860
+ let idx = elementsRef.current.indexOf(element);
2861
+ idx > -1 && elementsRef.current.splice(idx, 1);
2862
+ };
2863
+ }, [rootElementRef, setActiveIndex]), handleKeyDown = useCallback((event) => {
2864
+ if (event.key === "Tab") {
2865
+ originElement && originElement.focus();
2866
+ return;
2867
+ }
2868
+ if (event.key === "Home") {
2869
+ event.preventDefault(), event.stopPropagation();
2870
+ let el = _getFocusableElements(elementsRef.current)[0];
2871
+ if (!el) return;
2872
+ let currentIndex = elementsRef.current.indexOf(el);
2873
+ setActiveIndex(currentIndex);
2874
+ return;
2875
+ }
2876
+ if (event.key === "End") {
2877
+ event.preventDefault(), event.stopPropagation();
2878
+ let focusableElements = _getFocusableElements(elementsRef.current), el = focusableElements[focusableElements.length - 1];
2879
+ if (!el) return;
2880
+ let currentIndex = elementsRef.current.indexOf(el);
2881
+ setActiveIndex(currentIndex);
2882
+ return;
2883
+ }
2884
+ if (event.key === "ArrowUp") {
2885
+ event.preventDefault(), event.stopPropagation();
2886
+ let focusableElements = _getFocusableElements(elementsRef.current), focusableLen = focusableElements.length;
2887
+ if (focusableLen === 0) return;
2888
+ let focusedElement = elementsRef.current[activeIndexRef.current], focusedIndex = focusableElements.indexOf(focusedElement);
2889
+ focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
2890
+ let el = focusableElements[focusedIndex], currentIndex = elementsRef.current.indexOf(el);
2891
+ setActiveIndex(currentIndex);
2892
+ return;
2893
+ }
2894
+ if (event.key === "ArrowDown") {
2895
+ event.preventDefault(), event.stopPropagation();
2896
+ let focusableElements = _getFocusableElements(elementsRef.current), focusableLen = focusableElements.length;
2897
+ if (focusableLen === 0) return;
2898
+ let focusedElement = elementsRef.current[activeIndexRef.current], focusedIndex = focusableElements.indexOf(focusedElement);
2899
+ focusedIndex = (focusedIndex + 1) % focusableLen;
2900
+ let el = focusableElements[focusedIndex], currentIndex = elementsRef.current.indexOf(el);
2901
+ setActiveIndex(currentIndex);
2902
+ return;
2903
+ }
2904
+ onKeyDown && onKeyDown(event);
2905
+ }, [
2906
+ onKeyDown,
2907
+ originElement,
2908
+ setActiveIndex
2909
+ ]), handleItemMouseEnter = useCallback((event) => {
2910
+ let element = event.currentTarget, currentIndex = elementsRef.current.indexOf(element);
2911
+ setActiveIndex(currentIndex);
2912
+ }, [setActiveIndex]), handleItemMouseLeave = useCallback(() => {
2913
+ setActiveIndex(-2), rootElementRef.current?.focus();
2914
+ }, [rootElementRef, setActiveIndex]);
2915
+ return useEffect(() => {
2916
+ if (!rootElementRef.current) return;
2917
+ let rafId = requestAnimationFrame(() => {
2918
+ if (activeIndex === -1) {
2919
+ if (shouldFocus === "first") {
2920
+ let el = _getFocusableElements(elementsRef.current)[0];
2921
+ if (el) {
2922
+ let currentIndex = elementsRef.current.indexOf(el);
2923
+ setActiveIndex(currentIndex);
2924
+ }
2925
+ }
2926
+ if (shouldFocus === "last") {
2927
+ let focusableElements = _getFocusableElements(elementsRef.current), el = focusableElements[focusableElements.length - 1];
2928
+ if (el) {
2929
+ let currentIndex = elementsRef.current.indexOf(el);
2930
+ setActiveIndex(currentIndex);
2931
+ }
2932
+ }
2933
+ return;
2934
+ }
2935
+ (elementsRef.current[activeIndex] || null)?.focus();
2936
+ });
2937
+ return () => cancelAnimationFrame(rafId);
2938
+ }, [
2939
+ activeIndex,
2940
+ rootElementRef,
2941
+ setActiveIndex,
2942
+ shouldFocus
2943
+ ]), {
2944
+ activeElement,
2945
+ activeIndex,
2946
+ handleItemMouseEnter,
2947
+ handleItemMouseLeave,
2948
+ handleKeyDown,
2949
+ mount
2950
+ };
2951
+ }
2952
+ const StyledMenu = styled(Box).withConfig({
2953
+ displayName: "StyledMenu",
2954
+ componentId: "sc-hkwd9h-0"
2955
+ })`outline:none;overflow:auto;`, Menu = forwardRef(function(props, forwardedRef) {
2956
+ let $ = c(50), _shouldFocus, children, gap, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, restProps, t0, t1;
2957
+ if ($[0] !== props) {
2958
+ let { children: t2, focusFirst, focusLast, onClickOutside: t3, onEscape: t4, onItemClick: t5, onItemSelect: t6, onKeyDown: t7, originElement: t8, padding: t9, registerElement: t10, shouldFocus: t11, gap: t12, space: t13, ...t14 } = props;
2959
+ children = t2, onClickOutside = t3, onEscape = t4, onItemClick = t5, onItemSelect = t6, onKeyDown = t7, originElement = t8, t0 = t9, registerElement = t10, _shouldFocus = t11, gap = t12, t1 = t13, restProps = t14, $[0] = props, $[1] = _shouldFocus, $[2] = children, $[3] = gap, $[4] = onClickOutside, $[5] = onEscape, $[6] = onItemClick, $[7] = onItemSelect, $[8] = onKeyDown, $[9] = originElement, $[10] = registerElement, $[11] = restProps, $[12] = t0, $[13] = t1;
2960
+ } else _shouldFocus = $[1], children = $[2], gap = $[3], onClickOutside = $[4], onEscape = $[5], onItemClick = $[6], onItemSelect = $[7], onKeyDown = $[8], originElement = $[9], registerElement = $[10], restProps = $[11], t0 = $[12], t1 = $[13];
2961
+ let padding = t0 === void 0 ? 1 : t0, spacing = gap === void 0 ? t1 === void 0 ? 1 : t1 : gap, shouldFocus = _shouldFocus ?? (props.focusFirst && "first" || props.focusLast && "last" || null), ref = useRef(null), t2;
2962
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[14] = t2) : t2 = $[14], useImperativeHandle(forwardedRef, t2);
2963
+ let { isTopLayer } = useLayer(), t3;
2964
+ $[15] !== onKeyDown || $[16] !== originElement || $[17] !== shouldFocus ? (t3 = {
2965
+ onKeyDown,
2966
+ originElement,
2967
+ shouldFocus,
2968
+ rootElementRef: ref
2969
+ }, $[15] = onKeyDown, $[16] = originElement, $[17] = shouldFocus, $[18] = t3) : t3 = $[18];
2970
+ let { activeElement, activeIndex, handleItemMouseEnter, handleItemMouseLeave, handleKeyDown, mount } = useMenuController(t3), unregisterElementRef = useRef(null), t4;
2971
+ $[19] === registerElement ? t4 = $[20] : (t4 = (el) => {
2972
+ unregisterElementRef.current &&= (unregisterElementRef.current(), null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
2973
+ }, $[19] = registerElement, $[20] = t4);
2974
+ let handleRefChange = t4, t5, t6;
2975
+ $[21] !== activeIndex || $[22] !== onItemSelect ? (t5 = () => {
2976
+ onItemSelect && onItemSelect(activeIndex);
2977
+ }, t6 = [activeIndex, onItemSelect], $[21] = activeIndex, $[22] = onItemSelect, $[23] = t5, $[24] = t6) : (t5 = $[23], t6 = $[24]), useEffect(t5, t6);
2978
+ let t7;
2979
+ $[25] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [ref.current], $[25] = t7) : t7 = $[25], useClickOutsideEvent(isTopLayer && onClickOutside, t7);
2980
+ let t8;
2981
+ $[26] !== isTopLayer || $[27] !== onEscape ? (t8 = (event) => {
2982
+ isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
2983
+ }, $[26] = isTopLayer, $[27] = onEscape, $[28] = t8) : t8 = $[28], useGlobalKeyDown(t8);
2984
+ let t9;
2985
+ $[29] !== activeElement || $[30] !== handleItemMouseEnter || $[31] !== handleItemMouseLeave || $[32] !== mount || $[33] !== onClickOutside || $[34] !== onEscape || $[35] !== onItemClick || $[36] !== registerElement ? (t9 = {
2986
+ version: 2,
2987
+ activeElement,
2988
+ mount,
2989
+ onClickOutside,
2990
+ onEscape,
2991
+ onItemClick,
2992
+ onItemMouseEnter: handleItemMouseEnter,
2993
+ onItemMouseLeave: handleItemMouseLeave,
2994
+ registerElement
2995
+ }, $[29] = activeElement, $[30] = handleItemMouseEnter, $[31] = handleItemMouseLeave, $[32] = mount, $[33] = onClickOutside, $[34] = onEscape, $[35] = onItemClick, $[36] = registerElement, $[37] = t9) : t9 = $[37];
2996
+ let value = t9, t10;
2997
+ $[38] !== children || $[39] !== spacing ? (t10 = /* @__PURE__ */ jsx(Stack, {
2998
+ gap: spacing,
2999
+ children
3000
+ }), $[38] = children, $[39] = spacing, $[40] = t10) : t10 = $[40];
3001
+ let t11;
3002
+ $[41] !== handleKeyDown || $[42] !== handleRefChange || $[43] !== padding || $[44] !== restProps || $[45] !== t10 ? (t11 = /* @__PURE__ */ jsx(StyledMenu, {
3003
+ "data-ui": "Menu",
3004
+ ...restProps,
3005
+ onKeyDown: handleKeyDown,
3006
+ padding,
3007
+ ref: handleRefChange,
3008
+ role: "menu",
3009
+ tabIndex: -1,
3010
+ children: t10
3011
+ }), $[41] = handleKeyDown, $[42] = handleRefChange, $[43] = padding, $[44] = restProps, $[45] = t10, $[46] = t11) : t11 = $[46];
3012
+ let t12;
3013
+ return $[47] !== t11 || $[48] !== value ? (t12 = /* @__PURE__ */ jsx(MenuContext.Provider, {
3014
+ value,
3015
+ children: t11
3016
+ }), $[47] = t11, $[48] = value, $[49] = t12) : t12 = $[49], t12;
3017
+ });
3018
+ Menu.displayName = "ForwardRef(Menu)";
3019
+ const StyledMenuDivider = styled.hr.withConfig({
3020
+ displayName: "StyledMenuDivider",
3021
+ componentId: "sc-bemnwm-0"
3022
+ })`height:1px;border:0;background:var(--card-hairline-soft-color);margin:0;`;
3023
+ StyledMenuDivider.displayName = "MenuDivider";
3024
+ /**
3025
+ * @public
3026
+ */
3027
+ const MenuDivider = StyledMenuDivider;
3028
+ function selectableBaseStyle() {
3029
+ return css`background-color:inherit;color:inherit;&[data-as='button']{-webkit-font-smoothing:inherit;appearance:none;outline:none;font:inherit;text-align:inherit;border:0;width:-moz-available;width:-webkit-fill-available;width:stretch;}&[data-as='a']{text-decoration:none;}`;
3030
+ }
3031
+ function selectableColorStyle(props) {
3032
+ let { $tone } = props, { color, style } = getTheme_v2(props.theme), tone = color.selectable[$tone];
3033
+ return css`${_cardColorStyle(color, tone.enabled)} background-color:var(--card-bg-color);color:var(--card-fg-color);outline:none;&[data-as='button']{&:disabled{${_cardColorStyle(color, tone.disabled)}}&:not(:disabled){&[aria-pressed='true']{${_cardColorStyle(color, tone.pressed)}}&[data-selected],&[aria-selected='true'] > &{${_cardColorStyle(color, tone.selected)}}@media (hover:hover){&:not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, tone.hovered)}}&:active{${_cardColorStyle(color, tone.pressed)}}}}}}&[data-as='a']{&[data-disabled]{${_cardColorStyle(color, tone.disabled)}}&:not([data-disabled]){&[data-pressed]{${_cardColorStyle(color, tone.pressed)}}&[data-selected]{${_cardColorStyle(color, tone.selected)}}@media (hover:hover){&:not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, tone.hovered)}}&:active{${_cardColorStyle(color, tone.pressed)}}}}}}${style?.card?.root}`;
3034
+ }
3035
+ /**
3036
+ * @internal
3037
+ */
3038
+ const Selectable = /* @__PURE__ */ styled(Box).withConfig({
3039
+ displayName: "Selectable",
3040
+ componentId: "sc-q5xa1z-0"
3041
+ })(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
3042
+ Selectable.displayName = "Selectable";
3043
+ function useMenu() {
3044
+ let value = useContext(MenuContext);
3045
+ if (!value) throw Error("useMenu(): missing context value");
3046
+ if (!isRecord(value) || value.version !== 2) throw Error("useMenu(): the context value is not compatible");
3047
+ return value;
3048
+ }
3049
+ function MenuGroupComponent(props) {
3050
+ let $ = c(82), IconComponent, children, gap, menuProps, onClick, popover, restProps, t0, t1, t2, t3, t4, t5, text;
3051
+ $[0] === props ? (IconComponent = $[1], children = $[2], gap = $[3], menuProps = $[4], onClick = $[5], popover = $[6], restProps = $[7], t0 = $[8], t1 = $[9], t2 = $[10], t3 = $[11], t4 = $[12], t5 = $[13], text = $[14]) : ({as: t0, children, fontSize: t1, icon: IconComponent, menu: menuProps, onClick, padding: t2, popover, radius: t3, gap, space: t4, text, tone: t5, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = gap, $[4] = menuProps, $[5] = onClick, $[6] = popover, $[7] = restProps, $[8] = t0, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = t4, $[13] = t5, $[14] = text);
3052
+ let as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, deprecated_space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, spacing = gap === void 0 ? deprecated_space : gap, menu = useMenu(), { scheme } = useRootTheme(), { activeElement, mount, onClickOutside, onEscape, onItemClick, onItemMouseEnter: _onItemMouseEnter, registerElement } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1), t6;
3053
+ $[15] === onItemMouseEnter ? t6 = $[16] : (t6 = (event) => {
3054
+ setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
3055
+ }, $[15] = onItemMouseEnter, $[16] = t6);
3056
+ let handleMouseEnter = t6, t7;
3057
+ $[17] === rootElement ? t7 = $[18] : (t7 = (event_0) => {
3058
+ event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
3059
+ rootElement?.focus();
3060
+ }));
3061
+ }, $[17] = rootElement, $[18] = t7);
3062
+ let handleMenuKeyDown = t7, t8;
3063
+ $[19] === onClick ? t8 = $[20] : (t8 = (event_1) => {
3064
+ onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
3065
+ }, $[19] = onClick, $[20] = t8);
3066
+ let handleClick = t8, t9;
3067
+ $[21] === onItemClick ? t9 = $[22] : (t9 = () => {
3068
+ setOpen(!1), onItemClick?.();
3069
+ }, $[21] = onItemClick, $[22] = t9);
3070
+ let handleChildItemClick = t9, t10;
3071
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[23] = t10) : t10 = $[23];
3072
+ let handleMenuMouseEnter = t10, t11, t12;
3073
+ $[24] !== mount || $[25] !== rootElement ? (t11 = () => mount(rootElement), t12 = [mount, rootElement], $[24] = mount, $[25] = rootElement, $[26] = t11, $[27] = t12) : (t11 = $[26], t12 = $[27]), useEffect(t11, t12);
3074
+ let t13, t14;
3075
+ $[28] === active ? (t13 = $[29], t14 = $[30]) : (t13 = () => {
3076
+ active || setOpen(!1);
3077
+ }, t14 = [active], $[28] = active, $[29] = t13, $[30] = t14), useEffect(t13, t14);
3078
+ let t15, t16;
3079
+ $[31] === open ? (t15 = $[32], t16 = $[33]) : (t15 = () => {
3080
+ open || setWithinMenu(!1);
3081
+ }, t16 = [open], $[31] = open, $[32] = t15, $[33] = t16), useEffect(t15, t16);
3082
+ let t17, t18;
3083
+ $[34] === shouldFocus ? (t17 = $[35], t18 = $[36]) : (t17 = () => {
3084
+ if (!shouldFocus) return;
3085
+ let rafId = requestAnimationFrame(() => setShouldFocus(null));
3086
+ return () => cancelAnimationFrame(rafId);
3087
+ }, t18 = [shouldFocus], $[34] = shouldFocus, $[35] = t17, $[36] = t18), useEffect(t17, t18);
3088
+ let t19;
3089
+ $[37] !== children || $[38] !== handleChildItemClick || $[39] !== handleMenuKeyDown || $[40] !== menuProps || $[41] !== onClickOutside || $[42] !== onEscape || $[43] !== registerElement || $[44] !== shouldFocus ? (t19 = /* @__PURE__ */ jsx(Menu, {
3090
+ ...menuProps,
3091
+ onClickOutside,
3092
+ onEscape,
3093
+ onItemClick: handleChildItemClick,
3094
+ onKeyDown: handleMenuKeyDown,
3095
+ onMouseEnter: handleMenuMouseEnter,
3096
+ registerElement,
3097
+ shouldFocus,
3098
+ children
3099
+ }), $[37] = children, $[38] = handleChildItemClick, $[39] = handleMenuKeyDown, $[40] = menuProps, $[41] = onClickOutside, $[42] = onEscape, $[43] = registerElement, $[44] = shouldFocus, $[45] = t19) : t19 = $[45];
3100
+ let childMenu = t19, t20;
3101
+ $[46] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
3102
+ let target = event_2.currentTarget;
3103
+ if (document.activeElement === target && event_2.key === "ArrowRight") {
3104
+ setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
3105
+ return;
3106
+ }
3107
+ }, $[46] = t20) : t20 = $[46];
3108
+ let handleKeyDown = t20, t21 = as === "button" ? withinMenu : void 0, t22 = as === "button" ? void 0 : withinMenu, t23 = !withinMenu && active ? "" : void 0, t24;
3109
+ $[47] === radius ? t24 = $[48] : (t24 = _getArrayProp(radius), $[47] = radius, $[48] = t24);
3110
+ let t25 = as === "button" ? "button" : void 0, t26;
3111
+ $[49] !== IconComponent || $[50] !== fontSize ? (t26 = IconComponent && /* @__PURE__ */ jsxs(Text, {
3112
+ size: fontSize,
3113
+ children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
3114
+ }), $[49] = IconComponent, $[50] = fontSize, $[51] = t26) : t26 = $[51];
3115
+ let t27;
3116
+ $[52] !== fontSize || $[53] !== text ? (t27 = /* @__PURE__ */ jsx(Box, {
3117
+ flex: 1,
3118
+ children: /* @__PURE__ */ jsx(Text, {
3119
+ size: fontSize,
3120
+ textOverflow: "ellipsis",
3121
+ weight: "medium",
3122
+ children: text
3123
+ })
3124
+ }), $[52] = fontSize, $[53] = text, $[54] = t27) : t27 = $[54];
3125
+ let t28;
3126
+ $[55] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[55] = t28) : t28 = $[55];
3127
+ let t29;
3128
+ $[56] === fontSize ? t29 = $[57] : (t29 = /* @__PURE__ */ jsx(Text, {
3129
+ size: fontSize,
3130
+ children: t28
3131
+ }), $[56] = fontSize, $[57] = t29);
3132
+ let t30;
3133
+ $[58] !== padding || $[59] !== spacing || $[60] !== t26 || $[61] !== t27 || $[62] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Flex, {
3134
+ gap: spacing,
3135
+ padding,
3136
+ children: [
3137
+ t26,
3138
+ t27,
3139
+ t29
3140
+ ]
3141
+ }), $[58] = padding, $[59] = spacing, $[60] = t26, $[61] = t27, $[62] = t29, $[63] = t30) : t30 = $[63];
3142
+ let t31;
3143
+ $[64] !== as || $[65] !== handleClick || $[66] !== handleMouseEnter || $[67] !== restProps || $[68] !== scheme || $[69] !== t21 || $[70] !== t22 || $[71] !== t23 || $[72] !== t24 || $[73] !== t25 || $[74] !== t30 || $[75] !== tone ? (t31 = /* @__PURE__ */ jsx(Selectable, {
3144
+ "data-as": as,
3145
+ "data-ui": "MenuGroup",
3146
+ forwardedAs: as,
3147
+ ...restProps,
3148
+ "aria-pressed": t21,
3149
+ "data-pressed": t22,
3150
+ "data-selected": t23,
3151
+ $radius: t24,
3152
+ $tone: tone,
3153
+ $scheme: scheme,
3154
+ onClick: handleClick,
3155
+ onKeyDown: handleKeyDown,
3156
+ onMouseEnter: handleMouseEnter,
3157
+ ref: setRootElement,
3158
+ tabIndex: -1,
3159
+ type: t25,
3160
+ children: t30
3161
+ }), $[64] = as, $[65] = handleClick, $[66] = handleMouseEnter, $[67] = restProps, $[68] = scheme, $[69] = t21, $[70] = t22, $[71] = t23, $[72] = t24, $[73] = t25, $[74] = t30, $[75] = tone, $[76] = t31) : t31 = $[76];
3162
+ let t32;
3163
+ return $[77] !== childMenu || $[78] !== open || $[79] !== popover || $[80] !== t31 ? (t32 = /* @__PURE__ */ jsx(Popover, {
3164
+ ...popover,
3165
+ content: childMenu,
3166
+ "data-ui": "MenuGroup__popover",
3167
+ open,
3168
+ children: t31
3169
+ }), $[77] = childMenu, $[78] = open, $[79] = popover, $[80] = t31, $[81] = t32) : t32 = $[81], t32;
3170
+ }
3171
+ MenuGroupComponent.displayName = "MenuGroup";
3172
+ /**
3173
+ * @public
3174
+ */
3175
+ const MenuGroup = MenuGroupComponent, MenuItemComponent = forwardRef(function(props, forwardedRef) {
3176
+ let $ = c(76), IconComponent, IconRightComponent, children, disabled, gap, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, restProps, selectedProp, t0, t1, t2, t3, t4, t5, text;
3177
+ $[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], gap = $[5], hotkeys = $[6], onClick = $[7], paddingBottom = $[8], paddingLeft = $[9], paddingRight = $[10], paddingTop = $[11], paddingX = $[12], paddingY = $[13], pressed = $[14], restProps = $[15], selectedProp = $[16], t0 = $[17], t1 = $[18], t2 = $[19], t3 = $[20], t4 = $[21], t5 = $[22], text = $[23]) : ({as: t0, children, disabled, fontSize: t1, hotkeys, icon: IconComponent, iconRight: IconRightComponent, onClick, padding: t2, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, radius: t3, selected: selectedProp, gap, space: t4, text, tone: t5, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = gap, $[6] = hotkeys, $[7] = onClick, $[8] = paddingBottom, $[9] = paddingLeft, $[10] = paddingRight, $[11] = paddingTop, $[12] = paddingX, $[13] = paddingY, $[14] = pressed, $[15] = restProps, $[16] = selectedProp, $[17] = t0, $[18] = t1, $[19] = t2, $[20] = t3, $[21] = t4, $[22] = t5, $[23] = text);
3178
+ let as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, deprecated_space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, spacing = gap === void 0 ? deprecated_space : gap, { scheme } = useRootTheme(), menu = useMenu(), { activeElement, mount, onItemClick, onItemMouseEnter: _onItemMouseEnter, onItemMouseLeave: _onItemMouseLeave } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onItemMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null), t6;
3179
+ $[24] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[24] = t6) : t6 = $[24], useImperativeHandle(forwardedRef, t6);
3180
+ let t7, t8;
3181
+ $[25] !== mount || $[26] !== rootElement || $[27] !== selectedProp ? (t7 = () => mount(rootElement, selectedProp), t8 = [
3182
+ mount,
3183
+ rootElement,
3184
+ selectedProp
3185
+ ], $[25] = mount, $[26] = rootElement, $[27] = selectedProp, $[28] = t7, $[29] = t8) : (t7 = $[28], t8 = $[29]), useEffect(t7, t8);
3186
+ let t9;
3187
+ $[30] !== disabled || $[31] !== onClick || $[32] !== onItemClick ? (t9 = (event) => {
3188
+ disabled || (onClick && onClick(event), onItemClick && onItemClick());
3189
+ }, $[30] = disabled, $[31] = onClick, $[32] = onItemClick, $[33] = t9) : t9 = $[33];
3190
+ let handleClick = t9, t10;
3191
+ $[34] !== padding || $[35] !== paddingBottom || $[36] !== paddingLeft || $[37] !== paddingRight || $[38] !== paddingTop || $[39] !== paddingX || $[40] !== paddingY ? (t10 = {
3192
+ padding,
3193
+ paddingX,
3194
+ paddingY,
3195
+ paddingTop,
3196
+ paddingRight,
3197
+ paddingBottom,
3198
+ paddingLeft
3199
+ }, $[34] = padding, $[35] = paddingBottom, $[36] = paddingLeft, $[37] = paddingRight, $[38] = paddingTop, $[39] = paddingX, $[40] = paddingY, $[41] = t10) : t10 = $[41];
3200
+ let paddingProps = t10, t11;
3201
+ $[42] === fontSize ? t11 = $[43] : (t11 = _getArrayProp(fontSize).map(_temp), $[42] = fontSize, $[43] = t11);
3202
+ let hotkeysFontSize = t11, t12;
3203
+ $[44] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (el) => {
3204
+ ref.current = el, setRootElement(el);
3205
+ }, $[44] = t12) : t12 = $[44];
3206
+ let setRef = t12, t13 = as !== "button" && pressed ? "" : void 0, t14 = active ? "" : void 0, t15 = disabled ? "" : void 0, t16;
3207
+ $[45] === radius ? t16 = $[46] : (t16 = _getArrayProp(radius), $[45] = radius, $[46] = t16);
3208
+ let t17;
3209
+ $[47] === Symbol.for("react.memo_cache_sentinel") ? (t17 = _getArrayProp(0), $[47] = t17) : t17 = $[47];
3210
+ let t18 = disabled ? "default" : tone, t19 = as === "button" ? "button" : void 0, t20;
3211
+ $[48] !== IconComponent || $[49] !== IconRightComponent || $[50] !== fontSize || $[51] !== hotkeys || $[52] !== hotkeysFontSize || $[53] !== paddingProps || $[54] !== spacing || $[55] !== text ? (t20 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, {
3212
+ as: "span",
3213
+ gap: spacing,
3214
+ align: "center",
3215
+ ...paddingProps,
3216
+ children: [
3217
+ IconComponent && /* @__PURE__ */ jsxs(Text, {
3218
+ size: fontSize,
3219
+ children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
3220
+ }),
3221
+ text && /* @__PURE__ */ jsx(Box, {
3222
+ flex: 1,
3223
+ children: /* @__PURE__ */ jsx(Text, {
3224
+ size: fontSize,
3225
+ textOverflow: "ellipsis",
3226
+ weight: "medium",
3227
+ children: text
3228
+ })
3229
+ }),
3230
+ hotkeys && /* @__PURE__ */ jsx(Hotkeys, {
3231
+ fontSize: hotkeysFontSize,
3232
+ keys: hotkeys,
3233
+ style: {
3234
+ marginTop: -4,
3235
+ marginBottom: -4
3236
+ }
3237
+ }),
3238
+ IconRightComponent && /* @__PURE__ */ jsxs(Text, {
3239
+ size: fontSize,
3240
+ children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
3241
+ })
3242
+ ]
3243
+ }), $[48] = IconComponent, $[49] = IconRightComponent, $[50] = fontSize, $[51] = hotkeys, $[52] = hotkeysFontSize, $[53] = paddingProps, $[54] = spacing, $[55] = text, $[56] = t20) : t20 = $[56];
3244
+ let t21;
3245
+ $[57] !== children || $[58] !== paddingProps ? (t21 = children && /* @__PURE__ */ jsx(Box, {
3246
+ as: "span",
3247
+ ...paddingProps,
3248
+ children
3249
+ }), $[57] = children, $[58] = paddingProps, $[59] = t21) : t21 = $[59];
3250
+ let t22;
3251
+ return $[60] !== as || $[61] !== disabled || $[62] !== handleClick || $[63] !== onItemMouseEnter || $[64] !== onItemMouseLeave || $[65] !== restProps || $[66] !== scheme || $[67] !== t13 || $[68] !== t14 || $[69] !== t15 || $[70] !== t16 || $[71] !== t18 || $[72] !== t19 || $[73] !== t20 || $[74] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Selectable, {
3252
+ "data-ui": "MenuItem",
3253
+ role: "menuitem",
3254
+ ...restProps,
3255
+ "data-pressed": t13,
3256
+ "data-selected": t14,
3257
+ "data-disabled": t15,
3258
+ forwardedAs: as,
3259
+ $radius: t16,
3260
+ $padding: t17,
3261
+ $tone: t18,
3262
+ $scheme: scheme,
3263
+ disabled,
3264
+ onClick: handleClick,
3265
+ onMouseEnter: onItemMouseEnter,
3266
+ onMouseLeave: onItemMouseLeave,
3267
+ ref: setRef,
3268
+ tabIndex: -1,
3269
+ type: t19,
3270
+ children: [t20, t21]
3271
+ }), $[60] = as, $[61] = disabled, $[62] = handleClick, $[63] = onItemMouseEnter, $[64] = onItemMouseLeave, $[65] = restProps, $[66] = scheme, $[67] = t13, $[68] = t14, $[69] = t15, $[70] = t16, $[71] = t18, $[72] = t19, $[73] = t20, $[74] = t21, $[75] = t22) : t22 = $[75], t22;
3272
+ });
3273
+ MenuItemComponent.displayName = "ForwardRef(MenuItem)";
3274
+ /**
3275
+ * @public
3276
+ */
3277
+ const MenuItem = MenuItemComponent;
3278
+ function _temp(s) {
3279
+ return s - 1;
3280
+ }
3281
+ const CustomButton = styled(Button).withConfig({
3282
+ displayName: "CustomButton",
3283
+ componentId: "sc-epil5s-0"
3284
+ })`max-width:100%;`, Tab = forwardRef(function(props, forwardedRef) {
3285
+ let $ = c(30), focused, icon, id, label, onClick, onFocus, restProps, selected, t0, t1;
3286
+ $[0] === props ? (focused = $[1], icon = $[2], id = $[3], label = $[4], onClick = $[5], onFocus = $[6], restProps = $[7], selected = $[8], t0 = $[9], t1 = $[10]) : ({icon, id, focused, fontSize: t0, label, onClick, onFocus, padding: t1, selected, ...restProps} = props, $[0] = props, $[1] = focused, $[2] = icon, $[3] = id, $[4] = label, $[5] = onClick, $[6] = onFocus, $[7] = restProps, $[8] = selected, $[9] = t0, $[10] = t1);
3287
+ let fontSize = t0 === void 0 ? 1 : t0, padding = t1 === void 0 ? 2 : t1, ref = useRef(null), focusedRef = useRef(!1), t2;
3288
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[11] = t2) : t2 = $[11], useImperativeHandle(forwardedRef, t2);
3289
+ let t3;
3290
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => {
3291
+ focusedRef.current = !1;
3292
+ }, $[12] = t3) : t3 = $[12];
3293
+ let handleBlur = t3, t4;
3294
+ $[13] === onFocus ? t4 = $[14] : (t4 = (event) => {
3295
+ focusedRef.current = !0, onFocus && onFocus(event);
3296
+ }, $[13] = onFocus, $[14] = t4);
3297
+ let handleFocus = t4, t5, t6;
3298
+ $[15] === focused ? (t5 = $[16], t6 = $[17]) : (t5 = () => {
3299
+ focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
3300
+ }, t6 = [focused], $[15] = focused, $[16] = t5, $[17] = t6), useEffect(t5, t6);
3301
+ let t7 = selected ? "true" : "false", t8 = selected ? 0 : -1, t9;
3302
+ return $[18] !== fontSize || $[19] !== handleFocus || $[20] !== icon || $[21] !== id || $[22] !== label || $[23] !== onClick || $[24] !== padding || $[25] !== restProps || $[26] !== selected || $[27] !== t7 || $[28] !== t8 ? (t9 = /* @__PURE__ */ jsx(CustomButton, {
3303
+ "data-ui": "Tab",
3304
+ ...restProps,
3305
+ "aria-selected": t7,
3306
+ fontSize,
3307
+ icon,
3308
+ id,
3309
+ mode: "bleed",
3310
+ onClick,
3311
+ onBlur: handleBlur,
3312
+ onFocus: handleFocus,
3313
+ padding,
3314
+ ref,
3315
+ role: "tab",
3316
+ selected,
3317
+ tabIndex: t8,
3318
+ text: label,
3319
+ type: "button"
3320
+ }), $[18] = fontSize, $[19] = handleFocus, $[20] = icon, $[21] = id, $[22] = label, $[23] = onClick, $[24] = padding, $[25] = restProps, $[26] = selected, $[27] = t7, $[28] = t8, $[29] = t9) : t9 = $[29], t9;
3321
+ });
3322
+ Tab.displayName = "ForwardRef(Tab)";
3323
+ const CustomInline = styled(Inline).withConfig({
3324
+ displayName: "CustomInline",
3325
+ componentId: "sc-k5whbp-0"
3326
+ })`& > div{display:inline-block;vertical-align:middle;max-width:100%;box-sizing:border-box;}`, TabList = forwardRef(function(props, ref) {
3327
+ let $ = c(15), childrenProp, restProps;
3328
+ $[0] === props ? (childrenProp = $[1], restProps = $[2]) : ({children: childrenProp, ...restProps} = props, $[0] = props, $[1] = childrenProp, $[2] = restProps);
3329
+ let [focusedIndex, setFocusedIndex] = useState(-1), t0;
3330
+ if ($[3] !== childrenProp || $[4] !== focusedIndex) {
3331
+ let children = Children.toArray(childrenProp).filter(isValidElement), t1;
3332
+ $[6] === focusedIndex ? t1 = $[7] : (t1 = (child, childIndex) => cloneElement(child, {
3333
+ focused: focusedIndex === childIndex,
3334
+ key: childIndex,
3335
+ onFocus: () => setFocusedIndex(childIndex)
3336
+ }), $[6] = focusedIndex, $[7] = t1), t0 = children.map(t1), $[3] = childrenProp, $[4] = focusedIndex, $[5] = t0;
3337
+ } else t0 = $[5];
3338
+ let tabs = t0, numTabs = tabs.length, t1;
3339
+ $[8] === numTabs ? t1 = $[9] : (t1 = (event) => {
3340
+ event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
3341
+ }, $[8] = numTabs, $[9] = t1);
3342
+ let handleKeyDown = t1, t2;
3343
+ return $[10] !== handleKeyDown || $[11] !== ref || $[12] !== restProps || $[13] !== tabs ? (t2 = /* @__PURE__ */ jsx(CustomInline, {
3344
+ "data-ui": "TabList",
3345
+ ...restProps,
3346
+ onKeyDown: handleKeyDown,
3347
+ ref,
3348
+ role: "tablist",
3349
+ children: tabs
3350
+ }), $[10] = handleKeyDown, $[11] = ref, $[12] = restProps, $[13] = tabs, $[14] = t2) : t2 = $[14], t2;
3351
+ });
3352
+ TabList.displayName = "ForwardRef(TabList)";
3353
+ export { responsiveInputPaddingStyle as $, useMediaIndex as A, parseColor as At, _cardColorStyle as B, BoundaryElementContext as C, isHTMLTextAreaElement as Ct, Grid as D, hexToRgb as Dt, Inline as E, createColorTheme as Et, _ResizeObserver as F, studioTheme as Ft, SpanWithTextOverflow as G, Flex as H, useCustomValidity as I, textInputBaseStyle as J, responsiveRadiusStyle as K, useClickOutsideEvent as L, useGlobalKeyDown as M, rgbToHsl as Mt, useElementSize as N, rgba as Nt, usePrefersReducedMotion as O, hslToRgb as Ot, _elementSizeObserver as P, screen as Pt, responsiveInputPaddingIconRightStyle as Q, Card as R, isRecord as S, isHTMLSelectElement as St, KBD as T, EMPTY_RECORD as Tt, Text as U, Spinner as V, Box as W, textInputRepresentationStyle as X, textInputFontSizeStyle as Y, textInputRootStyle as Z, usePortal as _, containsOrEqualsElement as _t, MenuDivider as a, useRootTheme as at, LayerProvider as b, isHTMLElement as bt, Tooltip as c, responsiveTextFont as ct, useDelayedState as d, _fillCSSObject as dt, focusRingBorderStyle as et, TextInput as f, _getArrayProp as ft, Portal as g, _isEnterToClickElement as gt, PortalProvider as h, rem as ht, MenuGroup as i, ThemeColorProvider as it, useMatchMedia as j, rgbToHex as jt, usePrefersDark as k, multiply as kt, useTooltipDelayGroup as l, responsiveTextAlignStyle as lt, Popover as m, _responsive as mt, Tab as n, useTheme$1 as nt, Menu as o, ThemeProvider$1 as ot, Stack as p, _getResponsiveSpace as pt, responsivePaddingStyle as q, MenuItem as r, useTheme_v2 as rt, Hotkeys as s, createGlobalScopedContext as st, TabList as t, focusRingStyle as tt, TooltipDelayGroupContext as u, responsiveFont as ut, Layer as v, isHTMLAnchorElement as vt, Arrow as w, EMPTY_ARRAY as wt, useBoundaryElement as x, isHTMLInputElement as xt, useLayer as y, isHTMLButtonElement as yt, Button as z };
3354
+
3355
+ //# sourceMappingURL=tabList.mjs.map