@mjhls/mjh-framework 1.0.861-dl-iframe-v1 → 1.0.862-beta.0

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 (249) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/AD.js +9 -10
  3. package/dist/cjs/AD300x250.js +9 -10
  4. package/dist/cjs/AD300x250x600.js +9 -10
  5. package/dist/cjs/AD728x90.js +10 -11
  6. package/dist/cjs/ADFloatingFooter.js +11 -12
  7. package/dist/cjs/ADFooter.js +8 -9
  8. package/dist/cjs/ADGutter.js +11 -12
  9. package/dist/cjs/{ADInfeed-25d48cc2.js → ADInfeed-98c71bcd.js} +9 -11
  10. package/dist/cjs/ADSkyscraper.js +11 -12
  11. package/dist/cjs/ADSponsoredResources.js +11 -12
  12. package/dist/cjs/ADWebcast.js +11 -12
  13. package/dist/cjs/ADWelcome.js +15 -16
  14. package/dist/cjs/{ADlgInfeed-a535a768.js → ADlgInfeed-9de32585.js} +6 -7
  15. package/dist/cjs/AccordionPanel.js +22 -24
  16. package/dist/cjs/AdSlot.js +13 -14
  17. package/dist/cjs/AdSlotsProvider.js +902 -11
  18. package/dist/cjs/AlgoliaSearch.js +842 -952
  19. package/dist/cjs/AlphabeticList.js +15 -16
  20. package/dist/cjs/ArticleCarousel.js +10 -11
  21. package/dist/cjs/ArticleProgramLandingPage.js +27 -28
  22. package/dist/cjs/ArticleSeriesLandingPage.js +22 -23
  23. package/dist/cjs/ArticleSeriesListing.js +39 -40
  24. package/dist/cjs/Auth.js +1197 -237
  25. package/dist/cjs/AuthWrapper.js +38 -119
  26. package/dist/cjs/{AuthorComponent-ac8972ce.js → AuthorComponent-bb831b74.js} +12 -13
  27. package/dist/cjs/{BlockContent-8b494587.js → BlockContent-091a991f.js} +24 -25
  28. package/dist/cjs/Breadcrumbs.js +21 -23
  29. package/dist/cjs/CMEDeck.js +64 -64
  30. package/dist/cjs/Column1.js +11 -14
  31. package/dist/cjs/Column2.js +19 -22
  32. package/dist/cjs/Column3.js +32 -35
  33. package/dist/cjs/ConferenceArticleCard.js +17 -18
  34. package/dist/cjs/ConferenceBanner-4a16fddc.js +23 -0
  35. package/dist/cjs/DeckContent.js +72 -76
  36. package/dist/cjs/DeckQueue.js +68 -72
  37. package/dist/cjs/{Dfp-391fd124.js → Dfp-26baccf1.js} +22 -23
  38. package/dist/cjs/EventsDeck.js +116 -123
  39. package/dist/cjs/ExternalResources.js +46 -47
  40. package/dist/cjs/Feature.js +23 -25
  41. package/dist/cjs/ForbesHero.js +34 -35
  42. package/dist/cjs/GridContent.js +203 -208
  43. package/dist/cjs/GridHero.js +35 -36
  44. package/dist/cjs/GroupDeck.js +48 -49
  45. package/dist/cjs/HamMagazine.js +116 -121
  46. package/dist/cjs/Header.js +12 -14
  47. package/dist/cjs/Hero.js +9 -10
  48. package/dist/cjs/HighlightenVideo.js +16 -17
  49. package/dist/cjs/HorizontalArticleListing.js +36 -37
  50. package/dist/cjs/HorizontalHero.js +23 -24
  51. package/dist/cjs/IssueContentDeck.js +65 -70
  52. package/dist/cjs/IssueDeck.js +60 -65
  53. package/dist/cjs/IssueLanding.js +28 -29
  54. package/dist/cjs/LeftNav.js +20 -22
  55. package/dist/cjs/MasterDeck.js +49 -50
  56. package/dist/cjs/MediaSeriesLanding.js +786 -733
  57. package/dist/cjs/NavDvm.js +63 -68
  58. package/dist/cjs/{NavFooter-3dcd99a8.js → NavFooter-76c913e3.js} +14 -15
  59. package/dist/cjs/NavMagazine.js +116 -121
  60. package/dist/cjs/NavNative.js +108 -116
  61. package/dist/cjs/OncliveHero.js +17 -17
  62. package/dist/cjs/OncliveLargeHero.js +63 -64
  63. package/dist/cjs/PageFilter.js +8 -9
  64. package/dist/cjs/PartnerDetailListing.js +3899 -80
  65. package/dist/cjs/PdfDownload.js +8 -9
  66. package/dist/cjs/PopUpModal.js +13 -15
  67. package/dist/cjs/PubSection.js +19 -20
  68. package/dist/cjs/PubToc.js +7 -8
  69. package/dist/cjs/PublicationDeck.js +59 -64
  70. package/dist/cjs/PublicationLanding.js +83 -87
  71. package/dist/cjs/QueueDeckExpanded.js +285 -285
  72. package/dist/cjs/RecentNews.js +19 -20
  73. package/dist/cjs/RelatedContent.js +22 -23
  74. package/dist/cjs/RelatedTopicsDropdown.js +19 -22
  75. package/dist/cjs/RolesDeck.js +27 -32
  76. package/dist/cjs/Search.js +12 -16
  77. package/dist/cjs/SeriesListingDeck.js +26 -26
  78. package/dist/cjs/{SeriesSlider-0d3bf265.js → SeriesSlider-8bbc989f.js} +33 -34
  79. package/dist/cjs/SideFooter.js +23 -24
  80. package/dist/cjs/SocialIcons.js +9 -10
  81. package/dist/cjs/{SocialSearchComponent-19548e2a.js → SocialSearchComponent-cea213aa.js} +34 -38
  82. package/dist/cjs/SocialShare.js +29 -31
  83. package/dist/cjs/TaxonomyCard.js +54 -59
  84. package/dist/cjs/TaxonomyDescription.js +21 -22
  85. package/dist/cjs/TemplateNormal.js +34 -35
  86. package/dist/cjs/ThumbnailCard.js +17 -19
  87. package/dist/cjs/Ustream.js +21 -22
  88. package/dist/cjs/VerticalHero.js +15 -16
  89. package/dist/cjs/VideoProgramLandingPage.js +43 -47
  90. package/dist/cjs/VideoSeriesCard.js +22 -23
  91. package/dist/cjs/VideoSeriesFilter.js +9 -9
  92. package/dist/cjs/VideoSeriesLandingPage.js +27 -28
  93. package/dist/cjs/VideoSeriesListing.js +56 -57
  94. package/dist/cjs/View.js +200 -204
  95. package/dist/cjs/YahooHero.js +30 -31
  96. package/dist/cjs/YoutubeGroup.js +50 -51
  97. package/dist/cjs/{brightcove-react-player-loader.es-5c98aec7.js → brightcove-react-player-loader.es-156bd4d6.js} +8 -10
  98. package/dist/cjs/faundadb.js +16 -16
  99. package/dist/cjs/getRelatedArticle.js +131 -67
  100. package/dist/cjs/getRootDocGroup.js +3 -3
  101. package/dist/cjs/getSerializers.js +11 -11
  102. package/dist/cjs/{getTargeting-a9a871f0.js → getTargeting-f1821260.js} +2 -2
  103. package/dist/cjs/getTargeting.js +1 -1
  104. package/dist/cjs/iconBase-68959171.js +3 -0
  105. package/dist/cjs/{index-6367b7bf.js → index-3294d3bc.js} +17 -16
  106. package/dist/cjs/{index-9d365128.js → index-96b3db50.js} +10 -12
  107. package/dist/cjs/{index-2cf30c83.js → index-98e01cb9.js} +8 -9
  108. package/dist/cjs/{index-f83a102a.js → index-a1e54356.js} +934 -965
  109. package/dist/cjs/{index-b5eb3ff8.js → index-be0c82be.js} +19 -20
  110. package/dist/cjs/{index.es-f3e47207.js → index.es-9110add6.js} +12 -31
  111. package/dist/cjs/{index.esm-3ffa049c.js → index.esm-4d410430.js} +20 -20
  112. package/dist/cjs/{index.esm-974f47d9.js → index.esm-90433435.js} +15 -6
  113. package/dist/cjs/{index.esm-44f3e2d0.js → index.esm-e32d3e8e.js} +6 -3
  114. package/dist/cjs/{index.esm-05850a2f.js → index.esm-ff47db6f.js} +12 -5
  115. package/dist/cjs/index.js +58 -63
  116. package/dist/cjs/{inherits-0c7830c5.js → inherits-1f5a1c72.js} +3 -3
  117. package/dist/cjs/inherits-8d29278d.js +110 -0
  118. package/dist/cjs/{lodash-7fd85bcf.js → lodash-fc2922d0.js} +22 -71
  119. package/dist/cjs/{main-7b5e57b0.js → main-02daeefe.js} +54 -90
  120. package/dist/cjs/{md5-e1ca5797.js → md5-5039b1a6.js} +1 -1
  121. package/dist/cjs/{moment-ca3bd9fb.js → moment-575fe24c.js} +8 -10
  122. package/dist/cjs/{react-social-icons-07939b41.js → react-social-icons-f7f48f71.js} +11 -12
  123. package/dist/cjs/timeDifferenceCalc.js +1 -1
  124. package/dist/cjs/{typeof-9d7f610f.js → typeof-725500bc.js} +1 -1
  125. package/dist/cjs/urlFor.js +3 -3
  126. package/dist/cjs/{visibility-sensor-eb2c5b69.js → visibility-sensor-ad5e3116.js} +5 -7
  127. package/dist/esm/AD.js +7 -7
  128. package/dist/esm/AD300x250.js +7 -7
  129. package/dist/esm/AD300x250x600.js +7 -7
  130. package/dist/esm/AD728x90.js +8 -8
  131. package/dist/esm/ADFloatingFooter.js +9 -9
  132. package/dist/esm/ADFooter.js +6 -6
  133. package/dist/esm/ADGutter.js +9 -9
  134. package/dist/esm/{ADInfeed-56a3db8b.js → ADInfeed-1cc9d817.js} +7 -7
  135. package/dist/esm/ADSkyscraper.js +9 -9
  136. package/dist/esm/ADSponsoredResources.js +9 -9
  137. package/dist/esm/ADWebcast.js +9 -9
  138. package/dist/esm/ADWelcome.js +13 -13
  139. package/dist/esm/{ADlgInfeed-53edb995.js → ADlgInfeed-8c4f129e.js} +4 -4
  140. package/dist/esm/AccordionPanel.js +17 -17
  141. package/dist/esm/AdSlot.js +5 -5
  142. package/dist/esm/AdSlotsProvider.js +902 -10
  143. package/dist/esm/AlgoliaSearch.js +238 -347
  144. package/dist/esm/AlphabeticList.js +13 -13
  145. package/dist/esm/ArticleCarousel.js +8 -8
  146. package/dist/esm/ArticleProgramLandingPage.js +20 -20
  147. package/dist/esm/ArticleSeriesLandingPage.js +17 -17
  148. package/dist/esm/ArticleSeriesListing.js +36 -36
  149. package/dist/esm/Auth.js +1180 -216
  150. package/dist/esm/AuthWrapper.js +36 -116
  151. package/dist/esm/{AuthorComponent-8ffd4679.js → AuthorComponent-34b16174.js} +10 -10
  152. package/dist/esm/{BlockContent-d05b5b23.js → BlockContent-e9b4ddcf.js} +4 -4
  153. package/dist/esm/Breadcrumbs.js +11 -11
  154. package/dist/esm/CMEDeck.js +61 -61
  155. package/dist/esm/Column1.js +9 -9
  156. package/dist/esm/Column2.js +17 -17
  157. package/dist/esm/Column3.js +30 -30
  158. package/dist/esm/ConferenceArticleCard.js +15 -15
  159. package/dist/esm/{ConferenceBanner-9162d0ca.js → ConferenceBanner-8792ebd2.js} +4 -4
  160. package/dist/esm/DeckContent.js +68 -68
  161. package/dist/esm/DeckQueue.js +64 -64
  162. package/dist/esm/{Dfp-2f9796e1.js → Dfp-b7236041.js} +10 -10
  163. package/dist/esm/EventsDeck.js +92 -92
  164. package/dist/esm/ExternalResources.js +41 -41
  165. package/dist/esm/Feature.js +17 -17
  166. package/dist/esm/ForbesHero.js +28 -28
  167. package/dist/esm/GridContent.js +172 -172
  168. package/dist/esm/GridHero.js +29 -29
  169. package/dist/esm/GroupDeck.js +36 -36
  170. package/dist/esm/HamMagazine.js +91 -91
  171. package/dist/esm/Header.js +8 -8
  172. package/dist/esm/Hero.js +7 -7
  173. package/dist/esm/HighlightenVideo.js +14 -14
  174. package/dist/esm/HorizontalArticleListing.js +34 -34
  175. package/dist/esm/HorizontalHero.js +21 -21
  176. package/dist/esm/IssueContentDeck.js +53 -53
  177. package/dist/esm/IssueDeck.js +54 -54
  178. package/dist/esm/IssueLanding.js +26 -26
  179. package/dist/esm/LeftNav.js +16 -16
  180. package/dist/esm/MasterDeck.js +46 -46
  181. package/dist/esm/MediaSeriesLanding.js +506 -450
  182. package/dist/esm/NavDvm.js +46 -46
  183. package/dist/esm/{NavFooter-c29526b7.js → NavFooter-e27bd93b.js} +12 -12
  184. package/dist/esm/NavMagazine.js +93 -93
  185. package/dist/esm/NavNative.js +83 -83
  186. package/dist/esm/OncliveHero.js +15 -14
  187. package/dist/esm/OncliveLargeHero.js +52 -52
  188. package/dist/esm/PageFilter.js +6 -6
  189. package/dist/esm/PartnerDetailListing.js +3895 -76
  190. package/dist/esm/PdfDownload.js +6 -6
  191. package/dist/esm/PopUpModal.js +8 -8
  192. package/dist/esm/PubSection.js +17 -17
  193. package/dist/esm/PubToc.js +5 -5
  194. package/dist/esm/PublicationDeck.js +51 -51
  195. package/dist/esm/PublicationLanding.js +69 -69
  196. package/dist/esm/QueueDeckExpanded.js +251 -251
  197. package/dist/esm/RecentNews.js +17 -17
  198. package/dist/esm/RelatedContent.js +17 -17
  199. package/dist/esm/RelatedTopicsDropdown.js +11 -11
  200. package/dist/esm/RolesDeck.js +25 -25
  201. package/dist/esm/Search.js +7 -7
  202. package/dist/esm/SeriesListingDeck.js +20 -20
  203. package/dist/esm/{SeriesSlider-7d89f4d9.js → SeriesSlider-a866bb21.js} +24 -24
  204. package/dist/esm/SideFooter.js +19 -19
  205. package/dist/esm/SocialIcons.js +7 -7
  206. package/dist/esm/{SocialSearchComponent-47815365.js → SocialSearchComponent-03c3e869.js} +28 -28
  207. package/dist/esm/SocialShare.js +25 -25
  208. package/dist/esm/TaxonomyCard.js +50 -50
  209. package/dist/esm/TaxonomyDescription.js +16 -16
  210. package/dist/esm/TemplateNormal.js +31 -31
  211. package/dist/esm/ThumbnailCard.js +10 -10
  212. package/dist/esm/Ustream.js +18 -18
  213. package/dist/esm/VerticalHero.js +13 -13
  214. package/dist/esm/VideoProgramLandingPage.js +32 -32
  215. package/dist/esm/VideoSeriesCard.js +17 -17
  216. package/dist/esm/VideoSeriesFilter.js +6 -6
  217. package/dist/esm/VideoSeriesLandingPage.js +17 -17
  218. package/dist/esm/VideoSeriesListing.js +53 -53
  219. package/dist/esm/View.js +181 -181
  220. package/dist/esm/YahooHero.js +25 -25
  221. package/dist/esm/YoutubeGroup.js +35 -35
  222. package/dist/esm/{brightcove-react-player-loader.es-4abff0b1.js → brightcove-react-player-loader.es-83f53e4e.js} +6 -7
  223. package/dist/esm/faundadb.js +1 -1
  224. package/dist/esm/getRelatedArticle.js +126 -62
  225. package/dist/esm/getSerializers.js +11 -11
  226. package/dist/esm/{index-f7fb1e25.js → index-41a678ea.js} +3 -3
  227. package/dist/esm/{index-6c12bdd5.js → index-5f7e79e7.js} +4 -4
  228. package/dist/esm/{index-51a80699.js → index-73819142.js} +19 -20
  229. package/dist/esm/{index-82fea143.js → index-a1c5f00a.js} +887 -908
  230. package/dist/esm/{index-c00b0bbb.js → index-ef6d5dcf.js} +17 -16
  231. package/dist/esm/{index.es-c6222053.js → index.es-29c1cef5.js} +10 -28
  232. package/dist/esm/{index.esm-3fdda599.js → index.esm-29e48d38.js} +15 -6
  233. package/dist/esm/{index.esm-a8ff922c.js → index.esm-cf08bf18.js} +12 -5
  234. package/dist/esm/{index.esm-c6715e80.js → index.esm-f8aaeeeb.js} +6 -3
  235. package/dist/esm/{index.esm-8ee5ff72.js → index.esm-fd746768.js} +18 -17
  236. package/dist/esm/index.js +49 -51
  237. package/dist/esm/inherits-77d5e4fc.js +101 -0
  238. package/dist/esm/{inherits-75d45541.js → inherits-cf8dde54.js} +1 -1
  239. package/dist/esm/{lodash-ec8c6b48.js → lodash-17fdfebb.js} +22 -71
  240. package/dist/esm/{main-747e7d25.js → main-e4a934b2.js} +52 -87
  241. package/dist/esm/{md5-4e42248e.js → md5-9be0e905.js} +1 -1
  242. package/dist/esm/{moment-b6f49411.js → moment-e2f9b20c.js} +8 -10
  243. package/dist/esm/{react-social-icons-3822f1ce.js → react-social-icons-a7d5c5c7.js} +5 -5
  244. package/dist/esm/timeDifferenceCalc.js +1 -1
  245. package/dist/esm/{typeof-af9c50d8.js → typeof-6435ba1c.js} +1 -1
  246. package/dist/esm/urlFor.js +1 -1
  247. package/dist/esm/{visibility-sensor-f40c2564.js → visibility-sensor-72fd8f8b.js} +2 -2
  248. package/package.json +2 -1
  249. package/dist/cjs/ConferenceBanner-6c9e718a.js +0 -24
package/dist/esm/Auth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as commonjsGlobal, c as createCommonjsModule } from './_commonjsHelpers-0c4b6f40.js';
1
+ import { a as commonjsGlobal } from './_commonjsHelpers-0c4b6f40.js';
2
2
  import './_to-object-a4107da3.js';
3
3
  import './es6.string.iterator-c990c18c.js';
4
4
  import './_library-528f1934.js';
@@ -7,7 +7,7 @@ import './core.get-iterator-method-e1de7503.js';
7
7
  import './_object-pie-33c40e79.js';
8
8
  import { _ as _extends } from './extends-6f2fcc99.js';
9
9
  import './web.dom.iterable-4439f05a.js';
10
- import React, { useEffect, useState } from 'react';
10
+ import React__default, { useEffect, useLayoutEffect, createContext, useContext, useRef, useDebugValue, useState, useCallback, useMemo } from 'react';
11
11
  import Router from 'next/router';
12
12
  import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-641f241f.js';
13
13
  import { _ as _JSON$stringify } from './stringify-4330ccdc.js';
@@ -15,10 +15,9 @@ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-fc1
15
15
  import { Col, Form, Button, Spinner } from 'react-bootstrap';
16
16
  import { u as util } from './util-7700fc59.js';
17
17
  import { s as serialize_1, p as parse_1 } from './index-db3bb315.js';
18
- import useSWR from 'swr';
19
18
  import Local from 'passport-local';
20
19
  import mysql from 'mysql';
21
- import { m as md5 } from './md5-4e42248e.js';
20
+ import { m as md5 } from './md5-9be0e905.js';
22
21
 
23
22
  var returnFormField = function returnFormField(_ref) {
24
23
  var name = _ref.name,
@@ -57,21 +56,21 @@ var returnFormField = function returnFormField(_ref) {
57
56
  }
58
57
 
59
58
  if (type == 'text' || type == 'email' || type == 'password' || type == 'number') {
60
- return React.createElement(
59
+ return React__default.createElement(
61
60
  Form.Group,
62
61
  _extends({}, opts, { controlId: name }),
63
- React.createElement(
62
+ React__default.createElement(
64
63
  Form.Label,
65
64
  { kye: name + '_label' },
66
65
  label,
67
- required && React.createElement(
66
+ required && React__default.createElement(
68
67
  'span',
69
68
  { style: { color: 'red' } },
70
69
  '*'
71
70
  )
72
71
  ),
73
- React.createElement(Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
74
- React.createElement(
72
+ React__default.createElement(Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
73
+ React__default.createElement(
75
74
  Form.Control.Feedback,
76
75
  { key: name + '_feedback', type: 'invalid' },
77
76
  errors[name]
@@ -79,28 +78,28 @@ var returnFormField = function returnFormField(_ref) {
79
78
  );
80
79
  }
81
80
  if (type == 'select') {
82
- return React.createElement(
81
+ return React__default.createElement(
83
82
  Form.Group,
84
83
  _extends({}, opts, { key: name, controlId: name }),
85
- React.createElement(
84
+ React__default.createElement(
86
85
  Form.Label,
87
86
  { key: name + '_' + label },
88
87
  label,
89
- required && React.createElement(
88
+ required && React__default.createElement(
90
89
  'span',
91
90
  { key: name + '_required_span', style: { color: 'red' } },
92
91
  '*'
93
92
  )
94
93
  ),
95
- React.createElement(
94
+ React__default.createElement(
96
95
  Form.Control,
97
96
  { key: name + '_select', as: 'select', name: name, required: required, defaultValue: default_value },
98
- React.createElement('option', { value: '', key: name + '_options_empty' }),
97
+ React__default.createElement('option', { value: '', key: name + '_options_empty' }),
99
98
  options.map(function (option, index) {
100
99
  var value = option.value ? option.value : option;
101
100
  var label = option.label ? option.label : option;
102
101
  var key = name + '_options_' + index;
103
- return React.createElement(
102
+ return React__default.createElement(
104
103
  'option',
105
104
  { key: key, value: value },
106
105
  label
@@ -111,31 +110,1080 @@ var returnFormField = function returnFormField(_ref) {
111
110
  }
112
111
 
113
112
  if (type == 'radio' || type == 'checkbox') {
114
- return React.createElement(
113
+ return React__default.createElement(
115
114
  Form.Group,
116
115
  opts,
117
- React.createElement(
116
+ React__default.createElement(
118
117
  Form.Label,
119
118
  null,
120
119
  label,
121
- required && React.createElement(
120
+ required && React__default.createElement(
122
121
  'span',
123
122
  { style: { color: 'red' } },
124
123
  '*'
125
124
  )
126
125
  ),
127
126
  options.map(function (option, index) {
128
- return React.createElement(
127
+ return React__default.createElement(
129
128
  Form.Check,
130
129
  { type: type, key: index, required: required },
131
- React.createElement(Form.Check.Input, { type: type, key: type + '_' + index + '_input', defaultChecked: default_value ? default_value === option.value : false, name: name, id: name + '_' + index, value: option.value, required: required }),
132
- React.createElement(Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
130
+ React__default.createElement(Form.Check.Input, { type: type, key: type + '_' + index + '_input', defaultChecked: default_value ? default_value === option.value : false, name: name, id: name + '_' + index, value: option.value, required: required }),
131
+ React__default.createElement(Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
133
132
  );
134
133
  })
135
134
  );
136
135
  }
137
136
  };
138
137
 
138
+ var has = Object.prototype.hasOwnProperty;
139
+
140
+ function dequal(foo, bar) {
141
+ var ctor, len;
142
+ if (foo === bar) return true;
143
+
144
+ if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
145
+ if (ctor === Date) return foo.getTime() === bar.getTime();
146
+ if (ctor === RegExp) return foo.toString() === bar.toString();
147
+
148
+ if (ctor === Array) {
149
+ if ((len=foo.length) === bar.length) {
150
+ while (len-- && dequal(foo[len], bar[len]));
151
+ }
152
+ return len === -1;
153
+ }
154
+
155
+ if (!ctor || typeof foo === 'object') {
156
+ len = 0;
157
+ for (ctor in foo) {
158
+ if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
159
+ if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
160
+ }
161
+ return Object.keys(bar).length === len;
162
+ }
163
+ }
164
+
165
+ return foo !== foo && bar !== bar;
166
+ }
167
+
168
+ // use WeakMap to store the object->key mapping
169
+ // so the objects can be garbage collected.
170
+ // WeakMap uses a hashtable under the hood, so the lookup
171
+ // complexity is almost O(1).
172
+ var table = new WeakMap();
173
+ // counter of the key
174
+ var counter = 0;
175
+ // hashes an array of objects and returns a string
176
+ function hash(args) {
177
+ if (!args.length)
178
+ return '';
179
+ var key = 'arg';
180
+ for (var i = 0; i < args.length; ++i) {
181
+ if (args[i] === null) {
182
+ key += '@null';
183
+ continue;
184
+ }
185
+ var _hash = void 0;
186
+ if (typeof args[i] !== 'object' && typeof args[i] !== 'function') {
187
+ // need to consider the case that args[i] is a string:
188
+ // args[i] _hash
189
+ // "undefined" -> '"undefined"'
190
+ // undefined -> 'undefined'
191
+ // 123 -> '123'
192
+ // "null" -> '"null"'
193
+ if (typeof args[i] === 'string') {
194
+ _hash = '"' + args[i] + '"';
195
+ }
196
+ else {
197
+ _hash = String(args[i]);
198
+ }
199
+ }
200
+ else {
201
+ if (!table.has(args[i])) {
202
+ _hash = counter;
203
+ table.set(args[i], counter++);
204
+ }
205
+ else {
206
+ _hash = table.get(args[i]);
207
+ }
208
+ }
209
+ key += '@' + _hash;
210
+ }
211
+ return key;
212
+ }
213
+
214
+ var Cache = /** @class */ (function () {
215
+ function Cache(initialData) {
216
+ if (initialData === void 0) { initialData = {}; }
217
+ this.cache = new Map(Object.entries(initialData));
218
+ this.subs = [];
219
+ }
220
+ Cache.prototype.get = function (key) {
221
+ var _key = this.serializeKey(key)[0];
222
+ return this.cache.get(_key);
223
+ };
224
+ Cache.prototype.set = function (key, value) {
225
+ var _key = this.serializeKey(key)[0];
226
+ this.cache.set(_key, value);
227
+ this.notify();
228
+ };
229
+ Cache.prototype.keys = function () {
230
+ return Array.from(this.cache.keys());
231
+ };
232
+ Cache.prototype.has = function (key) {
233
+ var _key = this.serializeKey(key)[0];
234
+ return this.cache.has(_key);
235
+ };
236
+ Cache.prototype.clear = function () {
237
+ this.cache.clear();
238
+ this.notify();
239
+ };
240
+ Cache.prototype.delete = function (key) {
241
+ var _key = this.serializeKey(key)[0];
242
+ this.cache.delete(_key);
243
+ this.notify();
244
+ };
245
+ // TODO: introduce namespace for the cache
246
+ Cache.prototype.serializeKey = function (key) {
247
+ var args = null;
248
+ if (typeof key === 'function') {
249
+ try {
250
+ key = key();
251
+ }
252
+ catch (err) {
253
+ // dependencies not ready
254
+ key = '';
255
+ }
256
+ }
257
+ if (Array.isArray(key)) {
258
+ // args array
259
+ args = key;
260
+ key = hash(key);
261
+ }
262
+ else {
263
+ // convert null to ''
264
+ key = String(key || '');
265
+ }
266
+ var errorKey = key ? 'err@' + key : '';
267
+ var isValidatingKey = key ? 'validating@' + key : '';
268
+ return [key, args, errorKey, isValidatingKey];
269
+ };
270
+ Cache.prototype.subscribe = function (listener) {
271
+ var _this = this;
272
+ if (typeof listener !== 'function') {
273
+ throw new Error('Expected the listener to be a function.');
274
+ }
275
+ var isSubscribed = true;
276
+ this.subs.push(listener);
277
+ return function () {
278
+ if (!isSubscribed)
279
+ return;
280
+ isSubscribed = false;
281
+ var index = _this.subs.indexOf(listener);
282
+ if (index > -1) {
283
+ _this.subs[index] = _this.subs[_this.subs.length - 1];
284
+ _this.subs.length--;
285
+ }
286
+ };
287
+ };
288
+ // Notify Cache subscribers about a change in the cache
289
+ Cache.prototype.notify = function () {
290
+ for (var _i = 0, _a = this.subs; _i < _a.length; _i++) {
291
+ var listener = _a[_i];
292
+ listener();
293
+ }
294
+ };
295
+ return Cache;
296
+ }());
297
+
298
+ /**
299
+ * Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
300
+ * it's not reliable to detect if the browser is currently online or offline
301
+ * based on `navigator.onLine`.
302
+ * As a work around, we always assume it's online on first load, and change
303
+ * the status upon `online` or `offline` events.
304
+ */
305
+ var online = true;
306
+ var isOnline = function () { return online; };
307
+ var isDocumentVisible = function () {
308
+ if (typeof document !== 'undefined' &&
309
+ document.visibilityState !== undefined) {
310
+ return document.visibilityState !== 'hidden';
311
+ }
312
+ // always assume it's visible
313
+ return true;
314
+ };
315
+ var fetcher = function (url) { return fetch(url).then(function (res) { return res.json(); }); };
316
+ var registerOnFocus = function (cb) {
317
+ if (typeof window !== 'undefined' &&
318
+ window.addEventListener !== undefined &&
319
+ typeof document !== 'undefined' &&
320
+ document.addEventListener !== undefined) {
321
+ // focus revalidate
322
+ document.addEventListener('visibilitychange', function () { return cb(); }, false);
323
+ window.addEventListener('focus', function () { return cb(); }, false);
324
+ }
325
+ };
326
+ var registerOnReconnect = function (cb) {
327
+ if (typeof window !== 'undefined' && window.addEventListener !== undefined) {
328
+ // reconnect revalidate
329
+ window.addEventListener('online', function () {
330
+ online = true;
331
+ cb();
332
+ }, false);
333
+ // nothing to revalidate, just update the status
334
+ window.addEventListener('offline', function () { return (online = false); }, false);
335
+ }
336
+ };
337
+ var webPreset = {
338
+ isOnline: isOnline,
339
+ isDocumentVisible: isDocumentVisible,
340
+ fetcher: fetcher,
341
+ registerOnFocus: registerOnFocus,
342
+ registerOnReconnect: registerOnReconnect
343
+ };
344
+
345
+ var __assign = (undefined && undefined.__assign) || function () {
346
+ __assign = Object.assign || function(t) {
347
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
348
+ s = arguments[i];
349
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
350
+ t[p] = s[p];
351
+ }
352
+ return t;
353
+ };
354
+ return __assign.apply(this, arguments);
355
+ };
356
+ // cache
357
+ var cache = new Cache();
358
+ // error retry
359
+ function onErrorRetry(_, __, config, revalidate, opts) {
360
+ if (!config.isDocumentVisible()) {
361
+ // if it's hidden, stop
362
+ // it will auto revalidate when focus
363
+ return;
364
+ }
365
+ if (typeof config.errorRetryCount === 'number' &&
366
+ opts.retryCount > config.errorRetryCount) {
367
+ return;
368
+ }
369
+ // exponential backoff
370
+ var count = Math.min(opts.retryCount, 8);
371
+ var timeout = ~~((Math.random() + 0.5) * (1 << count)) * config.errorRetryInterval;
372
+ setTimeout(revalidate, timeout, opts);
373
+ }
374
+ // client side: need to adjust the config
375
+ // based on the browser status
376
+ // slow connection (<= 70Kbps)
377
+ var slowConnection = typeof window !== 'undefined' &&
378
+ // @ts-ignore
379
+ navigator['connection'] &&
380
+ // @ts-ignore
381
+ ['slow-2g', '2g'].indexOf(navigator['connection'].effectiveType) !== -1;
382
+ // config
383
+ var defaultConfig = __assign({
384
+ // events
385
+ onLoadingSlow: function () { }, onSuccess: function () { }, onError: function () { }, onErrorRetry: onErrorRetry, errorRetryInterval: (slowConnection ? 10 : 5) * 1000, focusThrottleInterval: 5 * 1000, dedupingInterval: 2 * 1000, loadingTimeout: (slowConnection ? 5 : 3) * 1000, refreshInterval: 0, revalidateOnFocus: true, revalidateOnReconnect: true, refreshWhenHidden: false, refreshWhenOffline: false, shouldRetryOnError: true, suspense: false, compare: dequal, isPaused: function () { return false; } }, webPreset);
386
+
387
+ var IS_SERVER = typeof window === 'undefined' ||
388
+ // @ts-ignore
389
+ !!(typeof Deno !== 'undefined' && Deno && Deno.version && Deno.version.deno);
390
+ // polyfill for requestAnimationFrame
391
+ var rAF = IS_SERVER
392
+ ? null
393
+ : window['requestAnimationFrame']
394
+ ? function (f) { return window['requestAnimationFrame'](f); }
395
+ : function (f) { return setTimeout(f, 1); };
396
+ // React currently throws a warning when using useLayoutEffect on the server.
397
+ // To get around it, we can conditionally useEffect on the server (no-op) and
398
+ // useLayoutEffect in the browser.
399
+ var useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;
400
+
401
+ var SWRConfigContext = createContext({});
402
+ SWRConfigContext.displayName = 'SWRConfigContext';
403
+
404
+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
405
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
406
+ return new (P || (P = Promise))(function (resolve, reject) {
407
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
408
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
409
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
410
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
411
+ });
412
+ };
413
+ var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
414
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
415
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
416
+ function verb(n) { return function (v) { return step([n, v]); }; }
417
+ function step(op) {
418
+ if (f) throw new TypeError("Generator is already executing.");
419
+ while (_) try {
420
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
421
+ if (y = 0, t) op = [op[0] & 2, t.value];
422
+ switch (op[0]) {
423
+ case 0: case 1: t = op; break;
424
+ case 4: _.label++; return { value: op[1], done: false };
425
+ case 5: _.label++; y = op[1]; op = [0]; continue;
426
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
427
+ default:
428
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
429
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
430
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
431
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
432
+ if (t[2]) _.ops.pop();
433
+ _.trys.pop(); continue;
434
+ }
435
+ op = body.call(thisArg, _);
436
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
437
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
438
+ }
439
+ };
440
+ // global state managers
441
+ var CONCURRENT_PROMISES = {};
442
+ var CONCURRENT_PROMISES_TS = {};
443
+ var FOCUS_REVALIDATORS = {};
444
+ var RECONNECT_REVALIDATORS = {};
445
+ var CACHE_REVALIDATORS = {};
446
+ var MUTATION_TS = {};
447
+ var MUTATION_END_TS = {};
448
+ // generate strictly increasing timestamps
449
+ var now = (function () {
450
+ var ts = 0;
451
+ return function () { return ++ts; };
452
+ })();
453
+ // setup DOM events listeners for `focus` and `reconnect` actions
454
+ if (!IS_SERVER) {
455
+ var revalidate_1 = function (revalidators) {
456
+ if (!defaultConfig.isDocumentVisible() || !defaultConfig.isOnline())
457
+ return;
458
+ for (var key in revalidators) {
459
+ if (revalidators[key][0])
460
+ revalidators[key][0]();
461
+ }
462
+ };
463
+ if (typeof defaultConfig.registerOnFocus === 'function') {
464
+ defaultConfig.registerOnFocus(function () { return revalidate_1(FOCUS_REVALIDATORS); });
465
+ }
466
+ if (typeof defaultConfig.registerOnReconnect === 'function') {
467
+ defaultConfig.registerOnReconnect(function () { return revalidate_1(RECONNECT_REVALIDATORS); });
468
+ }
469
+ }
470
+ var trigger = function (_key, shouldRevalidate) {
471
+ if (shouldRevalidate === void 0) { shouldRevalidate = true; }
472
+ // we are ignoring the second argument which correspond to the arguments
473
+ // the fetcher will receive when key is an array
474
+ var _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2], keyValidating = _a[3];
475
+ if (!key)
476
+ return Promise.resolve();
477
+ var updaters = CACHE_REVALIDATORS[key];
478
+ if (key && updaters) {
479
+ var currentData = cache.get(key);
480
+ var currentError = cache.get(keyErr);
481
+ var currentIsValidating = cache.get(keyValidating);
482
+ var promises = [];
483
+ for (var i = 0; i < updaters.length; ++i) {
484
+ promises.push(updaters[i](shouldRevalidate, currentData, currentError, currentIsValidating, i > 0));
485
+ }
486
+ // return new updated value
487
+ return Promise.all(promises).then(function () { return cache.get(key); });
488
+ }
489
+ return Promise.resolve(cache.get(key));
490
+ };
491
+ var broadcastState = function (key, data, error, isValidating) {
492
+ var updaters = CACHE_REVALIDATORS[key];
493
+ if (key && updaters) {
494
+ for (var i = 0; i < updaters.length; ++i) {
495
+ updaters[i](false, data, error, isValidating);
496
+ }
497
+ }
498
+ };
499
+ var mutate = function (_key, _data, shouldRevalidate) {
500
+ if (shouldRevalidate === void 0) { shouldRevalidate = true; }
501
+ return __awaiter(void 0, void 0, void 0, function () {
502
+ var _a, key, keyErr, beforeMutationTs, beforeConcurrentPromisesTs, data, error, isAsyncMutation, err_1, shouldAbort, updaters, promises, i;
503
+ return __generator(this, function (_b) {
504
+ switch (_b.label) {
505
+ case 0:
506
+ _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2];
507
+ if (!key)
508
+ return [2 /*return*/];
509
+ // if there is no new data to update, let's just revalidate the key
510
+ if (typeof _data === 'undefined')
511
+ return [2 /*return*/, trigger(_key, shouldRevalidate)
512
+ // update global timestamps
513
+ ];
514
+ // update global timestamps
515
+ MUTATION_TS[key] = now() - 1;
516
+ MUTATION_END_TS[key] = 0;
517
+ beforeMutationTs = MUTATION_TS[key];
518
+ beforeConcurrentPromisesTs = CONCURRENT_PROMISES_TS[key];
519
+ isAsyncMutation = false;
520
+ if (_data && typeof _data === 'function') {
521
+ // `_data` is a function, call it passing current cache value
522
+ try {
523
+ _data = _data(cache.get(key));
524
+ }
525
+ catch (err) {
526
+ // if `_data` function throws an error synchronously, it shouldn't be cached
527
+ _data = undefined;
528
+ error = err;
529
+ }
530
+ }
531
+ if (!(_data && typeof _data.then === 'function')) return [3 /*break*/, 5];
532
+ // `_data` is a promise
533
+ isAsyncMutation = true;
534
+ _b.label = 1;
535
+ case 1:
536
+ _b.trys.push([1, 3, , 4]);
537
+ return [4 /*yield*/, _data];
538
+ case 2:
539
+ data = _b.sent();
540
+ return [3 /*break*/, 4];
541
+ case 3:
542
+ err_1 = _b.sent();
543
+ error = err_1;
544
+ return [3 /*break*/, 4];
545
+ case 4: return [3 /*break*/, 6];
546
+ case 5:
547
+ data = _data;
548
+ _b.label = 6;
549
+ case 6:
550
+ shouldAbort = function () {
551
+ // check if other mutations have occurred since we've started this mutation
552
+ if (beforeMutationTs !== MUTATION_TS[key] ||
553
+ beforeConcurrentPromisesTs !== CONCURRENT_PROMISES_TS[key]) {
554
+ if (error)
555
+ throw error;
556
+ return true;
557
+ }
558
+ };
559
+ // if there's a race we don't update cache or broadcast change, just return the data
560
+ if (shouldAbort())
561
+ return [2 /*return*/, data];
562
+ if (typeof data !== 'undefined') {
563
+ // update cached data
564
+ cache.set(key, data);
565
+ }
566
+ // always update or reset the error
567
+ cache.set(keyErr, error);
568
+ // reset the timestamp to mark the mutation has ended
569
+ MUTATION_END_TS[key] = now() - 1;
570
+ if (!isAsyncMutation) {
571
+ // we skip broadcasting if there's another mutation happened synchronously
572
+ if (shouldAbort())
573
+ return [2 /*return*/, data];
574
+ }
575
+ updaters = CACHE_REVALIDATORS[key];
576
+ if (updaters) {
577
+ promises = [];
578
+ for (i = 0; i < updaters.length; ++i) {
579
+ promises.push(updaters[i](!!shouldRevalidate, data, error, undefined, i > 0));
580
+ }
581
+ // return new updated value
582
+ return [2 /*return*/, Promise.all(promises).then(function () {
583
+ if (error)
584
+ throw error;
585
+ return cache.get(key);
586
+ })];
587
+ }
588
+ // throw error or return data to be used by caller of mutate
589
+ if (error)
590
+ throw error;
591
+ return [2 /*return*/, data];
592
+ }
593
+ });
594
+ });
595
+ };
596
+ function useSWR() {
597
+ var _this = this;
598
+ var args = [];
599
+ for (var _i = 0; _i < arguments.length; _i++) {
600
+ args[_i] = arguments[_i];
601
+ }
602
+ var _key = args[0];
603
+ var config = Object.assign({}, defaultConfig, useContext(SWRConfigContext), args.length > 2
604
+ ? args[2]
605
+ : args.length === 2 && typeof args[1] === 'object'
606
+ ? args[1]
607
+ : {});
608
+ // in typescript args.length > 2 is not same as args.lenth === 3
609
+ // we do a safe type assertion here
610
+ // args.length === 3
611
+ var fn = (args.length > 2
612
+ ? args[1]
613
+ : args.length === 2 && typeof args[1] === 'function'
614
+ ? args[1]
615
+ : /**
616
+ pass fn as null will disable revalidate
617
+ https://paco.sh/blog/shared-hook-state-with-swr
618
+ */
619
+ args[1] === null
620
+ ? args[1]
621
+ : config.fetcher);
622
+ // we assume `key` as the identifier of the request
623
+ // `key` can change but `fn` shouldn't
624
+ // (because `revalidate` only depends on `key`)
625
+ // `keyErr` is the cache key for error objects
626
+ var _a = cache.serializeKey(_key), key = _a[0], fnArgs = _a[1], keyErr = _a[2], keyValidating = _a[3];
627
+ var configRef = useRef(config);
628
+ useIsomorphicLayoutEffect(function () {
629
+ configRef.current = config;
630
+ });
631
+ var willRevalidateOnMount = function () {
632
+ return (config.revalidateOnMount ||
633
+ (!config.initialData && config.revalidateOnMount === undefined));
634
+ };
635
+ var resolveData = function () {
636
+ var cachedData = cache.get(key);
637
+ return typeof cachedData === 'undefined' ? config.initialData : cachedData;
638
+ };
639
+ var resolveIsValidating = function () {
640
+ return !!cache.get(keyValidating) || (key && willRevalidateOnMount());
641
+ };
642
+ var initialData = resolveData();
643
+ var initialError = cache.get(keyErr);
644
+ var initialIsValidating = resolveIsValidating();
645
+ // if a state is accessed (data, error or isValidating),
646
+ // we add the state to dependencies so if the state is
647
+ // updated in the future, we can trigger a rerender
648
+ var stateDependencies = useRef({
649
+ data: false,
650
+ error: false,
651
+ isValidating: false
652
+ });
653
+ var stateRef = useRef({
654
+ data: initialData,
655
+ error: initialError,
656
+ isValidating: initialIsValidating
657
+ });
658
+ // display the data label in the React DevTools next to SWR hooks
659
+ useDebugValue(stateRef.current.data);
660
+ var rerender = useState({})[1];
661
+ var dispatch = useCallback(function (payload) {
662
+ var shouldUpdateState = false;
663
+ for (var k in payload) {
664
+ // @ts-ignore
665
+ if (stateRef.current[k] === payload[k]) {
666
+ continue;
667
+ }
668
+ // @ts-ignore
669
+ stateRef.current[k] = payload[k];
670
+ // @ts-ignore
671
+ if (stateDependencies.current[k]) {
672
+ shouldUpdateState = true;
673
+ }
674
+ }
675
+ if (shouldUpdateState) {
676
+ // if component is unmounted, should skip rerender
677
+ // if component is not mounted, should skip rerender
678
+ if (unmountedRef.current || !initialMountedRef.current)
679
+ return;
680
+ rerender({});
681
+ }
682
+ },
683
+ // config.suspense isn't allowed to change during the lifecycle
684
+ // eslint-disable-next-line react-hooks/exhaustive-deps
685
+ []);
686
+ // error ref inside revalidate (is last request errored?)
687
+ var unmountedRef = useRef(false);
688
+ var keyRef = useRef(key);
689
+ // check if component is mounted in suspense mode
690
+ var initialMountedRef = useRef(false);
691
+ // do unmount check for callbacks
692
+ var eventsCallback = useCallback(function (event) {
693
+ var _a;
694
+ var params = [];
695
+ for (var _i = 1; _i < arguments.length; _i++) {
696
+ params[_i - 1] = arguments[_i];
697
+ }
698
+ if (unmountedRef.current)
699
+ return;
700
+ if (!initialMountedRef.current)
701
+ return;
702
+ if (key !== keyRef.current)
703
+ return;
704
+ // @ts-ignore
705
+ (_a = configRef.current)[event].apply(_a, params);
706
+ }, [key]);
707
+ var boundMutate = useCallback(function (data, shouldRevalidate) {
708
+ return mutate(keyRef.current, data, shouldRevalidate);
709
+ }, []);
710
+ var addRevalidator = function (revalidators, callback) {
711
+ if (!revalidators[key]) {
712
+ revalidators[key] = [callback];
713
+ }
714
+ else {
715
+ revalidators[key].push(callback);
716
+ }
717
+ return function () {
718
+ var keyedRevalidators = revalidators[key];
719
+ var index = keyedRevalidators.indexOf(callback);
720
+ if (index >= 0) {
721
+ // O(1): faster than splice
722
+ keyedRevalidators[index] =
723
+ keyedRevalidators[keyedRevalidators.length - 1];
724
+ keyedRevalidators.pop();
725
+ }
726
+ };
727
+ };
728
+ // start a revalidation
729
+ var revalidate = useCallback(function (revalidateOpts) {
730
+ if (revalidateOpts === void 0) { revalidateOpts = {}; }
731
+ return __awaiter(_this, void 0, void 0, function () {
732
+ var _a, retryCount, _b, dedupe, loading, shouldDeduping, newData, startAt, newState, err_2;
733
+ return __generator(this, function (_c) {
734
+ switch (_c.label) {
735
+ case 0:
736
+ if (!key || !fn)
737
+ return [2 /*return*/, false];
738
+ if (unmountedRef.current)
739
+ return [2 /*return*/, false];
740
+ if (configRef.current.isPaused())
741
+ return [2 /*return*/, false];
742
+ _a = revalidateOpts.retryCount, retryCount = _a === void 0 ? 0 : _a, _b = revalidateOpts.dedupe, dedupe = _b === void 0 ? false : _b;
743
+ loading = true;
744
+ shouldDeduping = typeof CONCURRENT_PROMISES[key] !== 'undefined' && dedupe;
745
+ _c.label = 1;
746
+ case 1:
747
+ _c.trys.push([1, 6, , 7]);
748
+ dispatch({
749
+ isValidating: true
750
+ });
751
+ cache.set(keyValidating, true);
752
+ if (!shouldDeduping) {
753
+ // also update other hooks
754
+ broadcastState(key, stateRef.current.data, stateRef.current.error, true);
755
+ }
756
+ newData = void 0;
757
+ startAt = void 0;
758
+ if (!shouldDeduping) return [3 /*break*/, 3];
759
+ // there's already an ongoing request,
760
+ // this one needs to be deduplicated.
761
+ startAt = CONCURRENT_PROMISES_TS[key];
762
+ return [4 /*yield*/, CONCURRENT_PROMISES[key]];
763
+ case 2:
764
+ newData = _c.sent();
765
+ return [3 /*break*/, 5];
766
+ case 3:
767
+ // if no cache being rendered currently (it shows a blank page),
768
+ // we trigger the loading slow event.
769
+ if (config.loadingTimeout && !cache.get(key)) {
770
+ setTimeout(function () {
771
+ if (loading)
772
+ eventsCallback('onLoadingSlow', key, config);
773
+ }, config.loadingTimeout);
774
+ }
775
+ if (fnArgs !== null) {
776
+ CONCURRENT_PROMISES[key] = fn.apply(void 0, fnArgs);
777
+ }
778
+ else {
779
+ CONCURRENT_PROMISES[key] = fn(key);
780
+ }
781
+ CONCURRENT_PROMISES_TS[key] = startAt = now();
782
+ return [4 /*yield*/, CONCURRENT_PROMISES[key]];
783
+ case 4:
784
+ newData = _c.sent();
785
+ setTimeout(function () {
786
+ delete CONCURRENT_PROMISES[key];
787
+ delete CONCURRENT_PROMISES_TS[key];
788
+ }, config.dedupingInterval);
789
+ // trigger the success event,
790
+ // only do this for the original request.
791
+ eventsCallback('onSuccess', newData, key, config);
792
+ _c.label = 5;
793
+ case 5:
794
+ // if there're other ongoing request(s), started after the current one,
795
+ // we need to ignore the current one to avoid possible race conditions:
796
+ // req1------------------>res1 (current one)
797
+ // req2---------------->res2
798
+ // the request that fired later will always be kept.
799
+ if (CONCURRENT_PROMISES_TS[key] > startAt) {
800
+ return [2 /*return*/, false];
801
+ }
802
+ // if there're other mutations(s), overlapped with the current revalidation:
803
+ // case 1:
804
+ // req------------------>res
805
+ // mutate------>end
806
+ // case 2:
807
+ // req------------>res
808
+ // mutate------>end
809
+ // case 3:
810
+ // req------------------>res
811
+ // mutate-------...---------->
812
+ // we have to ignore the revalidation result (res) because it's no longer fresh.
813
+ // meanwhile, a new revalidation should be triggered when the mutation ends.
814
+ if (MUTATION_TS[key] &&
815
+ // case 1
816
+ (startAt <= MUTATION_TS[key] ||
817
+ // case 2
818
+ startAt <= MUTATION_END_TS[key] ||
819
+ // case 3
820
+ MUTATION_END_TS[key] === 0)) {
821
+ dispatch({ isValidating: false });
822
+ return [2 /*return*/, false];
823
+ }
824
+ cache.set(keyErr, undefined);
825
+ cache.set(keyValidating, false);
826
+ newState = {
827
+ isValidating: false
828
+ };
829
+ if (typeof stateRef.current.error !== 'undefined') {
830
+ // we don't have an error
831
+ newState.error = undefined;
832
+ }
833
+ if (!config.compare(stateRef.current.data, newData)) {
834
+ // deep compare to avoid extra re-render
835
+ // data changed
836
+ newState.data = newData;
837
+ }
838
+ if (!config.compare(cache.get(key), newData)) {
839
+ cache.set(key, newData);
840
+ }
841
+ // merge the new state
842
+ dispatch(newState);
843
+ if (!shouldDeduping) {
844
+ // also update other hooks
845
+ broadcastState(key, newData, newState.error, false);
846
+ }
847
+ return [3 /*break*/, 7];
848
+ case 6:
849
+ err_2 = _c.sent();
850
+ delete CONCURRENT_PROMISES[key];
851
+ delete CONCURRENT_PROMISES_TS[key];
852
+ if (configRef.current.isPaused()) {
853
+ dispatch({
854
+ isValidating: false
855
+ });
856
+ return [2 /*return*/, false];
857
+ }
858
+ cache.set(keyErr, err_2);
859
+ // get a new error
860
+ // don't use deep equal for errors
861
+ if (stateRef.current.error !== err_2) {
862
+ // we keep the stale data
863
+ dispatch({
864
+ isValidating: false,
865
+ error: err_2
866
+ });
867
+ if (!shouldDeduping) {
868
+ // also broadcast to update other hooks
869
+ broadcastState(key, undefined, err_2, false);
870
+ }
871
+ }
872
+ // events and retry
873
+ eventsCallback('onError', err_2, key, config);
874
+ if (config.shouldRetryOnError) {
875
+ // when retrying, we always enable deduping
876
+ eventsCallback('onErrorRetry', err_2, key, config, revalidate, {
877
+ retryCount: retryCount + 1,
878
+ dedupe: true
879
+ });
880
+ }
881
+ return [3 /*break*/, 7];
882
+ case 7:
883
+ loading = false;
884
+ return [2 /*return*/, true];
885
+ }
886
+ });
887
+ });
888
+ },
889
+ // dispatch is immutable, and `eventsCallback`, `fnArgs`, `keyErr`, and `keyValidating` are based on `key`,
890
+ // so we can them from the deps array.
891
+ //
892
+ // FIXME:
893
+ // `fn` and `config` might be changed during the lifecycle,
894
+ // but they might be changed every render like this.
895
+ // useSWR('key', () => fetch('/api/'), { suspense: true })
896
+ // So we omit the values from the deps array
897
+ // even though it might cause unexpected behaviors.
898
+ // eslint-disable-next-line react-hooks/exhaustive-deps
899
+ [key]);
900
+ // mounted (client side rendering)
901
+ useIsomorphicLayoutEffect(function () {
902
+ if (!key)
903
+ return undefined;
904
+ // after `key` updates, we need to mark it as mounted
905
+ unmountedRef.current = false;
906
+ var isUpdating = initialMountedRef.current;
907
+ initialMountedRef.current = true;
908
+ // after the component is mounted (hydrated),
909
+ // we need to update the data from the cache
910
+ // and trigger a revalidation
911
+ var currentHookData = stateRef.current.data;
912
+ var latestKeyedData = resolveData();
913
+ // update the state if the key changed (not the inital render) or cache updated
914
+ keyRef.current = key;
915
+ if (!config.compare(currentHookData, latestKeyedData)) {
916
+ dispatch({ data: latestKeyedData });
917
+ }
918
+ // revalidate with deduping
919
+ var softRevalidate = function () { return revalidate({ dedupe: true }); };
920
+ // trigger a revalidation
921
+ if (isUpdating || willRevalidateOnMount()) {
922
+ if (typeof latestKeyedData !== 'undefined' && !IS_SERVER) {
923
+ // delay revalidate if there's cache
924
+ // to not block the rendering
925
+ // @ts-ignore it's safe to use requestAnimationFrame in browser
926
+ rAF(softRevalidate);
927
+ }
928
+ else {
929
+ softRevalidate();
930
+ }
931
+ }
932
+ var pending = false;
933
+ var onFocus = function () {
934
+ if (pending || !configRef.current.revalidateOnFocus)
935
+ return;
936
+ pending = true;
937
+ softRevalidate();
938
+ setTimeout(function () { return (pending = false); }, configRef.current.focusThrottleInterval);
939
+ };
940
+ var onReconnect = function () {
941
+ if (configRef.current.revalidateOnReconnect) {
942
+ softRevalidate();
943
+ }
944
+ };
945
+ // register global cache update listener
946
+ var onUpdate = function (shouldRevalidate, updatedData, updatedError, updatedIsValidating, dedupe) {
947
+ if (shouldRevalidate === void 0) { shouldRevalidate = true; }
948
+ if (dedupe === void 0) { dedupe = true; }
949
+ // update hook state
950
+ var newState = {};
951
+ var needUpdate = false;
952
+ if (typeof updatedData !== 'undefined' &&
953
+ !config.compare(stateRef.current.data, updatedData)) {
954
+ newState.data = updatedData;
955
+ needUpdate = true;
956
+ }
957
+ // always update error
958
+ // because it can be `undefined`
959
+ if (stateRef.current.error !== updatedError) {
960
+ newState.error = updatedError;
961
+ needUpdate = true;
962
+ }
963
+ if (typeof updatedIsValidating !== 'undefined' &&
964
+ stateRef.current.isValidating !== updatedIsValidating) {
965
+ newState.isValidating = updatedIsValidating;
966
+ needUpdate = true;
967
+ }
968
+ if (needUpdate) {
969
+ dispatch(newState);
970
+ }
971
+ if (shouldRevalidate) {
972
+ if (dedupe) {
973
+ return softRevalidate();
974
+ }
975
+ else {
976
+ return revalidate();
977
+ }
978
+ }
979
+ return false;
980
+ };
981
+ var unsubFocus = addRevalidator(FOCUS_REVALIDATORS, onFocus);
982
+ var unsubReconnect = addRevalidator(RECONNECT_REVALIDATORS, onReconnect);
983
+ var unsubUpdate = addRevalidator(CACHE_REVALIDATORS, onUpdate);
984
+ return function () {
985
+ // cleanup
986
+ dispatch = function () { return null; };
987
+ // mark it as unmounted
988
+ unmountedRef.current = true;
989
+ unsubFocus();
990
+ unsubReconnect();
991
+ unsubUpdate();
992
+ };
993
+ }, [key, revalidate]);
994
+ useIsomorphicLayoutEffect(function () {
995
+ var timer = null;
996
+ var tick = function () { return __awaiter(_this, void 0, void 0, function () {
997
+ return __generator(this, function (_a) {
998
+ switch (_a.label) {
999
+ case 0:
1000
+ if (!(!stateRef.current.error &&
1001
+ (configRef.current.refreshWhenHidden ||
1002
+ configRef.current.isDocumentVisible()) &&
1003
+ (configRef.current.refreshWhenOffline || configRef.current.isOnline()))) return [3 /*break*/, 2];
1004
+ // only revalidate when the page is visible
1005
+ // if API request errored, we stop polling in this round
1006
+ // and let the error retry function handle it
1007
+ return [4 /*yield*/, revalidate({ dedupe: true })];
1008
+ case 1:
1009
+ // only revalidate when the page is visible
1010
+ // if API request errored, we stop polling in this round
1011
+ // and let the error retry function handle it
1012
+ _a.sent();
1013
+ _a.label = 2;
1014
+ case 2:
1015
+ // Read the latest refreshInterval
1016
+ if (configRef.current.refreshInterval && timer) {
1017
+ timer = setTimeout(tick, configRef.current.refreshInterval);
1018
+ }
1019
+ return [2 /*return*/];
1020
+ }
1021
+ });
1022
+ }); };
1023
+ if (configRef.current.refreshInterval) {
1024
+ timer = setTimeout(tick, configRef.current.refreshInterval);
1025
+ }
1026
+ return function () {
1027
+ if (timer) {
1028
+ clearTimeout(timer);
1029
+ timer = null;
1030
+ }
1031
+ };
1032
+ }, [
1033
+ config.refreshInterval,
1034
+ config.refreshWhenHidden,
1035
+ config.refreshWhenOffline,
1036
+ revalidate
1037
+ ]);
1038
+ // suspense
1039
+ var latestData;
1040
+ var latestError;
1041
+ if (config.suspense) {
1042
+ // in suspense mode, we can't return empty state
1043
+ // (it should be suspended)
1044
+ // try to get data and error from cache
1045
+ latestData = cache.get(key);
1046
+ latestError = cache.get(keyErr);
1047
+ if (typeof latestData === 'undefined') {
1048
+ latestData = initialData;
1049
+ }
1050
+ if (typeof latestError === 'undefined') {
1051
+ latestError = initialError;
1052
+ }
1053
+ if (typeof latestData === 'undefined' &&
1054
+ typeof latestError === 'undefined') {
1055
+ // need to start the request if it hasn't
1056
+ if (!CONCURRENT_PROMISES[key]) {
1057
+ // trigger revalidate immediately
1058
+ // to get the promise
1059
+ // in this revalidate, should not rerender
1060
+ revalidate();
1061
+ }
1062
+ if (CONCURRENT_PROMISES[key] &&
1063
+ typeof CONCURRENT_PROMISES[key].then === 'function') {
1064
+ // if it is a promise
1065
+ throw CONCURRENT_PROMISES[key];
1066
+ }
1067
+ // it's a value, return it directly (override)
1068
+ latestData = CONCURRENT_PROMISES[key];
1069
+ }
1070
+ if (typeof latestData === 'undefined' && latestError) {
1071
+ // in suspense mode, throw error if there's no content
1072
+ throw latestError;
1073
+ }
1074
+ }
1075
+ // define returned state
1076
+ // can be memorized since the state is a ref
1077
+ var memoizedState = useMemo(function () {
1078
+ // revalidate will be deprecated in the 1.x release
1079
+ // because mutate() covers the same use case of revalidate().
1080
+ // This remains only for backward compatibility
1081
+ var state = { revalidate: revalidate, mutate: boundMutate };
1082
+ Object.defineProperties(state, {
1083
+ error: {
1084
+ // `key` might be changed in the upcoming hook re-render,
1085
+ // but the previous state will stay
1086
+ // so we need to match the latest key and data (fallback to `initialData`)
1087
+ get: function () {
1088
+ stateDependencies.current.error = true;
1089
+ if (config.suspense) {
1090
+ return latestError;
1091
+ }
1092
+ return keyRef.current === key ? stateRef.current.error : initialError;
1093
+ },
1094
+ enumerable: true
1095
+ },
1096
+ data: {
1097
+ get: function () {
1098
+ stateDependencies.current.data = true;
1099
+ if (config.suspense) {
1100
+ return latestData;
1101
+ }
1102
+ return keyRef.current === key ? stateRef.current.data : initialData;
1103
+ },
1104
+ enumerable: true
1105
+ },
1106
+ isValidating: {
1107
+ get: function () {
1108
+ stateDependencies.current.isValidating = true;
1109
+ return key ? stateRef.current.isValidating : false;
1110
+ },
1111
+ enumerable: true
1112
+ }
1113
+ });
1114
+ return state;
1115
+ // `config.suspense` isn't allowed to change during the lifecycle.
1116
+ // `boundMutate` is immutable, and the immutability of `revalidate` depends on `key`
1117
+ // so we can omit them from the deps array,
1118
+ // but we put it to enable react-hooks/exhaustive-deps rule.
1119
+ // `initialData` and `initialError` are not initial values
1120
+ // because they are changed during the lifecycle
1121
+ // so we should add them in the deps array.
1122
+ }, [
1123
+ revalidate,
1124
+ initialData,
1125
+ initialError,
1126
+ boundMutate,
1127
+ key,
1128
+ config.suspense,
1129
+ latestError,
1130
+ latestData
1131
+ ]);
1132
+ return memoizedState;
1133
+ }
1134
+ Object.defineProperty(SWRConfigContext.Provider, 'default', {
1135
+ value: defaultConfig
1136
+ });
1137
+ var SWRConfig = SWRConfigContext.Provider;
1138
+
1139
+ var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1140
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1141
+ return new (P || (P = Promise))(function (resolve, reject) {
1142
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1143
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1144
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1145
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1146
+ });
1147
+ };
1148
+ var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
1149
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1150
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1151
+ function verb(n) { return function (v) { return step([n, v]); }; }
1152
+ function step(op) {
1153
+ if (f) throw new TypeError("Generator is already executing.");
1154
+ while (_) try {
1155
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1156
+ if (y = 0, t) op = [op[0] & 2, t.value];
1157
+ switch (op[0]) {
1158
+ case 0: case 1: t = op; break;
1159
+ case 4: _.label++; return { value: op[1], done: false };
1160
+ case 5: _.label++; y = op[1]; op = [0]; continue;
1161
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
1162
+ default:
1163
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1164
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1165
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1166
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1167
+ if (t[2]) _.ops.pop();
1168
+ _.trys.pop(); continue;
1169
+ }
1170
+ op = body.call(thisArg, _);
1171
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1172
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1173
+ }
1174
+ };
1175
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
1176
+ var t = {};
1177
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1178
+ t[p] = s[p];
1179
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1180
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1181
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1182
+ t[p[i]] = s[p[i]];
1183
+ }
1184
+ return t;
1185
+ };
1186
+
139
1187
  var _this = undefined;
140
1188
 
141
1189
  var dataHandler = function () {
@@ -336,43 +1384,43 @@ var LoginForm = function LoginForm(props) {
336
1384
  loading = _useState4[0],
337
1385
  setLoading = _useState4[1];
338
1386
 
339
- return React.createElement(
1387
+ return React__default.createElement(
340
1388
  Form,
341
1389
  { className: 'login', onSubmit: handleSubmit },
342
- React.createElement(
1390
+ React__default.createElement(
343
1391
  'h1',
344
1392
  null,
345
1393
  'Login'
346
1394
  ),
347
- React.createElement('hr', null),
1395
+ React__default.createElement('hr', null),
348
1396
  returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
349
1397
  returnFormField({ name: 'password', label: 'Password', type: 'password', required: true }),
350
- React.createElement('hr', null),
351
- React.createElement(
1398
+ React__default.createElement('hr', null),
1399
+ React__default.createElement(
352
1400
  Form.Row,
353
1401
  null,
354
- React.createElement(
1402
+ React__default.createElement(
355
1403
  Form.Group,
356
1404
  { as: Col },
357
- React.createElement(
1405
+ React__default.createElement(
358
1406
  'a',
359
1407
  { href: '/auth/signup' },
360
1408
  'I don\'t have an account'
361
1409
  )
362
1410
  ),
363
- React.createElement(
1411
+ React__default.createElement(
364
1412
  Form.Group,
365
1413
  { as: Col, className: 'text-right' },
366
- !loading && React.createElement(
1414
+ !loading && React__default.createElement(
367
1415
  Button,
368
1416
  { type: 'submit' },
369
1417
  'Login'
370
1418
  ),
371
- loading && React.createElement(
1419
+ loading && React__default.createElement(
372
1420
  Button,
373
1421
  { variant: 'primary', disabled: true },
374
- React.createElement(Spinner, { as: 'span', animation: 'border', role: 'status', 'aria-hidden': 'true', size: 'sm' }),
375
- React.createElement(
1422
+ React__default.createElement(Spinner, { as: 'span', animation: 'border', role: 'status', 'aria-hidden': 'true', size: 'sm' }),
1423
+ React__default.createElement(
376
1424
  'span',
377
1425
  { className: 'sr-only' },
378
1426
  'Loading...'
@@ -380,12 +1428,12 @@ var LoginForm = function LoginForm(props) {
380
1428
  )
381
1429
  )
382
1430
  ),
383
- errorMsg && React.createElement(
1431
+ errorMsg && React__default.createElement(
384
1432
  'p',
385
1433
  { className: 'error' },
386
1434
  errorMsg
387
1435
  ),
388
- React.createElement(
1436
+ React__default.createElement(
389
1437
  'style',
390
1438
  { jsx: 'true'.toString() },
391
1439
  '\n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n '
@@ -641,29 +1689,29 @@ var SignupForm = function SignupForm(props) {
641
1689
  loading = _useState14[0],
642
1690
  setLoading = _useState14[1];
643
1691
 
644
- return React.createElement(
1692
+ return React__default.createElement(
645
1693
  Form,
646
1694
  { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
647
- React.createElement(
1695
+ React__default.createElement(
648
1696
  'h1',
649
1697
  null,
650
1698
  'Sign Up'
651
1699
  ),
652
- React.createElement('hr', null),
1700
+ React__default.createElement('hr', null),
653
1701
  returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
654
- React.createElement(
1702
+ React__default.createElement(
655
1703
  Form.Row,
656
1704
  null,
657
1705
  returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: Col, required: true }),
658
1706
  returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: Col, required: true })
659
1707
  ),
660
- React.createElement(
1708
+ React__default.createElement(
661
1709
  Form.Row,
662
1710
  null,
663
1711
  returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: Col, required: true }),
664
1712
  returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: Col, required: true })
665
1713
  ),
666
- React.createElement(
1714
+ React__default.createElement(
667
1715
  Form.Row,
668
1716
  null,
669
1717
  returnFormField({
@@ -677,7 +1725,7 @@ var SignupForm = function SignupForm(props) {
677
1725
  }),
678
1726
  countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: Col, options: states })
679
1727
  ),
680
- React.createElement(
1728
+ React__default.createElement(
681
1729
  Form.Row,
682
1730
  null,
683
1731
  countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: Col }),
@@ -724,38 +1772,38 @@ var SignupForm = function SignupForm(props) {
724
1772
  required: true,
725
1773
  options: [{ label: 'By registering you agree to our <a href="/terms" style="color:blue">Terms and Conditions</a> and <a href="/privacy" style="color:blue">Privacy Policy</a> and understand that you will be receiving email communications', value: 'Y' }]
726
1774
  }),
727
- React.createElement('hr', null),
728
- React.createElement(
1775
+ React__default.createElement('hr', null),
1776
+ React__default.createElement(
729
1777
  Form.Row,
730
1778
  null,
731
- React.createElement(
1779
+ React__default.createElement(
732
1780
  Form.Group,
733
1781
  { as: Col },
734
- React.createElement(
1782
+ React__default.createElement(
735
1783
  'a',
736
1784
  { href: '/auth/login' },
737
1785
  'I already have an account'
738
1786
  )
739
1787
  ),
740
- React.createElement(
1788
+ React__default.createElement(
741
1789
  Form.Group,
742
1790
  { as: Col, className: 'text-right' },
743
- !loading && React.createElement(
1791
+ !loading && React__default.createElement(
744
1792
  Button,
745
1793
  { type: 'submit' },
746
1794
  'Sign Up'
747
1795
  ),
748
- loading && React.createElement(
1796
+ loading && React__default.createElement(
749
1797
  Button,
750
1798
  { variant: 'primary', disabled: true },
751
- React.createElement(Spinner, {
1799
+ React__default.createElement(Spinner, {
752
1800
  as: 'span',
753
1801
  animation: 'border',
754
1802
  role: 'status',
755
1803
  'aria-hidden': 'true',
756
1804
  size: 'sm'
757
1805
  }),
758
- React.createElement(
1806
+ React__default.createElement(
759
1807
  'span',
760
1808
  { className: 'sr-only' },
761
1809
  'Loading...'
@@ -763,12 +1811,12 @@ var SignupForm = function SignupForm(props) {
763
1811
  )
764
1812
  )
765
1813
  ),
766
- errorMsg && React.createElement(
1814
+ errorMsg && React__default.createElement(
767
1815
  'p',
768
1816
  { className: 'error' },
769
1817
  errorMsg
770
1818
  ),
771
- React.createElement(
1819
+ React__default.createElement(
772
1820
  'style',
773
1821
  { jsx: 'true'.toString() },
774
1822
  ' \n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n '
@@ -1058,32 +2106,32 @@ var SignupForm$1 = function SignupForm(props) {
1058
2106
  loading = _useState18[0],
1059
2107
  setLoading = _useState18[1];
1060
2108
 
1061
- return React.createElement(
2109
+ return React__default.createElement(
1062
2110
  Form,
1063
2111
  { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
1064
- React.createElement(
2112
+ React__default.createElement(
1065
2113
  'h1',
1066
2114
  null,
1067
2115
  'Profile'
1068
2116
  ),
1069
- React.createElement('hr', null),
1070
- userData ? React.createElement(
1071
- React.Fragment,
2117
+ React__default.createElement('hr', null),
2118
+ userData ? React__default.createElement(
2119
+ React__default.Fragment,
1072
2120
  null,
1073
2121
  returnFormField({ name: 'email', label: 'Email', type: 'email', required: true, readonly: true, default_value: userData.email }),
1074
- React.createElement(
2122
+ React__default.createElement(
1075
2123
  Form.Row,
1076
2124
  null,
1077
2125
  returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: Col, required: false }),
1078
2126
  returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: Col, required: false })
1079
2127
  ),
1080
- React.createElement(
2128
+ React__default.createElement(
1081
2129
  Form.Row,
1082
2130
  null,
1083
2131
  returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: Col, required: true, default_value: userData.shared.first_name }),
1084
2132
  returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: Col, required: true, default_value: userData.shared.last_name })
1085
2133
  ),
1086
- React.createElement(
2134
+ React__default.createElement(
1087
2135
  Form.Row,
1088
2136
  null,
1089
2137
  returnFormField({
@@ -1098,7 +2146,7 @@ var SignupForm$1 = function SignupForm(props) {
1098
2146
  }),
1099
2147
  countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: Col, options: states, default_value: userData.shared.state })
1100
2148
  ),
1101
- React.createElement(
2149
+ React__default.createElement(
1102
2150
  Form.Row,
1103
2151
  null,
1104
2152
  countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: Col, default_value: userData.shared.zip }),
@@ -1148,29 +2196,29 @@ var SignupForm$1 = function SignupForm(props) {
1148
2196
  required: true,
1149
2197
  options: [{ label: 'By registering you agree to our <a href="/terms">Terms and Conditions</a> and <a href="/privacy">Privacy Policy</a> and understand that you will be receiving email communications', value: 'Y' }]
1150
2198
  }),
1151
- React.createElement('hr', null),
1152
- React.createElement(
2199
+ React__default.createElement('hr', null),
2200
+ React__default.createElement(
1153
2201
  Form.Row,
1154
2202
  null,
1155
- React.createElement(
2203
+ React__default.createElement(
1156
2204
  Form.Group,
1157
2205
  { as: Col },
1158
- !loading && React.createElement(
2206
+ !loading && React__default.createElement(
1159
2207
  Button,
1160
2208
  { type: 'submit' },
1161
2209
  'Update'
1162
2210
  ),
1163
- loading && React.createElement(
2211
+ loading && React__default.createElement(
1164
2212
  Button,
1165
2213
  { variant: 'primary', disabled: true },
1166
- React.createElement(Spinner, {
2214
+ React__default.createElement(Spinner, {
1167
2215
  as: 'span',
1168
2216
  animation: 'border',
1169
2217
  role: 'status',
1170
2218
  'aria-hidden': 'true',
1171
2219
  size: 'sm'
1172
2220
  }),
1173
- React.createElement(
2221
+ React__default.createElement(
1174
2222
  'span',
1175
2223
  { className: 'sr-only' },
1176
2224
  'Loading...'
@@ -1178,24 +2226,24 @@ var SignupForm$1 = function SignupForm(props) {
1178
2226
  )
1179
2227
  )
1180
2228
  )
1181
- ) : React.createElement(Spinner, {
2229
+ ) : React__default.createElement(Spinner, {
1182
2230
  as: 'span',
1183
2231
  animation: 'border',
1184
2232
  role: 'status',
1185
2233
  'aria-hidden': 'true',
1186
2234
  size: 'sm'
1187
2235
  }),
1188
- errorMsg && React.createElement(
2236
+ errorMsg && React__default.createElement(
1189
2237
  'p',
1190
2238
  { className: 'error' },
1191
2239
  errorMsg
1192
2240
  ),
1193
- successMsg && React.createElement(
2241
+ successMsg && React__default.createElement(
1194
2242
  'p',
1195
2243
  { className: 'success' },
1196
2244
  successMsg
1197
2245
  ),
1198
- React.createElement(
2246
+ React__default.createElement(
1199
2247
  'style',
1200
2248
  { jsx: 'true'.toString() },
1201
2249
  ' \n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n .success {\n color: green;\n margin: 1rem 0 0;\n }\n '
@@ -1332,7 +2380,7 @@ var isArguments = function isArguments(value) {
1332
2380
  var keysShim;
1333
2381
  if (!Object.keys) {
1334
2382
  // modified from https://github.com/es-shims/es5-shim
1335
- var has = Object.prototype.hasOwnProperty;
2383
+ var has$1 = Object.prototype.hasOwnProperty;
1336
2384
  var toStr$1 = Object.prototype.toString;
1337
2385
  var isArgs = isArguments; // eslint-disable-line global-require
1338
2386
  var isEnumerable = Object.prototype.propertyIsEnumerable;
@@ -1381,7 +2429,7 @@ if (!Object.keys) {
1381
2429
  if (typeof window === 'undefined') { return false; }
1382
2430
  for (var k in window) {
1383
2431
  try {
1384
- if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
2432
+ if (!excludedKeys['$' + k] && has$1.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
1385
2433
  try {
1386
2434
  equalsConstructorPrototype(window[k]);
1387
2435
  } catch (e) {
@@ -1418,7 +2466,7 @@ if (!Object.keys) {
1418
2466
  }
1419
2467
 
1420
2468
  var skipProto = hasProtoEnumBug && isFunction;
1421
- if (isString && object.length > 0 && !has.call(object, 0)) {
2469
+ if (isString && object.length > 0 && !has$1.call(object, 0)) {
1422
2470
  for (var i = 0; i < object.length; ++i) {
1423
2471
  theKeys.push(String(i));
1424
2472
  }
@@ -1430,7 +2478,7 @@ if (!Object.keys) {
1430
2478
  }
1431
2479
  } else {
1432
2480
  for (var name in object) {
1433
- if (!(skipProto && name === 'prototype') && has.call(object, name)) {
2481
+ if (!(skipProto && name === 'prototype') && has$1.call(object, name)) {
1434
2482
  theKeys.push(String(name));
1435
2483
  }
1436
2484
  }
@@ -1440,7 +2488,7 @@ if (!Object.keys) {
1440
2488
  var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
1441
2489
 
1442
2490
  for (var k = 0; k < dontEnums.length; ++k) {
1443
- if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
2491
+ if (!(skipConstructor && dontEnums[k] === 'constructor') && has$1.call(object, dontEnums[k])) {
1444
2492
  theKeys.push(dontEnums[k]);
1445
2493
  }
1446
2494
  }
@@ -1846,14 +2894,7 @@ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
1846
2894
  if (!allowMissing && !(parts[i] in value)) {
1847
2895
  throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
1848
2896
  }
1849
- // By convention, when a data property is converted to an accessor
1850
- // property to emulate a data property that does not suffer from
1851
- // the override mistake, that accessor's getter is marked with
1852
- // an `originalValue` property. Here, when we detect this, we
1853
- // uphold the illusion by pretending to see that original data
1854
- // property, i.e., returning the value rather than the getter
1855
- // itself.
1856
- value = desc && 'get' in desc && !('originalValue' in desc.get) ? desc.get : value[parts[i]];
2897
+ value = desc ? (desc.get || desc.value) : value[parts[i]];
1857
2898
  } else {
1858
2899
  value = value[parts[i]];
1859
2900
  }
@@ -1862,42 +2903,18 @@ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
1862
2903
  return value;
1863
2904
  };
1864
2905
 
1865
- var callBind = createCommonjsModule(function (module) {
1866
-
1867
-
1868
-
1869
-
1870
-
1871
- var $apply = GetIntrinsic('%Function.prototype.apply%');
1872
- var $call = GetIntrinsic('%Function.prototype.call%');
1873
- var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
1874
-
1875
- var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
1876
-
1877
- if ($defineProperty) {
1878
- try {
1879
- $defineProperty({}, 'a', { value: 1 });
1880
- } catch (e) {
1881
- // IE 8 has a broken defineProperty
1882
- $defineProperty = null;
1883
- }
1884
- }
2906
+ var $Function = GetIntrinsic('%Function%');
2907
+ var $apply = $Function.apply;
2908
+ var $call = $Function.call;
1885
2909
 
1886
- module.exports = function callBind() {
1887
- return $reflectApply(functionBind, $call, arguments);
2910
+ var callBind = function callBind() {
2911
+ return functionBind.apply($call, arguments);
1888
2912
  };
1889
2913
 
1890
- var applyBind = function applyBind() {
1891
- return $reflectApply(functionBind, $apply, arguments);
2914
+ var apply = function applyBind() {
2915
+ return functionBind.apply($apply, arguments);
1892
2916
  };
1893
-
1894
- if ($defineProperty) {
1895
- $defineProperty(module.exports, 'apply', { value: applyBind });
1896
- } else {
1897
- module.exports.apply = applyBind;
1898
- }
1899
- });
1900
- var callBind_1 = callBind.apply;
2917
+ callBind.apply = apply;
1901
2918
 
1902
2919
  var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
1903
2920
 
@@ -2021,7 +3038,7 @@ var Type = function Type(x) {
2021
3038
  }
2022
3039
  };
2023
3040
 
2024
- // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values
3041
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
2025
3042
 
2026
3043
  var Type$1 = function Type$1(x) {
2027
3044
  if (typeof x === 'symbol') {
@@ -2090,62 +3107,42 @@ var IsPropertyKey = function IsPropertyKey(argument) {
2090
3107
  return typeof argument === 'string' || typeof argument === 'symbol';
2091
3108
  };
2092
3109
 
2093
- var hasSymbols$3 = hasSymbols$1();
2094
- var hasToStringTag = hasSymbols$3 && typeof Symbol.toStringTag === 'symbol';
2095
- var hasOwnProperty;
2096
- var regexExec;
2097
- var isRegexMarker;
2098
- var badStringifier;
2099
-
2100
- if (hasToStringTag) {
2101
- hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
2102
- regexExec = Function.call.bind(RegExp.prototype.exec);
2103
- isRegexMarker = {};
2104
-
2105
- var throwRegexMarker = function () {
2106
- throw isRegexMarker;
2107
- };
2108
- badStringifier = {
2109
- toString: throwRegexMarker,
2110
- valueOf: throwRegexMarker
2111
- };
3110
+ var regexExec = RegExp.prototype.exec;
3111
+ var gOPD = Object.getOwnPropertyDescriptor;
2112
3112
 
2113
- if (typeof Symbol.toPrimitive === 'symbol') {
2114
- badStringifier[Symbol.toPrimitive] = throwRegexMarker;
2115
- }
2116
- }
3113
+ var tryRegexExecCall = function tryRegexExec(value) {
3114
+ try {
3115
+ var lastIndex = value.lastIndex;
3116
+ value.lastIndex = 0; // eslint-disable-line no-param-reassign
2117
3117
 
3118
+ regexExec.call(value);
3119
+ return true;
3120
+ } catch (e) {
3121
+ return false;
3122
+ } finally {
3123
+ value.lastIndex = lastIndex; // eslint-disable-line no-param-reassign
3124
+ }
3125
+ };
2118
3126
  var toStr$5 = Object.prototype.toString;
2119
- var gOPD = Object.getOwnPropertyDescriptor;
2120
3127
  var regexClass = '[object RegExp]';
3128
+ var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
2121
3129
 
2122
- var isRegex = hasToStringTag
2123
- // eslint-disable-next-line consistent-return
2124
- ? function isRegex(value) {
2125
- if (!value || typeof value !== 'object') {
2126
- return false;
2127
- }
2128
-
2129
- var descriptor = gOPD(value, 'lastIndex');
2130
- var hasLastIndexDataProperty = descriptor && hasOwnProperty(descriptor, 'value');
2131
- if (!hasLastIndexDataProperty) {
2132
- return false;
2133
- }
3130
+ var isRegex = function isRegex(value) {
3131
+ if (!value || typeof value !== 'object') {
3132
+ return false;
3133
+ }
3134
+ if (!hasToStringTag) {
3135
+ return toStr$5.call(value) === regexClass;
3136
+ }
2134
3137
 
2135
- try {
2136
- regexExec(value, badStringifier);
2137
- } catch (e) {
2138
- return e === isRegexMarker;
2139
- }
3138
+ var descriptor = gOPD(value, 'lastIndex');
3139
+ var hasLastIndexDataProperty = descriptor && src(descriptor, 'value');
3140
+ if (!hasLastIndexDataProperty) {
3141
+ return false;
2140
3142
  }
2141
- : function isRegex(value) {
2142
- // In older browsers, typeof regex incorrectly returns 'function'
2143
- if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
2144
- return false;
2145
- }
2146
3143
 
2147
- return toStr$5.call(value) === regexClass;
2148
- };
3144
+ return tryRegexExecCall(value);
3145
+ };
2149
3146
 
2150
3147
  // http://www.ecma-international.org/ecma-262/5.1/#sec-9.2
2151
3148
 
@@ -2173,27 +3170,6 @@ var IsRegExp = function IsRegExp(argument) {
2173
3170
  };
2174
3171
 
2175
3172
  var fnToStr = Function.prototype.toString;
2176
- var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
2177
- var badArrayLike;
2178
- var isCallableMarker;
2179
- if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
2180
- try {
2181
- badArrayLike = Object.defineProperty({}, 'length', {
2182
- get: function () {
2183
- throw isCallableMarker;
2184
- }
2185
- });
2186
- isCallableMarker = {};
2187
- // eslint-disable-next-line no-throw-literal
2188
- reflectApply(function () { throw 42; }, null, badArrayLike);
2189
- } catch (_) {
2190
- if (_ !== isCallableMarker) {
2191
- reflectApply = null;
2192
- }
2193
- }
2194
- } else {
2195
- reflectApply = null;
2196
- }
2197
3173
 
2198
3174
  var constructorRegex = /^\s*class\b/;
2199
3175
  var isES6ClassFn = function isES6ClassFunction(value) {
@@ -2219,27 +3195,15 @@ var fnClass = '[object Function]';
2219
3195
  var genClass = '[object GeneratorFunction]';
2220
3196
  var hasToStringTag$1 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
2221
3197
 
2222
- var isCallable = reflectApply
2223
- ? function isCallable(value) {
2224
- if (!value) { return false; }
2225
- if (typeof value !== 'function' && typeof value !== 'object') { return false; }
2226
- if (typeof value === 'function' && !value.prototype) { return true; }
2227
- try {
2228
- reflectApply(value, null, badArrayLike);
2229
- } catch (e) {
2230
- if (e !== isCallableMarker) { return false; }
2231
- }
2232
- return !isES6ClassFn(value);
2233
- }
2234
- : function isCallable(value) {
2235
- if (!value) { return false; }
2236
- if (typeof value !== 'function' && typeof value !== 'object') { return false; }
2237
- if (typeof value === 'function' && !value.prototype) { return true; }
2238
- if (hasToStringTag$1) { return tryFunctionObject(value); }
2239
- if (isES6ClassFn(value)) { return false; }
2240
- var strClass = toStr$6.call(value);
2241
- return strClass === fnClass || strClass === genClass;
2242
- };
3198
+ var isCallable = function isCallable(value) {
3199
+ if (!value) { return false; }
3200
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
3201
+ if (typeof value === 'function' && !value.prototype) { return true; }
3202
+ if (hasToStringTag$1) { return tryFunctionObject(value); }
3203
+ if (isES6ClassFn(value)) { return false; }
3204
+ var strClass = toStr$6.call(value);
3205
+ return strClass === fnClass || strClass === genClass;
3206
+ };
2243
3207
 
2244
3208
  // http://www.ecma-international.org/ecma-262/5.1/#sec-9.11
2245
3209
 
@@ -2274,7 +3238,7 @@ var ToPropertyDescriptor = function ToPropertyDescriptor(Obj) {
2274
3238
  if (src(Obj, 'get')) {
2275
3239
  var getter = Obj.get;
2276
3240
  if (typeof getter !== 'undefined' && !IsCallable(getter)) {
2277
- throw new $TypeError$2('getter must be a function');
3241
+ throw new TypeError('getter must be a function');
2278
3242
  }
2279
3243
  desc['[[Get]]'] = getter;
2280
3244
  }
@@ -2405,8 +3369,8 @@ var CreateDataProperty = function CreateDataProperty(O, P, V) {
2405
3369
  throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
2406
3370
  }
2407
3371
  var oldDesc = OrdinaryGetOwnProperty(O, P);
2408
- var extensible = !oldDesc || IsExtensible(O);
2409
- var immutable = oldDesc && (!oldDesc['[[Writable]]'] || !oldDesc['[[Configurable]]']);
3372
+ var extensible = oldDesc || IsExtensible(O);
3373
+ var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
2410
3374
  if (immutable || !extensible) {
2411
3375
  return false;
2412
3376
  }
@@ -2523,10 +3487,10 @@ var $slice = callBound('Array.prototype.slice');
2523
3487
  var $concat$1 = callBound('Array.prototype.concat');
2524
3488
  var $forEach = callBound('Array.prototype.forEach');
2525
3489
 
2526
- var hasSymbols$4 = hasSymbols$1();
3490
+ var hasSymbols$3 = hasSymbols$1();
2527
3491
 
2528
- var kCustomPromisifiedSymbol = hasSymbols$4 ? Symbol('util.promisify.custom') : null;
2529
- var kCustomPromisifyArgsSymbol = hasSymbols$4 ? Symbol('customPromisifyArgs') : null;
3492
+ var kCustomPromisifiedSymbol = hasSymbols$3 ? Symbol('util.promisify.custom') : null;
3493
+ var kCustomPromisifyArgsSymbol = hasSymbols$3 ? Symbol('customPromisifyArgs') : null;
2530
3494
 
2531
3495
  var implementation$3 = function promisify(orig) {
2532
3496
  if (typeof orig !== 'function') {
@@ -2536,7 +3500,7 @@ var implementation$3 = function promisify(orig) {
2536
3500
  throw error;
2537
3501
  }
2538
3502
 
2539
- if (hasSymbols$4 && orig[kCustomPromisifiedSymbol]) {
3503
+ if (hasSymbols$3 && orig[kCustomPromisifiedSymbol]) {
2540
3504
  var customFunction = orig[kCustomPromisifiedSymbol];
2541
3505
  if (typeof customFunction !== 'function') {
2542
3506
  throw new TypeError('The [util.promisify.custom] property must be a function');