@mjhls/mjh-framework 1.0.882 → 1.0.883-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 (288) hide show
  1. package/README.md +168 -168
  2. package/dist/cjs/AD.js +1 -1
  3. package/dist/cjs/AD300x250.js +11 -11
  4. package/dist/cjs/AD300x250x600.js +11 -11
  5. package/dist/cjs/AD728x90.js +12 -12
  6. package/dist/cjs/ADFloatingFooter.js +10 -10
  7. package/dist/cjs/ADFooter.js +3 -3
  8. package/dist/cjs/ADGutter.js +10 -10
  9. package/dist/cjs/{ADInfeed-4f661172.js → ADInfeed-2e48af77.js} +1 -1
  10. package/dist/cjs/ADSkyscraper.js +10 -10
  11. package/dist/cjs/ADSponsoredResources.js +10 -10
  12. package/dist/cjs/ADWebcast.js +10 -10
  13. package/dist/cjs/ADWelcome.js +10 -10
  14. package/dist/cjs/{ADlgInfeed-6242e5b5.js → ADlgInfeed-c39c7131.js} +1 -1
  15. package/dist/cjs/AccordionPanel.js +4 -4
  16. package/dist/cjs/AdSlot.js +10 -10
  17. package/dist/cjs/AdSlotsProvider.js +903 -10
  18. package/dist/cjs/AlgoliaSearch.js +264 -391
  19. package/dist/cjs/AlphabeticList.js +6 -6
  20. package/dist/cjs/ArticleCarousel.js +6 -6
  21. package/dist/cjs/ArticleProgramLandingPage.js +25 -25
  22. package/dist/cjs/ArticleSeriesLandingPage.js +22 -22
  23. package/dist/cjs/ArticleSeriesListing.js +16 -16
  24. package/dist/cjs/Auth.js +1297 -469
  25. package/dist/cjs/AuthWrapper.js +390 -1697
  26. package/dist/cjs/{AuthorComponent-421d5ec1.js → AuthorComponent-02e827ae.js} +1 -1
  27. package/dist/cjs/Beam.js +5 -5
  28. package/dist/cjs/{BlockContent-bac780ac.js → BlockContent-091a991f.js} +1 -1
  29. package/dist/cjs/Breadcrumbs.js +3 -3
  30. package/dist/cjs/CMEDeck.js +12 -12
  31. package/dist/cjs/Column2.js +6 -6
  32. package/dist/cjs/Column3.js +14 -14
  33. package/dist/cjs/ConferenceArticleCard.js +20 -20
  34. package/dist/cjs/DeckContent.js +30 -30
  35. package/dist/cjs/DeckQueue.js +19 -19
  36. package/dist/cjs/DeckQueuePaginated.js +339 -0
  37. package/dist/cjs/{Dfp-ab12cd55.js → Dfp-f492f985.js} +8 -8
  38. package/dist/cjs/EventsDeck.js +31 -31
  39. package/dist/cjs/ExternalResources.js +25 -25
  40. package/dist/cjs/Feature.js +6 -6
  41. package/dist/cjs/ForbesHero.js +6 -6
  42. package/dist/cjs/GridContent.js +27 -27
  43. package/dist/cjs/GridHero.js +7 -7
  44. package/dist/cjs/GroupDeck.js +6 -6
  45. package/dist/cjs/HamMagazine.js +23 -23
  46. package/dist/cjs/Hero.js +5 -5
  47. package/dist/cjs/HighlightenVideo.js +1 -1
  48. package/dist/cjs/HorizontalArticleListing.js +24 -24
  49. package/dist/cjs/HorizontalHero.js +6 -6
  50. package/dist/cjs/IssueContentDeck.js +6 -6
  51. package/dist/cjs/IssueDeck.js +8 -8
  52. package/dist/cjs/IssueLanding.js +58 -58
  53. package/dist/cjs/KMTracker.js +15 -15
  54. package/dist/cjs/LeftNav.js +10 -10
  55. package/dist/cjs/MasterDeck.js +30 -30
  56. package/dist/cjs/MasterDeckPaginated.js +443 -0
  57. package/dist/cjs/MediaSeriesCard-c6a6bfd3.js +9411 -0
  58. package/dist/cjs/MediaSeriesLanding.js +53 -9534
  59. package/dist/cjs/MediaSeriesLandingPaginated.js +521 -0
  60. package/dist/cjs/NavDvm.js +5 -5
  61. package/dist/cjs/NavMagazine.js +22 -22
  62. package/dist/cjs/NavNative.js +19 -19
  63. package/dist/cjs/OncliveHero.js +6 -5
  64. package/dist/cjs/OncliveLargeHero.js +7 -7
  65. package/dist/cjs/PageFilter.js +3 -3
  66. package/dist/cjs/Pagination-f3ef7bc1.js +59 -0
  67. package/dist/cjs/PartnerDetailListing.js +1233 -160
  68. package/dist/cjs/PdfDownload.js +1 -1
  69. package/dist/cjs/PopUpModal.js +3 -3
  70. package/dist/cjs/PubSection.js +19 -19
  71. package/dist/cjs/PubToc.js +5 -5
  72. package/dist/cjs/PublicationDeck.js +5 -5
  73. package/dist/cjs/PublicationLanding.js +34 -34
  74. package/dist/cjs/QueueDeckExpanded.js +21 -21
  75. package/dist/cjs/QueueDeckExpandedPaginated.js +1377 -0
  76. package/dist/cjs/RecentNews.js +1 -1
  77. package/dist/cjs/RelatedContent.js +33 -33
  78. package/dist/cjs/RelatedTopicsDropdown.js +10 -10
  79. package/dist/cjs/Search.js +3 -3
  80. package/dist/cjs/Segment.js +4 -4
  81. package/dist/cjs/SeriesListingDeck.js +10 -10
  82. package/dist/cjs/{SeriesSlider-372e418f.js → SeriesSlider-49b81b0b.js} +11 -11
  83. package/dist/cjs/SideFooter.js +8 -8
  84. package/dist/cjs/{SocialSearchComponent-80a2130a.js → SocialSearchComponent-e8477ca3.js} +7 -7
  85. package/dist/cjs/TaxonomyCard.js +6 -6
  86. package/dist/cjs/TaxonomyDescription.js +24 -24
  87. package/dist/cjs/TemplateNormal.js +16 -16
  88. package/dist/cjs/ThumbnailCard.js +5 -5
  89. package/dist/cjs/Ustream.js +10 -10
  90. package/dist/cjs/VerticalHero.js +5 -5
  91. package/dist/cjs/VideoProgramLandingPage.js +25 -25
  92. package/dist/cjs/VideoSeriesCard.js +9 -9
  93. package/dist/cjs/VideoSeriesFilter.js +5 -5
  94. package/dist/cjs/VideoSeriesLandingPage.js +23 -23
  95. package/dist/cjs/VideoSeriesListing.js +16 -16
  96. package/dist/cjs/View.js +63 -63
  97. package/dist/cjs/YahooHero.js +7 -7
  98. package/dist/cjs/YoutubeGroup.js +14 -14
  99. package/dist/cjs/{_is-array-bd978497.js → _is-array-aa52fa1e.js} +1 -1
  100. package/dist/cjs/{_iter-detect-ee3d4802.js → _iter-detect-05795553.js} +1 -1
  101. package/dist/cjs/{_object-sap-fee50a62.js → _object-sap-171b9ea5.js} +1 -1
  102. package/dist/cjs/{_object-to-array-18379aba.js → _object-to-array-9bac8737.js} +1 -1
  103. package/dist/cjs/{asyncToGenerator-15014394.js → asyncToGenerator-df19209d.js} +3 -3
  104. package/dist/cjs/{brightcove-react-player-loader.es-05029198.js → brightcove-react-player-loader.es-156bd4d6.js} +3 -4
  105. package/dist/cjs/{core.get-iterator-method-5cb3af28.js → core.get-iterator-method-f3c44602.js} +2 -2
  106. package/dist/cjs/{debounce-6191c8ee.js → debounce-529c8d06.js} +1 -1
  107. package/dist/cjs/{define-property-530a5e9e.js → define-property-21887c62.js} +1 -1
  108. package/dist/cjs/{defineProperty-5ca424cd.js → defineProperty-77a37684.js} +1 -1
  109. package/dist/cjs/{entities-fb0c6568.js → entities-310b46ee.js} +0 -4
  110. package/dist/cjs/{extends-1d905ddb.js → extends-eed4f016.js} +1 -1
  111. package/dist/cjs/faundadb.js +5 -5
  112. package/dist/cjs/getRelatedArticle.js +4 -4
  113. package/dist/cjs/getRootDocGroup.js +4 -4
  114. package/dist/cjs/getSerializers.js +24 -24
  115. package/dist/cjs/{getTargeting-41f2f52d.js → getTargeting-8874437b.js} +11 -11
  116. package/dist/cjs/getTargeting.js +5 -5
  117. package/dist/cjs/{index-79eed652.js → index-3294d3bc.js} +40 -39
  118. package/dist/cjs/{index-cdd88325.js → index-396089c0.js} +504 -514
  119. package/dist/cjs/{index-ff69979f.js → index-be0c82be.js} +22 -28
  120. package/dist/cjs/{index-53e27416.js → index-e2e62963.js} +9 -25
  121. package/dist/cjs/{index.es-e9d84959.js → index.es-9110add6.js} +5 -23
  122. package/dist/cjs/{index.esm-bf016399.js → index.esm-4d410430.js} +3 -2
  123. package/dist/cjs/{index.esm-974f47d9.js → index.esm-90433435.js} +15 -6
  124. package/dist/cjs/{index.esm-44f3e2d0.js → index.esm-e32d3e8e.js} +6 -3
  125. package/dist/cjs/{index.esm-05850a2f.js → index.esm-ff47db6f.js} +12 -5
  126. package/dist/cjs/index.js +41 -43
  127. package/dist/cjs/inherits-8d29278d.js +110 -0
  128. package/dist/cjs/{inherits-337c73a7.js → inherits-cba9c846.js} +7 -7
  129. package/dist/cjs/{keys-91f31941.js → keys-d207942e.js} +2 -2
  130. package/dist/cjs/{lodash-b5e0d5f6.js → lodash-fc2922d0.js} +30 -127
  131. package/dist/cjs/main-02daeefe.js +862 -0
  132. package/dist/cjs/{md5-e1ca5797.js → md5-5039b1a6.js} +1 -1
  133. package/dist/cjs/{moment-ca3bd9fb.js → moment-575fe24c.js} +8 -10
  134. package/dist/cjs/{slicedToArray-0a78cdf3.js → slicedToArray-f6d4eaa8.js} +2 -2
  135. package/dist/cjs/{stringify-13405ce2.js → stringify-bbc68047.js} +1 -1
  136. package/dist/cjs/timeDifferenceCalc.js +1 -1
  137. package/dist/cjs/{toConsumableArray-39fd0757.js → toConsumableArray-c9b8a0d0.js} +2 -2
  138. package/dist/cjs/{toNumber-f2f8744b.js → toNumber-36d1e7e5.js} +4 -39
  139. package/dist/cjs/{typeof-3dd6d3df.js → typeof-5f52cf64.js} +3 -3
  140. package/dist/cjs/urlFor.js +4 -4
  141. package/dist/cjs/{ustream-api-5619c1fa.js → ustream-api-9ebe112f.js} +4 -4
  142. package/dist/cjs/{web.dom.iterable-a9359910.js → web.dom.iterable-e34bf324.js} +1 -1
  143. package/dist/esm/AD.js +1 -1
  144. package/dist/esm/AD300x250.js +11 -11
  145. package/dist/esm/AD300x250x600.js +11 -11
  146. package/dist/esm/AD728x90.js +12 -12
  147. package/dist/esm/ADFloatingFooter.js +10 -10
  148. package/dist/esm/ADFooter.js +3 -3
  149. package/dist/esm/ADGutter.js +10 -10
  150. package/dist/esm/{ADInfeed-7db96917.js → ADInfeed-d767ebe2.js} +3 -3
  151. package/dist/esm/ADSkyscraper.js +10 -10
  152. package/dist/esm/ADSponsoredResources.js +10 -10
  153. package/dist/esm/ADWebcast.js +10 -10
  154. package/dist/esm/ADWelcome.js +10 -10
  155. package/dist/esm/{ADlgInfeed-a3931e68.js → ADlgInfeed-cee95aa2.js} +1 -1
  156. package/dist/esm/AccordionPanel.js +4 -4
  157. package/dist/esm/AdSlot.js +10 -10
  158. package/dist/esm/AdSlotsProvider.js +905 -13
  159. package/dist/esm/AlgoliaSearch.js +32 -159
  160. package/dist/esm/AlphabeticList.js +6 -6
  161. package/dist/esm/ArticleCarousel.js +6 -6
  162. package/dist/esm/ArticleProgramLandingPage.js +25 -25
  163. package/dist/esm/ArticleSeriesLandingPage.js +22 -22
  164. package/dist/esm/ArticleSeriesListing.js +18 -18
  165. package/dist/esm/Auth.js +1297 -469
  166. package/dist/esm/AuthWrapper.js +385 -1692
  167. package/dist/esm/{AuthorComponent-2277b67c.js → AuthorComponent-e6f95c2f.js} +1 -1
  168. package/dist/esm/Beam.js +5 -5
  169. package/dist/esm/{BlockContent-ea93e8f7.js → BlockContent-e9b4ddcf.js} +1 -1
  170. package/dist/esm/Breadcrumbs.js +3 -3
  171. package/dist/esm/CMEDeck.js +12 -12
  172. package/dist/esm/Column1.js +4 -4
  173. package/dist/esm/Column2.js +11 -11
  174. package/dist/esm/Column3.js +20 -20
  175. package/dist/esm/ConferenceArticleCard.js +20 -20
  176. package/dist/esm/DeckContent.js +45 -45
  177. package/dist/esm/DeckQueue.js +37 -37
  178. package/dist/esm/DeckQueuePaginated.js +333 -0
  179. package/dist/esm/{Dfp-d6a5629f.js → Dfp-f867d061.js} +5 -5
  180. package/dist/esm/EventsDeck.js +57 -57
  181. package/dist/esm/ExternalResources.js +27 -27
  182. package/dist/esm/Feature.js +6 -6
  183. package/dist/esm/ForbesHero.js +6 -6
  184. package/dist/esm/GridContent.js +71 -71
  185. package/dist/esm/GridHero.js +7 -7
  186. package/dist/esm/GroupDeck.js +6 -6
  187. package/dist/esm/HamMagazine.js +26 -26
  188. package/dist/esm/Hero.js +5 -5
  189. package/dist/esm/HighlightenVideo.js +1 -1
  190. package/dist/esm/HorizontalArticleListing.js +24 -24
  191. package/dist/esm/HorizontalHero.js +6 -6
  192. package/dist/esm/IssueContentDeck.js +20 -20
  193. package/dist/esm/IssueDeck.js +30 -30
  194. package/dist/esm/IssueLanding.js +58 -58
  195. package/dist/esm/KMTracker.js +15 -15
  196. package/dist/esm/LeftNav.js +10 -10
  197. package/dist/esm/MasterDeck.js +33 -33
  198. package/dist/esm/MasterDeckPaginated.js +437 -0
  199. package/dist/esm/MediaSeriesCard-1dd7eae8.js +9403 -0
  200. package/dist/esm/MediaSeriesLanding.js +53 -9533
  201. package/dist/esm/MediaSeriesLandingPaginated.js +516 -0
  202. package/dist/esm/NavDvm.js +8 -8
  203. package/dist/esm/NavMagazine.js +25 -25
  204. package/dist/esm/NavNative.js +24 -24
  205. package/dist/esm/OncliveHero.js +6 -5
  206. package/dist/esm/OncliveLargeHero.js +7 -7
  207. package/dist/esm/PageFilter.js +3 -3
  208. package/dist/esm/Pagination-a24855d4.js +54 -0
  209. package/dist/esm/PartnerDetailListing.js +1234 -161
  210. package/dist/esm/PdfDownload.js +1 -1
  211. package/dist/esm/PopUpModal.js +3 -3
  212. package/dist/esm/PubSection.js +19 -19
  213. package/dist/esm/PubToc.js +5 -5
  214. package/dist/esm/PublicationDeck.js +23 -23
  215. package/dist/esm/PublicationLanding.js +56 -56
  216. package/dist/esm/QueueDeckExpanded.js +21 -21
  217. package/dist/esm/QueueDeckExpandedPaginated.js +1371 -0
  218. package/dist/esm/RecentNews.js +1 -1
  219. package/dist/esm/RelatedContent.js +33 -33
  220. package/dist/esm/RelatedTopicsDropdown.js +10 -10
  221. package/dist/esm/RolesDeck.js +12 -12
  222. package/dist/esm/Search.js +5 -5
  223. package/dist/esm/Segment.js +4 -4
  224. package/dist/esm/SeriesListingDeck.js +10 -10
  225. package/dist/esm/{SeriesSlider-88c4133d.js → SeriesSlider-ce19fa25.js} +11 -11
  226. package/dist/esm/SideFooter.js +8 -8
  227. package/dist/esm/{SocialSearchComponent-7f3d6531.js → SocialSearchComponent-dca69151.js} +10 -10
  228. package/dist/esm/TaxonomyCard.js +22 -22
  229. package/dist/esm/TaxonomyDescription.js +24 -24
  230. package/dist/esm/TemplateNormal.js +19 -19
  231. package/dist/esm/ThumbnailCard.js +5 -5
  232. package/dist/esm/Ustream.js +10 -10
  233. package/dist/esm/VerticalHero.js +5 -5
  234. package/dist/esm/VideoProgramLandingPage.js +30 -30
  235. package/dist/esm/VideoSeriesCard.js +8 -8
  236. package/dist/esm/VideoSeriesFilter.js +5 -5
  237. package/dist/esm/VideoSeriesLandingPage.js +22 -22
  238. package/dist/esm/VideoSeriesListing.js +19 -19
  239. package/dist/esm/View.js +38 -38
  240. package/dist/esm/YahooHero.js +7 -7
  241. package/dist/esm/YoutubeGroup.js +14 -14
  242. package/dist/esm/{_is-array-8914b83f.js → _is-array-4df618a6.js} +1 -1
  243. package/dist/esm/{_iter-detect-13e31915.js → _iter-detect-130ee549.js} +1 -1
  244. package/dist/esm/{_object-sap-fc9da7e8.js → _object-sap-8b8ea5a9.js} +1 -1
  245. package/dist/esm/{_object-to-array-ee8f6d98.js → _object-to-array-c54dd835.js} +1 -1
  246. package/dist/esm/{asyncToGenerator-40371743.js → asyncToGenerator-7bf8bc4d.js} +3 -3
  247. package/dist/esm/{brightcove-react-player-loader.es-e761d404.js → brightcove-react-player-loader.es-83f53e4e.js} +3 -4
  248. package/dist/esm/{core.get-iterator-method-0fb60d94.js → core.get-iterator-method-86d4db69.js} +2 -2
  249. package/dist/esm/{debounce-89969f66.js → debounce-9207d8ee.js} +1 -1
  250. package/dist/esm/{define-property-73034847.js → define-property-6d26cb48.js} +1 -1
  251. package/dist/esm/{defineProperty-e66a2c7c.js → defineProperty-d7d9b577.js} +1 -1
  252. package/dist/esm/{entities-731f3fdb.js → entities-7cc3bf45.js} +0 -4
  253. package/dist/esm/{extends-9a61581c.js → extends-5b1796d4.js} +1 -1
  254. package/dist/esm/faundadb.js +5 -5
  255. package/dist/esm/getRelatedArticle.js +4 -4
  256. package/dist/esm/getRootDocGroup.js +4 -4
  257. package/dist/esm/getSerializers.js +24 -24
  258. package/dist/esm/{getTargeting-e6820763.js → getTargeting-277c801e.js} +11 -11
  259. package/dist/esm/getTargeting.js +5 -5
  260. package/dist/esm/{index-f7fdcc91.js → index-73819142.js} +22 -28
  261. package/dist/esm/{index-637e8f49.js → index-aaa2dae0.js} +10 -25
  262. package/dist/esm/{index-0b6db187.js → index-d1476645.js} +523 -533
  263. package/dist/esm/{index-511bdaa5.js → index-ef6d5dcf.js} +40 -39
  264. package/dist/esm/{index.es-a6137319.js → index.es-29c1cef5.js} +5 -23
  265. package/dist/esm/{index.esm-3fdda599.js → index.esm-29e48d38.js} +15 -6
  266. package/dist/esm/{index.esm-a8ff922c.js → index.esm-cf08bf18.js} +12 -5
  267. package/dist/esm/{index.esm-c6715e80.js → index.esm-f8aaeeeb.js} +6 -3
  268. package/dist/esm/{index.esm-ed50151c.js → index.esm-fd746768.js} +3 -2
  269. package/dist/esm/index.js +46 -48
  270. package/dist/esm/{inherits-eeaf6740.js → inherits-2409637d.js} +4 -4
  271. package/dist/esm/inherits-77d5e4fc.js +101 -0
  272. package/dist/esm/{keys-a5ffafe7.js → keys-69989821.js} +2 -2
  273. package/dist/esm/{lodash-a818d390.js → lodash-17fdfebb.js} +30 -127
  274. package/dist/esm/main-c0612122.js +851 -0
  275. package/dist/esm/{md5-4e42248e.js → md5-9be0e905.js} +1 -1
  276. package/dist/esm/{moment-b6f49411.js → moment-e2f9b20c.js} +8 -10
  277. package/dist/esm/{slicedToArray-9c3bb613.js → slicedToArray-67a08c9c.js} +2 -2
  278. package/dist/esm/{stringify-ebc16384.js → stringify-70b72959.js} +1 -1
  279. package/dist/esm/timeDifferenceCalc.js +1 -1
  280. package/dist/esm/{toConsumableArray-e333293f.js → toConsumableArray-32282905.js} +2 -2
  281. package/dist/esm/{toNumber-e3dcad26.js → toNumber-2f7a84cd.js} +4 -39
  282. package/dist/esm/{typeof-938ae770.js → typeof-c05a82ba.js} +3 -3
  283. package/dist/esm/urlFor.js +4 -4
  284. package/dist/esm/{ustream-api-d325d196.js → ustream-api-4c4fe0ba.js} +4 -4
  285. package/dist/esm/{web.dom.iterable-6b037ff9.js → web.dom.iterable-f8f967cd.js} +1 -1
  286. package/package.json +112 -111
  287. package/dist/cjs/main-bc7d4bf8.js +0 -972
  288. package/dist/esm/main-ede573ee.js +0 -961
@@ -3,1062 +3,55 @@
3
3
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
4
 
5
5
  var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
6
- require('./core.get-iterator-method-5cb3af28.js');
7
- require('./web.dom.iterable-a9359910.js');
6
+ require('./core.get-iterator-method-f3c44602.js');
7
+ require('./web.dom.iterable-e34bf324.js');
8
8
  var React = require('react');
9
9
  var React__default = _interopDefault(React);
10
- var slicedToArray$1 = require('./slicedToArray-0a78cdf3.js');
10
+ var slicedToArray = require('./slicedToArray-f6d4eaa8.js');
11
11
  var reactBootstrap = require('react-bootstrap');
12
12
  var styleInject_es = require('./style-inject.es-dcee06b6.js');
13
13
 
14
- var interopRequireDefault = _commonjsHelpers.createCommonjsModule(function (module) {
15
- function _interopRequireDefault(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- "default": obj
18
- };
19
- }
20
-
21
- module.exports = _interopRequireDefault;
22
- module.exports["default"] = module.exports, module.exports.__esModule = true;
23
- });
24
-
25
- _commonjsHelpers.unwrapExports(interopRequireDefault);
26
-
27
- var _typeof_1 = _commonjsHelpers.createCommonjsModule(function (module) {
28
- function _typeof(obj) {
29
- "@babel/helpers - typeof";
30
-
31
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
32
- module.exports = _typeof = function _typeof(obj) {
33
- return typeof obj;
34
- };
35
-
36
- module.exports["default"] = module.exports, module.exports.__esModule = true;
37
- } else {
38
- module.exports = _typeof = function _typeof(obj) {
39
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
40
- };
41
-
42
- module.exports["default"] = module.exports, module.exports.__esModule = true;
43
- }
44
-
45
- return _typeof(obj);
46
- }
47
-
48
- module.exports = _typeof;
49
- module.exports["default"] = module.exports, module.exports.__esModule = true;
50
- });
51
-
52
- _commonjsHelpers.unwrapExports(_typeof_1);
53
-
54
- var runtime_1 = _commonjsHelpers.createCommonjsModule(function (module) {
55
- /**
56
- * Copyright (c) 2014-present, Facebook, Inc.
57
- *
58
- * This source code is licensed under the MIT license found in the
59
- * LICENSE file in the root directory of this source tree.
60
- */
61
-
62
- var runtime = (function (exports) {
63
-
64
- var Op = Object.prototype;
65
- var hasOwn = Op.hasOwnProperty;
66
- var undefined$1; // More compressible than void 0.
67
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
68
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
69
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
70
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
71
-
72
- function define(obj, key, value) {
73
- Object.defineProperty(obj, key, {
74
- value: value,
75
- enumerable: true,
76
- configurable: true,
77
- writable: true
78
- });
79
- return obj[key];
80
- }
81
- try {
82
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
83
- define({}, "");
84
- } catch (err) {
85
- define = function(obj, key, value) {
86
- return obj[key] = value;
87
- };
88
- }
89
-
90
- function wrap(innerFn, outerFn, self, tryLocsList) {
91
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
92
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
93
- var generator = Object.create(protoGenerator.prototype);
94
- var context = new Context(tryLocsList || []);
95
-
96
- // The ._invoke method unifies the implementations of the .next,
97
- // .throw, and .return methods.
98
- generator._invoke = makeInvokeMethod(innerFn, self, context);
99
-
100
- return generator;
101
- }
102
- exports.wrap = wrap;
103
-
104
- // Try/catch helper to minimize deoptimizations. Returns a completion
105
- // record like context.tryEntries[i].completion. This interface could
106
- // have been (and was previously) designed to take a closure to be
107
- // invoked without arguments, but in all the cases we care about we
108
- // already have an existing method we want to call, so there's no need
109
- // to create a new function object. We can even get away with assuming
110
- // the method takes exactly one argument, since that happens to be true
111
- // in every case, so we don't have to touch the arguments object. The
112
- // only additional allocation required is the completion record, which
113
- // has a stable shape and so hopefully should be cheap to allocate.
114
- function tryCatch(fn, obj, arg) {
115
- try {
116
- return { type: "normal", arg: fn.call(obj, arg) };
117
- } catch (err) {
118
- return { type: "throw", arg: err };
119
- }
120
- }
121
-
122
- var GenStateSuspendedStart = "suspendedStart";
123
- var GenStateSuspendedYield = "suspendedYield";
124
- var GenStateExecuting = "executing";
125
- var GenStateCompleted = "completed";
126
-
127
- // Returning this object from the innerFn has the same effect as
128
- // breaking out of the dispatch switch statement.
129
- var ContinueSentinel = {};
130
-
131
- // Dummy constructor functions that we use as the .constructor and
132
- // .constructor.prototype properties for functions that return Generator
133
- // objects. For full spec compliance, you may wish to configure your
134
- // minifier not to mangle the names of these two functions.
135
- function Generator() {}
136
- function GeneratorFunction() {}
137
- function GeneratorFunctionPrototype() {}
138
-
139
- // This is a polyfill for %IteratorPrototype% for environments that
140
- // don't natively support it.
141
- var IteratorPrototype = {};
142
- IteratorPrototype[iteratorSymbol] = function () {
143
- return this;
144
- };
145
-
146
- var getProto = Object.getPrototypeOf;
147
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
148
- if (NativeIteratorPrototype &&
149
- NativeIteratorPrototype !== Op &&
150
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
151
- // This environment has a native %IteratorPrototype%; use it instead
152
- // of the polyfill.
153
- IteratorPrototype = NativeIteratorPrototype;
154
- }
155
-
156
- var Gp = GeneratorFunctionPrototype.prototype =
157
- Generator.prototype = Object.create(IteratorPrototype);
158
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
159
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
160
- GeneratorFunction.displayName = define(
161
- GeneratorFunctionPrototype,
162
- toStringTagSymbol,
163
- "GeneratorFunction"
164
- );
165
-
166
- // Helper for defining the .next, .throw, and .return methods of the
167
- // Iterator interface in terms of a single ._invoke method.
168
- function defineIteratorMethods(prototype) {
169
- ["next", "throw", "return"].forEach(function(method) {
170
- define(prototype, method, function(arg) {
171
- return this._invoke(method, arg);
172
- });
173
- });
174
- }
175
-
176
- exports.isGeneratorFunction = function(genFun) {
177
- var ctor = typeof genFun === "function" && genFun.constructor;
178
- return ctor
179
- ? ctor === GeneratorFunction ||
180
- // For the native GeneratorFunction constructor, the best we can
181
- // do is to check its .name property.
182
- (ctor.displayName || ctor.name) === "GeneratorFunction"
183
- : false;
184
- };
185
-
186
- exports.mark = function(genFun) {
187
- if (Object.setPrototypeOf) {
188
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
189
- } else {
190
- genFun.__proto__ = GeneratorFunctionPrototype;
191
- define(genFun, toStringTagSymbol, "GeneratorFunction");
192
- }
193
- genFun.prototype = Object.create(Gp);
194
- return genFun;
195
- };
196
-
197
- // Within the body of any async function, `await x` is transformed to
198
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
199
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
200
- // meant to be awaited.
201
- exports.awrap = function(arg) {
202
- return { __await: arg };
203
- };
204
-
205
- function AsyncIterator(generator, PromiseImpl) {
206
- function invoke(method, arg, resolve, reject) {
207
- var record = tryCatch(generator[method], generator, arg);
208
- if (record.type === "throw") {
209
- reject(record.arg);
210
- } else {
211
- var result = record.arg;
212
- var value = result.value;
213
- if (value &&
214
- typeof value === "object" &&
215
- hasOwn.call(value, "__await")) {
216
- return PromiseImpl.resolve(value.__await).then(function(value) {
217
- invoke("next", value, resolve, reject);
218
- }, function(err) {
219
- invoke("throw", err, resolve, reject);
220
- });
221
- }
222
-
223
- return PromiseImpl.resolve(value).then(function(unwrapped) {
224
- // When a yielded Promise is resolved, its final value becomes
225
- // the .value of the Promise<{value,done}> result for the
226
- // current iteration.
227
- result.value = unwrapped;
228
- resolve(result);
229
- }, function(error) {
230
- // If a rejected Promise was yielded, throw the rejection back
231
- // into the async generator function so it can be handled there.
232
- return invoke("throw", error, resolve, reject);
233
- });
234
- }
235
- }
236
-
237
- var previousPromise;
238
-
239
- function enqueue(method, arg) {
240
- function callInvokeWithMethodAndArg() {
241
- return new PromiseImpl(function(resolve, reject) {
242
- invoke(method, arg, resolve, reject);
243
- });
244
- }
245
-
246
- return previousPromise =
247
- // If enqueue has been called before, then we want to wait until
248
- // all previous Promises have been resolved before calling invoke,
249
- // so that results are always delivered in the correct order. If
250
- // enqueue has not been called before, then it is important to
251
- // call invoke immediately, without waiting on a callback to fire,
252
- // so that the async generator function has the opportunity to do
253
- // any necessary setup in a predictable way. This predictability
254
- // is why the Promise constructor synchronously invokes its
255
- // executor callback, and why async functions synchronously
256
- // execute code before the first await. Since we implement simple
257
- // async functions in terms of async generators, it is especially
258
- // important to get this right, even though it requires care.
259
- previousPromise ? previousPromise.then(
260
- callInvokeWithMethodAndArg,
261
- // Avoid propagating failures to Promises returned by later
262
- // invocations of the iterator.
263
- callInvokeWithMethodAndArg
264
- ) : callInvokeWithMethodAndArg();
265
- }
266
-
267
- // Define the unified helper method that is used to implement .next,
268
- // .throw, and .return (see defineIteratorMethods).
269
- this._invoke = enqueue;
270
- }
271
-
272
- defineIteratorMethods(AsyncIterator.prototype);
273
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
274
- return this;
275
- };
276
- exports.AsyncIterator = AsyncIterator;
277
-
278
- // Note that simple async functions are implemented on top of
279
- // AsyncIterator objects; they just return a Promise for the value of
280
- // the final result produced by the iterator.
281
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
282
- if (PromiseImpl === void 0) PromiseImpl = Promise;
283
-
284
- var iter = new AsyncIterator(
285
- wrap(innerFn, outerFn, self, tryLocsList),
286
- PromiseImpl
287
- );
288
-
289
- return exports.isGeneratorFunction(outerFn)
290
- ? iter // If outerFn is a generator, return the full iterator.
291
- : iter.next().then(function(result) {
292
- return result.done ? result.value : iter.next();
293
- });
294
- };
295
-
296
- function makeInvokeMethod(innerFn, self, context) {
297
- var state = GenStateSuspendedStart;
298
-
299
- return function invoke(method, arg) {
300
- if (state === GenStateExecuting) {
301
- throw new Error("Generator is already running");
302
- }
303
-
304
- if (state === GenStateCompleted) {
305
- if (method === "throw") {
306
- throw arg;
307
- }
308
-
309
- // Be forgiving, per 25.3.3.3.3 of the spec:
310
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
311
- return doneResult();
312
- }
313
-
314
- context.method = method;
315
- context.arg = arg;
316
-
317
- while (true) {
318
- var delegate = context.delegate;
319
- if (delegate) {
320
- var delegateResult = maybeInvokeDelegate(delegate, context);
321
- if (delegateResult) {
322
- if (delegateResult === ContinueSentinel) continue;
323
- return delegateResult;
324
- }
325
- }
326
-
327
- if (context.method === "next") {
328
- // Setting context._sent for legacy support of Babel's
329
- // function.sent implementation.
330
- context.sent = context._sent = context.arg;
331
-
332
- } else if (context.method === "throw") {
333
- if (state === GenStateSuspendedStart) {
334
- state = GenStateCompleted;
335
- throw context.arg;
336
- }
337
-
338
- context.dispatchException(context.arg);
339
-
340
- } else if (context.method === "return") {
341
- context.abrupt("return", context.arg);
342
- }
343
-
344
- state = GenStateExecuting;
345
-
346
- var record = tryCatch(innerFn, self, context);
347
- if (record.type === "normal") {
348
- // If an exception is thrown from innerFn, we leave state ===
349
- // GenStateExecuting and loop back for another invocation.
350
- state = context.done
351
- ? GenStateCompleted
352
- : GenStateSuspendedYield;
353
-
354
- if (record.arg === ContinueSentinel) {
355
- continue;
356
- }
357
-
358
- return {
359
- value: record.arg,
360
- done: context.done
361
- };
362
-
363
- } else if (record.type === "throw") {
364
- state = GenStateCompleted;
365
- // Dispatch the exception by looping back around to the
366
- // context.dispatchException(context.arg) call above.
367
- context.method = "throw";
368
- context.arg = record.arg;
369
- }
370
- }
371
- };
372
- }
373
-
374
- // Call delegate.iterator[context.method](context.arg) and handle the
375
- // result, either by returning a { value, done } result from the
376
- // delegate iterator, or by modifying context.method and context.arg,
377
- // setting context.delegate to null, and returning the ContinueSentinel.
378
- function maybeInvokeDelegate(delegate, context) {
379
- var method = delegate.iterator[context.method];
380
- if (method === undefined$1) {
381
- // A .throw or .return when the delegate iterator has no .throw
382
- // method always terminates the yield* loop.
383
- context.delegate = null;
384
-
385
- if (context.method === "throw") {
386
- // Note: ["return"] must be used for ES3 parsing compatibility.
387
- if (delegate.iterator["return"]) {
388
- // If the delegate iterator has a return method, give it a
389
- // chance to clean up.
390
- context.method = "return";
391
- context.arg = undefined$1;
392
- maybeInvokeDelegate(delegate, context);
393
-
394
- if (context.method === "throw") {
395
- // If maybeInvokeDelegate(context) changed context.method from
396
- // "return" to "throw", let that override the TypeError below.
397
- return ContinueSentinel;
398
- }
399
- }
400
-
401
- context.method = "throw";
402
- context.arg = new TypeError(
403
- "The iterator does not provide a 'throw' method");
404
- }
405
-
406
- return ContinueSentinel;
407
- }
408
-
409
- var record = tryCatch(method, delegate.iterator, context.arg);
410
-
411
- if (record.type === "throw") {
412
- context.method = "throw";
413
- context.arg = record.arg;
414
- context.delegate = null;
415
- return ContinueSentinel;
416
- }
417
-
418
- var info = record.arg;
419
-
420
- if (! info) {
421
- context.method = "throw";
422
- context.arg = new TypeError("iterator result is not an object");
423
- context.delegate = null;
424
- return ContinueSentinel;
425
- }
426
-
427
- if (info.done) {
428
- // Assign the result of the finished delegate to the temporary
429
- // variable specified by delegate.resultName (see delegateYield).
430
- context[delegate.resultName] = info.value;
431
-
432
- // Resume execution at the desired location (see delegateYield).
433
- context.next = delegate.nextLoc;
434
-
435
- // If context.method was "throw" but the delegate handled the
436
- // exception, let the outer generator proceed normally. If
437
- // context.method was "next", forget context.arg since it has been
438
- // "consumed" by the delegate iterator. If context.method was
439
- // "return", allow the original .return call to continue in the
440
- // outer generator.
441
- if (context.method !== "return") {
442
- context.method = "next";
443
- context.arg = undefined$1;
444
- }
445
-
446
- } else {
447
- // Re-yield the result returned by the delegate method.
448
- return info;
449
- }
450
-
451
- // The delegate iterator is finished, so forget it and continue with
452
- // the outer generator.
453
- context.delegate = null;
454
- return ContinueSentinel;
455
- }
456
-
457
- // Define Generator.prototype.{next,throw,return} in terms of the
458
- // unified ._invoke helper method.
459
- defineIteratorMethods(Gp);
460
-
461
- define(Gp, toStringTagSymbol, "Generator");
462
-
463
- // A Generator should always return itself as the iterator object when the
464
- // @@iterator function is called on it. Some browsers' implementations of the
465
- // iterator prototype chain incorrectly implement this, causing the Generator
466
- // object to not be returned from this call. This ensures that doesn't happen.
467
- // See https://github.com/facebook/regenerator/issues/274 for more details.
468
- Gp[iteratorSymbol] = function() {
469
- return this;
470
- };
471
-
472
- Gp.toString = function() {
473
- return "[object Generator]";
474
- };
475
-
476
- function pushTryEntry(locs) {
477
- var entry = { tryLoc: locs[0] };
478
-
479
- if (1 in locs) {
480
- entry.catchLoc = locs[1];
481
- }
482
-
483
- if (2 in locs) {
484
- entry.finallyLoc = locs[2];
485
- entry.afterLoc = locs[3];
486
- }
487
-
488
- this.tryEntries.push(entry);
489
- }
490
-
491
- function resetTryEntry(entry) {
492
- var record = entry.completion || {};
493
- record.type = "normal";
494
- delete record.arg;
495
- entry.completion = record;
496
- }
497
-
498
- function Context(tryLocsList) {
499
- // The root entry object (effectively a try statement without a catch
500
- // or a finally block) gives us a place to store values thrown from
501
- // locations where there is no enclosing try statement.
502
- this.tryEntries = [{ tryLoc: "root" }];
503
- tryLocsList.forEach(pushTryEntry, this);
504
- this.reset(true);
505
- }
506
-
507
- exports.keys = function(object) {
508
- var keys = [];
509
- for (var key in object) {
510
- keys.push(key);
511
- }
512
- keys.reverse();
513
-
514
- // Rather than returning an object with a next method, we keep
515
- // things simple and return the next function itself.
516
- return function next() {
517
- while (keys.length) {
518
- var key = keys.pop();
519
- if (key in object) {
520
- next.value = key;
521
- next.done = false;
522
- return next;
523
- }
524
- }
525
-
526
- // To avoid creating an additional object, we just hang the .value
527
- // and .done properties off the next function object itself. This
528
- // also ensures that the minifier will not anonymize the function.
529
- next.done = true;
530
- return next;
531
- };
532
- };
533
-
534
- function values(iterable) {
535
- if (iterable) {
536
- var iteratorMethod = iterable[iteratorSymbol];
537
- if (iteratorMethod) {
538
- return iteratorMethod.call(iterable);
539
- }
540
-
541
- if (typeof iterable.next === "function") {
542
- return iterable;
543
- }
544
-
545
- if (!isNaN(iterable.length)) {
546
- var i = -1, next = function next() {
547
- while (++i < iterable.length) {
548
- if (hasOwn.call(iterable, i)) {
549
- next.value = iterable[i];
550
- next.done = false;
551
- return next;
552
- }
553
- }
554
-
555
- next.value = undefined$1;
556
- next.done = true;
557
-
558
- return next;
559
- };
560
-
561
- return next.next = next;
562
- }
563
- }
564
-
565
- // Return an iterator with no values.
566
- return { next: doneResult };
567
- }
568
- exports.values = values;
569
-
570
- function doneResult() {
571
- return { value: undefined$1, done: true };
572
- }
573
-
574
- Context.prototype = {
575
- constructor: Context,
576
-
577
- reset: function(skipTempReset) {
578
- this.prev = 0;
579
- this.next = 0;
580
- // Resetting context._sent for legacy support of Babel's
581
- // function.sent implementation.
582
- this.sent = this._sent = undefined$1;
583
- this.done = false;
584
- this.delegate = null;
585
-
586
- this.method = "next";
587
- this.arg = undefined$1;
588
-
589
- this.tryEntries.forEach(resetTryEntry);
590
-
591
- if (!skipTempReset) {
592
- for (var name in this) {
593
- // Not sure about the optimal order of these conditions:
594
- if (name.charAt(0) === "t" &&
595
- hasOwn.call(this, name) &&
596
- !isNaN(+name.slice(1))) {
597
- this[name] = undefined$1;
598
- }
599
- }
600
- }
601
- },
602
-
603
- stop: function() {
604
- this.done = true;
605
-
606
- var rootEntry = this.tryEntries[0];
607
- var rootRecord = rootEntry.completion;
608
- if (rootRecord.type === "throw") {
609
- throw rootRecord.arg;
610
- }
611
-
612
- return this.rval;
613
- },
614
-
615
- dispatchException: function(exception) {
616
- if (this.done) {
617
- throw exception;
618
- }
619
-
620
- var context = this;
621
- function handle(loc, caught) {
622
- record.type = "throw";
623
- record.arg = exception;
624
- context.next = loc;
625
-
626
- if (caught) {
627
- // If the dispatched exception was caught by a catch block,
628
- // then let that catch block handle the exception normally.
629
- context.method = "next";
630
- context.arg = undefined$1;
631
- }
632
-
633
- return !! caught;
634
- }
635
-
636
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
637
- var entry = this.tryEntries[i];
638
- var record = entry.completion;
639
-
640
- if (entry.tryLoc === "root") {
641
- // Exception thrown outside of any try block that could handle
642
- // it, so set the completion value of the entire function to
643
- // throw the exception.
644
- return handle("end");
645
- }
646
-
647
- if (entry.tryLoc <= this.prev) {
648
- var hasCatch = hasOwn.call(entry, "catchLoc");
649
- var hasFinally = hasOwn.call(entry, "finallyLoc");
650
-
651
- if (hasCatch && hasFinally) {
652
- if (this.prev < entry.catchLoc) {
653
- return handle(entry.catchLoc, true);
654
- } else if (this.prev < entry.finallyLoc) {
655
- return handle(entry.finallyLoc);
656
- }
657
-
658
- } else if (hasCatch) {
659
- if (this.prev < entry.catchLoc) {
660
- return handle(entry.catchLoc, true);
661
- }
662
-
663
- } else if (hasFinally) {
664
- if (this.prev < entry.finallyLoc) {
665
- return handle(entry.finallyLoc);
666
- }
667
-
668
- } else {
669
- throw new Error("try statement without catch or finally");
670
- }
671
- }
672
- }
673
- },
674
-
675
- abrupt: function(type, arg) {
676
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
677
- var entry = this.tryEntries[i];
678
- if (entry.tryLoc <= this.prev &&
679
- hasOwn.call(entry, "finallyLoc") &&
680
- this.prev < entry.finallyLoc) {
681
- var finallyEntry = entry;
682
- break;
683
- }
684
- }
685
-
686
- if (finallyEntry &&
687
- (type === "break" ||
688
- type === "continue") &&
689
- finallyEntry.tryLoc <= arg &&
690
- arg <= finallyEntry.finallyLoc) {
691
- // Ignore the finally entry if control is not jumping to a
692
- // location outside the try/catch block.
693
- finallyEntry = null;
694
- }
695
-
696
- var record = finallyEntry ? finallyEntry.completion : {};
697
- record.type = type;
698
- record.arg = arg;
699
-
700
- if (finallyEntry) {
701
- this.method = "next";
702
- this.next = finallyEntry.finallyLoc;
703
- return ContinueSentinel;
704
- }
705
-
706
- return this.complete(record);
707
- },
708
-
709
- complete: function(record, afterLoc) {
710
- if (record.type === "throw") {
711
- throw record.arg;
712
- }
713
-
714
- if (record.type === "break" ||
715
- record.type === "continue") {
716
- this.next = record.arg;
717
- } else if (record.type === "return") {
718
- this.rval = this.arg = record.arg;
719
- this.method = "return";
720
- this.next = "end";
721
- } else if (record.type === "normal" && afterLoc) {
722
- this.next = afterLoc;
723
- }
724
-
725
- return ContinueSentinel;
726
- },
727
-
728
- finish: function(finallyLoc) {
729
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
730
- var entry = this.tryEntries[i];
731
- if (entry.finallyLoc === finallyLoc) {
732
- this.complete(entry.completion, entry.afterLoc);
733
- resetTryEntry(entry);
734
- return ContinueSentinel;
735
- }
736
- }
737
- },
738
-
739
- "catch": function(tryLoc) {
740
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
741
- var entry = this.tryEntries[i];
742
- if (entry.tryLoc === tryLoc) {
743
- var record = entry.completion;
744
- if (record.type === "throw") {
745
- var thrown = record.arg;
746
- resetTryEntry(entry);
747
- }
748
- return thrown;
749
- }
750
- }
751
-
752
- // The context.catch method must only be called with a location
753
- // argument that corresponds to a known catch block.
754
- throw new Error("illegal catch attempt");
755
- },
756
-
757
- delegateYield: function(iterable, resultName, nextLoc) {
758
- this.delegate = {
759
- iterator: values(iterable),
760
- resultName: resultName,
761
- nextLoc: nextLoc
762
- };
763
-
764
- if (this.method === "next") {
765
- // Deliberately forget the last sent value so that we don't
766
- // accidentally pass it on to the delegate.
767
- this.arg = undefined$1;
768
- }
769
-
770
- return ContinueSentinel;
771
- }
772
- };
773
-
774
- // Regardless of whether this script is executing as a CommonJS module
775
- // or not, return the runtime object so that we can declare the variable
776
- // regeneratorRuntime in the outer scope, which allows this module to be
777
- // injected easily by `bin/regenerator --include-runtime script.js`.
778
- return exports;
779
-
780
- }(
781
- // If this script is executing as a CommonJS module, use module.exports
782
- // as the regeneratorRuntime namespace. Otherwise create a new empty
783
- // object. Either way, the resulting object will be used to initialize
784
- // the regeneratorRuntime variable at the top of this file.
785
- module.exports
786
- ));
787
-
788
- try {
789
- regeneratorRuntime = runtime;
790
- } catch (accidentalStrictMode) {
791
- // This module should not be running in strict mode, so the above
792
- // assignment should always work unless something is misconfigured. Just
793
- // in case runtime.js accidentally runs in strict mode, we can escape
794
- // strict mode using a global Function call. This could conceivably fail
795
- // if a Content Security Policy forbids using Function, but in that case
796
- // the proper solution is to fix the accidental strict mode problem. If
797
- // you've misconfigured your bundler to force strict mode and applied a
798
- // CSP to forbid Function, and you're not willing to fix either of those
799
- // problems, please detail your unique predicament in a GitHub issue.
800
- Function("r", "regeneratorRuntime = r")(runtime);
801
- }
802
- });
803
-
804
- var regenerator = runtime_1;
805
-
806
- var defineProperty = _commonjsHelpers.createCommonjsModule(function (module) {
807
- function _defineProperty(obj, key, value) {
808
- if (key in obj) {
809
- Object.defineProperty(obj, key, {
810
- value: value,
811
- enumerable: true,
812
- configurable: true,
813
- writable: true
814
- });
815
- } else {
816
- obj[key] = value;
817
- }
818
-
819
- return obj;
820
- }
821
-
822
- module.exports = _defineProperty;
823
- module.exports["default"] = module.exports, module.exports.__esModule = true;
824
- });
825
-
826
- _commonjsHelpers.unwrapExports(defineProperty);
827
-
828
- var asyncToGenerator = _commonjsHelpers.createCommonjsModule(function (module) {
829
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
830
- try {
831
- var info = gen[key](arg);
832
- var value = info.value;
833
- } catch (error) {
834
- reject(error);
835
- return;
836
- }
837
-
838
- if (info.done) {
839
- resolve(value);
840
- } else {
841
- Promise.resolve(value).then(_next, _throw);
842
- }
843
- }
844
-
845
- function _asyncToGenerator(fn) {
846
- return function () {
847
- var self = this,
848
- args = arguments;
849
- return new Promise(function (resolve, reject) {
850
- var gen = fn.apply(self, args);
851
-
852
- function _next(value) {
853
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
854
- }
855
-
856
- function _throw(err) {
857
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
858
- }
859
-
860
- _next(undefined);
861
- });
862
- };
863
- }
864
-
865
- module.exports = _asyncToGenerator;
866
- module.exports["default"] = module.exports, module.exports.__esModule = true;
867
- });
868
-
869
- _commonjsHelpers.unwrapExports(asyncToGenerator);
870
-
871
- var arrayWithHoles = _commonjsHelpers.createCommonjsModule(function (module) {
872
- function _arrayWithHoles(arr) {
873
- if (Array.isArray(arr)) return arr;
874
- }
875
-
876
- module.exports = _arrayWithHoles;
877
- module.exports["default"] = module.exports, module.exports.__esModule = true;
878
- });
879
-
880
- _commonjsHelpers.unwrapExports(arrayWithHoles);
881
-
882
- var iterableToArrayLimit = _commonjsHelpers.createCommonjsModule(function (module) {
883
- function _iterableToArrayLimit(arr, i) {
884
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
885
-
886
- if (_i == null) return;
887
- var _arr = [];
888
- var _n = true;
889
- var _d = false;
890
-
891
- var _s, _e;
892
-
893
- try {
894
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
895
- _arr.push(_s.value);
896
-
897
- if (i && _arr.length === i) break;
898
- }
899
- } catch (err) {
900
- _d = true;
901
- _e = err;
902
- } finally {
903
- try {
904
- if (!_n && _i["return"] != null) _i["return"]();
905
- } finally {
906
- if (_d) throw _e;
907
- }
908
- }
909
-
910
- return _arr;
911
- }
912
-
913
- module.exports = _iterableToArrayLimit;
914
- module.exports["default"] = module.exports, module.exports.__esModule = true;
915
- });
916
-
917
- _commonjsHelpers.unwrapExports(iterableToArrayLimit);
918
-
919
- var arrayLikeToArray = _commonjsHelpers.createCommonjsModule(function (module) {
920
- function _arrayLikeToArray(arr, len) {
921
- if (len == null || len > arr.length) len = arr.length;
922
-
923
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
924
- arr2[i] = arr[i];
925
- }
926
-
927
- return arr2;
928
- }
929
-
930
- module.exports = _arrayLikeToArray;
931
- module.exports["default"] = module.exports, module.exports.__esModule = true;
932
- });
933
-
934
- _commonjsHelpers.unwrapExports(arrayLikeToArray);
935
-
936
- var unsupportedIterableToArray = _commonjsHelpers.createCommonjsModule(function (module) {
937
- function _unsupportedIterableToArray(o, minLen) {
938
- if (!o) return;
939
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
940
- var n = Object.prototype.toString.call(o).slice(8, -1);
941
- if (n === "Object" && o.constructor) n = o.constructor.name;
942
- if (n === "Map" || n === "Set") return Array.from(o);
943
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
944
- }
945
-
946
- module.exports = _unsupportedIterableToArray;
947
- module.exports["default"] = module.exports, module.exports.__esModule = true;
948
- });
949
-
950
- _commonjsHelpers.unwrapExports(unsupportedIterableToArray);
951
-
952
- var nonIterableRest = _commonjsHelpers.createCommonjsModule(function (module) {
953
- function _nonIterableRest() {
954
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
955
- }
956
-
957
- module.exports = _nonIterableRest;
958
- module.exports["default"] = module.exports, module.exports.__esModule = true;
959
- });
960
-
961
- _commonjsHelpers.unwrapExports(nonIterableRest);
962
-
963
- var slicedToArray = _commonjsHelpers.createCommonjsModule(function (module) {
964
- function _slicedToArray(arr, i) {
965
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
966
- }
967
-
968
- module.exports = _slicedToArray;
969
- module.exports["default"] = module.exports, module.exports.__esModule = true;
970
- });
971
-
972
- _commonjsHelpers.unwrapExports(slicedToArray);
973
-
974
- var logger = _commonjsHelpers.createCommonjsModule(function (module, exports) {
14
+ var logger_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
975
15
 
976
16
  Object.defineProperty(exports, "__esModule", {
977
17
  value: true
978
18
  });
979
- exports.setLogger = setLogger;
980
- exports.proxyLogger = proxyLogger;
981
19
  exports.default = void 0;
982
- const _logger = {
983
- error(code, ...message) {
984
- console.error(`[next-auth][error][${code.toLowerCase()}]`, `\nhttps://next-auth.js.org/errors#${code.toLowerCase()}`, ...message);
985
- },
20
+ var logger = {
21
+ error(code) {
22
+ for (var _len = arguments.length, message = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
23
+ message[_key - 1] = arguments[_key];
24
+ }
986
25
 
987
- warn(code, ...message) {
988
- console.warn(`[next-auth][warn][${code.toLowerCase()}]`, `\nhttps://next-auth.js.org/warnings#${code.toLowerCase()}`, ...message);
26
+ console.error("[next-auth][error][".concat(code.toLowerCase(), "]"), "\nhttps://next-auth.js.org/errors#".concat(code.toLowerCase()), ...message);
989
27
  },
990
28
 
991
- debug(code, ...message) {
992
- var _process, _process$env;
993
-
994
- if (!((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env._NEXTAUTH_DEBUG)) return;
995
- console.log(`[next-auth][debug][${code.toLowerCase()}]`, ...message);
996
- }
997
-
998
- };
999
-
1000
- function setLogger(newLogger = {}) {
1001
- if (newLogger.error) _logger.error = newLogger.error;
1002
- if (newLogger.warn) _logger.warn = newLogger.warn;
1003
- if (newLogger.debug) _logger.debug = newLogger.debug;
1004
- }
1005
-
1006
- var _default = _logger;
1007
- exports.default = _default;
1008
-
1009
- function proxyLogger(logger = _logger, basePath) {
1010
- try {
1011
- if (typeof window === "undefined") {
1012
- return logger;
29
+ warn(code) {
30
+ for (var _len2 = arguments.length, message = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
31
+ message[_key2 - 1] = arguments[_key2];
1013
32
  }
1014
33
 
1015
- const clientLogger = {};
1016
-
1017
- for (const level in logger) {
1018
- clientLogger[level] = (code, ...message) => {
1019
- _logger[level](code, ...message);
1020
-
1021
- const url = `${basePath}/_log`;
1022
- const body = new URLSearchParams({
1023
- level,
1024
- code,
1025
- message: JSON.stringify(message.map(m => {
1026
- if (m instanceof Error) {
1027
- return {
1028
- name: m.name,
1029
- message: m.message,
1030
- stack: m.stack
1031
- };
1032
- }
34
+ console.warn("[next-auth][warn][".concat(code.toLowerCase(), "]"), "\nhttps://next-auth.js.org/warnings#".concat(code.toLowerCase()), ...message);
35
+ },
1033
36
 
1034
- return m;
1035
- }))
1036
- });
37
+ debug(code) {
38
+ var _process, _process$env;
1037
39
 
1038
- if (navigator.sendBeacon) {
1039
- return navigator.sendBeacon(url, body);
1040
- }
40
+ if (!((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env._NEXTAUTH_DEBUG)) return;
1041
41
 
1042
- return fetch(url, {
1043
- method: "POST",
1044
- headers: {
1045
- "Content-Type": "application/json"
1046
- },
1047
- body
1048
- });
1049
- };
42
+ for (var _len3 = arguments.length, message = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
43
+ message[_key3 - 1] = arguments[_key3];
1050
44
  }
1051
45
 
1052
- return clientLogger;
1053
- } catch (_unused) {
1054
- return _logger;
46
+ console.log("[next-auth][debug][".concat(code.toLowerCase(), "]"), ...message);
1055
47
  }
1056
- }
48
+
49
+ };
50
+ var _default = logger;
51
+ exports.default = _default;
1057
52
  });
1058
53
 
1059
- _commonjsHelpers.unwrapExports(logger);
1060
- var logger_1 = logger.setLogger;
1061
- var logger_2 = logger.proxyLogger;
54
+ _commonjsHelpers.unwrapExports(logger_1);
1062
55
 
1063
56
  var parseUrl_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1064
57
 
@@ -1068,18 +61,18 @@ Object.defineProperty(exports, "__esModule", {
1068
61
  exports.default = parseUrl;
1069
62
 
1070
63
  function parseUrl(url) {
1071
- const defaultHost = 'http://localhost:3000';
1072
- const defaultPath = '/api/auth';
64
+ var defaultHost = 'http://localhost:3000';
65
+ var defaultPath = '/api/auth';
1073
66
 
1074
67
  if (!url) {
1075
- url = `${defaultHost}${defaultPath}`;
68
+ url = "".concat(defaultHost).concat(defaultPath);
1076
69
  }
1077
70
 
1078
- const protocol = url.startsWith('http:') ? 'http' : 'https';
71
+ var protocol = url.startsWith('http:') ? 'http' : 'https';
1079
72
  url = url.replace(/^https?:\/\//, '').replace(/\/$/, '');
1080
- const [_host, ..._path] = url.split('/');
1081
- const baseUrl = _host ? `${protocol}://${_host}` : defaultHost;
1082
- const basePath = _path.length > 0 ? `/${_path.join('/')}` : defaultPath;
73
+ var [_host, ..._path] = url.split('/');
74
+ var baseUrl = _host ? "".concat(protocol, "://").concat(_host) : defaultHost;
75
+ var basePath = _path.length > 0 ? "/".concat(_path.join('/')) : defaultPath;
1083
76
  return {
1084
77
  baseUrl,
1085
78
  basePath
@@ -1091,442 +84,334 @@ _commonjsHelpers.unwrapExports(parseUrl_1);
1091
84
 
1092
85
  var client = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1093
86
 
1094
-
1095
-
1096
-
1097
-
1098
87
  Object.defineProperty(exports, "__esModule", {
1099
88
  value: true
1100
89
  });
1101
- exports.useSession = useSession;
1102
- exports.session = exports.getSession = getSession;
1103
- exports.csrfToken = exports.getCsrfToken = getCsrfToken;
1104
- exports.providers = exports.getProviders = getProviders;
1105
- exports.signin = exports.signIn = signIn;
1106
- exports.signout = exports.signOut = signOut;
1107
- exports.options = exports.setOptions = setOptions;
1108
- exports.Provider = Provider;
1109
- exports.default = void 0;
1110
-
1111
- var _regenerator = interopRequireDefault(regenerator);
90
+ exports.getSession = getSession;
91
+ exports.signIn = signIn;
92
+ exports.signOut = signOut;
93
+ exports.default = exports.Provider = exports.useSession = void 0;
1112
94
 
1113
- var _defineProperty2 = interopRequireDefault(defineProperty);
1114
95
 
1115
- var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
1116
96
 
1117
- var _slicedToArray2 = interopRequireDefault(slicedToArray);
97
+ var _logger = _interopRequireDefault(logger_1);
1118
98
 
99
+ var _parseUrl = _interopRequireDefault(parseUrl_1);
1119
100
 
101
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1120
102
 
1121
- var _logger2 = _interopRequireWildcard(logger);
103
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1122
104
 
1123
- var _parseUrl = interopRequireDefault(parseUrl_1);
105
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1124
106
 
1125
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
107
+ 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; }
1126
108
 
1127
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof_1(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
109
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
1128
110
 
1129
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1130
-
1131
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
111
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
1132
112
 
1133
113
  var __NEXTAUTH = {
1134
114
  baseUrl: (0, _parseUrl.default)(process.env.NEXTAUTH_URL || process.env.VERCEL_URL).baseUrl,
1135
115
  basePath: (0, _parseUrl.default)(process.env.NEXTAUTH_URL).basePath,
1136
- baseUrlServer: (0, _parseUrl.default)(process.env.NEXTAUTH_URL_INTERNAL || process.env.NEXTAUTH_URL || process.env.VERCEL_URL).baseUrl,
1137
- basePathServer: (0, _parseUrl.default)(process.env.NEXTAUTH_URL_INTERNAL || process.env.NEXTAUTH_URL).basePath,
1138
116
  keepAlive: 0,
1139
117
  clientMaxAge: 0,
1140
118
  _clientLastSync: 0,
1141
119
  _clientSyncTimer: null,
1142
120
  _eventListenersAdded: false,
1143
121
  _clientSession: undefined,
1144
- _getSession: function _getSession() {}
122
+ _clientId: Math.random().toString(36).substring(2) + Date.now().toString(36),
123
+ _getSession: () => {}
1145
124
  };
1146
- var logger$1 = (0, _logger2.proxyLogger)(_logger2.default, __NEXTAUTH.basePath);
1147
- var broadcast = BroadcastChannel();
1148
-
1149
- if (typeof window !== "undefined" && !__NEXTAUTH._eventListenersAdded) {
1150
- __NEXTAUTH._eventListenersAdded = true;
1151
- broadcast.receive(function () {
1152
- return __NEXTAUTH._getSession({
1153
- event: "storage"
1154
- });
1155
- });
1156
- document.addEventListener("visibilitychange", function () {
1157
- !document.hidden && __NEXTAUTH._getSession({
1158
- event: "visibilitychange"
1159
- });
1160
- }, false);
1161
- }
1162
-
1163
- var SessionContext = (0, React__default.createContext)();
1164
125
 
1165
- function useSession(session) {
1166
- var context = (0, React__default.useContext)(SessionContext);
1167
- if (context) return context;
1168
- return _useSessionHook(session);
1169
- }
126
+ if (typeof window !== 'undefined') {
127
+ if (__NEXTAUTH._eventListenersAdded === false) {
128
+ __NEXTAUTH._eventListenersAdded = true;
129
+ window.addEventListener('storage', function () {
130
+ var _ref = _asyncToGenerator(function* (event) {
131
+ if (event.key === 'nextauth.message') {
132
+ var message = JSON.parse(event.newValue);
133
+
134
+ if ((message === null || message === void 0 ? void 0 : message.event) === 'session' && message.data) {
135
+ if (__NEXTAUTH._clientId === message.clientId) {
136
+ return;
137
+ }
1170
138
 
1171
- function _useSessionHook(session) {
1172
- var _useState = (0, React__default.useState)(session),
1173
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
1174
- data = _useState2[0],
1175
- setData = _useState2[1];
1176
-
1177
- var _useState3 = (0, React__default.useState)(!data),
1178
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
1179
- loading = _useState4[0],
1180
- setLoading = _useState4[1];
1181
-
1182
- (0, React__default.useEffect)(function () {
1183
- __NEXTAUTH._getSession = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
1184
- var _ref2,
1185
- _ref2$event,
1186
- event,
1187
- triggredByEvent,
1188
- triggeredByStorageEvent,
1189
- clientMaxAge,
1190
- clientLastSync,
1191
- currentTime,
1192
- clientSession,
1193
- newClientSessionData,
1194
- _args = arguments;
1195
-
1196
- return _regenerator.default.wrap(function _callee$(_context) {
1197
- while (1) {
1198
- switch (_context.prev = _context.next) {
1199
- case 0:
1200
- _ref2 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref2$event = _ref2.event, event = _ref2$event === void 0 ? null : _ref2$event;
1201
- _context.prev = 1;
1202
- triggredByEvent = event !== null;
1203
- triggeredByStorageEvent = event === "storage";
1204
- clientMaxAge = __NEXTAUTH.clientMaxAge;
1205
- clientLastSync = parseInt(__NEXTAUTH._clientLastSync);
1206
- currentTime = _now();
1207
- clientSession = __NEXTAUTH._clientSession;
1208
-
1209
- if (!(!triggeredByStorageEvent && clientSession !== undefined)) {
1210
- _context.next = 19;
1211
- break;
1212
- }
1213
-
1214
- if (!(clientMaxAge === 0 && triggredByEvent !== true)) {
1215
- _context.next = 13;
1216
- break;
1217
- }
1218
-
1219
- return _context.abrupt("return");
1220
-
1221
- case 13:
1222
- if (!(clientMaxAge > 0 && clientSession === null)) {
1223
- _context.next = 17;
1224
- break;
1225
- }
1226
-
1227
- return _context.abrupt("return");
1228
-
1229
- case 17:
1230
- if (!(clientMaxAge > 0 && currentTime < clientLastSync + clientMaxAge)) {
1231
- _context.next = 19;
1232
- break;
1233
- }
1234
-
1235
- return _context.abrupt("return");
1236
-
1237
- case 19:
1238
- if (clientSession === undefined) {
1239
- __NEXTAUTH._clientSession = null;
1240
- }
1241
-
1242
- __NEXTAUTH._clientLastSync = _now();
1243
- _context.next = 23;
1244
- return getSession({
1245
- triggerEvent: !triggeredByStorageEvent
1246
- });
1247
-
1248
- case 23:
1249
- newClientSessionData = _context.sent;
1250
- __NEXTAUTH._clientSession = newClientSessionData;
1251
- setData(newClientSessionData);
1252
- setLoading(false);
1253
- _context.next = 33;
1254
- break;
1255
-
1256
- case 29:
1257
- _context.prev = 29;
1258
- _context.t0 = _context["catch"](1);
1259
- logger$1.error("CLIENT_USE_SESSION_ERROR", _context.t0);
1260
- setLoading(false);
1261
-
1262
- case 33:
1263
- case "end":
1264
- return _context.stop();
139
+ yield __NEXTAUTH._getSession({
140
+ event: 'storage'
141
+ });
1265
142
  }
1266
143
  }
1267
- }, _callee, null, [[1, 29]]);
1268
- }));
144
+ });
1269
145
 
1270
- __NEXTAUTH._getSession();
1271
- });
1272
- return [data, loading];
146
+ return function (_x) {
147
+ return _ref.apply(this, arguments);
148
+ };
149
+ }());
150
+ var hidden, visibilityChange;
151
+
152
+ if (typeof document.hidden !== 'undefined') {
153
+ hidden = 'hidden';
154
+ visibilityChange = 'visibilitychange';
155
+ } else if (typeof document.msHidden !== 'undefined') {
156
+ hidden = 'msHidden';
157
+ visibilityChange = 'msvisibilitychange';
158
+ } else if (typeof document.webkitHidden !== 'undefined') {
159
+ hidden = 'webkitHidden';
160
+ visibilityChange = 'webkitvisibilitychange';
161
+ }
162
+
163
+ var handleVisibilityChange = () => !document[hidden] && __NEXTAUTH._getSession({
164
+ event: visibilityChange
165
+ });
166
+
167
+ document.addEventListener('visibilitychange', handleVisibilityChange, false);
168
+ }
1273
169
  }
1274
170
 
1275
- function getSession(_x) {
171
+ var setOptions = function setOptions() {
172
+ var {
173
+ baseUrl,
174
+ basePath,
175
+ clientMaxAge,
176
+ keepAlive
177
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
178
+
179
+ if (baseUrl) {
180
+ __NEXTAUTH.baseUrl = baseUrl;
181
+ }
182
+
183
+ if (basePath) {
184
+ __NEXTAUTH.basePath = basePath;
185
+ }
186
+
187
+ if (clientMaxAge) {
188
+ __NEXTAUTH.clientMaxAge = clientMaxAge;
189
+ }
190
+
191
+ if (keepAlive) {
192
+ __NEXTAUTH.keepAlive = keepAlive;
193
+
194
+ if (typeof window !== 'undefined' && keepAlive > 0) {
195
+ if (__NEXTAUTH._clientSyncTimer !== null) {
196
+ clearTimeout(__NEXTAUTH._clientSyncTimer);
197
+ }
198
+
199
+ __NEXTAUTH._clientSyncTimer = setTimeout(_asyncToGenerator(function* () {
200
+ if (__NEXTAUTH._clientSession) {
201
+ yield __NEXTAUTH._getSession({
202
+ event: 'timer'
203
+ });
204
+ }
205
+ }), keepAlive * 1000);
206
+ }
207
+ }
208
+ };
209
+
210
+ function getSession() {
1276
211
  return _getSession2.apply(this, arguments);
1277
212
  }
1278
213
 
1279
214
  function _getSession2() {
1280
- _getSession2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(ctx) {
1281
- var _ctx$triggerEvent;
1282
-
1283
- var session;
1284
- return _regenerator.default.wrap(function _callee4$(_context4) {
1285
- while (1) {
1286
- switch (_context4.prev = _context4.next) {
1287
- case 0:
1288
- _context4.next = 2;
1289
- return _fetchData("session", ctx);
1290
-
1291
- case 2:
1292
- session = _context4.sent;
1293
-
1294
- if ((_ctx$triggerEvent = ctx === null || ctx === void 0 ? void 0 : ctx.triggerEvent) !== null && _ctx$triggerEvent !== void 0 ? _ctx$triggerEvent : true) {
1295
- broadcast.post({
1296
- event: "session",
1297
- data: {
1298
- trigger: "getSession"
1299
- }
1300
- });
1301
- }
1302
-
1303
- return _context4.abrupt("return", session);
1304
-
1305
- case 5:
1306
- case "end":
1307
- return _context4.stop();
215
+ _getSession2 = _asyncToGenerator(function* () {
216
+ var {
217
+ ctx,
218
+ req = ctx === null || ctx === void 0 ? void 0 : ctx.req,
219
+ triggerEvent = true
220
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
221
+
222
+ var baseUrl = _apiBaseUrl();
223
+
224
+ var fetchOptions = req ? {
225
+ headers: {
226
+ cookie: req.headers.cookie
227
+ }
228
+ } : {};
229
+ var session = yield _fetchData("".concat(baseUrl, "/session"), fetchOptions);
230
+
231
+ if (triggerEvent) {
232
+ _sendMessage({
233
+ event: 'session',
234
+ data: {
235
+ trigger: 'getSession'
1308
236
  }
1309
- }
1310
- }, _callee4);
1311
- }));
237
+ });
238
+ }
239
+
240
+ return session;
241
+ });
1312
242
  return _getSession2.apply(this, arguments);
1313
243
  }
1314
244
 
1315
- function getCsrfToken(_x2) {
245
+ function getCsrfToken() {
1316
246
  return _getCsrfToken.apply(this, arguments);
1317
247
  }
1318
248
 
1319
249
  function _getCsrfToken() {
1320
- _getCsrfToken = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(ctx) {
1321
- var _yield$_fetchData;
1322
-
1323
- return _regenerator.default.wrap(function _callee5$(_context5) {
1324
- while (1) {
1325
- switch (_context5.prev = _context5.next) {
1326
- case 0:
1327
- _context5.next = 2;
1328
- return _fetchData("csrf", ctx);
1329
-
1330
- case 2:
1331
- _context5.t1 = _yield$_fetchData = _context5.sent;
1332
- _context5.t0 = _context5.t1 === null;
1333
-
1334
- if (_context5.t0) {
1335
- _context5.next = 6;
1336
- break;
1337
- }
250
+ _getCsrfToken = _asyncToGenerator(function* () {
251
+ var {
252
+ ctx,
253
+ req = ctx === null || ctx === void 0 ? void 0 : ctx.req
254
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1338
255
 
1339
- _context5.t0 = _yield$_fetchData === void 0;
256
+ var baseUrl = _apiBaseUrl();
1340
257
 
1341
- case 6:
1342
- if (!_context5.t0) {
1343
- _context5.next = 10;
1344
- break;
1345
- }
258
+ var fetchOptions = req ? {
259
+ headers: {
260
+ cookie: req.headers.cookie
261
+ }
262
+ } : {};
263
+ var data = yield _fetchData("".concat(baseUrl, "/csrf"), fetchOptions);
264
+ return data && data.csrfToken ? data.csrfToken : null;
265
+ });
266
+ return _getCsrfToken.apply(this, arguments);
267
+ }
1346
268
 
1347
- _context5.t2 = void 0;
1348
- _context5.next = 11;
1349
- break;
269
+ var getProviders = function () {
270
+ var _ref3 = _asyncToGenerator(function* () {
271
+ var baseUrl = _apiBaseUrl();
1350
272
 
1351
- case 10:
1352
- _context5.t2 = _yield$_fetchData.csrfToken;
273
+ return _fetchData("".concat(baseUrl, "/providers"));
274
+ });
1353
275
 
1354
- case 11:
1355
- return _context5.abrupt("return", _context5.t2);
276
+ return function getProviders() {
277
+ return _ref3.apply(this, arguments);
278
+ };
279
+ }();
1356
280
 
1357
- case 12:
1358
- case "end":
1359
- return _context5.stop();
1360
- }
1361
- }
1362
- }, _callee5);
1363
- }));
1364
- return _getCsrfToken.apply(this, arguments);
1365
- }
281
+ var SessionContext = (0, React__default.createContext)();
1366
282
 
1367
- function getProviders() {
1368
- return _getProviders.apply(this, arguments);
1369
- }
283
+ var useSession = session => {
284
+ var value = (0, React__default.useContext)(SessionContext);
285
+
286
+ if (value === undefined) {
287
+ return _useSessionHook(session);
288
+ }
289
+
290
+ return value;
291
+ };
1370
292
 
1371
- function _getProviders() {
1372
- _getProviders = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6() {
1373
- return _regenerator.default.wrap(function _callee6$(_context6) {
1374
- while (1) {
1375
- switch (_context6.prev = _context6.next) {
1376
- case 0:
1377
- _context6.next = 2;
1378
- return _fetchData("providers");
1379
-
1380
- case 2:
1381
- return _context6.abrupt("return", _context6.sent);
1382
-
1383
- case 3:
1384
- case "end":
1385
- return _context6.stop();
293
+ exports.useSession = useSession;
294
+
295
+ var _useSessionHook = session => {
296
+ var [data, setData] = (0, React__default.useState)(session);
297
+ var [loading, setLoading] = (0, React__default.useState)(true);
298
+ (0, React__default.useEffect)(() => {
299
+ var _getSession = function () {
300
+ var _ref4 = _asyncToGenerator(function* () {
301
+ var {
302
+ event = null
303
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
304
+
305
+ try {
306
+ var triggredByEvent = event !== null;
307
+ var triggeredByStorageEvent = !!(event && event === 'storage');
308
+ var clientMaxAge = __NEXTAUTH.clientMaxAge;
309
+ var clientLastSync = parseInt(__NEXTAUTH._clientLastSync);
310
+ var currentTime = Math.floor(new Date().getTime() / 1000);
311
+ var clientSession = __NEXTAUTH._clientSession;
312
+
313
+ if (triggeredByStorageEvent === false && clientSession !== undefined) {
314
+ if (clientMaxAge === 0 && triggredByEvent !== true) {
315
+ return;
316
+ } else if (clientMaxAge > 0 && clientSession === null) {
317
+ return;
318
+ } else if (clientMaxAge > 0 && currentTime < clientLastSync + clientMaxAge) {
319
+ return;
320
+ }
321
+ }
322
+
323
+ if (clientSession === undefined) {
324
+ __NEXTAUTH._clientSession = null;
325
+ }
326
+
327
+ __NEXTAUTH._clientLastSync = Math.floor(new Date().getTime() / 1000);
328
+ var triggerEvent = triggeredByStorageEvent === false;
329
+ var newClientSessionData = yield getSession({
330
+ triggerEvent
331
+ });
332
+ __NEXTAUTH._clientSession = newClientSessionData;
333
+ setData(newClientSessionData);
334
+ setLoading(false);
335
+ } catch (error) {
336
+ _logger.default.error('CLIENT_USE_SESSION_ERROR', error);
1386
337
  }
1387
- }
1388
- }, _callee6);
1389
- }));
1390
- return _getProviders.apply(this, arguments);
1391
- }
338
+ });
339
+
340
+ return function _getSession() {
341
+ return _ref4.apply(this, arguments);
342
+ };
343
+ }();
344
+
345
+ __NEXTAUTH._getSession = _getSession;
1392
346
 
1393
- function signIn(_x3) {
347
+ _getSession();
348
+ });
349
+ return [data, loading];
350
+ };
351
+
352
+ function signIn(_x2) {
1394
353
  return _signIn.apply(this, arguments);
1395
354
  }
1396
355
 
1397
356
  function _signIn() {
1398
- _signIn = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(provider) {
1399
- var options,
1400
- authorizationParams,
1401
- _options$callbackUrl,
1402
- callbackUrl,
1403
- _options$redirect,
1404
- redirect,
1405
- baseUrl,
1406
- providers,
1407
- isCredentials,
1408
- isEmail,
1409
- isSupportingReturn,
1410
- signInUrl,
1411
- _signInUrl,
1412
- res,
1413
- data,
1414
- _data$url,
1415
- url,
1416
- error,
1417
- _args7 = arguments;
1418
-
1419
- return _regenerator.default.wrap(function _callee7$(_context7) {
1420
- while (1) {
1421
- switch (_context7.prev = _context7.next) {
1422
- case 0:
1423
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
1424
- authorizationParams = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
1425
- _options$callbackUrl = options.callbackUrl, callbackUrl = _options$callbackUrl === void 0 ? window.location.href : _options$callbackUrl, _options$redirect = options.redirect, redirect = _options$redirect === void 0 ? true : _options$redirect;
1426
- baseUrl = _apiBaseUrl();
1427
- _context7.next = 6;
1428
- return getProviders();
1429
-
1430
- case 6:
1431
- providers = _context7.sent;
1432
-
1433
- if (providers) {
1434
- _context7.next = 9;
1435
- break;
1436
- }
357
+ _signIn = _asyncToGenerator(function* (provider) {
358
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
359
+ var authorizationParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
360
+ var {
361
+ callbackUrl = window.location,
362
+ redirect = true
363
+ } = options;
1437
364
 
1438
- return _context7.abrupt("return", window.location.replace("".concat(baseUrl, "/error")));
365
+ var baseUrl = _apiBaseUrl();
1439
366
 
1440
- case 9:
1441
- if (provider in providers) {
1442
- _context7.next = 11;
1443
- break;
1444
- }
367
+ var providers = yield getProviders();
1445
368
 
1446
- return _context7.abrupt("return", window.location.replace("".concat(baseUrl, "/signin?callbackUrl=").concat(encodeURIComponent(callbackUrl))));
1447
-
1448
- case 11:
1449
- isCredentials = providers[provider].type === "credentials";
1450
- isEmail = providers[provider].type === "email";
1451
- isSupportingReturn = isCredentials || isEmail;
1452
- signInUrl = isCredentials ? "".concat(baseUrl, "/callback/").concat(provider) : "".concat(baseUrl, "/signin/").concat(provider);
1453
- _signInUrl = "".concat(signInUrl, "?").concat(new URLSearchParams(authorizationParams));
1454
- _context7.t0 = fetch;
1455
- _context7.t1 = _signInUrl;
1456
- _context7.t2 = {
1457
- "Content-Type": "application/x-www-form-urlencoded"
1458
- };
1459
- _context7.t3 = URLSearchParams;
1460
- _context7.t4 = _objectSpread;
1461
- _context7.t5 = _objectSpread({}, options);
1462
- _context7.t6 = {};
1463
- _context7.next = 25;
1464
- return getCsrfToken();
1465
-
1466
- case 25:
1467
- _context7.t7 = _context7.sent;
1468
- _context7.t8 = callbackUrl;
1469
- _context7.t9 = {
1470
- csrfToken: _context7.t7,
1471
- callbackUrl: _context7.t8,
1472
- json: true
1473
- };
1474
- _context7.t10 = (0, _context7.t4)(_context7.t5, _context7.t6, _context7.t9);
1475
- _context7.t11 = new _context7.t3(_context7.t10);
1476
- _context7.t12 = {
1477
- method: "post",
1478
- headers: _context7.t2,
1479
- body: _context7.t11
1480
- };
1481
- _context7.next = 33;
1482
- return (0, _context7.t0)(_context7.t1, _context7.t12);
1483
-
1484
- case 33:
1485
- res = _context7.sent;
1486
- _context7.next = 36;
1487
- return res.json();
1488
-
1489
- case 36:
1490
- data = _context7.sent;
1491
-
1492
- if (!(redirect || !isSupportingReturn)) {
1493
- _context7.next = 42;
1494
- break;
1495
- }
369
+ if (!(provider in providers)) {
370
+ window.location = "".concat(baseUrl, "/signin?callbackUrl=").concat(encodeURIComponent(callbackUrl));
371
+ return;
372
+ }
1496
373
 
1497
- url = (_data$url = data.url) !== null && _data$url !== void 0 ? _data$url : callbackUrl;
1498
- window.location.replace(url);
1499
- if (url.includes("#")) window.location.reload();
1500
- return _context7.abrupt("return");
374
+ var isCredentials = providers[provider].type === 'credentials';
375
+ var signInUrl = isCredentials ? "".concat(baseUrl, "/callback/").concat(provider) : "".concat(baseUrl, "/signin/").concat(provider);
376
+ var fetchOptions = {
377
+ method: 'post',
378
+ headers: {
379
+ 'Content-Type': 'application/x-www-form-urlencoded'
380
+ },
381
+ body: new URLSearchParams(_objectSpread(_objectSpread({}, options), {}, {
382
+ csrfToken: yield getCsrfToken(),
383
+ callbackUrl,
384
+ json: true
385
+ }))
386
+ };
1501
387
 
1502
- case 42:
1503
- error = new URL(data.url).searchParams.get("error");
388
+ var _signInUrl = "".concat(signInUrl, "?").concat(new URLSearchParams(authorizationParams));
1504
389
 
1505
- if (!res.ok) {
1506
- _context7.next = 46;
1507
- break;
1508
- }
390
+ var res = yield fetch(_signInUrl, fetchOptions);
391
+ var data = yield res.json();
1509
392
 
1510
- _context7.next = 46;
1511
- return __NEXTAUTH._getSession({
1512
- event: "storage"
1513
- });
393
+ if (redirect || !isCredentials) {
394
+ var _data$url;
1514
395
 
1515
- case 46:
1516
- return _context7.abrupt("return", {
1517
- error: error,
1518
- status: res.status,
1519
- ok: res.ok,
1520
- url: error ? null : data.url
1521
- });
396
+ window.location = (_data$url = data.url) !== null && _data$url !== void 0 ? _data$url : callbackUrl;
397
+ return;
398
+ }
1522
399
 
1523
- case 47:
1524
- case "end":
1525
- return _context7.stop();
1526
- }
1527
- }
1528
- }, _callee7);
1529
- }));
400
+ var error = new URL(data.url).searchParams.get('error');
401
+
402
+ if (res.ok) {
403
+ yield __NEXTAUTH._getSession({
404
+ event: 'storage'
405
+ });
406
+ }
407
+
408
+ return {
409
+ error,
410
+ status: res.status,
411
+ ok: res.ok,
412
+ url: error ? null : data.url
413
+ };
414
+ });
1530
415
  return _signIn.apply(this, arguments);
1531
416
  }
1532
417
 
@@ -1535,299 +420,116 @@ function signOut() {
1535
420
  }
1536
421
 
1537
422
  function _signOut() {
1538
- _signOut = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee8() {
1539
- var options,
1540
- _options$callbackUrl2,
423
+ _signOut = _asyncToGenerator(function* () {
424
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
425
+ var {
426
+ callbackUrl = window.location,
427
+ redirect = true
428
+ } = options;
429
+
430
+ var baseUrl = _apiBaseUrl();
431
+
432
+ var fetchOptions = {
433
+ method: 'post',
434
+ headers: {
435
+ 'Content-Type': 'application/x-www-form-urlencoded'
436
+ },
437
+ body: new URLSearchParams({
438
+ csrfToken: yield getCsrfToken(),
1541
439
  callbackUrl,
1542
- _options$redirect2,
1543
- redirect,
1544
- baseUrl,
1545
- fetchOptions,
1546
- res,
1547
- data,
1548
- _data$url2,
1549
- url,
1550
- _args8 = arguments;
1551
-
1552
- return _regenerator.default.wrap(function _callee8$(_context8) {
1553
- while (1) {
1554
- switch (_context8.prev = _context8.next) {
1555
- case 0:
1556
- options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
1557
- _options$callbackUrl2 = options.callbackUrl, callbackUrl = _options$callbackUrl2 === void 0 ? window.location.href : _options$callbackUrl2, _options$redirect2 = options.redirect, redirect = _options$redirect2 === void 0 ? true : _options$redirect2;
1558
- baseUrl = _apiBaseUrl();
1559
- _context8.t0 = {
1560
- "Content-Type": "application/x-www-form-urlencoded"
1561
- };
1562
- _context8.t1 = URLSearchParams;
1563
- _context8.next = 7;
1564
- return getCsrfToken();
1565
-
1566
- case 7:
1567
- _context8.t2 = _context8.sent;
1568
- _context8.t3 = callbackUrl;
1569
- _context8.t4 = {
1570
- csrfToken: _context8.t2,
1571
- callbackUrl: _context8.t3,
1572
- json: true
1573
- };
1574
- _context8.t5 = new _context8.t1(_context8.t4);
1575
- fetchOptions = {
1576
- method: "post",
1577
- headers: _context8.t0,
1578
- body: _context8.t5
1579
- };
1580
- _context8.next = 14;
1581
- return fetch("".concat(baseUrl, "/signout"), fetchOptions);
1582
-
1583
- case 14:
1584
- res = _context8.sent;
1585
- _context8.next = 17;
1586
- return res.json();
1587
-
1588
- case 17:
1589
- data = _context8.sent;
1590
- broadcast.post({
1591
- event: "session",
1592
- data: {
1593
- trigger: "signout"
1594
- }
1595
- });
1596
-
1597
- if (!redirect) {
1598
- _context8.next = 24;
1599
- break;
1600
- }
1601
-
1602
- url = (_data$url2 = data.url) !== null && _data$url2 !== void 0 ? _data$url2 : callbackUrl;
1603
- window.location.replace(url);
1604
- if (url.includes("#")) window.location.reload();
1605
- return _context8.abrupt("return");
1606
-
1607
- case 24:
1608
- _context8.next = 26;
1609
- return __NEXTAUTH._getSession({
1610
- event: "storage"
1611
- });
1612
-
1613
- case 26:
1614
- return _context8.abrupt("return", data);
440
+ json: true
441
+ })
442
+ };
443
+ var res = yield fetch("".concat(baseUrl, "/signout"), fetchOptions);
444
+ var data = yield res.json();
1615
445
 
1616
- case 27:
1617
- case "end":
1618
- return _context8.stop();
1619
- }
446
+ _sendMessage({
447
+ event: 'session',
448
+ data: {
449
+ trigger: 'signout'
1620
450
  }
1621
- }, _callee8);
1622
- }));
1623
- return _signOut.apply(this, arguments);
1624
- }
1625
-
1626
- function setOptions() {
1627
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1628
- baseUrl = _ref3.baseUrl,
1629
- basePath = _ref3.basePath,
1630
- clientMaxAge = _ref3.clientMaxAge,
1631
- keepAlive = _ref3.keepAlive;
1632
-
1633
- if (baseUrl) __NEXTAUTH.baseUrl = baseUrl;
1634
- if (basePath) __NEXTAUTH.basePath = basePath;
1635
- if (clientMaxAge) __NEXTAUTH.clientMaxAge = clientMaxAge;
451
+ });
1636
452
 
1637
- if (keepAlive) {
1638
- __NEXTAUTH.keepAlive = keepAlive;
1639
- if (typeof window === "undefined") return;
453
+ if (redirect) {
454
+ var _data$url2;
1640
455
 
1641
- if (__NEXTAUTH._clientSyncTimer !== null) {
1642
- clearTimeout(__NEXTAUTH._clientSyncTimer);
456
+ window.location = (_data$url2 = data.url) !== null && _data$url2 !== void 0 ? _data$url2 : callbackUrl;
457
+ return;
1643
458
  }
1644
459
 
1645
- __NEXTAUTH._clientSyncTimer = setTimeout((0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2() {
1646
- return _regenerator.default.wrap(function _callee2$(_context2) {
1647
- while (1) {
1648
- switch (_context2.prev = _context2.next) {
1649
- case 0:
1650
- if (__NEXTAUTH._clientSession) {
1651
- _context2.next = 2;
1652
- break;
1653
- }
1654
-
1655
- return _context2.abrupt("return");
1656
-
1657
- case 2:
1658
- _context2.next = 4;
1659
- return __NEXTAUTH._getSession({
1660
- event: "timer"
1661
- });
1662
-
1663
- case 4:
1664
- case "end":
1665
- return _context2.stop();
1666
- }
1667
- }
1668
- }, _callee2);
1669
- })), keepAlive * 1000);
1670
- }
460
+ yield __NEXTAUTH._getSession({
461
+ event: 'storage'
462
+ });
463
+ return data;
464
+ });
465
+ return _signOut.apply(this, arguments);
1671
466
  }
1672
467
 
1673
- function Provider(_ref5) {
1674
- var children = _ref5.children,
1675
- session = _ref5.session,
1676
- options = _ref5.options;
468
+ var Provider = (_ref5) => {
469
+ var {
470
+ children,
471
+ session,
472
+ options
473
+ } = _ref5;
1677
474
  setOptions(options);
1678
475
  return (0, React__default.createElement)(SessionContext.Provider, {
1679
476
  value: useSession(session)
1680
477
  }, children);
1681
- }
1682
-
1683
- function _fetchData(_x4) {
1684
- return _fetchData2.apply(this, arguments);
1685
- }
478
+ };
1686
479
 
1687
- function _fetchData2() {
1688
- _fetchData2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(path) {
1689
- var _ref7,
1690
- ctx,
1691
- _ref7$req,
1692
- req,
1693
- baseUrl,
1694
- options,
1695
- res,
1696
- data,
1697
- _args9 = arguments;
1698
-
1699
- return _regenerator.default.wrap(function _callee9$(_context9) {
1700
- while (1) {
1701
- switch (_context9.prev = _context9.next) {
1702
- case 0:
1703
- _ref7 = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {}, ctx = _ref7.ctx, _ref7$req = _ref7.req, req = _ref7$req === void 0 ? ctx === null || ctx === void 0 ? void 0 : ctx.req : _ref7$req;
1704
- _context9.prev = 1;
1705
- _context9.next = 4;
1706
- return _apiBaseUrl();
1707
-
1708
- case 4:
1709
- baseUrl = _context9.sent;
1710
- options = req ? {
1711
- headers: {
1712
- cookie: req.headers.cookie
1713
- }
1714
- } : {};
1715
- _context9.next = 8;
1716
- return fetch("".concat(baseUrl, "/").concat(path), options);
1717
-
1718
- case 8:
1719
- res = _context9.sent;
1720
- _context9.next = 11;
1721
- return res.json();
1722
-
1723
- case 11:
1724
- data = _context9.sent;
1725
-
1726
- if (res.ok) {
1727
- _context9.next = 14;
1728
- break;
1729
- }
480
+ exports.Provider = Provider;
1730
481
 
1731
- throw data;
482
+ var _fetchData = function () {
483
+ var _ref6 = _asyncToGenerator(function* (url) {
484
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1732
485
 
1733
- case 14:
1734
- return _context9.abrupt("return", Object.keys(data).length > 0 ? data : null);
486
+ try {
487
+ var res = yield fetch(url, options);
488
+ var data = yield res.json();
489
+ return Promise.resolve(Object.keys(data).length > 0 ? data : null);
490
+ } catch (error) {
491
+ _logger.default.error('CLIENT_FETCH_ERROR', url, error);
1735
492
 
1736
- case 17:
1737
- _context9.prev = 17;
1738
- _context9.t0 = _context9["catch"](1);
1739
- logger$1.error("CLIENT_FETCH_ERROR", path, _context9.t0);
1740
- return _context9.abrupt("return", null);
493
+ return Promise.resolve(null);
494
+ }
495
+ });
1741
496
 
1742
- case 21:
1743
- case "end":
1744
- return _context9.stop();
1745
- }
1746
- }
1747
- }, _callee9, null, [[1, 17]]);
1748
- }));
1749
- return _fetchData2.apply(this, arguments);
1750
- }
497
+ return function _fetchData(_x3) {
498
+ return _ref6.apply(this, arguments);
499
+ };
500
+ }();
1751
501
 
1752
- function _apiBaseUrl() {
1753
- if (typeof window === "undefined") {
502
+ var _apiBaseUrl = () => {
503
+ if (typeof window === 'undefined') {
1754
504
  if (!process.env.NEXTAUTH_URL) {
1755
- logger$1.warn("NEXTAUTH_URL", "NEXTAUTH_URL environment variable not set");
505
+ _logger.default.warn('NEXTAUTH_URL', 'NEXTAUTH_URL environment variable not set');
1756
506
  }
1757
507
 
1758
- return "".concat(__NEXTAUTH.baseUrlServer).concat(__NEXTAUTH.basePathServer);
508
+ return "".concat(__NEXTAUTH.baseUrl).concat(__NEXTAUTH.basePath);
509
+ } else {
510
+ return __NEXTAUTH.basePath;
1759
511
  }
512
+ };
1760
513
 
1761
- return __NEXTAUTH.basePath;
1762
- }
1763
-
1764
- function _now() {
1765
- return Math.floor(Date.now() / 1000);
1766
- }
1767
-
1768
- function BroadcastChannel() {
1769
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "nextauth.message";
1770
- return {
1771
- receive: function receive(onReceive) {
1772
- if (typeof window === "undefined") return;
1773
- window.addEventListener("storage", function () {
1774
- var _ref6 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(event) {
1775
- var message;
1776
- return _regenerator.default.wrap(function _callee3$(_context3) {
1777
- while (1) {
1778
- switch (_context3.prev = _context3.next) {
1779
- case 0:
1780
- if (!(event.key !== name)) {
1781
- _context3.next = 2;
1782
- break;
1783
- }
1784
-
1785
- return _context3.abrupt("return");
1786
-
1787
- case 2:
1788
- message = JSON.parse(event.newValue);
1789
-
1790
- if (!((message === null || message === void 0 ? void 0 : message.event) !== "session" || !(message !== null && message !== void 0 && message.data))) {
1791
- _context3.next = 5;
1792
- break;
1793
- }
1794
-
1795
- return _context3.abrupt("return");
1796
-
1797
- case 5:
1798
- onReceive(message);
1799
-
1800
- case 6:
1801
- case "end":
1802
- return _context3.stop();
1803
- }
1804
- }
1805
- }, _callee3);
1806
- }));
1807
-
1808
- return function (_x5) {
1809
- return _ref6.apply(this, arguments);
1810
- };
1811
- }());
1812
- },
1813
- post: function post(message) {
1814
- if (typeof localStorage === "undefined") return;
1815
- localStorage.setItem(name, JSON.stringify(_objectSpread(_objectSpread({}, message), {}, {
1816
- timestamp: _now()
1817
- })));
1818
- }
1819
- };
1820
- }
514
+ var _sendMessage = message => {
515
+ if (typeof localStorage !== 'undefined') {
516
+ var timestamp = Math.floor(new Date().getTime() / 1000);
517
+ localStorage.setItem('nextauth.message', JSON.stringify(_objectSpread(_objectSpread({}, message), {}, {
518
+ clientId: __NEXTAUTH._clientId,
519
+ timestamp
520
+ })));
521
+ }
522
+ };
1821
523
 
1822
524
  var _default = {
1823
- getSession: getSession,
1824
- getCsrfToken: getCsrfToken,
1825
- getProviders: getProviders,
1826
- useSession: useSession,
1827
- signIn: signIn,
1828
- signOut: signOut,
1829
- Provider: Provider,
1830
- setOptions: setOptions,
525
+ getSession,
526
+ getCsrfToken,
527
+ getProviders,
528
+ useSession,
529
+ signIn,
530
+ signOut,
531
+ Provider,
532
+ setOptions,
1831
533
  options: setOptions,
1832
534
  session: getSession,
1833
535
  providers: getProviders,
@@ -1839,24 +541,15 @@ exports.default = _default;
1839
541
  });
1840
542
 
1841
543
  _commonjsHelpers.unwrapExports(client);
1842
- var client_1 = client.useSession;
1843
- var client_2 = client.session;
1844
- var client_3 = client.getSession;
1845
- var client_4 = client.csrfToken;
1846
- var client_5 = client.getCsrfToken;
1847
- var client_6 = client.providers;
1848
- var client_7 = client.getProviders;
1849
- var client_8 = client.signin;
1850
- var client_9 = client.signIn;
1851
- var client_10 = client.signout;
1852
- var client_11 = client.signOut;
1853
- var client_12 = client.options;
1854
- var client_13 = client.setOptions;
1855
- var client_14 = client.Provider;
544
+ var client_1 = client.getSession;
545
+ var client_2 = client.signIn;
546
+ var client_3 = client.signOut;
547
+ var client_4 = client.Provider;
548
+ var client_5 = client.useSession;
1856
549
 
1857
550
  var client$1 = client.default;
1858
551
 
1859
- var css = ".AuthWrapper-module_loginBox__3l-BE {\n margin-bottom: 2rem;\n width: 350px;\n max-width: 90vw;\n margin-left: auto;\n margin-right: auto;\n /* box-shadow: 2px 5px 12px rgba(0, 0, 0, 0.15); */\n background: #fff;\n z-index: 1;\n}\n.AuthWrapper-module_loginBox_title__12rGD {\n margin-bottom: 2rem;\n text-align: center;\n}\n.AuthWrapper-module_bar__1dafn {\n background: #eee;\n margin-left: unset;\n margin-right: unset;\n}\n.AuthWrapper-module_bar__1dafn:nth-child(1) {\n float: left;\n border-right: 1rem solid #fff;\n background: rgb(245, 245, 245);\n height: 10rem;\n width: 25%;\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 2rem;\n}\n.AuthWrapper-module_bar__1dafn:nth-child(2n) {\n width: 97%;\n height: 1.5rem;\n margin-bottom: 0.25rem;\n}\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(3n) {\n width: 96%;\n height: 1.5rem;\n margin-bottom: 1.5rem;\n}\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(4n) {\n width: 72%;\n height: 1.5rem;\n margin-bottom: 0.25rem;\n}\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(5n) {\n width: 88%;\n height: 1.5rem;\n margin-bottom: 0.25rem;\n}\n\n.AuthWrapper-module_iframe__2wDJW {\n margin-top: -3rem;\n border: none;\n width: 100%;\n height: 1900px;\n}";
552
+ var css = ".AuthWrapper-module_loginBox__3l-BE {\r\n margin-bottom: 2rem;\r\n width: 350px;\r\n max-width: 90vw;\r\n margin-left: auto;\r\n margin-right: auto;\r\n /* box-shadow: 2px 5px 12px rgba(0, 0, 0, 0.15); */\r\n background: #fff;\r\n z-index: 1;\r\n}\r\n.AuthWrapper-module_loginBox_title__12rGD {\r\n margin-bottom: 2rem;\r\n text-align: center;\r\n}\r\n.AuthWrapper-module_bar__1dafn {\r\n background: #eee;\r\n margin-left: unset;\r\n margin-right: unset;\r\n}\r\n.AuthWrapper-module_bar__1dafn:nth-child(1) {\r\n float: left;\r\n border-right: 1rem solid #fff;\r\n background: rgb(245, 245, 245);\r\n height: 10rem;\r\n width: 25%;\r\n margin-left: auto;\r\n margin-right: auto;\r\n margin-bottom: 2rem;\r\n}\r\n.AuthWrapper-module_bar__1dafn:nth-child(2n) {\r\n width: 97%;\r\n height: 1.5rem;\r\n margin-bottom: 0.25rem;\r\n}\r\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(3n) {\r\n width: 96%;\r\n height: 1.5rem;\r\n margin-bottom: 1.5rem;\r\n}\r\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(4n) {\r\n width: 72%;\r\n height: 1.5rem;\r\n margin-bottom: 0.25rem;\r\n}\r\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(5n) {\r\n width: 88%;\r\n height: 1.5rem;\r\n margin-bottom: 0.25rem;\r\n}\r\n\r\n.AuthWrapper-module_iframe__2wDJW {\r\n margin-top: -3rem;\r\n border: none;\r\n width: 100%;\r\n height: 1900px;\r\n}";
1860
553
  var styles = { "loginBox": "AuthWrapper-module_loginBox__3l-BE", "loginBox_title": "AuthWrapper-module_loginBox_title__12rGD", "bar": "AuthWrapper-module_bar__1dafn", "iframe": "AuthWrapper-module_iframe__2wDJW" };
1861
554
  styleInject_es.styleInject(css);
1862
555
 
@@ -1867,27 +560,27 @@ var AuthWrapper = function AuthWrapper(_ref) {
1867
560
  formUrl = _ref$formUrl === undefined ? '' : _ref$formUrl;
1868
561
 
1869
562
  var _nextAuth$useSession = client$1.useSession(),
1870
- _nextAuth$useSession2 = slicedToArray$1._slicedToArray(_nextAuth$useSession, 2),
563
+ _nextAuth$useSession2 = slicedToArray._slicedToArray(_nextAuth$useSession, 2),
1871
564
  session = _nextAuth$useSession2[0],
1872
565
  loading = _nextAuth$useSession2[1];
1873
566
 
1874
567
  var _useState = React.useState(null),
1875
- _useState2 = slicedToArray$1._slicedToArray(_useState, 2),
568
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
1876
569
  callbackUrl = _useState2[0],
1877
570
  setCallbackUrl = _useState2[1];
1878
571
 
1879
572
  var _useState3 = React.useState(),
1880
- _useState4 = slicedToArray$1._slicedToArray(_useState3, 2),
573
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
1881
574
  email = _useState4[0],
1882
575
  setEmail = _useState4[1];
1883
576
 
1884
577
  var _useState5 = React.useState(false),
1885
- _useState6 = slicedToArray$1._slicedToArray(_useState5, 2),
578
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
1886
579
  showForm = _useState6[0],
1887
580
  setShowForm = _useState6[1];
1888
581
 
1889
582
  var _useState7 = React.useState(),
1890
- _useState8 = slicedToArray$1._slicedToArray(_useState7, 2),
583
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
1891
584
  password = _useState8[0],
1892
585
  setPassword = _useState8[1];
1893
586