@jobber/components 4.85.5 → 4.85.6-CJS-to-ESM.1

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 (606) hide show
  1. package/dist/AnimatedPresence/{index.js → index.cjs} +1 -3
  2. package/dist/AnimatedPresence/index.mjs +4 -0
  3. package/dist/AnimatedPresence-D73apgLB.js +98 -0
  4. package/dist/{AnimatedPresence-20a02aaa.js → AnimatedPresence-DFaAEYUa.js} +3 -7
  5. package/dist/AnimatedSwitcher/index.cjs +11 -0
  6. package/dist/AnimatedSwitcher/index.mjs +5 -0
  7. package/dist/AnimatedSwitcher-B4fUExeN.js +90 -0
  8. package/dist/{AnimatedSwitcher-3d45ec5d.js → AnimatedSwitcher-UmlTf067.js} +4 -8
  9. package/dist/Autocomplete/index.cjs +34 -0
  10. package/dist/Autocomplete/index.mjs +28 -0
  11. package/dist/{Autocomplete/index.js → Autocomplete-CDpl009j.js} +24 -43
  12. package/dist/Autocomplete-DcuJsI7Z.js +188 -0
  13. package/dist/Avatar/index.cjs +13 -0
  14. package/dist/Avatar/index.mjs +7 -0
  15. package/dist/Avatar-DZCQBKMr.js +70 -0
  16. package/dist/Avatar-Q2BQymsE.js +72 -0
  17. package/dist/Banner/components/BannerIcon/index.cjs +13 -0
  18. package/dist/Banner/components/BannerIcon/index.mjs +7 -0
  19. package/dist/Banner/index.cjs +19 -0
  20. package/dist/Banner/index.mjs +13 -0
  21. package/dist/Banner-B230_jsV.js +84 -0
  22. package/dist/Banner-zMyKdO1y.js +82 -0
  23. package/dist/BannerIcon-QB3lZddm.js +24 -0
  24. package/dist/BannerIcon-YIreWKuC.js +27 -0
  25. package/dist/Body-DMRyfeGa.js +59 -0
  26. package/dist/Body-Dd2-HEDo.js +50 -0
  27. package/dist/Button/index.cjs +14 -0
  28. package/dist/Button/index.mjs +8 -0
  29. package/dist/Button-CWVwgwhn.js +50 -0
  30. package/dist/Button-D3mW3Hcg.js +52 -0
  31. package/dist/ButtonDismiss/index.cjs +15 -0
  32. package/dist/ButtonDismiss/index.mjs +9 -0
  33. package/dist/ButtonDismiss-GLptCaNc.js +8 -0
  34. package/dist/ButtonDismiss-l6Kunmen.js +10 -0
  35. package/dist/Card/index.cjs +22 -0
  36. package/dist/Card/index.mjs +16 -0
  37. package/dist/{Card-e3144022.js → Card-0WPJWxfz.js} +20 -25
  38. package/dist/Card-BOD8v9wH.js +86 -0
  39. package/dist/Checkbox/index.cjs +16 -0
  40. package/dist/Checkbox/index.mjs +10 -0
  41. package/dist/Checkbox-C78HDAVJ.js +58 -0
  42. package/dist/Checkbox-qsepteuE.js +56 -0
  43. package/dist/Chip/hooks/index.cjs +8 -0
  44. package/dist/Chip/hooks/index.mjs +2 -0
  45. package/dist/Chip/index.cjs +26 -0
  46. package/dist/Chip/index.mjs +18 -0
  47. package/dist/Chip-Div4v8At.js +73 -0
  48. package/dist/Chip-tWHAQezL.js +70 -0
  49. package/dist/ChipDismissible-B0DslYTJ.js +22 -0
  50. package/dist/ChipDismissible-DSLoDRyq.js +19 -0
  51. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +24 -0
  52. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +14 -0
  53. package/dist/Chips/InternalChipDismissible/index.cjs +35 -0
  54. package/dist/Chips/InternalChipDismissible/index.mjs +29 -0
  55. package/dist/Chips/index.cjs +48 -0
  56. package/dist/Chips/index.mjs +44 -0
  57. package/dist/Chips-DzPxRiFY.js +91 -0
  58. package/dist/Chips-tdDqEKfy.js +93 -0
  59. package/dist/Combobox/components/ComboboxAction/index.cjs +13 -0
  60. package/dist/Combobox/components/ComboboxAction/index.mjs +7 -0
  61. package/dist/Combobox/components/ComboboxActivator/index.cjs +27 -0
  62. package/dist/Combobox/components/ComboboxActivator/index.mjs +21 -0
  63. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.cjs +15 -0
  64. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.mjs +9 -0
  65. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +25 -0
  66. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +19 -0
  67. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.cjs +11 -0
  68. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.mjs +5 -0
  69. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +10 -0
  70. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +4 -0
  71. package/dist/Combobox/components/ComboboxContent/index.cjs +35 -0
  72. package/dist/Combobox/components/ComboboxContent/index.mjs +29 -0
  73. package/dist/Combobox/components/ComboboxOption/index.cjs +15 -0
  74. package/dist/Combobox/components/ComboboxOption/index.mjs +9 -0
  75. package/dist/Combobox/components/ComboboxTrigger/index.cjs +25 -0
  76. package/dist/Combobox/components/ComboboxTrigger/index.mjs +19 -0
  77. package/dist/Combobox/index.cjs +52 -0
  78. package/dist/Combobox/index.mjs +45 -0
  79. package/dist/Combobox-BwSFlPWt.js +120 -0
  80. package/dist/Combobox-Dr5ftH9X.js +122 -0
  81. package/dist/ComboboxAction-B3RwsCtx.js +27 -0
  82. package/dist/ComboboxAction-BzEwYtPm.js +25 -0
  83. package/dist/ComboboxActivator-B-2nmWQ-.js +28 -0
  84. package/dist/ComboboxActivator-DkcbNfv5.js +26 -0
  85. package/dist/ComboboxContent-B108quRR.js +144 -0
  86. package/dist/ComboboxContent-D44NnZaD.js +146 -0
  87. package/dist/ComboboxContentHeader-CJ0if4JI.js +32 -0
  88. package/dist/ComboboxContentHeader-DFLlxg-X.js +30 -0
  89. package/dist/ComboboxContentList-DHQ0x2ml.js +80 -0
  90. package/dist/ComboboxContentList-DmdT_cqp.js +78 -0
  91. package/dist/ComboboxContentSearch-B8hsfo_D.js +35 -0
  92. package/dist/ComboboxContentSearch-UAyHetvM.js +37 -0
  93. package/dist/ComboboxLoadMore-C3JuiaZf.js +17 -0
  94. package/dist/ComboboxLoadMore-Dk2tUBxS.js +19 -0
  95. package/dist/ComboboxOption-CWkyTkzU.js +25 -0
  96. package/dist/ComboboxOption-D_f4NcBM.js +23 -0
  97. package/dist/ComboboxProvider-BwxfVgmL.js +13 -0
  98. package/dist/ComboboxProvider-Dm_tfmkr.js +10 -0
  99. package/dist/ComboboxTrigger-BAOfY8Og.js +22 -0
  100. package/dist/ComboboxTrigger-ZqNl11Qy.js +24 -0
  101. package/dist/ConfirmationModal/index.cjs +29 -0
  102. package/dist/ConfirmationModal/index.mjs +23 -0
  103. package/dist/ConfirmationModal-CPNH-chF.js +94 -0
  104. package/dist/{ConfirmationModal-52e16873.js → ConfirmationModal-CZTiORX4.js} +6 -10
  105. package/dist/Content/index.cjs +10 -0
  106. package/dist/Content/index.mjs +4 -0
  107. package/dist/Content-B8Od1cqS.js +20 -0
  108. package/dist/Content-BknIp35w.js +18 -0
  109. package/dist/Countdown/index.cjs +10 -0
  110. package/dist/Countdown/index.mjs +4 -0
  111. package/dist/Countdown-DQYi_QSJ.js +63 -0
  112. package/dist/{Countdown/index.js → Countdown-mTio5lCJ.js} +2 -9
  113. package/dist/DataDump/index.cjs +25 -0
  114. package/dist/DataDump/index.mjs +19 -0
  115. package/dist/DataDump-BhkXdMFl.js +15 -0
  116. package/dist/DataDump-BoNQd_3r.js +17 -0
  117. package/dist/DataList/components/DataListAction/index.cjs +14 -0
  118. package/dist/DataList/components/DataListAction/index.mjs +8 -0
  119. package/dist/DataList/components/DataListActions/index.cjs +43 -0
  120. package/dist/DataList/components/DataListActions/index.mjs +37 -0
  121. package/dist/DataList/components/DataListActionsMenu/index.cjs +16 -0
  122. package/dist/DataList/components/DataListActionsMenu/index.mjs +10 -0
  123. package/dist/DataList/components/DataListBulkActions/index.cjs +46 -0
  124. package/dist/DataList/components/DataListBulkActions/index.mjs +39 -0
  125. package/dist/DataList/components/DataListEmptyState/index.cjs +21 -0
  126. package/dist/DataList/components/DataListEmptyState/index.mjs +14 -0
  127. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +53 -0
  128. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +47 -0
  129. package/dist/DataList/components/DataListFilters/index.cjs +67 -0
  130. package/dist/DataList/components/DataListFilters/index.mjs +60 -0
  131. package/dist/DataList/components/DataListHeader/index.cjs +53 -0
  132. package/dist/DataList/components/DataListHeader/index.mjs +47 -0
  133. package/dist/DataList/components/DataListHeaderTile/components/index.cjs +13 -0
  134. package/dist/DataList/components/DataListHeaderTile/components/index.mjs +7 -0
  135. package/dist/DataList/components/DataListHeaderTile/index.cjs +21 -0
  136. package/dist/DataList/components/DataListHeaderTile/index.mjs +15 -0
  137. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.cjs +15 -0
  138. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.mjs +9 -0
  139. package/dist/DataList/components/DataListItem/index.cjs +52 -0
  140. package/dist/DataList/components/DataListItem/index.mjs +46 -0
  141. package/dist/DataList/components/DataListItemActions/index.cjs +45 -0
  142. package/dist/DataList/components/DataListItemActions/index.mjs +38 -0
  143. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +25 -0
  144. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +19 -0
  145. package/dist/DataList/components/DataListItems/index.cjs +53 -0
  146. package/dist/DataList/components/DataListItems/index.mjs +47 -0
  147. package/dist/DataList/components/DataListLayout/index.cjs +56 -0
  148. package/dist/DataList/components/DataListLayout/index.mjs +50 -0
  149. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.cjs +9 -0
  150. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.mjs +2 -0
  151. package/dist/DataList/components/DataListLayoutActions/index.cjs +33 -0
  152. package/dist/DataList/components/DataListLayoutActions/index.mjs +27 -0
  153. package/dist/DataList/components/DataListLoadMore/index.cjs +22 -0
  154. package/dist/DataList/components/DataListLoadMore/index.mjs +15 -0
  155. package/dist/DataList/components/DataListLoadingState/index.cjs +22 -0
  156. package/dist/DataList/components/DataListLoadingState/index.mjs +14 -0
  157. package/dist/DataList/components/DataListOverflowFade/index.cjs +12 -0
  158. package/dist/DataList/components/DataListOverflowFade/index.mjs +5 -0
  159. package/dist/DataList/components/DataListSearch/index.cjs +35 -0
  160. package/dist/DataList/components/DataListSearch/index.mjs +27 -0
  161. package/dist/DataList/components/DataListStatusBar/index.cjs +32 -0
  162. package/dist/DataList/components/DataListStatusBar/index.mjs +25 -0
  163. package/dist/DataList/components/DataListStickyHeader/index.cjs +12 -0
  164. package/dist/DataList/components/DataListStickyHeader/index.mjs +6 -0
  165. package/dist/DataList/components/DataListTags/index.cjs +13 -0
  166. package/dist/DataList/components/DataListTags/index.mjs +7 -0
  167. package/dist/DataList/components/DataListTotalCount/index.cjs +16 -0
  168. package/dist/DataList/components/DataListTotalCount/index.mjs +9 -0
  169. package/dist/DataList/context/DataListContext/index.cjs +12 -0
  170. package/dist/DataList/context/DataListContext/index.mjs +4 -0
  171. package/dist/DataList/context/DataListLayoutContext/index.cjs +12 -0
  172. package/dist/DataList/context/DataListLayoutContext/index.mjs +4 -0
  173. package/dist/DataList/index.cjs +98 -0
  174. package/dist/DataList/index.mjs +92 -0
  175. package/dist/DataList-BL3zeA83.js +9 -0
  176. package/dist/DataList-D8rsiB6p.js +7 -0
  177. package/dist/DataList-DcPfsE4o.js +141 -0
  178. package/dist/DataList-UzxXqfXV.js +139 -0
  179. package/dist/DataList.const-Wz370ukq.js +25 -0
  180. package/dist/DataList.const-YbvF2-QB.js +38 -0
  181. package/dist/DataList.utils-B0hOFZaX.js +168 -0
  182. package/dist/DataList.utils-C931OWj0.js +161 -0
  183. package/dist/DataListAction-CMZbwbN5.js +40 -0
  184. package/dist/DataListAction-CzSLV230.js +42 -0
  185. package/dist/DataListActions-D2xI1Gnz.js +45 -0
  186. package/dist/DataListActions-DYrocbl7.js +43 -0
  187. package/dist/DataListActionsMenu-3JxvPbGZ.js +53 -0
  188. package/dist/DataListActionsMenu-CjBKmZT6.js +55 -0
  189. package/dist/DataListBulkActions-BSjCVCSw.js +32 -0
  190. package/dist/DataListBulkActions-OLJ1EzI6.js +29 -0
  191. package/dist/DataListContext-CWEeA357.js +29 -0
  192. package/dist/DataListContext-DHdRjGCC.js +25 -0
  193. package/dist/DataListEmptyState-CvRFHlYt.js +56 -0
  194. package/dist/DataListEmptyState-Rk1OowmR.js +53 -0
  195. package/dist/DataListFilters-Dfw7ptNa.js +46 -0
  196. package/dist/DataListFilters-y0CrJgWe.js +43 -0
  197. package/dist/DataListHeader-BFg0X9Jz.js +95 -0
  198. package/dist/DataListHeader-DB1ikJ1G.js +93 -0
  199. package/dist/DataListHeaderTile-BcvpRQqc.js +86 -0
  200. package/dist/DataListHeaderTile-CUaHgFkG.js +84 -0
  201. package/dist/DataListItem-27SGm5NU.js +114 -0
  202. package/dist/DataListItem-CEcG1clf.js +112 -0
  203. package/dist/DataListItemActions-B0IR13cA.js +35 -0
  204. package/dist/DataListItemActions-DbMxVTo5.js +32 -0
  205. package/dist/DataListItemActionsOverflow-B1XTLLAZ.js +33 -0
  206. package/dist/DataListItemActionsOverflow-Dt1rZ_ch.js +35 -0
  207. package/dist/DataListItemClickable-CPGV8QJU.js +47 -0
  208. package/dist/DataListItemClickable-a9vfumwQ.js +45 -0
  209. package/dist/DataListItems-C37QwFLL.js +21 -0
  210. package/dist/DataListItems-CmmwaaoF.js +19 -0
  211. package/dist/DataListLayout-BkqOAi5X.js +19 -0
  212. package/dist/DataListLayout-fuctDjAR.js +21 -0
  213. package/dist/DataListLayoutActions-BrXEXuWB.js +41 -0
  214. package/dist/DataListLayoutActions-C1xVkV8F.js +39 -0
  215. package/dist/DataListLayoutContext-BiMbo7LQ.js +18 -0
  216. package/dist/DataListLayoutContext-D3REliDa.js +8 -0
  217. package/dist/DataListLayoutContext-D5Jhd_ZG.js +14 -0
  218. package/dist/DataListLayoutContext-DT0mtKzt.js +11 -0
  219. package/dist/DataListLoadMore-BThmoeQ0.js +37 -0
  220. package/dist/DataListLoadMore-eMdC9JGb.js +34 -0
  221. package/dist/DataListLoadingState-BovqtnV7.js +29 -0
  222. package/dist/DataListLoadingState-DKSypijq.js +25 -0
  223. package/dist/DataListOverflowFade-DUocP0Jz.js +25 -0
  224. package/dist/DataListOverflowFade-DxUdWrD0.js +28 -0
  225. package/dist/DataListSearch-D0pqhE8d.js +66 -0
  226. package/dist/DataListSearch-DiHOG8VU.js +62 -0
  227. package/dist/DataListSort-CQ62ewRY.js +94 -0
  228. package/dist/DataListSort-CW4v1psG.js +92 -0
  229. package/dist/DataListSortingOptions-BGNu0KOG.js +38 -0
  230. package/dist/DataListSortingOptions-ZiARzP5b.js +40 -0
  231. package/dist/DataListStatusBar-EQKC5MHS.js +22 -0
  232. package/dist/DataListStatusBar-Va-ssWph.js +25 -0
  233. package/dist/DataListStickyHeader-BKN9V51R.js +28 -0
  234. package/dist/DataListStickyHeader-CCG09E7V.js +26 -0
  235. package/dist/DataListTags-C5inHFOR.js +67 -0
  236. package/dist/DataListTags-CHZr9DW3.js +65 -0
  237. package/dist/DataListTotalCount-B9K3hGqp.js +30 -0
  238. package/dist/DataListTotalCount-Dzzm_buN.js +27 -0
  239. package/dist/DataTable/index.cjs +34 -0
  240. package/dist/DataTable/index.mjs +23 -0
  241. package/dist/DataTable/test-utilities/index.cjs +241 -0
  242. package/dist/DataTable/test-utilities/index.mjs +233 -0
  243. package/dist/DataTable-BOZ_Zf4q.js +245 -0
  244. package/dist/DataTable-D1Q5tABs.js +247 -0
  245. package/dist/DatePicker/index.cjs +24 -0
  246. package/dist/DatePicker/index.mjs +18 -0
  247. package/dist/DatePicker-CqYEsDX3.js +1279 -0
  248. package/dist/DatePicker-DBObDXoW.js +1282 -0
  249. package/dist/DayOfMonthSelect--s7Ry-jx.js +141 -0
  250. package/dist/DayOfMonthSelect-UlE6seGW.js +148 -0
  251. package/dist/DescriptionList/index.cjs +11 -0
  252. package/dist/DescriptionList/index.mjs +5 -0
  253. package/dist/DescriptionList-CBeTDl49.js +15 -0
  254. package/dist/DescriptionList-DBENvQT5.js +17 -0
  255. package/dist/Disclosure/index.cjs +14 -0
  256. package/dist/Disclosure/index.mjs +8 -0
  257. package/dist/Disclosure-Bikm1B9V.js +38 -0
  258. package/dist/Disclosure-D7kJi1Df.js +36 -0
  259. package/dist/Divider/index.cjs +10 -0
  260. package/dist/Divider/index.mjs +4 -0
  261. package/dist/Divider-DOmpOAKU.js +20 -0
  262. package/dist/{Divider/index.js → Divider-Dt_qE9xe.js} +4 -11
  263. package/dist/Drawer/index.cjs +19 -0
  264. package/dist/Drawer/index.mjs +12 -0
  265. package/dist/DrawerGrid-Bg9ydPFR.js +33 -0
  266. package/dist/DrawerGrid-DM3WKmX6.js +36 -0
  267. package/dist/Emphasis/index.cjs +11 -0
  268. package/dist/Emphasis/index.mjs +5 -0
  269. package/dist/Emphasis-B3vf8Ek9.js +15 -0
  270. package/dist/Emphasis-xxFrrT2i.js +13 -0
  271. package/dist/FeatureSwitch/index.cjs +24 -0
  272. package/dist/FeatureSwitch/index.mjs +18 -0
  273. package/dist/FeatureSwitch-C1cXc0VS.js +55 -0
  274. package/dist/FeatureSwitch-C66nDoAy.js +57 -0
  275. package/dist/Flex/index.cjs +10 -0
  276. package/dist/Flex/index.mjs +4 -0
  277. package/dist/{Flex-d490c4db.js → Flex-CBKf3epb.js} +3 -8
  278. package/dist/Flex-DXDpEzMI.js +31 -0
  279. package/dist/Form/index.cjs +10 -0
  280. package/dist/Form/index.mjs +4 -0
  281. package/dist/{Form/index.js → Form-ChkdN1bx.js} +3 -9
  282. package/dist/Form-Dd9YKBh-.js +48 -0
  283. package/dist/FormField/index.cjs +22 -0
  284. package/dist/FormField/index.mjs +16 -0
  285. package/dist/FormField-BBg_JAlJ.js +248 -0
  286. package/dist/FormField-C-d0U7Ww.js +246 -0
  287. package/dist/FormatDate/{index.js → index.cjs} +1 -3
  288. package/dist/FormatDate/index.mjs +2 -0
  289. package/dist/{FormatDate-70ea5b43.js → FormatDate-BzJETLja.js} +1 -5
  290. package/dist/FormatDate-Dxs33-Xj.js +27 -0
  291. package/dist/FormatEmail/index.cjs +10 -0
  292. package/dist/FormatEmail/index.mjs +4 -0
  293. package/dist/FormatEmail-BH1qM7Va.js +16 -0
  294. package/dist/FormatEmail-_Ytrq7mn.js +14 -0
  295. package/dist/FormatFile/index.cjs +34 -0
  296. package/dist/FormatFile/index.mjs +28 -0
  297. package/dist/FormatFile-BQXjo6EG.js +154 -0
  298. package/dist/FormatFile-D-UIdDqE.js +156 -0
  299. package/dist/FormatRelativeDateTime/index.cjs +8 -0
  300. package/dist/FormatRelativeDateTime/index.mjs +2 -0
  301. package/dist/{FormatRelativeDateTime/index.js → FormatRelativeDateTime-COgItrYT.js} +5 -11
  302. package/dist/FormatRelativeDateTime-DTnQraIq.js +64 -0
  303. package/dist/FormatTime/index.cjs +8 -0
  304. package/dist/FormatTime/index.mjs +2 -0
  305. package/dist/FormatTime-BGr7_DaA.js +28 -0
  306. package/dist/{FormatTime/index.js → FormatTime-CfcVslez.js} +1 -7
  307. package/dist/Gallery/index.cjs +40 -0
  308. package/dist/Gallery/index.mjs +34 -0
  309. package/dist/Gallery-BMpC_ohB.js +66 -0
  310. package/dist/Gallery-DXXQxrHV.js +68 -0
  311. package/dist/Glimmer/index.cjs +13 -0
  312. package/dist/Glimmer/index.mjs +6 -0
  313. package/dist/Glimmer-Cgcy2Ruw.js +72 -0
  314. package/dist/Glimmer-Dz1E9Bo5.js +69 -0
  315. package/dist/Grid/InternalGridCell/index.cjs +10 -0
  316. package/dist/Grid/InternalGridCell/index.mjs +3 -0
  317. package/dist/Grid/index.cjs +13 -0
  318. package/dist/Grid/index.mjs +6 -0
  319. package/dist/Grid-2KPGnpZI.js +37 -0
  320. package/dist/Grid-ClBkskz-.js +34 -0
  321. package/dist/Heading/index.cjs +12 -0
  322. package/dist/Heading/index.mjs +6 -0
  323. package/dist/Heading-CL3UujY7.js +49 -0
  324. package/dist/{Heading-1e8e4bd3.js → Heading-suKDLmO4.js} +3 -7
  325. package/dist/Icon/index.cjs +9 -0
  326. package/dist/Icon/index.mjs +3 -0
  327. package/dist/Icon-B9XNdA1T.js +36 -0
  328. package/dist/Icon-CoHJokXb.js +34 -0
  329. package/dist/InlineLabel/index.cjs +11 -0
  330. package/dist/InlineLabel/index.mjs +5 -0
  331. package/dist/InlineLabel-BPjH1ASc.js +23 -0
  332. package/dist/InlineLabel-x3msDD5R.js +21 -0
  333. package/dist/InputAvatar/index.cjs +26 -0
  334. package/dist/InputAvatar/index.mjs +20 -0
  335. package/dist/InputAvatar-DcNJEpM3.js +52 -0
  336. package/dist/InputAvatar-Dp3cCHai.js +50 -0
  337. package/dist/InputDate/index.cjs +33 -0
  338. package/dist/InputDate/index.mjs +27 -0
  339. package/dist/InputDate-Brwb3gue.js +31 -0
  340. package/dist/InputDate-D5pZraRN.js +33 -0
  341. package/dist/InputEmail/index.cjs +24 -0
  342. package/dist/InputEmail/index.mjs +17 -0
  343. package/dist/InputEmail-DkvNQj63.js +23 -0
  344. package/dist/InputEmail-nxOzDFb8.js +20 -0
  345. package/dist/InputFile/index.cjs +23 -0
  346. package/dist/InputFile/index.mjs +16 -0
  347. package/dist/InputFile-BBOdV6FH.js +2794 -0
  348. package/dist/InputFile-l-Zdbe8r.js +2797 -0
  349. package/dist/InputGroup/index.cjs +10 -0
  350. package/dist/InputGroup/index.mjs +4 -0
  351. package/dist/{InputGroup-8d4fd4eb.js → InputGroup-Bljb97cw.js} +5 -10
  352. package/dist/InputGroup-CCJ2rycA.js +26 -0
  353. package/dist/InputNumber/index.cjs +23 -0
  354. package/dist/InputNumber/index.mjs +17 -0
  355. package/dist/{InputNumber-d451b52e.js → InputNumber-B3-6b6mT.js} +2 -6
  356. package/dist/InputNumber-D2jOwtOi.js +56 -0
  357. package/dist/InputPassword/index.cjs +23 -0
  358. package/dist/InputPassword/index.mjs +17 -0
  359. package/dist/InputPassword-BwPfewHd.js +19 -0
  360. package/dist/InputPassword-mWbDB3Oh.js +21 -0
  361. package/dist/InputPhoneNumber/index.cjs +23 -0
  362. package/dist/InputPhoneNumber/index.mjs +17 -0
  363. package/dist/{InputPhoneNumber/index.js → InputPhoneNumber-CrkVlyUE.js} +8 -25
  364. package/dist/InputPhoneNumber-ynZiTe9j.js +97 -0
  365. package/dist/InputText/index.cjs +24 -0
  366. package/dist/InputText/index.mjs +18 -0
  367. package/dist/InputText-CgykvJl2.js +96 -0
  368. package/dist/{InputText-55b6cb65.js → InputText-D1KkzO4T.js} +2 -6
  369. package/dist/InputTime/index.cjs +28 -0
  370. package/dist/InputTime/index.mjs +22 -0
  371. package/dist/InputTime-CVHCWh2x.js +187 -0
  372. package/dist/{InputTime/index.js → InputTime-Ce0H2RWH.js} +5 -25
  373. package/dist/InputValidation/index.cjs +15 -0
  374. package/dist/InputValidation/index.mjs +9 -0
  375. package/dist/InputValidation-BmgvSw0e.js +23 -0
  376. package/dist/InputValidation-DIwnbDDv.js +25 -0
  377. package/dist/InternalChipDismissible-BoAPXU91.js +158 -0
  378. package/dist/InternalChipDismissible-Dj-XvjT4.js +163 -0
  379. package/dist/InternalGridCell-CBv95C-G.js +37 -0
  380. package/dist/InternalGridCell-DFrhM8oX.js +40 -0
  381. package/dist/LightBox/index.cjs +25 -0
  382. package/dist/LightBox/index.mjs +19 -0
  383. package/dist/LightBox-DLJk1m24.js +109 -0
  384. package/dist/LightBox-oRvBzCVE.js +111 -0
  385. package/dist/Link/index.cjs +8 -0
  386. package/dist/Link/index.mjs +2 -0
  387. package/dist/Link-Bnzn51lp.js +9 -0
  388. package/dist/Link-CTWzdpyV.js +7 -0
  389. package/dist/List/index.cjs +28 -0
  390. package/dist/List/index.d.ts +1 -1
  391. package/dist/List/index.mjs +21 -0
  392. package/dist/List-BLRtWdVA.js +196 -0
  393. package/dist/List-C6AG4_dM.js +193 -0
  394. package/dist/Markdown/index.cjs +17 -0
  395. package/dist/Markdown/index.mjs +11 -0
  396. package/dist/Markdown-B2B4q1R4.js +57 -0
  397. package/dist/Markdown-BqNLA1UK.js +55 -0
  398. package/dist/Menu/{index.js → index.cjs} +5 -7
  399. package/dist/Menu/index.mjs +13 -0
  400. package/dist/Menu-BXvyYPow.js +132 -0
  401. package/dist/Menu-DWqTLjQu.js +134 -0
  402. package/dist/Modal/index.cjs +23 -0
  403. package/dist/Modal/index.mjs +17 -0
  404. package/dist/Modal-BsCYxzQV.js +65 -0
  405. package/dist/Modal-COtt6AGz.js +63 -0
  406. package/dist/MultiSelect/index.cjs +17 -0
  407. package/dist/MultiSelect/index.mjs +11 -0
  408. package/dist/MultiSelect-ByY6NzAS.js +169 -0
  409. package/dist/{MultiSelect/index.js → MultiSelect-D_-_TiTD.js} +16 -27
  410. package/dist/Option-BmWN4Bgv.js +15 -0
  411. package/dist/Option-DkWd2dv6.js +12 -0
  412. package/dist/Page/index.cjs +28 -0
  413. package/dist/Page/index.mjs +22 -0
  414. package/dist/Page-CI4G1pxg.js +61 -0
  415. package/dist/Page-DdD5O2fP.js +59 -0
  416. package/dist/Popover/index.cjs +18 -0
  417. package/dist/Popover/index.mjs +12 -0
  418. package/dist/Popover-D2Lc46rN.js +49 -0
  419. package/dist/Popover-MtwM2-M4.js +47 -0
  420. package/dist/ProgressBar/index.cjs +10 -0
  421. package/dist/ProgressBar/index.mjs +4 -0
  422. package/dist/ProgressBar-D2wik11q.js +38 -0
  423. package/dist/ProgressBar-DjFTRxLD.js +36 -0
  424. package/dist/RadioGroup/index.cjs +13 -0
  425. package/dist/RadioGroup/index.mjs +6 -0
  426. package/dist/RadioGroup-CL8tcJwY.js +42 -0
  427. package/dist/RadioGroup-CvoMZUNQ.js +39 -0
  428. package/dist/RecurringSelect/components/index.cjs +16 -0
  429. package/dist/RecurringSelect/components/index.mjs +7 -0
  430. package/dist/RecurringSelect/index.cjs +37 -0
  431. package/dist/RecurringSelect/index.mjs +23 -0
  432. package/dist/RecurringSelect-BQuw43z9.js +74 -0
  433. package/dist/RecurringSelect-DLFrS379.js +76 -0
  434. package/dist/Select/index.cjs +24 -0
  435. package/dist/Select/index.mjs +17 -0
  436. package/dist/Spinner/index.cjs +10 -0
  437. package/dist/Spinner/index.mjs +4 -0
  438. package/dist/Spinner-BOhyUAA_.js +17 -0
  439. package/dist/Spinner-DT15aa_r.js +19 -0
  440. package/dist/StatusIndicator/index.cjs +9 -0
  441. package/dist/StatusIndicator/index.mjs +3 -0
  442. package/dist/StatusIndicator-DMcPLJ2i.js +14 -0
  443. package/dist/StatusIndicator-DcXKG260.js +12 -0
  444. package/dist/StatusLabel/index.cjs +13 -0
  445. package/dist/StatusLabel/index.mjs +7 -0
  446. package/dist/StatusLabel-8RoVevu0.js +21 -0
  447. package/dist/StatusLabel-BJsnaMk6.js +19 -0
  448. package/dist/Switch/index.cjs +11 -0
  449. package/dist/Switch/index.mjs +5 -0
  450. package/dist/Switch-CQA6xnNA.js +49 -0
  451. package/dist/Switch-CWis2Tw3.js +51 -0
  452. package/dist/Table/index.cjs +18 -0
  453. package/dist/Table/index.mjs +5 -0
  454. package/dist/Tabs/index.cjs +12 -0
  455. package/dist/Tabs/index.mjs +5 -0
  456. package/dist/Tabs-D8_NCGQa.js +70 -0
  457. package/dist/Tabs-DsTn5FwP.js +73 -0
  458. package/dist/Text/index.cjs +11 -0
  459. package/dist/Text/index.mjs +5 -0
  460. package/dist/{Text-259af966.js → Text-D9gsHxbp.js} +2 -6
  461. package/dist/Text-DEviM1Tv.js +25 -0
  462. package/dist/Toast/index.cjs +17 -0
  463. package/dist/Toast/index.mjs +11 -0
  464. package/dist/Tooltip/{index.js → index.cjs} +2 -4
  465. package/dist/Tooltip/index.mjs +8 -0
  466. package/dist/Tooltip-DG1mcZlX.js +104 -0
  467. package/dist/{Tooltip-ef3d6ef4.js → Tooltip-DWAVu0yQ.js} +10 -16
  468. package/dist/Typography/index.cjs +10 -0
  469. package/dist/Typography/index.mjs +4 -0
  470. package/dist/Typography-Dx8KtnBw.js +57 -0
  471. package/dist/Typography-G8pA_xwj.js +55 -0
  472. package/dist/_baseAssignValue-BDfrxHwl.js +29 -0
  473. package/dist/_baseAssignValue-Cq-EPFBb.js +31 -0
  474. package/dist/_baseEach-C5AdInAP.js +1069 -0
  475. package/dist/_baseEach-fQjYIaCA.js +1073 -0
  476. package/dist/_commonjsHelpers-BFTU3MAI.js +7 -0
  477. package/dist/_commonjsHelpers-BJu3ubxk.js +10 -0
  478. package/dist/_defineProperty-DVTdBF7D.js +1326 -0
  479. package/dist/_defineProperty-DYWOWIJv.js +1306 -0
  480. package/dist/_getTag-CHBhnZgu.js +733 -0
  481. package/dist/_getTag-DYzEQmpZ.js +718 -0
  482. package/dist/_setToString-Cjq7b1P9.js +230 -0
  483. package/dist/_setToString-F-wwuS_Y.js +234 -0
  484. package/dist/debounce-B-pQrPa0.js +331 -0
  485. package/dist/debounce-asENWBkf.js +329 -0
  486. package/dist/getAtlantisConfig-6FPWID0P.js +11 -0
  487. package/dist/helpers-5vvADJkh.js +15 -0
  488. package/dist/helpers-CFWATKJI.js +36 -0
  489. package/dist/index.cjs +274 -0
  490. package/dist/index.d.mts +73 -0
  491. package/dist/index.d.ts +73 -0
  492. package/dist/index.mjs +164 -0
  493. package/dist/isObjectLike-91E0YOes.js +190 -0
  494. package/dist/isObjectLike-CsWGWxp9.js +197 -0
  495. package/dist/isSymbol-BEvcpX3s.js +33 -0
  496. package/dist/isSymbol-CqL-NQwG.js +35 -0
  497. package/dist/noop-DXH2P2oE.js +26 -0
  498. package/dist/noop-D_wzwwIq.js +24 -0
  499. package/dist/showToast-CSU2xysR.js +102 -0
  500. package/dist/showToast-lrVl7hOm.js +104 -0
  501. package/dist/style-inject.es-tgCJW-Cu.js +28 -0
  502. package/dist/tslib.es6-Df1SgIEn.js +97 -0
  503. package/dist/tslib.es6-ld72nsZq.js +102 -0
  504. package/dist/useActiveLayout-BzQghohH.js +16 -0
  505. package/dist/useActiveLayout-DazMYwxf.js +14 -0
  506. package/dist/useBatchSelect-B7U15920.js +38 -0
  507. package/dist/useBatchSelect-DMD3JH4P.js +36 -0
  508. package/dist/useChildComponent-BUH0ttPi.js +17 -0
  509. package/dist/useChildComponent-D95jU7NM.js +15 -0
  510. package/dist/useResponsiveSizing-CMuS7Or1.js +46 -0
  511. package/dist/useResponsiveSizing-DRjeJos_.js +44 -0
  512. package/dist/useScrollToActive-BB-8euJF.js +554 -0
  513. package/dist/useScrollToActive-KSEZO66J.js +548 -0
  514. package/package.json +382 -9
  515. package/{rollup.config.js → rollup.config.mjs} +27 -18
  516. package/dist/AnimatedSwitcher/index.js +0 -13
  517. package/dist/Avatar/index.js +0 -15
  518. package/dist/Avatar-76a799fa.js +0 -78
  519. package/dist/Banner/index.js +0 -110
  520. package/dist/Button/index.js +0 -16
  521. package/dist/Button-b73a5e01.js +0 -57
  522. package/dist/ButtonDismiss/index.js +0 -17
  523. package/dist/ButtonDismiss-350af163.js +0 -14
  524. package/dist/Card/index.js +0 -24
  525. package/dist/Checkbox/index.js +0 -18
  526. package/dist/Checkbox-787e2e47.js +0 -63
  527. package/dist/Chip/index.js +0 -41
  528. package/dist/Chip-3d1bfddc.js +0 -89
  529. package/dist/Chips/index.js +0 -524
  530. package/dist/Combobox/index.js +0 -40
  531. package/dist/Combobox-a24c8241.js +0 -479
  532. package/dist/ConfirmationModal/index.js +0 -31
  533. package/dist/Content/index.js +0 -12
  534. package/dist/Content-e3f7b6fc.js +0 -24
  535. package/dist/DataDump/index.js +0 -37
  536. package/dist/DataList/index.js +0 -1335
  537. package/dist/DataTable/index.js +0 -301
  538. package/dist/DatePicker/index.js +0 -20
  539. package/dist/DatePicker-64c5ab1a.js +0 -134
  540. package/dist/DescriptionList/index.js +0 -24
  541. package/dist/Disclosure/index.js +0 -46
  542. package/dist/Drawer/index.js +0 -49
  543. package/dist/Emphasis/index.js +0 -13
  544. package/dist/Emphasis-bda56d3b.js +0 -19
  545. package/dist/FeatureSwitch/index.js +0 -70
  546. package/dist/Flex/index.js +0 -12
  547. package/dist/FormField/index.js +0 -24
  548. package/dist/FormField-6ff183f8.js +0 -253
  549. package/dist/FormatEmail/index.js +0 -23
  550. package/dist/FormatFile/index.js +0 -36
  551. package/dist/FormatFile-f036902d.js +0 -162
  552. package/dist/Gallery/index.js +0 -99
  553. package/dist/Glimmer/index.js +0 -15
  554. package/dist/Glimmer-84dee1ed.js +0 -77
  555. package/dist/Grid/index.js +0 -76
  556. package/dist/Heading/index.js +0 -14
  557. package/dist/Icon/index.js +0 -11
  558. package/dist/Icon-405a216c.js +0 -40
  559. package/dist/InlineLabel/index.js +0 -13
  560. package/dist/InlineLabel-a6557829.js +0 -28
  561. package/dist/InputAvatar/index.js +0 -70
  562. package/dist/InputDate/index.js +0 -57
  563. package/dist/InputEmail/index.js +0 -43
  564. package/dist/InputFile/index.js +0 -25
  565. package/dist/InputFile-bb945071.js +0 -190
  566. package/dist/InputGroup/index.js +0 -12
  567. package/dist/InputNumber/index.js +0 -25
  568. package/dist/InputPassword/index.js +0 -41
  569. package/dist/InputText/index.js +0 -26
  570. package/dist/InputValidation/index.js +0 -17
  571. package/dist/InputValidation-05e839fa.js +0 -29
  572. package/dist/LightBox/index.js +0 -24
  573. package/dist/LightBox-a89d8863.js +0 -117
  574. package/dist/Link/index.js +0 -15
  575. package/dist/List/index.js +0 -93
  576. package/dist/Markdown/index.js +0 -19
  577. package/dist/Markdown-f7c55304.js +0 -62
  578. package/dist/Menu-083fc4c4.js +0 -139
  579. package/dist/Modal/index.js +0 -25
  580. package/dist/Modal-c336cac6.js +0 -71
  581. package/dist/Option-3c4d377e.js +0 -19
  582. package/dist/Page/index.js +0 -78
  583. package/dist/Popover/index.js +0 -61
  584. package/dist/ProgressBar/index.js +0 -12
  585. package/dist/ProgressBar-b68edc8f.js +0 -43
  586. package/dist/RadioGroup/index.js +0 -15
  587. package/dist/RadioGroup-17b67ade.js +0 -46
  588. package/dist/RecurringSelect/index.js +0 -227
  589. package/dist/Select/index.js +0 -26
  590. package/dist/Spinner/index.js +0 -12
  591. package/dist/Spinner-9d8fc7ff.js +0 -24
  592. package/dist/StatusIndicator/index.js +0 -11
  593. package/dist/StatusIndicator-b179d06e.js +0 -18
  594. package/dist/StatusLabel/index.js +0 -29
  595. package/dist/Switch/index.js +0 -13
  596. package/dist/Switch-7d4aa7c3.js +0 -56
  597. package/dist/Table/index.js +0 -66
  598. package/dist/Tabs/index.js +0 -80
  599. package/dist/Text/index.js +0 -13
  600. package/dist/Toast/index.js +0 -111
  601. package/dist/Typography/index.js +0 -12
  602. package/dist/Typography-c45bf216.js +0 -62
  603. package/dist/tslib.es6-754e2961.js +0 -46
  604. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
  605. /package/dist/{getAtlantisConfig-0f3e8af2.js → getAtlantisConfig-mcMVqf6m.js} +0 -0
  606. /package/dist/{style-inject.es-9d2f5f4e.js → style-inject.es-XZHJH68X.js} +0 -0
@@ -0,0 +1,2794 @@
1
+ import { a as __awaiter, b as __generator, c as __spread } from './tslib.es6-Df1SgIEn.js';
2
+ import React, { forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useEffect, useCallback } from 'react';
3
+ import classnames from 'classnames';
4
+ import { g as getDefaultExportFromCjs } from './_commonjsHelpers-BFTU3MAI.js';
5
+ import axios from 'axios';
6
+ import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
7
+ import { I as InputValidation } from './InputValidation-BmgvSw0e.js';
8
+ import { B as Button } from './Button-CWVwgwhn.js';
9
+ import { C as Content } from './Content-BknIp35w.js';
10
+ import { T as Typography } from './Typography-G8pA_xwj.js';
11
+
12
+ var propTypes = {exports: {}};
13
+
14
+ var reactIs = {exports: {}};
15
+
16
+ var reactIs_production_min = {};
17
+
18
+ /** @license React v16.13.1
19
+ * react-is.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+
27
+ var hasRequiredReactIs_production_min;
28
+
29
+ function requireReactIs_production_min () {
30
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
31
+ hasRequiredReactIs_production_min = 1;
32
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
33
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
34
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
35
+ reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
36
+ reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
37
+ reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
38
+ return reactIs_production_min;
39
+ }
40
+
41
+ var reactIs_development = {};
42
+
43
+ /** @license React v16.13.1
44
+ * react-is.development.js
45
+ *
46
+ * Copyright (c) Facebook, Inc. and its affiliates.
47
+ *
48
+ * This source code is licensed under the MIT license found in the
49
+ * LICENSE file in the root directory of this source tree.
50
+ */
51
+
52
+ var hasRequiredReactIs_development;
53
+
54
+ function requireReactIs_development () {
55
+ if (hasRequiredReactIs_development) return reactIs_development;
56
+ hasRequiredReactIs_development = 1;
57
+
58
+
59
+
60
+ if (process.env.NODE_ENV !== "production") {
61
+ (function() {
62
+
63
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
64
+ // nor polyfill, then a plain number is used for performance.
65
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
66
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
67
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
68
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
69
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
70
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
71
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
72
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
73
+ // (unstable) APIs that have been removed. Can we remove the symbols?
74
+
75
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
76
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
77
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
78
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
79
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
80
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
81
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
82
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
83
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
84
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
85
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
86
+
87
+ function isValidElementType(type) {
88
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
89
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
90
+ }
91
+
92
+ function typeOf(object) {
93
+ if (typeof object === 'object' && object !== null) {
94
+ var $$typeof = object.$$typeof;
95
+
96
+ switch ($$typeof) {
97
+ case REACT_ELEMENT_TYPE:
98
+ var type = object.type;
99
+
100
+ switch (type) {
101
+ case REACT_ASYNC_MODE_TYPE:
102
+ case REACT_CONCURRENT_MODE_TYPE:
103
+ case REACT_FRAGMENT_TYPE:
104
+ case REACT_PROFILER_TYPE:
105
+ case REACT_STRICT_MODE_TYPE:
106
+ case REACT_SUSPENSE_TYPE:
107
+ return type;
108
+
109
+ default:
110
+ var $$typeofType = type && type.$$typeof;
111
+
112
+ switch ($$typeofType) {
113
+ case REACT_CONTEXT_TYPE:
114
+ case REACT_FORWARD_REF_TYPE:
115
+ case REACT_LAZY_TYPE:
116
+ case REACT_MEMO_TYPE:
117
+ case REACT_PROVIDER_TYPE:
118
+ return $$typeofType;
119
+
120
+ default:
121
+ return $$typeof;
122
+ }
123
+
124
+ }
125
+
126
+ case REACT_PORTAL_TYPE:
127
+ return $$typeof;
128
+ }
129
+ }
130
+
131
+ return undefined;
132
+ } // AsyncMode is deprecated along with isAsyncMode
133
+
134
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
135
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
136
+ var ContextConsumer = REACT_CONTEXT_TYPE;
137
+ var ContextProvider = REACT_PROVIDER_TYPE;
138
+ var Element = REACT_ELEMENT_TYPE;
139
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
140
+ var Fragment = REACT_FRAGMENT_TYPE;
141
+ var Lazy = REACT_LAZY_TYPE;
142
+ var Memo = REACT_MEMO_TYPE;
143
+ var Portal = REACT_PORTAL_TYPE;
144
+ var Profiler = REACT_PROFILER_TYPE;
145
+ var StrictMode = REACT_STRICT_MODE_TYPE;
146
+ var Suspense = REACT_SUSPENSE_TYPE;
147
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
148
+
149
+ function isAsyncMode(object) {
150
+ {
151
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
152
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
153
+
154
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
155
+ }
156
+ }
157
+
158
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
159
+ }
160
+ function isConcurrentMode(object) {
161
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
162
+ }
163
+ function isContextConsumer(object) {
164
+ return typeOf(object) === REACT_CONTEXT_TYPE;
165
+ }
166
+ function isContextProvider(object) {
167
+ return typeOf(object) === REACT_PROVIDER_TYPE;
168
+ }
169
+ function isElement(object) {
170
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
171
+ }
172
+ function isForwardRef(object) {
173
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
174
+ }
175
+ function isFragment(object) {
176
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
177
+ }
178
+ function isLazy(object) {
179
+ return typeOf(object) === REACT_LAZY_TYPE;
180
+ }
181
+ function isMemo(object) {
182
+ return typeOf(object) === REACT_MEMO_TYPE;
183
+ }
184
+ function isPortal(object) {
185
+ return typeOf(object) === REACT_PORTAL_TYPE;
186
+ }
187
+ function isProfiler(object) {
188
+ return typeOf(object) === REACT_PROFILER_TYPE;
189
+ }
190
+ function isStrictMode(object) {
191
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
192
+ }
193
+ function isSuspense(object) {
194
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
195
+ }
196
+
197
+ reactIs_development.AsyncMode = AsyncMode;
198
+ reactIs_development.ConcurrentMode = ConcurrentMode;
199
+ reactIs_development.ContextConsumer = ContextConsumer;
200
+ reactIs_development.ContextProvider = ContextProvider;
201
+ reactIs_development.Element = Element;
202
+ reactIs_development.ForwardRef = ForwardRef;
203
+ reactIs_development.Fragment = Fragment;
204
+ reactIs_development.Lazy = Lazy;
205
+ reactIs_development.Memo = Memo;
206
+ reactIs_development.Portal = Portal;
207
+ reactIs_development.Profiler = Profiler;
208
+ reactIs_development.StrictMode = StrictMode;
209
+ reactIs_development.Suspense = Suspense;
210
+ reactIs_development.isAsyncMode = isAsyncMode;
211
+ reactIs_development.isConcurrentMode = isConcurrentMode;
212
+ reactIs_development.isContextConsumer = isContextConsumer;
213
+ reactIs_development.isContextProvider = isContextProvider;
214
+ reactIs_development.isElement = isElement;
215
+ reactIs_development.isForwardRef = isForwardRef;
216
+ reactIs_development.isFragment = isFragment;
217
+ reactIs_development.isLazy = isLazy;
218
+ reactIs_development.isMemo = isMemo;
219
+ reactIs_development.isPortal = isPortal;
220
+ reactIs_development.isProfiler = isProfiler;
221
+ reactIs_development.isStrictMode = isStrictMode;
222
+ reactIs_development.isSuspense = isSuspense;
223
+ reactIs_development.isValidElementType = isValidElementType;
224
+ reactIs_development.typeOf = typeOf;
225
+ })();
226
+ }
227
+ return reactIs_development;
228
+ }
229
+
230
+ var hasRequiredReactIs;
231
+
232
+ function requireReactIs () {
233
+ if (hasRequiredReactIs) return reactIs.exports;
234
+ hasRequiredReactIs = 1;
235
+
236
+ if (process.env.NODE_ENV === 'production') {
237
+ reactIs.exports = requireReactIs_production_min();
238
+ } else {
239
+ reactIs.exports = requireReactIs_development();
240
+ }
241
+ return reactIs.exports;
242
+ }
243
+
244
+ /*
245
+ object-assign
246
+ (c) Sindre Sorhus
247
+ @license MIT
248
+ */
249
+
250
+ var objectAssign;
251
+ var hasRequiredObjectAssign;
252
+
253
+ function requireObjectAssign () {
254
+ if (hasRequiredObjectAssign) return objectAssign;
255
+ hasRequiredObjectAssign = 1;
256
+ /* eslint-disable no-unused-vars */
257
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
258
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
259
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
260
+
261
+ function toObject(val) {
262
+ if (val === null || val === undefined) {
263
+ throw new TypeError('Object.assign cannot be called with null or undefined');
264
+ }
265
+
266
+ return Object(val);
267
+ }
268
+
269
+ function shouldUseNative() {
270
+ try {
271
+ if (!Object.assign) {
272
+ return false;
273
+ }
274
+
275
+ // Detect buggy property enumeration order in older V8 versions.
276
+
277
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
278
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
279
+ test1[5] = 'de';
280
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
281
+ return false;
282
+ }
283
+
284
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
285
+ var test2 = {};
286
+ for (var i = 0; i < 10; i++) {
287
+ test2['_' + String.fromCharCode(i)] = i;
288
+ }
289
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
290
+ return test2[n];
291
+ });
292
+ if (order2.join('') !== '0123456789') {
293
+ return false;
294
+ }
295
+
296
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
297
+ var test3 = {};
298
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
299
+ test3[letter] = letter;
300
+ });
301
+ if (Object.keys(Object.assign({}, test3)).join('') !==
302
+ 'abcdefghijklmnopqrst') {
303
+ return false;
304
+ }
305
+
306
+ return true;
307
+ } catch (err) {
308
+ // We don't expect any of the above to throw, but better to be safe.
309
+ return false;
310
+ }
311
+ }
312
+
313
+ objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
314
+ var from;
315
+ var to = toObject(target);
316
+ var symbols;
317
+
318
+ for (var s = 1; s < arguments.length; s++) {
319
+ from = Object(arguments[s]);
320
+
321
+ for (var key in from) {
322
+ if (hasOwnProperty.call(from, key)) {
323
+ to[key] = from[key];
324
+ }
325
+ }
326
+
327
+ if (getOwnPropertySymbols) {
328
+ symbols = getOwnPropertySymbols(from);
329
+ for (var i = 0; i < symbols.length; i++) {
330
+ if (propIsEnumerable.call(from, symbols[i])) {
331
+ to[symbols[i]] = from[symbols[i]];
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+ return to;
338
+ };
339
+ return objectAssign;
340
+ }
341
+
342
+ /**
343
+ * Copyright (c) 2013-present, Facebook, Inc.
344
+ *
345
+ * This source code is licensed under the MIT license found in the
346
+ * LICENSE file in the root directory of this source tree.
347
+ */
348
+
349
+ var ReactPropTypesSecret_1;
350
+ var hasRequiredReactPropTypesSecret;
351
+
352
+ function requireReactPropTypesSecret () {
353
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
354
+ hasRequiredReactPropTypesSecret = 1;
355
+
356
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
357
+
358
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
359
+ return ReactPropTypesSecret_1;
360
+ }
361
+
362
+ var has;
363
+ var hasRequiredHas;
364
+
365
+ function requireHas () {
366
+ if (hasRequiredHas) return has;
367
+ hasRequiredHas = 1;
368
+ has = Function.call.bind(Object.prototype.hasOwnProperty);
369
+ return has;
370
+ }
371
+
372
+ /**
373
+ * Copyright (c) 2013-present, Facebook, Inc.
374
+ *
375
+ * This source code is licensed under the MIT license found in the
376
+ * LICENSE file in the root directory of this source tree.
377
+ */
378
+
379
+ var checkPropTypes_1;
380
+ var hasRequiredCheckPropTypes;
381
+
382
+ function requireCheckPropTypes () {
383
+ if (hasRequiredCheckPropTypes) return checkPropTypes_1;
384
+ hasRequiredCheckPropTypes = 1;
385
+
386
+ var printWarning = function() {};
387
+
388
+ if (process.env.NODE_ENV !== 'production') {
389
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
390
+ var loggedTypeFailures = {};
391
+ var has = requireHas();
392
+
393
+ printWarning = function(text) {
394
+ var message = 'Warning: ' + text;
395
+ if (typeof console !== 'undefined') {
396
+ console.error(message);
397
+ }
398
+ try {
399
+ // --- Welcome to debugging React ---
400
+ // This error was thrown as a convenience so that you can use this stack
401
+ // to find the callsite that caused this warning to fire.
402
+ throw new Error(message);
403
+ } catch (x) { /**/ }
404
+ };
405
+ }
406
+
407
+ /**
408
+ * Assert that the values match with the type specs.
409
+ * Error messages are memorized and will only be shown once.
410
+ *
411
+ * @param {object} typeSpecs Map of name to a ReactPropType
412
+ * @param {object} values Runtime values that need to be type-checked
413
+ * @param {string} location e.g. "prop", "context", "child context"
414
+ * @param {string} componentName Name of the component for error messages.
415
+ * @param {?Function} getStack Returns the component stack.
416
+ * @private
417
+ */
418
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
419
+ if (process.env.NODE_ENV !== 'production') {
420
+ for (var typeSpecName in typeSpecs) {
421
+ if (has(typeSpecs, typeSpecName)) {
422
+ var error;
423
+ // Prop type validation may throw. In case they do, we don't want to
424
+ // fail the render phase where it didn't fail before. So we log it.
425
+ // After these have been cleaned up, we'll let them throw.
426
+ try {
427
+ // This is intentionally an invariant that gets caught. It's the same
428
+ // behavior as without this statement except with a better message.
429
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
430
+ var err = Error(
431
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
432
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
433
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
434
+ );
435
+ err.name = 'Invariant Violation';
436
+ throw err;
437
+ }
438
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
439
+ } catch (ex) {
440
+ error = ex;
441
+ }
442
+ if (error && !(error instanceof Error)) {
443
+ printWarning(
444
+ (componentName || 'React class') + ': type specification of ' +
445
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
446
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
447
+ 'You may have forgotten to pass an argument to the type checker ' +
448
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
449
+ 'shape all require an argument).'
450
+ );
451
+ }
452
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
453
+ // Only monitor this failure once because there tends to be a lot of the
454
+ // same error.
455
+ loggedTypeFailures[error.message] = true;
456
+
457
+ var stack = getStack ? getStack() : '';
458
+
459
+ printWarning(
460
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
461
+ );
462
+ }
463
+ }
464
+ }
465
+ }
466
+ }
467
+
468
+ /**
469
+ * Resets warning cache when testing.
470
+ *
471
+ * @private
472
+ */
473
+ checkPropTypes.resetWarningCache = function() {
474
+ if (process.env.NODE_ENV !== 'production') {
475
+ loggedTypeFailures = {};
476
+ }
477
+ };
478
+
479
+ checkPropTypes_1 = checkPropTypes;
480
+ return checkPropTypes_1;
481
+ }
482
+
483
+ /**
484
+ * Copyright (c) 2013-present, Facebook, Inc.
485
+ *
486
+ * This source code is licensed under the MIT license found in the
487
+ * LICENSE file in the root directory of this source tree.
488
+ */
489
+
490
+ var factoryWithTypeCheckers;
491
+ var hasRequiredFactoryWithTypeCheckers;
492
+
493
+ function requireFactoryWithTypeCheckers () {
494
+ if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
495
+ hasRequiredFactoryWithTypeCheckers = 1;
496
+
497
+ var ReactIs = requireReactIs();
498
+ var assign = requireObjectAssign();
499
+
500
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
501
+ var has = requireHas();
502
+ var checkPropTypes = requireCheckPropTypes();
503
+
504
+ var printWarning = function() {};
505
+
506
+ if (process.env.NODE_ENV !== 'production') {
507
+ printWarning = function(text) {
508
+ var message = 'Warning: ' + text;
509
+ if (typeof console !== 'undefined') {
510
+ console.error(message);
511
+ }
512
+ try {
513
+ // --- Welcome to debugging React ---
514
+ // This error was thrown as a convenience so that you can use this stack
515
+ // to find the callsite that caused this warning to fire.
516
+ throw new Error(message);
517
+ } catch (x) {}
518
+ };
519
+ }
520
+
521
+ function emptyFunctionThatReturnsNull() {
522
+ return null;
523
+ }
524
+
525
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
526
+ /* global Symbol */
527
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
528
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
529
+
530
+ /**
531
+ * Returns the iterator method function contained on the iterable object.
532
+ *
533
+ * Be sure to invoke the function with the iterable as context:
534
+ *
535
+ * var iteratorFn = getIteratorFn(myIterable);
536
+ * if (iteratorFn) {
537
+ * var iterator = iteratorFn.call(myIterable);
538
+ * ...
539
+ * }
540
+ *
541
+ * @param {?object} maybeIterable
542
+ * @return {?function}
543
+ */
544
+ function getIteratorFn(maybeIterable) {
545
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
546
+ if (typeof iteratorFn === 'function') {
547
+ return iteratorFn;
548
+ }
549
+ }
550
+
551
+ /**
552
+ * Collection of methods that allow declaration and validation of props that are
553
+ * supplied to React components. Example usage:
554
+ *
555
+ * var Props = require('ReactPropTypes');
556
+ * var MyArticle = React.createClass({
557
+ * propTypes: {
558
+ * // An optional string prop named "description".
559
+ * description: Props.string,
560
+ *
561
+ * // A required enum prop named "category".
562
+ * category: Props.oneOf(['News','Photos']).isRequired,
563
+ *
564
+ * // A prop named "dialog" that requires an instance of Dialog.
565
+ * dialog: Props.instanceOf(Dialog).isRequired
566
+ * },
567
+ * render: function() { ... }
568
+ * });
569
+ *
570
+ * A more formal specification of how these methods are used:
571
+ *
572
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
573
+ * decl := ReactPropTypes.{type}(.isRequired)?
574
+ *
575
+ * Each and every declaration produces a function with the same signature. This
576
+ * allows the creation of custom validation functions. For example:
577
+ *
578
+ * var MyLink = React.createClass({
579
+ * propTypes: {
580
+ * // An optional string or URI prop named "href".
581
+ * href: function(props, propName, componentName) {
582
+ * var propValue = props[propName];
583
+ * if (propValue != null && typeof propValue !== 'string' &&
584
+ * !(propValue instanceof URI)) {
585
+ * return new Error(
586
+ * 'Expected a string or an URI for ' + propName + ' in ' +
587
+ * componentName
588
+ * );
589
+ * }
590
+ * }
591
+ * },
592
+ * render: function() {...}
593
+ * });
594
+ *
595
+ * @internal
596
+ */
597
+
598
+ var ANONYMOUS = '<<anonymous>>';
599
+
600
+ // Important!
601
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
602
+ var ReactPropTypes = {
603
+ array: createPrimitiveTypeChecker('array'),
604
+ bigint: createPrimitiveTypeChecker('bigint'),
605
+ bool: createPrimitiveTypeChecker('boolean'),
606
+ func: createPrimitiveTypeChecker('function'),
607
+ number: createPrimitiveTypeChecker('number'),
608
+ object: createPrimitiveTypeChecker('object'),
609
+ string: createPrimitiveTypeChecker('string'),
610
+ symbol: createPrimitiveTypeChecker('symbol'),
611
+
612
+ any: createAnyTypeChecker(),
613
+ arrayOf: createArrayOfTypeChecker,
614
+ element: createElementTypeChecker(),
615
+ elementType: createElementTypeTypeChecker(),
616
+ instanceOf: createInstanceTypeChecker,
617
+ node: createNodeChecker(),
618
+ objectOf: createObjectOfTypeChecker,
619
+ oneOf: createEnumTypeChecker,
620
+ oneOfType: createUnionTypeChecker,
621
+ shape: createShapeTypeChecker,
622
+ exact: createStrictShapeTypeChecker,
623
+ };
624
+
625
+ /**
626
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
627
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
628
+ */
629
+ /*eslint-disable no-self-compare*/
630
+ function is(x, y) {
631
+ // SameValue algorithm
632
+ if (x === y) {
633
+ // Steps 1-5, 7-10
634
+ // Steps 6.b-6.e: +0 != -0
635
+ return x !== 0 || 1 / x === 1 / y;
636
+ } else {
637
+ // Step 6.a: NaN == NaN
638
+ return x !== x && y !== y;
639
+ }
640
+ }
641
+ /*eslint-enable no-self-compare*/
642
+
643
+ /**
644
+ * We use an Error-like object for backward compatibility as people may call
645
+ * PropTypes directly and inspect their output. However, we don't use real
646
+ * Errors anymore. We don't inspect their stack anyway, and creating them
647
+ * is prohibitively expensive if they are created too often, such as what
648
+ * happens in oneOfType() for any type before the one that matched.
649
+ */
650
+ function PropTypeError(message, data) {
651
+ this.message = message;
652
+ this.data = data && typeof data === 'object' ? data: {};
653
+ this.stack = '';
654
+ }
655
+ // Make `instanceof Error` still work for returned errors.
656
+ PropTypeError.prototype = Error.prototype;
657
+
658
+ function createChainableTypeChecker(validate) {
659
+ if (process.env.NODE_ENV !== 'production') {
660
+ var manualPropTypeCallCache = {};
661
+ var manualPropTypeWarningCount = 0;
662
+ }
663
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
664
+ componentName = componentName || ANONYMOUS;
665
+ propFullName = propFullName || propName;
666
+
667
+ if (secret !== ReactPropTypesSecret) {
668
+ if (throwOnDirectAccess) {
669
+ // New behavior only for users of `prop-types` package
670
+ var err = new Error(
671
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
672
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
673
+ 'Read more at http://fb.me/use-check-prop-types'
674
+ );
675
+ err.name = 'Invariant Violation';
676
+ throw err;
677
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
678
+ // Old behavior for people using React.PropTypes
679
+ var cacheKey = componentName + ':' + propName;
680
+ if (
681
+ !manualPropTypeCallCache[cacheKey] &&
682
+ // Avoid spamming the console because they are often not actionable except for lib authors
683
+ manualPropTypeWarningCount < 3
684
+ ) {
685
+ printWarning(
686
+ 'You are manually calling a React.PropTypes validation ' +
687
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
688
+ 'and will throw in the standalone `prop-types` package. ' +
689
+ 'You may be seeing this warning due to a third-party PropTypes ' +
690
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
691
+ );
692
+ manualPropTypeCallCache[cacheKey] = true;
693
+ manualPropTypeWarningCount++;
694
+ }
695
+ }
696
+ }
697
+ if (props[propName] == null) {
698
+ if (isRequired) {
699
+ if (props[propName] === null) {
700
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
701
+ }
702
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
703
+ }
704
+ return null;
705
+ } else {
706
+ return validate(props, propName, componentName, location, propFullName);
707
+ }
708
+ }
709
+
710
+ var chainedCheckType = checkType.bind(null, false);
711
+ chainedCheckType.isRequired = checkType.bind(null, true);
712
+
713
+ return chainedCheckType;
714
+ }
715
+
716
+ function createPrimitiveTypeChecker(expectedType) {
717
+ function validate(props, propName, componentName, location, propFullName, secret) {
718
+ var propValue = props[propName];
719
+ var propType = getPropType(propValue);
720
+ if (propType !== expectedType) {
721
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
722
+ // check, but we can offer a more precise error message here rather than
723
+ // 'of type `object`'.
724
+ var preciseType = getPreciseType(propValue);
725
+
726
+ return new PropTypeError(
727
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
728
+ {expectedType: expectedType}
729
+ );
730
+ }
731
+ return null;
732
+ }
733
+ return createChainableTypeChecker(validate);
734
+ }
735
+
736
+ function createAnyTypeChecker() {
737
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
738
+ }
739
+
740
+ function createArrayOfTypeChecker(typeChecker) {
741
+ function validate(props, propName, componentName, location, propFullName) {
742
+ if (typeof typeChecker !== 'function') {
743
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
744
+ }
745
+ var propValue = props[propName];
746
+ if (!Array.isArray(propValue)) {
747
+ var propType = getPropType(propValue);
748
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
749
+ }
750
+ for (var i = 0; i < propValue.length; i++) {
751
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
752
+ if (error instanceof Error) {
753
+ return error;
754
+ }
755
+ }
756
+ return null;
757
+ }
758
+ return createChainableTypeChecker(validate);
759
+ }
760
+
761
+ function createElementTypeChecker() {
762
+ function validate(props, propName, componentName, location, propFullName) {
763
+ var propValue = props[propName];
764
+ if (!isValidElement(propValue)) {
765
+ var propType = getPropType(propValue);
766
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
767
+ }
768
+ return null;
769
+ }
770
+ return createChainableTypeChecker(validate);
771
+ }
772
+
773
+ function createElementTypeTypeChecker() {
774
+ function validate(props, propName, componentName, location, propFullName) {
775
+ var propValue = props[propName];
776
+ if (!ReactIs.isValidElementType(propValue)) {
777
+ var propType = getPropType(propValue);
778
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
779
+ }
780
+ return null;
781
+ }
782
+ return createChainableTypeChecker(validate);
783
+ }
784
+
785
+ function createInstanceTypeChecker(expectedClass) {
786
+ function validate(props, propName, componentName, location, propFullName) {
787
+ if (!(props[propName] instanceof expectedClass)) {
788
+ var expectedClassName = expectedClass.name || ANONYMOUS;
789
+ var actualClassName = getClassName(props[propName]);
790
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
791
+ }
792
+ return null;
793
+ }
794
+ return createChainableTypeChecker(validate);
795
+ }
796
+
797
+ function createEnumTypeChecker(expectedValues) {
798
+ if (!Array.isArray(expectedValues)) {
799
+ if (process.env.NODE_ENV !== 'production') {
800
+ if (arguments.length > 1) {
801
+ printWarning(
802
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
803
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
804
+ );
805
+ } else {
806
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
807
+ }
808
+ }
809
+ return emptyFunctionThatReturnsNull;
810
+ }
811
+
812
+ function validate(props, propName, componentName, location, propFullName) {
813
+ var propValue = props[propName];
814
+ for (var i = 0; i < expectedValues.length; i++) {
815
+ if (is(propValue, expectedValues[i])) {
816
+ return null;
817
+ }
818
+ }
819
+
820
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
821
+ var type = getPreciseType(value);
822
+ if (type === 'symbol') {
823
+ return String(value);
824
+ }
825
+ return value;
826
+ });
827
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
828
+ }
829
+ return createChainableTypeChecker(validate);
830
+ }
831
+
832
+ function createObjectOfTypeChecker(typeChecker) {
833
+ function validate(props, propName, componentName, location, propFullName) {
834
+ if (typeof typeChecker !== 'function') {
835
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
836
+ }
837
+ var propValue = props[propName];
838
+ var propType = getPropType(propValue);
839
+ if (propType !== 'object') {
840
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
841
+ }
842
+ for (var key in propValue) {
843
+ if (has(propValue, key)) {
844
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
845
+ if (error instanceof Error) {
846
+ return error;
847
+ }
848
+ }
849
+ }
850
+ return null;
851
+ }
852
+ return createChainableTypeChecker(validate);
853
+ }
854
+
855
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
856
+ if (!Array.isArray(arrayOfTypeCheckers)) {
857
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
858
+ return emptyFunctionThatReturnsNull;
859
+ }
860
+
861
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
862
+ var checker = arrayOfTypeCheckers[i];
863
+ if (typeof checker !== 'function') {
864
+ printWarning(
865
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
866
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
867
+ );
868
+ return emptyFunctionThatReturnsNull;
869
+ }
870
+ }
871
+
872
+ function validate(props, propName, componentName, location, propFullName) {
873
+ var expectedTypes = [];
874
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
875
+ var checker = arrayOfTypeCheckers[i];
876
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
877
+ if (checkerResult == null) {
878
+ return null;
879
+ }
880
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
881
+ expectedTypes.push(checkerResult.data.expectedType);
882
+ }
883
+ }
884
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
885
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
886
+ }
887
+ return createChainableTypeChecker(validate);
888
+ }
889
+
890
+ function createNodeChecker() {
891
+ function validate(props, propName, componentName, location, propFullName) {
892
+ if (!isNode(props[propName])) {
893
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
894
+ }
895
+ return null;
896
+ }
897
+ return createChainableTypeChecker(validate);
898
+ }
899
+
900
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
901
+ return new PropTypeError(
902
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
903
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
904
+ );
905
+ }
906
+
907
+ function createShapeTypeChecker(shapeTypes) {
908
+ function validate(props, propName, componentName, location, propFullName) {
909
+ var propValue = props[propName];
910
+ var propType = getPropType(propValue);
911
+ if (propType !== 'object') {
912
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
913
+ }
914
+ for (var key in shapeTypes) {
915
+ var checker = shapeTypes[key];
916
+ if (typeof checker !== 'function') {
917
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
918
+ }
919
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
920
+ if (error) {
921
+ return error;
922
+ }
923
+ }
924
+ return null;
925
+ }
926
+ return createChainableTypeChecker(validate);
927
+ }
928
+
929
+ function createStrictShapeTypeChecker(shapeTypes) {
930
+ function validate(props, propName, componentName, location, propFullName) {
931
+ var propValue = props[propName];
932
+ var propType = getPropType(propValue);
933
+ if (propType !== 'object') {
934
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
935
+ }
936
+ // We need to check all keys in case some are required but missing from props.
937
+ var allKeys = assign({}, props[propName], shapeTypes);
938
+ for (var key in allKeys) {
939
+ var checker = shapeTypes[key];
940
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
941
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
942
+ }
943
+ if (!checker) {
944
+ return new PropTypeError(
945
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
946
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
947
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
948
+ );
949
+ }
950
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
951
+ if (error) {
952
+ return error;
953
+ }
954
+ }
955
+ return null;
956
+ }
957
+
958
+ return createChainableTypeChecker(validate);
959
+ }
960
+
961
+ function isNode(propValue) {
962
+ switch (typeof propValue) {
963
+ case 'number':
964
+ case 'string':
965
+ case 'undefined':
966
+ return true;
967
+ case 'boolean':
968
+ return !propValue;
969
+ case 'object':
970
+ if (Array.isArray(propValue)) {
971
+ return propValue.every(isNode);
972
+ }
973
+ if (propValue === null || isValidElement(propValue)) {
974
+ return true;
975
+ }
976
+
977
+ var iteratorFn = getIteratorFn(propValue);
978
+ if (iteratorFn) {
979
+ var iterator = iteratorFn.call(propValue);
980
+ var step;
981
+ if (iteratorFn !== propValue.entries) {
982
+ while (!(step = iterator.next()).done) {
983
+ if (!isNode(step.value)) {
984
+ return false;
985
+ }
986
+ }
987
+ } else {
988
+ // Iterator will provide entry [k,v] tuples rather than values.
989
+ while (!(step = iterator.next()).done) {
990
+ var entry = step.value;
991
+ if (entry) {
992
+ if (!isNode(entry[1])) {
993
+ return false;
994
+ }
995
+ }
996
+ }
997
+ }
998
+ } else {
999
+ return false;
1000
+ }
1001
+
1002
+ return true;
1003
+ default:
1004
+ return false;
1005
+ }
1006
+ }
1007
+
1008
+ function isSymbol(propType, propValue) {
1009
+ // Native Symbol.
1010
+ if (propType === 'symbol') {
1011
+ return true;
1012
+ }
1013
+
1014
+ // falsy value can't be a Symbol
1015
+ if (!propValue) {
1016
+ return false;
1017
+ }
1018
+
1019
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1020
+ if (propValue['@@toStringTag'] === 'Symbol') {
1021
+ return true;
1022
+ }
1023
+
1024
+ // Fallback for non-spec compliant Symbols which are polyfilled.
1025
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1026
+ return true;
1027
+ }
1028
+
1029
+ return false;
1030
+ }
1031
+
1032
+ // Equivalent of `typeof` but with special handling for array and regexp.
1033
+ function getPropType(propValue) {
1034
+ var propType = typeof propValue;
1035
+ if (Array.isArray(propValue)) {
1036
+ return 'array';
1037
+ }
1038
+ if (propValue instanceof RegExp) {
1039
+ // Old webkits (at least until Android 4.0) return 'function' rather than
1040
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1041
+ // passes PropTypes.object.
1042
+ return 'object';
1043
+ }
1044
+ if (isSymbol(propType, propValue)) {
1045
+ return 'symbol';
1046
+ }
1047
+ return propType;
1048
+ }
1049
+
1050
+ // This handles more types than `getPropType`. Only used for error messages.
1051
+ // See `createPrimitiveTypeChecker`.
1052
+ function getPreciseType(propValue) {
1053
+ if (typeof propValue === 'undefined' || propValue === null) {
1054
+ return '' + propValue;
1055
+ }
1056
+ var propType = getPropType(propValue);
1057
+ if (propType === 'object') {
1058
+ if (propValue instanceof Date) {
1059
+ return 'date';
1060
+ } else if (propValue instanceof RegExp) {
1061
+ return 'regexp';
1062
+ }
1063
+ }
1064
+ return propType;
1065
+ }
1066
+
1067
+ // Returns a string that is postfixed to a warning about an invalid type.
1068
+ // For example, "undefined" or "of type array"
1069
+ function getPostfixForTypeWarning(value) {
1070
+ var type = getPreciseType(value);
1071
+ switch (type) {
1072
+ case 'array':
1073
+ case 'object':
1074
+ return 'an ' + type;
1075
+ case 'boolean':
1076
+ case 'date':
1077
+ case 'regexp':
1078
+ return 'a ' + type;
1079
+ default:
1080
+ return type;
1081
+ }
1082
+ }
1083
+
1084
+ // Returns class name of the object, if any.
1085
+ function getClassName(propValue) {
1086
+ if (!propValue.constructor || !propValue.constructor.name) {
1087
+ return ANONYMOUS;
1088
+ }
1089
+ return propValue.constructor.name;
1090
+ }
1091
+
1092
+ ReactPropTypes.checkPropTypes = checkPropTypes;
1093
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1094
+ ReactPropTypes.PropTypes = ReactPropTypes;
1095
+
1096
+ return ReactPropTypes;
1097
+ };
1098
+ return factoryWithTypeCheckers;
1099
+ }
1100
+
1101
+ /**
1102
+ * Copyright (c) 2013-present, Facebook, Inc.
1103
+ *
1104
+ * This source code is licensed under the MIT license found in the
1105
+ * LICENSE file in the root directory of this source tree.
1106
+ */
1107
+
1108
+ var factoryWithThrowingShims;
1109
+ var hasRequiredFactoryWithThrowingShims;
1110
+
1111
+ function requireFactoryWithThrowingShims () {
1112
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1113
+ hasRequiredFactoryWithThrowingShims = 1;
1114
+
1115
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
1116
+
1117
+ function emptyFunction() {}
1118
+ function emptyFunctionWithReset() {}
1119
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1120
+
1121
+ factoryWithThrowingShims = function() {
1122
+ function shim(props, propName, componentName, location, propFullName, secret) {
1123
+ if (secret === ReactPropTypesSecret) {
1124
+ // It is still safe when called from React.
1125
+ return;
1126
+ }
1127
+ var err = new Error(
1128
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1129
+ 'Use PropTypes.checkPropTypes() to call them. ' +
1130
+ 'Read more at http://fb.me/use-check-prop-types'
1131
+ );
1132
+ err.name = 'Invariant Violation';
1133
+ throw err;
1134
+ } shim.isRequired = shim;
1135
+ function getShim() {
1136
+ return shim;
1137
+ } // Important!
1138
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1139
+ var ReactPropTypes = {
1140
+ array: shim,
1141
+ bigint: shim,
1142
+ bool: shim,
1143
+ func: shim,
1144
+ number: shim,
1145
+ object: shim,
1146
+ string: shim,
1147
+ symbol: shim,
1148
+
1149
+ any: shim,
1150
+ arrayOf: getShim,
1151
+ element: shim,
1152
+ elementType: shim,
1153
+ instanceOf: getShim,
1154
+ node: shim,
1155
+ objectOf: getShim,
1156
+ oneOf: getShim,
1157
+ oneOfType: getShim,
1158
+ shape: getShim,
1159
+ exact: getShim,
1160
+
1161
+ checkPropTypes: emptyFunctionWithReset,
1162
+ resetWarningCache: emptyFunction
1163
+ };
1164
+
1165
+ ReactPropTypes.PropTypes = ReactPropTypes;
1166
+
1167
+ return ReactPropTypes;
1168
+ };
1169
+ return factoryWithThrowingShims;
1170
+ }
1171
+
1172
+ /**
1173
+ * Copyright (c) 2013-present, Facebook, Inc.
1174
+ *
1175
+ * This source code is licensed under the MIT license found in the
1176
+ * LICENSE file in the root directory of this source tree.
1177
+ */
1178
+
1179
+ if (process.env.NODE_ENV !== 'production') {
1180
+ var ReactIs = requireReactIs();
1181
+
1182
+ // By explicitly using `prop-types` you are opting into new development behavior.
1183
+ // http://fb.me/prop-types-in-prod
1184
+ var throwOnDirectAccess = true;
1185
+ propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1186
+ } else {
1187
+ // By explicitly using `prop-types` you are opting into new production behavior.
1188
+ // http://fb.me/prop-types-in-prod
1189
+ propTypes.exports = requireFactoryWithThrowingShims()();
1190
+ }
1191
+
1192
+ var propTypesExports = propTypes.exports;
1193
+ var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
1194
+
1195
+ var COMMON_MIME_TYPES = new Map([
1196
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
1197
+ ['aac', 'audio/aac'],
1198
+ ['abw', 'application/x-abiword'],
1199
+ ['arc', 'application/x-freearc'],
1200
+ ['avif', 'image/avif'],
1201
+ ['avi', 'video/x-msvideo'],
1202
+ ['azw', 'application/vnd.amazon.ebook'],
1203
+ ['bin', 'application/octet-stream'],
1204
+ ['bmp', 'image/bmp'],
1205
+ ['bz', 'application/x-bzip'],
1206
+ ['bz2', 'application/x-bzip2'],
1207
+ ['cda', 'application/x-cdf'],
1208
+ ['csh', 'application/x-csh'],
1209
+ ['css', 'text/css'],
1210
+ ['csv', 'text/csv'],
1211
+ ['doc', 'application/msword'],
1212
+ ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
1213
+ ['eot', 'application/vnd.ms-fontobject'],
1214
+ ['epub', 'application/epub+zip'],
1215
+ ['gz', 'application/gzip'],
1216
+ ['gif', 'image/gif'],
1217
+ ['htm', 'text/html'],
1218
+ ['html', 'text/html'],
1219
+ ['ico', 'image/vnd.microsoft.icon'],
1220
+ ['ics', 'text/calendar'],
1221
+ ['jar', 'application/java-archive'],
1222
+ ['jpeg', 'image/jpeg'],
1223
+ ['jpg', 'image/jpeg'],
1224
+ ['js', 'text/javascript'],
1225
+ ['json', 'application/json'],
1226
+ ['jsonld', 'application/ld+json'],
1227
+ ['mid', 'audio/midi'],
1228
+ ['midi', 'audio/midi'],
1229
+ ['mjs', 'text/javascript'],
1230
+ ['mp3', 'audio/mpeg'],
1231
+ ['mp4', 'video/mp4'],
1232
+ ['mpeg', 'video/mpeg'],
1233
+ ['mpkg', 'application/vnd.apple.installer+xml'],
1234
+ ['odp', 'application/vnd.oasis.opendocument.presentation'],
1235
+ ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
1236
+ ['odt', 'application/vnd.oasis.opendocument.text'],
1237
+ ['oga', 'audio/ogg'],
1238
+ ['ogv', 'video/ogg'],
1239
+ ['ogx', 'application/ogg'],
1240
+ ['opus', 'audio/opus'],
1241
+ ['otf', 'font/otf'],
1242
+ ['png', 'image/png'],
1243
+ ['pdf', 'application/pdf'],
1244
+ ['php', 'application/x-httpd-php'],
1245
+ ['ppt', 'application/vnd.ms-powerpoint'],
1246
+ ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
1247
+ ['rar', 'application/vnd.rar'],
1248
+ ['rtf', 'application/rtf'],
1249
+ ['sh', 'application/x-sh'],
1250
+ ['svg', 'image/svg+xml'],
1251
+ ['swf', 'application/x-shockwave-flash'],
1252
+ ['tar', 'application/x-tar'],
1253
+ ['tif', 'image/tiff'],
1254
+ ['tiff', 'image/tiff'],
1255
+ ['ts', 'video/mp2t'],
1256
+ ['ttf', 'font/ttf'],
1257
+ ['txt', 'text/plain'],
1258
+ ['vsd', 'application/vnd.visio'],
1259
+ ['wav', 'audio/wav'],
1260
+ ['weba', 'audio/webm'],
1261
+ ['webm', 'video/webm'],
1262
+ ['webp', 'image/webp'],
1263
+ ['woff', 'font/woff'],
1264
+ ['woff2', 'font/woff2'],
1265
+ ['xhtml', 'application/xhtml+xml'],
1266
+ ['xls', 'application/vnd.ms-excel'],
1267
+ ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
1268
+ ['xml', 'application/xml'],
1269
+ ['xul', 'application/vnd.mozilla.xul+xml'],
1270
+ ['zip', 'application/zip'],
1271
+ ['7z', 'application/x-7z-compressed'],
1272
+ // Others
1273
+ ['mkv', 'video/x-matroska'],
1274
+ ['mov', 'video/quicktime'],
1275
+ ['msg', 'application/vnd.ms-outlook']
1276
+ ]);
1277
+ function toFileWithPath(file, path) {
1278
+ var f = withMimeType(file);
1279
+ if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
1280
+ var webkitRelativePath = file.webkitRelativePath;
1281
+ Object.defineProperty(f, 'path', {
1282
+ value: typeof path === 'string'
1283
+ ? path
1284
+ // If <input webkitdirectory> is set,
1285
+ // the File will have a {webkitRelativePath} property
1286
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
1287
+ : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
1288
+ ? webkitRelativePath
1289
+ : file.name,
1290
+ writable: false,
1291
+ configurable: false,
1292
+ enumerable: true
1293
+ });
1294
+ }
1295
+ return f;
1296
+ }
1297
+ function withMimeType(file) {
1298
+ var name = file.name;
1299
+ var hasExtension = name && name.lastIndexOf('.') !== -1;
1300
+ if (hasExtension && !file.type) {
1301
+ var ext = name.split('.')
1302
+ .pop().toLowerCase();
1303
+ var type = COMMON_MIME_TYPES.get(ext);
1304
+ if (type) {
1305
+ Object.defineProperty(file, 'type', {
1306
+ value: type,
1307
+ writable: false,
1308
+ configurable: false,
1309
+ enumerable: true
1310
+ });
1311
+ }
1312
+ }
1313
+ return file;
1314
+ }
1315
+
1316
+ var FILES_TO_IGNORE = [
1317
+ // Thumbnail cache files for macOS and Windows
1318
+ '.DS_Store',
1319
+ 'Thumbs.db' // Windows
1320
+ ];
1321
+ /**
1322
+ * Convert a DragEvent's DataTrasfer object to a list of File objects
1323
+ * NOTE: If some of the items are folders,
1324
+ * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
1325
+ *
1326
+ * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
1327
+ * and a list of File objects will be returned.
1328
+ *
1329
+ * @param evt
1330
+ */
1331
+ function fromEvent(evt) {
1332
+ return __awaiter(this, void 0, void 0, function () {
1333
+ return __generator(this, function (_a) {
1334
+ if (isObject(evt) && isDataTransfer(evt)) {
1335
+ return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
1336
+ }
1337
+ else if (isChangeEvt(evt)) {
1338
+ return [2 /*return*/, getInputFiles(evt)];
1339
+ }
1340
+ else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
1341
+ return [2 /*return*/, getFsHandleFiles(evt)];
1342
+ }
1343
+ return [2 /*return*/, []];
1344
+ });
1345
+ });
1346
+ }
1347
+ function isDataTransfer(value) {
1348
+ return isObject(value.dataTransfer);
1349
+ }
1350
+ function isChangeEvt(value) {
1351
+ return isObject(value) && isObject(value.target);
1352
+ }
1353
+ function isObject(v) {
1354
+ return typeof v === 'object' && v !== null;
1355
+ }
1356
+ function getInputFiles(evt) {
1357
+ return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
1358
+ }
1359
+ // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
1360
+ function getFsHandleFiles(handles) {
1361
+ return __awaiter(this, void 0, void 0, function () {
1362
+ var files;
1363
+ return __generator(this, function (_a) {
1364
+ switch (_a.label) {
1365
+ case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
1366
+ case 1:
1367
+ files = _a.sent();
1368
+ return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
1369
+ }
1370
+ });
1371
+ });
1372
+ }
1373
+ function getDataTransferFiles(dt, type) {
1374
+ return __awaiter(this, void 0, void 0, function () {
1375
+ var items, files;
1376
+ return __generator(this, function (_a) {
1377
+ switch (_a.label) {
1378
+ case 0:
1379
+ if (dt === null) {
1380
+ return [2 /*return*/, []];
1381
+ }
1382
+ if (!dt.items) return [3 /*break*/, 2];
1383
+ items = fromList(dt.items)
1384
+ .filter(function (item) { return item.kind === 'file'; });
1385
+ // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
1386
+ // only 'dragstart' and 'drop' has access to the data (source node)
1387
+ if (type !== 'drop') {
1388
+ return [2 /*return*/, items];
1389
+ }
1390
+ return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
1391
+ case 1:
1392
+ files = _a.sent();
1393
+ return [2 /*return*/, noIgnoredFiles(flatten(files))];
1394
+ case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
1395
+ .map(function (file) { return toFileWithPath(file); }))];
1396
+ }
1397
+ });
1398
+ });
1399
+ }
1400
+ function noIgnoredFiles(files) {
1401
+ return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
1402
+ }
1403
+ // IE11 does not support Array.from()
1404
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
1405
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileList
1406
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
1407
+ function fromList(items) {
1408
+ if (items === null) {
1409
+ return [];
1410
+ }
1411
+ var files = [];
1412
+ // tslint:disable: prefer-for-of
1413
+ for (var i = 0; i < items.length; i++) {
1414
+ var file = items[i];
1415
+ files.push(file);
1416
+ }
1417
+ return files;
1418
+ }
1419
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
1420
+ function toFilePromises(item) {
1421
+ if (typeof item.webkitGetAsEntry !== 'function') {
1422
+ return fromDataTransferItem(item);
1423
+ }
1424
+ var entry = item.webkitGetAsEntry();
1425
+ // Safari supports dropping an image node from a different window and can be retrieved using
1426
+ // the DataTransferItem.getAsFile() API
1427
+ // NOTE: FileSystemEntry.file() throws if trying to get the file
1428
+ if (entry && entry.isDirectory) {
1429
+ return fromDirEntry(entry);
1430
+ }
1431
+ return fromDataTransferItem(item);
1432
+ }
1433
+ function flatten(items) {
1434
+ return items.reduce(function (acc, files) { return __spread(acc, (Array.isArray(files) ? flatten(files) : [files])); }, []);
1435
+ }
1436
+ function fromDataTransferItem(item) {
1437
+ var file = item.getAsFile();
1438
+ if (!file) {
1439
+ return Promise.reject(item + " is not a File");
1440
+ }
1441
+ var fwp = toFileWithPath(file);
1442
+ return Promise.resolve(fwp);
1443
+ }
1444
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
1445
+ function fromEntry(entry) {
1446
+ return __awaiter(this, void 0, void 0, function () {
1447
+ return __generator(this, function (_a) {
1448
+ return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
1449
+ });
1450
+ });
1451
+ }
1452
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
1453
+ function fromDirEntry(entry) {
1454
+ var reader = entry.createReader();
1455
+ return new Promise(function (resolve, reject) {
1456
+ var entries = [];
1457
+ function readEntries() {
1458
+ var _this = this;
1459
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
1460
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
1461
+ reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () {
1462
+ var files, err_1, items;
1463
+ return __generator(this, function (_a) {
1464
+ switch (_a.label) {
1465
+ case 0:
1466
+ if (!!batch.length) return [3 /*break*/, 5];
1467
+ _a.label = 1;
1468
+ case 1:
1469
+ _a.trys.push([1, 3, , 4]);
1470
+ return [4 /*yield*/, Promise.all(entries)];
1471
+ case 2:
1472
+ files = _a.sent();
1473
+ resolve(files);
1474
+ return [3 /*break*/, 4];
1475
+ case 3:
1476
+ err_1 = _a.sent();
1477
+ reject(err_1);
1478
+ return [3 /*break*/, 4];
1479
+ case 4: return [3 /*break*/, 6];
1480
+ case 5:
1481
+ items = Promise.all(batch.map(fromEntry));
1482
+ entries.push(items);
1483
+ // Continue reading
1484
+ readEntries();
1485
+ _a.label = 6;
1486
+ case 6: return [2 /*return*/];
1487
+ }
1488
+ });
1489
+ }); }, function (err) {
1490
+ reject(err);
1491
+ });
1492
+ }
1493
+ readEntries();
1494
+ });
1495
+ }
1496
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
1497
+ function fromFileEntry(entry) {
1498
+ return __awaiter(this, void 0, void 0, function () {
1499
+ return __generator(this, function (_a) {
1500
+ return [2 /*return*/, new Promise(function (resolve, reject) {
1501
+ entry.file(function (file) {
1502
+ var fwp = toFileWithPath(file, entry.fullPath);
1503
+ resolve(fwp);
1504
+ }, function (err) {
1505
+ reject(err);
1506
+ });
1507
+ })];
1508
+ });
1509
+ });
1510
+ }
1511
+
1512
+ var _default = function (file, acceptedFiles) {
1513
+ if (file && acceptedFiles) {
1514
+ var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
1515
+ var fileName = file.name || '';
1516
+ var mimeType = (file.type || '').toLowerCase();
1517
+ var baseMimeType = mimeType.replace(/\/.*$/, '');
1518
+ return acceptedFilesArray.some(function (type) {
1519
+ var validType = type.trim().toLowerCase();
1520
+
1521
+ if (validType.charAt(0) === '.') {
1522
+ return fileName.toLowerCase().endsWith(validType);
1523
+ } else if (validType.endsWith('/*')) {
1524
+ // This is something like a image/* mime type
1525
+ return baseMimeType === validType.replace(/\/.*$/, '');
1526
+ }
1527
+
1528
+ return mimeType === validType;
1529
+ });
1530
+ }
1531
+
1532
+ return true;
1533
+ };
1534
+
1535
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1536
+
1537
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1538
+
1539
+ function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1540
+
1541
+ function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
1542
+
1543
+ function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1544
+
1545
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
1546
+
1547
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1548
+
1549
+ function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1550
+
1551
+ function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
1552
+
1553
+ var FILE_INVALID_TYPE = 'file-invalid-type';
1554
+ var FILE_TOO_LARGE = 'file-too-large';
1555
+ var FILE_TOO_SMALL = 'file-too-small';
1556
+ var TOO_MANY_FILES = 'too-many-files';
1557
+
1558
+ var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
1559
+ accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
1560
+ var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(', ')) : accept;
1561
+ return {
1562
+ code: FILE_INVALID_TYPE,
1563
+ message: "File type must be ".concat(messageSuffix)
1564
+ };
1565
+ };
1566
+ var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
1567
+ return {
1568
+ code: FILE_TOO_LARGE,
1569
+ message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? 'byte' : 'bytes')
1570
+ };
1571
+ };
1572
+ var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
1573
+ return {
1574
+ code: FILE_TOO_SMALL,
1575
+ message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? 'byte' : 'bytes')
1576
+ };
1577
+ };
1578
+ var TOO_MANY_FILES_REJECTION = {
1579
+ code: TOO_MANY_FILES,
1580
+ message: 'Too many files'
1581
+ }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
1582
+ // that MIME type will always be accepted
1583
+
1584
+ function fileAccepted(file, accept) {
1585
+ var isAcceptable = file.type === 'application/x-moz-file' || _default(file, accept);
1586
+ return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
1587
+ }
1588
+ function fileMatchSize(file, minSize, maxSize) {
1589
+ if (isDefined(file.size)) {
1590
+ if (isDefined(minSize) && isDefined(maxSize)) {
1591
+ if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
1592
+ if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
1593
+ } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
1594
+ }
1595
+
1596
+ return [true, null];
1597
+ }
1598
+
1599
+ function isDefined(value) {
1600
+ return value !== undefined && value !== null;
1601
+ }
1602
+
1603
+ function allFilesAccepted(_ref) {
1604
+ var files = _ref.files,
1605
+ accept = _ref.accept,
1606
+ minSize = _ref.minSize,
1607
+ maxSize = _ref.maxSize,
1608
+ multiple = _ref.multiple,
1609
+ maxFiles = _ref.maxFiles;
1610
+
1611
+ if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
1612
+ return false;
1613
+ }
1614
+
1615
+ return files.every(function (file) {
1616
+ var _fileAccepted = fileAccepted(file, accept),
1617
+ _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
1618
+ accepted = _fileAccepted2[0];
1619
+
1620
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
1621
+ _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
1622
+ sizeMatch = _fileMatchSize2[0];
1623
+
1624
+ return accepted && sizeMatch;
1625
+ });
1626
+ } // React's synthetic events has event.isPropagationStopped,
1627
+ // but to remain compatibility with other libs (Preact) fall back
1628
+ // to check event.cancelBubble
1629
+
1630
+ function isPropagationStopped(event) {
1631
+ if (typeof event.isPropagationStopped === 'function') {
1632
+ return event.isPropagationStopped();
1633
+ } else if (typeof event.cancelBubble !== 'undefined') {
1634
+ return event.cancelBubble;
1635
+ }
1636
+
1637
+ return false;
1638
+ }
1639
+ function isEvtWithFiles(event) {
1640
+ if (!event.dataTransfer) {
1641
+ return !!event.target && !!event.target.files;
1642
+ } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
1643
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
1644
+
1645
+
1646
+ return Array.prototype.some.call(event.dataTransfer.types, function (type) {
1647
+ return type === 'Files' || type === 'application/x-moz-file';
1648
+ });
1649
+ }
1650
+
1651
+ function onDocumentDragOver(event) {
1652
+ event.preventDefault();
1653
+ }
1654
+
1655
+ function isIe(userAgent) {
1656
+ return userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1;
1657
+ }
1658
+
1659
+ function isEdge(userAgent) {
1660
+ return userAgent.indexOf('Edge/') !== -1;
1661
+ }
1662
+
1663
+ function isIeOrEdge() {
1664
+ var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
1665
+ return isIe(userAgent) || isEdge(userAgent);
1666
+ }
1667
+ /**
1668
+ * This is intended to be used to compose event handlers
1669
+ * They are executed in order until one of them calls `event.isPropagationStopped()`.
1670
+ * Note that the check is done on the first invoke too,
1671
+ * meaning that if propagation was stopped before invoking the fns,
1672
+ * no handlers will be executed.
1673
+ *
1674
+ * @param {Function} fns the event hanlder functions
1675
+ * @return {Function} the event handler to add to an element
1676
+ */
1677
+
1678
+ function composeEventHandlers() {
1679
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
1680
+ fns[_key] = arguments[_key];
1681
+ }
1682
+
1683
+ return function (event) {
1684
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1685
+ args[_key2 - 1] = arguments[_key2];
1686
+ }
1687
+
1688
+ return fns.some(function (fn) {
1689
+ if (!isPropagationStopped(event) && fn) {
1690
+ fn.apply(void 0, [event].concat(args));
1691
+ }
1692
+
1693
+ return isPropagationStopped(event);
1694
+ });
1695
+ };
1696
+ }
1697
+ /**
1698
+ * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
1699
+ * is supported by the browser.
1700
+ * @returns {boolean}
1701
+ */
1702
+
1703
+ function canUseFileSystemAccessAPI() {
1704
+ return 'showOpenFilePicker' in window;
1705
+ }
1706
+ /**
1707
+ * filePickerOptionsTypes returns the {types} option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
1708
+ * based on the accept attr (see https://github.com/react-dropzone/attr-accept)
1709
+ * E.g: converts ['image/*', 'text/*'] to {'image/*': [], 'text/*': []}
1710
+ * @param {string|string[]} accept
1711
+ */
1712
+
1713
+ function filePickerOptionsTypes(accept) {
1714
+ accept = typeof accept === 'string' ? accept.split(',') : accept;
1715
+ return [{
1716
+ description: 'everything',
1717
+ // TODO: Need to handle filtering more elegantly than this!
1718
+ accept: Array.isArray(accept) // Accept just MIME types as per spec
1719
+ // NOTE: accept can be https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers
1720
+ ? accept.filter(function (item) {
1721
+ return item === 'audio/*' || item === 'video/*' || item === 'image/*' || item === 'text/*' || /\w+\/[-+.\w]+/g.test(item);
1722
+ }).reduce(function (a, b) {
1723
+ return _objectSpread$1(_objectSpread$1({}, a), {}, _defineProperty$1({}, b, []));
1724
+ }, {}) : {}
1725
+ }];
1726
+ }
1727
+
1728
+ var _excluded = ["children"],
1729
+ _excluded2 = ["open"],
1730
+ _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
1731
+ _excluded4 = ["refKey", "onChange", "onClick"];
1732
+
1733
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1734
+
1735
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1736
+
1737
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1738
+
1739
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1740
+
1741
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1742
+
1743
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1744
+
1745
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1746
+
1747
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1748
+
1749
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1750
+
1751
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1752
+
1753
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1754
+
1755
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1756
+
1757
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1758
+
1759
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1760
+
1761
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1762
+ /**
1763
+ * Convenience wrapper component for the `useDropzone` hook
1764
+ *
1765
+ * ```jsx
1766
+ * <Dropzone>
1767
+ * {({getRootProps, getInputProps}) => (
1768
+ * <div {...getRootProps()}>
1769
+ * <input {...getInputProps()} />
1770
+ * <p>Drag 'n' drop some files here, or click to select files</p>
1771
+ * </div>
1772
+ * )}
1773
+ * </Dropzone>
1774
+ * ```
1775
+ */
1776
+
1777
+ var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
1778
+ var children = _ref.children,
1779
+ params = _objectWithoutProperties(_ref, _excluded);
1780
+
1781
+ var _useDropzone = useDropzone(params),
1782
+ open = _useDropzone.open,
1783
+ props = _objectWithoutProperties(_useDropzone, _excluded2);
1784
+
1785
+ useImperativeHandle(ref, function () {
1786
+ return {
1787
+ open: open
1788
+ };
1789
+ }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
1790
+
1791
+ return /*#__PURE__*/React.createElement(Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
1792
+ open: open
1793
+ })));
1794
+ });
1795
+ Dropzone.displayName = 'Dropzone'; // Add default props for react-docgen
1796
+
1797
+ var defaultProps = {
1798
+ disabled: false,
1799
+ getFilesFromEvent: fromEvent,
1800
+ maxSize: Infinity,
1801
+ minSize: 0,
1802
+ multiple: true,
1803
+ maxFiles: 0,
1804
+ preventDropOnDocument: true,
1805
+ noClick: false,
1806
+ noKeyboard: false,
1807
+ noDrag: false,
1808
+ noDragEventsBubbling: false,
1809
+ validator: null,
1810
+ useFsAccessApi: false
1811
+ };
1812
+ Dropzone.defaultProps = defaultProps;
1813
+ Dropzone.propTypes = {
1814
+ /**
1815
+ * Render function that exposes the dropzone state and prop getter fns
1816
+ *
1817
+ * @param {object} params
1818
+ * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
1819
+ * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
1820
+ * @param {Function} params.open Open the native file selection dialog
1821
+ * @param {boolean} params.isFocused Dropzone area is in focus
1822
+ * @param {boolean} params.isFileDialogActive File dialog is opened
1823
+ * @param {boolean} params.isDragActive Active drag is in progress
1824
+ * @param {boolean} params.isDragAccept Dragged files are accepted
1825
+ * @param {boolean} params.isDragReject Some dragged files are rejected
1826
+ * @param {File[]} params.draggedFiles Files in active drag
1827
+ * @param {File[]} params.acceptedFiles Accepted files
1828
+ * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
1829
+ */
1830
+ children: PropTypes.func,
1831
+
1832
+ /**
1833
+ * Set accepted file types.
1834
+ * See https://github.com/okonet/attr-accept for more information.
1835
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
1836
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
1837
+ * Windows. In some cases there might not be a mime type set at all.
1838
+ * See: https://github.com/react-dropzone/react-dropzone/issues/276
1839
+ */
1840
+ accept: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
1841
+
1842
+ /**
1843
+ * Allow drag 'n' drop (or selection from the file dialog) of multiple files
1844
+ */
1845
+ multiple: PropTypes.bool,
1846
+
1847
+ /**
1848
+ * If false, allow dropped items to take over the current browser window
1849
+ */
1850
+ preventDropOnDocument: PropTypes.bool,
1851
+
1852
+ /**
1853
+ * If true, disables click to open the native file selection dialog
1854
+ */
1855
+ noClick: PropTypes.bool,
1856
+
1857
+ /**
1858
+ * If true, disables SPACE/ENTER to open the native file selection dialog.
1859
+ * Note that it also stops tracking the focus state.
1860
+ */
1861
+ noKeyboard: PropTypes.bool,
1862
+
1863
+ /**
1864
+ * If true, disables drag 'n' drop
1865
+ */
1866
+ noDrag: PropTypes.bool,
1867
+
1868
+ /**
1869
+ * If true, stops drag event propagation to parents
1870
+ */
1871
+ noDragEventsBubbling: PropTypes.bool,
1872
+
1873
+ /**
1874
+ * Minimum file size (in bytes)
1875
+ */
1876
+ minSize: PropTypes.number,
1877
+
1878
+ /**
1879
+ * Maximum file size (in bytes)
1880
+ */
1881
+ maxSize: PropTypes.number,
1882
+
1883
+ /**
1884
+ * Maximum accepted number of files
1885
+ * The default value is 0 which means there is no limitation to how many files are accepted.
1886
+ */
1887
+ maxFiles: PropTypes.number,
1888
+
1889
+ /**
1890
+ * Enable/disable the dropzone
1891
+ */
1892
+ disabled: PropTypes.bool,
1893
+
1894
+ /**
1895
+ * Use this to provide a custom file aggregator
1896
+ *
1897
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
1898
+ */
1899
+ getFilesFromEvent: PropTypes.func,
1900
+
1901
+ /**
1902
+ * Cb for when closing the file dialog with no selection
1903
+ */
1904
+ onFileDialogCancel: PropTypes.func,
1905
+
1906
+ /**
1907
+ * Cb for when opening the file dialog
1908
+ */
1909
+ onFileDialogOpen: PropTypes.func,
1910
+
1911
+ /**
1912
+ * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
1913
+ * to open the file picker instead of using an `<input type="file">` click event.
1914
+ */
1915
+ useFsAccessApi: PropTypes.bool,
1916
+
1917
+ /**
1918
+ * Cb for when the `dragenter` event occurs.
1919
+ *
1920
+ * @param {DragEvent} event
1921
+ */
1922
+ onDragEnter: PropTypes.func,
1923
+
1924
+ /**
1925
+ * Cb for when the `dragleave` event occurs
1926
+ *
1927
+ * @param {DragEvent} event
1928
+ */
1929
+ onDragLeave: PropTypes.func,
1930
+
1931
+ /**
1932
+ * Cb for when the `dragover` event occurs
1933
+ *
1934
+ * @param {DragEvent} event
1935
+ */
1936
+ onDragOver: PropTypes.func,
1937
+
1938
+ /**
1939
+ * Cb for when the `drop` event occurs.
1940
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
1941
+ *
1942
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
1943
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
1944
+ * If `multiple` is set to false and additional files are dropped,
1945
+ * all files besides the first will be rejected.
1946
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
1947
+ *
1948
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
1949
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
1950
+ *
1951
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
1952
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
1953
+ *
1954
+ * ```js
1955
+ * function onDrop(acceptedFiles) {
1956
+ * const req = request.post('/upload')
1957
+ * acceptedFiles.forEach(file => {
1958
+ * req.attach(file.name, file)
1959
+ * })
1960
+ * req.end(callback)
1961
+ * }
1962
+ * ```
1963
+ *
1964
+ * @param {File[]} acceptedFiles
1965
+ * @param {FileRejection[]} fileRejections
1966
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
1967
+ */
1968
+ onDrop: PropTypes.func,
1969
+
1970
+ /**
1971
+ * Cb for when the `drop` event occurs.
1972
+ * Note that if no files are accepted, this callback is not invoked.
1973
+ *
1974
+ * @param {File[]} files
1975
+ * @param {(DragEvent|Event)} event
1976
+ */
1977
+ onDropAccepted: PropTypes.func,
1978
+
1979
+ /**
1980
+ * Cb for when the `drop` event occurs.
1981
+ * Note that if no files are rejected, this callback is not invoked.
1982
+ *
1983
+ * @param {FileRejection[]} fileRejections
1984
+ * @param {(DragEvent|Event)} event
1985
+ */
1986
+ onDropRejected: PropTypes.func,
1987
+
1988
+ /**
1989
+ * Custom validation function
1990
+ * @param {File} file
1991
+ * @returns {FileError|FileError[]}
1992
+ */
1993
+ validator: PropTypes.func
1994
+ };
1995
+ /**
1996
+ * A function that is invoked for the `dragenter`,
1997
+ * `dragover` and `dragleave` events.
1998
+ * It is not invoked if the items are not files (such as link, text, etc.).
1999
+ *
2000
+ * @callback dragCb
2001
+ * @param {DragEvent} event
2002
+ */
2003
+
2004
+ /**
2005
+ * A function that is invoked for the `drop` or input change event.
2006
+ * It is not invoked if the items are not files (such as link, text, etc.).
2007
+ *
2008
+ * @callback dropCb
2009
+ * @param {File[]} acceptedFiles List of accepted files
2010
+ * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
2011
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2012
+ */
2013
+
2014
+ /**
2015
+ * A function that is invoked for the `drop` or input change event.
2016
+ * It is not invoked if the items are files (such as link, text, etc.).
2017
+ *
2018
+ * @callback dropAcceptedCb
2019
+ * @param {File[]} files List of accepted files that meet the given criteria
2020
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
2021
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2022
+ */
2023
+
2024
+ /**
2025
+ * A function that is invoked for the `drop` or input change event.
2026
+ *
2027
+ * @callback dropRejectedCb
2028
+ * @param {File[]} files List of rejected files that do not meet the given criteria
2029
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
2030
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2031
+ */
2032
+
2033
+ /**
2034
+ * A function that is used aggregate files,
2035
+ * in a asynchronous fashion, from drag or input change events.
2036
+ *
2037
+ * @callback getFilesFromEvent
2038
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2039
+ * @returns {(File[]|Promise<File[]>)}
2040
+ */
2041
+
2042
+ /**
2043
+ * An object with the current dropzone state and some helper functions.
2044
+ *
2045
+ * @typedef {object} DropzoneState
2046
+ * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
2047
+ * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
2048
+ * @property {Function} open Open the native file selection dialog
2049
+ * @property {boolean} isFocused Dropzone area is in focus
2050
+ * @property {boolean} isFileDialogActive File dialog is opened
2051
+ * @property {boolean} isDragActive Active drag is in progress
2052
+ * @property {boolean} isDragAccept Dragged files are accepted
2053
+ * @property {boolean} isDragReject Some dragged files are rejected
2054
+ * @property {File[]} draggedFiles Files in active drag
2055
+ * @property {File[]} acceptedFiles Accepted files
2056
+ * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
2057
+ */
2058
+
2059
+ var initialState = {
2060
+ isFocused: false,
2061
+ isFileDialogActive: false,
2062
+ isDragActive: false,
2063
+ isDragAccept: false,
2064
+ isDragReject: false,
2065
+ draggedFiles: [],
2066
+ acceptedFiles: [],
2067
+ fileRejections: []
2068
+ };
2069
+ /**
2070
+ * A React hook that creates a drag 'n' drop area.
2071
+ *
2072
+ * ```jsx
2073
+ * function MyDropzone(props) {
2074
+ * const {getRootProps, getInputProps} = useDropzone({
2075
+ * onDrop: acceptedFiles => {
2076
+ * // do something with the File objects, e.g. upload to some server
2077
+ * }
2078
+ * });
2079
+ * return (
2080
+ * <div {...getRootProps()}>
2081
+ * <input {...getInputProps()} />
2082
+ * <p>Drag and drop some files here, or click to select files</p>
2083
+ * </div>
2084
+ * )
2085
+ * }
2086
+ * ```
2087
+ *
2088
+ * @function useDropzone
2089
+ *
2090
+ * @param {object} props
2091
+ * @param {string|string[]} [props.accept] Set accepted file types.
2092
+ * See https://github.com/okonet/attr-accept for more information.
2093
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
2094
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
2095
+ * Windows. In some cases there might not be a mime type set at all.
2096
+ * See: https://github.com/react-dropzone/react-dropzone/issues/276
2097
+ * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
2098
+ * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
2099
+ * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
2100
+ * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
2101
+ * Note that it also stops tracking the focus state.
2102
+ * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
2103
+ * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
2104
+ * @param {number} [props.minSize=0] Minimum file size (in bytes)
2105
+ * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
2106
+ * @param {boolean} [props.disabled=false] Enable/disable the dropzone
2107
+ * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
2108
+ * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
2109
+ * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
2110
+ * to open the file picker instead of using an `<input type="file">` click event.
2111
+ * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
2112
+ * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
2113
+ * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
2114
+ * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
2115
+ * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
2116
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
2117
+ *
2118
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
2119
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
2120
+ * If `multiple` is set to false and additional files are dropped,
2121
+ * all files besides the first will be rejected.
2122
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
2123
+ *
2124
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
2125
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
2126
+ *
2127
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
2128
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
2129
+ *
2130
+ * ```js
2131
+ * function onDrop(acceptedFiles) {
2132
+ * const req = request.post('/upload')
2133
+ * acceptedFiles.forEach(file => {
2134
+ * req.attach(file.name, file)
2135
+ * })
2136
+ * req.end(callback)
2137
+ * }
2138
+ * ```
2139
+ * @param {dropAcceptedCb} [props.onDropAccepted]
2140
+ * @param {dropRejectedCb} [props.onDropRejected]
2141
+ *
2142
+ * @returns {DropzoneState}
2143
+ */
2144
+
2145
+ function useDropzone() {
2146
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2147
+
2148
+ var _defaultProps$options = _objectSpread(_objectSpread({}, defaultProps), options),
2149
+ accept = _defaultProps$options.accept,
2150
+ disabled = _defaultProps$options.disabled,
2151
+ getFilesFromEvent = _defaultProps$options.getFilesFromEvent,
2152
+ maxSize = _defaultProps$options.maxSize,
2153
+ minSize = _defaultProps$options.minSize,
2154
+ multiple = _defaultProps$options.multiple,
2155
+ maxFiles = _defaultProps$options.maxFiles,
2156
+ onDragEnter = _defaultProps$options.onDragEnter,
2157
+ onDragLeave = _defaultProps$options.onDragLeave,
2158
+ onDragOver = _defaultProps$options.onDragOver,
2159
+ onDrop = _defaultProps$options.onDrop,
2160
+ onDropAccepted = _defaultProps$options.onDropAccepted,
2161
+ onDropRejected = _defaultProps$options.onDropRejected,
2162
+ onFileDialogCancel = _defaultProps$options.onFileDialogCancel,
2163
+ onFileDialogOpen = _defaultProps$options.onFileDialogOpen,
2164
+ useFsAccessApi = _defaultProps$options.useFsAccessApi,
2165
+ preventDropOnDocument = _defaultProps$options.preventDropOnDocument,
2166
+ noClick = _defaultProps$options.noClick,
2167
+ noKeyboard = _defaultProps$options.noKeyboard,
2168
+ noDrag = _defaultProps$options.noDrag,
2169
+ noDragEventsBubbling = _defaultProps$options.noDragEventsBubbling,
2170
+ validator = _defaultProps$options.validator;
2171
+
2172
+ var onFileDialogOpenCb = useMemo(function () {
2173
+ return typeof onFileDialogOpen === 'function' ? onFileDialogOpen : noop;
2174
+ }, [onFileDialogOpen]);
2175
+ var onFileDialogCancelCb = useMemo(function () {
2176
+ return typeof onFileDialogCancel === 'function' ? onFileDialogCancel : noop;
2177
+ }, [onFileDialogCancel]);
2178
+ var rootRef = useRef(null);
2179
+ var inputRef = useRef(null);
2180
+
2181
+ var _useReducer = useReducer(reducer, initialState),
2182
+ _useReducer2 = _slicedToArray(_useReducer, 2),
2183
+ state = _useReducer2[0],
2184
+ dispatch = _useReducer2[1];
2185
+
2186
+ var isFocused = state.isFocused,
2187
+ isFileDialogActive = state.isFileDialogActive,
2188
+ draggedFiles = state.draggedFiles; // Update file dialog active state when the window is focused on
2189
+
2190
+ var onWindowFocus = function onWindowFocus() {
2191
+ // Execute the timeout only if the file dialog is opened in the browser
2192
+ if (isFileDialogActive) {
2193
+ setTimeout(function () {
2194
+ if (inputRef.current) {
2195
+ var files = inputRef.current.files;
2196
+
2197
+ if (!files.length) {
2198
+ dispatch({
2199
+ type: 'closeDialog'
2200
+ });
2201
+ onFileDialogCancelCb();
2202
+ }
2203
+ }
2204
+ }, 300);
2205
+ }
2206
+ };
2207
+
2208
+ useEffect(function () {
2209
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
2210
+ return function () {};
2211
+ }
2212
+
2213
+ window.addEventListener('focus', onWindowFocus, false);
2214
+ return function () {
2215
+ window.removeEventListener('focus', onWindowFocus, false);
2216
+ };
2217
+ }, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]);
2218
+ var dragTargetsRef = useRef([]);
2219
+
2220
+ var onDocumentDrop = function onDocumentDrop(event) {
2221
+ if (rootRef.current && rootRef.current.contains(event.target)) {
2222
+ // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
2223
+ return;
2224
+ }
2225
+
2226
+ event.preventDefault();
2227
+ dragTargetsRef.current = [];
2228
+ };
2229
+
2230
+ useEffect(function () {
2231
+ if (preventDropOnDocument) {
2232
+ document.addEventListener('dragover', onDocumentDragOver, false);
2233
+ document.addEventListener('drop', onDocumentDrop, false);
2234
+ }
2235
+
2236
+ return function () {
2237
+ if (preventDropOnDocument) {
2238
+ document.removeEventListener('dragover', onDocumentDragOver);
2239
+ document.removeEventListener('drop', onDocumentDrop);
2240
+ }
2241
+ };
2242
+ }, [rootRef, preventDropOnDocument]);
2243
+ var onDragEnterCb = useCallback(function (event) {
2244
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
2245
+
2246
+ event.persist();
2247
+ stopPropagation(event);
2248
+ dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
2249
+
2250
+ if (isEvtWithFiles(event)) {
2251
+ Promise.resolve(getFilesFromEvent(event)).then(function (draggedFiles) {
2252
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
2253
+ return;
2254
+ }
2255
+
2256
+ dispatch({
2257
+ draggedFiles: draggedFiles,
2258
+ isDragActive: true,
2259
+ type: 'setDraggedFiles'
2260
+ });
2261
+
2262
+ if (onDragEnter) {
2263
+ onDragEnter(event);
2264
+ }
2265
+ });
2266
+ }
2267
+ }, [getFilesFromEvent, onDragEnter, noDragEventsBubbling]);
2268
+ var onDragOverCb = useCallback(function (event) {
2269
+ event.preventDefault();
2270
+ event.persist();
2271
+ stopPropagation(event);
2272
+ var hasFiles = isEvtWithFiles(event);
2273
+
2274
+ if (hasFiles && event.dataTransfer) {
2275
+ try {
2276
+ event.dataTransfer.dropEffect = 'copy';
2277
+ } catch (_unused) {}
2278
+ /* eslint-disable-line no-empty */
2279
+
2280
+ }
2281
+
2282
+ if (hasFiles && onDragOver) {
2283
+ onDragOver(event);
2284
+ }
2285
+
2286
+ return false;
2287
+ }, [onDragOver, noDragEventsBubbling]);
2288
+ var onDragLeaveCb = useCallback(function (event) {
2289
+ event.preventDefault();
2290
+ event.persist();
2291
+ stopPropagation(event); // Only deactivate once the dropzone and all children have been left
2292
+
2293
+ var targets = dragTargetsRef.current.filter(function (target) {
2294
+ return rootRef.current && rootRef.current.contains(target);
2295
+ }); // Make sure to remove a target present multiple times only once
2296
+ // (Firefox may fire dragenter/dragleave multiple times on the same element)
2297
+
2298
+ var targetIdx = targets.indexOf(event.target);
2299
+
2300
+ if (targetIdx !== -1) {
2301
+ targets.splice(targetIdx, 1);
2302
+ }
2303
+
2304
+ dragTargetsRef.current = targets;
2305
+
2306
+ if (targets.length > 0) {
2307
+ return;
2308
+ }
2309
+
2310
+ dispatch({
2311
+ isDragActive: false,
2312
+ type: 'setDraggedFiles',
2313
+ draggedFiles: []
2314
+ });
2315
+
2316
+ if (isEvtWithFiles(event) && onDragLeave) {
2317
+ onDragLeave(event);
2318
+ }
2319
+ }, [rootRef, onDragLeave, noDragEventsBubbling]);
2320
+ var setFiles = useCallback(function (files, event) {
2321
+ var acceptedFiles = [];
2322
+ var fileRejections = [];
2323
+ files.forEach(function (file) {
2324
+ var _fileAccepted = fileAccepted(file, accept),
2325
+ _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
2326
+ accepted = _fileAccepted2[0],
2327
+ acceptError = _fileAccepted2[1];
2328
+
2329
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
2330
+ _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
2331
+ sizeMatch = _fileMatchSize2[0],
2332
+ sizeError = _fileMatchSize2[1];
2333
+
2334
+ var customErrors = validator ? validator(file) : null;
2335
+
2336
+ if (accepted && sizeMatch && !customErrors) {
2337
+ acceptedFiles.push(file);
2338
+ } else {
2339
+ var errors = [acceptError, sizeError];
2340
+
2341
+ if (customErrors) {
2342
+ errors = errors.concat(customErrors);
2343
+ }
2344
+
2345
+ fileRejections.push({
2346
+ file: file,
2347
+ errors: errors.filter(function (e) {
2348
+ return e;
2349
+ })
2350
+ });
2351
+ }
2352
+ });
2353
+
2354
+ if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
2355
+ // Reject everything and empty accepted files
2356
+ acceptedFiles.forEach(function (file) {
2357
+ fileRejections.push({
2358
+ file: file,
2359
+ errors: [TOO_MANY_FILES_REJECTION]
2360
+ });
2361
+ });
2362
+ acceptedFiles.splice(0);
2363
+ }
2364
+
2365
+ dispatch({
2366
+ acceptedFiles: acceptedFiles,
2367
+ fileRejections: fileRejections,
2368
+ type: 'setFiles'
2369
+ });
2370
+
2371
+ if (onDrop) {
2372
+ onDrop(acceptedFiles, fileRejections, event);
2373
+ }
2374
+
2375
+ if (fileRejections.length > 0 && onDropRejected) {
2376
+ onDropRejected(fileRejections, event);
2377
+ }
2378
+
2379
+ if (acceptedFiles.length > 0 && onDropAccepted) {
2380
+ onDropAccepted(acceptedFiles, event);
2381
+ }
2382
+ }, [dispatch, multiple, accept, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
2383
+ var onDropCb = useCallback(function (event) {
2384
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
2385
+
2386
+ event.persist();
2387
+ stopPropagation(event);
2388
+ dragTargetsRef.current = [];
2389
+
2390
+ if (isEvtWithFiles(event)) {
2391
+ Promise.resolve(getFilesFromEvent(event)).then(function (files) {
2392
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
2393
+ return;
2394
+ }
2395
+
2396
+ setFiles(files, event);
2397
+ });
2398
+ }
2399
+
2400
+ dispatch({
2401
+ type: 'reset'
2402
+ });
2403
+ }, [getFilesFromEvent, setFiles, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
2404
+
2405
+ var openFileDialog = useCallback(function () {
2406
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
2407
+ dispatch({
2408
+ type: 'openDialog'
2409
+ });
2410
+ onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
2411
+
2412
+ var opts = {
2413
+ multiple: multiple,
2414
+ types: filePickerOptionsTypes(accept)
2415
+ };
2416
+ window.showOpenFilePicker(opts).then(function (handles) {
2417
+ return getFilesFromEvent(handles);
2418
+ }).then(function (files) {
2419
+ return setFiles(files, null);
2420
+ }).catch(function (e) {
2421
+ return onFileDialogCancelCb(e);
2422
+ }).finally(function () {
2423
+ return dispatch({
2424
+ type: 'closeDialog'
2425
+ });
2426
+ });
2427
+ return;
2428
+ }
2429
+
2430
+ if (inputRef.current) {
2431
+ dispatch({
2432
+ type: 'openDialog'
2433
+ });
2434
+ onFileDialogOpenCb();
2435
+ inputRef.current.value = null;
2436
+ inputRef.current.click();
2437
+ }
2438
+ }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
2439
+
2440
+ var onKeyDownCb = useCallback(function (event) {
2441
+ // Ignore keyboard events bubbling up the DOM tree
2442
+ if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
2443
+ return;
2444
+ }
2445
+
2446
+ if (event.keyCode === 32 || event.keyCode === 13) {
2447
+ event.preventDefault();
2448
+ openFileDialog();
2449
+ }
2450
+ }, [rootRef, inputRef, openFileDialog]); // Update focus state for the dropzone
2451
+
2452
+ var onFocusCb = useCallback(function () {
2453
+ dispatch({
2454
+ type: 'focus'
2455
+ });
2456
+ }, []);
2457
+ var onBlurCb = useCallback(function () {
2458
+ dispatch({
2459
+ type: 'blur'
2460
+ });
2461
+ }, []); // Cb to open the file dialog when click occurs on the dropzone
2462
+
2463
+ var onClickCb = useCallback(function () {
2464
+ if (noClick) {
2465
+ return;
2466
+ } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
2467
+ // to ensure React can handle state changes
2468
+ // See: https://github.com/react-dropzone/react-dropzone/issues/450
2469
+
2470
+
2471
+ if (isIeOrEdge()) {
2472
+ setTimeout(openFileDialog, 0);
2473
+ } else {
2474
+ openFileDialog();
2475
+ }
2476
+ }, [inputRef, noClick, openFileDialog]);
2477
+
2478
+ var composeHandler = function composeHandler(fn) {
2479
+ return disabled ? null : fn;
2480
+ };
2481
+
2482
+ var composeKeyboardHandler = function composeKeyboardHandler(fn) {
2483
+ return noKeyboard ? null : composeHandler(fn);
2484
+ };
2485
+
2486
+ var composeDragHandler = function composeDragHandler(fn) {
2487
+ return noDrag ? null : composeHandler(fn);
2488
+ };
2489
+
2490
+ var stopPropagation = function stopPropagation(event) {
2491
+ if (noDragEventsBubbling) {
2492
+ event.stopPropagation();
2493
+ }
2494
+ };
2495
+
2496
+ var getRootProps = useMemo(function () {
2497
+ return function () {
2498
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2499
+ _ref2$refKey = _ref2.refKey,
2500
+ refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
2501
+ role = _ref2.role,
2502
+ onKeyDown = _ref2.onKeyDown,
2503
+ onFocus = _ref2.onFocus,
2504
+ onBlur = _ref2.onBlur,
2505
+ onClick = _ref2.onClick,
2506
+ onDragEnter = _ref2.onDragEnter,
2507
+ onDragOver = _ref2.onDragOver,
2508
+ onDragLeave = _ref2.onDragLeave,
2509
+ onDrop = _ref2.onDrop,
2510
+ rest = _objectWithoutProperties(_ref2, _excluded3);
2511
+
2512
+ return _objectSpread(_objectSpread(_defineProperty({
2513
+ onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
2514
+ onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
2515
+ onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
2516
+ onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
2517
+ onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
2518
+ onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
2519
+ onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
2520
+ onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
2521
+ role: typeof role === 'string' && role !== '' ? role : 'button'
2522
+ }, refKey, rootRef), !disabled && !noKeyboard ? {
2523
+ tabIndex: 0
2524
+ } : {}), rest);
2525
+ };
2526
+ }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
2527
+ var onInputElementClick = useCallback(function (event) {
2528
+ event.stopPropagation();
2529
+ }, []);
2530
+ var getInputProps = useMemo(function () {
2531
+ return function () {
2532
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2533
+ _ref3$refKey = _ref3.refKey,
2534
+ refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2535
+ onChange = _ref3.onChange,
2536
+ onClick = _ref3.onClick,
2537
+ rest = _objectWithoutProperties(_ref3, _excluded4);
2538
+
2539
+ var inputProps = _defineProperty({
2540
+ accept: accept,
2541
+ multiple: multiple,
2542
+ type: 'file',
2543
+ style: {
2544
+ display: 'none'
2545
+ },
2546
+ onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
2547
+ onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
2548
+ autoComplete: 'off',
2549
+ tabIndex: -1
2550
+ }, refKey, inputRef);
2551
+
2552
+ return _objectSpread(_objectSpread({}, inputProps), rest);
2553
+ };
2554
+ }, [inputRef, accept, multiple, onDropCb, disabled]);
2555
+ var fileCount = draggedFiles.length;
2556
+ var isDragAccept = fileCount > 0 && allFilesAccepted({
2557
+ files: draggedFiles,
2558
+ accept: accept,
2559
+ minSize: minSize,
2560
+ maxSize: maxSize,
2561
+ multiple: multiple,
2562
+ maxFiles: maxFiles
2563
+ });
2564
+ var isDragReject = fileCount > 0 && !isDragAccept;
2565
+ return _objectSpread(_objectSpread({}, state), {}, {
2566
+ isDragAccept: isDragAccept,
2567
+ isDragReject: isDragReject,
2568
+ isFocused: isFocused && !disabled,
2569
+ getRootProps: getRootProps,
2570
+ getInputProps: getInputProps,
2571
+ rootRef: rootRef,
2572
+ inputRef: inputRef,
2573
+ open: composeHandler(openFileDialog)
2574
+ });
2575
+ }
2576
+
2577
+ function reducer(state, action) {
2578
+ /* istanbul ignore next */
2579
+ switch (action.type) {
2580
+ case 'focus':
2581
+ return _objectSpread(_objectSpread({}, state), {}, {
2582
+ isFocused: true
2583
+ });
2584
+
2585
+ case 'blur':
2586
+ return _objectSpread(_objectSpread({}, state), {}, {
2587
+ isFocused: false
2588
+ });
2589
+
2590
+ case 'openDialog':
2591
+ return _objectSpread(_objectSpread({}, initialState), {}, {
2592
+ isFileDialogActive: true
2593
+ });
2594
+
2595
+ case 'closeDialog':
2596
+ return _objectSpread(_objectSpread({}, state), {}, {
2597
+ isFileDialogActive: false
2598
+ });
2599
+
2600
+ case 'setDraggedFiles':
2601
+ /* eslint no-case-declarations: 0 */
2602
+ var isDragActive = action.isDragActive,
2603
+ draggedFiles = action.draggedFiles;
2604
+ return _objectSpread(_objectSpread({}, state), {}, {
2605
+ draggedFiles: draggedFiles,
2606
+ isDragActive: isDragActive
2607
+ });
2608
+
2609
+ case 'setFiles':
2610
+ return _objectSpread(_objectSpread({}, state), {}, {
2611
+ acceptedFiles: action.acceptedFiles,
2612
+ fileRejections: action.fileRejections
2613
+ });
2614
+
2615
+ case 'reset':
2616
+ return _objectSpread({}, initialState);
2617
+
2618
+ default:
2619
+ return state;
2620
+ }
2621
+ }
2622
+
2623
+ function noop() {}
2624
+
2625
+ var css_248z = ".grljXfTWj84- {\n font-size: 0;\n line-height: 0;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n cursor: pointer;\n}\n\n.grljXfTWj84-:focus,\n.grljXfTWj84-:focus-within {\n border-color: var(--color-focus);\n outline: none;\n}\n\n.WHhHWgaoXk4- {\n padding: var(--space-base);\n border: var(--color-border) dashed var(--border-thick);\n border-radius: var(--radius-larger);\n text-align: center;\n}\n\n.WHhHWgaoXk4-.n1h-T2metRA- {\n border-color: var(--color-focus);\n background-color: var(--color-surface--hover);\n}\n\n.WHhHWgaoXk4-.MRRclAp51-w- {\n border-color: var(--color-critical);\n}\n\n.TIbSRNvDK10- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n";
2626
+ var styles = {"dropZoneBase":"grljXfTWj84-","dropZone":"WHhHWgaoXk4-","active":"n1h-T2metRA-","error":"MRRclAp51-w-","validationErrors":"TIbSRNvDK10-"};
2627
+ styleInject(css_248z);
2628
+
2629
+ function InputFile({ variation = "dropzone", size = "base", buttonLabel: providedButtonLabel, allowMultiple = false, allowedTypes = "all", getUploadParams, onUploadStart, onUploadProgress, onUploadComplete, onUploadError, validator, }) {
2630
+ const options = {
2631
+ multiple: allowMultiple,
2632
+ onDrop: useCallback(handleDrop, [uploadFile]),
2633
+ validator: validator && useCallback(validator, []),
2634
+ };
2635
+ if (allowedTypes === "images") {
2636
+ options.accept = "image/*";
2637
+ }
2638
+ else if (allowedTypes === "basicImages") {
2639
+ options.accept = "image/png, image/jpg, image/jpeg";
2640
+ }
2641
+ else if (Array.isArray(allowedTypes)) {
2642
+ options.accept = allowedTypes.join(",");
2643
+ }
2644
+ const { getRootProps, getInputProps, isDragActive, fileRejections } = useDropzone(options);
2645
+ const validationErrors = fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.map(({ file, errors }) => {
2646
+ return errors.map(error => {
2647
+ return (React.createElement(InputValidation, { message: `${file.name} ${error.message}`, key: `${file.name}${error.code}` }));
2648
+ });
2649
+ });
2650
+ const { buttonLabel, hintText } = getLabels(providedButtonLabel, allowMultiple, allowedTypes);
2651
+ const dropZone = classnames(styles.dropZoneBase, {
2652
+ [styles.dropZone]: variation === "dropzone",
2653
+ [styles.active]: isDragActive,
2654
+ [styles.error]: (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0,
2655
+ });
2656
+ return (React.createElement(React.Fragment, null,
2657
+ React.createElement("div", Object.assign({}, getRootProps({ className: dropZone }), { tabIndex: variation === "button" ? -1 : 0 }),
2658
+ React.createElement("input", Object.assign({}, getInputProps())),
2659
+ variation === "dropzone" && (React.createElement(Content, { spacing: "small" },
2660
+ React.createElement(Button, { label: buttonLabel, size: "small", type: "secondary" }),
2661
+ size === "base" && (React.createElement(Typography, { size: "small", textColor: "textSecondary" }, hintText)))),
2662
+ variation === "button" && (React.createElement(Button, { label: buttonLabel, size: size, type: "secondary", fullWidth: true }))),
2663
+ (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0 && (React.createElement("div", { className: styles.validationErrors }, validationErrors))));
2664
+ function handleDrop(acceptedFiles) {
2665
+ acceptedFiles.forEach(file => {
2666
+ uploadFile(file);
2667
+ });
2668
+ }
2669
+ function uploadFile(file) {
2670
+ return __awaiter(this, void 0, void 0, function* () {
2671
+ let params;
2672
+ try {
2673
+ params = yield getUploadParams(file);
2674
+ }
2675
+ catch (_a) {
2676
+ onUploadError && onUploadError(new Error("Failed to get upload params"));
2677
+ return;
2678
+ }
2679
+ const { url, key = generateId(), fields = {}, httpMethod = "POST", } = params;
2680
+ const fileUpload = getFileUpload(file, key, url);
2681
+ onUploadStart && onUploadStart(Object.assign({}, fileUpload));
2682
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2683
+ const handleUploadProgress = (progressEvent) => {
2684
+ onUploadProgress &&
2685
+ onUploadProgress(Object.assign(Object.assign({}, fileUpload), { progress: progressEvent.loaded / progressEvent.total }));
2686
+ };
2687
+ const handleUploadComplete = () => {
2688
+ onUploadComplete === null || onUploadComplete === void 0 ? void 0 : onUploadComplete(Object.assign(Object.assign({}, fileUpload), { progress: 1 }));
2689
+ };
2690
+ const axiosConfig = createAxiosConfig({
2691
+ url,
2692
+ httpMethod,
2693
+ fields,
2694
+ file,
2695
+ handleUploadProgress,
2696
+ });
2697
+ axios
2698
+ .request(axiosConfig)
2699
+ .then(handleUploadComplete)
2700
+ .catch(() => {
2701
+ onUploadError && onUploadError(new Error("Failed to upload file"));
2702
+ });
2703
+ });
2704
+ }
2705
+ }
2706
+ function createAxiosConfig({ url, httpMethod = "POST", fields = {}, file, handleUploadProgress, }) {
2707
+ let data;
2708
+ let headers;
2709
+ if (httpMethod === "POST") {
2710
+ const formData = new FormData();
2711
+ Object.entries(fields).forEach(([field, value]) => formData.append(field, value));
2712
+ formData.append("file", file);
2713
+ data = formData;
2714
+ headers = { "X-Requested-With": "XMLHttpRequest" };
2715
+ }
2716
+ else {
2717
+ data = file;
2718
+ headers = fields;
2719
+ }
2720
+ return {
2721
+ method: httpMethod,
2722
+ url: url,
2723
+ headers: headers,
2724
+ data: data,
2725
+ onUploadProgress: handleUploadProgress,
2726
+ };
2727
+ }
2728
+ function getLabels(providedButtonLabel, multiple, allowedTypes) {
2729
+ let buttonLabel = multiple ? "Upload Files" : "Upload File";
2730
+ let hintText = multiple
2731
+ ? "or drag files here to upload"
2732
+ : "or drag a file here to upload";
2733
+ if (allowedTypes === "images" || allowedTypes === "basicImages") {
2734
+ buttonLabel = multiple ? "Upload Images" : "Upload Image";
2735
+ hintText = multiple
2736
+ ? "or drag images here to upload"
2737
+ : "or drag an image here to upload";
2738
+ }
2739
+ if (providedButtonLabel)
2740
+ buttonLabel = providedButtonLabel;
2741
+ return { buttonLabel, hintText };
2742
+ }
2743
+ function getFileUpload(file, key, uploadUrl) {
2744
+ return {
2745
+ key: key,
2746
+ name: file.name,
2747
+ type: file.type,
2748
+ size: file.size,
2749
+ progress: 0,
2750
+ src: getSrc,
2751
+ uploadUrl,
2752
+ };
2753
+ function getSrc() {
2754
+ const promise = new Promise((resolve, reject) => {
2755
+ const reader = new FileReader();
2756
+ reader.onload = event => {
2757
+ if (event.target &&
2758
+ event.target.result &&
2759
+ typeof event.target.result === "string") {
2760
+ resolve(event.target.result);
2761
+ }
2762
+ else {
2763
+ reject("Could not generate file data url.");
2764
+ }
2765
+ };
2766
+ reader.readAsDataURL(file);
2767
+ });
2768
+ return promise;
2769
+ }
2770
+ }
2771
+ /**
2772
+ * Upsert a given `FileUpload` into an array of `FileUpload`s.
2773
+ * `key` is used to uniquely identify files.
2774
+ *
2775
+ * @param updatedFile FileUpload File that was updated.
2776
+ * @param files Existing array of FileUploads.
2777
+ * @returns FileUpload[] updated set of files.
2778
+ */
2779
+ function updateFiles(updatedFile, files) {
2780
+ const newFiles = [...files];
2781
+ const index = files.findIndex(file => file.key === updatedFile.key);
2782
+ if (index !== -1) {
2783
+ newFiles[index] = updatedFile;
2784
+ }
2785
+ else {
2786
+ newFiles.push(updatedFile);
2787
+ }
2788
+ return newFiles;
2789
+ }
2790
+ function generateId() {
2791
+ return Math.floor(Math.random() * Date.now()).toString(16);
2792
+ }
2793
+
2794
+ export { InputFile as I, updateFiles as u };