ivt 0.3.2 → 0.3.4

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 (257) hide show
  1. package/dist/accordion/index.mjs +19 -1
  2. package/dist/accordion/index.mjs.map +1 -1
  3. package/dist/alert/index.mjs +43 -1
  4. package/dist/alert/index.mjs.map +1 -1
  5. package/dist/alert-dialog/index.mjs +260 -1
  6. package/dist/alert-dialog/index.mjs.map +1 -1
  7. package/dist/avatar/index.mjs +164 -1
  8. package/dist/avatar/index.mjs.map +1 -1
  9. package/dist/badge/index.mjs +6 -1
  10. package/dist/badge/index.mjs.map +1 -1
  11. package/dist/base/index.mjs +760 -1
  12. package/dist/base/index.mjs.map +1 -1
  13. package/dist/button/index.mjs +6 -1
  14. package/dist/button/index.mjs.map +1 -1
  15. package/dist/calendar/index.mjs +11 -1
  16. package/dist/calendar/index.mjs.map +1 -1
  17. package/dist/card/index.mjs +55 -1
  18. package/dist/card/index.mjs.map +1 -1
  19. package/dist/chart/index.mjs +17042 -1
  20. package/dist/chart/index.mjs.map +1 -1
  21. package/dist/checkbox/index.mjs +223 -1
  22. package/dist/checkbox/index.mjs.map +1 -1
  23. package/dist/chunks/_commonjsHelpers-DqEvkrE1.mjs +6 -0
  24. package/dist/chunks/_commonjsHelpers-DqEvkrE1.mjs.map +1 -0
  25. package/dist/chunks/accordion-BMP2PSSC.mjs +455 -0
  26. package/dist/chunks/{accordion-CdshDFZC.mjs.map → accordion-BMP2PSSC.mjs.map} +1 -1
  27. package/dist/chunks/badge-DxuZhgBF.mjs +57 -0
  28. package/dist/chunks/{badge-BYqshEmA.mjs.map → badge-DxuZhgBF.mjs.map} +1 -1
  29. package/dist/chunks/bundle-mjs-tFg__FnT.mjs +4491 -0
  30. package/dist/chunks/{bundle-mjs-9BXytT_r.mjs.map → bundle-mjs-tFg__FnT.mjs.map} +1 -1
  31. package/dist/chunks/button-CX0htulo.mjs +47 -0
  32. package/dist/chunks/{button-DrFZXJ7z.mjs.map → button-CX0htulo.mjs.map} +1 -1
  33. package/dist/chunks/calendar-B4IV5RyM.mjs +7106 -0
  34. package/dist/chunks/calendar-B4IV5RyM.mjs.map +1 -0
  35. package/dist/chunks/check-B7209s3e.mjs +15 -0
  36. package/dist/chunks/{check-CimnOyD7.mjs.map → check-B7209s3e.mjs.map} +1 -1
  37. package/dist/chunks/chevron-down-D84DRJBv.mjs +15 -0
  38. package/dist/chunks/{chevron-down-D3fvbjxE.mjs.map → chevron-down-D84DRJBv.mjs.map} +1 -1
  39. package/dist/chunks/chevron-left-DtL1t1DJ.mjs +15 -0
  40. package/dist/chunks/{chevron-left-CrN7DlXg.mjs.map → chevron-left-DtL1t1DJ.mjs.map} +1 -1
  41. package/dist/chunks/chevron-right-Cdxg1JSQ.mjs +15 -0
  42. package/dist/chunks/{chevron-right-BMSCuDGK.mjs.map → chevron-right-Cdxg1JSQ.mjs.map} +1 -1
  43. package/dist/chunks/chevrons-up-down-DtBUG1i8.mjs +22 -0
  44. package/dist/chunks/{chevrons-up-down-DBgvRkZm.mjs.map → chevrons-up-down-DtBUG1i8.mjs.map} +1 -1
  45. package/dist/chunks/circle-BLWMZ9yp.mjs +17 -0
  46. package/dist/chunks/{circle-CGqt18Bd.mjs.map → circle-BLWMZ9yp.mjs.map} +1 -1
  47. package/dist/chunks/command-C8cVzg-x.mjs +611 -0
  48. package/dist/chunks/command-C8cVzg-x.mjs.map +1 -0
  49. package/dist/chunks/createLucideIcon-Ba0IWqsz.mjs +60 -0
  50. package/dist/chunks/{createLucideIcon-L-tld2uc.mjs.map → createLucideIcon-Ba0IWqsz.mjs.map} +1 -1
  51. package/dist/chunks/dialog-D9vbxUuQ.mjs +80 -0
  52. package/dist/chunks/{dialog-36eqHzT3.mjs.map → dialog-D9vbxUuQ.mjs.map} +1 -1
  53. package/dist/chunks/hover-card-idvDPXrI.mjs +274 -0
  54. package/dist/chunks/{hover-card-Cnd58du6.mjs.map → hover-card-idvDPXrI.mjs.map} +1 -1
  55. package/dist/chunks/index-6JUj2Tld.mjs +18 -0
  56. package/dist/chunks/{index-CRxQlsb9.mjs.map → index-6JUj2Tld.mjs.map} +1 -1
  57. package/dist/chunks/index-B0IElWB4.mjs +51 -0
  58. package/dist/chunks/{index-vmPXTidH.mjs.map → index-B0IElWB4.mjs.map} +1 -1
  59. package/dist/chunks/index-B4VRyyD1.mjs +40 -0
  60. package/dist/chunks/index-B4VRyyD1.mjs.map +1 -0
  61. package/dist/chunks/index-BE-_q4IW.mjs +266 -0
  62. package/dist/chunks/index-BE-_q4IW.mjs.map +1 -0
  63. package/dist/chunks/index-BNxaLFA6.mjs +216 -0
  64. package/dist/chunks/{index-LvOFIVGz.mjs.map → index-BNxaLFA6.mjs.map} +1 -1
  65. package/dist/chunks/index-BZUrHhU8.mjs +7 -0
  66. package/dist/chunks/{index-CLtWFQL5.mjs.map → index-BZUrHhU8.mjs.map} +1 -1
  67. package/dist/chunks/index-B_FsTtnF.mjs +110 -0
  68. package/dist/chunks/{index-CCcl327A.mjs.map → index-B_FsTtnF.mjs.map} +1 -1
  69. package/dist/chunks/index-CAg47KJ6.mjs +13 -0
  70. package/dist/chunks/{index-CXszXOf_.mjs.map → index-CAg47KJ6.mjs.map} +1 -1
  71. package/dist/chunks/index-CXuEm8w1.mjs +12 -0
  72. package/dist/chunks/{index-CU_y1XAz.mjs.map → index-CXuEm8w1.mjs.map} +1 -1
  73. package/dist/chunks/index-C_jFwfR_.mjs +77 -0
  74. package/dist/chunks/{index-CybgQKpz.mjs.map → index-C_jFwfR_.mjs.map} +1 -1
  75. package/dist/chunks/index-CglX-DNW.mjs +21 -0
  76. package/dist/chunks/index-CglX-DNW.mjs.map +1 -0
  77. package/dist/chunks/index-CyMuypYR.mjs +324 -0
  78. package/dist/chunks/{index-DUNcuWJE.mjs.map → index-CyMuypYR.mjs.map} +1 -1
  79. package/dist/chunks/index-D0S6rRRE.mjs +50 -0
  80. package/dist/chunks/{index-w9bxia3O.mjs.map → index-D0S6rRRE.mjs.map} +1 -1
  81. package/dist/chunks/index-D23BhVQG.mjs +859 -0
  82. package/dist/chunks/{index-DZHMFdr0.mjs.map → index-D23BhVQG.mjs.map} +1 -1
  83. package/dist/chunks/index-D2wfJaZh.mjs +145 -0
  84. package/dist/chunks/index-D2wfJaZh.mjs.map +1 -0
  85. package/dist/chunks/index-DNvm9MP3.mjs +34 -0
  86. package/dist/chunks/{index-D2sZp5OP.mjs.map → index-DNvm9MP3.mjs.map} +1 -1
  87. package/dist/chunks/index-Dm4_czlz.mjs +12 -0
  88. package/dist/chunks/index-Dm4_czlz.mjs.map +1 -0
  89. package/dist/chunks/index-PaJVyocC.mjs +151 -0
  90. package/dist/chunks/index-PaJVyocC.mjs.map +1 -0
  91. package/dist/chunks/index-kr6_v_F8.mjs +2370 -0
  92. package/dist/chunks/index-kr6_v_F8.mjs.map +1 -0
  93. package/dist/chunks/index-sz_BcBbA.mjs +1210 -0
  94. package/dist/chunks/index-sz_BcBbA.mjs.map +1 -0
  95. package/dist/chunks/input-DK1slFF1.mjs +14 -0
  96. package/dist/chunks/{input-85UFztMJ.mjs.map → input-DK1slFF1.mjs.map} +1 -1
  97. package/dist/chunks/label-D7ONQdHc.mjs +32 -0
  98. package/dist/chunks/{label-CICFzZIt.mjs.map → label-D7ONQdHc.mjs.map} +1 -1
  99. package/dist/chunks/pagination-BM_IQ6Qk.mjs +106 -0
  100. package/dist/chunks/{pagination-CReDQes6.mjs.map → pagination-BM_IQ6Qk.mjs.map} +1 -1
  101. package/dist/chunks/popover-D3F326FR.mjs +308 -0
  102. package/dist/chunks/{popover-Cn2ZTvKd.mjs.map → popover-D3F326FR.mjs.map} +1 -1
  103. package/dist/chunks/progress-BCl5yD5Q.mjs +99 -0
  104. package/dist/chunks/{progress-CSxQH6-f.mjs.map → progress-BCl5yD5Q.mjs.map} +1 -1
  105. package/dist/chunks/scroll-area-DB3eUx8V.mjs +791 -0
  106. package/dist/chunks/scroll-area-DB3eUx8V.mjs.map +1 -0
  107. package/dist/chunks/select-Cw81y8pT.mjs +104 -0
  108. package/dist/chunks/{select-BR6_N_Yo.mjs.map → select-Cw81y8pT.mjs.map} +1 -1
  109. package/dist/chunks/separator-2k1C7RSn.mjs +48 -0
  110. package/dist/chunks/{separator-BB6-E9Z1.mjs.map → separator-2k1C7RSn.mjs.map} +1 -1
  111. package/dist/chunks/skeleton-qx8-vr62.mjs +13 -0
  112. package/dist/chunks/{skeleton-XPWWiaac.mjs.map → skeleton-qx8-vr62.mjs.map} +1 -1
  113. package/dist/chunks/sortable-D8ayoe_b.mjs +4221 -0
  114. package/dist/chunks/sortable-D8ayoe_b.mjs.map +1 -0
  115. package/dist/chunks/table-BDNUhtz-.mjs +62 -0
  116. package/dist/chunks/{table-LQIHzPHi.mjs.map → table-BDNUhtz-.mjs.map} +1 -1
  117. package/dist/chunks/toggle-CE2ycSdL.mjs +65 -0
  118. package/dist/chunks/{toggle-Co72WXGd.mjs.map → toggle-CE2ycSdL.mjs.map} +1 -1
  119. package/dist/chunks/tooltip-DLD0ycR4.mjs +596 -0
  120. package/dist/chunks/{tooltip-qX2HjdJP.mjs.map → tooltip-DLD0ycR4.mjs.map} +1 -1
  121. package/dist/chunks/tslib.es6-BgHLrbno.mjs +61 -0
  122. package/dist/chunks/{tslib.es6-cMGqxriw.mjs.map → tslib.es6-BgHLrbno.mjs.map} +1 -1
  123. package/dist/chunks/utils-BUelq9Ro.mjs +42 -0
  124. package/dist/chunks/utils-BUelq9Ro.mjs.map +1 -0
  125. package/dist/chunks/x-Bjz0Vo6R.mjs +22 -0
  126. package/dist/chunks/{x-BNLl0E-E.mjs.map → x-Bjz0Vo6R.mjs.map} +1 -1
  127. package/dist/combobox/index.mjs +65 -1
  128. package/dist/combobox/index.mjs.map +1 -1
  129. package/dist/command/index.mjs +23 -1
  130. package/dist/command/index.mjs.map +1 -1
  131. package/dist/data-table/index.mjs +673 -1
  132. package/dist/data-table/index.mjs.map +1 -1
  133. package/dist/dialog/index.mjs +22 -1
  134. package/dist/dialog/index.mjs.map +1 -1
  135. package/dist/dropdown-menu/index.mjs +438 -1
  136. package/dist/dropdown-menu/index.mjs.map +1 -1
  137. package/dist/dropzone/index.mjs +7839 -1
  138. package/dist/dropzone/index.mjs.map +1 -1
  139. package/dist/form/index.mjs +649 -1
  140. package/dist/form/index.mjs.map +1 -1
  141. package/dist/hover-card/index.mjs +18 -1
  142. package/dist/hover-card/index.mjs.map +1 -1
  143. package/dist/icon/index.mjs +317 -1
  144. package/dist/icon/index.mjs.map +1 -1
  145. package/dist/index.css +1 -1
  146. package/dist/input/index.mjs +4 -1
  147. package/dist/input/index.mjs.map +1 -1
  148. package/dist/ivt.css +1 -1
  149. package/dist/label/index.mjs +8 -1
  150. package/dist/label/index.mjs.map +1 -1
  151. package/dist/menubar/index.mjs +583 -1
  152. package/dist/menubar/index.mjs.map +1 -1
  153. package/dist/multi-select/index.mjs +297 -1
  154. package/dist/multi-select/index.mjs.map +1 -1
  155. package/dist/pagination/index.mjs +10 -1
  156. package/dist/pagination/index.mjs.map +1 -1
  157. package/dist/popover/index.mjs +21 -1
  158. package/dist/popover/index.mjs.map +1 -1
  159. package/dist/progress/index.mjs +9 -1
  160. package/dist/progress/index.mjs.map +1 -1
  161. package/dist/radio-group/index.mjs +267 -1
  162. package/dist/radio-group/index.mjs.map +1 -1
  163. package/dist/scroll-area/index.mjs +15 -1
  164. package/dist/scroll-area/index.mjs.map +1 -1
  165. package/dist/select/index.mjs +8 -1
  166. package/dist/select/index.mjs.map +1 -1
  167. package/dist/separator/index.mjs +8 -1
  168. package/dist/separator/index.mjs.map +1 -1
  169. package/dist/sheet/index.mjs +96 -1
  170. package/dist/sheet/index.mjs.map +1 -1
  171. package/dist/skeleton/index.mjs +4 -1
  172. package/dist/skeleton/index.mjs.map +1 -1
  173. package/dist/sonner/index.mjs +1140 -1
  174. package/dist/sonner/index.mjs.map +1 -1
  175. package/dist/sortable/index.mjs +8 -1
  176. package/dist/sortable/index.mjs.map +1 -1
  177. package/dist/table/index.mjs +4 -1
  178. package/dist/table/index.mjs.map +1 -1
  179. package/dist/tabs/index.mjs +193 -1
  180. package/dist/tabs/index.mjs.map +1 -1
  181. package/dist/textarea/index.mjs +13 -1
  182. package/dist/textarea/index.mjs.map +1 -1
  183. package/dist/toast/index.mjs +705 -1
  184. package/dist/toast/index.mjs.map +1 -1
  185. package/dist/toggle/index.mjs +12 -1
  186. package/dist/toggle/index.mjs.map +1 -1
  187. package/dist/toggle-group/index.mjs +219 -1
  188. package/dist/toggle-group/index.mjs.map +1 -1
  189. package/dist/tooltip/index.mjs +20 -1
  190. package/dist/tooltip/index.mjs.map +1 -1
  191. package/package.json +2 -2
  192. package/dist/chunks/_commonjsHelpers-6qLFzZa5.mjs +0 -2
  193. package/dist/chunks/_commonjsHelpers-6qLFzZa5.mjs.map +0 -1
  194. package/dist/chunks/accordion-CdshDFZC.mjs +0 -2
  195. package/dist/chunks/badge-BYqshEmA.mjs +0 -2
  196. package/dist/chunks/bundle-mjs-9BXytT_r.mjs +0 -2
  197. package/dist/chunks/button-DrFZXJ7z.mjs +0 -2
  198. package/dist/chunks/calendar-BY6t8wdJ.mjs +0 -2
  199. package/dist/chunks/calendar-BY6t8wdJ.mjs.map +0 -1
  200. package/dist/chunks/check-CimnOyD7.mjs +0 -2
  201. package/dist/chunks/chevron-down-D3fvbjxE.mjs +0 -2
  202. package/dist/chunks/chevron-left-CrN7DlXg.mjs +0 -2
  203. package/dist/chunks/chevron-right-BMSCuDGK.mjs +0 -2
  204. package/dist/chunks/chevrons-up-down-DBgvRkZm.mjs +0 -2
  205. package/dist/chunks/circle-CGqt18Bd.mjs +0 -2
  206. package/dist/chunks/command-C6ON-ciq.mjs +0 -2
  207. package/dist/chunks/command-C6ON-ciq.mjs.map +0 -1
  208. package/dist/chunks/createLucideIcon-L-tld2uc.mjs +0 -2
  209. package/dist/chunks/dialog-36eqHzT3.mjs +0 -2
  210. package/dist/chunks/hover-card-Cnd58du6.mjs +0 -2
  211. package/dist/chunks/index-B4QsDzeM.mjs +0 -2
  212. package/dist/chunks/index-B4QsDzeM.mjs.map +0 -1
  213. package/dist/chunks/index-BdpYc58_.mjs +0 -2
  214. package/dist/chunks/index-BdpYc58_.mjs.map +0 -1
  215. package/dist/chunks/index-CCcl327A.mjs +0 -2
  216. package/dist/chunks/index-CLtWFQL5.mjs +0 -2
  217. package/dist/chunks/index-COvW87ew.mjs +0 -2
  218. package/dist/chunks/index-COvW87ew.mjs.map +0 -1
  219. package/dist/chunks/index-CRxQlsb9.mjs +0 -2
  220. package/dist/chunks/index-CU_y1XAz.mjs +0 -2
  221. package/dist/chunks/index-CXszXOf_.mjs +0 -2
  222. package/dist/chunks/index-CdJCOoFA.mjs +0 -2
  223. package/dist/chunks/index-CdJCOoFA.mjs.map +0 -1
  224. package/dist/chunks/index-Cpq7N5Ej.mjs +0 -2
  225. package/dist/chunks/index-Cpq7N5Ej.mjs.map +0 -1
  226. package/dist/chunks/index-CybgQKpz.mjs +0 -2
  227. package/dist/chunks/index-D2sZp5OP.mjs +0 -2
  228. package/dist/chunks/index-DOyt-JEx.mjs +0 -2
  229. package/dist/chunks/index-DOyt-JEx.mjs.map +0 -1
  230. package/dist/chunks/index-DUNcuWJE.mjs +0 -2
  231. package/dist/chunks/index-DZHMFdr0.mjs +0 -2
  232. package/dist/chunks/index-LvOFIVGz.mjs +0 -2
  233. package/dist/chunks/index-lvPXnk5F.mjs +0 -2
  234. package/dist/chunks/index-lvPXnk5F.mjs.map +0 -1
  235. package/dist/chunks/index-vmPXTidH.mjs +0 -2
  236. package/dist/chunks/index-w9bxia3O.mjs +0 -2
  237. package/dist/chunks/index-xew3kygQ.mjs +0 -2
  238. package/dist/chunks/index-xew3kygQ.mjs.map +0 -1
  239. package/dist/chunks/input-85UFztMJ.mjs +0 -2
  240. package/dist/chunks/label-CICFzZIt.mjs +0 -2
  241. package/dist/chunks/pagination-CReDQes6.mjs +0 -2
  242. package/dist/chunks/popover-Cn2ZTvKd.mjs +0 -2
  243. package/dist/chunks/progress-CSxQH6-f.mjs +0 -2
  244. package/dist/chunks/scroll-area-CvCz7cL_.mjs +0 -2
  245. package/dist/chunks/scroll-area-CvCz7cL_.mjs.map +0 -1
  246. package/dist/chunks/select-BR6_N_Yo.mjs +0 -2
  247. package/dist/chunks/separator-BB6-E9Z1.mjs +0 -2
  248. package/dist/chunks/skeleton-XPWWiaac.mjs +0 -2
  249. package/dist/chunks/sortable-CqPFGn8Q.mjs +0 -2
  250. package/dist/chunks/sortable-CqPFGn8Q.mjs.map +0 -1
  251. package/dist/chunks/table-LQIHzPHi.mjs +0 -2
  252. package/dist/chunks/toggle-Co72WXGd.mjs +0 -2
  253. package/dist/chunks/tooltip-qX2HjdJP.mjs +0 -2
  254. package/dist/chunks/tslib.es6-cMGqxriw.mjs +0 -2
  255. package/dist/chunks/utils-BctauAA9.mjs +0 -2
  256. package/dist/chunks/utils-BctauAA9.mjs.map +0 -1
  257. package/dist/chunks/x-BNLl0E-E.mjs +0 -2
@@ -1,2 +1,1141 @@
1
- import t from"react";import e from"react-dom";const a=Array(12).fill(0),o=({visible:e,className:o})=>t.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":e},t.createElement("div",{className:"sonner-spinner"},a.map((e,a)=>t.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),r=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),n=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},t.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),s=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),i=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),l=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));let d=1;const c=new class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;const{message:a,...o}=t,r="number"==typeof(null==t?void 0:t.id)||(null==(e=t.id)?void 0:e.length)>0?t.id:d++,n=this.toasts.find(t=>t.id===r),s=void 0===t.dismissible||t.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),n?this.toasts=this.toasts.map(e=>e.id===r?(this.publish({...e,...t,id:r,title:a}),{...e,...t,id:r,dismissible:s,title:a}):e):this.addToast({title:a,...o,dismissible:s,id:r}),r},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(e=>e({id:t,dismiss:!0})))):this.toasts.forEach(t=>{this.subscribers.forEach(e=>e({id:t.id,dismiss:!0}))}),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(e,a)=>{if(!a)return;let o;void 0!==a.loading&&(o=this.create({...a,promise:e,type:"loading",message:a.loading,description:"function"!=typeof a.description?a.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let n,s=void 0!==o;const i=r.then(async e=>{n=["resolve",e];if(t.isValidElement(e))s=!1,this.create({id:o,type:"default",message:e});else if(u(e)&&!e.ok){s=!1;const r="function"==typeof a.error?await a.error(`HTTP error! status: ${e.status}`):a.error,n="function"==typeof a.description?await a.description(`HTTP error! status: ${e.status}`):a.description,i="object"==typeof r&&!t.isValidElement(r)?r:{message:r};this.create({id:o,type:"error",description:n,...i})}else if(e instanceof Error){s=!1;const r="function"==typeof a.error?await a.error(e):a.error,n="function"==typeof a.description?await a.description(e):a.description,i="object"==typeof r&&!t.isValidElement(r)?r:{message:r};this.create({id:o,type:"error",description:n,...i})}else if(void 0!==a.success){s=!1;const r="function"==typeof a.success?await a.success(e):a.success,n="function"==typeof a.description?await a.description(e):a.description,i="object"==typeof r&&!t.isValidElement(r)?r:{message:r};this.create({id:o,type:"success",description:n,...i})}}).catch(async e=>{if(n=["reject",e],void 0!==a.error){s=!1;const r="function"==typeof a.error?await a.error(e):a.error,n="function"==typeof a.description?await a.description(e):a.description,i="object"==typeof r&&!t.isValidElement(r)?r:{message:r};this.create({id:o,type:"error",description:n,...i})}}).finally(()=>{s&&(this.dismiss(o),o=void 0),null==a.finally||a.finally.call(a)}),l=()=>new Promise((t,e)=>i.then(()=>"reject"===n[0]?e(n[1]):t(n[1])).catch(e));return"string"!=typeof o&&"number"!=typeof o?{unwrap:l}:Object.assign(o,{unwrap:l})},this.custom=(t,e)=>{const a=(null==e?void 0:e.id)||d++;return this.create({jsx:t(a),id:a,...e}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},u=t=>t&&"object"==typeof t&&"ok"in t&&"boolean"==typeof t.ok&&"status"in t&&"number"==typeof t.status,m=(t,e)=>{const a=(null==e?void 0:e.id)||d++;return c.addToast({title:t,...e,id:a}),a};function f(t){return void 0!==t.label}Object.assign(m,{success:c.success,info:c.info,warning:c.warning,error:c.error,custom:c.custom,message:c.message,promise:c.promise,dismiss:c.dismiss,loading:c.loading},{getHistory:()=>c.toasts,getToasts:()=>c.getActiveToasts()}),function(t){if("undefined"==typeof document)return;let e=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",e.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const p=3,g=14;function h(...t){return t.filter(Boolean).join(" ")}const v=e=>{var a,d,c,u,m,p,g,v,b;const{invert:y,toast:w,unstyled:x,interacting:E,setHeights:k,visibleToasts:N,heights:B,index:T,toasts:S,expanded:M,removeToast:C,defaultRichColors:z,closeButton:j,style:R,cancelButtonStyle:D,actionButtonStyle:Y,className:$="",descriptionClassName:A="",duration:L,position:P,gap:I,expandByDefault:H,classNames:V,icons:X,closeButtonAriaLabel:O="Close toast"}=e,[U,F]=t.useState(null),[K,q]=t.useState(null),[W,G]=t.useState(!1),[J,Q]=t.useState(!1),[Z,_]=t.useState(!1),[tt,et]=t.useState(!1),[at,ot]=t.useState(!1),[rt,nt]=t.useState(0),[st,it]=t.useState(0),lt=t.useRef(w.duration||L||4e3),dt=t.useRef(null),ct=t.useRef(null),ut=0===T,mt=T+1<=N,ft=w.type,pt=!1!==w.dismissible,gt=w.className||"",ht=w.descriptionClassName||"",vt=t.useMemo(()=>B.findIndex(t=>t.toastId===w.id)||0,[B,w.id]),bt=t.useMemo(()=>{var t;return null!=(t=w.closeButton)?t:j},[w.closeButton,j]),yt=t.useMemo(()=>w.duration||L||4e3,[w.duration,L]),wt=t.useRef(0),xt=t.useRef(0),Et=t.useRef(0),kt=t.useRef(null),[Nt,Bt]=P.split("-"),Tt=t.useMemo(()=>B.reduce((t,e,a)=>a>=vt?t:t+e.height,0),[B,vt]),St=(()=>{const[e,a]=t.useState(document.hidden);return t.useEffect(()=>{const t=()=>{a(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),e})(),Mt=w.invert||y,Ct="loading"===ft;xt.current=t.useMemo(()=>vt*I+Tt,[vt,Tt]),t.useEffect(()=>{lt.current=yt},[yt]),t.useEffect(()=>{G(!0)},[]),t.useEffect(()=>{const t=ct.current;if(t){const e=t.getBoundingClientRect().height;return it(e),k(t=>[{toastId:w.id,height:e,position:w.position},...t]),()=>k(t=>t.filter(t=>t.toastId!==w.id))}},[k,w.id]),t.useLayoutEffect(()=>{if(!W)return;const t=ct.current,e=t.style.height;t.style.height="auto";const a=t.getBoundingClientRect().height;t.style.height=e,it(a),k(t=>t.find(t=>t.toastId===w.id)?t.map(t=>t.toastId===w.id?{...t,height:a}:t):[{toastId:w.id,height:a,position:w.position},...t])},[W,w.title,w.description,k,w.id,w.jsx,w.action,w.cancel]);const zt=t.useCallback(()=>{Q(!0),nt(xt.current),k(t=>t.filter(t=>t.toastId!==w.id)),setTimeout(()=>{C(w)},200)},[w,C,k,xt]);t.useEffect(()=>{if(w.promise&&"loading"===ft||w.duration===1/0||"loading"===w.type)return;let t;return M||E||St?(()=>{if(Et.current<wt.current){const t=(new Date).getTime()-wt.current;lt.current=lt.current-t}Et.current=(new Date).getTime()})():lt.current!==1/0&&(wt.current=(new Date).getTime(),t=setTimeout(()=>{null==w.onAutoClose||w.onAutoClose.call(w,w),zt()},lt.current)),()=>clearTimeout(t)},[M,E,w,ft,St,zt]),t.useEffect(()=>{w.delete&&(zt(),null==w.onDismiss||w.onDismiss.call(w,w))},[zt,w.delete]);const jt=w.icon||(null==X?void 0:X[ft])||(t=>{switch(t){case"success":return r;case"info":return s;case"warning":return n;case"error":return i;default:return null}})(ft);var Rt,Dt;return t.createElement("li",{tabIndex:0,ref:ct,className:h($,gt,null==V?void 0:V.toast,null==w||null==(a=w.classNames)?void 0:a.toast,null==V?void 0:V.default,null==V?void 0:V[ft],null==w||null==(d=w.classNames)?void 0:d[ft]),"data-sonner-toast":"","data-rich-colors":null!=(Rt=w.richColors)?Rt:z,"data-styled":!Boolean(w.jsx||w.unstyled||x),"data-mounted":W,"data-promise":Boolean(w.promise),"data-swiped":at,"data-removed":J,"data-visible":mt,"data-y-position":Nt,"data-x-position":Bt,"data-index":T,"data-front":ut,"data-swiping":Z,"data-dismissible":pt,"data-type":ft,"data-invert":Mt,"data-swipe-out":tt,"data-swipe-direction":K,"data-expanded":Boolean(M||H&&W),style:{"--index":T,"--toasts-before":T,"--z-index":S.length-T,"--offset":`${J?rt:xt.current}px`,"--initial-height":H?"auto":`${st}px`,...R,...w.style},onDragEnd:()=>{_(!1),F(null),kt.current=null},onPointerDown:t=>{2!==t.button&&!Ct&&pt&&(dt.current=new Date,nt(xt.current),t.target.setPointerCapture(t.pointerId),"BUTTON"!==t.target.tagName&&(_(!0),kt.current={x:t.clientX,y:t.clientY}))},onPointerUp:()=>{var t,e,a;if(tt||!pt)return;kt.current=null;const o=Number((null==(t=ct.current)?void 0:t.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),r=Number((null==(e=ct.current)?void 0:e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),n=(new Date).getTime()-(null==(a=dt.current)?void 0:a.getTime()),s="x"===U?o:r,i=Math.abs(s)/n;if(Math.abs(s)>=45||i>.11)return nt(xt.current),null==w.onDismiss||w.onDismiss.call(w,w),q("x"===U?o>0?"right":"left":r>0?"down":"up"),zt(),void et(!0);var l,d;null==(l=ct.current)||l.style.setProperty("--swipe-amount-x","0px"),null==(d=ct.current)||d.style.setProperty("--swipe-amount-y","0px"),ot(!1),_(!1),F(null)},onPointerMove:t=>{var a,o,r;if(!kt.current||!pt)return;if((null==(a=window.getSelection())?void 0:a.toString().length)>0)return;const n=t.clientY-kt.current.y,s=t.clientX-kt.current.x;var i;const l=null!=(i=e.swipeDirections)?i:function(t){const[e,a]=t.split("-"),o=[];return e&&o.push(e),a&&o.push(a),o}(P);!U&&(Math.abs(s)>1||Math.abs(n)>1)&&F(Math.abs(s)>Math.abs(n)?"x":"y");let d={x:0,y:0};const c=t=>1/(1.5+Math.abs(t)/20);if("y"===U){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&n<0||l.includes("bottom")&&n>0)d.y=n;else{const t=n*c(n);d.y=Math.abs(t)<Math.abs(n)?t:n}}else if("x"===U&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&s<0||l.includes("right")&&s>0)d.x=s;else{const t=s*c(s);d.x=Math.abs(t)<Math.abs(s)?t:s}(Math.abs(d.x)>0||Math.abs(d.y)>0)&&ot(!0),null==(o=ct.current)||o.style.setProperty("--swipe-amount-x",`${d.x}px`),null==(r=ct.current)||r.style.setProperty("--swipe-amount-y",`${d.y}px`)}},bt&&!w.jsx&&"loading"!==ft?t.createElement("button",{"aria-label":O,"data-disabled":Ct,"data-close-button":!0,onClick:Ct||!pt?()=>{}:()=>{zt(),null==w.onDismiss||w.onDismiss.call(w,w)},className:h(null==V?void 0:V.closeButton,null==w||null==(c=w.classNames)?void 0:c.closeButton)},null!=(Dt=null==X?void 0:X.close)?Dt:l):null,(ft||w.icon||w.promise)&&null!==w.icon&&(null!==(null==X?void 0:X[ft])||w.icon)?t.createElement("div",{"data-icon":"",className:h(null==V?void 0:V.icon,null==w||null==(u=w.classNames)?void 0:u.icon)},w.promise||"loading"===w.type&&!w.icon?w.icon||function(){var e,a;return(null==X?void 0:X.loading)?t.createElement("div",{className:h(null==V?void 0:V.loader,null==w||null==(a=w.classNames)?void 0:a.loader,"sonner-loader"),"data-visible":"loading"===ft},X.loading):t.createElement(o,{className:h(null==V?void 0:V.loader,null==w||null==(e=w.classNames)?void 0:e.loader),visible:"loading"===ft})}():null,"loading"!==w.type?jt:null):null,t.createElement("div",{"data-content":"",className:h(null==V?void 0:V.content,null==w||null==(m=w.classNames)?void 0:m.content)},t.createElement("div",{"data-title":"",className:h(null==V?void 0:V.title,null==w||null==(p=w.classNames)?void 0:p.title)},w.jsx?w.jsx:"function"==typeof w.title?w.title():w.title),w.description?t.createElement("div",{"data-description":"",className:h(A,ht,null==V?void 0:V.description,null==w||null==(g=w.classNames)?void 0:g.description)},"function"==typeof w.description?w.description():w.description):null),t.isValidElement(w.cancel)?w.cancel:w.cancel&&f(w.cancel)?t.createElement("button",{"data-button":!0,"data-cancel":!0,style:w.cancelButtonStyle||D,onClick:t=>{f(w.cancel)&&pt&&(null==w.cancel.onClick||w.cancel.onClick.call(w.cancel,t),zt())},className:h(null==V?void 0:V.cancelButton,null==w||null==(v=w.classNames)?void 0:v.cancelButton)},w.cancel.label):null,t.isValidElement(w.action)?w.action:w.action&&f(w.action)?t.createElement("button",{"data-button":!0,"data-action":!0,style:w.actionButtonStyle||Y,onClick:t=>{f(w.action)&&(null==w.action.onClick||w.action.onClick.call(w.action,t),t.defaultPrevented||zt())},className:h(null==V?void 0:V.actionButton,null==w||null==(b=w.classNames)?void 0:b.actionButton)},w.action.label):null)};function b(){if("undefined"==typeof window)return"ltr";if("undefined"==typeof document)return"ltr";const t=document.documentElement.getAttribute("dir");return"auto"!==t&&t?t:window.getComputedStyle(document.documentElement).direction}function y(t,e){const a={};return[t,e].forEach((t,e)=>{const o=1===e,r=o?"--mobile-offset":"--offset",n=o?"16px":"24px";function s(t){["top","right","bottom","left"].forEach(e=>{a[`${r}-${e}`]="number"==typeof t?`${t}px`:t})}"number"==typeof t||"string"==typeof t?s(t):"object"==typeof t?["top","right","bottom","left"].forEach(e=>{void 0===t[e]?a[`${r}-${e}`]=n:a[`${r}-${e}`]="number"==typeof t[e]?`${t[e]}px`:t[e]}):s(n)}),a}const w=t.forwardRef(function(a,o){const{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:l,className:d,offset:u,mobileOffset:m,theme:f="light",richColors:h,duration:w,style:x,visibleToasts:E=p,toastOptions:k,dir:N=b(),gap:B=g,icons:T,containerAriaLabel:S="Notifications"}=a,[M,C]=t.useState([]),z=t.useMemo(()=>Array.from(new Set([n].concat(M.filter(t=>t.position).map(t=>t.position)))),[M,n]),[j,R]=t.useState([]),[D,Y]=t.useState(!1),[$,A]=t.useState(!1),[L,P]=t.useState("system"!==f?f:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=t.useRef(null),H=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=t.useRef(null),X=t.useRef(!1),O=t.useCallback(t=>{C(e=>{var a;return(null==(a=e.find(e=>e.id===t.id))?void 0:a.delete)||c.dismiss(t.id),e.filter(({id:e})=>e!==t.id)})},[]);return t.useEffect(()=>c.subscribe(t=>{t.dismiss?requestAnimationFrame(()=>{C(e=>e.map(e=>e.id===t.id?{...e,delete:!0}:e))}):setTimeout(()=>{e.flushSync(()=>{C(e=>{const a=e.findIndex(e=>e.id===t.id);return-1!==a?[...e.slice(0,a),{...e[a],...t},...e.slice(a+1)]:[t,...e]})})})}),[M]),t.useEffect(()=>{if("system"!==f)return void P(f);if("system"===f&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?P("dark"):P("light")),"undefined"==typeof window)return;const t=window.matchMedia("(prefers-color-scheme: dark)");try{t.addEventListener("change",({matches:t})=>{P(t?"dark":"light")})}catch(e){t.addListener(({matches:t})=>{try{P(t?"dark":"light")}catch(t){}})}},[f]),t.useEffect(()=>{M.length<=1&&Y(!1)},[M]),t.useEffect(()=>{const t=t=>{var e;var a;s.every(e=>t[e]||t.code===e)&&(Y(!0),null==(a=I.current)||a.focus());"Escape"!==t.code||document.activeElement!==I.current&&!(null==(e=I.current)?void 0:e.contains(document.activeElement))||Y(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),t.useEffect(()=>{if(I.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,X.current=!1)}},[I.current]),t.createElement("section",{ref:o,"aria-label":`${S} ${H}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},z.map((e,o)=>{var n;const[s,c]=e.split("-");return M.length?t.createElement("ol",{key:e,dir:"auto"===N?b():N,tabIndex:-1,ref:I,className:d,"data-sonner-toaster":!0,"data-sonner-theme":L,"data-y-position":s,"data-x-position":c,style:{"--front-toast-height":`${(null==(n=j[0])?void 0:n.height)||0}px`,"--width":"356px","--gap":`${B}px`,...x,...y(u,m)},onBlur:t=>{X.current&&!t.currentTarget.contains(t.relatedTarget)&&(X.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:t=>{t.target instanceof HTMLElement&&"false"===t.target.dataset.dismissible||X.current||(X.current=!0,V.current=t.relatedTarget)},onMouseEnter:()=>Y(!0),onMouseMove:()=>Y(!0),onMouseLeave:()=>{$||Y(!1)},onDragEnd:()=>Y(!1),onPointerDown:t=>{t.target instanceof HTMLElement&&"false"===t.target.dataset.dismissible||A(!0)},onPointerUp:()=>A(!1)},M.filter(t=>!t.position&&0===o||t.position===e).map((o,n)=>{var s,d;return t.createElement(v,{key:o.id,icons:T,index:n,toast:o,defaultRichColors:h,duration:null!=(s=null==k?void 0:k.duration)?s:w,className:null==k?void 0:k.className,descriptionClassName:null==k?void 0:k.descriptionClassName,invert:r,visibleToasts:E,closeButton:null!=(d=null==k?void 0:k.closeButton)?d:l,interacting:$,position:e,style:null==k?void 0:k.style,unstyled:null==k?void 0:k.unstyled,classNames:null==k?void 0:k.classNames,cancelButtonStyle:null==k?void 0:k.cancelButtonStyle,actionButtonStyle:null==k?void 0:k.actionButtonStyle,closeButtonAriaLabel:null==k?void 0:k.closeButtonAriaLabel,removeToast:O,toasts:M.filter(t=>t.position==o.position),heights:j.filter(t=>t.position==o.position),setHeights:R,expandByDefault:i,gap:B,expanded:D,swipeDirections:a.swipeDirections})})):null}))}),x=({...e})=>t.createElement(w,{className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...e});export{x as Toaster};
1
+ import React__default from 'react';
2
+ import ReactDOM__default from 'react-dom';
3
+
4
+ function __insertCSS(code) {
5
+ if (typeof document == 'undefined') return;
6
+ let head = document.head || document.getElementsByTagName('head')[0];
7
+ let style = document.createElement('style');
8
+ style.type = 'text/css';
9
+ head.appendChild(style);
10
+ style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
11
+ }
12
+ const getAsset = (type)=>{
13
+ switch(type){
14
+ case 'success':
15
+ return SuccessIcon;
16
+ case 'info':
17
+ return InfoIcon;
18
+ case 'warning':
19
+ return WarningIcon;
20
+ case 'error':
21
+ return ErrorIcon;
22
+ default:
23
+ return null;
24
+ }
25
+ };
26
+ const bars = Array(12).fill(0);
27
+ const Loader = ({ visible, className })=>{
28
+ return /*#__PURE__*/ React__default.createElement("div", {
29
+ className: [
30
+ 'sonner-loading-wrapper',
31
+ className
32
+ ].filter(Boolean).join(' '),
33
+ "data-visible": visible
34
+ }, /*#__PURE__*/ React__default.createElement("div", {
35
+ className: "sonner-spinner"
36
+ }, bars.map((_, i)=>/*#__PURE__*/ React__default.createElement("div", {
37
+ className: "sonner-loading-bar",
38
+ key: `spinner-bar-${i}`
39
+ }))));
40
+ };
41
+ const SuccessIcon = /*#__PURE__*/ React__default.createElement("svg", {
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ viewBox: "0 0 20 20",
44
+ fill: "currentColor",
45
+ height: "20",
46
+ width: "20"
47
+ }, /*#__PURE__*/ React__default.createElement("path", {
48
+ fillRule: "evenodd",
49
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
50
+ clipRule: "evenodd"
51
+ }));
52
+ const WarningIcon = /*#__PURE__*/ React__default.createElement("svg", {
53
+ xmlns: "http://www.w3.org/2000/svg",
54
+ viewBox: "0 0 24 24",
55
+ fill: "currentColor",
56
+ height: "20",
57
+ width: "20"
58
+ }, /*#__PURE__*/ React__default.createElement("path", {
59
+ fillRule: "evenodd",
60
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
61
+ clipRule: "evenodd"
62
+ }));
63
+ const InfoIcon = /*#__PURE__*/ React__default.createElement("svg", {
64
+ xmlns: "http://www.w3.org/2000/svg",
65
+ viewBox: "0 0 20 20",
66
+ fill: "currentColor",
67
+ height: "20",
68
+ width: "20"
69
+ }, /*#__PURE__*/ React__default.createElement("path", {
70
+ fillRule: "evenodd",
71
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
72
+ clipRule: "evenodd"
73
+ }));
74
+ const ErrorIcon = /*#__PURE__*/ React__default.createElement("svg", {
75
+ xmlns: "http://www.w3.org/2000/svg",
76
+ viewBox: "0 0 20 20",
77
+ fill: "currentColor",
78
+ height: "20",
79
+ width: "20"
80
+ }, /*#__PURE__*/ React__default.createElement("path", {
81
+ fillRule: "evenodd",
82
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
83
+ clipRule: "evenodd"
84
+ }));
85
+ const CloseIcon = /*#__PURE__*/ React__default.createElement("svg", {
86
+ xmlns: "http://www.w3.org/2000/svg",
87
+ width: "12",
88
+ height: "12",
89
+ viewBox: "0 0 24 24",
90
+ fill: "none",
91
+ stroke: "currentColor",
92
+ strokeWidth: "1.5",
93
+ strokeLinecap: "round",
94
+ strokeLinejoin: "round"
95
+ }, /*#__PURE__*/ React__default.createElement("line", {
96
+ x1: "18",
97
+ y1: "6",
98
+ x2: "6",
99
+ y2: "18"
100
+ }), /*#__PURE__*/ React__default.createElement("line", {
101
+ x1: "6",
102
+ y1: "6",
103
+ x2: "18",
104
+ y2: "18"
105
+ }));
106
+ const useIsDocumentHidden = ()=>{
107
+ const [isDocumentHidden, setIsDocumentHidden] = React__default.useState(document.hidden);
108
+ React__default.useEffect(()=>{
109
+ const callback = ()=>{
110
+ setIsDocumentHidden(document.hidden);
111
+ };
112
+ document.addEventListener('visibilitychange', callback);
113
+ return ()=>window.removeEventListener('visibilitychange', callback);
114
+ }, []);
115
+ return isDocumentHidden;
116
+ };
117
+ let toastsCounter = 1;
118
+ class Observer {
119
+ constructor(){
120
+ // We use arrow functions to maintain the correct `this` reference
121
+ this.subscribe = (subscriber)=>{
122
+ this.subscribers.push(subscriber);
123
+ return ()=>{
124
+ const index = this.subscribers.indexOf(subscriber);
125
+ this.subscribers.splice(index, 1);
126
+ };
127
+ };
128
+ this.publish = (data)=>{
129
+ this.subscribers.forEach((subscriber)=>subscriber(data));
130
+ };
131
+ this.addToast = (data)=>{
132
+ this.publish(data);
133
+ this.toasts = [
134
+ ...this.toasts,
135
+ data
136
+ ];
137
+ };
138
+ this.create = (data)=>{
139
+ var _data_id;
140
+ const { message, ...rest } = data;
141
+ const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
142
+ const alreadyExists = this.toasts.find((toast)=>{
143
+ return toast.id === id;
144
+ });
145
+ const dismissible = data.dismissible === undefined ? true : data.dismissible;
146
+ if (this.dismissedToasts.has(id)) {
147
+ this.dismissedToasts.delete(id);
148
+ }
149
+ if (alreadyExists) {
150
+ this.toasts = this.toasts.map((toast)=>{
151
+ if (toast.id === id) {
152
+ this.publish({
153
+ ...toast,
154
+ ...data,
155
+ id,
156
+ title: message
157
+ });
158
+ return {
159
+ ...toast,
160
+ ...data,
161
+ id,
162
+ dismissible,
163
+ title: message
164
+ };
165
+ }
166
+ return toast;
167
+ });
168
+ } else {
169
+ this.addToast({
170
+ title: message,
171
+ ...rest,
172
+ dismissible,
173
+ id
174
+ });
175
+ }
176
+ return id;
177
+ };
178
+ this.dismiss = (id)=>{
179
+ if (id) {
180
+ this.dismissedToasts.add(id);
181
+ requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({
182
+ id,
183
+ dismiss: true
184
+ })));
185
+ } else {
186
+ this.toasts.forEach((toast)=>{
187
+ this.subscribers.forEach((subscriber)=>subscriber({
188
+ id: toast.id,
189
+ dismiss: true
190
+ }));
191
+ });
192
+ }
193
+ return id;
194
+ };
195
+ this.message = (message, data)=>{
196
+ return this.create({
197
+ ...data,
198
+ message
199
+ });
200
+ };
201
+ this.error = (message, data)=>{
202
+ return this.create({
203
+ ...data,
204
+ message,
205
+ type: 'error'
206
+ });
207
+ };
208
+ this.success = (message, data)=>{
209
+ return this.create({
210
+ ...data,
211
+ type: 'success',
212
+ message
213
+ });
214
+ };
215
+ this.info = (message, data)=>{
216
+ return this.create({
217
+ ...data,
218
+ type: 'info',
219
+ message
220
+ });
221
+ };
222
+ this.warning = (message, data)=>{
223
+ return this.create({
224
+ ...data,
225
+ type: 'warning',
226
+ message
227
+ });
228
+ };
229
+ this.loading = (message, data)=>{
230
+ return this.create({
231
+ ...data,
232
+ type: 'loading',
233
+ message
234
+ });
235
+ };
236
+ this.promise = (promise, data)=>{
237
+ if (!data) {
238
+ // Nothing to show
239
+ return;
240
+ }
241
+ let id = undefined;
242
+ if (data.loading !== undefined) {
243
+ id = this.create({
244
+ ...data,
245
+ promise,
246
+ type: 'loading',
247
+ message: data.loading,
248
+ description: typeof data.description !== 'function' ? data.description : undefined
249
+ });
250
+ }
251
+ const p = Promise.resolve(promise instanceof Function ? promise() : promise);
252
+ let shouldDismiss = id !== undefined;
253
+ let result;
254
+ const originalPromise = p.then(async (response)=>{
255
+ result = [
256
+ 'resolve',
257
+ response
258
+ ];
259
+ const isReactElementResponse = React__default.isValidElement(response);
260
+ if (isReactElementResponse) {
261
+ shouldDismiss = false;
262
+ this.create({
263
+ id,
264
+ type: 'default',
265
+ message: response
266
+ });
267
+ } else if (isHttpResponse(response) && !response.ok) {
268
+ shouldDismiss = false;
269
+ const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
270
+ const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
271
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
272
+ const toastSettings = isExtendedResult ? promiseData : {
273
+ message: promiseData
274
+ };
275
+ this.create({
276
+ id,
277
+ type: 'error',
278
+ description,
279
+ ...toastSettings
280
+ });
281
+ } else if (response instanceof Error) {
282
+ shouldDismiss = false;
283
+ const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;
284
+ const description = typeof data.description === 'function' ? await data.description(response) : data.description;
285
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
286
+ const toastSettings = isExtendedResult ? promiseData : {
287
+ message: promiseData
288
+ };
289
+ this.create({
290
+ id,
291
+ type: 'error',
292
+ description,
293
+ ...toastSettings
294
+ });
295
+ } else if (data.success !== undefined) {
296
+ shouldDismiss = false;
297
+ const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;
298
+ const description = typeof data.description === 'function' ? await data.description(response) : data.description;
299
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
300
+ const toastSettings = isExtendedResult ? promiseData : {
301
+ message: promiseData
302
+ };
303
+ this.create({
304
+ id,
305
+ type: 'success',
306
+ description,
307
+ ...toastSettings
308
+ });
309
+ }
310
+ }).catch(async (error)=>{
311
+ result = [
312
+ 'reject',
313
+ error
314
+ ];
315
+ if (data.error !== undefined) {
316
+ shouldDismiss = false;
317
+ const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;
318
+ const description = typeof data.description === 'function' ? await data.description(error) : data.description;
319
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
320
+ const toastSettings = isExtendedResult ? promiseData : {
321
+ message: promiseData
322
+ };
323
+ this.create({
324
+ id,
325
+ type: 'error',
326
+ description,
327
+ ...toastSettings
328
+ });
329
+ }
330
+ }).finally(()=>{
331
+ if (shouldDismiss) {
332
+ // Toast is still in load state (and will be indefinitely — dismiss it)
333
+ this.dismiss(id);
334
+ id = undefined;
335
+ }
336
+ data.finally == null ? void 0 : data.finally.call(data);
337
+ });
338
+ const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));
339
+ if (typeof id !== 'string' && typeof id !== 'number') {
340
+ // cannot Object.assign on undefined
341
+ return {
342
+ unwrap
343
+ };
344
+ } else {
345
+ return Object.assign(id, {
346
+ unwrap
347
+ });
348
+ }
349
+ };
350
+ this.custom = (jsx, data)=>{
351
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
352
+ this.create({
353
+ jsx: jsx(id),
354
+ id,
355
+ ...data
356
+ });
357
+ return id;
358
+ };
359
+ this.getActiveToasts = ()=>{
360
+ return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));
361
+ };
362
+ this.subscribers = [];
363
+ this.toasts = [];
364
+ this.dismissedToasts = new Set();
365
+ }
366
+ }
367
+ const ToastState = new Observer();
368
+ // bind this to the toast function
369
+ const toastFunction = (message, data)=>{
370
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
371
+ ToastState.addToast({
372
+ title: message,
373
+ ...data,
374
+ id
375
+ });
376
+ return id;
377
+ };
378
+ const isHttpResponse = (data)=>{
379
+ return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';
380
+ };
381
+ const basicToast = toastFunction;
382
+ const getHistory = ()=>ToastState.toasts;
383
+ const getToasts = ()=>ToastState.getActiveToasts();
384
+ // We use `Object.assign` to maintain the correct types as we would lose them otherwise
385
+ Object.assign(basicToast, {
386
+ success: ToastState.success,
387
+ info: ToastState.info,
388
+ warning: ToastState.warning,
389
+ error: ToastState.error,
390
+ custom: ToastState.custom,
391
+ message: ToastState.message,
392
+ promise: ToastState.promise,
393
+ dismiss: ToastState.dismiss,
394
+ loading: ToastState.loading
395
+ }, {
396
+ getHistory,
397
+ getToasts
398
+ });
399
+ __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
400
+ function isAction(action) {
401
+ return action.label !== undefined;
402
+ }
403
+ // Visible toasts amount
404
+ const VISIBLE_TOASTS_AMOUNT = 3;
405
+ // Viewport padding
406
+ const VIEWPORT_OFFSET = '24px';
407
+ // Mobile viewport padding
408
+ const MOBILE_VIEWPORT_OFFSET = '16px';
409
+ // Default lifetime of a toasts (in ms)
410
+ const TOAST_LIFETIME = 4000;
411
+ // Default toast width
412
+ const TOAST_WIDTH = 356;
413
+ // Default gap between toasts
414
+ const GAP = 14;
415
+ // Threshold to dismiss a toast
416
+ const SWIPE_THRESHOLD = 45;
417
+ // Equal to exit animation duration
418
+ const TIME_BEFORE_UNMOUNT = 200;
419
+ function cn(...classes) {
420
+ return classes.filter(Boolean).join(' ');
421
+ }
422
+ function getDefaultSwipeDirections(position) {
423
+ const [y, x] = position.split('-');
424
+ const directions = [];
425
+ if (y) {
426
+ directions.push(y);
427
+ }
428
+ if (x) {
429
+ directions.push(x);
430
+ }
431
+ return directions;
432
+ }
433
+ const Toast = (props)=>{
434
+ var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
435
+ const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = '', descriptionClassName = '', duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = 'Close toast' } = props;
436
+ const [swipeDirection, setSwipeDirection] = React__default.useState(null);
437
+ const [swipeOutDirection, setSwipeOutDirection] = React__default.useState(null);
438
+ const [mounted, setMounted] = React__default.useState(false);
439
+ const [removed, setRemoved] = React__default.useState(false);
440
+ const [swiping, setSwiping] = React__default.useState(false);
441
+ const [swipeOut, setSwipeOut] = React__default.useState(false);
442
+ const [isSwiped, setIsSwiped] = React__default.useState(false);
443
+ const [offsetBeforeRemove, setOffsetBeforeRemove] = React__default.useState(0);
444
+ const [initialHeight, setInitialHeight] = React__default.useState(0);
445
+ const remainingTime = React__default.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME);
446
+ const dragStartTime = React__default.useRef(null);
447
+ const toastRef = React__default.useRef(null);
448
+ const isFront = index === 0;
449
+ const isVisible = index + 1 <= visibleToasts;
450
+ const toastType = toast.type;
451
+ const dismissible = toast.dismissible !== false;
452
+ const toastClassname = toast.className || '';
453
+ const toastDescriptionClassname = toast.descriptionClassName || '';
454
+ // Height index is used to calculate the offset as it gets updated before the toast array, which means we can calculate the new layout faster.
455
+ const heightIndex = React__default.useMemo(()=>heights.findIndex((height)=>height.toastId === toast.id) || 0, [
456
+ heights,
457
+ toast.id
458
+ ]);
459
+ const closeButton = React__default.useMemo(()=>{
460
+ var _toast_closeButton;
461
+ return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
462
+ }, [
463
+ toast.closeButton,
464
+ closeButtonFromToaster
465
+ ]);
466
+ const duration = React__default.useMemo(()=>toast.duration || durationFromToaster || TOAST_LIFETIME, [
467
+ toast.duration,
468
+ durationFromToaster
469
+ ]);
470
+ const closeTimerStartTimeRef = React__default.useRef(0);
471
+ const offset = React__default.useRef(0);
472
+ const lastCloseTimerStartTimeRef = React__default.useRef(0);
473
+ const pointerStartRef = React__default.useRef(null);
474
+ const [y, x] = position.split('-');
475
+ const toastsHeightBefore = React__default.useMemo(()=>{
476
+ return heights.reduce((prev, curr, reducerIndex)=>{
477
+ // Calculate offset up until current toast
478
+ if (reducerIndex >= heightIndex) {
479
+ return prev;
480
+ }
481
+ return prev + curr.height;
482
+ }, 0);
483
+ }, [
484
+ heights,
485
+ heightIndex
486
+ ]);
487
+ const isDocumentHidden = useIsDocumentHidden();
488
+ const invert = toast.invert || ToasterInvert;
489
+ const disabled = toastType === 'loading';
490
+ offset.current = React__default.useMemo(()=>heightIndex * gap + toastsHeightBefore, [
491
+ heightIndex,
492
+ toastsHeightBefore
493
+ ]);
494
+ React__default.useEffect(()=>{
495
+ remainingTime.current = duration;
496
+ }, [
497
+ duration
498
+ ]);
499
+ React__default.useEffect(()=>{
500
+ // Trigger enter animation without using CSS animation
501
+ setMounted(true);
502
+ }, []);
503
+ React__default.useEffect(()=>{
504
+ const toastNode = toastRef.current;
505
+ if (toastNode) {
506
+ const height = toastNode.getBoundingClientRect().height;
507
+ // Add toast height to heights array after the toast is mounted
508
+ setInitialHeight(height);
509
+ setHeights((h)=>[
510
+ {
511
+ toastId: toast.id,
512
+ height,
513
+ position: toast.position
514
+ },
515
+ ...h
516
+ ]);
517
+ return ()=>setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
518
+ }
519
+ }, [
520
+ setHeights,
521
+ toast.id
522
+ ]);
523
+ React__default.useLayoutEffect(()=>{
524
+ // Keep height up to date with the content in case it updates
525
+ if (!mounted) return;
526
+ const toastNode = toastRef.current;
527
+ const originalHeight = toastNode.style.height;
528
+ toastNode.style.height = 'auto';
529
+ const newHeight = toastNode.getBoundingClientRect().height;
530
+ toastNode.style.height = originalHeight;
531
+ setInitialHeight(newHeight);
532
+ setHeights((heights)=>{
533
+ const alreadyExists = heights.find((height)=>height.toastId === toast.id);
534
+ if (!alreadyExists) {
535
+ return [
536
+ {
537
+ toastId: toast.id,
538
+ height: newHeight,
539
+ position: toast.position
540
+ },
541
+ ...heights
542
+ ];
543
+ } else {
544
+ return heights.map((height)=>height.toastId === toast.id ? {
545
+ ...height,
546
+ height: newHeight
547
+ } : height);
548
+ }
549
+ });
550
+ }, [
551
+ mounted,
552
+ toast.title,
553
+ toast.description,
554
+ setHeights,
555
+ toast.id,
556
+ toast.jsx,
557
+ toast.action,
558
+ toast.cancel
559
+ ]);
560
+ const deleteToast = React__default.useCallback(()=>{
561
+ // Save the offset for the exit swipe animation
562
+ setRemoved(true);
563
+ setOffsetBeforeRemove(offset.current);
564
+ setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
565
+ setTimeout(()=>{
566
+ removeToast(toast);
567
+ }, TIME_BEFORE_UNMOUNT);
568
+ }, [
569
+ toast,
570
+ removeToast,
571
+ setHeights,
572
+ offset
573
+ ]);
574
+ React__default.useEffect(()=>{
575
+ if (toast.promise && toastType === 'loading' || toast.duration === Infinity || toast.type === 'loading') return;
576
+ let timeoutId;
577
+ // Pause the timer on each hover
578
+ const pauseTimer = ()=>{
579
+ if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
580
+ // Get the elapsed time since the timer started
581
+ const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;
582
+ remainingTime.current = remainingTime.current - elapsedTime;
583
+ }
584
+ lastCloseTimerStartTimeRef.current = new Date().getTime();
585
+ };
586
+ const startTimer = ()=>{
587
+ // setTimeout(, Infinity) behaves as if the delay is 0.
588
+ // As a result, the toast would be closed immediately, giving the appearance that it was never rendered.
589
+ // See: https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#an-infinite-timeout
590
+ if (remainingTime.current === Infinity) return;
591
+ closeTimerStartTimeRef.current = new Date().getTime();
592
+ // Let the toast know it has started
593
+ timeoutId = setTimeout(()=>{
594
+ toast.onAutoClose == null ? void 0 : toast.onAutoClose.call(toast, toast);
595
+ deleteToast();
596
+ }, remainingTime.current);
597
+ };
598
+ if (expanded || interacting || isDocumentHidden) {
599
+ pauseTimer();
600
+ } else {
601
+ startTimer();
602
+ }
603
+ return ()=>clearTimeout(timeoutId);
604
+ }, [
605
+ expanded,
606
+ interacting,
607
+ toast,
608
+ toastType,
609
+ isDocumentHidden,
610
+ deleteToast
611
+ ]);
612
+ React__default.useEffect(()=>{
613
+ if (toast.delete) {
614
+ deleteToast();
615
+ toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
616
+ }
617
+ }, [
618
+ deleteToast,
619
+ toast.delete
620
+ ]);
621
+ function getLoadingIcon() {
622
+ var _toast_classNames;
623
+ if (icons == null ? void 0 : icons.loading) {
624
+ var _toast_classNames1;
625
+ return /*#__PURE__*/ React__default.createElement("div", {
626
+ className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1.loader, 'sonner-loader'),
627
+ "data-visible": toastType === 'loading'
628
+ }, icons.loading);
629
+ }
630
+ return /*#__PURE__*/ React__default.createElement(Loader, {
631
+ className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.loader),
632
+ visible: toastType === 'loading'
633
+ });
634
+ }
635
+ const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
636
+ var _toast_richColors, _icons_close;
637
+ return /*#__PURE__*/ React__default.createElement("li", {
638
+ tabIndex: 0,
639
+ ref: toastRef,
640
+ className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastType]),
641
+ "data-sonner-toast": "",
642
+ "data-rich-colors": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors,
643
+ "data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled),
644
+ "data-mounted": mounted,
645
+ "data-promise": Boolean(toast.promise),
646
+ "data-swiped": isSwiped,
647
+ "data-removed": removed,
648
+ "data-visible": isVisible,
649
+ "data-y-position": y,
650
+ "data-x-position": x,
651
+ "data-index": index,
652
+ "data-front": isFront,
653
+ "data-swiping": swiping,
654
+ "data-dismissible": dismissible,
655
+ "data-type": toastType,
656
+ "data-invert": invert,
657
+ "data-swipe-out": swipeOut,
658
+ "data-swipe-direction": swipeOutDirection,
659
+ "data-expanded": Boolean(expanded || expandByDefault && mounted),
660
+ "data-testid": toast.testId,
661
+ style: {
662
+ '--index': index,
663
+ '--toasts-before': index,
664
+ '--z-index': toasts.length - index,
665
+ '--offset': `${removed ? offsetBeforeRemove : offset.current}px`,
666
+ '--initial-height': expandByDefault ? 'auto' : `${initialHeight}px`,
667
+ ...style,
668
+ ...toast.style
669
+ },
670
+ onDragEnd: ()=>{
671
+ setSwiping(false);
672
+ setSwipeDirection(null);
673
+ pointerStartRef.current = null;
674
+ },
675
+ onPointerDown: (event)=>{
676
+ if (event.button === 2) return; // Return early on right click
677
+ if (disabled || !dismissible) return;
678
+ dragStartTime.current = new Date();
679
+ setOffsetBeforeRemove(offset.current);
680
+ // Ensure we maintain correct pointer capture even when going outside of the toast (e.g. when swiping)
681
+ event.target.setPointerCapture(event.pointerId);
682
+ if (event.target.tagName === 'BUTTON') return;
683
+ setSwiping(true);
684
+ pointerStartRef.current = {
685
+ x: event.clientX,
686
+ y: event.clientY
687
+ };
688
+ },
689
+ onPointerUp: ()=>{
690
+ var _toastRef_current, _toastRef_current1, _dragStartTime_current;
691
+ if (swipeOut || !dismissible) return;
692
+ pointerStartRef.current = null;
693
+ const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue('--swipe-amount-x').replace('px', '')) || 0);
694
+ const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue('--swipe-amount-y').replace('px', '')) || 0);
695
+ const timeTaken = new Date().getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
696
+ const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY;
697
+ const velocity = Math.abs(swipeAmount) / timeTaken;
698
+ if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
699
+ setOffsetBeforeRemove(offset.current);
700
+ toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
701
+ if (swipeDirection === 'x') {
702
+ setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left');
703
+ } else {
704
+ setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up');
705
+ }
706
+ deleteToast();
707
+ setSwipeOut(true);
708
+ return;
709
+ } else {
710
+ var _toastRef_current2, _toastRef_current3;
711
+ (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty('--swipe-amount-x', `0px`);
712
+ (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty('--swipe-amount-y', `0px`);
713
+ }
714
+ setIsSwiped(false);
715
+ setSwiping(false);
716
+ setSwipeDirection(null);
717
+ },
718
+ onPointerMove: (event)=>{
719
+ var _window_getSelection, _toastRef_current, _toastRef_current1;
720
+ if (!pointerStartRef.current || !dismissible) return;
721
+ const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
722
+ if (isHighlighted) return;
723
+ const yDelta = event.clientY - pointerStartRef.current.y;
724
+ const xDelta = event.clientX - pointerStartRef.current.x;
725
+ var _props_swipeDirections;
726
+ const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
727
+ // Determine swipe direction if not already locked
728
+ if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
729
+ setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y');
730
+ }
731
+ let swipeAmount = {
732
+ x: 0,
733
+ y: 0
734
+ };
735
+ const getDampening = (delta)=>{
736
+ const factor = Math.abs(delta) / 20;
737
+ return 1 / (1.5 + factor);
738
+ };
739
+ // Only apply swipe in the locked direction
740
+ if (swipeDirection === 'y') {
741
+ // Handle vertical swipes
742
+ if (swipeDirections.includes('top') || swipeDirections.includes('bottom')) {
743
+ if (swipeDirections.includes('top') && yDelta < 0 || swipeDirections.includes('bottom') && yDelta > 0) {
744
+ swipeAmount.y = yDelta;
745
+ } else {
746
+ // Smoothly transition to dampened movement
747
+ const dampenedDelta = yDelta * getDampening(yDelta);
748
+ // Ensure we don't jump when transitioning to dampened movement
749
+ swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
750
+ }
751
+ }
752
+ } else if (swipeDirection === 'x') {
753
+ // Handle horizontal swipes
754
+ if (swipeDirections.includes('left') || swipeDirections.includes('right')) {
755
+ if (swipeDirections.includes('left') && xDelta < 0 || swipeDirections.includes('right') && xDelta > 0) {
756
+ swipeAmount.x = xDelta;
757
+ } else {
758
+ // Smoothly transition to dampened movement
759
+ const dampenedDelta = xDelta * getDampening(xDelta);
760
+ // Ensure we don't jump when transitioning to dampened movement
761
+ swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
762
+ }
763
+ }
764
+ }
765
+ if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
766
+ setIsSwiped(true);
767
+ }
768
+ (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty('--swipe-amount-x', `${swipeAmount.x}px`);
769
+ (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty('--swipe-amount-y', `${swipeAmount.y}px`);
770
+ }
771
+ }, closeButton && !toast.jsx && toastType !== 'loading' ? /*#__PURE__*/ React__default.createElement("button", {
772
+ "aria-label": closeButtonAriaLabel,
773
+ "data-disabled": disabled,
774
+ "data-close-button": true,
775
+ onClick: disabled || !dismissible ? ()=>{} : ()=>{
776
+ deleteToast();
777
+ toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
778
+ },
779
+ className: cn(classNames == null ? void 0 : classNames.closeButton, toast == null ? void 0 : (_toast_classNames2 = toast.classNames) == null ? void 0 : _toast_classNames2.closeButton)
780
+ }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ React__default.createElement("div", {
781
+ "data-icon": "",
782
+ className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon)
783
+ }, toast.promise || toast.type === 'loading' && !toast.icon ? toast.icon || getLoadingIcon() : null, toast.type !== 'loading' ? icon : null) : null, /*#__PURE__*/ React__default.createElement("div", {
784
+ "data-content": "",
785
+ className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content)
786
+ }, /*#__PURE__*/ React__default.createElement("div", {
787
+ "data-title": "",
788
+ className: cn(classNames == null ? void 0 : classNames.title, toast == null ? void 0 : (_toast_classNames5 = toast.classNames) == null ? void 0 : _toast_classNames5.title)
789
+ }, toast.jsx ? toast.jsx : typeof toast.title === 'function' ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ React__default.createElement("div", {
790
+ "data-description": "",
791
+ className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast == null ? void 0 : (_toast_classNames6 = toast.classNames) == null ? void 0 : _toast_classNames6.description)
792
+ }, typeof toast.description === 'function' ? toast.description() : toast.description) : null), /*#__PURE__*/ React__default.isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ React__default.createElement("button", {
793
+ "data-button": true,
794
+ "data-cancel": true,
795
+ style: toast.cancelButtonStyle || cancelButtonStyle,
796
+ onClick: (event)=>{
797
+ // We need to check twice because typescript
798
+ if (!isAction(toast.cancel)) return;
799
+ if (!dismissible) return;
800
+ toast.cancel.onClick == null ? void 0 : toast.cancel.onClick.call(toast.cancel, event);
801
+ deleteToast();
802
+ },
803
+ className: cn(classNames == null ? void 0 : classNames.cancelButton, toast == null ? void 0 : (_toast_classNames7 = toast.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
804
+ }, toast.cancel.label) : null, /*#__PURE__*/ React__default.isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ React__default.createElement("button", {
805
+ "data-button": true,
806
+ "data-action": true,
807
+ style: toast.actionButtonStyle || actionButtonStyle,
808
+ onClick: (event)=>{
809
+ // We need to check twice because typescript
810
+ if (!isAction(toast.action)) return;
811
+ toast.action.onClick == null ? void 0 : toast.action.onClick.call(toast.action, event);
812
+ if (event.defaultPrevented) return;
813
+ deleteToast();
814
+ },
815
+ className: cn(classNames == null ? void 0 : classNames.actionButton, toast == null ? void 0 : (_toast_classNames8 = toast.classNames) == null ? void 0 : _toast_classNames8.actionButton)
816
+ }, toast.action.label) : null);
817
+ };
818
+ function getDocumentDirection() {
819
+ if (typeof window === 'undefined') return 'ltr';
820
+ if (typeof document === 'undefined') return 'ltr'; // For Fresh purpose
821
+ const dirAttribute = document.documentElement.getAttribute('dir');
822
+ if (dirAttribute === 'auto' || !dirAttribute) {
823
+ return window.getComputedStyle(document.documentElement).direction;
824
+ }
825
+ return dirAttribute;
826
+ }
827
+ function assignOffset(defaultOffset, mobileOffset) {
828
+ const styles = {};
829
+ [
830
+ defaultOffset,
831
+ mobileOffset
832
+ ].forEach((offset, index)=>{
833
+ const isMobile = index === 1;
834
+ const prefix = isMobile ? '--mobile-offset' : '--offset';
835
+ const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
836
+ function assignAll(offset) {
837
+ [
838
+ 'top',
839
+ 'right',
840
+ 'bottom',
841
+ 'left'
842
+ ].forEach((key)=>{
843
+ styles[`${prefix}-${key}`] = typeof offset === 'number' ? `${offset}px` : offset;
844
+ });
845
+ }
846
+ if (typeof offset === 'number' || typeof offset === 'string') {
847
+ assignAll(offset);
848
+ } else if (typeof offset === 'object') {
849
+ [
850
+ 'top',
851
+ 'right',
852
+ 'bottom',
853
+ 'left'
854
+ ].forEach((key)=>{
855
+ if (offset[key] === undefined) {
856
+ styles[`${prefix}-${key}`] = defaultValue;
857
+ } else {
858
+ styles[`${prefix}-${key}`] = typeof offset[key] === 'number' ? `${offset[key]}px` : offset[key];
859
+ }
860
+ });
861
+ } else {
862
+ assignAll(defaultValue);
863
+ }
864
+ });
865
+ return styles;
866
+ }
867
+ const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props, ref) {
868
+ const { id, invert, position = 'bottom-right', hotkey = [
869
+ 'altKey',
870
+ 'KeyT'
871
+ ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;
872
+ const [toasts, setToasts] = React__default.useState([]);
873
+ const filteredToasts = React__default.useMemo(()=>{
874
+ if (id) {
875
+ return toasts.filter((toast)=>toast.toasterId === id);
876
+ }
877
+ return toasts.filter((toast)=>!toast.toasterId);
878
+ }, [
879
+ toasts,
880
+ id
881
+ ]);
882
+ const possiblePositions = React__default.useMemo(()=>{
883
+ return Array.from(new Set([
884
+ position
885
+ ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
886
+ }, [
887
+ filteredToasts,
888
+ position
889
+ ]);
890
+ const [heights, setHeights] = React__default.useState([]);
891
+ const [expanded, setExpanded] = React__default.useState(false);
892
+ const [interacting, setInteracting] = React__default.useState(false);
893
+ const [actualTheme, setActualTheme] = React__default.useState(theme !== 'system' ? theme : typeof window !== 'undefined' ? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : 'light');
894
+ const listRef = React__default.useRef(null);
895
+ const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');
896
+ const lastFocusedElementRef = React__default.useRef(null);
897
+ const isFocusWithinRef = React__default.useRef(false);
898
+ const removeToast = React__default.useCallback((toastToRemove)=>{
899
+ setToasts((toasts)=>{
900
+ var _toasts_find;
901
+ if (!((_toasts_find = toasts.find((toast)=>toast.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
902
+ ToastState.dismiss(toastToRemove.id);
903
+ }
904
+ return toasts.filter(({ id })=>id !== toastToRemove.id);
905
+ });
906
+ }, []);
907
+ React__default.useEffect(()=>{
908
+ return ToastState.subscribe((toast)=>{
909
+ if (toast.dismiss) {
910
+ // Prevent batching of other state updates
911
+ requestAnimationFrame(()=>{
912
+ setToasts((toasts)=>toasts.map((t)=>t.id === toast.id ? {
913
+ ...t,
914
+ delete: true
915
+ } : t));
916
+ });
917
+ return;
918
+ }
919
+ // Prevent batching, temp solution.
920
+ setTimeout(()=>{
921
+ ReactDOM__default.flushSync(()=>{
922
+ setToasts((toasts)=>{
923
+ const indexOfExistingToast = toasts.findIndex((t)=>t.id === toast.id);
924
+ // Update the toast if it already exists
925
+ if (indexOfExistingToast !== -1) {
926
+ return [
927
+ ...toasts.slice(0, indexOfExistingToast),
928
+ {
929
+ ...toasts[indexOfExistingToast],
930
+ ...toast
931
+ },
932
+ ...toasts.slice(indexOfExistingToast + 1)
933
+ ];
934
+ }
935
+ return [
936
+ toast,
937
+ ...toasts
938
+ ];
939
+ });
940
+ });
941
+ });
942
+ });
943
+ }, [
944
+ toasts
945
+ ]);
946
+ React__default.useEffect(()=>{
947
+ if (theme !== 'system') {
948
+ setActualTheme(theme);
949
+ return;
950
+ }
951
+ if (theme === 'system') {
952
+ // check if current preference is dark
953
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
954
+ // it's currently dark
955
+ setActualTheme('dark');
956
+ } else {
957
+ // it's not dark
958
+ setActualTheme('light');
959
+ }
960
+ }
961
+ if (typeof window === 'undefined') return;
962
+ const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
963
+ try {
964
+ // Chrome & Firefox
965
+ darkMediaQuery.addEventListener('change', ({ matches })=>{
966
+ if (matches) {
967
+ setActualTheme('dark');
968
+ } else {
969
+ setActualTheme('light');
970
+ }
971
+ });
972
+ } catch (error) {
973
+ // Safari < 14
974
+ darkMediaQuery.addListener(({ matches })=>{
975
+ try {
976
+ if (matches) {
977
+ setActualTheme('dark');
978
+ } else {
979
+ setActualTheme('light');
980
+ }
981
+ } catch (e) {
982
+ console.error(e);
983
+ }
984
+ });
985
+ }
986
+ }, [
987
+ theme
988
+ ]);
989
+ React__default.useEffect(()=>{
990
+ // Ensure expanded is always false when no toasts are present / only one left
991
+ if (toasts.length <= 1) {
992
+ setExpanded(false);
993
+ }
994
+ }, [
995
+ toasts
996
+ ]);
997
+ React__default.useEffect(()=>{
998
+ const handleKeyDown = (event)=>{
999
+ var _listRef_current;
1000
+ const isHotkeyPressed = hotkey.every((key)=>event[key] || event.code === key);
1001
+ if (isHotkeyPressed) {
1002
+ var _listRef_current1;
1003
+ setExpanded(true);
1004
+ (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
1005
+ }
1006
+ if (event.code === 'Escape' && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
1007
+ setExpanded(false);
1008
+ }
1009
+ };
1010
+ document.addEventListener('keydown', handleKeyDown);
1011
+ return ()=>document.removeEventListener('keydown', handleKeyDown);
1012
+ }, [
1013
+ hotkey
1014
+ ]);
1015
+ React__default.useEffect(()=>{
1016
+ if (listRef.current) {
1017
+ return ()=>{
1018
+ if (lastFocusedElementRef.current) {
1019
+ lastFocusedElementRef.current.focus({
1020
+ preventScroll: true
1021
+ });
1022
+ lastFocusedElementRef.current = null;
1023
+ isFocusWithinRef.current = false;
1024
+ }
1025
+ };
1026
+ }
1027
+ }, [
1028
+ listRef.current
1029
+ ]);
1030
+ return /*#__PURE__*/ React__default.createElement("section", {
1031
+ ref: ref,
1032
+ "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
1033
+ tabIndex: -1,
1034
+ "aria-live": "polite",
1035
+ "aria-relevant": "additions text",
1036
+ "aria-atomic": "false",
1037
+ suppressHydrationWarning: true
1038
+ }, possiblePositions.map((position, index)=>{
1039
+ var _heights_;
1040
+ const [y, x] = position.split('-');
1041
+ if (!filteredToasts.length) return null;
1042
+ return /*#__PURE__*/ React__default.createElement("ol", {
1043
+ key: position,
1044
+ dir: dir === 'auto' ? getDocumentDirection() : dir,
1045
+ tabIndex: -1,
1046
+ ref: listRef,
1047
+ className: className,
1048
+ "data-sonner-toaster": true,
1049
+ "data-sonner-theme": actualTheme,
1050
+ "data-y-position": y,
1051
+ "data-x-position": x,
1052
+ style: {
1053
+ '--front-toast-height': `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
1054
+ '--width': `${TOAST_WIDTH}px`,
1055
+ '--gap': `${gap}px`,
1056
+ ...style,
1057
+ ...assignOffset(offset, mobileOffset)
1058
+ },
1059
+ onBlur: (event)=>{
1060
+ if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
1061
+ isFocusWithinRef.current = false;
1062
+ if (lastFocusedElementRef.current) {
1063
+ lastFocusedElementRef.current.focus({
1064
+ preventScroll: true
1065
+ });
1066
+ lastFocusedElementRef.current = null;
1067
+ }
1068
+ }
1069
+ },
1070
+ onFocus: (event)=>{
1071
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1072
+ if (isNotDismissible) return;
1073
+ if (!isFocusWithinRef.current) {
1074
+ isFocusWithinRef.current = true;
1075
+ lastFocusedElementRef.current = event.relatedTarget;
1076
+ }
1077
+ },
1078
+ onMouseEnter: ()=>setExpanded(true),
1079
+ onMouseMove: ()=>setExpanded(true),
1080
+ onMouseLeave: ()=>{
1081
+ // Avoid setting expanded to false when interacting with a toast, e.g. swiping
1082
+ if (!interacting) {
1083
+ setExpanded(false);
1084
+ }
1085
+ },
1086
+ onDragEnd: ()=>setExpanded(false),
1087
+ onPointerDown: (event)=>{
1088
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1089
+ if (isNotDismissible) return;
1090
+ setInteracting(true);
1091
+ },
1092
+ onPointerUp: ()=>setInteracting(false)
1093
+ }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
1094
+ var _toastOptions_duration, _toastOptions_closeButton;
1095
+ return /*#__PURE__*/ React__default.createElement(Toast, {
1096
+ key: toast.id,
1097
+ icons: icons,
1098
+ index: index,
1099
+ toast: toast,
1100
+ defaultRichColors: richColors,
1101
+ duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
1102
+ className: toastOptions == null ? void 0 : toastOptions.className,
1103
+ descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
1104
+ invert: invert,
1105
+ visibleToasts: visibleToasts,
1106
+ closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
1107
+ interacting: interacting,
1108
+ position: position,
1109
+ style: toastOptions == null ? void 0 : toastOptions.style,
1110
+ unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
1111
+ classNames: toastOptions == null ? void 0 : toastOptions.classNames,
1112
+ cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
1113
+ actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
1114
+ closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
1115
+ removeToast: removeToast,
1116
+ toasts: filteredToasts.filter((t)=>t.position == toast.position),
1117
+ heights: heights.filter((h)=>h.position == toast.position),
1118
+ setHeights: setHeights,
1119
+ expandByDefault: expand,
1120
+ gap: gap,
1121
+ expanded: expanded,
1122
+ swipeDirections: props.swipeDirections
1123
+ });
1124
+ }));
1125
+ }));
1126
+ });
1127
+
1128
+ const Toaster = ({ ...props })=>{
1129
+ return /*#__PURE__*/ React__default.createElement(Toaster$1, {
1130
+ className: "toaster group",
1131
+ style: {
1132
+ "--normal-bg": "var(--popover)",
1133
+ "--normal-text": "var(--popover-foreground)",
1134
+ "--normal-border": "var(--border)"
1135
+ },
1136
+ ...props
1137
+ });
1138
+ };
1139
+
1140
+ export { Toaster };
2
1141
  //# sourceMappingURL=index.mjs.map