@gardenfi/garden-book 0.2.3-beta.10 → 0.2.3-beta.12

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 (392) hide show
  1. package/dist/BlogCard/index.d.ts +1 -0
  2. package/dist/BlogCard.js +820 -0
  3. package/dist/BlogCard.js.map +1 -0
  4. package/dist/BottomSheet/index.d.ts +1 -0
  5. package/dist/BottomSheet.js +2801 -0
  6. package/dist/BottomSheet.js.map +1 -0
  7. package/dist/{components/atoms/Button → Button}/Button.d.ts +7 -0
  8. package/dist/Button/index.d.ts +1 -0
  9. package/dist/Button.js +515 -0
  10. package/dist/Button.js.map +1 -0
  11. package/dist/{components/atoms/Checkbox → Checkbox}/Checkbox.d.ts +1 -0
  12. package/dist/Checkbox/index.d.ts +1 -0
  13. package/dist/Checkbox.js +9 -0
  14. package/dist/Checkbox.js.map +1 -0
  15. package/dist/Chip/index.d.ts +1 -0
  16. package/dist/Chip-DOSAEkS5.js +24 -0
  17. package/dist/Chip-DOSAEkS5.js.map +1 -0
  18. package/dist/Chip.js +5 -0
  19. package/dist/Chip.js.map +1 -0
  20. package/dist/ClientOnly-CMQEf-Yl.js +13 -0
  21. package/dist/ClientOnly-CMQEf-Yl.js.map +1 -0
  22. package/dist/ClientOnly.js +5 -0
  23. package/dist/ClientOnly.js.map +1 -0
  24. package/dist/Combination-BN2ESQ8D.js +666 -0
  25. package/dist/Combination-BN2ESQ8D.js.map +1 -0
  26. package/dist/Container/index.d.ts +1 -0
  27. package/dist/Container.js +9 -0
  28. package/dist/Container.js.map +1 -0
  29. package/dist/{components/organisms/Footer → Footer}/Footer.d.ts +0 -1
  30. package/dist/Footer/index.d.ts +1 -0
  31. package/dist/Footer.js +661 -0
  32. package/dist/Footer.js.map +1 -0
  33. package/dist/GardenIcon-E0OJI-b-.js +35 -0
  34. package/dist/GardenIcon-E0OJI-b-.js.map +1 -0
  35. package/dist/GradientScroll/index.d.ts +1 -0
  36. package/dist/GradientScroll.js +86 -0
  37. package/dist/GradientScroll.js.map +1 -0
  38. package/dist/Icons/APIIcon/index.d.ts +1 -0
  39. package/dist/Icons/AddIcon/index.d.ts +1 -0
  40. package/dist/Icons/ArrowDownwardIcon/index.d.ts +1 -0
  41. package/dist/Icons/ArrowEastIcon/index.d.ts +1 -0
  42. package/dist/Icons/ArrowInwardIcon/ArrowInwardIcon.d.ts +5 -0
  43. package/dist/Icons/ArrowInwardIcon/index.d.ts +1 -0
  44. package/dist/Icons/ArrowLeftIcon/index.d.ts +1 -0
  45. package/dist/Icons/ArrowNorthEastIcon/index.d.ts +1 -0
  46. package/dist/Icons/ArrowNorthWestIcon/index.d.ts +1 -0
  47. package/dist/Icons/ArrowRightIcon/index.d.ts +1 -0
  48. package/dist/Icons/ArrowSouthEastIcon/index.d.ts +1 -0
  49. package/dist/Icons/ArrowSouthWestIcon/index.d.ts +1 -0
  50. package/dist/Icons/ArrowSyncIcon/index.d.ts +1 -0
  51. package/dist/Icons/ArrowUpwardIcon/index.d.ts +1 -0
  52. package/dist/Icons/BlogIcon/index.d.ts +1 -0
  53. package/dist/Icons/BrandKitIcon/index.d.ts +1 -0
  54. package/dist/Icons/CancelIcon/index.d.ts +1 -0
  55. package/dist/Icons/ChainflipIcon/index.d.ts +1 -0
  56. package/dist/Icons/CheckCircleIcon/index.d.ts +1 -0
  57. package/dist/Icons/CheckIcon/index.d.ts +1 -0
  58. package/dist/Icons/Checked/index.d.ts +1 -0
  59. package/dist/Icons/ClockIcon/index.d.ts +1 -0
  60. package/dist/Icons/CloseIcon/index.d.ts +1 -0
  61. package/dist/Icons/CodeBlockIcon/index.d.ts +1 -0
  62. package/dist/Icons/CompareArrowsIcon/index.d.ts +1 -0
  63. package/dist/Icons/ConsoleIcon/index.d.ts +1 -0
  64. package/dist/Icons/CopyIcon/index.d.ts +1 -0
  65. package/dist/Icons/CopyrightsIcon/index.d.ts +1 -0
  66. package/dist/Icons/DeleteIcon/index.d.ts +1 -0
  67. package/dist/Icons/DiscordIcon/index.d.ts +1 -0
  68. package/dist/Icons/DollarChipIcon/index.d.ts +1 -0
  69. package/dist/Icons/DraftIcon/index.d.ts +1 -0
  70. package/dist/Icons/EditIcon/index.d.ts +1 -0
  71. package/dist/Icons/EncryptedIcon/index.d.ts +1 -0
  72. package/dist/Icons/ExchangeIcon/index.d.ts +1 -0
  73. package/dist/Icons/FaqIcon/FaqIcon.d.ts +5 -0
  74. package/dist/Icons/FaqIcon/index.d.ts +1 -0
  75. package/dist/Icons/FeesIcon/index.d.ts +1 -0
  76. package/dist/Icons/FingerprintIcon/index.d.ts +1 -0
  77. package/dist/Icons/FolderIcon/FolderIcon.d.ts +5 -0
  78. package/dist/Icons/FolderIcon/index.d.ts +1 -0
  79. package/dist/Icons/GasStationIcon/index.d.ts +1 -0
  80. package/dist/Icons/GiftBoxIcon/index.d.ts +1 -0
  81. package/dist/Icons/HorizontalSwap/index.d.ts +1 -0
  82. package/dist/Icons/HubIcon/index.d.ts +1 -0
  83. package/dist/Icons/InfinityIcon/index.d.ts +1 -0
  84. package/dist/Icons/InfoIcon/index.d.ts +1 -0
  85. package/dist/Icons/KeyboardDownIcon/index.d.ts +1 -0
  86. package/dist/Icons/KeyboardLeftIcon/index.d.ts +1 -0
  87. package/dist/Icons/KeyboardRightIcon/index.d.ts +1 -0
  88. package/dist/Icons/KeyboardUpIcon/index.d.ts +1 -0
  89. package/dist/Icons/LanguageIcon/index.d.ts +1 -0
  90. package/dist/Icons/LinkIcon/index.d.ts +1 -0
  91. package/dist/Icons/LockIcon/index.d.ts +1 -0
  92. package/dist/Icons/LogoutIcon/index.d.ts +1 -0
  93. package/dist/Icons/MenuIcon/index.d.ts +1 -0
  94. package/dist/Icons/MinusIcon/index.d.ts +1 -0
  95. package/dist/Icons/OpenInFullIcon/index.d.ts +1 -0
  96. package/dist/Icons/OpenInNewIcon/index.d.ts +1 -0
  97. package/dist/Icons/OtterSecIcon/index.d.ts +1 -0
  98. package/dist/Icons/PageInfoIcon/index.d.ts +1 -0
  99. package/dist/Icons/PasskeyIcon/index.d.ts +1 -0
  100. package/dist/Icons/PlusIcon/index.d.ts +1 -0
  101. package/dist/Icons/RadioCheckedIcon/index.d.ts +1 -0
  102. package/dist/Icons/RadioUncheckedIcon/index.d.ts +1 -0
  103. package/dist/Icons/RaiseHandIcon/index.d.ts +1 -0
  104. package/dist/Icons/ReferralIcon/index.d.ts +1 -0
  105. package/dist/Icons/RelayLinkIcon/index.d.ts +1 -0
  106. package/dist/Icons/RemoveIcon/index.d.ts +1 -0
  107. package/dist/Icons/Rotate360Icon/index.d.ts +1 -0
  108. package/dist/Icons/RoutingIcon/index.d.ts +1 -0
  109. package/dist/Icons/RowInfoIcon/index.d.ts +1 -0
  110. package/dist/Icons/SDKIcon/index.d.ts +1 -0
  111. package/dist/Icons/SearchIcon/index.d.ts +1 -0
  112. package/dist/Icons/SearchIconThin/index.d.ts +1 -0
  113. package/dist/Icons/Share/index.d.ts +1 -0
  114. package/dist/Icons/StakeIcon/index.d.ts +1 -0
  115. package/dist/Icons/StarIcon/index.d.ts +1 -0
  116. package/dist/Icons/SwapHorizontalIcon/index.d.ts +1 -0
  117. package/dist/Icons/ThorswapIcon/index.d.ts +1 -0
  118. package/dist/Icons/TimerIcon/index.d.ts +1 -0
  119. package/dist/Icons/Unchecked/index.d.ts +1 -0
  120. package/dist/Icons/WalletIcon/index.d.ts +1 -0
  121. package/dist/Icons/WalletIconRose/index.d.ts +1 -0
  122. package/dist/Icons/WarningIcon/index.d.ts +1 -0
  123. package/dist/Icons/XIcon/index.d.ts +1 -0
  124. package/dist/Icons/XSolidIcon/index.d.ts +1 -0
  125. package/dist/Icons/ZellicIcon/index.d.ts +1 -0
  126. package/dist/{components/atoms/Icons → Icons}/index.d.ts +5 -2
  127. package/dist/Icons.js +1936 -0
  128. package/dist/Icons.js.map +1 -0
  129. package/dist/InfoBadge/index.d.ts +1 -0
  130. package/dist/InfoBadge.js +19 -0
  131. package/dist/InfoBadge.js.map +1 -0
  132. package/dist/KeyboardDownIcon-hh63DdT7.js +19 -0
  133. package/dist/KeyboardDownIcon-hh63DdT7.js.map +1 -0
  134. package/dist/Logo/ArbitrumLogo/index.d.ts +1 -0
  135. package/dist/Logo/BTCLogo/index.d.ts +1 -0
  136. package/dist/Logo/Camelot/index.d.ts +1 -0
  137. package/dist/Logo/CatalogLogo/index.d.ts +1 -0
  138. package/dist/Logo/Coinbase/index.d.ts +1 -0
  139. package/dist/Logo/DLCBTC/index.d.ts +1 -0
  140. package/dist/Logo/Debridge/index.d.ts +1 -0
  141. package/dist/Logo/Dodo/index.d.ts +1 -0
  142. package/dist/Logo/EthereumLogo/index.d.ts +1 -0
  143. package/dist/Logo/GMX/index.d.ts +1 -0
  144. package/dist/Logo/GMXLogo/index.d.ts +1 -0
  145. package/dist/Logo/GardenDocs/GardenDocs.d.ts +5 -0
  146. package/dist/Logo/GardenDocs/index.d.ts +1 -0
  147. package/dist/Logo/GardenExplorer/index.d.ts +1 -0
  148. package/dist/Logo/GardenExplorerAlt/GardenExplorerAlt.d.ts +5 -0
  149. package/dist/Logo/GardenExplorerAlt/index.d.ts +1 -0
  150. package/dist/Logo/GardenFullLogo/index.d.ts +1 -0
  151. package/dist/Logo/GardenIcon/GardenIcon.d.ts +8 -0
  152. package/dist/Logo/GardenIcon/index.d.ts +1 -0
  153. package/dist/Logo/GardenIconOutline/index.d.ts +1 -0
  154. package/dist/Logo/GardenLogo/index.d.ts +1 -0
  155. package/dist/Logo/GardenLogoDark/GardenLogoDark.d.ts +5 -0
  156. package/dist/Logo/GardenLogoDark/index.d.ts +1 -0
  157. package/dist/Logo/GardenLogoLight/GardenLogoLight.d.ts +5 -0
  158. package/dist/Logo/GardenLogoLight/index.d.ts +1 -0
  159. package/dist/Logo/GardenLogoMarkDark/GardenLogoMarkDark.d.ts +5 -0
  160. package/dist/Logo/GardenLogoMarkDark/index.d.ts +1 -0
  161. package/dist/Logo/GardenLogoMarkLight/GardenLogoMarkLight.d.ts +5 -0
  162. package/dist/Logo/GardenLogoMarkLight/index.d.ts +1 -0
  163. package/dist/Logo/GardenLogoText/index.d.ts +1 -0
  164. package/dist/Logo/GardenStrokeIcon/index.d.ts +1 -0
  165. package/dist/Logo/NFTIcon/index.d.ts +1 -0
  166. package/dist/Logo/PancakeSwap/index.d.ts +1 -0
  167. package/dist/Logo/PhantomIcon/index.d.ts +1 -0
  168. package/dist/Logo/PolygonLogo/index.d.ts +1 -0
  169. package/dist/Logo/Radiant/index.d.ts +1 -0
  170. package/dist/Logo/RadiantLogo/index.d.ts +1 -0
  171. package/dist/Logo/Solv/index.d.ts +1 -0
  172. package/dist/Logo/SwellBTC/index.d.ts +1 -0
  173. package/dist/Logo/TraderJoe/index.d.ts +1 -0
  174. package/dist/Logo/TrailOfBits/index.d.ts +1 -0
  175. package/dist/Logo/TrustWallet/index.d.ts +1 -0
  176. package/dist/Logo/Vertex/index.d.ts +1 -0
  177. package/dist/Logo/WalletConnect/index.d.ts +1 -0
  178. package/dist/{components/atoms/Logo → Logo}/index.d.ts +7 -1
  179. package/dist/Logo.js +2044 -0
  180. package/dist/Logo.js.map +1 -0
  181. package/dist/{components/atoms/Modal → Modal}/Modal.d.ts +1 -0
  182. package/dist/Modal/index.d.ts +1 -0
  183. package/dist/Modal.js +77 -0
  184. package/dist/Modal.js.map +1 -0
  185. package/dist/Opacity/index.d.ts +2 -0
  186. package/dist/Opacity-DRe3jTZ4.js +29 -0
  187. package/dist/Opacity-DRe3jTZ4.js.map +1 -0
  188. package/dist/Opacity.js +5 -0
  189. package/dist/Opacity.js.map +1 -0
  190. package/dist/OpenInFullIcon-D2mt0Gjr.js +34 -0
  191. package/dist/OpenInFullIcon-D2mt0Gjr.js.map +1 -0
  192. package/dist/QuestCard/index.d.ts +1 -0
  193. package/dist/QuestCard.js +60 -0
  194. package/dist/QuestCard.js.map +1 -0
  195. package/dist/RadioUncheckedIcon-KnzZG6cp.js +34 -0
  196. package/dist/RadioUncheckedIcon-KnzZG6cp.js.map +1 -0
  197. package/dist/Sidebar/index.d.ts +1 -0
  198. package/dist/Sidebar.js +45 -0
  199. package/dist/Sidebar.js.map +1 -0
  200. package/dist/{components/molecules/TokenInfo → TokenInfo}/TokenInfo.d.ts +1 -0
  201. package/dist/TokenInfo/index.d.ts +1 -0
  202. package/dist/TokenInfo.js +47 -0
  203. package/dist/TokenInfo.js.map +1 -0
  204. package/dist/{components/molecules/TokenNetworkLogos → TokenNetworkLogos}/TokenNetworkLogos.d.ts +1 -0
  205. package/dist/TokenNetworkLogos/index.d.ts +1 -0
  206. package/dist/TokenNetworkLogos-DZZrRsmI.js +41 -0
  207. package/dist/TokenNetworkLogos-DZZrRsmI.js.map +1 -0
  208. package/dist/TokenNetworkLogos.js +5 -0
  209. package/dist/TokenNetworkLogos.js.map +1 -0
  210. package/dist/Typography/index.d.ts +1 -0
  211. package/dist/Typography-DX9XpQWB.js +91 -0
  212. package/dist/Typography-DX9XpQWB.js.map +1 -0
  213. package/dist/Typography.js +5 -0
  214. package/dist/Typography.js.map +1 -0
  215. package/dist/Unchecked-B7UGXlAZ.js +76 -0
  216. package/dist/Unchecked-B7UGXlAZ.js.map +1 -0
  217. package/dist/XIcon-DC822TMq.js +67 -0
  218. package/dist/XIcon-DC822TMq.js.map +1 -0
  219. package/dist/index-Ir5YwUO1.js +45 -0
  220. package/dist/index-Ir5YwUO1.js.map +1 -0
  221. package/dist/style.css +17 -1
  222. package/dist/useClientOnly-Bzx92NOa.js +12 -0
  223. package/dist/useClientOnly-Bzx92NOa.js.map +1 -0
  224. package/dist/utils-BnsJHiW8.js +2478 -0
  225. package/dist/utils-BnsJHiW8.js.map +1 -0
  226. package/package.json +16 -10
  227. package/dist/animations/RollingText/RollingText.d.ts +0 -12
  228. package/dist/animations/RollingText/RollingText.stories.d.ts +0 -7
  229. package/dist/animations/ScaleY/ScaleY.d.ts +0 -12
  230. package/dist/animations/ScaleY/ScaleY.stories.d.ts +0 -7
  231. package/dist/animations/Shine/Shine.d.ts +0 -11
  232. package/dist/animations/Shine/Shine.stories.d.ts +0 -7
  233. package/dist/animations/index.d.ts +0 -5
  234. package/dist/components/atoms/BottomSheet/BottomSheet.stories.d.ts +0 -7
  235. package/dist/components/atoms/Button/Button.stories.d.ts +0 -15
  236. package/dist/components/atoms/Checkbox/Checkbox.stories.d.ts +0 -7
  237. package/dist/components/atoms/Container/Container.stories.d.ts +0 -7
  238. package/dist/components/atoms/Icons/Icons.stories.d.ts +0 -5
  239. package/dist/components/atoms/Logo/GardenIcon.d.ts +0 -5
  240. package/dist/components/atoms/Logo/Logo.stories.d.ts +0 -5
  241. package/dist/components/atoms/Modal/Modal.stories.d.ts +0 -7
  242. package/dist/components/atoms/Opacity/Opacity.stories.d.ts +0 -11
  243. package/dist/components/atoms/Sidebar/Sidebar.stories.d.ts +0 -9
  244. package/dist/components/atoms/Typography/Typography.stories.d.ts +0 -16
  245. package/dist/components/atoms/index.d.ts +0 -13
  246. package/dist/components/index.d.ts +0 -3
  247. package/dist/components/molecules/Chip/Chip.stories.d.ts +0 -37
  248. package/dist/components/molecules/GradientScroll/GradientScroll.stories.d.ts +0 -20
  249. package/dist/components/molecules/InfoBadge/InfoBadge.stories.d.ts +0 -14
  250. package/dist/components/molecules/TokenInfo/TokenInfo.stories.d.ts +0 -18
  251. package/dist/components/molecules/TokenNetworkLogos/TokenNetworkLogos.stories.d.ts +0 -19
  252. package/dist/components/molecules/index.d.ts +0 -7
  253. package/dist/components/organisms/BlogCard/BlogCard.stories.d.ts +0 -21
  254. package/dist/components/organisms/Footer/Footer.stories.d.ts +0 -18
  255. package/dist/components/organisms/QuestCard/QuestCard.stories.d.ts +0 -27
  256. package/dist/components/organisms/index.d.ts +0 -3
  257. package/dist/hooks/useClientOnly.d.ts +0 -5
  258. package/dist/index.d.ts +0 -3
  259. package/dist/index.es-BsweaPuE.js +0 -8030
  260. package/dist/index.es-EZUrluJw.cjs +0 -11
  261. package/dist/ui.cjs.js +0 -65
  262. package/dist/ui.es.js +0 -15453
  263. package/dist/ui.umd.js +0 -75
  264. package/dist/utils/utils.d.ts +0 -3
  265. /package/dist/{components/organisms/BlogCard → BlogCard}/BlogCard.d.ts +0 -0
  266. /package/dist/{components/atoms/BottomSheet → BottomSheet}/BottomSheet.d.ts +0 -0
  267. /package/dist/{components/atoms/Button → Button}/ClientOnlyLottie.d.ts +0 -0
  268. /package/dist/{components/atoms/Button → Button}/spinner.json.d.ts +0 -0
  269. /package/dist/{components/molecules/Chip → Chip}/Chip.d.ts +0 -0
  270. /package/dist/{components/atoms/ClientOnly → ClientOnly}/ClientOnly.d.ts +0 -0
  271. /package/dist/{components/atoms/ClientOnly → ClientOnly}/index.d.ts +0 -0
  272. /package/dist/{components/atoms/Container → Container}/Container.d.ts +0 -0
  273. /package/dist/{components/organisms/Footer → Footer}/FooterBackgroundAnimation.d.ts +0 -0
  274. /package/dist/{components/organisms/Footer → Footer}/FooterLink.d.ts +0 -0
  275. /package/dist/{components/molecules/GradientScroll → GradientScroll}/GradientScroll.d.ts +0 -0
  276. /package/dist/{components/atoms/Icons → Icons/APIIcon}/APIIcon.d.ts +0 -0
  277. /package/dist/{components/atoms/Icons → Icons/AddIcon}/AddIcon.d.ts +0 -0
  278. /package/dist/{components/atoms/Icons → Icons/ArrowDownwardIcon}/ArrowDownwardIcon.d.ts +0 -0
  279. /package/dist/{components/atoms/Icons → Icons/ArrowEastIcon}/ArrowEastIcon.d.ts +0 -0
  280. /package/dist/{components/atoms/Icons → Icons/ArrowLeftIcon}/ArrowLeftIcon.d.ts +0 -0
  281. /package/dist/{components/atoms/Icons → Icons/ArrowNorthEastIcon}/ArrowNorthEastIcon.d.ts +0 -0
  282. /package/dist/{components/atoms/Icons → Icons/ArrowNorthWestIcon}/ArrowNorthWestIcon.d.ts +0 -0
  283. /package/dist/{components/atoms/Icons → Icons/ArrowRightIcon}/ArrowRightIcon.d.ts +0 -0
  284. /package/dist/{components/atoms/Icons → Icons/ArrowSouthEastIcon}/ArrowSouthEastIcon.d.ts +0 -0
  285. /package/dist/{components/atoms/Icons → Icons/ArrowSouthWestIcon}/ArrowSouthWestIcon.d.ts +0 -0
  286. /package/dist/{components/atoms/Icons → Icons/ArrowSyncIcon}/ArrowSyncIcon.d.ts +0 -0
  287. /package/dist/{components/atoms/Icons → Icons/ArrowUpwardIcon}/ArrowUpwardIcon.d.ts +0 -0
  288. /package/dist/{components/atoms/Icons → Icons/BlogIcon}/BlogIcon.d.ts +0 -0
  289. /package/dist/{components/atoms/Icons → Icons/BrandKitIcon}/BrandKitIcon.d.ts +0 -0
  290. /package/dist/{components/atoms/Icons → Icons/CancelIcon}/CancelIcon.d.ts +0 -0
  291. /package/dist/{components/atoms/Icons → Icons/ChainflipIcon}/ChainflipIcon.d.ts +0 -0
  292. /package/dist/{components/atoms/Icons → Icons/CheckCircleIcon}/CheckCircleIcon.d.ts +0 -0
  293. /package/dist/{components/atoms/Icons → Icons/CheckIcon}/CheckIcon.d.ts +0 -0
  294. /package/dist/{components/atoms/Icons → Icons/Checked}/Checked.d.ts +0 -0
  295. /package/dist/{components/atoms/Icons → Icons/ClockIcon}/ClockIcon.d.ts +0 -0
  296. /package/dist/{components/atoms/Icons → Icons/CloseIcon}/CloseIcon.d.ts +0 -0
  297. /package/dist/{components/atoms/Icons → Icons/CodeBlockIcon}/CodeBlockIcon.d.ts +0 -0
  298. /package/dist/{components/atoms/Icons → Icons/CompareArrowsIcon}/CompareArrowsIcon.d.ts +0 -0
  299. /package/dist/{components/atoms/Icons → Icons/ConsoleIcon}/ConsoleIcon.d.ts +0 -0
  300. /package/dist/{components/atoms/Icons → Icons/CopyIcon}/CopyIcon.d.ts +0 -0
  301. /package/dist/{components/atoms/Icons → Icons/CopyrightsIcon}/CopyrightsIcon.d.ts +0 -0
  302. /package/dist/{components/atoms/Icons → Icons/DeleteIcon}/DeleteIcon.d.ts +0 -0
  303. /package/dist/{components/atoms/Icons → Icons/DiscordIcon}/DiscordIcon.d.ts +0 -0
  304. /package/dist/{components/atoms/Icons → Icons/DollarChipIcon}/DollarChipIcon.d.ts +0 -0
  305. /package/dist/{components/atoms/Icons → Icons/DraftIcon}/DraftIcon.d.ts +0 -0
  306. /package/dist/{components/atoms/Icons → Icons/EditIcon}/EditIcon.d.ts +0 -0
  307. /package/dist/{components/atoms/Icons → Icons/EncryptedIcon}/EncryptedIcon.d.ts +0 -0
  308. /package/dist/{components/atoms/Icons → Icons/ExchangeIcon}/ExchangeIcon.d.ts +0 -0
  309. /package/dist/{components/atoms/Icons → Icons/FeesIcon}/FeesIcon.d.ts +0 -0
  310. /package/dist/{components/atoms/Icons → Icons/FingerprintIcon}/FingerprintIcon.d.ts +0 -0
  311. /package/dist/{components/atoms/Icons → Icons/GasStationIcon}/GasStationIcon.d.ts +0 -0
  312. /package/dist/{components/atoms/Icons → Icons/GiftBoxIcon}/GiftBoxIcon.d.ts +0 -0
  313. /package/dist/{components/atoms/Icons → Icons/HorizontalSwap}/HorizontalSwap.d.ts +0 -0
  314. /package/dist/{components/atoms/Icons → Icons/HubIcon}/HubIcon.d.ts +0 -0
  315. /package/dist/{components/atoms/Icons → Icons/InfinityIcon}/InfinityIcon.d.ts +0 -0
  316. /package/dist/{components/atoms/Icons → Icons/InfoIcon}/InfoIcon.d.ts +0 -0
  317. /package/dist/{components/atoms/Icons → Icons/KeyboardDownIcon}/KeyboardDownIcon.d.ts +0 -0
  318. /package/dist/{components/atoms/Icons → Icons/KeyboardLeftIcon}/KeyboardLeftIcon.d.ts +0 -0
  319. /package/dist/{components/atoms/Icons → Icons/KeyboardRightIcon}/KeyboardRightIcon.d.ts +0 -0
  320. /package/dist/{components/atoms/Icons → Icons/KeyboardUpIcon}/KeyboardUpIcon.d.ts +0 -0
  321. /package/dist/{components/atoms/Icons → Icons/LanguageIcon}/GlobeIcon.d.ts +0 -0
  322. /package/dist/{components/atoms/Icons → Icons/LinkIcon}/LinkIcon.d.ts +0 -0
  323. /package/dist/{components/atoms/Icons → Icons/LockIcon}/LockIcon.d.ts +0 -0
  324. /package/dist/{components/atoms/Icons → Icons/LogoutIcon}/LogoutIcon.d.ts +0 -0
  325. /package/dist/{components/atoms/Icons → Icons/MenuIcon}/MenuIcon.d.ts +0 -0
  326. /package/dist/{components/atoms/Icons → Icons/MinusIcon}/MinusIcon.d.ts +0 -0
  327. /package/dist/{components/atoms/Icons → Icons/OpenInFullIcon}/OpenInFullIcon.d.ts +0 -0
  328. /package/dist/{components/atoms/Icons → Icons/OpenInNewIcon}/OpenInNewIcon.d.ts +0 -0
  329. /package/dist/{components/atoms/Icons → Icons/OtterSecIcon}/OtterSecIcon.d.ts +0 -0
  330. /package/dist/{components/atoms/Icons → Icons/PageInfoIcon}/PageInfoIcon.d.ts +0 -0
  331. /package/dist/{components/atoms/Icons → Icons/PasskeyIcon}/Passkey.d.ts +0 -0
  332. /package/dist/{components/atoms/Icons → Icons/PlusIcon}/PlusIcon.d.ts +0 -0
  333. /package/dist/{components/atoms/Icons → Icons/RadioCheckedIcon}/RadioCheckedIcon.d.ts +0 -0
  334. /package/dist/{components/atoms/Icons → Icons/RadioUncheckedIcon}/RadioUncheckedIcon.d.ts +0 -0
  335. /package/dist/{components/atoms/Icons → Icons/RaiseHandIcon}/RaiseHandIcon.d.ts +0 -0
  336. /package/dist/{components/atoms/Icons → Icons/ReferralIcon}/ReferralIcon.d.ts +0 -0
  337. /package/dist/{components/atoms/Icons → Icons/RelayLinkIcon}/RelayLinkIcon.d.ts +0 -0
  338. /package/dist/{components/atoms/Icons → Icons/RemoveIcon}/RemoveIcon.d.ts +0 -0
  339. /package/dist/{components/atoms/Icons → Icons/Rotate360Icon}/Rotate360Icon.d.ts +0 -0
  340. /package/dist/{components/atoms/Icons → Icons/RoutingIcon}/RoutingIcon.d.ts +0 -0
  341. /package/dist/{components/atoms/Icons → Icons/RowInfoIcon}/RowInfoIcon.d.ts +0 -0
  342. /package/dist/{components/atoms/Icons → Icons/SDKIcon}/SDKIcon.d.ts +0 -0
  343. /package/dist/{components/atoms/Icons → Icons/SearchIcon}/SearchIcon.d.ts +0 -0
  344. /package/dist/{components/atoms/Icons → Icons/SearchIconThin}/SearchIconThin.d.ts +0 -0
  345. /package/dist/{components/atoms/Icons → Icons/Share}/Share.d.ts +0 -0
  346. /package/dist/{components/atoms/Icons → Icons/StakeIcon}/StakeIcon.d.ts +0 -0
  347. /package/dist/{components/atoms/Icons → Icons/StarIcon}/StarIcon.d.ts +0 -0
  348. /package/dist/{components/atoms/Icons → Icons/SwapHorizontalIcon}/SwapHorizontalIcon.d.ts +0 -0
  349. /package/dist/{components/atoms/Icons → Icons/ThorswapIcon}/ThorswapIcon.d.ts +0 -0
  350. /package/dist/{components/atoms/Icons → Icons/TimerIcon}/TimerIcon.d.ts +0 -0
  351. /package/dist/{components/atoms/Icons → Icons/Unchecked}/Unchecked.d.ts +0 -0
  352. /package/dist/{components/atoms/Icons → Icons/WalletIcon}/WalletIcon.d.ts +0 -0
  353. /package/dist/{components/atoms/Icons → Icons/WalletIconRose}/WalletIconRose.d.ts +0 -0
  354. /package/dist/{components/atoms/Icons → Icons/WarningIcon}/WarningIcon.d.ts +0 -0
  355. /package/dist/{components/atoms/Icons → Icons/XIcon}/XIcon.d.ts +0 -0
  356. /package/dist/{components/atoms/Icons → Icons/XSolidIcon}/XSolidIcon.d.ts +0 -0
  357. /package/dist/{components/atoms/Icons → Icons/ZellicIcon}/ZellicIcon.d.ts +0 -0
  358. /package/dist/{components/molecules/InfoBadge → InfoBadge}/InfoBadge.d.ts +0 -0
  359. /package/dist/{components/atoms/Logo → Logo/ArbitrumLogo}/ArbitrumLogo.d.ts +0 -0
  360. /package/dist/{components/atoms/Logo → Logo/BTCLogo}/BTCLogo.d.ts +0 -0
  361. /package/dist/{components/atoms/Logo → Logo/Camelot}/Camelot.d.ts +0 -0
  362. /package/dist/{components/atoms/Logo → Logo/CatalogLogo}/CatalogLogo.d.ts +0 -0
  363. /package/dist/{components/atoms/Logo → Logo/Coinbase}/Coinbase.d.ts +0 -0
  364. /package/dist/{components/atoms/Logo → Logo/DLCBTC}/DLCBTC.d.ts +0 -0
  365. /package/dist/{components/atoms/Logo → Logo/Debridge}/Debridge.d.ts +0 -0
  366. /package/dist/{components/atoms/Logo → Logo/Dodo}/DODO.d.ts +0 -0
  367. /package/dist/{components/atoms/Logo → Logo/EthereumLogo}/EthereumLogo.d.ts +0 -0
  368. /package/dist/{components/atoms/Logo → Logo/GMX}/GMX.d.ts +0 -0
  369. /package/dist/{components/atoms/Logo → Logo/GMXLogo}/GMXLogo.d.ts +0 -0
  370. /package/dist/{components/atoms/Logo → Logo/GardenExplorer}/GardenExplorer.d.ts +0 -0
  371. /package/dist/{components/atoms/Logo → Logo/GardenFullLogo}/GardenFullLogo.d.ts +0 -0
  372. /package/dist/{components/atoms/Logo → Logo/GardenIconOutline}/GardenIconOutline.d.ts +0 -0
  373. /package/dist/{components/atoms/Logo → Logo/GardenLogo}/GardenLogo.d.ts +0 -0
  374. /package/dist/{components/atoms/Logo → Logo/GardenLogoText}/GardenLogoText.d.ts +0 -0
  375. /package/dist/{components/atoms/Logo → Logo/GardenStrokeIcon}/GardenStrokeIcon.d.ts +0 -0
  376. /package/dist/{components/atoms/Logo → Logo/NFTIcon}/NFTIcon.d.ts +0 -0
  377. /package/dist/{components/atoms/Logo → Logo/PancakeSwap}/PancakeSwap.d.ts +0 -0
  378. /package/dist/{components/atoms/Logo → Logo/PhantomIcon}/PhantomIcon.d.ts +0 -0
  379. /package/dist/{components/atoms/Logo → Logo/PolygonLogo}/PolygonLogo.d.ts +0 -0
  380. /package/dist/{components/atoms/Logo → Logo/Radiant}/Radiant.d.ts +0 -0
  381. /package/dist/{components/atoms/Logo → Logo/RadiantLogo}/RadiantLogo.d.ts +0 -0
  382. /package/dist/{components/atoms/Logo → Logo/Solv}/Solv.d.ts +0 -0
  383. /package/dist/{components/atoms/Logo → Logo/SwellBTC}/SwellBTC.d.ts +0 -0
  384. /package/dist/{components/atoms/Logo → Logo/TraderJoe}/TraderJoe.d.ts +0 -0
  385. /package/dist/{components/atoms/Logo → Logo/TrailOfBits}/TrailOfBits.d.ts +0 -0
  386. /package/dist/{components/atoms/Logo → Logo/TrustWallet}/TrustWallet.d.ts +0 -0
  387. /package/dist/{components/atoms/Logo → Logo/Vertex}/Vertex.d.ts +0 -0
  388. /package/dist/{components/atoms/Logo → Logo/WalletConnect}/WalletConnect.d.ts +0 -0
  389. /package/dist/{components/atoms/Opacity → Opacity}/Opacity.d.ts +0 -0
  390. /package/dist/{components/organisms/QuestCard → QuestCard}/QuestCard.d.ts +0 -0
  391. /package/dist/{components/atoms/Sidebar → Sidebar}/Sidebar.d.ts +0 -0
  392. /package/dist/{components/atoms/Typography → Typography}/Typography.d.ts +0 -0
@@ -0,0 +1,2801 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import React__default, { useLayoutEffect, useEffect, useMemo } from "react";
4
+ import * as ReactDOM from "react-dom";
5
+ import ReactDOM__default from "react-dom";
6
+ import { R as ReactRemoveScroll } from "./Combination-BN2ESQ8D.js";
7
+ import { C as ClientOnly } from "./ClientOnly-CMQEf-Yl.js";
8
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
9
+ return function handleEvent(event) {
10
+ originalEventHandler == null ? void 0 : originalEventHandler(event);
11
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
12
+ return ourEventHandler == null ? void 0 : ourEventHandler(event);
13
+ }
14
+ };
15
+ }
16
+ function setRef$1(ref, value) {
17
+ if (typeof ref === "function") {
18
+ return ref(value);
19
+ } else if (ref !== null && ref !== void 0) {
20
+ ref.current = value;
21
+ }
22
+ }
23
+ function composeRefs$1(...refs) {
24
+ return (node) => {
25
+ let hasCleanup = false;
26
+ const cleanups = refs.map((ref) => {
27
+ const cleanup = setRef$1(ref, node);
28
+ if (!hasCleanup && typeof cleanup == "function") {
29
+ hasCleanup = true;
30
+ }
31
+ return cleanup;
32
+ });
33
+ if (hasCleanup) {
34
+ return () => {
35
+ for (let i = 0; i < cleanups.length; i++) {
36
+ const cleanup = cleanups[i];
37
+ if (typeof cleanup == "function") {
38
+ cleanup();
39
+ } else {
40
+ setRef$1(refs[i], null);
41
+ }
42
+ }
43
+ };
44
+ }
45
+ };
46
+ }
47
+ function useComposedRefs$1(...refs) {
48
+ return React.useCallback(composeRefs$1(...refs), refs);
49
+ }
50
+ function createContext2(rootComponentName, defaultContext) {
51
+ const Context = React.createContext(defaultContext);
52
+ const Provider = (props) => {
53
+ const { children, ...context } = props;
54
+ const value = React.useMemo(() => context, Object.values(context));
55
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
56
+ };
57
+ Provider.displayName = rootComponentName + "Provider";
58
+ function useContext2(consumerName) {
59
+ const context = React.useContext(Context);
60
+ if (context) return context;
61
+ if (defaultContext !== void 0) return defaultContext;
62
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
63
+ }
64
+ return [Provider, useContext2];
65
+ }
66
+ function createContextScope(scopeName, createContextScopeDeps = []) {
67
+ let defaultContexts = [];
68
+ function createContext3(rootComponentName, defaultContext) {
69
+ const BaseContext = React.createContext(defaultContext);
70
+ const index = defaultContexts.length;
71
+ defaultContexts = [...defaultContexts, defaultContext];
72
+ const Provider = (props) => {
73
+ var _a;
74
+ const { scope, children, ...context } = props;
75
+ const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index]) || BaseContext;
76
+ const value = React.useMemo(() => context, Object.values(context));
77
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
78
+ };
79
+ Provider.displayName = rootComponentName + "Provider";
80
+ function useContext2(consumerName, scope) {
81
+ var _a;
82
+ const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index]) || BaseContext;
83
+ const context = React.useContext(Context);
84
+ if (context) return context;
85
+ if (defaultContext !== void 0) return defaultContext;
86
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
87
+ }
88
+ return [Provider, useContext2];
89
+ }
90
+ const createScope = () => {
91
+ const scopeContexts = defaultContexts.map((defaultContext) => {
92
+ return React.createContext(defaultContext);
93
+ });
94
+ return function useScope(scope) {
95
+ const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
96
+ return React.useMemo(
97
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
98
+ [scope, contexts]
99
+ );
100
+ };
101
+ };
102
+ createScope.scopeName = scopeName;
103
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
104
+ }
105
+ function composeContextScopes(...scopes) {
106
+ const baseScope = scopes[0];
107
+ if (scopes.length === 1) return baseScope;
108
+ const createScope = () => {
109
+ const scopeHooks = scopes.map((createScope2) => ({
110
+ useScope: createScope2(),
111
+ scopeName: createScope2.scopeName
112
+ }));
113
+ return function useComposedScopes(overrideScopes) {
114
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
115
+ const scopeProps = useScope(overrideScopes);
116
+ const currentScope = scopeProps[`__scope${scopeName}`];
117
+ return { ...nextScopes2, ...currentScope };
118
+ }, {});
119
+ return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
120
+ };
121
+ };
122
+ createScope.scopeName = baseScope.scopeName;
123
+ return createScope;
124
+ }
125
+ var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? React.useLayoutEffect : () => {
126
+ };
127
+ var useReactId = React[" useId ".trim().toString()] || (() => void 0);
128
+ var count$1 = 0;
129
+ function useId(deterministicId) {
130
+ const [id, setId] = React.useState(useReactId());
131
+ useLayoutEffect2(() => {
132
+ setId((reactId) => reactId ?? String(count$1++));
133
+ }, [deterministicId]);
134
+ return deterministicId || (id ? `radix-${id}` : "");
135
+ }
136
+ var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
137
+ function useControllableState$1({
138
+ prop,
139
+ defaultProp,
140
+ onChange = () => {
141
+ },
142
+ caller
143
+ }) {
144
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState$1({
145
+ defaultProp,
146
+ onChange
147
+ });
148
+ const isControlled = prop !== void 0;
149
+ const value = isControlled ? prop : uncontrolledProp;
150
+ {
151
+ const isControlledRef = React.useRef(prop !== void 0);
152
+ React.useEffect(() => {
153
+ const wasControlled = isControlledRef.current;
154
+ if (wasControlled !== isControlled) {
155
+ const from = wasControlled ? "controlled" : "uncontrolled";
156
+ const to = isControlled ? "controlled" : "uncontrolled";
157
+ console.warn(
158
+ `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
159
+ );
160
+ }
161
+ isControlledRef.current = isControlled;
162
+ }, [isControlled, caller]);
163
+ }
164
+ const setValue = React.useCallback(
165
+ (nextValue) => {
166
+ var _a;
167
+ if (isControlled) {
168
+ const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
169
+ if (value2 !== prop) {
170
+ (_a = onChangeRef.current) == null ? void 0 : _a.call(onChangeRef, value2);
171
+ }
172
+ } else {
173
+ setUncontrolledProp(nextValue);
174
+ }
175
+ },
176
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
177
+ );
178
+ return [value, setValue];
179
+ }
180
+ function useUncontrolledState$1({
181
+ defaultProp,
182
+ onChange
183
+ }) {
184
+ const [value, setValue] = React.useState(defaultProp);
185
+ const prevValueRef = React.useRef(value);
186
+ const onChangeRef = React.useRef(onChange);
187
+ useInsertionEffect(() => {
188
+ onChangeRef.current = onChange;
189
+ }, [onChange]);
190
+ React.useEffect(() => {
191
+ var _a;
192
+ if (prevValueRef.current !== value) {
193
+ (_a = onChangeRef.current) == null ? void 0 : _a.call(onChangeRef, value);
194
+ prevValueRef.current = value;
195
+ }
196
+ }, [value, prevValueRef]);
197
+ return [value, setValue, onChangeRef];
198
+ }
199
+ function isFunction(value) {
200
+ return typeof value === "function";
201
+ }
202
+ // @__NO_SIDE_EFFECTS__
203
+ function createSlot(ownerName) {
204
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
205
+ const Slot2 = React.forwardRef((props, forwardedRef) => {
206
+ const { children, ...slotProps } = props;
207
+ const childrenArray = React.Children.toArray(children);
208
+ const slottable = childrenArray.find(isSlottable);
209
+ if (slottable) {
210
+ const newElement = slottable.props.children;
211
+ const newChildren = childrenArray.map((child) => {
212
+ if (child === slottable) {
213
+ if (React.Children.count(newElement) > 1) return React.Children.only(null);
214
+ return React.isValidElement(newElement) ? newElement.props.children : null;
215
+ } else {
216
+ return child;
217
+ }
218
+ });
219
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
220
+ }
221
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
222
+ });
223
+ Slot2.displayName = `${ownerName}.Slot`;
224
+ return Slot2;
225
+ }
226
+ // @__NO_SIDE_EFFECTS__
227
+ function createSlotClone(ownerName) {
228
+ const SlotClone = React.forwardRef((props, forwardedRef) => {
229
+ const { children, ...slotProps } = props;
230
+ if (React.isValidElement(children)) {
231
+ const childrenRef = getElementRef$1(children);
232
+ const props2 = mergeProps(slotProps, children.props);
233
+ if (children.type !== React.Fragment) {
234
+ props2.ref = forwardedRef ? composeRefs$1(forwardedRef, childrenRef) : childrenRef;
235
+ }
236
+ return React.cloneElement(children, props2);
237
+ }
238
+ return React.Children.count(children) > 1 ? React.Children.only(null) : null;
239
+ });
240
+ SlotClone.displayName = `${ownerName}.SlotClone`;
241
+ return SlotClone;
242
+ }
243
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
244
+ function isSlottable(child) {
245
+ return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
246
+ }
247
+ function mergeProps(slotProps, childProps) {
248
+ const overrideProps = { ...childProps };
249
+ for (const propName in childProps) {
250
+ const slotPropValue = slotProps[propName];
251
+ const childPropValue = childProps[propName];
252
+ const isHandler = /^on[A-Z]/.test(propName);
253
+ if (isHandler) {
254
+ if (slotPropValue && childPropValue) {
255
+ overrideProps[propName] = (...args) => {
256
+ const result = childPropValue(...args);
257
+ slotPropValue(...args);
258
+ return result;
259
+ };
260
+ } else if (slotPropValue) {
261
+ overrideProps[propName] = slotPropValue;
262
+ }
263
+ } else if (propName === "style") {
264
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
265
+ } else if (propName === "className") {
266
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
267
+ }
268
+ }
269
+ return { ...slotProps, ...overrideProps };
270
+ }
271
+ function getElementRef$1(element) {
272
+ var _a, _b;
273
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
274
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
275
+ if (mayWarn) {
276
+ return element.ref;
277
+ }
278
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
279
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
280
+ if (mayWarn) {
281
+ return element.props.ref;
282
+ }
283
+ return element.props.ref || element.ref;
284
+ }
285
+ var NODES = [
286
+ "a",
287
+ "button",
288
+ "div",
289
+ "form",
290
+ "h2",
291
+ "h3",
292
+ "img",
293
+ "input",
294
+ "label",
295
+ "li",
296
+ "nav",
297
+ "ol",
298
+ "p",
299
+ "select",
300
+ "span",
301
+ "svg",
302
+ "ul"
303
+ ];
304
+ var Primitive = NODES.reduce((primitive, node) => {
305
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
306
+ const Node = React.forwardRef((props, forwardedRef) => {
307
+ const { asChild, ...primitiveProps } = props;
308
+ const Comp = asChild ? Slot2 : node;
309
+ if (typeof window !== "undefined") {
310
+ window[Symbol.for("radix-ui")] = true;
311
+ }
312
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
313
+ });
314
+ Node.displayName = `Primitive.${node}`;
315
+ return { ...primitive, [node]: Node };
316
+ }, {});
317
+ function dispatchDiscreteCustomEvent(target, event) {
318
+ if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
319
+ }
320
+ function useCallbackRef$1(callback) {
321
+ const callbackRef = React.useRef(callback);
322
+ React.useEffect(() => {
323
+ callbackRef.current = callback;
324
+ });
325
+ return React.useMemo(() => (...args) => {
326
+ var _a;
327
+ return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
328
+ }, []);
329
+ }
330
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
331
+ const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
332
+ React.useEffect(() => {
333
+ const handleKeyDown = (event) => {
334
+ if (event.key === "Escape") {
335
+ onEscapeKeyDown(event);
336
+ }
337
+ };
338
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
339
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
340
+ }, [onEscapeKeyDown, ownerDocument]);
341
+ }
342
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
343
+ var CONTEXT_UPDATE = "dismissableLayer.update";
344
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
345
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
346
+ var originalBodyPointerEvents;
347
+ var DismissableLayerContext = React.createContext({
348
+ layers: /* @__PURE__ */ new Set(),
349
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
350
+ branches: /* @__PURE__ */ new Set()
351
+ });
352
+ var DismissableLayer = React.forwardRef(
353
+ (props, forwardedRef) => {
354
+ const {
355
+ disableOutsidePointerEvents = false,
356
+ onEscapeKeyDown,
357
+ onPointerDownOutside,
358
+ onFocusOutside,
359
+ onInteractOutside,
360
+ onDismiss,
361
+ ...layerProps
362
+ } = props;
363
+ const context = React.useContext(DismissableLayerContext);
364
+ const [node, setNode] = React.useState(null);
365
+ const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
366
+ const [, force] = React.useState({});
367
+ const composedRefs = useComposedRefs$1(forwardedRef, (node2) => setNode(node2));
368
+ const layers = Array.from(context.layers);
369
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
370
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
371
+ const index = node ? layers.indexOf(node) : -1;
372
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
373
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
374
+ const pointerDownOutside = usePointerDownOutside((event) => {
375
+ const target = event.target;
376
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
377
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
378
+ onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
379
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
380
+ if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
381
+ }, ownerDocument);
382
+ const focusOutside = useFocusOutside((event) => {
383
+ const target = event.target;
384
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
385
+ if (isFocusInBranch) return;
386
+ onFocusOutside == null ? void 0 : onFocusOutside(event);
387
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
388
+ if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
389
+ }, ownerDocument);
390
+ useEscapeKeydown((event) => {
391
+ const isHighestLayer = index === context.layers.size - 1;
392
+ if (!isHighestLayer) return;
393
+ onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
394
+ if (!event.defaultPrevented && onDismiss) {
395
+ event.preventDefault();
396
+ onDismiss();
397
+ }
398
+ }, ownerDocument);
399
+ React.useEffect(() => {
400
+ if (!node) return;
401
+ if (disableOutsidePointerEvents) {
402
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
403
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
404
+ ownerDocument.body.style.pointerEvents = "none";
405
+ }
406
+ context.layersWithOutsidePointerEventsDisabled.add(node);
407
+ }
408
+ context.layers.add(node);
409
+ dispatchUpdate();
410
+ return () => {
411
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
412
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
413
+ }
414
+ };
415
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
416
+ React.useEffect(() => {
417
+ return () => {
418
+ if (!node) return;
419
+ context.layers.delete(node);
420
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
421
+ dispatchUpdate();
422
+ };
423
+ }, [node, context]);
424
+ React.useEffect(() => {
425
+ const handleUpdate = () => force({});
426
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
427
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
428
+ }, []);
429
+ return /* @__PURE__ */ jsx(
430
+ Primitive.div,
431
+ {
432
+ ...layerProps,
433
+ ref: composedRefs,
434
+ style: {
435
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
436
+ ...props.style
437
+ },
438
+ onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
439
+ onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
440
+ onPointerDownCapture: composeEventHandlers(
441
+ props.onPointerDownCapture,
442
+ pointerDownOutside.onPointerDownCapture
443
+ )
444
+ }
445
+ );
446
+ }
447
+ );
448
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
449
+ var BRANCH_NAME = "DismissableLayerBranch";
450
+ var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
451
+ const context = React.useContext(DismissableLayerContext);
452
+ const ref = React.useRef(null);
453
+ const composedRefs = useComposedRefs$1(forwardedRef, ref);
454
+ React.useEffect(() => {
455
+ const node = ref.current;
456
+ if (node) {
457
+ context.branches.add(node);
458
+ return () => {
459
+ context.branches.delete(node);
460
+ };
461
+ }
462
+ }, [context.branches]);
463
+ return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
464
+ });
465
+ DismissableLayerBranch.displayName = BRANCH_NAME;
466
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
467
+ const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
468
+ const isPointerInsideReactTreeRef = React.useRef(false);
469
+ const handleClickRef = React.useRef(() => {
470
+ });
471
+ React.useEffect(() => {
472
+ const handlePointerDown = (event) => {
473
+ if (event.target && !isPointerInsideReactTreeRef.current) {
474
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
475
+ handleAndDispatchCustomEvent(
476
+ POINTER_DOWN_OUTSIDE,
477
+ handlePointerDownOutside,
478
+ eventDetail,
479
+ { discrete: true }
480
+ );
481
+ };
482
+ const eventDetail = { originalEvent: event };
483
+ if (event.pointerType === "touch") {
484
+ ownerDocument.removeEventListener("click", handleClickRef.current);
485
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
486
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
487
+ } else {
488
+ handleAndDispatchPointerDownOutsideEvent2();
489
+ }
490
+ } else {
491
+ ownerDocument.removeEventListener("click", handleClickRef.current);
492
+ }
493
+ isPointerInsideReactTreeRef.current = false;
494
+ };
495
+ const timerId = window.setTimeout(() => {
496
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
497
+ }, 0);
498
+ return () => {
499
+ window.clearTimeout(timerId);
500
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
501
+ ownerDocument.removeEventListener("click", handleClickRef.current);
502
+ };
503
+ }, [ownerDocument, handlePointerDownOutside]);
504
+ return {
505
+ // ensures we check React component tree (not just DOM tree)
506
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
507
+ };
508
+ }
509
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
510
+ const handleFocusOutside = useCallbackRef$1(onFocusOutside);
511
+ const isFocusInsideReactTreeRef = React.useRef(false);
512
+ React.useEffect(() => {
513
+ const handleFocus = (event) => {
514
+ if (event.target && !isFocusInsideReactTreeRef.current) {
515
+ const eventDetail = { originalEvent: event };
516
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
517
+ discrete: false
518
+ });
519
+ }
520
+ };
521
+ ownerDocument.addEventListener("focusin", handleFocus);
522
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
523
+ }, [ownerDocument, handleFocusOutside]);
524
+ return {
525
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
526
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
527
+ };
528
+ }
529
+ function dispatchUpdate() {
530
+ const event = new CustomEvent(CONTEXT_UPDATE);
531
+ document.dispatchEvent(event);
532
+ }
533
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
534
+ const target = detail.originalEvent.target;
535
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
536
+ if (handler) target.addEventListener(name, handler, { once: true });
537
+ if (discrete) {
538
+ dispatchDiscreteCustomEvent(target, event);
539
+ } else {
540
+ target.dispatchEvent(event);
541
+ }
542
+ }
543
+ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
544
+ var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
545
+ var EVENT_OPTIONS = { bubbles: false, cancelable: true };
546
+ var FOCUS_SCOPE_NAME = "FocusScope";
547
+ var FocusScope = React.forwardRef((props, forwardedRef) => {
548
+ const {
549
+ loop = false,
550
+ trapped = false,
551
+ onMountAutoFocus: onMountAutoFocusProp,
552
+ onUnmountAutoFocus: onUnmountAutoFocusProp,
553
+ ...scopeProps
554
+ } = props;
555
+ const [container, setContainer] = React.useState(null);
556
+ const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
557
+ const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
558
+ const lastFocusedElementRef = React.useRef(null);
559
+ const composedRefs = useComposedRefs$1(forwardedRef, (node) => setContainer(node));
560
+ const focusScope = React.useRef({
561
+ paused: false,
562
+ pause() {
563
+ this.paused = true;
564
+ },
565
+ resume() {
566
+ this.paused = false;
567
+ }
568
+ }).current;
569
+ React.useEffect(() => {
570
+ if (trapped) {
571
+ let handleFocusIn2 = function(event) {
572
+ if (focusScope.paused || !container) return;
573
+ const target = event.target;
574
+ if (container.contains(target)) {
575
+ lastFocusedElementRef.current = target;
576
+ } else {
577
+ focus(lastFocusedElementRef.current, { select: true });
578
+ }
579
+ }, handleFocusOut2 = function(event) {
580
+ if (focusScope.paused || !container) return;
581
+ const relatedTarget = event.relatedTarget;
582
+ if (relatedTarget === null) return;
583
+ if (!container.contains(relatedTarget)) {
584
+ focus(lastFocusedElementRef.current, { select: true });
585
+ }
586
+ }, handleMutations2 = function(mutations) {
587
+ const focusedElement = document.activeElement;
588
+ if (focusedElement !== document.body) return;
589
+ for (const mutation of mutations) {
590
+ if (mutation.removedNodes.length > 0) focus(container);
591
+ }
592
+ };
593
+ document.addEventListener("focusin", handleFocusIn2);
594
+ document.addEventListener("focusout", handleFocusOut2);
595
+ const mutationObserver = new MutationObserver(handleMutations2);
596
+ if (container) mutationObserver.observe(container, { childList: true, subtree: true });
597
+ return () => {
598
+ document.removeEventListener("focusin", handleFocusIn2);
599
+ document.removeEventListener("focusout", handleFocusOut2);
600
+ mutationObserver.disconnect();
601
+ };
602
+ }
603
+ }, [trapped, container, focusScope.paused]);
604
+ React.useEffect(() => {
605
+ if (container) {
606
+ focusScopesStack.add(focusScope);
607
+ const previouslyFocusedElement = document.activeElement;
608
+ const hasFocusedCandidate = container.contains(previouslyFocusedElement);
609
+ if (!hasFocusedCandidate) {
610
+ const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
611
+ container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
612
+ container.dispatchEvent(mountEvent);
613
+ if (!mountEvent.defaultPrevented) {
614
+ focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
615
+ if (document.activeElement === previouslyFocusedElement) {
616
+ focus(container);
617
+ }
618
+ }
619
+ }
620
+ return () => {
621
+ container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
622
+ setTimeout(() => {
623
+ const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
624
+ container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
625
+ container.dispatchEvent(unmountEvent);
626
+ if (!unmountEvent.defaultPrevented) {
627
+ focus(previouslyFocusedElement ?? document.body, { select: true });
628
+ }
629
+ container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
630
+ focusScopesStack.remove(focusScope);
631
+ }, 0);
632
+ };
633
+ }
634
+ }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
635
+ const handleKeyDown = React.useCallback(
636
+ (event) => {
637
+ if (!loop && !trapped) return;
638
+ if (focusScope.paused) return;
639
+ const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
640
+ const focusedElement = document.activeElement;
641
+ if (isTabKey && focusedElement) {
642
+ const container2 = event.currentTarget;
643
+ const [first, last] = getTabbableEdges(container2);
644
+ const hasTabbableElementsInside = first && last;
645
+ if (!hasTabbableElementsInside) {
646
+ if (focusedElement === container2) event.preventDefault();
647
+ } else {
648
+ if (!event.shiftKey && focusedElement === last) {
649
+ event.preventDefault();
650
+ if (loop) focus(first, { select: true });
651
+ } else if (event.shiftKey && focusedElement === first) {
652
+ event.preventDefault();
653
+ if (loop) focus(last, { select: true });
654
+ }
655
+ }
656
+ }
657
+ },
658
+ [loop, trapped, focusScope.paused]
659
+ );
660
+ return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
661
+ });
662
+ FocusScope.displayName = FOCUS_SCOPE_NAME;
663
+ function focusFirst(candidates, { select = false } = {}) {
664
+ const previouslyFocusedElement = document.activeElement;
665
+ for (const candidate of candidates) {
666
+ focus(candidate, { select });
667
+ if (document.activeElement !== previouslyFocusedElement) return;
668
+ }
669
+ }
670
+ function getTabbableEdges(container) {
671
+ const candidates = getTabbableCandidates(container);
672
+ const first = findVisible(candidates, container);
673
+ const last = findVisible(candidates.reverse(), container);
674
+ return [first, last];
675
+ }
676
+ function getTabbableCandidates(container) {
677
+ const nodes = [];
678
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
679
+ acceptNode: (node) => {
680
+ const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
681
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
682
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
683
+ }
684
+ });
685
+ while (walker.nextNode()) nodes.push(walker.currentNode);
686
+ return nodes;
687
+ }
688
+ function findVisible(elements, container) {
689
+ for (const element of elements) {
690
+ if (!isHidden(element, { upTo: container })) return element;
691
+ }
692
+ }
693
+ function isHidden(node, { upTo }) {
694
+ if (getComputedStyle(node).visibility === "hidden") return true;
695
+ while (node) {
696
+ if (upTo !== void 0 && node === upTo) return false;
697
+ if (getComputedStyle(node).display === "none") return true;
698
+ node = node.parentElement;
699
+ }
700
+ return false;
701
+ }
702
+ function isSelectableInput(element) {
703
+ return element instanceof HTMLInputElement && "select" in element;
704
+ }
705
+ function focus(element, { select = false } = {}) {
706
+ if (element && element.focus) {
707
+ const previouslyFocusedElement = document.activeElement;
708
+ element.focus({ preventScroll: true });
709
+ if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
710
+ element.select();
711
+ }
712
+ }
713
+ var focusScopesStack = createFocusScopesStack();
714
+ function createFocusScopesStack() {
715
+ let stack = [];
716
+ return {
717
+ add(focusScope) {
718
+ const activeFocusScope = stack[0];
719
+ if (focusScope !== activeFocusScope) {
720
+ activeFocusScope == null ? void 0 : activeFocusScope.pause();
721
+ }
722
+ stack = arrayRemove(stack, focusScope);
723
+ stack.unshift(focusScope);
724
+ },
725
+ remove(focusScope) {
726
+ var _a;
727
+ stack = arrayRemove(stack, focusScope);
728
+ (_a = stack[0]) == null ? void 0 : _a.resume();
729
+ }
730
+ };
731
+ }
732
+ function arrayRemove(array, item) {
733
+ const updatedArray = [...array];
734
+ const index = updatedArray.indexOf(item);
735
+ if (index !== -1) {
736
+ updatedArray.splice(index, 1);
737
+ }
738
+ return updatedArray;
739
+ }
740
+ function removeLinks(items) {
741
+ return items.filter((item) => item.tagName !== "A");
742
+ }
743
+ var PORTAL_NAME$1 = "Portal";
744
+ var Portal$2 = React.forwardRef((props, forwardedRef) => {
745
+ var _a;
746
+ const { container: containerProp, ...portalProps } = props;
747
+ const [mounted, setMounted] = React.useState(false);
748
+ useLayoutEffect2(() => setMounted(true), []);
749
+ const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
750
+ return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
751
+ });
752
+ Portal$2.displayName = PORTAL_NAME$1;
753
+ function useStateMachine(initialState, machine) {
754
+ return React.useReducer((state, event) => {
755
+ const nextState = machine[state][event];
756
+ return nextState ?? state;
757
+ }, initialState);
758
+ }
759
+ var Presence = (props) => {
760
+ const { present, children } = props;
761
+ const presence = usePresence(present);
762
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
763
+ const ref = useComposedRefs$1(presence.ref, getElementRef(child));
764
+ const forceMount = typeof children === "function";
765
+ return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
766
+ };
767
+ Presence.displayName = "Presence";
768
+ function usePresence(present) {
769
+ const [node, setNode] = React.useState();
770
+ const stylesRef = React.useRef(null);
771
+ const prevPresentRef = React.useRef(present);
772
+ const prevAnimationNameRef = React.useRef("none");
773
+ const initialState = present ? "mounted" : "unmounted";
774
+ const [state, send] = useStateMachine(initialState, {
775
+ mounted: {
776
+ UNMOUNT: "unmounted",
777
+ ANIMATION_OUT: "unmountSuspended"
778
+ },
779
+ unmountSuspended: {
780
+ MOUNT: "mounted",
781
+ ANIMATION_END: "unmounted"
782
+ },
783
+ unmounted: {
784
+ MOUNT: "mounted"
785
+ }
786
+ });
787
+ React.useEffect(() => {
788
+ const currentAnimationName = getAnimationName(stylesRef.current);
789
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
790
+ }, [state]);
791
+ useLayoutEffect2(() => {
792
+ const styles = stylesRef.current;
793
+ const wasPresent = prevPresentRef.current;
794
+ const hasPresentChanged = wasPresent !== present;
795
+ if (hasPresentChanged) {
796
+ const prevAnimationName = prevAnimationNameRef.current;
797
+ const currentAnimationName = getAnimationName(styles);
798
+ if (present) {
799
+ send("MOUNT");
800
+ } else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
801
+ send("UNMOUNT");
802
+ } else {
803
+ const isAnimating = prevAnimationName !== currentAnimationName;
804
+ if (wasPresent && isAnimating) {
805
+ send("ANIMATION_OUT");
806
+ } else {
807
+ send("UNMOUNT");
808
+ }
809
+ }
810
+ prevPresentRef.current = present;
811
+ }
812
+ }, [present, send]);
813
+ useLayoutEffect2(() => {
814
+ if (node) {
815
+ let timeoutId;
816
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
817
+ const handleAnimationEnd = (event) => {
818
+ const currentAnimationName = getAnimationName(stylesRef.current);
819
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
820
+ if (event.target === node && isCurrentAnimation) {
821
+ send("ANIMATION_END");
822
+ if (!prevPresentRef.current) {
823
+ const currentFillMode = node.style.animationFillMode;
824
+ node.style.animationFillMode = "forwards";
825
+ timeoutId = ownerWindow.setTimeout(() => {
826
+ if (node.style.animationFillMode === "forwards") {
827
+ node.style.animationFillMode = currentFillMode;
828
+ }
829
+ });
830
+ }
831
+ }
832
+ };
833
+ const handleAnimationStart = (event) => {
834
+ if (event.target === node) {
835
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
836
+ }
837
+ };
838
+ node.addEventListener("animationstart", handleAnimationStart);
839
+ node.addEventListener("animationcancel", handleAnimationEnd);
840
+ node.addEventListener("animationend", handleAnimationEnd);
841
+ return () => {
842
+ ownerWindow.clearTimeout(timeoutId);
843
+ node.removeEventListener("animationstart", handleAnimationStart);
844
+ node.removeEventListener("animationcancel", handleAnimationEnd);
845
+ node.removeEventListener("animationend", handleAnimationEnd);
846
+ };
847
+ } else {
848
+ send("ANIMATION_END");
849
+ }
850
+ }, [node, send]);
851
+ return {
852
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
853
+ ref: React.useCallback((node2) => {
854
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
855
+ setNode(node2);
856
+ }, [])
857
+ };
858
+ }
859
+ function getAnimationName(styles) {
860
+ return (styles == null ? void 0 : styles.animationName) || "none";
861
+ }
862
+ function getElementRef(element) {
863
+ var _a, _b;
864
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
865
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
866
+ if (mayWarn) {
867
+ return element.ref;
868
+ }
869
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
870
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
871
+ if (mayWarn) {
872
+ return element.props.ref;
873
+ }
874
+ return element.props.ref || element.ref;
875
+ }
876
+ var count = 0;
877
+ function useFocusGuards() {
878
+ React.useEffect(() => {
879
+ const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
880
+ document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
881
+ document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
882
+ count++;
883
+ return () => {
884
+ if (count === 1) {
885
+ document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
886
+ }
887
+ count--;
888
+ };
889
+ }, []);
890
+ }
891
+ function createFocusGuard() {
892
+ const element = document.createElement("span");
893
+ element.setAttribute("data-radix-focus-guard", "");
894
+ element.tabIndex = 0;
895
+ element.style.outline = "none";
896
+ element.style.opacity = "0";
897
+ element.style.position = "fixed";
898
+ element.style.pointerEvents = "none";
899
+ return element;
900
+ }
901
+ var getDefaultParent = function(originalTarget) {
902
+ if (typeof document === "undefined") {
903
+ return null;
904
+ }
905
+ var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
906
+ return sampleTarget.ownerDocument.body;
907
+ };
908
+ var counterMap = /* @__PURE__ */ new WeakMap();
909
+ var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
910
+ var markerMap = {};
911
+ var lockCount = 0;
912
+ var unwrapHost = function(node) {
913
+ return node && (node.host || unwrapHost(node.parentNode));
914
+ };
915
+ var correctTargets = function(parent, targets) {
916
+ return targets.map(function(target) {
917
+ if (parent.contains(target)) {
918
+ return target;
919
+ }
920
+ var correctedTarget = unwrapHost(target);
921
+ if (correctedTarget && parent.contains(correctedTarget)) {
922
+ return correctedTarget;
923
+ }
924
+ console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
925
+ return null;
926
+ }).filter(function(x) {
927
+ return Boolean(x);
928
+ });
929
+ };
930
+ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
931
+ var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
932
+ if (!markerMap[markerName]) {
933
+ markerMap[markerName] = /* @__PURE__ */ new WeakMap();
934
+ }
935
+ var markerCounter = markerMap[markerName];
936
+ var hiddenNodes = [];
937
+ var elementsToKeep = /* @__PURE__ */ new Set();
938
+ var elementsToStop = new Set(targets);
939
+ var keep = function(el) {
940
+ if (!el || elementsToKeep.has(el)) {
941
+ return;
942
+ }
943
+ elementsToKeep.add(el);
944
+ keep(el.parentNode);
945
+ };
946
+ targets.forEach(keep);
947
+ var deep = function(parent) {
948
+ if (!parent || elementsToStop.has(parent)) {
949
+ return;
950
+ }
951
+ Array.prototype.forEach.call(parent.children, function(node) {
952
+ if (elementsToKeep.has(node)) {
953
+ deep(node);
954
+ } else {
955
+ try {
956
+ var attr = node.getAttribute(controlAttribute);
957
+ var alreadyHidden = attr !== null && attr !== "false";
958
+ var counterValue = (counterMap.get(node) || 0) + 1;
959
+ var markerValue = (markerCounter.get(node) || 0) + 1;
960
+ counterMap.set(node, counterValue);
961
+ markerCounter.set(node, markerValue);
962
+ hiddenNodes.push(node);
963
+ if (counterValue === 1 && alreadyHidden) {
964
+ uncontrolledNodes.set(node, true);
965
+ }
966
+ if (markerValue === 1) {
967
+ node.setAttribute(markerName, "true");
968
+ }
969
+ if (!alreadyHidden) {
970
+ node.setAttribute(controlAttribute, "true");
971
+ }
972
+ } catch (e) {
973
+ console.error("aria-hidden: cannot operate on ", node, e);
974
+ }
975
+ }
976
+ });
977
+ };
978
+ deep(parentNode);
979
+ elementsToKeep.clear();
980
+ lockCount++;
981
+ return function() {
982
+ hiddenNodes.forEach(function(node) {
983
+ var counterValue = counterMap.get(node) - 1;
984
+ var markerValue = markerCounter.get(node) - 1;
985
+ counterMap.set(node, counterValue);
986
+ markerCounter.set(node, markerValue);
987
+ if (!counterValue) {
988
+ if (!uncontrolledNodes.has(node)) {
989
+ node.removeAttribute(controlAttribute);
990
+ }
991
+ uncontrolledNodes.delete(node);
992
+ }
993
+ if (!markerValue) {
994
+ node.removeAttribute(markerName);
995
+ }
996
+ });
997
+ lockCount--;
998
+ if (!lockCount) {
999
+ counterMap = /* @__PURE__ */ new WeakMap();
1000
+ counterMap = /* @__PURE__ */ new WeakMap();
1001
+ uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1002
+ markerMap = {};
1003
+ }
1004
+ };
1005
+ };
1006
+ var hideOthers = function(originalTarget, parentNode, markerName) {
1007
+ if (markerName === void 0) {
1008
+ markerName = "data-aria-hidden";
1009
+ }
1010
+ var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1011
+ var activeParentNode = getDefaultParent(originalTarget);
1012
+ if (!activeParentNode) {
1013
+ return function() {
1014
+ return null;
1015
+ };
1016
+ }
1017
+ targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
1018
+ return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
1019
+ };
1020
+ var DIALOG_NAME = "Dialog";
1021
+ var [createDialogContext] = createContextScope(DIALOG_NAME);
1022
+ var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
1023
+ var Dialog = (props) => {
1024
+ const {
1025
+ __scopeDialog,
1026
+ children,
1027
+ open: openProp,
1028
+ defaultOpen,
1029
+ onOpenChange,
1030
+ modal = true
1031
+ } = props;
1032
+ const triggerRef = React.useRef(null);
1033
+ const contentRef = React.useRef(null);
1034
+ const [open, setOpen] = useControllableState$1({
1035
+ prop: openProp,
1036
+ defaultProp: defaultOpen ?? false,
1037
+ onChange: onOpenChange,
1038
+ caller: DIALOG_NAME
1039
+ });
1040
+ return /* @__PURE__ */ jsx(
1041
+ DialogProvider,
1042
+ {
1043
+ scope: __scopeDialog,
1044
+ triggerRef,
1045
+ contentRef,
1046
+ contentId: useId(),
1047
+ titleId: useId(),
1048
+ descriptionId: useId(),
1049
+ open,
1050
+ onOpenChange: setOpen,
1051
+ onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
1052
+ modal,
1053
+ children
1054
+ }
1055
+ );
1056
+ };
1057
+ Dialog.displayName = DIALOG_NAME;
1058
+ var TRIGGER_NAME = "DialogTrigger";
1059
+ var DialogTrigger = React.forwardRef(
1060
+ (props, forwardedRef) => {
1061
+ const { __scopeDialog, ...triggerProps } = props;
1062
+ const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
1063
+ const composedTriggerRef = useComposedRefs$1(forwardedRef, context.triggerRef);
1064
+ return /* @__PURE__ */ jsx(
1065
+ Primitive.button,
1066
+ {
1067
+ type: "button",
1068
+ "aria-haspopup": "dialog",
1069
+ "aria-expanded": context.open,
1070
+ "aria-controls": context.contentId,
1071
+ "data-state": getState(context.open),
1072
+ ...triggerProps,
1073
+ ref: composedTriggerRef,
1074
+ onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
1075
+ }
1076
+ );
1077
+ }
1078
+ );
1079
+ DialogTrigger.displayName = TRIGGER_NAME;
1080
+ var PORTAL_NAME = "DialogPortal";
1081
+ var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
1082
+ forceMount: void 0
1083
+ });
1084
+ var DialogPortal = (props) => {
1085
+ const { __scopeDialog, forceMount, children, container } = props;
1086
+ const context = useDialogContext(PORTAL_NAME, __scopeDialog);
1087
+ return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$2, { asChild: true, container, children: child }) })) });
1088
+ };
1089
+ DialogPortal.displayName = PORTAL_NAME;
1090
+ var OVERLAY_NAME = "DialogOverlay";
1091
+ var DialogOverlay = React.forwardRef(
1092
+ (props, forwardedRef) => {
1093
+ const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
1094
+ const { forceMount = portalContext.forceMount, ...overlayProps } = props;
1095
+ const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
1096
+ return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
1097
+ }
1098
+ );
1099
+ DialogOverlay.displayName = OVERLAY_NAME;
1100
+ var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
1101
+ var DialogOverlayImpl = React.forwardRef(
1102
+ (props, forwardedRef) => {
1103
+ const { __scopeDialog, ...overlayProps } = props;
1104
+ const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
1105
+ return (
1106
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
1107
+ // ie. when `Overlay` and `Content` are siblings
1108
+ /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
1109
+ Primitive.div,
1110
+ {
1111
+ "data-state": getState(context.open),
1112
+ ...overlayProps,
1113
+ ref: forwardedRef,
1114
+ style: { pointerEvents: "auto", ...overlayProps.style }
1115
+ }
1116
+ ) })
1117
+ );
1118
+ }
1119
+ );
1120
+ var CONTENT_NAME = "DialogContent";
1121
+ var DialogContent = React.forwardRef(
1122
+ (props, forwardedRef) => {
1123
+ const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
1124
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
1125
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1126
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
1127
+ }
1128
+ );
1129
+ DialogContent.displayName = CONTENT_NAME;
1130
+ var DialogContentModal = React.forwardRef(
1131
+ (props, forwardedRef) => {
1132
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1133
+ const contentRef = React.useRef(null);
1134
+ const composedRefs = useComposedRefs$1(forwardedRef, context.contentRef, contentRef);
1135
+ React.useEffect(() => {
1136
+ const content = contentRef.current;
1137
+ if (content) return hideOthers(content);
1138
+ }, []);
1139
+ return /* @__PURE__ */ jsx(
1140
+ DialogContentImpl,
1141
+ {
1142
+ ...props,
1143
+ ref: composedRefs,
1144
+ trapFocus: context.open,
1145
+ disableOutsidePointerEvents: true,
1146
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
1147
+ var _a;
1148
+ event.preventDefault();
1149
+ (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
1150
+ }),
1151
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
1152
+ const originalEvent = event.detail.originalEvent;
1153
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
1154
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
1155
+ if (isRightClick) event.preventDefault();
1156
+ }),
1157
+ onFocusOutside: composeEventHandlers(
1158
+ props.onFocusOutside,
1159
+ (event) => event.preventDefault()
1160
+ )
1161
+ }
1162
+ );
1163
+ }
1164
+ );
1165
+ var DialogContentNonModal = React.forwardRef(
1166
+ (props, forwardedRef) => {
1167
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1168
+ const hasInteractedOutsideRef = React.useRef(false);
1169
+ const hasPointerDownOutsideRef = React.useRef(false);
1170
+ return /* @__PURE__ */ jsx(
1171
+ DialogContentImpl,
1172
+ {
1173
+ ...props,
1174
+ ref: forwardedRef,
1175
+ trapFocus: false,
1176
+ disableOutsidePointerEvents: false,
1177
+ onCloseAutoFocus: (event) => {
1178
+ var _a, _b;
1179
+ (_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
1180
+ if (!event.defaultPrevented) {
1181
+ if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
1182
+ event.preventDefault();
1183
+ }
1184
+ hasInteractedOutsideRef.current = false;
1185
+ hasPointerDownOutsideRef.current = false;
1186
+ },
1187
+ onInteractOutside: (event) => {
1188
+ var _a, _b;
1189
+ (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
1190
+ if (!event.defaultPrevented) {
1191
+ hasInteractedOutsideRef.current = true;
1192
+ if (event.detail.originalEvent.type === "pointerdown") {
1193
+ hasPointerDownOutsideRef.current = true;
1194
+ }
1195
+ }
1196
+ const target = event.target;
1197
+ const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
1198
+ if (targetIsTrigger) event.preventDefault();
1199
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
1200
+ event.preventDefault();
1201
+ }
1202
+ }
1203
+ }
1204
+ );
1205
+ }
1206
+ );
1207
+ var DialogContentImpl = React.forwardRef(
1208
+ (props, forwardedRef) => {
1209
+ const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
1210
+ const context = useDialogContext(CONTENT_NAME, __scopeDialog);
1211
+ const contentRef = React.useRef(null);
1212
+ const composedRefs = useComposedRefs$1(forwardedRef, contentRef);
1213
+ useFocusGuards();
1214
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1215
+ /* @__PURE__ */ jsx(
1216
+ FocusScope,
1217
+ {
1218
+ asChild: true,
1219
+ loop: true,
1220
+ trapped: trapFocus,
1221
+ onMountAutoFocus: onOpenAutoFocus,
1222
+ onUnmountAutoFocus: onCloseAutoFocus,
1223
+ children: /* @__PURE__ */ jsx(
1224
+ DismissableLayer,
1225
+ {
1226
+ role: "dialog",
1227
+ id: context.contentId,
1228
+ "aria-describedby": context.descriptionId,
1229
+ "aria-labelledby": context.titleId,
1230
+ "data-state": getState(context.open),
1231
+ ...contentProps,
1232
+ ref: composedRefs,
1233
+ onDismiss: () => context.onOpenChange(false)
1234
+ }
1235
+ )
1236
+ }
1237
+ ),
1238
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1239
+ /* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
1240
+ /* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
1241
+ ] })
1242
+ ] });
1243
+ }
1244
+ );
1245
+ var TITLE_NAME = "DialogTitle";
1246
+ var DialogTitle = React.forwardRef(
1247
+ (props, forwardedRef) => {
1248
+ const { __scopeDialog, ...titleProps } = props;
1249
+ const context = useDialogContext(TITLE_NAME, __scopeDialog);
1250
+ return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
1251
+ }
1252
+ );
1253
+ DialogTitle.displayName = TITLE_NAME;
1254
+ var DESCRIPTION_NAME = "DialogDescription";
1255
+ var DialogDescription = React.forwardRef(
1256
+ (props, forwardedRef) => {
1257
+ const { __scopeDialog, ...descriptionProps } = props;
1258
+ const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
1259
+ return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
1260
+ }
1261
+ );
1262
+ DialogDescription.displayName = DESCRIPTION_NAME;
1263
+ var CLOSE_NAME = "DialogClose";
1264
+ var DialogClose = React.forwardRef(
1265
+ (props, forwardedRef) => {
1266
+ const { __scopeDialog, ...closeProps } = props;
1267
+ const context = useDialogContext(CLOSE_NAME, __scopeDialog);
1268
+ return /* @__PURE__ */ jsx(
1269
+ Primitive.button,
1270
+ {
1271
+ type: "button",
1272
+ ...closeProps,
1273
+ ref: forwardedRef,
1274
+ onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
1275
+ }
1276
+ );
1277
+ }
1278
+ );
1279
+ DialogClose.displayName = CLOSE_NAME;
1280
+ function getState(open) {
1281
+ return open ? "open" : "closed";
1282
+ }
1283
+ var TITLE_WARNING_NAME = "DialogTitleWarning";
1284
+ var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
1285
+ contentName: CONTENT_NAME,
1286
+ titleName: TITLE_NAME,
1287
+ docsSlug: "dialog"
1288
+ });
1289
+ var TitleWarning = ({ titleId }) => {
1290
+ const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
1291
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
1292
+
1293
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
1294
+
1295
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
1296
+ React.useEffect(() => {
1297
+ if (titleId) {
1298
+ const hasTitle = document.getElementById(titleId);
1299
+ if (!hasTitle) console.error(MESSAGE);
1300
+ }
1301
+ }, [MESSAGE, titleId]);
1302
+ return null;
1303
+ };
1304
+ var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
1305
+ var DescriptionWarning = ({ contentRef, descriptionId }) => {
1306
+ const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
1307
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
1308
+ React.useEffect(() => {
1309
+ var _a;
1310
+ const describedById = (_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby");
1311
+ if (descriptionId && describedById) {
1312
+ const hasDescription = document.getElementById(descriptionId);
1313
+ if (!hasDescription) console.warn(MESSAGE);
1314
+ }
1315
+ }, [MESSAGE, contentRef, descriptionId]);
1316
+ return null;
1317
+ };
1318
+ var Root$1 = Dialog;
1319
+ var Portal$1 = DialogPortal;
1320
+ var Overlay$1 = DialogOverlay;
1321
+ var Content$1 = DialogContent;
1322
+ function __insertCSS(code) {
1323
+ if (typeof document == "undefined") return;
1324
+ let head = document.head || document.getElementsByTagName("head")[0];
1325
+ let style = document.createElement("style");
1326
+ style.type = "text/css";
1327
+ head.appendChild(style);
1328
+ style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
1329
+ }
1330
+ const DrawerContext = React__default.createContext({
1331
+ drawerRef: {
1332
+ current: null
1333
+ },
1334
+ overlayRef: {
1335
+ current: null
1336
+ },
1337
+ onPress: () => {
1338
+ },
1339
+ onRelease: () => {
1340
+ },
1341
+ onDrag: () => {
1342
+ },
1343
+ onNestedDrag: () => {
1344
+ },
1345
+ onNestedOpenChange: () => {
1346
+ },
1347
+ onNestedRelease: () => {
1348
+ },
1349
+ openProp: void 0,
1350
+ dismissible: false,
1351
+ isOpen: false,
1352
+ isDragging: false,
1353
+ keyboardIsOpen: {
1354
+ current: false
1355
+ },
1356
+ snapPointsOffset: null,
1357
+ snapPoints: null,
1358
+ handleOnly: false,
1359
+ modal: false,
1360
+ shouldFade: false,
1361
+ activeSnapPoint: null,
1362
+ onOpenChange: () => {
1363
+ },
1364
+ setActiveSnapPoint: () => {
1365
+ },
1366
+ closeDrawer: () => {
1367
+ },
1368
+ direction: "bottom",
1369
+ shouldAnimate: {
1370
+ current: true
1371
+ },
1372
+ shouldScaleBackground: false,
1373
+ setBackgroundColorOnScale: true,
1374
+ noBodyStyles: false,
1375
+ container: null,
1376
+ autoFocus: false
1377
+ });
1378
+ const useDrawerContext = () => {
1379
+ const context = React__default.useContext(DrawerContext);
1380
+ if (!context) {
1381
+ throw new Error("useDrawerContext must be used within a Drawer.Root");
1382
+ }
1383
+ return context;
1384
+ };
1385
+ __insertCSS("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");
1386
+ function isMobileFirefox() {
1387
+ const userAgent = navigator.userAgent;
1388
+ return typeof window !== "undefined" && (/Firefox/.test(userAgent) && /Mobile/.test(userAgent) || // Android Firefox
1389
+ /FxiOS/.test(userAgent));
1390
+ }
1391
+ function isMac() {
1392
+ return testPlatform(/^Mac/);
1393
+ }
1394
+ function isIPhone() {
1395
+ return testPlatform(/^iPhone/);
1396
+ }
1397
+ function isSafari() {
1398
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
1399
+ }
1400
+ function isIPad() {
1401
+ return testPlatform(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
1402
+ isMac() && navigator.maxTouchPoints > 1;
1403
+ }
1404
+ function isIOS() {
1405
+ return isIPhone() || isIPad();
1406
+ }
1407
+ function testPlatform(re) {
1408
+ return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform) : void 0;
1409
+ }
1410
+ const KEYBOARD_BUFFER = 24;
1411
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
1412
+ function chain$1(...callbacks) {
1413
+ return (...args) => {
1414
+ for (let callback of callbacks) {
1415
+ if (typeof callback === "function") {
1416
+ callback(...args);
1417
+ }
1418
+ }
1419
+ };
1420
+ }
1421
+ const visualViewport = typeof document !== "undefined" && window.visualViewport;
1422
+ function isScrollable(node) {
1423
+ let style = window.getComputedStyle(node);
1424
+ return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
1425
+ }
1426
+ function getScrollParent(node) {
1427
+ if (isScrollable(node)) {
1428
+ node = node.parentElement;
1429
+ }
1430
+ while (node && !isScrollable(node)) {
1431
+ node = node.parentElement;
1432
+ }
1433
+ return node || document.scrollingElement || document.documentElement;
1434
+ }
1435
+ const nonTextInputTypes = /* @__PURE__ */ new Set([
1436
+ "checkbox",
1437
+ "radio",
1438
+ "range",
1439
+ "color",
1440
+ "file",
1441
+ "image",
1442
+ "button",
1443
+ "submit",
1444
+ "reset"
1445
+ ]);
1446
+ let preventScrollCount = 0;
1447
+ let restore;
1448
+ function usePreventScroll(options = {}) {
1449
+ let { isDisabled } = options;
1450
+ useIsomorphicLayoutEffect(() => {
1451
+ if (isDisabled) {
1452
+ return;
1453
+ }
1454
+ preventScrollCount++;
1455
+ if (preventScrollCount === 1) {
1456
+ if (isIOS()) {
1457
+ restore = preventScrollMobileSafari();
1458
+ }
1459
+ }
1460
+ return () => {
1461
+ preventScrollCount--;
1462
+ if (preventScrollCount === 0) {
1463
+ restore == null ? void 0 : restore();
1464
+ }
1465
+ };
1466
+ }, [
1467
+ isDisabled
1468
+ ]);
1469
+ }
1470
+ function preventScrollMobileSafari() {
1471
+ let scrollable;
1472
+ let lastY = 0;
1473
+ let onTouchStart = (e) => {
1474
+ scrollable = getScrollParent(e.target);
1475
+ if (scrollable === document.documentElement && scrollable === document.body) {
1476
+ return;
1477
+ }
1478
+ lastY = e.changedTouches[0].pageY;
1479
+ };
1480
+ let onTouchMove = (e) => {
1481
+ if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
1482
+ e.preventDefault();
1483
+ return;
1484
+ }
1485
+ let y = e.changedTouches[0].pageY;
1486
+ let scrollTop = scrollable.scrollTop;
1487
+ let bottom = scrollable.scrollHeight - scrollable.clientHeight;
1488
+ if (bottom === 0) {
1489
+ return;
1490
+ }
1491
+ if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) {
1492
+ e.preventDefault();
1493
+ }
1494
+ lastY = y;
1495
+ };
1496
+ let onTouchEnd = (e) => {
1497
+ let target = e.target;
1498
+ if (isInput(target) && target !== document.activeElement) {
1499
+ e.preventDefault();
1500
+ target.style.transform = "translateY(-2000px)";
1501
+ target.focus();
1502
+ requestAnimationFrame(() => {
1503
+ target.style.transform = "";
1504
+ });
1505
+ }
1506
+ };
1507
+ let onFocus = (e) => {
1508
+ let target = e.target;
1509
+ if (isInput(target)) {
1510
+ target.style.transform = "translateY(-2000px)";
1511
+ requestAnimationFrame(() => {
1512
+ target.style.transform = "";
1513
+ if (visualViewport) {
1514
+ if (visualViewport.height < window.innerHeight) {
1515
+ requestAnimationFrame(() => {
1516
+ scrollIntoView(target);
1517
+ });
1518
+ } else {
1519
+ visualViewport.addEventListener("resize", () => scrollIntoView(target), {
1520
+ once: true
1521
+ });
1522
+ }
1523
+ }
1524
+ });
1525
+ }
1526
+ };
1527
+ let onWindowScroll = () => {
1528
+ window.scrollTo(0, 0);
1529
+ };
1530
+ let scrollX = window.pageXOffset;
1531
+ let scrollY = window.pageYOffset;
1532
+ let restoreStyles = chain$1(setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
1533
+ window.scrollTo(0, 0);
1534
+ let removeEvents = chain$1(addEvent(document, "touchstart", onTouchStart, {
1535
+ passive: false,
1536
+ capture: true
1537
+ }), addEvent(document, "touchmove", onTouchMove, {
1538
+ passive: false,
1539
+ capture: true
1540
+ }), addEvent(document, "touchend", onTouchEnd, {
1541
+ passive: false,
1542
+ capture: true
1543
+ }), addEvent(document, "focus", onFocus, true), addEvent(window, "scroll", onWindowScroll));
1544
+ return () => {
1545
+ restoreStyles();
1546
+ removeEvents();
1547
+ window.scrollTo(scrollX, scrollY);
1548
+ };
1549
+ }
1550
+ function setStyle(element, style, value) {
1551
+ let cur = element.style[style];
1552
+ element.style[style] = value;
1553
+ return () => {
1554
+ element.style[style] = cur;
1555
+ };
1556
+ }
1557
+ function addEvent(target, event, handler, options) {
1558
+ target.addEventListener(event, handler, options);
1559
+ return () => {
1560
+ target.removeEventListener(event, handler, options);
1561
+ };
1562
+ }
1563
+ function scrollIntoView(target) {
1564
+ let root = document.scrollingElement || document.documentElement;
1565
+ while (target && target !== root) {
1566
+ let scrollable = getScrollParent(target);
1567
+ if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
1568
+ let scrollableTop = scrollable.getBoundingClientRect().top;
1569
+ let targetTop = target.getBoundingClientRect().top;
1570
+ let targetBottom = target.getBoundingClientRect().bottom;
1571
+ const keyboardHeight = scrollable.getBoundingClientRect().bottom + KEYBOARD_BUFFER;
1572
+ if (targetBottom > keyboardHeight) {
1573
+ scrollable.scrollTop += targetTop - scrollableTop;
1574
+ }
1575
+ }
1576
+ target = scrollable.parentElement;
1577
+ }
1578
+ }
1579
+ function isInput(target) {
1580
+ return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
1581
+ }
1582
+ function setRef(ref, value) {
1583
+ if (typeof ref === "function") {
1584
+ ref(value);
1585
+ } else if (ref !== null && ref !== void 0) {
1586
+ ref.current = value;
1587
+ }
1588
+ }
1589
+ function composeRefs(...refs) {
1590
+ return (node) => refs.forEach((ref) => setRef(ref, node));
1591
+ }
1592
+ function useComposedRefs(...refs) {
1593
+ return React.useCallback(composeRefs(...refs), refs);
1594
+ }
1595
+ const cache = /* @__PURE__ */ new WeakMap();
1596
+ function set(el, styles, ignoreCache = false) {
1597
+ if (!el || !(el instanceof HTMLElement)) return;
1598
+ let originalStyles = {};
1599
+ Object.entries(styles).forEach(([key, value]) => {
1600
+ if (key.startsWith("--")) {
1601
+ el.style.setProperty(key, value);
1602
+ return;
1603
+ }
1604
+ originalStyles[key] = el.style[key];
1605
+ el.style[key] = value;
1606
+ });
1607
+ if (ignoreCache) return;
1608
+ cache.set(el, originalStyles);
1609
+ }
1610
+ function reset(el, prop) {
1611
+ if (!el || !(el instanceof HTMLElement)) return;
1612
+ let originalStyles = cache.get(el);
1613
+ if (!originalStyles) {
1614
+ return;
1615
+ }
1616
+ {
1617
+ el.style[prop] = originalStyles[prop];
1618
+ }
1619
+ }
1620
+ const isVertical = (direction) => {
1621
+ switch (direction) {
1622
+ case "top":
1623
+ case "bottom":
1624
+ return true;
1625
+ case "left":
1626
+ case "right":
1627
+ return false;
1628
+ default:
1629
+ return direction;
1630
+ }
1631
+ };
1632
+ function getTranslate(element, direction) {
1633
+ if (!element) {
1634
+ return null;
1635
+ }
1636
+ const style = window.getComputedStyle(element);
1637
+ const transform = (
1638
+ // @ts-ignore
1639
+ style.transform || style.webkitTransform || style.mozTransform
1640
+ );
1641
+ let mat = transform.match(/^matrix3d\((.+)\)$/);
1642
+ if (mat) {
1643
+ return parseFloat(mat[1].split(", ")[isVertical(direction) ? 13 : 12]);
1644
+ }
1645
+ mat = transform.match(/^matrix\((.+)\)$/);
1646
+ return mat ? parseFloat(mat[1].split(", ")[isVertical(direction) ? 5 : 4]) : null;
1647
+ }
1648
+ function dampenValue(v) {
1649
+ return 8 * (Math.log(v + 1) - 2);
1650
+ }
1651
+ function assignStyle(element, style) {
1652
+ if (!element) return () => {
1653
+ };
1654
+ const prevStyle = element.style.cssText;
1655
+ Object.assign(element.style, style);
1656
+ return () => {
1657
+ element.style.cssText = prevStyle;
1658
+ };
1659
+ }
1660
+ function chain(...fns) {
1661
+ return (...args) => {
1662
+ for (const fn of fns) {
1663
+ if (typeof fn === "function") {
1664
+ fn(...args);
1665
+ }
1666
+ }
1667
+ };
1668
+ }
1669
+ const TRANSITIONS = {
1670
+ DURATION: 0.5,
1671
+ EASE: [
1672
+ 0.32,
1673
+ 0.72,
1674
+ 0,
1675
+ 1
1676
+ ]
1677
+ };
1678
+ const VELOCITY_THRESHOLD = 0.4;
1679
+ const CLOSE_THRESHOLD = 0.25;
1680
+ const SCROLL_LOCK_TIMEOUT = 100;
1681
+ const BORDER_RADIUS = 8;
1682
+ const NESTED_DISPLACEMENT = 16;
1683
+ const WINDOW_TOP_OFFSET = 26;
1684
+ const DRAG_CLASS = "vaul-dragging";
1685
+ function useCallbackRef(callback) {
1686
+ const callbackRef = React__default.useRef(callback);
1687
+ React__default.useEffect(() => {
1688
+ callbackRef.current = callback;
1689
+ });
1690
+ return React__default.useMemo(() => (...args) => callbackRef.current == null ? void 0 : callbackRef.current.call(callbackRef, ...args), []);
1691
+ }
1692
+ function useUncontrolledState({ defaultProp, onChange }) {
1693
+ const uncontrolledState = React__default.useState(defaultProp);
1694
+ const [value] = uncontrolledState;
1695
+ const prevValueRef = React__default.useRef(value);
1696
+ const handleChange = useCallbackRef(onChange);
1697
+ React__default.useEffect(() => {
1698
+ if (prevValueRef.current !== value) {
1699
+ handleChange(value);
1700
+ prevValueRef.current = value;
1701
+ }
1702
+ }, [
1703
+ value,
1704
+ prevValueRef,
1705
+ handleChange
1706
+ ]);
1707
+ return uncontrolledState;
1708
+ }
1709
+ function useControllableState({ prop, defaultProp, onChange = () => {
1710
+ } }) {
1711
+ const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({
1712
+ defaultProp,
1713
+ onChange
1714
+ });
1715
+ const isControlled = prop !== void 0;
1716
+ const value = isControlled ? prop : uncontrolledProp;
1717
+ const handleChange = useCallbackRef(onChange);
1718
+ const setValue = React__default.useCallback((nextValue) => {
1719
+ if (isControlled) {
1720
+ const setter = nextValue;
1721
+ const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
1722
+ if (value2 !== prop) handleChange(value2);
1723
+ } else {
1724
+ setUncontrolledProp(nextValue);
1725
+ }
1726
+ }, [
1727
+ isControlled,
1728
+ prop,
1729
+ setUncontrolledProp,
1730
+ handleChange
1731
+ ]);
1732
+ return [
1733
+ value,
1734
+ setValue
1735
+ ];
1736
+ }
1737
+ function useSnapPoints({ activeSnapPointProp, setActiveSnapPointProp, snapPoints, drawerRef, overlayRef, fadeFromIndex, onSnapPointChange, direction = "bottom", container, snapToSequentialPoint }) {
1738
+ const [activeSnapPoint, setActiveSnapPoint] = useControllableState({
1739
+ prop: activeSnapPointProp,
1740
+ defaultProp: snapPoints == null ? void 0 : snapPoints[0],
1741
+ onChange: setActiveSnapPointProp
1742
+ });
1743
+ const [windowDimensions, setWindowDimensions] = React__default.useState(typeof window !== "undefined" ? {
1744
+ innerWidth: window.innerWidth,
1745
+ innerHeight: window.innerHeight
1746
+ } : void 0);
1747
+ React__default.useEffect(() => {
1748
+ function onResize() {
1749
+ setWindowDimensions({
1750
+ innerWidth: window.innerWidth,
1751
+ innerHeight: window.innerHeight
1752
+ });
1753
+ }
1754
+ window.addEventListener("resize", onResize);
1755
+ return () => window.removeEventListener("resize", onResize);
1756
+ }, []);
1757
+ const isLastSnapPoint = React__default.useMemo(() => activeSnapPoint === (snapPoints == null ? void 0 : snapPoints[snapPoints.length - 1]) || null, [
1758
+ snapPoints,
1759
+ activeSnapPoint
1760
+ ]);
1761
+ const activeSnapPointIndex = React__default.useMemo(() => {
1762
+ var _snapPoints_findIndex;
1763
+ return (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint) => snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : null;
1764
+ }, [
1765
+ snapPoints,
1766
+ activeSnapPoint
1767
+ ]);
1768
+ const shouldFade = snapPoints && snapPoints.length > 0 && (fadeFromIndex || fadeFromIndex === 0) && !Number.isNaN(fadeFromIndex) && snapPoints[fadeFromIndex] === activeSnapPoint || !snapPoints;
1769
+ const snapPointsOffset = React__default.useMemo(() => {
1770
+ const containerSize = container ? {
1771
+ width: container.getBoundingClientRect().width,
1772
+ height: container.getBoundingClientRect().height
1773
+ } : typeof window !== "undefined" ? {
1774
+ width: window.innerWidth,
1775
+ height: window.innerHeight
1776
+ } : {
1777
+ width: 0,
1778
+ height: 0
1779
+ };
1780
+ var _snapPoints_map;
1781
+ return (_snapPoints_map = snapPoints == null ? void 0 : snapPoints.map((snapPoint) => {
1782
+ const isPx = typeof snapPoint === "string";
1783
+ let snapPointAsNumber = 0;
1784
+ if (isPx) {
1785
+ snapPointAsNumber = parseInt(snapPoint, 10);
1786
+ }
1787
+ if (isVertical(direction)) {
1788
+ const height = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.height : 0;
1789
+ if (windowDimensions) {
1790
+ return direction === "bottom" ? containerSize.height - height : -containerSize.height + height;
1791
+ }
1792
+ return height;
1793
+ }
1794
+ const width = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.width : 0;
1795
+ if (windowDimensions) {
1796
+ return direction === "right" ? containerSize.width - width : -containerSize.width + width;
1797
+ }
1798
+ return width;
1799
+ })) != null ? _snapPoints_map : [];
1800
+ }, [
1801
+ snapPoints,
1802
+ windowDimensions,
1803
+ container
1804
+ ]);
1805
+ const activeSnapPointOffset = React__default.useMemo(() => activeSnapPointIndex !== null ? snapPointsOffset == null ? void 0 : snapPointsOffset[activeSnapPointIndex] : null, [
1806
+ snapPointsOffset,
1807
+ activeSnapPointIndex
1808
+ ]);
1809
+ const snapToPoint = React__default.useCallback((dimension) => {
1810
+ var _snapPointsOffset_findIndex;
1811
+ const newSnapPointIndex = (_snapPointsOffset_findIndex = snapPointsOffset == null ? void 0 : snapPointsOffset.findIndex((snapPointDim) => snapPointDim === dimension)) != null ? _snapPointsOffset_findIndex : null;
1812
+ onSnapPointChange(newSnapPointIndex);
1813
+ set(drawerRef.current, {
1814
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
1815
+ transform: isVertical(direction) ? `translate3d(0, ${dimension}px, 0)` : `translate3d(${dimension}px, 0, 0)`
1816
+ });
1817
+ if (snapPointsOffset && newSnapPointIndex !== snapPointsOffset.length - 1 && fadeFromIndex !== void 0 && newSnapPointIndex !== fadeFromIndex && newSnapPointIndex < fadeFromIndex) {
1818
+ set(overlayRef.current, {
1819
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
1820
+ opacity: "0"
1821
+ });
1822
+ } else {
1823
+ set(overlayRef.current, {
1824
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
1825
+ opacity: "1"
1826
+ });
1827
+ }
1828
+ setActiveSnapPoint(snapPoints == null ? void 0 : snapPoints[Math.max(newSnapPointIndex, 0)]);
1829
+ }, [
1830
+ drawerRef.current,
1831
+ snapPoints,
1832
+ snapPointsOffset,
1833
+ fadeFromIndex,
1834
+ overlayRef,
1835
+ setActiveSnapPoint
1836
+ ]);
1837
+ React__default.useEffect(() => {
1838
+ if (activeSnapPoint || activeSnapPointProp) {
1839
+ var _snapPoints_findIndex;
1840
+ const newIndex = (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint) => snapPoint === activeSnapPointProp || snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : -1;
1841
+ if (snapPointsOffset && newIndex !== -1 && typeof snapPointsOffset[newIndex] === "number") {
1842
+ snapToPoint(snapPointsOffset[newIndex]);
1843
+ }
1844
+ }
1845
+ }, [
1846
+ activeSnapPoint,
1847
+ activeSnapPointProp,
1848
+ snapPoints,
1849
+ snapPointsOffset,
1850
+ snapToPoint
1851
+ ]);
1852
+ function onRelease({ draggedDistance, closeDrawer, velocity, dismissible }) {
1853
+ if (fadeFromIndex === void 0) return;
1854
+ const currentPosition = direction === "bottom" || direction === "right" ? (activeSnapPointOffset != null ? activeSnapPointOffset : 0) - draggedDistance : (activeSnapPointOffset != null ? activeSnapPointOffset : 0) + draggedDistance;
1855
+ const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;
1856
+ const isFirst = activeSnapPointIndex === 0;
1857
+ const hasDraggedUp = draggedDistance > 0;
1858
+ if (isOverlaySnapPoint) {
1859
+ set(overlayRef.current, {
1860
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`
1861
+ });
1862
+ }
1863
+ if (!snapToSequentialPoint && velocity > 2 && !hasDraggedUp) {
1864
+ if (dismissible) closeDrawer();
1865
+ else snapToPoint(snapPointsOffset[0]);
1866
+ return;
1867
+ }
1868
+ if (!snapToSequentialPoint && velocity > 2 && hasDraggedUp && snapPointsOffset && snapPoints) {
1869
+ snapToPoint(snapPointsOffset[snapPoints.length - 1]);
1870
+ return;
1871
+ }
1872
+ const closestSnapPoint = snapPointsOffset == null ? void 0 : snapPointsOffset.reduce((prev, curr) => {
1873
+ if (typeof prev !== "number" || typeof curr !== "number") return prev;
1874
+ return Math.abs(curr - currentPosition) < Math.abs(prev - currentPosition) ? curr : prev;
1875
+ });
1876
+ const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;
1877
+ if (velocity > VELOCITY_THRESHOLD && Math.abs(draggedDistance) < dim * 0.4) {
1878
+ const dragDirection = hasDraggedUp ? 1 : -1;
1879
+ if (dragDirection > 0 && isLastSnapPoint && snapPoints) {
1880
+ snapToPoint(snapPointsOffset[snapPoints.length - 1]);
1881
+ return;
1882
+ }
1883
+ if (isFirst && dragDirection < 0 && dismissible) {
1884
+ closeDrawer();
1885
+ }
1886
+ if (activeSnapPointIndex === null) return;
1887
+ snapToPoint(snapPointsOffset[activeSnapPointIndex + dragDirection]);
1888
+ return;
1889
+ }
1890
+ snapToPoint(closestSnapPoint);
1891
+ }
1892
+ function onDrag({ draggedDistance }) {
1893
+ if (activeSnapPointOffset === null) return;
1894
+ const newValue = direction === "bottom" || direction === "right" ? activeSnapPointOffset - draggedDistance : activeSnapPointOffset + draggedDistance;
1895
+ if ((direction === "bottom" || direction === "right") && newValue < snapPointsOffset[snapPointsOffset.length - 1]) {
1896
+ return;
1897
+ }
1898
+ if ((direction === "top" || direction === "left") && newValue > snapPointsOffset[snapPointsOffset.length - 1]) {
1899
+ return;
1900
+ }
1901
+ set(drawerRef.current, {
1902
+ transform: isVertical(direction) ? `translate3d(0, ${newValue}px, 0)` : `translate3d(${newValue}px, 0, 0)`
1903
+ });
1904
+ }
1905
+ function getPercentageDragged(absDraggedDistance, isDraggingDown) {
1906
+ if (!snapPoints || typeof activeSnapPointIndex !== "number" || !snapPointsOffset || fadeFromIndex === void 0) return null;
1907
+ const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;
1908
+ const isOverlaySnapPointOrHigher = activeSnapPointIndex >= fadeFromIndex;
1909
+ if (isOverlaySnapPointOrHigher && isDraggingDown) {
1910
+ return 0;
1911
+ }
1912
+ if (isOverlaySnapPoint && !isDraggingDown) return 1;
1913
+ if (!shouldFade && !isOverlaySnapPoint) return null;
1914
+ const targetSnapPointIndex = isOverlaySnapPoint ? activeSnapPointIndex + 1 : activeSnapPointIndex - 1;
1915
+ const snapPointDistance = isOverlaySnapPoint ? snapPointsOffset[targetSnapPointIndex] - snapPointsOffset[targetSnapPointIndex - 1] : snapPointsOffset[targetSnapPointIndex + 1] - snapPointsOffset[targetSnapPointIndex];
1916
+ const percentageDragged = absDraggedDistance / Math.abs(snapPointDistance);
1917
+ if (isOverlaySnapPoint) {
1918
+ return 1 - percentageDragged;
1919
+ } else {
1920
+ return percentageDragged;
1921
+ }
1922
+ }
1923
+ return {
1924
+ isLastSnapPoint,
1925
+ activeSnapPoint,
1926
+ shouldFade,
1927
+ getPercentageDragged,
1928
+ setActiveSnapPoint,
1929
+ activeSnapPointIndex,
1930
+ onRelease,
1931
+ onDrag,
1932
+ snapPointsOffset
1933
+ };
1934
+ }
1935
+ const noop = () => () => {
1936
+ };
1937
+ function useScaleBackground() {
1938
+ const { direction, isOpen, shouldScaleBackground, setBackgroundColorOnScale, noBodyStyles } = useDrawerContext();
1939
+ const timeoutIdRef = React__default.useRef(null);
1940
+ const initialBackgroundColor = useMemo(() => document.body.style.backgroundColor, []);
1941
+ function getScale() {
1942
+ return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
1943
+ }
1944
+ React__default.useEffect(() => {
1945
+ if (isOpen && shouldScaleBackground) {
1946
+ if (timeoutIdRef.current) clearTimeout(timeoutIdRef.current);
1947
+ const wrapper = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
1948
+ if (!wrapper) return;
1949
+ chain(setBackgroundColorOnScale && !noBodyStyles ? assignStyle(document.body, {
1950
+ background: "black"
1951
+ }) : noop, assignStyle(wrapper, {
1952
+ transformOrigin: isVertical(direction) ? "top" : "left",
1953
+ transitionProperty: "transform, border-radius",
1954
+ transitionDuration: `${TRANSITIONS.DURATION}s`,
1955
+ transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(",")})`
1956
+ }));
1957
+ const wrapperStylesCleanup = assignStyle(wrapper, {
1958
+ borderRadius: `${BORDER_RADIUS}px`,
1959
+ overflow: "hidden",
1960
+ ...isVertical(direction) ? {
1961
+ transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`
1962
+ } : {
1963
+ transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`
1964
+ }
1965
+ });
1966
+ return () => {
1967
+ wrapperStylesCleanup();
1968
+ timeoutIdRef.current = window.setTimeout(() => {
1969
+ if (initialBackgroundColor) {
1970
+ document.body.style.background = initialBackgroundColor;
1971
+ } else {
1972
+ document.body.style.removeProperty("background");
1973
+ }
1974
+ }, TRANSITIONS.DURATION * 1e3);
1975
+ };
1976
+ }
1977
+ }, [
1978
+ isOpen,
1979
+ shouldScaleBackground,
1980
+ initialBackgroundColor
1981
+ ]);
1982
+ }
1983
+ let previousBodyPosition = null;
1984
+ function usePositionFixed({ isOpen, modal, nested, hasBeenOpened, preventScrollRestoration, noBodyStyles }) {
1985
+ const [activeUrl, setActiveUrl] = React__default.useState(() => typeof window !== "undefined" ? window.location.href : "");
1986
+ const scrollPos = React__default.useRef(0);
1987
+ const setPositionFixed = React__default.useCallback(() => {
1988
+ if (!isSafari()) return;
1989
+ if (previousBodyPosition === null && isOpen && !noBodyStyles) {
1990
+ previousBodyPosition = {
1991
+ position: document.body.style.position,
1992
+ top: document.body.style.top,
1993
+ left: document.body.style.left,
1994
+ height: document.body.style.height,
1995
+ right: "unset"
1996
+ };
1997
+ const { scrollX, innerHeight } = window;
1998
+ document.body.style.setProperty("position", "fixed", "important");
1999
+ Object.assign(document.body.style, {
2000
+ top: `${-scrollPos.current}px`,
2001
+ left: `${-scrollX}px`,
2002
+ right: "0px",
2003
+ height: "auto"
2004
+ });
2005
+ window.setTimeout(() => window.requestAnimationFrame(() => {
2006
+ const bottomBarHeight = innerHeight - window.innerHeight;
2007
+ if (bottomBarHeight && scrollPos.current >= innerHeight) {
2008
+ document.body.style.top = `${-(scrollPos.current + bottomBarHeight)}px`;
2009
+ }
2010
+ }), 300);
2011
+ }
2012
+ }, [
2013
+ isOpen
2014
+ ]);
2015
+ const restorePositionSetting = React__default.useCallback(() => {
2016
+ if (!isSafari()) return;
2017
+ if (previousBodyPosition !== null && !noBodyStyles) {
2018
+ const y = -parseInt(document.body.style.top, 10);
2019
+ const x = -parseInt(document.body.style.left, 10);
2020
+ Object.assign(document.body.style, previousBodyPosition);
2021
+ window.requestAnimationFrame(() => {
2022
+ if (preventScrollRestoration && activeUrl !== window.location.href) {
2023
+ setActiveUrl(window.location.href);
2024
+ return;
2025
+ }
2026
+ window.scrollTo(x, y);
2027
+ });
2028
+ previousBodyPosition = null;
2029
+ }
2030
+ }, [
2031
+ activeUrl
2032
+ ]);
2033
+ React__default.useEffect(() => {
2034
+ function onScroll() {
2035
+ scrollPos.current = window.scrollY;
2036
+ }
2037
+ onScroll();
2038
+ window.addEventListener("scroll", onScroll);
2039
+ return () => {
2040
+ window.removeEventListener("scroll", onScroll);
2041
+ };
2042
+ }, []);
2043
+ React__default.useEffect(() => {
2044
+ if (!modal) return;
2045
+ return () => {
2046
+ if (typeof document === "undefined") return;
2047
+ const hasDrawerOpened = !!document.querySelector("[data-vaul-drawer]");
2048
+ if (hasDrawerOpened) return;
2049
+ restorePositionSetting();
2050
+ };
2051
+ }, [
2052
+ modal,
2053
+ restorePositionSetting
2054
+ ]);
2055
+ React__default.useEffect(() => {
2056
+ if (nested || !hasBeenOpened) return;
2057
+ if (isOpen) {
2058
+ const isStandalone = window.matchMedia("(display-mode: standalone)").matches;
2059
+ !isStandalone && setPositionFixed();
2060
+ if (!modal) {
2061
+ window.setTimeout(() => {
2062
+ restorePositionSetting();
2063
+ }, 500);
2064
+ }
2065
+ } else {
2066
+ restorePositionSetting();
2067
+ }
2068
+ }, [
2069
+ isOpen,
2070
+ hasBeenOpened,
2071
+ activeUrl,
2072
+ modal,
2073
+ nested,
2074
+ setPositionFixed,
2075
+ restorePositionSetting
2076
+ ]);
2077
+ return {
2078
+ restorePositionSetting
2079
+ };
2080
+ }
2081
+ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRelease: onReleaseProp, snapPoints, shouldScaleBackground = false, setBackgroundColorOnScale = true, closeThreshold = CLOSE_THRESHOLD, scrollLockTimeout = SCROLL_LOCK_TIMEOUT, dismissible = true, handleOnly = false, fadeFromIndex = snapPoints && snapPoints.length - 1, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal = true, onClose, nested, noBodyStyles = false, direction = "bottom", defaultOpen = false, disablePreventScroll = true, snapToSequentialPoint = false, preventScrollRestoration = false, repositionInputs = true, onAnimationEnd, container, autoFocus = false }) {
2082
+ var _drawerRef_current, _drawerRef_current1;
2083
+ const [isOpen = false, setIsOpen] = useControllableState({
2084
+ defaultProp: defaultOpen,
2085
+ prop: openProp,
2086
+ onChange: (o) => {
2087
+ onOpenChange == null ? void 0 : onOpenChange(o);
2088
+ if (!o && !nested) {
2089
+ restorePositionSetting();
2090
+ }
2091
+ setTimeout(() => {
2092
+ onAnimationEnd == null ? void 0 : onAnimationEnd(o);
2093
+ }, TRANSITIONS.DURATION * 1e3);
2094
+ if (o && !modal) {
2095
+ if (typeof window !== "undefined") {
2096
+ window.requestAnimationFrame(() => {
2097
+ document.body.style.pointerEvents = "auto";
2098
+ });
2099
+ }
2100
+ }
2101
+ if (!o) {
2102
+ document.body.style.pointerEvents = "auto";
2103
+ }
2104
+ }
2105
+ });
2106
+ const [hasBeenOpened, setHasBeenOpened] = React__default.useState(false);
2107
+ const [isDragging, setIsDragging] = React__default.useState(false);
2108
+ const [justReleased, setJustReleased] = React__default.useState(false);
2109
+ const overlayRef = React__default.useRef(null);
2110
+ const openTime = React__default.useRef(null);
2111
+ const dragStartTime = React__default.useRef(null);
2112
+ const dragEndTime = React__default.useRef(null);
2113
+ const lastTimeDragPrevented = React__default.useRef(null);
2114
+ const isAllowedToDrag = React__default.useRef(false);
2115
+ const nestedOpenChangeTimer = React__default.useRef(null);
2116
+ const pointerStart = React__default.useRef(0);
2117
+ const keyboardIsOpen = React__default.useRef(false);
2118
+ const shouldAnimate = React__default.useRef(!defaultOpen);
2119
+ const previousDiffFromInitial = React__default.useRef(0);
2120
+ const drawerRef = React__default.useRef(null);
2121
+ const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
2122
+ const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
2123
+ const initialDrawerHeight = React__default.useRef(0);
2124
+ const onSnapPointChange = React__default.useCallback((activeSnapPointIndex2) => {
2125
+ if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
2126
+ }, []);
2127
+ const { activeSnapPoint, activeSnapPointIndex, setActiveSnapPoint, onRelease: onReleaseSnapPoints, snapPointsOffset, onDrag: onDragSnapPoints, shouldFade, getPercentageDragged: getSnapPointsPercentageDragged } = useSnapPoints({
2128
+ snapPoints,
2129
+ activeSnapPointProp,
2130
+ setActiveSnapPointProp,
2131
+ drawerRef,
2132
+ fadeFromIndex,
2133
+ overlayRef,
2134
+ onSnapPointChange,
2135
+ direction,
2136
+ container,
2137
+ snapToSequentialPoint
2138
+ });
2139
+ usePreventScroll({
2140
+ isDisabled: !isOpen || isDragging || !modal || justReleased || !hasBeenOpened || !repositionInputs || !disablePreventScroll
2141
+ });
2142
+ const { restorePositionSetting } = usePositionFixed({
2143
+ isOpen,
2144
+ modal,
2145
+ nested: nested != null ? nested : false,
2146
+ hasBeenOpened,
2147
+ preventScrollRestoration,
2148
+ noBodyStyles
2149
+ });
2150
+ function getScale() {
2151
+ return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
2152
+ }
2153
+ function onPress(event) {
2154
+ var _drawerRef_current2, _drawerRef_current12;
2155
+ if (!dismissible && !snapPoints) return;
2156
+ if (drawerRef.current && !drawerRef.current.contains(event.target)) return;
2157
+ drawerHeightRef.current = ((_drawerRef_current2 = drawerRef.current) == null ? void 0 : _drawerRef_current2.getBoundingClientRect().height) || 0;
2158
+ drawerWidthRef.current = ((_drawerRef_current12 = drawerRef.current) == null ? void 0 : _drawerRef_current12.getBoundingClientRect().width) || 0;
2159
+ setIsDragging(true);
2160
+ dragStartTime.current = /* @__PURE__ */ new Date();
2161
+ if (isIOS()) {
2162
+ window.addEventListener("touchend", () => isAllowedToDrag.current = false, {
2163
+ once: true
2164
+ });
2165
+ }
2166
+ event.target.setPointerCapture(event.pointerId);
2167
+ pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;
2168
+ }
2169
+ function shouldDrag(el, isDraggingInDirection) {
2170
+ var _window_getSelection;
2171
+ let element = el;
2172
+ const highlightedText = (_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString();
2173
+ const swipeAmount = drawerRef.current ? getTranslate(drawerRef.current, direction) : null;
2174
+ const date = /* @__PURE__ */ new Date();
2175
+ if (element.tagName === "SELECT") {
2176
+ return false;
2177
+ }
2178
+ if (element.hasAttribute("data-vaul-no-drag") || element.closest("[data-vaul-no-drag]")) {
2179
+ return false;
2180
+ }
2181
+ if (direction === "right" || direction === "left") {
2182
+ return true;
2183
+ }
2184
+ if (openTime.current && date.getTime() - openTime.current.getTime() < 500) {
2185
+ return false;
2186
+ }
2187
+ if (swipeAmount !== null) {
2188
+ if (direction === "bottom" ? swipeAmount > 0 : swipeAmount < 0) {
2189
+ return true;
2190
+ }
2191
+ }
2192
+ if (highlightedText && highlightedText.length > 0) {
2193
+ return false;
2194
+ }
2195
+ if (lastTimeDragPrevented.current && date.getTime() - lastTimeDragPrevented.current.getTime() < scrollLockTimeout && swipeAmount === 0) {
2196
+ lastTimeDragPrevented.current = date;
2197
+ return false;
2198
+ }
2199
+ if (isDraggingInDirection) {
2200
+ lastTimeDragPrevented.current = date;
2201
+ return false;
2202
+ }
2203
+ while (element) {
2204
+ if (element.scrollHeight > element.clientHeight) {
2205
+ if (element.scrollTop !== 0) {
2206
+ lastTimeDragPrevented.current = /* @__PURE__ */ new Date();
2207
+ return false;
2208
+ }
2209
+ if (element.getAttribute("role") === "dialog") {
2210
+ return true;
2211
+ }
2212
+ }
2213
+ element = element.parentNode;
2214
+ }
2215
+ return true;
2216
+ }
2217
+ function onDrag(event) {
2218
+ if (!drawerRef.current) {
2219
+ return;
2220
+ }
2221
+ if (isDragging) {
2222
+ const directionMultiplier = direction === "bottom" || direction === "right" ? 1 : -1;
2223
+ const draggedDistance = (pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX)) * directionMultiplier;
2224
+ const isDraggingInDirection = draggedDistance > 0;
2225
+ const noCloseSnapPointsPreCondition = snapPoints && !dismissible && !isDraggingInDirection;
2226
+ if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) return;
2227
+ const absDraggedDistance = Math.abs(draggedDistance);
2228
+ const wrapper = document.querySelector("[data-vaul-drawer-wrapper]");
2229
+ const drawerDimension = direction === "bottom" || direction === "top" ? drawerHeightRef.current : drawerWidthRef.current;
2230
+ let percentageDragged = absDraggedDistance / drawerDimension;
2231
+ const snapPointPercentageDragged = getSnapPointsPercentageDragged(absDraggedDistance, isDraggingInDirection);
2232
+ if (snapPointPercentageDragged !== null) {
2233
+ percentageDragged = snapPointPercentageDragged;
2234
+ }
2235
+ if (noCloseSnapPointsPreCondition && percentageDragged >= 1) {
2236
+ return;
2237
+ }
2238
+ if (!isAllowedToDrag.current && !shouldDrag(event.target, isDraggingInDirection)) return;
2239
+ drawerRef.current.classList.add(DRAG_CLASS);
2240
+ isAllowedToDrag.current = true;
2241
+ set(drawerRef.current, {
2242
+ transition: "none"
2243
+ });
2244
+ set(overlayRef.current, {
2245
+ transition: "none"
2246
+ });
2247
+ if (snapPoints) {
2248
+ onDragSnapPoints({
2249
+ draggedDistance
2250
+ });
2251
+ }
2252
+ if (isDraggingInDirection && !snapPoints) {
2253
+ const dampenedDraggedDistance = dampenValue(draggedDistance);
2254
+ const translateValue = Math.min(dampenedDraggedDistance * -1, 0) * directionMultiplier;
2255
+ set(drawerRef.current, {
2256
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
2257
+ });
2258
+ return;
2259
+ }
2260
+ const opacityValue = 1 - percentageDragged;
2261
+ if (shouldFade || fadeFromIndex && activeSnapPointIndex === fadeFromIndex - 1) {
2262
+ onDragProp == null ? void 0 : onDragProp(event, percentageDragged);
2263
+ set(overlayRef.current, {
2264
+ opacity: `${opacityValue}`,
2265
+ transition: "none"
2266
+ }, true);
2267
+ }
2268
+ if (wrapper && overlayRef.current && shouldScaleBackground) {
2269
+ const scaleValue = Math.min(getScale() + percentageDragged * (1 - getScale()), 1);
2270
+ const borderRadiusValue = 8 - percentageDragged * 8;
2271
+ const translateValue = Math.max(0, 14 - percentageDragged * 14);
2272
+ set(wrapper, {
2273
+ borderRadius: `${borderRadiusValue}px`,
2274
+ transform: isVertical(direction) ? `scale(${scaleValue}) translate3d(0, ${translateValue}px, 0)` : `scale(${scaleValue}) translate3d(${translateValue}px, 0, 0)`,
2275
+ transition: "none"
2276
+ }, true);
2277
+ }
2278
+ if (!snapPoints) {
2279
+ const translateValue = absDraggedDistance * directionMultiplier;
2280
+ set(drawerRef.current, {
2281
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
2282
+ });
2283
+ }
2284
+ }
2285
+ }
2286
+ React__default.useEffect(() => {
2287
+ window.requestAnimationFrame(() => {
2288
+ shouldAnimate.current = true;
2289
+ });
2290
+ }, []);
2291
+ React__default.useEffect(() => {
2292
+ var _window_visualViewport;
2293
+ function onVisualViewportChange() {
2294
+ if (!drawerRef.current || !repositionInputs) return;
2295
+ const focusedElement = document.activeElement;
2296
+ if (isInput(focusedElement) || keyboardIsOpen.current) {
2297
+ var _window_visualViewport2;
2298
+ const visualViewportHeight = ((_window_visualViewport2 = window.visualViewport) == null ? void 0 : _window_visualViewport2.height) || 0;
2299
+ const totalHeight = window.innerHeight;
2300
+ let diffFromInitial = totalHeight - visualViewportHeight;
2301
+ const drawerHeight = drawerRef.current.getBoundingClientRect().height || 0;
2302
+ const isTallEnough = drawerHeight > totalHeight * 0.8;
2303
+ if (!initialDrawerHeight.current) {
2304
+ initialDrawerHeight.current = drawerHeight;
2305
+ }
2306
+ const offsetFromTop = drawerRef.current.getBoundingClientRect().top;
2307
+ if (Math.abs(previousDiffFromInitial.current - diffFromInitial) > 60) {
2308
+ keyboardIsOpen.current = !keyboardIsOpen.current;
2309
+ }
2310
+ if (snapPoints && snapPoints.length > 0 && snapPointsOffset && activeSnapPointIndex) {
2311
+ const activeSnapPointHeight = snapPointsOffset[activeSnapPointIndex] || 0;
2312
+ diffFromInitial += activeSnapPointHeight;
2313
+ }
2314
+ previousDiffFromInitial.current = diffFromInitial;
2315
+ if (drawerHeight > visualViewportHeight || keyboardIsOpen.current) {
2316
+ const height = drawerRef.current.getBoundingClientRect().height;
2317
+ let newDrawerHeight = height;
2318
+ if (height > visualViewportHeight) {
2319
+ newDrawerHeight = visualViewportHeight - (isTallEnough ? offsetFromTop : WINDOW_TOP_OFFSET);
2320
+ }
2321
+ if (fixed) {
2322
+ drawerRef.current.style.height = `${height - Math.max(diffFromInitial, 0)}px`;
2323
+ } else {
2324
+ drawerRef.current.style.height = `${Math.max(newDrawerHeight, visualViewportHeight - offsetFromTop)}px`;
2325
+ }
2326
+ } else if (!isMobileFirefox()) {
2327
+ drawerRef.current.style.height = `${initialDrawerHeight.current}px`;
2328
+ }
2329
+ if (snapPoints && snapPoints.length > 0 && !keyboardIsOpen.current) {
2330
+ drawerRef.current.style.bottom = `0px`;
2331
+ } else {
2332
+ drawerRef.current.style.bottom = `${Math.max(diffFromInitial, 0)}px`;
2333
+ }
2334
+ }
2335
+ }
2336
+ (_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.addEventListener("resize", onVisualViewportChange);
2337
+ return () => {
2338
+ var _window_visualViewport2;
2339
+ return (_window_visualViewport2 = window.visualViewport) == null ? void 0 : _window_visualViewport2.removeEventListener("resize", onVisualViewportChange);
2340
+ };
2341
+ }, [
2342
+ activeSnapPointIndex,
2343
+ snapPoints,
2344
+ snapPointsOffset
2345
+ ]);
2346
+ function closeDrawer(fromWithin) {
2347
+ cancelDrag();
2348
+ onClose == null ? void 0 : onClose();
2349
+ if (!fromWithin) {
2350
+ setIsOpen(false);
2351
+ }
2352
+ setTimeout(() => {
2353
+ if (snapPoints) {
2354
+ setActiveSnapPoint(snapPoints[0]);
2355
+ }
2356
+ }, TRANSITIONS.DURATION * 1e3);
2357
+ }
2358
+ function resetDrawer() {
2359
+ if (!drawerRef.current) return;
2360
+ const wrapper = document.querySelector("[data-vaul-drawer-wrapper]");
2361
+ const currentSwipeAmount = getTranslate(drawerRef.current, direction);
2362
+ set(drawerRef.current, {
2363
+ transform: "translate3d(0, 0, 0)",
2364
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`
2365
+ });
2366
+ set(overlayRef.current, {
2367
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
2368
+ opacity: "1"
2369
+ });
2370
+ if (shouldScaleBackground && currentSwipeAmount && currentSwipeAmount > 0 && isOpen) {
2371
+ set(wrapper, {
2372
+ borderRadius: `${BORDER_RADIUS}px`,
2373
+ overflow: "hidden",
2374
+ ...isVertical(direction) ? {
2375
+ transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
2376
+ transformOrigin: "top"
2377
+ } : {
2378
+ transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
2379
+ transformOrigin: "left"
2380
+ },
2381
+ transitionProperty: "transform, border-radius",
2382
+ transitionDuration: `${TRANSITIONS.DURATION}s`,
2383
+ transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(",")})`
2384
+ }, true);
2385
+ }
2386
+ }
2387
+ function cancelDrag() {
2388
+ if (!isDragging || !drawerRef.current) return;
2389
+ drawerRef.current.classList.remove(DRAG_CLASS);
2390
+ isAllowedToDrag.current = false;
2391
+ setIsDragging(false);
2392
+ dragEndTime.current = /* @__PURE__ */ new Date();
2393
+ }
2394
+ function onRelease(event) {
2395
+ if (!isDragging || !drawerRef.current) return;
2396
+ drawerRef.current.classList.remove(DRAG_CLASS);
2397
+ isAllowedToDrag.current = false;
2398
+ setIsDragging(false);
2399
+ dragEndTime.current = /* @__PURE__ */ new Date();
2400
+ const swipeAmount = getTranslate(drawerRef.current, direction);
2401
+ if (!event || !shouldDrag(event.target, false) || !swipeAmount || Number.isNaN(swipeAmount)) return;
2402
+ if (dragStartTime.current === null) return;
2403
+ const timeTaken = dragEndTime.current.getTime() - dragStartTime.current.getTime();
2404
+ const distMoved = pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX);
2405
+ const velocity = Math.abs(distMoved) / timeTaken;
2406
+ if (velocity > 0.05) {
2407
+ setJustReleased(true);
2408
+ setTimeout(() => {
2409
+ setJustReleased(false);
2410
+ }, 200);
2411
+ }
2412
+ if (snapPoints) {
2413
+ const directionMultiplier = direction === "bottom" || direction === "right" ? 1 : -1;
2414
+ onReleaseSnapPoints({
2415
+ draggedDistance: distMoved * directionMultiplier,
2416
+ closeDrawer,
2417
+ velocity,
2418
+ dismissible
2419
+ });
2420
+ onReleaseProp == null ? void 0 : onReleaseProp(event, true);
2421
+ return;
2422
+ }
2423
+ if (direction === "bottom" || direction === "right" ? distMoved > 0 : distMoved < 0) {
2424
+ resetDrawer();
2425
+ onReleaseProp == null ? void 0 : onReleaseProp(event, true);
2426
+ return;
2427
+ }
2428
+ if (velocity > VELOCITY_THRESHOLD) {
2429
+ closeDrawer();
2430
+ onReleaseProp == null ? void 0 : onReleaseProp(event, false);
2431
+ return;
2432
+ }
2433
+ var _drawerRef_current_getBoundingClientRect_height;
2434
+ const visibleDrawerHeight = Math.min((_drawerRef_current_getBoundingClientRect_height = drawerRef.current.getBoundingClientRect().height) != null ? _drawerRef_current_getBoundingClientRect_height : 0, window.innerHeight);
2435
+ var _drawerRef_current_getBoundingClientRect_width;
2436
+ const visibleDrawerWidth = Math.min((_drawerRef_current_getBoundingClientRect_width = drawerRef.current.getBoundingClientRect().width) != null ? _drawerRef_current_getBoundingClientRect_width : 0, window.innerWidth);
2437
+ const isHorizontalSwipe = direction === "left" || direction === "right";
2438
+ if (Math.abs(swipeAmount) >= (isHorizontalSwipe ? visibleDrawerWidth : visibleDrawerHeight) * closeThreshold) {
2439
+ closeDrawer();
2440
+ onReleaseProp == null ? void 0 : onReleaseProp(event, false);
2441
+ return;
2442
+ }
2443
+ onReleaseProp == null ? void 0 : onReleaseProp(event, true);
2444
+ resetDrawer();
2445
+ }
2446
+ React__default.useEffect(() => {
2447
+ if (isOpen) {
2448
+ set(document.documentElement, {
2449
+ scrollBehavior: "auto"
2450
+ });
2451
+ openTime.current = /* @__PURE__ */ new Date();
2452
+ }
2453
+ return () => {
2454
+ reset(document.documentElement, "scrollBehavior");
2455
+ };
2456
+ }, [
2457
+ isOpen
2458
+ ]);
2459
+ function onNestedOpenChange(o) {
2460
+ const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1;
2461
+ const initialTranslate = o ? -NESTED_DISPLACEMENT : 0;
2462
+ if (nestedOpenChangeTimer.current) {
2463
+ window.clearTimeout(nestedOpenChangeTimer.current);
2464
+ }
2465
+ set(drawerRef.current, {
2466
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
2467
+ transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)` : `scale(${scale}) translate3d(${initialTranslate}px, 0, 0)`
2468
+ });
2469
+ if (!o && drawerRef.current) {
2470
+ nestedOpenChangeTimer.current = setTimeout(() => {
2471
+ const translateValue = getTranslate(drawerRef.current, direction);
2472
+ set(drawerRef.current, {
2473
+ transition: "none",
2474
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
2475
+ });
2476
+ }, 500);
2477
+ }
2478
+ }
2479
+ function onNestedDrag(_event, percentageDragged) {
2480
+ if (percentageDragged < 0) return;
2481
+ const initialScale = (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth;
2482
+ const newScale = initialScale + percentageDragged * (1 - initialScale);
2483
+ const newTranslate = -NESTED_DISPLACEMENT + percentageDragged * NESTED_DISPLACEMENT;
2484
+ set(drawerRef.current, {
2485
+ transform: isVertical(direction) ? `scale(${newScale}) translate3d(0, ${newTranslate}px, 0)` : `scale(${newScale}) translate3d(${newTranslate}px, 0, 0)`,
2486
+ transition: "none"
2487
+ });
2488
+ }
2489
+ function onNestedRelease(_event, o) {
2490
+ const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;
2491
+ const scale = o ? (dim - NESTED_DISPLACEMENT) / dim : 1;
2492
+ const translate = o ? -NESTED_DISPLACEMENT : 0;
2493
+ if (o) {
2494
+ set(drawerRef.current, {
2495
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
2496
+ transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${translate}px, 0)` : `scale(${scale}) translate3d(${translate}px, 0, 0)`
2497
+ });
2498
+ }
2499
+ }
2500
+ React__default.useEffect(() => {
2501
+ if (!modal) {
2502
+ window.requestAnimationFrame(() => {
2503
+ document.body.style.pointerEvents = "auto";
2504
+ });
2505
+ }
2506
+ }, [
2507
+ modal
2508
+ ]);
2509
+ return /* @__PURE__ */ React__default.createElement(Root$1, {
2510
+ defaultOpen,
2511
+ onOpenChange: (open) => {
2512
+ if (!dismissible && !open) return;
2513
+ if (open) {
2514
+ setHasBeenOpened(true);
2515
+ } else {
2516
+ closeDrawer(true);
2517
+ }
2518
+ setIsOpen(open);
2519
+ },
2520
+ open: isOpen
2521
+ }, /* @__PURE__ */ React__default.createElement(DrawerContext.Provider, {
2522
+ value: {
2523
+ activeSnapPoint,
2524
+ snapPoints,
2525
+ setActiveSnapPoint,
2526
+ drawerRef,
2527
+ overlayRef,
2528
+ onOpenChange,
2529
+ onPress,
2530
+ onRelease,
2531
+ onDrag,
2532
+ dismissible,
2533
+ shouldAnimate,
2534
+ handleOnly,
2535
+ isOpen,
2536
+ isDragging,
2537
+ shouldFade,
2538
+ closeDrawer,
2539
+ onNestedDrag,
2540
+ onNestedOpenChange,
2541
+ onNestedRelease,
2542
+ keyboardIsOpen,
2543
+ modal,
2544
+ snapPointsOffset,
2545
+ activeSnapPointIndex,
2546
+ direction,
2547
+ shouldScaleBackground,
2548
+ setBackgroundColorOnScale,
2549
+ noBodyStyles,
2550
+ container,
2551
+ autoFocus
2552
+ }
2553
+ }, children));
2554
+ }
2555
+ const Overlay = /* @__PURE__ */ React__default.forwardRef(function({ ...rest }, ref) {
2556
+ const { overlayRef, snapPoints, onRelease, shouldFade, isOpen, modal, shouldAnimate } = useDrawerContext();
2557
+ const composedRef = useComposedRefs(ref, overlayRef);
2558
+ const hasSnapPoints = snapPoints && snapPoints.length > 0;
2559
+ if (!modal) {
2560
+ return null;
2561
+ }
2562
+ const onMouseUp = React__default.useCallback((event) => onRelease(event), [
2563
+ onRelease
2564
+ ]);
2565
+ return /* @__PURE__ */ React__default.createElement(Overlay$1, {
2566
+ onMouseUp,
2567
+ ref: composedRef,
2568
+ "data-vaul-overlay": "",
2569
+ "data-vaul-snap-points": isOpen && hasSnapPoints ? "true" : "false",
2570
+ "data-vaul-snap-points-overlay": isOpen && shouldFade ? "true" : "false",
2571
+ "data-vaul-animate": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? "true" : "false",
2572
+ ...rest
2573
+ });
2574
+ });
2575
+ Overlay.displayName = "Drawer.Overlay";
2576
+ const Content = /* @__PURE__ */ React__default.forwardRef(function({ onPointerDownOutside, style, onOpenAutoFocus, ...rest }, ref) {
2577
+ const { drawerRef, onPress, onRelease, onDrag, keyboardIsOpen, snapPointsOffset, activeSnapPointIndex, modal, isOpen, direction, snapPoints, container, handleOnly, shouldAnimate, autoFocus } = useDrawerContext();
2578
+ const [delayedSnapPoints, setDelayedSnapPoints] = React__default.useState(false);
2579
+ const composedRef = useComposedRefs(ref, drawerRef);
2580
+ const pointerStartRef = React__default.useRef(null);
2581
+ const lastKnownPointerEventRef = React__default.useRef(null);
2582
+ const wasBeyondThePointRef = React__default.useRef(false);
2583
+ const hasSnapPoints = snapPoints && snapPoints.length > 0;
2584
+ useScaleBackground();
2585
+ const isDeltaInDirection = (delta, direction2, threshold = 0) => {
2586
+ if (wasBeyondThePointRef.current) return true;
2587
+ const deltaY = Math.abs(delta.y);
2588
+ const deltaX = Math.abs(delta.x);
2589
+ const isDeltaX = deltaX > deltaY;
2590
+ const dFactor = [
2591
+ "bottom",
2592
+ "right"
2593
+ ].includes(direction2) ? 1 : -1;
2594
+ if (direction2 === "left" || direction2 === "right") {
2595
+ const isReverseDirection = delta.x * dFactor < 0;
2596
+ if (!isReverseDirection && deltaX >= 0 && deltaX <= threshold) {
2597
+ return isDeltaX;
2598
+ }
2599
+ } else {
2600
+ const isReverseDirection = delta.y * dFactor < 0;
2601
+ if (!isReverseDirection && deltaY >= 0 && deltaY <= threshold) {
2602
+ return !isDeltaX;
2603
+ }
2604
+ }
2605
+ wasBeyondThePointRef.current = true;
2606
+ return true;
2607
+ };
2608
+ React__default.useEffect(() => {
2609
+ if (hasSnapPoints) {
2610
+ window.requestAnimationFrame(() => {
2611
+ setDelayedSnapPoints(true);
2612
+ });
2613
+ }
2614
+ }, []);
2615
+ function handleOnPointerUp(event) {
2616
+ pointerStartRef.current = null;
2617
+ wasBeyondThePointRef.current = false;
2618
+ onRelease(event);
2619
+ }
2620
+ return /* @__PURE__ */ React__default.createElement(Content$1, {
2621
+ "data-vaul-drawer-direction": direction,
2622
+ "data-vaul-drawer": "",
2623
+ "data-vaul-delayed-snap-points": delayedSnapPoints ? "true" : "false",
2624
+ "data-vaul-snap-points": isOpen && hasSnapPoints ? "true" : "false",
2625
+ "data-vaul-custom-container": container ? "true" : "false",
2626
+ "data-vaul-animate": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? "true" : "false",
2627
+ ...rest,
2628
+ ref: composedRef,
2629
+ style: snapPointsOffset && snapPointsOffset.length > 0 ? {
2630
+ "--snap-point-height": `${snapPointsOffset[activeSnapPointIndex != null ? activeSnapPointIndex : 0]}px`,
2631
+ ...style
2632
+ } : style,
2633
+ onPointerDown: (event) => {
2634
+ if (handleOnly) return;
2635
+ rest.onPointerDown == null ? void 0 : rest.onPointerDown.call(rest, event);
2636
+ pointerStartRef.current = {
2637
+ x: event.pageX,
2638
+ y: event.pageY
2639
+ };
2640
+ onPress(event);
2641
+ },
2642
+ onOpenAutoFocus: (e) => {
2643
+ onOpenAutoFocus == null ? void 0 : onOpenAutoFocus(e);
2644
+ if (!autoFocus) {
2645
+ e.preventDefault();
2646
+ }
2647
+ },
2648
+ onPointerDownOutside: (e) => {
2649
+ onPointerDownOutside == null ? void 0 : onPointerDownOutside(e);
2650
+ if (!modal || e.defaultPrevented) {
2651
+ e.preventDefault();
2652
+ return;
2653
+ }
2654
+ if (keyboardIsOpen.current) {
2655
+ keyboardIsOpen.current = false;
2656
+ }
2657
+ },
2658
+ onFocusOutside: (e) => {
2659
+ if (!modal) {
2660
+ e.preventDefault();
2661
+ return;
2662
+ }
2663
+ },
2664
+ onPointerMove: (event) => {
2665
+ lastKnownPointerEventRef.current = event;
2666
+ if (handleOnly) return;
2667
+ rest.onPointerMove == null ? void 0 : rest.onPointerMove.call(rest, event);
2668
+ if (!pointerStartRef.current) return;
2669
+ const yPosition = event.pageY - pointerStartRef.current.y;
2670
+ const xPosition = event.pageX - pointerStartRef.current.x;
2671
+ const swipeStartThreshold = event.pointerType === "touch" ? 10 : 2;
2672
+ const delta = {
2673
+ x: xPosition,
2674
+ y: yPosition
2675
+ };
2676
+ const isAllowedToSwipe = isDeltaInDirection(delta, direction, swipeStartThreshold);
2677
+ if (isAllowedToSwipe) onDrag(event);
2678
+ else if (Math.abs(xPosition) > swipeStartThreshold || Math.abs(yPosition) > swipeStartThreshold) {
2679
+ pointerStartRef.current = null;
2680
+ }
2681
+ },
2682
+ onPointerUp: (event) => {
2683
+ rest.onPointerUp == null ? void 0 : rest.onPointerUp.call(rest, event);
2684
+ pointerStartRef.current = null;
2685
+ wasBeyondThePointRef.current = false;
2686
+ onRelease(event);
2687
+ },
2688
+ onPointerOut: (event) => {
2689
+ rest.onPointerOut == null ? void 0 : rest.onPointerOut.call(rest, event);
2690
+ handleOnPointerUp(lastKnownPointerEventRef.current);
2691
+ },
2692
+ onContextMenu: (event) => {
2693
+ rest.onContextMenu == null ? void 0 : rest.onContextMenu.call(rest, event);
2694
+ if (lastKnownPointerEventRef.current) {
2695
+ handleOnPointerUp(lastKnownPointerEventRef.current);
2696
+ }
2697
+ }
2698
+ });
2699
+ });
2700
+ Content.displayName = "Drawer.Content";
2701
+ const LONG_HANDLE_PRESS_TIMEOUT = 250;
2702
+ const DOUBLE_TAP_TIMEOUT = 120;
2703
+ const Handle = /* @__PURE__ */ React__default.forwardRef(function({ preventCycle = false, children, ...rest }, ref) {
2704
+ const { closeDrawer, isDragging, snapPoints, activeSnapPoint, setActiveSnapPoint, dismissible, handleOnly, isOpen, onPress, onDrag } = useDrawerContext();
2705
+ const closeTimeoutIdRef = React__default.useRef(null);
2706
+ const shouldCancelInteractionRef = React__default.useRef(false);
2707
+ function handleStartCycle() {
2708
+ if (shouldCancelInteractionRef.current) {
2709
+ handleCancelInteraction();
2710
+ return;
2711
+ }
2712
+ window.setTimeout(() => {
2713
+ handleCycleSnapPoints();
2714
+ }, DOUBLE_TAP_TIMEOUT);
2715
+ }
2716
+ function handleCycleSnapPoints() {
2717
+ if (isDragging || preventCycle || shouldCancelInteractionRef.current) {
2718
+ handleCancelInteraction();
2719
+ return;
2720
+ }
2721
+ handleCancelInteraction();
2722
+ if (!snapPoints || snapPoints.length === 0) {
2723
+ if (!dismissible) {
2724
+ closeDrawer();
2725
+ }
2726
+ return;
2727
+ }
2728
+ const isLastSnapPoint = activeSnapPoint === snapPoints[snapPoints.length - 1];
2729
+ if (isLastSnapPoint && dismissible) {
2730
+ closeDrawer();
2731
+ return;
2732
+ }
2733
+ const currentSnapIndex = snapPoints.findIndex((point) => point === activeSnapPoint);
2734
+ if (currentSnapIndex === -1) return;
2735
+ const nextSnapPoint = snapPoints[currentSnapIndex + 1];
2736
+ setActiveSnapPoint(nextSnapPoint);
2737
+ }
2738
+ function handleStartInteraction() {
2739
+ closeTimeoutIdRef.current = window.setTimeout(() => {
2740
+ shouldCancelInteractionRef.current = true;
2741
+ }, LONG_HANDLE_PRESS_TIMEOUT);
2742
+ }
2743
+ function handleCancelInteraction() {
2744
+ if (closeTimeoutIdRef.current) {
2745
+ window.clearTimeout(closeTimeoutIdRef.current);
2746
+ }
2747
+ shouldCancelInteractionRef.current = false;
2748
+ }
2749
+ return /* @__PURE__ */ React__default.createElement("div", {
2750
+ onClick: handleStartCycle,
2751
+ onPointerCancel: handleCancelInteraction,
2752
+ onPointerDown: (e) => {
2753
+ if (handleOnly) onPress(e);
2754
+ handleStartInteraction();
2755
+ },
2756
+ onPointerMove: (e) => {
2757
+ if (handleOnly) onDrag(e);
2758
+ },
2759
+ // onPointerUp is already handled by the content component
2760
+ ref,
2761
+ "data-vaul-drawer-visible": isOpen ? "true" : "false",
2762
+ "data-vaul-handle": "",
2763
+ "aria-hidden": "true",
2764
+ ...rest
2765
+ }, /* @__PURE__ */ React__default.createElement("span", {
2766
+ "data-vaul-handle-hitarea": "",
2767
+ "aria-hidden": "true"
2768
+ }, children));
2769
+ });
2770
+ Handle.displayName = "Drawer.Handle";
2771
+ function Portal(props) {
2772
+ const context = useDrawerContext();
2773
+ const { container = context.container, ...portalProps } = props;
2774
+ return /* @__PURE__ */ React__default.createElement(Portal$1, {
2775
+ container,
2776
+ ...portalProps
2777
+ });
2778
+ }
2779
+ const Drawer = {
2780
+ Root,
2781
+ Content,
2782
+ Overlay,
2783
+ Portal
2784
+ };
2785
+ const BottomSheet = ({
2786
+ children,
2787
+ open,
2788
+ onOpenChange
2789
+ }) => {
2790
+ return /* @__PURE__ */ jsx(ClientOnly, { children: /* @__PURE__ */ jsxs(Drawer.Root, { open, onOpenChange, children: [
2791
+ /* @__PURE__ */ jsx(Drawer.Overlay, { className: "gf-fixed gf-inset-0 gf-z-50 gf-h-screen gf-w-screen gf-bg-dark-grey gf-bg-opacity-40 gf-transition-colors gf-duration-500 gf-ease-cubic-in-out" }),
2792
+ /* @__PURE__ */ jsx(Drawer.Portal, { children: /* @__PURE__ */ jsxs(Drawer.Content, { className: "gf-fixed gf-bottom-0 gf-z-50 gf-h-fit gf-w-full gf-rounded-t-xl gf-bg-white/50 gf-px-4 gf-py-4 gf-outline-none gf-backdrop-blur-[20px]", children: [
2793
+ /* @__PURE__ */ jsx("div", { className: "gf-mx-auto gf-mb-3 gf-h-1 gf-w-[60px] gf-rounded-full gf-bg-white/30" }),
2794
+ /* @__PURE__ */ jsx("div", { className: "gf-scrollbar-hide gf-flex gf-max-h-[90vh] gf-flex-col gf-gap-5 gf-overflow-y-scroll", children })
2795
+ ] }) })
2796
+ ] }) });
2797
+ };
2798
+ export {
2799
+ BottomSheet
2800
+ };
2801
+ //# sourceMappingURL=BottomSheet.js.map