@mjhls/mjh-framework 1.0.786-beta.1 → 1.0.786

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 (289) hide show
  1. package/dist/cjs/AD.js +10 -9
  2. package/dist/cjs/AD300x250.js +27 -26
  3. package/dist/cjs/AD300x250x600.js +27 -26
  4. package/dist/cjs/AD728x90.js +30 -29
  5. package/dist/cjs/ADFloatingFooter.js +29 -28
  6. package/dist/cjs/ADFooter.js +15 -14
  7. package/dist/cjs/ADGutter.js +29 -28
  8. package/dist/cjs/{ADInfeed-bb09e44c.js → ADInfeed-1e53d7db.js} +15 -13
  9. package/dist/cjs/ADSkyscraper.js +29 -28
  10. package/dist/cjs/ADSponsoredResources.js +29 -28
  11. package/dist/cjs/ADWebcast.js +29 -28
  12. package/dist/cjs/ADWelcome.js +30 -29
  13. package/dist/cjs/{ADlgInfeed-fa91dbda.js → ADlgInfeed-2494fd17.js} +11 -10
  14. package/dist/cjs/AccordionPanel.js +31 -29
  15. package/dist/cjs/AdSlot.js +32 -31
  16. package/dist/cjs/AdSlotsProvider.js +16 -15
  17. package/dist/cjs/AlphabeticList.js +25 -24
  18. package/dist/cjs/ArticleCarousel.js +24 -23
  19. package/dist/cjs/ArticleProgramLandingPage.js +57 -54
  20. package/dist/cjs/ArticleSeriesLandingPage.js +38 -37
  21. package/dist/cjs/ArticleSeriesListing.js +61 -60
  22. package/dist/cjs/Auth.js +4231 -0
  23. package/dist/cjs/{AuthorComponent-bb831b74.js → AuthorComponent-5fa89df5.js} +14 -13
  24. package/dist/cjs/Beam.js +8 -8
  25. package/dist/cjs/{BlockContent-091a991f.js → BlockContent-eca358e4.js} +25 -24
  26. package/dist/cjs/Breadcrumbs.js +29 -27
  27. package/dist/cjs/CMEDeck.js +82 -82
  28. package/dist/cjs/Column1.js +14 -11
  29. package/dist/cjs/Column2.js +35 -32
  30. package/dist/cjs/Column3.js +57 -54
  31. package/dist/cjs/ConferenceArticleCard.js +24 -23
  32. package/dist/cjs/ConferenceBanner-6c9e718a.js +24 -0
  33. package/dist/cjs/DeckContent.js +97 -93
  34. package/dist/cjs/DeckQueue.js +91 -87
  35. package/dist/cjs/{Dfp-b807d8fa.js → Dfp-a17e00fa.js} +32 -31
  36. package/dist/cjs/EventsDeck.js +138 -131
  37. package/dist/cjs/ExternalResources.js +80 -77
  38. package/dist/cjs/Feature.js +27 -25
  39. package/dist/cjs/ForbesHero.js +41 -40
  40. package/dist/cjs/GridContent.js +181 -177
  41. package/dist/cjs/GridHero.js +43 -42
  42. package/dist/cjs/GroupDeck.js +59 -58
  43. package/dist/cjs/HamMagazine.js +135 -130
  44. package/dist/cjs/Header.js +14 -12
  45. package/dist/cjs/Hero.js +13 -12
  46. package/dist/cjs/HighlightenVideo.js +18 -17
  47. package/dist/cjs/HorizontalArticleListing.js +71 -68
  48. package/dist/cjs/HorizontalHero.js +26 -25
  49. package/dist/cjs/IssueContentDeck.js +77 -72
  50. package/dist/cjs/IssueDeck.js +75 -70
  51. package/dist/cjs/IssueLanding.js +40 -39
  52. package/dist/cjs/LeftNav.js +37 -35
  53. package/dist/cjs/MasterDeck.js +70 -69
  54. package/dist/cjs/MediaSeriesLanding.js +40 -38
  55. package/dist/cjs/NavDvm.js +79 -74
  56. package/dist/cjs/{NavFooter-76c913e3.js → NavFooter-3dcd99a8.js} +15 -14
  57. package/dist/cjs/NavMagazine.js +142 -137
  58. package/dist/cjs/NavNative.js +134 -126
  59. package/dist/cjs/NavNormal.js +52 -47
  60. package/dist/cjs/OncliveHero.js +20 -20
  61. package/dist/cjs/OncliveLargeHero.js +67 -66
  62. package/dist/cjs/PageFilter.js +15 -14
  63. package/dist/cjs/PartnerDetailListing.js +112 -99
  64. package/dist/cjs/PdfDownload.js +9 -8
  65. package/dist/cjs/PopUpModal.js +21 -19
  66. package/dist/cjs/PubSection.js +39 -38
  67. package/dist/cjs/PubToc.js +16 -15
  68. package/dist/cjs/PublicationDeck.js +66 -61
  69. package/dist/cjs/PublicationLanding.js +83 -79
  70. package/dist/cjs/QueueDeckExpanded.js +291 -291
  71. package/dist/cjs/RecentNews.js +24 -23
  72. package/dist/cjs/RelatedContent.js +25 -24
  73. package/dist/cjs/RelatedTopicsDropdown.js +22 -19
  74. package/dist/cjs/RolesDeck.js +32 -27
  75. package/dist/cjs/Search.js +22 -18
  76. package/dist/cjs/Segment.js +6 -6
  77. package/dist/cjs/SeriesListingDeck.js +37 -37
  78. package/dist/cjs/{SeriesSlider-f662f1f5.js → SeriesSlider-193a2958.js} +38 -37
  79. package/dist/cjs/SetCookie.js +1 -1
  80. package/dist/cjs/SideFooter.js +35 -34
  81. package/dist/cjs/SocialIcons.js +10 -9
  82. package/dist/cjs/{SocialSearchComponent-8dd468fd.js → SocialSearchComponent-45c54bed.js} +40 -36
  83. package/dist/cjs/SocialShare.js +31 -29
  84. package/dist/cjs/TaxonomyCard.js +62 -57
  85. package/dist/cjs/TaxonomyDescription.js +54 -51
  86. package/dist/cjs/TemplateNormal.js +73 -72
  87. package/dist/cjs/ThumbnailCard.js +22 -20
  88. package/dist/cjs/Ustream.js +27 -26
  89. package/dist/cjs/VerticalHero.js +18 -17
  90. package/dist/cjs/VideoProgramLandingPage.js +76 -70
  91. package/dist/cjs/VideoSeriesCard.js +32 -31
  92. package/dist/cjs/VideoSeriesFilter.js +18 -18
  93. package/dist/cjs/VideoSeriesLandingPage.js +46 -45
  94. package/dist/cjs/VideoSeriesListing.js +78 -77
  95. package/dist/cjs/View.js +261 -255
  96. package/dist/cjs/YahooHero.js +40 -39
  97. package/dist/cjs/YoutubeGroup.js +63 -62
  98. package/dist/cjs/{_is-array-754e012d.js → _is-array-63ae4740.js} +6 -6
  99. package/dist/cjs/{_iter-detect-60b2f026.js → _iter-detect-2613ffa1.js} +2 -2
  100. package/dist/cjs/{_object-sap-5e74ba08.js → _object-sap-c5bd707d.js} +1 -1
  101. package/dist/cjs/{_object-to-array-5762f850.js → _object-to-array-bec5fcf2.js} +1 -1
  102. package/dist/cjs/{_to-object-329a650b.js → _to-object-821a2927.js} +4 -4
  103. package/dist/cjs/{asyncToGenerator-140e5f89.js → asyncToGenerator-b6a175bf.js} +7 -7
  104. package/dist/cjs/{brightcove-react-player-loader.es-156bd4d6.js → brightcove-react-player-loader.es-a195642e.js} +11 -9
  105. package/dist/cjs/{core.get-iterator-method-f62321d4.js → core.get-iterator-method-b4615fd3.js} +2 -2
  106. package/dist/cjs/{define-property-f4d12f4e.js → define-property-aff11f8a.js} +1 -1
  107. package/dist/cjs/{defineProperty-55548b25.js → defineProperty-d6fbb280.js} +1 -1
  108. package/dist/cjs/{entities-310b46ee.js → entities-3f9d0f2f.js} +1 -1
  109. package/dist/cjs/{es6.string.iterator-cc0bbaa4.js → es6.string.iterator-20d42c53.js} +2 -2
  110. package/dist/cjs/{extends-0a918631.js → extends-1e24fc8d.js} +1 -2
  111. package/dist/cjs/getRelatedArticle.js +443 -28
  112. package/dist/cjs/getRootDocGroup.js +6 -6
  113. package/dist/cjs/getSerializers.js +44 -42
  114. package/dist/cjs/{getTargeting-67f12cd7.js → getTargeting-497b581d.js} +3 -3
  115. package/dist/cjs/getTargeting.js +7 -7
  116. package/dist/cjs/iconBase-68959171.js +0 -3
  117. package/dist/cjs/{index-8bf6c863.js → index-0e4427c8.js} +12 -11
  118. package/dist/cjs/{index-3294d3bc.js → index-4d74ffd6.js} +40 -41
  119. package/dist/cjs/{index-57d0264f.js → index-4f6e2a09.js} +948 -1747
  120. package/dist/cjs/{index-da796b8c.js → index-80f57cff.js} +17 -15
  121. package/dist/cjs/index-bd6c9f56.js +211 -0
  122. package/dist/cjs/{index-be0c82be.js → index-d48b231c.js} +31 -25
  123. package/dist/cjs/{index.es-9110add6.js → index.es-f3e47207.js} +31 -12
  124. package/dist/cjs/{index.esm-ff47db6f.js → index.esm-05850a2f.js} +5 -12
  125. package/dist/cjs/{index.esm-66ffa47a.js → index.esm-3b9b8952.js} +4 -9
  126. package/dist/cjs/{index.esm-4d410430.js → index.esm-8123cf40.js} +20 -20
  127. package/dist/cjs/{index.esm-90433435.js → index.esm-974f47d9.js} +6 -15
  128. package/dist/cjs/index.js +166 -154
  129. package/dist/cjs/{inherits-452ff02c.js → inherits-2eb23889.js} +5 -8
  130. package/dist/cjs/{keys-a586b7a0.js → keys-95c064c9.js} +2 -2
  131. package/dist/cjs/{lodash-fc2922d0.js → lodash-4ef21f0f.js} +72 -23
  132. package/dist/cjs/{main-02daeefe.js → main-dc082238.js} +116 -80
  133. package/dist/cjs/{moment-575fe24c.js → moment-aca40de1.js} +11 -9
  134. package/dist/cjs/{react-social-icons-f7f48f71.js → react-social-icons-af932527.js} +28 -27
  135. package/dist/cjs/{slicedToArray-8f385299.js → slicedToArray-db24842a.js} +4 -4
  136. package/dist/cjs/{smoothscroll-5054361f.js → smoothscroll-99df7f93.js} +1 -1
  137. package/dist/cjs/{stringify-7c5aff47.js → stringify-01cf47f7.js} +1 -1
  138. package/dist/cjs/timeDifferenceCalc.js +1 -1
  139. package/dist/cjs/{toConsumableArray-9a3476fe.js → toConsumableArray-cf0865fc.js} +4 -4
  140. package/dist/cjs/{typeof-725500bc.js → typeof-97065d40.js} +7 -7
  141. package/dist/cjs/urlFor.js +2 -2
  142. package/dist/cjs/util-6f784d85.js +576 -0
  143. package/dist/cjs/{visibility-sensor-0c45a583.js → visibility-sensor-8b54af99.js} +7 -5
  144. package/dist/cjs/{web.dom.iterable-a0e279c1.js → web.dom.iterable-4480325a.js} +3 -3
  145. package/dist/esm/AD.js +7 -7
  146. package/dist/esm/AD300x250.js +23 -23
  147. package/dist/esm/AD300x250x600.js +23 -23
  148. package/dist/esm/AD728x90.js +26 -26
  149. package/dist/esm/ADFloatingFooter.js +25 -25
  150. package/dist/esm/ADFooter.js +11 -11
  151. package/dist/esm/ADGutter.js +25 -25
  152. package/dist/esm/{ADInfeed-0b552b0a.js → ADInfeed-94817c40.js} +9 -9
  153. package/dist/esm/ADSkyscraper.js +25 -25
  154. package/dist/esm/ADSponsoredResources.js +25 -25
  155. package/dist/esm/ADWebcast.js +25 -25
  156. package/dist/esm/ADWelcome.js +26 -26
  157. package/dist/esm/{ADlgInfeed-49f41f83.js → ADlgInfeed-6124ee3c.js} +8 -8
  158. package/dist/esm/AccordionPanel.js +24 -24
  159. package/dist/esm/AdSlot.js +22 -22
  160. package/dist/esm/AdSlotsProvider.js +12 -12
  161. package/dist/esm/AlphabeticList.js +21 -21
  162. package/dist/esm/ArticleCarousel.js +20 -20
  163. package/dist/esm/ArticleProgramLandingPage.js +53 -51
  164. package/dist/esm/ArticleSeriesLandingPage.js +34 -34
  165. package/dist/esm/ArticleSeriesListing.js +55 -55
  166. package/dist/esm/Auth.js +4211 -0
  167. package/dist/esm/{AuthorComponent-34b16174.js → AuthorComponent-c7ff069f.js} +11 -11
  168. package/dist/esm/Beam.js +8 -8
  169. package/dist/esm/{BlockContent-e9b4ddcf.js → BlockContent-d8cd739c.js} +4 -4
  170. package/dist/esm/Breadcrumbs.js +17 -17
  171. package/dist/esm/CMEDeck.js +78 -78
  172. package/dist/esm/Column1.js +5 -5
  173. package/dist/esm/Column2.js +26 -26
  174. package/dist/esm/Column3.js +47 -47
  175. package/dist/esm/ConferenceArticleCard.js +19 -19
  176. package/dist/esm/{ConferenceBanner-8792ebd2.js → ConferenceBanner-9162d0ca.js} +4 -4
  177. package/dist/esm/DeckContent.js +75 -75
  178. package/dist/esm/DeckQueue.js +65 -65
  179. package/dist/esm/{Dfp-ebc4b22f.js → Dfp-988dbcaa.js} +21 -21
  180. package/dist/esm/EventsDeck.js +84 -84
  181. package/dist/esm/ExternalResources.js +72 -70
  182. package/dist/esm/Feature.js +18 -18
  183. package/dist/esm/ForbesHero.js +34 -34
  184. package/dist/esm/GridContent.js +139 -139
  185. package/dist/esm/GridHero.js +36 -36
  186. package/dist/esm/GroupDeck.js +46 -46
  187. package/dist/esm/HamMagazine.js +104 -104
  188. package/dist/esm/Header.js +8 -8
  189. package/dist/esm/Hero.js +9 -9
  190. package/dist/esm/HighlightenVideo.js +14 -14
  191. package/dist/esm/HorizontalArticleListing.js +67 -65
  192. package/dist/esm/HorizontalHero.js +21 -21
  193. package/dist/esm/IssueContentDeck.js +49 -49
  194. package/dist/esm/IssueDeck.js +46 -46
  195. package/dist/esm/IssueLanding.js +36 -36
  196. package/dist/esm/LeftNav.js +31 -31
  197. package/dist/esm/MasterDeck.js +63 -63
  198. package/dist/esm/MediaSeriesLanding.js +31 -31
  199. package/dist/esm/NavDvm.js +56 -56
  200. package/dist/esm/{NavFooter-e27bd93b.js → NavFooter-c29526b7.js} +12 -12
  201. package/dist/esm/NavMagazine.js +113 -113
  202. package/dist/esm/NavNative.js +99 -99
  203. package/dist/esm/NavNormal.js +35 -35
  204. package/dist/esm/OncliveHero.js +16 -17
  205. package/dist/esm/OncliveLargeHero.js +59 -59
  206. package/dist/esm/PageFilter.js +12 -12
  207. package/dist/esm/PartnerDetailListing.js +107 -95
  208. package/dist/esm/PdfDownload.js +6 -6
  209. package/dist/esm/PopUpModal.js +14 -14
  210. package/dist/esm/PubSection.js +35 -35
  211. package/dist/esm/PubToc.js +12 -12
  212. package/dist/esm/PublicationDeck.js +38 -38
  213. package/dist/esm/PublicationLanding.js +54 -54
  214. package/dist/esm/QueueDeckExpanded.js +271 -271
  215. package/dist/esm/RecentNews.js +20 -20
  216. package/dist/esm/RelatedContent.js +19 -19
  217. package/dist/esm/RelatedTopicsDropdown.js +11 -11
  218. package/dist/esm/RolesDeck.js +13 -13
  219. package/dist/esm/Search.js +12 -12
  220. package/dist/esm/Segment.js +6 -6
  221. package/dist/esm/SeriesListingDeck.js +31 -31
  222. package/dist/esm/{SeriesSlider-9245785f.js → SeriesSlider-6a1081ff.js} +27 -27
  223. package/dist/esm/SetCookie.js +1 -1
  224. package/dist/esm/SideFooter.js +30 -30
  225. package/dist/esm/SocialIcons.js +7 -7
  226. package/dist/esm/{SocialSearchComponent-a2ae84d1.js → SocialSearchComponent-c3216d1a.js} +28 -28
  227. package/dist/esm/SocialShare.js +25 -25
  228. package/dist/esm/TaxonomyCard.js +41 -41
  229. package/dist/esm/TaxonomyDescription.js +48 -46
  230. package/dist/esm/TemplateNormal.js +66 -66
  231. package/dist/esm/ThumbnailCard.js +13 -13
  232. package/dist/esm/Ustream.js +23 -23
  233. package/dist/esm/VerticalHero.js +13 -13
  234. package/dist/esm/VideoProgramLandingPage.js +62 -60
  235. package/dist/esm/VideoSeriesCard.js +24 -24
  236. package/dist/esm/VideoSeriesFilter.js +15 -15
  237. package/dist/esm/VideoSeriesLandingPage.js +38 -38
  238. package/dist/esm/VideoSeriesListing.js +71 -71
  239. package/dist/esm/View.js +241 -239
  240. package/dist/esm/YahooHero.js +34 -34
  241. package/dist/esm/YoutubeGroup.js +46 -46
  242. package/dist/esm/{_is-array-58e95429.js → _is-array-674f71ec.js} +6 -6
  243. package/dist/esm/{_iter-detect-5d49a330.js → _iter-detect-48516cd3.js} +2 -2
  244. package/dist/esm/{_object-sap-964b6feb.js → _object-sap-fd3054d0.js} +1 -1
  245. package/dist/esm/{_object-to-array-7e804fce.js → _object-to-array-8f409e54.js} +1 -1
  246. package/dist/esm/{_to-object-a4107da3.js → _to-object-97770c52.js} +5 -5
  247. package/dist/esm/{asyncToGenerator-fc1c2e29.js → asyncToGenerator-585841c0.js} +7 -7
  248. package/dist/esm/{brightcove-react-player-loader.es-83f53e4e.js → brightcove-react-player-loader.es-b43c695a.js} +7 -6
  249. package/dist/esm/{core.get-iterator-method-e1de7503.js → core.get-iterator-method-d1d5ed02.js} +2 -2
  250. package/dist/esm/{define-property-8af5f002.js → define-property-ec6d528d.js} +1 -1
  251. package/dist/esm/{defineProperty-94fd8bfc.js → defineProperty-ea516b15.js} +1 -1
  252. package/dist/esm/{entities-7cc3bf45.js → entities-932b50cf.js} +1 -1
  253. package/dist/esm/{es6.string.iterator-c990c18c.js → es6.string.iterator-aa6068a3.js} +3 -3
  254. package/dist/esm/{extends-6f2fcc99.js → extends-31d65aba.js} +2 -2
  255. package/dist/esm/getRelatedArticle.js +443 -28
  256. package/dist/esm/getRootDocGroup.js +6 -6
  257. package/dist/esm/getSerializers.js +44 -42
  258. package/dist/esm/{getTargeting-ed6ebf43.js → getTargeting-2d402d66.js} +2 -2
  259. package/dist/esm/getTargeting.js +7 -7
  260. package/dist/esm/{index-73819142.js → index-3f5c03b2.js} +31 -25
  261. package/dist/esm/{index-5f9f807a.js → index-752d1dae.js} +10 -10
  262. package/dist/esm/{index-0141b5a9.js → index-761f5e47.js} +874 -1681
  263. package/dist/esm/{index-a9e53f80.js → index-888f9253.js} +6 -6
  264. package/dist/esm/{index-ef6d5dcf.js → index-ccb770c7.js} +40 -41
  265. package/dist/esm/index-db3bb315.js +207 -0
  266. package/dist/esm/{index.es-29c1cef5.js → index.es-c6222053.js} +28 -10
  267. package/dist/esm/{index.esm-29e48d38.js → index.esm-3fdda599.js} +6 -15
  268. package/dist/esm/{index.esm-fd746768.js → index.esm-8016b507.js} +17 -18
  269. package/dist/esm/{index.esm-cf08bf18.js → index.esm-a8ff922c.js} +5 -12
  270. package/dist/esm/{index.esm-b08f4b04.js → index.esm-d6f88d94.js} +4 -9
  271. package/dist/esm/index.js +132 -124
  272. package/dist/esm/{inherits-cf8dde54.js → inherits-5906fbea.js} +6 -6
  273. package/dist/esm/{keys-8eda7a5c.js → keys-a0b0c7a4.js} +2 -2
  274. package/dist/esm/{lodash-17fdfebb.js → lodash-ad27652f.js} +72 -23
  275. package/dist/esm/{main-e4a934b2.js → main-1450d277.js} +113 -78
  276. package/dist/esm/{moment-e2f9b20c.js → moment-bc12cb97.js} +11 -9
  277. package/dist/esm/{react-social-icons-a7d5c5c7.js → react-social-icons-91f9716f.js} +20 -20
  278. package/dist/esm/{slicedToArray-641f241f.js → slicedToArray-cdeaee08.js} +4 -4
  279. package/dist/esm/{smoothscroll-0cd4c7a6.js → smoothscroll-fa4e3f8c.js} +1 -1
  280. package/dist/esm/{stringify-4330ccdc.js → stringify-d4839bab.js} +1 -1
  281. package/dist/esm/timeDifferenceCalc.js +1 -1
  282. package/dist/esm/{toConsumableArray-43aa614d.js → toConsumableArray-fa2dcda7.js} +4 -4
  283. package/dist/esm/{typeof-6435ba1c.js → typeof-e9cea9e8.js} +7 -7
  284. package/dist/esm/urlFor.js +1 -1
  285. package/dist/esm/util-3ab476bf.js +574 -0
  286. package/dist/esm/{visibility-sensor-0baa4eea.js → visibility-sensor-082c757b.js} +2 -2
  287. package/dist/esm/{web.dom.iterable-4439f05a.js → web.dom.iterable-035980f3.js} +3 -3
  288. package/package.json +3 -3
  289. package/dist/cjs/ConferenceBanner-4a16fddc.js +0 -23
@@ -0,0 +1,4231 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var asyncToGenerator = require('./asyncToGenerator-b6a175bf.js');
6
+ var stringify = require('./stringify-01cf47f7.js');
7
+ var slicedToArray = require('./slicedToArray-db24842a.js');
8
+ var React = require('react');
9
+ var Router = require('next/router');
10
+ var _extends = require('./extends-1e24fc8d.js');
11
+ var reactBootstrap = require('react-bootstrap');
12
+ var useSWR = require('swr');
13
+ var index = require('./index-bd6c9f56.js');
14
+ var Local = require('passport-local');
15
+ var mysql = require('mysql');
16
+ var util = require('./util-6f784d85.js');
17
+ var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
18
+ require('./es6.string.iterator-20d42c53.js');
19
+ require('./_to-object-821a2927.js');
20
+ require('./web.dom.iterable-4480325a.js');
21
+ require('./_library-dd23b178.js');
22
+ require('./core.get-iterator-method-b4615fd3.js');
23
+ require('./_iter-detect-2613ffa1.js');
24
+ require('./_object-pie-68c5bcbc.js');
25
+
26
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
+
28
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
+ var Router__default = /*#__PURE__*/_interopDefaultLegacy(Router);
30
+ var useSWR__default = /*#__PURE__*/_interopDefaultLegacy(useSWR);
31
+ var Local__default = /*#__PURE__*/_interopDefaultLegacy(Local);
32
+ var mysql__default = /*#__PURE__*/_interopDefaultLegacy(mysql);
33
+
34
+ var returnFormField = function returnFormField(_ref) {
35
+ var name = _ref.name,
36
+ label = _ref.label,
37
+ type = _ref.type,
38
+ _ref$required = _ref.required,
39
+ required = _ref$required === undefined ? false : _ref$required,
40
+ _ref$readonly = _ref.readonly,
41
+ readonly = _ref$readonly === undefined ? false : _ref$readonly,
42
+ _ref$options = _ref.options,
43
+ options = _ref$options === undefined ? null : _ref$options,
44
+ _ref$groupType = _ref.groupType,
45
+ groupType = _ref$groupType === undefined ? '' : _ref$groupType,
46
+ _ref$errors = _ref.errors,
47
+ errors = _ref$errors === undefined ? {} : _ref$errors,
48
+ _ref$handleChanged = _ref.handleChanged,
49
+ handleChanged = _ref$handleChanged === undefined ? null : _ref$handleChanged,
50
+ _ref$default_value = _ref.default_value,
51
+ default_value = _ref$default_value === undefined ? null : _ref$default_value;
52
+
53
+ var opts = [];
54
+ if (groupType) {
55
+ opts['as'] = groupType;
56
+ if (groupType === reactBootstrap.Col) {
57
+ opts['xs'] = 12;
58
+ opts['md'] = 6;
59
+ }
60
+ }
61
+
62
+ if (handleChanged) {
63
+ opts['onChange'] = handleChanged;
64
+ }
65
+
66
+ if (readonly) {
67
+ opts['readOnly'] = readonly;
68
+ }
69
+
70
+ if (type == 'text' || type == 'email' || type == 'password' || type == 'number') {
71
+ return React__default['default'].createElement(
72
+ reactBootstrap.Form.Group,
73
+ _extends._extends({}, opts, { controlId: name }),
74
+ React__default['default'].createElement(
75
+ reactBootstrap.Form.Label,
76
+ { kye: name + '_label' },
77
+ label,
78
+ required && React__default['default'].createElement(
79
+ 'span',
80
+ { style: { color: 'red' } },
81
+ '*'
82
+ )
83
+ ),
84
+ React__default['default'].createElement(reactBootstrap.Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
85
+ React__default['default'].createElement(
86
+ reactBootstrap.Form.Control.Feedback,
87
+ { key: name + '_feedback', type: 'invalid' },
88
+ errors[name]
89
+ )
90
+ );
91
+ }
92
+ if (type == 'select') {
93
+ return React__default['default'].createElement(
94
+ reactBootstrap.Form.Group,
95
+ _extends._extends({}, opts, { key: name, controlId: name }),
96
+ React__default['default'].createElement(
97
+ reactBootstrap.Form.Label,
98
+ { key: name + '_' + label },
99
+ label,
100
+ required && React__default['default'].createElement(
101
+ 'span',
102
+ { key: name + '_required_span', style: { color: 'red' } },
103
+ '*'
104
+ )
105
+ ),
106
+ React__default['default'].createElement(
107
+ reactBootstrap.Form.Control,
108
+ { key: name + '_select', as: 'select', name: name, required: required, defaultValue: default_value },
109
+ React__default['default'].createElement('option', { value: '', key: name + '_options_empty' }),
110
+ options.map(function (option, index) {
111
+ var value = option.value ? option.value : option;
112
+ var label = option.label ? option.label : option;
113
+ var key = name + '_options_' + index;
114
+ return React__default['default'].createElement(
115
+ 'option',
116
+ { key: key, value: value },
117
+ label
118
+ );
119
+ })
120
+ )
121
+ );
122
+ }
123
+
124
+ if (type == 'radio' || type == 'checkbox') {
125
+ return React__default['default'].createElement(
126
+ reactBootstrap.Form.Group,
127
+ opts,
128
+ React__default['default'].createElement(
129
+ reactBootstrap.Form.Label,
130
+ null,
131
+ label,
132
+ required && React__default['default'].createElement(
133
+ 'span',
134
+ { style: { color: 'red' } },
135
+ '*'
136
+ )
137
+ ),
138
+ options.map(function (option, index) {
139
+ return React__default['default'].createElement(
140
+ reactBootstrap.Form.Check,
141
+ { type: type, key: index, required: required },
142
+ React__default['default'].createElement(reactBootstrap.Form.Check.Input, { type: type, key: type + '_' + index + '_input', defaultChecked: default_value ? default_value === option.value : false, name: name, id: name + '_' + index, value: option.value, required: required }),
143
+ React__default['default'].createElement(reactBootstrap.Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
144
+ );
145
+ })
146
+ );
147
+ }
148
+ };
149
+
150
+ var _this = undefined;
151
+
152
+ var dataHandler = function () {
153
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(api_url, body) {
154
+ var res, result;
155
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
156
+ while (1) {
157
+ switch (_context.prev = _context.next) {
158
+ case 0:
159
+ _context.prev = 0;
160
+ _context.next = 3;
161
+ return fetch(api_url, {
162
+ method: 'POST',
163
+ headers: { 'Content-Type': 'application/json' },
164
+ body: stringify._JSON$stringify(body)
165
+ });
166
+
167
+ case 3:
168
+ res = _context.sent;
169
+
170
+ if (!(res.status === 200)) {
171
+ _context.next = 13;
172
+ break;
173
+ }
174
+
175
+ _context.next = 7;
176
+ return res.json();
177
+
178
+ case 7:
179
+ result = _context.sent;
180
+
181
+ if (!result.error) {
182
+ _context.next = 10;
183
+ break;
184
+ }
185
+
186
+ throw new Error(result.error);
187
+
188
+ case 10:
189
+ return _context.abrupt('return', result.data);
190
+
191
+ case 13:
192
+ _context.t0 = Error;
193
+ _context.next = 16;
194
+ return res.text();
195
+
196
+ case 16:
197
+ _context.t1 = _context.sent;
198
+ throw new _context.t0(_context.t1);
199
+
200
+ case 18:
201
+ _context.next = 24;
202
+ break;
203
+
204
+ case 20:
205
+ _context.prev = 20;
206
+ _context.t2 = _context['catch'](0);
207
+
208
+ console.error('data handler failed : ' + api_url, _context.t2);
209
+ return _context.abrupt('return', null);
210
+
211
+ case 24:
212
+ case 'end':
213
+ return _context.stop();
214
+ }
215
+ }
216
+ }, _callee, _this, [[0, 20]]);
217
+ }));
218
+
219
+ return function dataHandler(_x, _x2) {
220
+ return _ref.apply(this, arguments);
221
+ };
222
+ }();
223
+
224
+ function useUser() {
225
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
226
+ redirectTo = _ref.redirectTo,
227
+ redirectIfFound = _ref.redirectIfFound;
228
+
229
+ var _useSWR = useSWR__default['default']('/api/auth/user', dataHandler),
230
+ data = _useSWR.data,
231
+ error = _useSWR.error;
232
+
233
+ var user = data;
234
+ var finished = Boolean(data);
235
+ var hasUser = Boolean(user);
236
+
237
+ React.useEffect(function () {
238
+ if (!redirectTo || !finished) return;
239
+ if (
240
+ // If redirectTo is set, redirect if the user was not found.
241
+ redirectTo && !redirectIfFound && !hasUser ||
242
+ // If redirectIfFound is also set, redirect if the user was found
243
+ redirectIfFound && hasUser) {
244
+ Router__default['default'].push(redirectTo);
245
+ }
246
+ }, [redirectTo, redirectIfFound, finished, hasUser]);
247
+
248
+ return error ? null : user;
249
+ }
250
+
251
+ var hooks = /*#__PURE__*/Object.freeze({
252
+ __proto__: null,
253
+ useUser: useUser
254
+ });
255
+
256
+ var LoginForm = function LoginForm(props) {
257
+ var handleSubmit = function () {
258
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(e) {
259
+ var body, res;
260
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
261
+ while (1) {
262
+ switch (_context.prev = _context.next) {
263
+ case 0:
264
+ event.preventDefault();
265
+
266
+ if (errorMsg) setErrorMsg('');
267
+ setLoading(true);
268
+
269
+ body = {
270
+ email: e.currentTarget.email.value,
271
+ password: e.currentTarget.password.value
272
+ };
273
+ _context.prev = 4;
274
+ _context.next = 7;
275
+ return fetch('/api/auth/login', {
276
+ method: 'POST',
277
+ headers: { 'Content-Type': 'application/json' },
278
+ body: stringify._JSON$stringify(body)
279
+ });
280
+
281
+ case 7:
282
+ res = _context.sent;
283
+
284
+ setLoading(false);
285
+
286
+ if (!(res.status === 200)) {
287
+ _context.next = 13;
288
+ break;
289
+ }
290
+
291
+ // here, Router.push() does not carry new cookie value.
292
+ // so need hard redirect
293
+ window.location.href = callbackUrl;
294
+ _context.next = 18;
295
+ break;
296
+
297
+ case 13:
298
+ _context.t0 = Error;
299
+ _context.next = 16;
300
+ return res.text();
301
+
302
+ case 16:
303
+ _context.t1 = _context.sent;
304
+ throw new _context.t0(_context.t1);
305
+
306
+ case 18:
307
+ _context.next = 23;
308
+ break;
309
+
310
+ case 20:
311
+ _context.prev = 20;
312
+ _context.t2 = _context['catch'](4);
313
+
314
+ setErrorMsg(_context.t2.message);
315
+
316
+ case 23:
317
+ case 'end':
318
+ return _context.stop();
319
+ }
320
+ }
321
+ }, _callee, this, [[4, 20]]);
322
+ }));
323
+
324
+ return function handleSubmit(_x) {
325
+ return _ref.apply(this, arguments);
326
+ };
327
+ }();
328
+
329
+ var _props$callbackUrl = props.callbackUrl,
330
+ callbackUrl = _props$callbackUrl === undefined ? '/' : _props$callbackUrl;
331
+
332
+
333
+ React.useEffect(function () {
334
+ if (props.user) {
335
+ window.location.href = '/auth/profile';
336
+ }
337
+ }, []);
338
+ useUser('/auth/profile', true);
339
+
340
+ var _useState = React.useState(''),
341
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
342
+ errorMsg = _useState2[0],
343
+ setErrorMsg = _useState2[1];
344
+
345
+ var _useState3 = React.useState(false),
346
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
347
+ loading = _useState4[0],
348
+ setLoading = _useState4[1];
349
+
350
+ return React__default['default'].createElement(
351
+ reactBootstrap.Form,
352
+ { className: 'login', onSubmit: handleSubmit },
353
+ React__default['default'].createElement(
354
+ 'h1',
355
+ null,
356
+ 'Login'
357
+ ),
358
+ React__default['default'].createElement('hr', null),
359
+ returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
360
+ returnFormField({ name: 'password', label: 'Password', type: 'password', required: true }),
361
+ React__default['default'].createElement('hr', null),
362
+ React__default['default'].createElement(
363
+ reactBootstrap.Form.Row,
364
+ null,
365
+ React__default['default'].createElement(
366
+ reactBootstrap.Form.Group,
367
+ { as: reactBootstrap.Col },
368
+ React__default['default'].createElement(
369
+ 'a',
370
+ { href: '/auth/signup' },
371
+ 'I don\'t have an account'
372
+ )
373
+ ),
374
+ React__default['default'].createElement(
375
+ reactBootstrap.Form.Group,
376
+ { as: reactBootstrap.Col, className: 'text-right' },
377
+ !loading && React__default['default'].createElement(
378
+ reactBootstrap.Button,
379
+ { type: 'submit' },
380
+ 'Login'
381
+ ),
382
+ loading && React__default['default'].createElement(
383
+ reactBootstrap.Button,
384
+ { variant: 'primary', disabled: true },
385
+ React__default['default'].createElement(reactBootstrap.Spinner, { as: 'span', animation: 'border', role: 'status', 'aria-hidden': 'true', size: 'sm' }),
386
+ React__default['default'].createElement(
387
+ 'span',
388
+ { className: 'sr-only' },
389
+ 'Loading...'
390
+ )
391
+ )
392
+ )
393
+ ),
394
+ errorMsg && React__default['default'].createElement(
395
+ 'p',
396
+ { className: 'error' },
397
+ errorMsg
398
+ ),
399
+ React__default['default'].createElement(
400
+ 'style',
401
+ { jsx: 'true'.toString() },
402
+ '\n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n '
403
+ )
404
+ );
405
+ };
406
+
407
+ // get country & state options
408
+ var countries = ["United States", "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas (the)", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia (Plurinational State of)", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory (the)", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Cayman Islands (the)", "Central African Republic (the)", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands (the)", "Colombia", "Comoros (the)", "Congo (the Democratic Republic of the)", "Congo (the)", "Cook Islands (the)", "Costa Rica", "Croatia", "Cuba", "Curaçao", "Cyprus", "Czechia", "Côte d'Ivoire", "Denmark", "Djibouti", "Dominica", "Dominican Republic (the)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Eswatini", "Ethiopia", "Falkland Islands (the) [Malvinas]", "Faroe Islands (the)", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories (the)", "Gabon", "Gambia (the)", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Holy See (the)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea (the Democratic People's Republic of)", "Korea (the Republic of)", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic (the)", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands (the)", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia (Federated States of)", "Moldova (the Republic of)", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands (the)", "New Caledonia", "New Zealand", "Nicaragua", "Niger (the)", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands (the)", "Norway", "Oman", "Pakistan", "Palau", "Palestine, State of", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines (the)", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Republic of North Macedonia", "Romania", "Russian Federation (the)", "Rwanda", "Réunion", "Saint Barthélemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin (French part)", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten (Dutch part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Sudan", "Spain", "Sri Lanka", "Sudan (the)", "Suriname", "Svalbard and Jan Mayen", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan (Province of China)", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands (the)", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates (the)", "United Kingdom of Great Britain and Northern Ireland (the)", "United States Minor Outlying Islands (the)", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela (Bolivarian Republic of)", "Viet Nam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe", "Åland Islands"];
409
+
410
+ var states = ['AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FM', 'FL', 'GA', 'GU', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MH', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'MP', 'OH', 'OK', 'OR', 'PW', 'PA', 'PR', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VI', 'VA', 'WA', 'WV', 'WI', 'WY'];
411
+
412
+ var _this$1 = undefined;
413
+
414
+ var SignupForm = function SignupForm(props) {
415
+ var handleSubmit = function () {
416
+ var _ref3 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee3(e) {
417
+ var formData, body, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, key, res;
418
+
419
+ return asyncToGenerator.regenerator.wrap(function _callee3$(_context3) {
420
+ while (1) {
421
+ switch (_context3.prev = _context3.next) {
422
+ case 0:
423
+ event.preventDefault();
424
+ setLoading(true);
425
+ if (errorMsg) setErrorMsg('');
426
+
427
+ formData = new FormData(e.currentTarget);
428
+ body = {};
429
+ _iteratorNormalCompletion = true;
430
+ _didIteratorError = false;
431
+ _iteratorError = undefined;
432
+ _context3.prev = 8;
433
+
434
+ for (_iterator = slicedToArray._getIterator(formData.keys()); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
435
+ key = _step.value;
436
+
437
+ body[key] = formData.get(key);
438
+ }
439
+
440
+ _context3.next = 16;
441
+ break;
442
+
443
+ case 12:
444
+ _context3.prev = 12;
445
+ _context3.t0 = _context3['catch'](8);
446
+ _didIteratorError = true;
447
+ _iteratorError = _context3.t0;
448
+
449
+ case 16:
450
+ _context3.prev = 16;
451
+ _context3.prev = 17;
452
+
453
+ if (!_iteratorNormalCompletion && _iterator.return) {
454
+ _iterator.return();
455
+ }
456
+
457
+ case 19:
458
+ _context3.prev = 19;
459
+
460
+ if (!_didIteratorError) {
461
+ _context3.next = 22;
462
+ break;
463
+ }
464
+
465
+ throw _iteratorError;
466
+
467
+ case 22:
468
+ return _context3.finish(19);
469
+
470
+ case 23:
471
+ return _context3.finish(16);
472
+
473
+ case 24:
474
+ _context3.prev = 24;
475
+ _context3.next = 27;
476
+ return fetch('/api/auth/signup', {
477
+ method: 'POST',
478
+ headers: { 'Content-Type': 'application/json' },
479
+ body: stringify._JSON$stringify(body)
480
+ });
481
+
482
+ case 27:
483
+ res = _context3.sent;
484
+
485
+ setLoading(false);
486
+
487
+ if (!(res.status === 200)) {
488
+ _context3.next = 33;
489
+ break;
490
+ }
491
+
492
+ window.location.href = '/';
493
+ _context3.next = 38;
494
+ break;
495
+
496
+ case 33:
497
+ _context3.t1 = Error;
498
+ _context3.next = 36;
499
+ return res.text();
500
+
501
+ case 36:
502
+ _context3.t2 = _context3.sent;
503
+ throw new _context3.t1(_context3.t2);
504
+
505
+ case 38:
506
+ _context3.next = 43;
507
+ break;
508
+
509
+ case 40:
510
+ _context3.prev = 40;
511
+ _context3.t3 = _context3['catch'](24);
512
+
513
+ setErrorMsg(_context3.t3.message);
514
+
515
+ case 43:
516
+ case 'end':
517
+ return _context3.stop();
518
+ }
519
+ }
520
+ }, _callee3, this, [[8, 12, 16, 24], [17,, 19, 23], [24, 40]]);
521
+ }));
522
+
523
+ return function handleSubmit(_x2) {
524
+ return _ref3.apply(this, arguments);
525
+ };
526
+ }();
527
+
528
+ var _useState = React.useState(''),
529
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
530
+ errorMsg = _useState2[0],
531
+ setErrorMsg = _useState2[1];
532
+
533
+ var _useState3 = React.useState(false),
534
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
535
+ countryUS = _useState4[0],
536
+ setCountryUS = _useState4[1];
537
+
538
+ var _useState5 = React.useState([]),
539
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
540
+ healthcareOccupation = _useState6[0],
541
+ setHealthcareOccupation = _useState6[1];
542
+
543
+ var _useState7 = React.useState([]),
544
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
545
+ nonHealthcareOccupation = _useState8[0],
546
+ setNonHealthcareOccupation = _useState8[1];
547
+
548
+ var loadInitData = function () {
549
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
550
+ var healthcare_occupation, non_healthcare_occupation;
551
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
552
+ while (1) {
553
+ switch (_context.prev = _context.next) {
554
+ case 0:
555
+ _context.next = 2;
556
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Healthcare' });
557
+
558
+ case 2:
559
+ healthcare_occupation = _context.sent;
560
+ _context.next = 5;
561
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Non-Healthcare' });
562
+
563
+ case 5:
564
+ non_healthcare_occupation = _context.sent;
565
+
566
+
567
+ setHealthcareOccupation(healthcare_occupation);
568
+ setNonHealthcareOccupation(non_healthcare_occupation);
569
+
570
+ case 8:
571
+ case 'end':
572
+ return _context.stop();
573
+ }
574
+ }
575
+ }, _callee, _this$1);
576
+ }));
577
+
578
+ return function loadInitData() {
579
+ return _ref.apply(this, arguments);
580
+ };
581
+ }();
582
+
583
+ React.useEffect(function () {
584
+ if (props.user) {
585
+ window.location.href = '/auth/profile';
586
+ } else {
587
+ loadInitData();
588
+ }
589
+ }, []);
590
+
591
+ // make it to change layout based on radio buton
592
+ var handleCountryChanged = function handleCountryChanged(e) {
593
+ if (e.target.value === 'United States') {
594
+ setCountryUS(true);
595
+ } else {
596
+ setCountryUS(false);
597
+ }
598
+ };
599
+
600
+ var _useState9 = React.useState(true),
601
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
602
+ healcareProfessional = _useState10[0],
603
+ setHealthcareProfessional = _useState10[1];
604
+
605
+ var handleHealthcareProfessionalChanged = function handleHealthcareProfessionalChanged(e) {
606
+
607
+ if (e.target.value === 'Y') {
608
+ setHealthcareProfessional(true);
609
+ } else {
610
+ setHealthcareProfessional(false);
611
+ }
612
+ document.getElementById('occupation').value = '';
613
+ setOccupationFields(null);
614
+ };
615
+
616
+ var _useState11 = React.useState(null),
617
+ _useState12 = slicedToArray._slicedToArray(_useState11, 2),
618
+ occupationFields = _useState12[0],
619
+ setOccupationFields = _useState12[1];
620
+
621
+ var handleOccupationChanged = function () {
622
+ var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(e) {
623
+ var occupation, fields;
624
+ return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
625
+ while (1) {
626
+ switch (_context2.prev = _context2.next) {
627
+ case 0:
628
+ occupation = e.target.value;
629
+ _context2.next = 3;
630
+ return dataHandler('/api/auth/data', { action: 'get-fields', occupation: occupation });
631
+
632
+ case 3:
633
+ fields = _context2.sent;
634
+
635
+ setOccupationFields(fields);
636
+
637
+ case 5:
638
+ case 'end':
639
+ return _context2.stop();
640
+ }
641
+ }
642
+ }, _callee2, _this$1);
643
+ }));
644
+
645
+ return function handleOccupationChanged(_x) {
646
+ return _ref2.apply(this, arguments);
647
+ };
648
+ }();
649
+
650
+ var _useState13 = React.useState(false),
651
+ _useState14 = slicedToArray._slicedToArray(_useState13, 2),
652
+ loading = _useState14[0],
653
+ setLoading = _useState14[1];
654
+
655
+ return React__default['default'].createElement(
656
+ reactBootstrap.Form,
657
+ { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
658
+ React__default['default'].createElement(
659
+ 'h1',
660
+ null,
661
+ 'Sign Up'
662
+ ),
663
+ React__default['default'].createElement('hr', null),
664
+ returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
665
+ React__default['default'].createElement(
666
+ reactBootstrap.Form.Row,
667
+ null,
668
+ returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: reactBootstrap.Col, required: true }),
669
+ returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: reactBootstrap.Col, required: true })
670
+ ),
671
+ React__default['default'].createElement(
672
+ reactBootstrap.Form.Row,
673
+ null,
674
+ returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: reactBootstrap.Col, required: true }),
675
+ returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: reactBootstrap.Col, required: true })
676
+ ),
677
+ React__default['default'].createElement(
678
+ reactBootstrap.Form.Row,
679
+ null,
680
+ returnFormField({
681
+ name: 'country',
682
+ label: 'Country',
683
+ type: 'select',
684
+ required: true,
685
+ groupType: reactBootstrap.Col,
686
+ options: countries,
687
+ handleChanged: handleCountryChanged
688
+ }),
689
+ countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: reactBootstrap.Col, options: states })
690
+ ),
691
+ React__default['default'].createElement(
692
+ reactBootstrap.Form.Row,
693
+ null,
694
+ countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: reactBootstrap.Col }),
695
+ countryUS && returnFormField({ name: 'phone', label: 'Phone', type: 'text', required: true, groupType: reactBootstrap.Col })
696
+ ),
697
+ returnFormField({
698
+ name: 'healthcare_professional',
699
+ label: 'Are You a Health Care Professional?',
700
+ type: 'radio',
701
+ required: true,
702
+ options: [{ value: 'Y', label: 'Yes', checked: true }, { value: 'N', label: 'No', checked: false }],
703
+ handleChanged: handleHealthcareProfessionalChanged,
704
+ default_value: 'Y'
705
+ }),
706
+ healcareProfessional && returnFormField({
707
+ name: 'occupation',
708
+ label: 'Occupation',
709
+ type: 'select',
710
+ required: true,
711
+ options: healthcareOccupation,
712
+ handleChanged: handleOccupationChanged
713
+ }),
714
+ !healcareProfessional && returnFormField({
715
+ name: 'occupation',
716
+ label: 'Non Provider Role',
717
+ type: 'select',
718
+ required: true,
719
+ options: nonHealthcareOccupation,
720
+ handleChanged: handleOccupationChanged
721
+ }),
722
+ occupationFields && occupationFields.map(function (field) {
723
+ return returnFormField({
724
+ name: field.name,
725
+ label: field.label,
726
+ type: field.type,
727
+ required: field.required === 1,
728
+ options: field.options
729
+ });
730
+ }),
731
+ returnFormField({
732
+ name: 'agree',
733
+ label: 'Terms & Conditions | Privacy Policy',
734
+ type: 'checkbox',
735
+ required: true,
736
+ options: [{ label: 'By registering you agree to our <a href="/terms" style="color:blue">Terms and Conditions</a> and <a href="/privacy" style="color:blue">Privacy Policy</a> and understand that you will be receiving email communications', value: 'Y' }]
737
+ }),
738
+ React__default['default'].createElement('hr', null),
739
+ React__default['default'].createElement(
740
+ reactBootstrap.Form.Row,
741
+ null,
742
+ React__default['default'].createElement(
743
+ reactBootstrap.Form.Group,
744
+ { as: reactBootstrap.Col },
745
+ React__default['default'].createElement(
746
+ 'a',
747
+ { href: '/auth/login' },
748
+ 'I already have an account'
749
+ )
750
+ ),
751
+ React__default['default'].createElement(
752
+ reactBootstrap.Form.Group,
753
+ { as: reactBootstrap.Col, className: 'text-right' },
754
+ !loading && React__default['default'].createElement(
755
+ reactBootstrap.Button,
756
+ { type: 'submit' },
757
+ 'Sign Up'
758
+ ),
759
+ loading && React__default['default'].createElement(
760
+ reactBootstrap.Button,
761
+ { variant: 'primary', disabled: true },
762
+ React__default['default'].createElement(reactBootstrap.Spinner, {
763
+ as: 'span',
764
+ animation: 'border',
765
+ role: 'status',
766
+ 'aria-hidden': 'true',
767
+ size: 'sm'
768
+ }),
769
+ React__default['default'].createElement(
770
+ 'span',
771
+ { className: 'sr-only' },
772
+ 'Loading...'
773
+ )
774
+ )
775
+ )
776
+ ),
777
+ errorMsg && React__default['default'].createElement(
778
+ 'p',
779
+ { className: 'error' },
780
+ errorMsg
781
+ ),
782
+ React__default['default'].createElement(
783
+ 'style',
784
+ { jsx: 'true'.toString() },
785
+ ' \n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n '
786
+ )
787
+ );
788
+ };
789
+
790
+ var _this$2 = undefined;
791
+
792
+ var SignupForm$1 = function SignupForm(props) {
793
+ var handleSubmit = function () {
794
+ var _ref3 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee3(e) {
795
+ var formData, body, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, key, res;
796
+
797
+ return asyncToGenerator.regenerator.wrap(function _callee3$(_context3) {
798
+ while (1) {
799
+ switch (_context3.prev = _context3.next) {
800
+ case 0:
801
+ event.preventDefault();
802
+
803
+ setErrorMsg('');
804
+ setSuccessMsg('');
805
+ setLoading(true);
806
+
807
+ formData = new FormData(e.currentTarget);
808
+ body = {};
809
+ _iteratorNormalCompletion = true;
810
+ _didIteratorError = false;
811
+ _iteratorError = undefined;
812
+ _context3.prev = 9;
813
+
814
+ for (_iterator = slicedToArray._getIterator(formData.keys()); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
815
+ key = _step.value;
816
+
817
+ body[key] = formData.get(key);
818
+ }
819
+
820
+ _context3.next = 17;
821
+ break;
822
+
823
+ case 13:
824
+ _context3.prev = 13;
825
+ _context3.t0 = _context3['catch'](9);
826
+ _didIteratorError = true;
827
+ _iteratorError = _context3.t0;
828
+
829
+ case 17:
830
+ _context3.prev = 17;
831
+ _context3.prev = 18;
832
+
833
+ if (!_iteratorNormalCompletion && _iterator.return) {
834
+ _iterator.return();
835
+ }
836
+
837
+ case 20:
838
+ _context3.prev = 20;
839
+
840
+ if (!_didIteratorError) {
841
+ _context3.next = 23;
842
+ break;
843
+ }
844
+
845
+ throw _iteratorError;
846
+
847
+ case 23:
848
+ return _context3.finish(20);
849
+
850
+ case 24:
851
+ return _context3.finish(17);
852
+
853
+ case 25:
854
+ body['user_id'] = userData.id;
855
+
856
+ _context3.prev = 26;
857
+ _context3.next = 29;
858
+ return fetch('/api/auth/profile', {
859
+ method: 'POST',
860
+ headers: { 'Content-Type': 'application/json' },
861
+ body: stringify._JSON$stringify(body)
862
+ });
863
+
864
+ case 29:
865
+ res = _context3.sent;
866
+
867
+ setLoading(false);
868
+
869
+ if (!(res.status === 200)) {
870
+ _context3.next = 35;
871
+ break;
872
+ }
873
+
874
+ setSuccessMsg('Your request has been processed successfully!');
875
+ _context3.next = 40;
876
+ break;
877
+
878
+ case 35:
879
+ _context3.t1 = Error;
880
+ _context3.next = 38;
881
+ return res.text();
882
+
883
+ case 38:
884
+ _context3.t2 = _context3.sent;
885
+ throw new _context3.t1(_context3.t2);
886
+
887
+ case 40:
888
+ _context3.next = 45;
889
+ break;
890
+
891
+ case 42:
892
+ _context3.prev = 42;
893
+ _context3.t3 = _context3['catch'](26);
894
+
895
+ setErrorMsg(_context3.t3.message);
896
+
897
+ case 45:
898
+ case 'end':
899
+ return _context3.stop();
900
+ }
901
+ }
902
+ }, _callee3, this, [[9, 13, 17, 25], [18,, 20, 24], [26, 42]]);
903
+ }));
904
+
905
+ return function handleSubmit(_x2) {
906
+ return _ref3.apply(this, arguments);
907
+ };
908
+ }();
909
+
910
+ var _useState = React.useState(''),
911
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
912
+ errorMsg = _useState2[0],
913
+ setErrorMsg = _useState2[1];
914
+
915
+ var _useState3 = React.useState(false),
916
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
917
+ countryUS = _useState4[0],
918
+ setCountryUS = _useState4[1];
919
+
920
+ var _useState5 = React.useState([]),
921
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
922
+ healthcareOccupation = _useState6[0],
923
+ setHealthcareOccupation = _useState6[1];
924
+
925
+ var _useState7 = React.useState([]),
926
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
927
+ nonHealthcareOccupation = _useState8[0],
928
+ setNonHealthcareOccupation = _useState8[1];
929
+
930
+ var _useState9 = React.useState(null),
931
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
932
+ userData = _useState10[0],
933
+ setUserData = _useState10[1];
934
+
935
+ var user = props.user;
936
+
937
+ var loadInitData = function () {
938
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
939
+ var healthcare_occupation, non_healthcare_occupation, foundOccupation, fields;
940
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
941
+ while (1) {
942
+ switch (_context.prev = _context.next) {
943
+ case 0:
944
+ _context.next = 2;
945
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Healthcare' });
946
+
947
+ case 2:
948
+ healthcare_occupation = _context.sent;
949
+ _context.next = 5;
950
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Non-Healthcare' });
951
+
952
+ case 5:
953
+ non_healthcare_occupation = _context.sent;
954
+ foundOccupation = healthcare_occupation.find(function (item) {
955
+ return item.value === user.shared.occupation_id;
956
+ });
957
+
958
+ if (foundOccupation) {
959
+ user.shared.healthcare_professional = 'Y';
960
+ } else {
961
+ user.shared.healthcare_professional = 'N';
962
+ }
963
+
964
+ setHealthcareOccupation(healthcare_occupation);
965
+ setNonHealthcareOccupation(non_healthcare_occupation);
966
+ setUserData(user);
967
+
968
+ if (user.shared.country === 'United States') {
969
+ setCountryUS(true);
970
+ } else {
971
+ setCountryUS(false);
972
+ }
973
+
974
+ _context.next = 14;
975
+ return dataHandler('/api/auth/data', { action: 'get-fields', occupation: user.shared.occupation_id });
976
+
977
+ case 14:
978
+ fields = _context.sent;
979
+
980
+ setOccupationFields(fields);
981
+
982
+ case 16:
983
+ case 'end':
984
+ return _context.stop();
985
+ }
986
+ }
987
+ }, _callee, _this$2);
988
+ }));
989
+
990
+ return function loadInitData() {
991
+ return _ref.apply(this, arguments);
992
+ };
993
+ }();
994
+
995
+ React.useEffect(function () {
996
+ if (!user) {
997
+ window.location.href = '/auth/login';
998
+ } else {
999
+ loadInitData();
1000
+ }
1001
+ }, []);
1002
+
1003
+ // make it to change layout based on radio buton
1004
+ var handleCountryChanged = function handleCountryChanged(e) {
1005
+ if (e.target.value === 'United States') {
1006
+ setCountryUS(true);
1007
+ } else {
1008
+ setCountryUS(false);
1009
+ }
1010
+ };
1011
+
1012
+ var _useState11 = React.useState(true),
1013
+ _useState12 = slicedToArray._slicedToArray(_useState11, 2),
1014
+ healcareProfessional = _useState12[0],
1015
+ setHealthcareProfessional = _useState12[1];
1016
+
1017
+ var handleHealthcareProfessionalChanged = function handleHealthcareProfessionalChanged(e) {
1018
+
1019
+ if (e.target.value === 'Y') {
1020
+ setHealthcareProfessional(true);
1021
+ } else {
1022
+ setHealthcareProfessional(false);
1023
+ }
1024
+ document.getElementById('occupation').value = '';
1025
+ setOccupationFields(null);
1026
+ };
1027
+
1028
+ var _useState13 = React.useState(null),
1029
+ _useState14 = slicedToArray._slicedToArray(_useState13, 2),
1030
+ occupationFields = _useState14[0],
1031
+ setOccupationFields = _useState14[1];
1032
+
1033
+ var handleOccupationChanged = function () {
1034
+ var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(e) {
1035
+ var occupation, fields;
1036
+ return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
1037
+ while (1) {
1038
+ switch (_context2.prev = _context2.next) {
1039
+ case 0:
1040
+ occupation = e.target.value;
1041
+ _context2.next = 3;
1042
+ return dataHandler('/api/auth/data', { action: 'get-fields', occupation: occupation });
1043
+
1044
+ case 3:
1045
+ fields = _context2.sent;
1046
+
1047
+ setOccupationFields(fields);
1048
+
1049
+ case 5:
1050
+ case 'end':
1051
+ return _context2.stop();
1052
+ }
1053
+ }
1054
+ }, _callee2, _this$2);
1055
+ }));
1056
+
1057
+ return function handleOccupationChanged(_x) {
1058
+ return _ref2.apply(this, arguments);
1059
+ };
1060
+ }();
1061
+
1062
+ var _useState15 = React.useState(''),
1063
+ _useState16 = slicedToArray._slicedToArray(_useState15, 2),
1064
+ successMsg = _useState16[0],
1065
+ setSuccessMsg = _useState16[1];
1066
+
1067
+ var _useState17 = React.useState(false),
1068
+ _useState18 = slicedToArray._slicedToArray(_useState17, 2),
1069
+ loading = _useState18[0],
1070
+ setLoading = _useState18[1];
1071
+
1072
+ return React__default['default'].createElement(
1073
+ reactBootstrap.Form,
1074
+ { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
1075
+ React__default['default'].createElement(
1076
+ 'h1',
1077
+ null,
1078
+ 'Profile'
1079
+ ),
1080
+ React__default['default'].createElement('hr', null),
1081
+ userData ? React__default['default'].createElement(
1082
+ React__default['default'].Fragment,
1083
+ null,
1084
+ returnFormField({ name: 'email', label: 'Email', type: 'email', required: true, readonly: true, default_value: userData.email }),
1085
+ React__default['default'].createElement(
1086
+ reactBootstrap.Form.Row,
1087
+ null,
1088
+ returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: reactBootstrap.Col, required: false }),
1089
+ returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: reactBootstrap.Col, required: false })
1090
+ ),
1091
+ React__default['default'].createElement(
1092
+ reactBootstrap.Form.Row,
1093
+ null,
1094
+ returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: reactBootstrap.Col, required: true, default_value: userData.shared.first_name }),
1095
+ returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: reactBootstrap.Col, required: true, default_value: userData.shared.last_name })
1096
+ ),
1097
+ React__default['default'].createElement(
1098
+ reactBootstrap.Form.Row,
1099
+ null,
1100
+ returnFormField({
1101
+ name: 'country',
1102
+ label: 'Country',
1103
+ type: 'select',
1104
+ required: true,
1105
+ groupType: reactBootstrap.Col,
1106
+ options: countries,
1107
+ handleChanged: handleCountryChanged,
1108
+ default_value: userData.shared.country
1109
+ }),
1110
+ countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: reactBootstrap.Col, options: states, default_value: userData.shared.state })
1111
+ ),
1112
+ React__default['default'].createElement(
1113
+ reactBootstrap.Form.Row,
1114
+ null,
1115
+ countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: reactBootstrap.Col, default_value: userData.shared.zip }),
1116
+ countryUS && returnFormField({ name: 'phone', label: 'Phone', type: 'text', required: true, groupType: reactBootstrap.Col, default_value: userData.shared.phone })
1117
+ ),
1118
+ returnFormField({
1119
+ name: 'healthcare_professional',
1120
+ label: 'Are You a Health Care Professional?',
1121
+ type: 'radio',
1122
+ required: true,
1123
+ options: [{ value: 'Y', label: 'Yes', checked: true }, { value: 'N', label: 'No', checked: false }],
1124
+ default_value: userData.shared.healthcare_professional,
1125
+ handleChanged: handleHealthcareProfessionalChanged
1126
+ }),
1127
+ healcareProfessional && returnFormField({
1128
+ name: 'occupation',
1129
+ label: 'Occupation',
1130
+ type: 'select',
1131
+ required: true,
1132
+ options: healthcareOccupation,
1133
+ handleChanged: handleOccupationChanged,
1134
+ default_value: userData.shared.occupation_id
1135
+ }),
1136
+ !healcareProfessional && returnFormField({
1137
+ name: 'occupation',
1138
+ label: 'Non Provider Role',
1139
+ type: 'select',
1140
+ required: true,
1141
+ options: nonHealthcareOccupation,
1142
+ handleChanged: handleOccupationChanged,
1143
+ default_value: userData.shared.occupation_id
1144
+ }),
1145
+ occupationFields && occupationFields.map(function (field) {
1146
+ return returnFormField({
1147
+ name: field.name,
1148
+ label: field.label,
1149
+ type: field.type,
1150
+ required: field.required === 1,
1151
+ options: field.options,
1152
+ default_value: userData.shared[field.name]
1153
+ });
1154
+ }),
1155
+ returnFormField({
1156
+ name: 'agree',
1157
+ label: 'Terms & Conditions | Privacy Policy',
1158
+ type: 'checkbox',
1159
+ required: true,
1160
+ options: [{ label: 'By registering you agree to our <a href="/terms">Terms and Conditions</a> and <a href="/privacy">Privacy Policy</a> and understand that you will be receiving email communications', value: 'Y' }]
1161
+ }),
1162
+ React__default['default'].createElement('hr', null),
1163
+ React__default['default'].createElement(
1164
+ reactBootstrap.Form.Row,
1165
+ null,
1166
+ React__default['default'].createElement(
1167
+ reactBootstrap.Form.Group,
1168
+ { as: reactBootstrap.Col },
1169
+ !loading && React__default['default'].createElement(
1170
+ reactBootstrap.Button,
1171
+ { type: 'submit' },
1172
+ 'Update'
1173
+ ),
1174
+ loading && React__default['default'].createElement(
1175
+ reactBootstrap.Button,
1176
+ { variant: 'primary', disabled: true },
1177
+ React__default['default'].createElement(reactBootstrap.Spinner, {
1178
+ as: 'span',
1179
+ animation: 'border',
1180
+ role: 'status',
1181
+ 'aria-hidden': 'true',
1182
+ size: 'sm'
1183
+ }),
1184
+ React__default['default'].createElement(
1185
+ 'span',
1186
+ { className: 'sr-only' },
1187
+ 'Loading...'
1188
+ )
1189
+ )
1190
+ )
1191
+ )
1192
+ ) : React__default['default'].createElement(reactBootstrap.Spinner, {
1193
+ as: 'span',
1194
+ animation: 'border',
1195
+ role: 'status',
1196
+ 'aria-hidden': 'true',
1197
+ size: 'sm'
1198
+ }),
1199
+ errorMsg && React__default['default'].createElement(
1200
+ 'p',
1201
+ { className: 'error' },
1202
+ errorMsg
1203
+ ),
1204
+ successMsg && React__default['default'].createElement(
1205
+ 'p',
1206
+ { className: 'success' },
1207
+ successMsg
1208
+ ),
1209
+ React__default['default'].createElement(
1210
+ 'style',
1211
+ { jsx: 'true'.toString() },
1212
+ ' \n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n .success {\n color: green;\n margin: 1rem 0 0;\n }\n '
1213
+ )
1214
+ );
1215
+ };
1216
+
1217
+ var TOKEN_NAME = 'token';
1218
+ var MAX_AGE = 60 * 60 * 8; // 8 hours
1219
+
1220
+ function setTokenCookie(res, token, eKey) {
1221
+ var cookies_serailized = [];
1222
+ cookies_serailized.push(index.serialize_1(TOKEN_NAME, token, {
1223
+ //maxAge: MAX_AGE, // we want login cookie to expire when browser
1224
+ //expires: new Date(Date.now() + MAX_AGE * 1000),
1225
+ //httpOnly: true,
1226
+ //secure: process.env.NODE_ENV === 'production',
1227
+ path: '/'
1228
+ //sameSite: 'lax',
1229
+ }));
1230
+
1231
+ cookies_serailized.push(index.serialize_1('eKey', eKey, {
1232
+ //maxAge: MAX_AGE, // we want login cookie to expire when browser
1233
+ //expires: new Date(Date.now() + MAX_AGE * 1000),
1234
+ //httpOnly: true,
1235
+ //secure: process.env.NODE_ENV === 'production',
1236
+ path: '/'
1237
+ //sameSite: 'lax',
1238
+ }));
1239
+
1240
+ res.setHeader('Set-Cookie', cookies_serailized);
1241
+ }
1242
+
1243
+ function removeTokenCookie(res) {
1244
+ var cookies_serailized = [];
1245
+ cookies_serailized.push(index.serialize_1(TOKEN_NAME, '', {
1246
+ maxAge: -1,
1247
+ expires: new Date(Date.now() - MAX_AGE * 1000),
1248
+ path: '/'
1249
+ }));
1250
+ cookies_serailized.push(index.serialize_1('eKey', '', {
1251
+ maxAge: -1,
1252
+ expires: new Date(Date.now() - MAX_AGE * 1000),
1253
+ path: '/'
1254
+ }));
1255
+
1256
+ res.setHeader('Set-Cookie', cookies_serailized);
1257
+ }
1258
+
1259
+ function parseCookies(req) {
1260
+ // For API Routes we don't need to parse the cookies.
1261
+ if (req.cookies) return req.cookies;
1262
+
1263
+ // For pages we do need to parse the cookies.
1264
+ var cookie = req.headers ? req.headers.cookie : null;
1265
+ return index.parse_1(cookie || '');
1266
+ }
1267
+
1268
+ function getTokenCookie(req) {
1269
+ var cookies = parseCookies(req);
1270
+ return cookies[TOKEN_NAME];
1271
+ }
1272
+
1273
+ var authCookies = /*#__PURE__*/Object.freeze({
1274
+ __proto__: null,
1275
+ setTokenCookie: setTokenCookie,
1276
+ removeTokenCookie: removeTokenCookie,
1277
+ parseCookies: parseCookies,
1278
+ getTokenCookie: getTokenCookie
1279
+ });
1280
+
1281
+ function encryptSession(session) {
1282
+ var buffer = new Buffer(stringify._JSON$stringify(session));
1283
+ return buffer.toString('base64');
1284
+ //return jwt.sign(session, TOKEN_SECRET)
1285
+ //return Iron.seal(session, TOKEN_SECRET, Iron.defaults)
1286
+ }
1287
+
1288
+ var getSession = function () {
1289
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(req) {
1290
+ var token, buff;
1291
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
1292
+ while (1) {
1293
+ switch (_context.prev = _context.next) {
1294
+ case 0:
1295
+ token = getTokenCookie(req);
1296
+
1297
+ if (!token) {
1298
+ _context.next = 4;
1299
+ break;
1300
+ }
1301
+
1302
+ buff = new Buffer(token, 'base64');
1303
+ return _context.abrupt('return', JSON.parse(buff.toString('utf8')));
1304
+
1305
+ case 4:
1306
+ return _context.abrupt('return', null);
1307
+
1308
+ case 5:
1309
+ case 'end':
1310
+ return _context.stop();
1311
+ }
1312
+ }
1313
+ }, _callee, this);
1314
+ }));
1315
+
1316
+ return function getSession(_x) {
1317
+ return _ref.apply(this, arguments);
1318
+ };
1319
+ }();
1320
+
1321
+ var iron = /*#__PURE__*/Object.freeze({
1322
+ __proto__: null,
1323
+ encryptSession: encryptSession,
1324
+ getSession: getSession
1325
+ });
1326
+
1327
+ var toStr = Object.prototype.toString;
1328
+
1329
+ var isArguments = function isArguments(value) {
1330
+ var str = toStr.call(value);
1331
+ var isArgs = str === '[object Arguments]';
1332
+ if (!isArgs) {
1333
+ isArgs = str !== '[object Array]' &&
1334
+ value !== null &&
1335
+ typeof value === 'object' &&
1336
+ typeof value.length === 'number' &&
1337
+ value.length >= 0 &&
1338
+ toStr.call(value.callee) === '[object Function]';
1339
+ }
1340
+ return isArgs;
1341
+ };
1342
+
1343
+ var keysShim;
1344
+ if (!Object.keys) {
1345
+ // modified from https://github.com/es-shims/es5-shim
1346
+ var has = Object.prototype.hasOwnProperty;
1347
+ var toStr$1 = Object.prototype.toString;
1348
+ var isArgs = isArguments; // eslint-disable-line global-require
1349
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
1350
+ var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
1351
+ var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
1352
+ var dontEnums = [
1353
+ 'toString',
1354
+ 'toLocaleString',
1355
+ 'valueOf',
1356
+ 'hasOwnProperty',
1357
+ 'isPrototypeOf',
1358
+ 'propertyIsEnumerable',
1359
+ 'constructor'
1360
+ ];
1361
+ var equalsConstructorPrototype = function (o) {
1362
+ var ctor = o.constructor;
1363
+ return ctor && ctor.prototype === o;
1364
+ };
1365
+ var excludedKeys = {
1366
+ $applicationCache: true,
1367
+ $console: true,
1368
+ $external: true,
1369
+ $frame: true,
1370
+ $frameElement: true,
1371
+ $frames: true,
1372
+ $innerHeight: true,
1373
+ $innerWidth: true,
1374
+ $onmozfullscreenchange: true,
1375
+ $onmozfullscreenerror: true,
1376
+ $outerHeight: true,
1377
+ $outerWidth: true,
1378
+ $pageXOffset: true,
1379
+ $pageYOffset: true,
1380
+ $parent: true,
1381
+ $scrollLeft: true,
1382
+ $scrollTop: true,
1383
+ $scrollX: true,
1384
+ $scrollY: true,
1385
+ $self: true,
1386
+ $webkitIndexedDB: true,
1387
+ $webkitStorageInfo: true,
1388
+ $window: true
1389
+ };
1390
+ var hasAutomationEqualityBug = (function () {
1391
+ /* global window */
1392
+ if (typeof window === 'undefined') { return false; }
1393
+ for (var k in window) {
1394
+ try {
1395
+ if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
1396
+ try {
1397
+ equalsConstructorPrototype(window[k]);
1398
+ } catch (e) {
1399
+ return true;
1400
+ }
1401
+ }
1402
+ } catch (e) {
1403
+ return true;
1404
+ }
1405
+ }
1406
+ return false;
1407
+ }());
1408
+ var equalsConstructorPrototypeIfNotBuggy = function (o) {
1409
+ /* global window */
1410
+ if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
1411
+ return equalsConstructorPrototype(o);
1412
+ }
1413
+ try {
1414
+ return equalsConstructorPrototype(o);
1415
+ } catch (e) {
1416
+ return false;
1417
+ }
1418
+ };
1419
+
1420
+ keysShim = function keys(object) {
1421
+ var isObject = object !== null && typeof object === 'object';
1422
+ var isFunction = toStr$1.call(object) === '[object Function]';
1423
+ var isArguments = isArgs(object);
1424
+ var isString = isObject && toStr$1.call(object) === '[object String]';
1425
+ var theKeys = [];
1426
+
1427
+ if (!isObject && !isFunction && !isArguments) {
1428
+ throw new TypeError('Object.keys called on a non-object');
1429
+ }
1430
+
1431
+ var skipProto = hasProtoEnumBug && isFunction;
1432
+ if (isString && object.length > 0 && !has.call(object, 0)) {
1433
+ for (var i = 0; i < object.length; ++i) {
1434
+ theKeys.push(String(i));
1435
+ }
1436
+ }
1437
+
1438
+ if (isArguments && object.length > 0) {
1439
+ for (var j = 0; j < object.length; ++j) {
1440
+ theKeys.push(String(j));
1441
+ }
1442
+ } else {
1443
+ for (var name in object) {
1444
+ if (!(skipProto && name === 'prototype') && has.call(object, name)) {
1445
+ theKeys.push(String(name));
1446
+ }
1447
+ }
1448
+ }
1449
+
1450
+ if (hasDontEnumBug) {
1451
+ var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
1452
+
1453
+ for (var k = 0; k < dontEnums.length; ++k) {
1454
+ if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
1455
+ theKeys.push(dontEnums[k]);
1456
+ }
1457
+ }
1458
+ }
1459
+ return theKeys;
1460
+ };
1461
+ }
1462
+ var implementation = keysShim;
1463
+
1464
+ var slice = Array.prototype.slice;
1465
+
1466
+
1467
+ var origKeys = Object.keys;
1468
+ var keysShim$1 = origKeys ? function keys(o) { return origKeys(o); } : implementation;
1469
+
1470
+ var originalKeys = Object.keys;
1471
+
1472
+ keysShim$1.shim = function shimObjectKeys() {
1473
+ if (Object.keys) {
1474
+ var keysWorksWithArguments = (function () {
1475
+ // Safari 5.0 bug
1476
+ var args = Object.keys(arguments);
1477
+ return args && args.length === arguments.length;
1478
+ }(1, 2));
1479
+ if (!keysWorksWithArguments) {
1480
+ Object.keys = function keys(object) { // eslint-disable-line func-name-matching
1481
+ if (isArguments(object)) {
1482
+ return originalKeys(slice.call(object));
1483
+ }
1484
+ return originalKeys(object);
1485
+ };
1486
+ }
1487
+ } else {
1488
+ Object.keys = keysShim$1;
1489
+ }
1490
+ return Object.keys || keysShim$1;
1491
+ };
1492
+
1493
+ var objectKeys = keysShim$1;
1494
+
1495
+ var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
1496
+
1497
+ var toStr$2 = Object.prototype.toString;
1498
+ var concat = Array.prototype.concat;
1499
+ var origDefineProperty = Object.defineProperty;
1500
+
1501
+ var isFunction = function (fn) {
1502
+ return typeof fn === 'function' && toStr$2.call(fn) === '[object Function]';
1503
+ };
1504
+
1505
+ var arePropertyDescriptorsSupported = function () {
1506
+ var obj = {};
1507
+ try {
1508
+ origDefineProperty(obj, 'x', { enumerable: false, value: obj });
1509
+ // eslint-disable-next-line no-unused-vars, no-restricted-syntax
1510
+ for (var _ in obj) { // jscs:ignore disallowUnusedVariables
1511
+ return false;
1512
+ }
1513
+ return obj.x === obj;
1514
+ } catch (e) { /* this is IE 8. */
1515
+ return false;
1516
+ }
1517
+ };
1518
+ var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
1519
+
1520
+ var defineProperty = function (object, name, value, predicate) {
1521
+ if (name in object && (!isFunction(predicate) || !predicate())) {
1522
+ return;
1523
+ }
1524
+ if (supportsDescriptors) {
1525
+ origDefineProperty(object, name, {
1526
+ configurable: true,
1527
+ enumerable: false,
1528
+ value: value,
1529
+ writable: true
1530
+ });
1531
+ } else {
1532
+ object[name] = value;
1533
+ }
1534
+ };
1535
+
1536
+ var defineProperties = function (object, map) {
1537
+ var predicates = arguments.length > 2 ? arguments[2] : {};
1538
+ var props = objectKeys(map);
1539
+ if (hasSymbols) {
1540
+ props = concat.call(props, Object.getOwnPropertySymbols(map));
1541
+ }
1542
+ for (var i = 0; i < props.length; i += 1) {
1543
+ defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
1544
+ }
1545
+ };
1546
+
1547
+ defineProperties.supportsDescriptors = !!supportsDescriptors;
1548
+
1549
+ var defineProperties_1 = defineProperties;
1550
+
1551
+ /* eslint no-invalid-this: 1 */
1552
+
1553
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
1554
+ var slice$1 = Array.prototype.slice;
1555
+ var toStr$3 = Object.prototype.toString;
1556
+ var funcType = '[object Function]';
1557
+
1558
+ var implementation$1 = function bind(that) {
1559
+ var target = this;
1560
+ if (typeof target !== 'function' || toStr$3.call(target) !== funcType) {
1561
+ throw new TypeError(ERROR_MESSAGE + target);
1562
+ }
1563
+ var args = slice$1.call(arguments, 1);
1564
+
1565
+ var bound;
1566
+ var binder = function () {
1567
+ if (this instanceof bound) {
1568
+ var result = target.apply(
1569
+ this,
1570
+ args.concat(slice$1.call(arguments))
1571
+ );
1572
+ if (Object(result) === result) {
1573
+ return result;
1574
+ }
1575
+ return this;
1576
+ } else {
1577
+ return target.apply(
1578
+ that,
1579
+ args.concat(slice$1.call(arguments))
1580
+ );
1581
+ }
1582
+ };
1583
+
1584
+ var boundLength = Math.max(0, target.length - args.length);
1585
+ var boundArgs = [];
1586
+ for (var i = 0; i < boundLength; i++) {
1587
+ boundArgs.push('$' + i);
1588
+ }
1589
+
1590
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
1591
+
1592
+ if (target.prototype) {
1593
+ var Empty = function Empty() {};
1594
+ Empty.prototype = target.prototype;
1595
+ bound.prototype = new Empty();
1596
+ Empty.prototype = null;
1597
+ }
1598
+
1599
+ return bound;
1600
+ };
1601
+
1602
+ var functionBind = Function.prototype.bind || implementation$1;
1603
+
1604
+ /* eslint complexity: [2, 18], max-statements: [2, 33] */
1605
+ var shams = function hasSymbols() {
1606
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
1607
+ if (typeof Symbol.iterator === 'symbol') { return true; }
1608
+
1609
+ var obj = {};
1610
+ var sym = Symbol('test');
1611
+ var symObj = Object(sym);
1612
+ if (typeof sym === 'string') { return false; }
1613
+
1614
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
1615
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
1616
+
1617
+ // temp disabled per https://github.com/ljharb/object.assign/issues/17
1618
+ // if (sym instanceof Symbol) { return false; }
1619
+ // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
1620
+ // if (!(symObj instanceof Symbol)) { return false; }
1621
+
1622
+ // if (typeof Symbol.prototype.toString !== 'function') { return false; }
1623
+ // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
1624
+
1625
+ var symVal = 42;
1626
+ obj[sym] = symVal;
1627
+ for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
1628
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
1629
+
1630
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
1631
+
1632
+ var syms = Object.getOwnPropertySymbols(obj);
1633
+ if (syms.length !== 1 || syms[0] !== sym) { return false; }
1634
+
1635
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
1636
+
1637
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
1638
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
1639
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
1640
+ }
1641
+
1642
+ return true;
1643
+ };
1644
+
1645
+ var origSymbol = _commonjsHelpers.commonjsGlobal.Symbol;
1646
+
1647
+
1648
+ var hasSymbols$1 = function hasNativeSymbols() {
1649
+ if (typeof origSymbol !== 'function') { return false; }
1650
+ if (typeof Symbol !== 'function') { return false; }
1651
+ if (typeof origSymbol('foo') !== 'symbol') { return false; }
1652
+ if (typeof Symbol('bar') !== 'symbol') { return false; }
1653
+
1654
+ return shams();
1655
+ };
1656
+
1657
+ var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
1658
+
1659
+ var undefined$1;
1660
+
1661
+ var $SyntaxError = SyntaxError;
1662
+ var $Function = Function;
1663
+ var $TypeError = TypeError;
1664
+
1665
+ // eslint-disable-next-line consistent-return
1666
+ var getEvalledConstructor = function (expressionSyntax) {
1667
+ try {
1668
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
1669
+ } catch (e) {}
1670
+ };
1671
+
1672
+ var $gOPD = Object.getOwnPropertyDescriptor;
1673
+ if ($gOPD) {
1674
+ try {
1675
+ $gOPD({}, '');
1676
+ } catch (e) {
1677
+ $gOPD = null; // this is IE 8, which has a broken gOPD
1678
+ }
1679
+ }
1680
+
1681
+ var throwTypeError = function () {
1682
+ throw new $TypeError();
1683
+ };
1684
+ var ThrowTypeError = $gOPD
1685
+ ? (function () {
1686
+ try {
1687
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
1688
+ arguments.callee; // IE 8 does not throw here
1689
+ return throwTypeError;
1690
+ } catch (calleeThrows) {
1691
+ try {
1692
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
1693
+ return $gOPD(arguments, 'callee').get;
1694
+ } catch (gOPDthrows) {
1695
+ return throwTypeError;
1696
+ }
1697
+ }
1698
+ }())
1699
+ : throwTypeError;
1700
+
1701
+ var hasSymbols$2 = hasSymbols$1();
1702
+
1703
+ var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
1704
+
1705
+ var needsEval = {};
1706
+
1707
+ var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
1708
+
1709
+ var INTRINSICS = {
1710
+ '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
1711
+ '%Array%': Array,
1712
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
1713
+ '%ArrayIteratorPrototype%': hasSymbols$2 ? getProto([][Symbol.iterator]()) : undefined$1,
1714
+ '%AsyncFromSyncIteratorPrototype%': undefined$1,
1715
+ '%AsyncFunction%': needsEval,
1716
+ '%AsyncGenerator%': needsEval,
1717
+ '%AsyncGeneratorFunction%': needsEval,
1718
+ '%AsyncIteratorPrototype%': needsEval,
1719
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
1720
+ '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
1721
+ '%Boolean%': Boolean,
1722
+ '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
1723
+ '%Date%': Date,
1724
+ '%decodeURI%': decodeURI,
1725
+ '%decodeURIComponent%': decodeURIComponent,
1726
+ '%encodeURI%': encodeURI,
1727
+ '%encodeURIComponent%': encodeURIComponent,
1728
+ '%Error%': Error,
1729
+ '%eval%': eval, // eslint-disable-line no-eval
1730
+ '%EvalError%': EvalError,
1731
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
1732
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
1733
+ '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
1734
+ '%Function%': $Function,
1735
+ '%GeneratorFunction%': needsEval,
1736
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
1737
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
1738
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
1739
+ '%isFinite%': isFinite,
1740
+ '%isNaN%': isNaN,
1741
+ '%IteratorPrototype%': hasSymbols$2 ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
1742
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
1743
+ '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
1744
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$2 ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
1745
+ '%Math%': Math,
1746
+ '%Number%': Number,
1747
+ '%Object%': Object,
1748
+ '%parseFloat%': parseFloat,
1749
+ '%parseInt%': parseInt,
1750
+ '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
1751
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
1752
+ '%RangeError%': RangeError,
1753
+ '%ReferenceError%': ReferenceError,
1754
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
1755
+ '%RegExp%': RegExp,
1756
+ '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
1757
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$2 ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
1758
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
1759
+ '%String%': String,
1760
+ '%StringIteratorPrototype%': hasSymbols$2 ? getProto(''[Symbol.iterator]()) : undefined$1,
1761
+ '%Symbol%': hasSymbols$2 ? Symbol : undefined$1,
1762
+ '%SyntaxError%': $SyntaxError,
1763
+ '%ThrowTypeError%': ThrowTypeError,
1764
+ '%TypedArray%': TypedArray,
1765
+ '%TypeError%': $TypeError,
1766
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
1767
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
1768
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
1769
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
1770
+ '%URIError%': URIError,
1771
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
1772
+ '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
1773
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
1774
+ };
1775
+
1776
+ var doEval = function doEval(name) {
1777
+ var value;
1778
+ if (name === '%AsyncFunction%') {
1779
+ value = getEvalledConstructor('async function () {}');
1780
+ } else if (name === '%GeneratorFunction%') {
1781
+ value = getEvalledConstructor('function* () {}');
1782
+ } else if (name === '%AsyncGeneratorFunction%') {
1783
+ value = getEvalledConstructor('async function* () {}');
1784
+ } else if (name === '%AsyncGenerator%') {
1785
+ var fn = doEval('%AsyncGeneratorFunction%');
1786
+ if (fn) {
1787
+ value = fn.prototype;
1788
+ }
1789
+ } else if (name === '%AsyncIteratorPrototype%') {
1790
+ var gen = doEval('%AsyncGenerator%');
1791
+ if (gen) {
1792
+ value = getProto(gen.prototype);
1793
+ }
1794
+ }
1795
+
1796
+ INTRINSICS[name] = value;
1797
+
1798
+ return value;
1799
+ };
1800
+
1801
+ var LEGACY_ALIASES = {
1802
+ '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
1803
+ '%ArrayPrototype%': ['Array', 'prototype'],
1804
+ '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
1805
+ '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
1806
+ '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
1807
+ '%ArrayProto_values%': ['Array', 'prototype', 'values'],
1808
+ '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
1809
+ '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
1810
+ '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
1811
+ '%BooleanPrototype%': ['Boolean', 'prototype'],
1812
+ '%DataViewPrototype%': ['DataView', 'prototype'],
1813
+ '%DatePrototype%': ['Date', 'prototype'],
1814
+ '%ErrorPrototype%': ['Error', 'prototype'],
1815
+ '%EvalErrorPrototype%': ['EvalError', 'prototype'],
1816
+ '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
1817
+ '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
1818
+ '%FunctionPrototype%': ['Function', 'prototype'],
1819
+ '%Generator%': ['GeneratorFunction', 'prototype'],
1820
+ '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
1821
+ '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
1822
+ '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
1823
+ '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
1824
+ '%JSONParse%': ['JSON', 'parse'],
1825
+ '%JSONStringify%': ['JSON', 'stringify'],
1826
+ '%MapPrototype%': ['Map', 'prototype'],
1827
+ '%NumberPrototype%': ['Number', 'prototype'],
1828
+ '%ObjectPrototype%': ['Object', 'prototype'],
1829
+ '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
1830
+ '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
1831
+ '%PromisePrototype%': ['Promise', 'prototype'],
1832
+ '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
1833
+ '%Promise_all%': ['Promise', 'all'],
1834
+ '%Promise_reject%': ['Promise', 'reject'],
1835
+ '%Promise_resolve%': ['Promise', 'resolve'],
1836
+ '%RangeErrorPrototype%': ['RangeError', 'prototype'],
1837
+ '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
1838
+ '%RegExpPrototype%': ['RegExp', 'prototype'],
1839
+ '%SetPrototype%': ['Set', 'prototype'],
1840
+ '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
1841
+ '%StringPrototype%': ['String', 'prototype'],
1842
+ '%SymbolPrototype%': ['Symbol', 'prototype'],
1843
+ '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
1844
+ '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
1845
+ '%TypeErrorPrototype%': ['TypeError', 'prototype'],
1846
+ '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
1847
+ '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
1848
+ '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
1849
+ '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
1850
+ '%URIErrorPrototype%': ['URIError', 'prototype'],
1851
+ '%WeakMapPrototype%': ['WeakMap', 'prototype'],
1852
+ '%WeakSetPrototype%': ['WeakSet', 'prototype']
1853
+ };
1854
+
1855
+
1856
+
1857
+ var $concat = functionBind.call(Function.call, Array.prototype.concat);
1858
+ var $spliceApply = functionBind.call(Function.apply, Array.prototype.splice);
1859
+ var $replace = functionBind.call(Function.call, String.prototype.replace);
1860
+ var $strSlice = functionBind.call(Function.call, String.prototype.slice);
1861
+
1862
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
1863
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
1864
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
1865
+ var stringToPath = function stringToPath(string) {
1866
+ var first = $strSlice(string, 0, 1);
1867
+ var last = $strSlice(string, -1);
1868
+ if (first === '%' && last !== '%') {
1869
+ throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
1870
+ } else if (last === '%' && first !== '%') {
1871
+ throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
1872
+ }
1873
+ var result = [];
1874
+ $replace(string, rePropName, function (match, number, quote, subString) {
1875
+ result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
1876
+ });
1877
+ return result;
1878
+ };
1879
+ /* end adaptation */
1880
+
1881
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
1882
+ var intrinsicName = name;
1883
+ var alias;
1884
+ if (src(LEGACY_ALIASES, intrinsicName)) {
1885
+ alias = LEGACY_ALIASES[intrinsicName];
1886
+ intrinsicName = '%' + alias[0] + '%';
1887
+ }
1888
+
1889
+ if (src(INTRINSICS, intrinsicName)) {
1890
+ var value = INTRINSICS[intrinsicName];
1891
+ if (value === needsEval) {
1892
+ value = doEval(intrinsicName);
1893
+ }
1894
+ if (typeof value === 'undefined' && !allowMissing) {
1895
+ throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
1896
+ }
1897
+
1898
+ return {
1899
+ alias: alias,
1900
+ name: intrinsicName,
1901
+ value: value
1902
+ };
1903
+ }
1904
+
1905
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
1906
+ };
1907
+
1908
+ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
1909
+ if (typeof name !== 'string' || name.length === 0) {
1910
+ throw new $TypeError('intrinsic name must be a non-empty string');
1911
+ }
1912
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
1913
+ throw new $TypeError('"allowMissing" argument must be a boolean');
1914
+ }
1915
+
1916
+ var parts = stringToPath(name);
1917
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
1918
+
1919
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
1920
+ var intrinsicRealName = intrinsic.name;
1921
+ var value = intrinsic.value;
1922
+ var skipFurtherCaching = false;
1923
+
1924
+ var alias = intrinsic.alias;
1925
+ if (alias) {
1926
+ intrinsicBaseName = alias[0];
1927
+ $spliceApply(parts, $concat([0, 1], alias));
1928
+ }
1929
+
1930
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
1931
+ var part = parts[i];
1932
+ var first = $strSlice(part, 0, 1);
1933
+ var last = $strSlice(part, -1);
1934
+ if (
1935
+ (
1936
+ (first === '"' || first === "'" || first === '`')
1937
+ || (last === '"' || last === "'" || last === '`')
1938
+ )
1939
+ && first !== last
1940
+ ) {
1941
+ throw new $SyntaxError('property names with quotes must have matching quotes');
1942
+ }
1943
+ if (part === 'constructor' || !isOwn) {
1944
+ skipFurtherCaching = true;
1945
+ }
1946
+
1947
+ intrinsicBaseName += '.' + part;
1948
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
1949
+
1950
+ if (src(INTRINSICS, intrinsicRealName)) {
1951
+ value = INTRINSICS[intrinsicRealName];
1952
+ } else if (value != null) {
1953
+ if (!(part in value)) {
1954
+ if (!allowMissing) {
1955
+ throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
1956
+ }
1957
+ return void undefined$1;
1958
+ }
1959
+ if ($gOPD && (i + 1) >= parts.length) {
1960
+ var desc = $gOPD(value, part);
1961
+ isOwn = !!desc;
1962
+
1963
+ // By convention, when a data property is converted to an accessor
1964
+ // property to emulate a data property that does not suffer from
1965
+ // the override mistake, that accessor's getter is marked with
1966
+ // an `originalValue` property. Here, when we detect this, we
1967
+ // uphold the illusion by pretending to see that original data
1968
+ // property, i.e., returning the value rather than the getter
1969
+ // itself.
1970
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
1971
+ value = desc.get;
1972
+ } else {
1973
+ value = value[part];
1974
+ }
1975
+ } else {
1976
+ isOwn = src(value, part);
1977
+ value = value[part];
1978
+ }
1979
+
1980
+ if (isOwn && !skipFurtherCaching) {
1981
+ INTRINSICS[intrinsicRealName] = value;
1982
+ }
1983
+ }
1984
+ }
1985
+ return value;
1986
+ };
1987
+
1988
+ var callBind = _commonjsHelpers.createCommonjsModule(function (module) {
1989
+
1990
+
1991
+
1992
+
1993
+ var $apply = getIntrinsic('%Function.prototype.apply%');
1994
+ var $call = getIntrinsic('%Function.prototype.call%');
1995
+ var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
1996
+
1997
+ var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
1998
+ var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
1999
+ var $max = getIntrinsic('%Math.max%');
2000
+
2001
+ if ($defineProperty) {
2002
+ try {
2003
+ $defineProperty({}, 'a', { value: 1 });
2004
+ } catch (e) {
2005
+ // IE 8 has a broken defineProperty
2006
+ $defineProperty = null;
2007
+ }
2008
+ }
2009
+
2010
+ module.exports = function callBind(originalFunction) {
2011
+ var func = $reflectApply(functionBind, $call, arguments);
2012
+ if ($gOPD && $defineProperty) {
2013
+ var desc = $gOPD(func, 'length');
2014
+ if (desc.configurable) {
2015
+ // original length, plus the receiver, minus any additional arguments (after the receiver)
2016
+ $defineProperty(
2017
+ func,
2018
+ 'length',
2019
+ { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
2020
+ );
2021
+ }
2022
+ }
2023
+ return func;
2024
+ };
2025
+
2026
+ var applyBind = function applyBind() {
2027
+ return $reflectApply(functionBind, $apply, arguments);
2028
+ };
2029
+
2030
+ if ($defineProperty) {
2031
+ $defineProperty(module.exports, 'apply', { value: applyBind });
2032
+ } else {
2033
+ module.exports.apply = applyBind;
2034
+ }
2035
+ });
2036
+ callBind.apply;
2037
+
2038
+ var $indexOf = callBind(getIntrinsic('String.prototype.indexOf'));
2039
+
2040
+ var callBound = function callBoundIntrinsic(name, allowMissing) {
2041
+ var intrinsic = getIntrinsic(name, !!allowMissing);
2042
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
2043
+ return callBind(intrinsic);
2044
+ }
2045
+ return intrinsic;
2046
+ };
2047
+
2048
+ var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
2049
+
2050
+ if ($defineProperty) {
2051
+ try {
2052
+ $defineProperty({}, 'a', { value: 1 });
2053
+ } catch (e) {
2054
+ // IE 8 has a broken defineProperty
2055
+ $defineProperty = null;
2056
+ }
2057
+ }
2058
+
2059
+
2060
+
2061
+ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
2062
+
2063
+ // eslint-disable-next-line max-params
2064
+ var DefineOwnProperty = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) {
2065
+ if (!$defineProperty) {
2066
+ if (!IsDataDescriptor(desc)) {
2067
+ // ES3 does not support getters/setters
2068
+ return false;
2069
+ }
2070
+ if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
2071
+ return false;
2072
+ }
2073
+
2074
+ // fallback for ES3
2075
+ if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
2076
+ // a non-enumerable existing property
2077
+ return false;
2078
+ }
2079
+
2080
+ // property does not exist at all, or exists but is enumerable
2081
+ var V = desc['[[Value]]'];
2082
+ // eslint-disable-next-line no-param-reassign
2083
+ O[P] = V; // will use [[Define]]
2084
+ return SameValue(O[P], V);
2085
+ }
2086
+ $defineProperty(O, P, FromPropertyDescriptor(desc));
2087
+ return true;
2088
+ };
2089
+
2090
+ var $TypeError$1 = getIntrinsic('%TypeError%');
2091
+ var $SyntaxError$1 = getIntrinsic('%SyntaxError%');
2092
+
2093
+
2094
+
2095
+ var predicates = {
2096
+ // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
2097
+ 'Property Descriptor': function isPropertyDescriptor(Type, Desc) {
2098
+ if (Type(Desc) !== 'Object') {
2099
+ return false;
2100
+ }
2101
+ var allowed = {
2102
+ '[[Configurable]]': true,
2103
+ '[[Enumerable]]': true,
2104
+ '[[Get]]': true,
2105
+ '[[Set]]': true,
2106
+ '[[Value]]': true,
2107
+ '[[Writable]]': true
2108
+ };
2109
+
2110
+ for (var key in Desc) { // eslint-disable-line
2111
+ if (src(Desc, key) && !allowed[key]) {
2112
+ return false;
2113
+ }
2114
+ }
2115
+
2116
+ var isData = src(Desc, '[[Value]]');
2117
+ var IsAccessor = src(Desc, '[[Get]]') || src(Desc, '[[Set]]');
2118
+ if (isData && IsAccessor) {
2119
+ throw new $TypeError$1('Property Descriptors may not be both accessor and data descriptors');
2120
+ }
2121
+ return true;
2122
+ }
2123
+ };
2124
+
2125
+ var assertRecord = function assertRecord(Type, recordType, argumentName, value) {
2126
+ var predicate = predicates[recordType];
2127
+ if (typeof predicate !== 'function') {
2128
+ throw new $SyntaxError$1('unknown record type: ' + recordType);
2129
+ }
2130
+ if (!predicate(Type, value)) {
2131
+ throw new $TypeError$1(argumentName + ' must be a ' + recordType);
2132
+ }
2133
+ };
2134
+
2135
+ // https://ecma-international.org/ecma-262/5.1/#sec-8
2136
+
2137
+ var Type = function Type(x) {
2138
+ if (x === null) {
2139
+ return 'Null';
2140
+ }
2141
+ if (typeof x === 'undefined') {
2142
+ return 'Undefined';
2143
+ }
2144
+ if (typeof x === 'function' || typeof x === 'object') {
2145
+ return 'Object';
2146
+ }
2147
+ if (typeof x === 'number') {
2148
+ return 'Number';
2149
+ }
2150
+ if (typeof x === 'boolean') {
2151
+ return 'Boolean';
2152
+ }
2153
+ if (typeof x === 'string') {
2154
+ return 'String';
2155
+ }
2156
+ };
2157
+
2158
+ // https://ecma-international.org/ecma-262/11.0/#sec-ecmascript-data-types-and-values
2159
+
2160
+ var Type$1 = function Type$1(x) {
2161
+ if (typeof x === 'symbol') {
2162
+ return 'Symbol';
2163
+ }
2164
+ if (typeof x === 'bigint') {
2165
+ return 'BigInt';
2166
+ }
2167
+ return Type(x);
2168
+ };
2169
+
2170
+ // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
2171
+
2172
+ var FromPropertyDescriptor = function FromPropertyDescriptor(Desc) {
2173
+ if (typeof Desc === 'undefined') {
2174
+ return Desc;
2175
+ }
2176
+
2177
+ assertRecord(Type$1, 'Property Descriptor', 'Desc', Desc);
2178
+
2179
+ var obj = {};
2180
+ if ('[[Value]]' in Desc) {
2181
+ obj.value = Desc['[[Value]]'];
2182
+ }
2183
+ if ('[[Writable]]' in Desc) {
2184
+ obj.writable = Desc['[[Writable]]'];
2185
+ }
2186
+ if ('[[Get]]' in Desc) {
2187
+ obj.get = Desc['[[Get]]'];
2188
+ }
2189
+ if ('[[Set]]' in Desc) {
2190
+ obj.set = Desc['[[Set]]'];
2191
+ }
2192
+ if ('[[Enumerable]]' in Desc) {
2193
+ obj.enumerable = Desc['[[Enumerable]]'];
2194
+ }
2195
+ if ('[[Configurable]]' in Desc) {
2196
+ obj.configurable = Desc['[[Configurable]]'];
2197
+ }
2198
+ return obj;
2199
+ };
2200
+
2201
+ var $gOPD$1 = getIntrinsic('%Object.getOwnPropertyDescriptor%');
2202
+ if ($gOPD$1) {
2203
+ try {
2204
+ $gOPD$1([], 'length');
2205
+ } catch (e) {
2206
+ // IE 8 has a broken gOPD
2207
+ $gOPD$1 = null;
2208
+ }
2209
+ }
2210
+
2211
+ var getOwnPropertyDescriptor = $gOPD$1;
2212
+
2213
+ var $Array = getIntrinsic('%Array%');
2214
+
2215
+ // eslint-disable-next-line global-require
2216
+ var toStr$4 = !$Array.isArray && callBound('Object.prototype.toString');
2217
+
2218
+ // https://ecma-international.org/ecma-262/6.0/#sec-isarray
2219
+
2220
+ var IsArray = $Array.isArray || function IsArray(argument) {
2221
+ return toStr$4(argument) === '[object Array]';
2222
+ };
2223
+
2224
+ // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey
2225
+
2226
+ var IsPropertyKey = function IsPropertyKey(argument) {
2227
+ return typeof argument === 'string' || typeof argument === 'symbol';
2228
+ };
2229
+
2230
+ var hasSymbols$3 = hasSymbols$1();
2231
+ var hasToStringTag = hasSymbols$3 && typeof Symbol.toStringTag === 'symbol';
2232
+ var has$1;
2233
+ var $exec;
2234
+ var isRegexMarker;
2235
+ var badStringifier;
2236
+
2237
+ if (hasToStringTag) {
2238
+ has$1 = callBound('Object.prototype.hasOwnProperty');
2239
+ $exec = callBound('RegExp.prototype.exec');
2240
+ isRegexMarker = {};
2241
+
2242
+ var throwRegexMarker = function () {
2243
+ throw isRegexMarker;
2244
+ };
2245
+ badStringifier = {
2246
+ toString: throwRegexMarker,
2247
+ valueOf: throwRegexMarker
2248
+ };
2249
+
2250
+ if (typeof Symbol.toPrimitive === 'symbol') {
2251
+ badStringifier[Symbol.toPrimitive] = throwRegexMarker;
2252
+ }
2253
+ }
2254
+
2255
+ var $toString = callBound('Object.prototype.toString');
2256
+ var gOPD = Object.getOwnPropertyDescriptor;
2257
+ var regexClass = '[object RegExp]';
2258
+
2259
+ var isRegex = hasToStringTag
2260
+ // eslint-disable-next-line consistent-return
2261
+ ? function isRegex(value) {
2262
+ if (!value || typeof value !== 'object') {
2263
+ return false;
2264
+ }
2265
+
2266
+ var descriptor = gOPD(value, 'lastIndex');
2267
+ var hasLastIndexDataProperty = descriptor && has$1(descriptor, 'value');
2268
+ if (!hasLastIndexDataProperty) {
2269
+ return false;
2270
+ }
2271
+
2272
+ try {
2273
+ $exec(value, badStringifier);
2274
+ } catch (e) {
2275
+ return e === isRegexMarker;
2276
+ }
2277
+ }
2278
+ : function isRegex(value) {
2279
+ // In older browsers, typeof regex incorrectly returns 'function'
2280
+ if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
2281
+ return false;
2282
+ }
2283
+
2284
+ return $toString(value) === regexClass;
2285
+ };
2286
+
2287
+ // http://ecma-international.org/ecma-262/5.1/#sec-9.2
2288
+
2289
+ var ToBoolean = function ToBoolean(value) { return !!value; };
2290
+
2291
+ var $match = getIntrinsic('%Symbol.match%', true);
2292
+
2293
+
2294
+
2295
+
2296
+
2297
+ // https://ecma-international.org/ecma-262/6.0/#sec-isregexp
2298
+
2299
+ var IsRegExp = function IsRegExp(argument) {
2300
+ if (!argument || typeof argument !== 'object') {
2301
+ return false;
2302
+ }
2303
+ if ($match) {
2304
+ var isRegExp = argument[$match];
2305
+ if (typeof isRegExp !== 'undefined') {
2306
+ return ToBoolean(isRegExp);
2307
+ }
2308
+ }
2309
+ return isRegex(argument);
2310
+ };
2311
+
2312
+ var fnToStr = Function.prototype.toString;
2313
+ var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
2314
+ var badArrayLike;
2315
+ var isCallableMarker;
2316
+ if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
2317
+ try {
2318
+ badArrayLike = Object.defineProperty({}, 'length', {
2319
+ get: function () {
2320
+ throw isCallableMarker;
2321
+ }
2322
+ });
2323
+ isCallableMarker = {};
2324
+ // eslint-disable-next-line no-throw-literal
2325
+ reflectApply(function () { throw 42; }, null, badArrayLike);
2326
+ } catch (_) {
2327
+ if (_ !== isCallableMarker) {
2328
+ reflectApply = null;
2329
+ }
2330
+ }
2331
+ } else {
2332
+ reflectApply = null;
2333
+ }
2334
+
2335
+ var constructorRegex = /^\s*class\b/;
2336
+ var isES6ClassFn = function isES6ClassFunction(value) {
2337
+ try {
2338
+ var fnStr = fnToStr.call(value);
2339
+ return constructorRegex.test(fnStr);
2340
+ } catch (e) {
2341
+ return false; // not a function
2342
+ }
2343
+ };
2344
+
2345
+ var tryFunctionObject = function tryFunctionToStr(value) {
2346
+ try {
2347
+ if (isES6ClassFn(value)) { return false; }
2348
+ fnToStr.call(value);
2349
+ return true;
2350
+ } catch (e) {
2351
+ return false;
2352
+ }
2353
+ };
2354
+ var toStr$5 = Object.prototype.toString;
2355
+ var fnClass = '[object Function]';
2356
+ var genClass = '[object GeneratorFunction]';
2357
+ var hasToStringTag$1 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
2358
+ /* globals document: false */
2359
+ var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {};
2360
+
2361
+ var isCallable = reflectApply
2362
+ ? function isCallable(value) {
2363
+ if (value === documentDotAll) { return true; }
2364
+ if (!value) { return false; }
2365
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
2366
+ if (typeof value === 'function' && !value.prototype) { return true; }
2367
+ try {
2368
+ reflectApply(value, null, badArrayLike);
2369
+ } catch (e) {
2370
+ if (e !== isCallableMarker) { return false; }
2371
+ }
2372
+ return !isES6ClassFn(value);
2373
+ }
2374
+ : function isCallable(value) {
2375
+ if (value === documentDotAll) { return true; }
2376
+ if (!value) { return false; }
2377
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
2378
+ if (typeof value === 'function' && !value.prototype) { return true; }
2379
+ if (hasToStringTag$1) { return tryFunctionObject(value); }
2380
+ if (isES6ClassFn(value)) { return false; }
2381
+ var strClass = toStr$5.call(value);
2382
+ return strClass === fnClass || strClass === genClass;
2383
+ };
2384
+
2385
+ // http://ecma-international.org/ecma-262/5.1/#sec-9.11
2386
+
2387
+ var IsCallable = isCallable;
2388
+
2389
+ var $TypeError$2 = getIntrinsic('%TypeError%');
2390
+
2391
+
2392
+
2393
+
2394
+
2395
+ // https://ecma-international.org/ecma-262/5.1/#sec-8.10.5
2396
+
2397
+ var ToPropertyDescriptor = function ToPropertyDescriptor(Obj) {
2398
+ if (Type$1(Obj) !== 'Object') {
2399
+ throw new $TypeError$2('ToPropertyDescriptor requires an object');
2400
+ }
2401
+
2402
+ var desc = {};
2403
+ if (src(Obj, 'enumerable')) {
2404
+ desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable);
2405
+ }
2406
+ if (src(Obj, 'configurable')) {
2407
+ desc['[[Configurable]]'] = ToBoolean(Obj.configurable);
2408
+ }
2409
+ if (src(Obj, 'value')) {
2410
+ desc['[[Value]]'] = Obj.value;
2411
+ }
2412
+ if (src(Obj, 'writable')) {
2413
+ desc['[[Writable]]'] = ToBoolean(Obj.writable);
2414
+ }
2415
+ if (src(Obj, 'get')) {
2416
+ var getter = Obj.get;
2417
+ if (typeof getter !== 'undefined' && !IsCallable(getter)) {
2418
+ throw new $TypeError$2('getter must be a function');
2419
+ }
2420
+ desc['[[Get]]'] = getter;
2421
+ }
2422
+ if (src(Obj, 'set')) {
2423
+ var setter = Obj.set;
2424
+ if (typeof setter !== 'undefined' && !IsCallable(setter)) {
2425
+ throw new $TypeError$2('setter must be a function');
2426
+ }
2427
+ desc['[[Set]]'] = setter;
2428
+ }
2429
+
2430
+ if ((src(desc, '[[Get]]') || src(desc, '[[Set]]')) && (src(desc, '[[Value]]') || src(desc, '[[Writable]]'))) {
2431
+ throw new $TypeError$2('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
2432
+ }
2433
+ return desc;
2434
+ };
2435
+
2436
+ var $TypeError$3 = getIntrinsic('%TypeError%');
2437
+
2438
+
2439
+
2440
+ var $isEnumerable$1 = callBound('Object.prototype.propertyIsEnumerable');
2441
+
2442
+
2443
+
2444
+
2445
+
2446
+
2447
+
2448
+
2449
+
2450
+ // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty
2451
+
2452
+ var OrdinaryGetOwnProperty = function OrdinaryGetOwnProperty(O, P) {
2453
+ if (Type$1(O) !== 'Object') {
2454
+ throw new $TypeError$3('Assertion failed: O must be an Object');
2455
+ }
2456
+ if (!IsPropertyKey(P)) {
2457
+ throw new $TypeError$3('Assertion failed: P must be a Property Key');
2458
+ }
2459
+ if (!src(O, P)) {
2460
+ return void 0;
2461
+ }
2462
+ if (!getOwnPropertyDescriptor) {
2463
+ // ES3 / IE 8 fallback
2464
+ var arrayLength = IsArray(O) && P === 'length';
2465
+ var regexLastIndex = IsRegExp(O) && P === 'lastIndex';
2466
+ return {
2467
+ '[[Configurable]]': !(arrayLength || regexLastIndex),
2468
+ '[[Enumerable]]': $isEnumerable$1(O, P),
2469
+ '[[Value]]': O[P],
2470
+ '[[Writable]]': true
2471
+ };
2472
+ }
2473
+ return ToPropertyDescriptor(getOwnPropertyDescriptor(O, P));
2474
+ };
2475
+
2476
+ // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
2477
+
2478
+ var IsDataDescriptor = function IsDataDescriptor(Desc) {
2479
+ if (typeof Desc === 'undefined') {
2480
+ return false;
2481
+ }
2482
+
2483
+ assertRecord(Type$1, 'Property Descriptor', 'Desc', Desc);
2484
+
2485
+ if (!src(Desc, '[[Value]]') && !src(Desc, '[[Writable]]')) {
2486
+ return false;
2487
+ }
2488
+
2489
+ return true;
2490
+ };
2491
+
2492
+ var isPrimitive = function isPrimitive(value) {
2493
+ return value === null || (typeof value !== 'function' && typeof value !== 'object');
2494
+ };
2495
+
2496
+ var $Object = getIntrinsic('%Object%');
2497
+
2498
+
2499
+
2500
+ var $preventExtensions = $Object.preventExtensions;
2501
+ var $isExtensible = $Object.isExtensible;
2502
+
2503
+ // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o
2504
+
2505
+ var IsExtensible = $preventExtensions
2506
+ ? function IsExtensible(obj) {
2507
+ return !isPrimitive(obj) && $isExtensible(obj);
2508
+ }
2509
+ : function IsExtensible(obj) {
2510
+ return !isPrimitive(obj);
2511
+ };
2512
+
2513
+ var _isNaN = Number.isNaN || function isNaN(a) {
2514
+ return a !== a;
2515
+ };
2516
+
2517
+ // http://ecma-international.org/ecma-262/5.1/#sec-9.12
2518
+
2519
+ var SameValue = function SameValue(x, y) {
2520
+ if (x === y) { // 0 === -0, but they are not identical.
2521
+ if (x === 0) { return 1 / x === 1 / y; }
2522
+ return true;
2523
+ }
2524
+ return _isNaN(x) && _isNaN(y);
2525
+ };
2526
+
2527
+ var $TypeError$4 = getIntrinsic('%TypeError%');
2528
+
2529
+
2530
+
2531
+
2532
+
2533
+
2534
+
2535
+
2536
+
2537
+
2538
+
2539
+ // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty
2540
+
2541
+ var CreateDataProperty = function CreateDataProperty(O, P, V) {
2542
+ if (Type$1(O) !== 'Object') {
2543
+ throw new $TypeError$4('Assertion failed: Type(O) is not Object');
2544
+ }
2545
+ if (!IsPropertyKey(P)) {
2546
+ throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
2547
+ }
2548
+ var oldDesc = OrdinaryGetOwnProperty(O, P);
2549
+ var extensible = !oldDesc || IsExtensible(O);
2550
+ var immutable = oldDesc && (!oldDesc['[[Writable]]'] || !oldDesc['[[Configurable]]']);
2551
+ if (immutable || !extensible) {
2552
+ return false;
2553
+ }
2554
+ return DefineOwnProperty(
2555
+ IsDataDescriptor,
2556
+ SameValue,
2557
+ FromPropertyDescriptor,
2558
+ O,
2559
+ P,
2560
+ {
2561
+ '[[Configurable]]': true,
2562
+ '[[Enumerable]]': true,
2563
+ '[[Value]]': V,
2564
+ '[[Writable]]': true
2565
+ }
2566
+ );
2567
+ };
2568
+
2569
+ var $TypeError$5 = getIntrinsic('%TypeError%');
2570
+
2571
+ // http://ecma-international.org/ecma-262/5.1/#sec-9.10
2572
+
2573
+ var CheckObjectCoercible = function CheckObjectCoercible(value, optMessage) {
2574
+ if (value == null) {
2575
+ throw new $TypeError$5(optMessage || ('Cannot call method on ' + value));
2576
+ }
2577
+ return value;
2578
+ };
2579
+
2580
+ var RequireObjectCoercible = CheckObjectCoercible;
2581
+
2582
+ var $Object$1 = getIntrinsic('%Object%');
2583
+
2584
+
2585
+
2586
+ // https://ecma-international.org/ecma-262/6.0/#sec-toobject
2587
+
2588
+ var ToObject = function ToObject(value) {
2589
+ RequireObjectCoercible(value);
2590
+ return $Object$1(value);
2591
+ };
2592
+
2593
+ var $gOPD$2 = Object.getOwnPropertyDescriptor;
2594
+ var $getOwnNames = Object.getOwnPropertyNames;
2595
+ var $getSymbols = Object.getOwnPropertySymbols;
2596
+ var $concat$1 = callBound('Array.prototype.concat');
2597
+ var $reduce = callBound('Array.prototype.reduce');
2598
+ var getAll = $getSymbols ? function (obj) {
2599
+ return $concat$1($getOwnNames(obj), $getSymbols(obj));
2600
+ } : $getOwnNames;
2601
+
2602
+ var isES5 = IsCallable($gOPD$2) && IsCallable($getOwnNames);
2603
+
2604
+ var implementation$2 = function getOwnPropertyDescriptors(value) {
2605
+ RequireObjectCoercible(value);
2606
+ if (!isES5) {
2607
+ throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor');
2608
+ }
2609
+
2610
+ var O = ToObject(value);
2611
+ return $reduce(
2612
+ getAll(O),
2613
+ function (acc, key) {
2614
+ var descriptor = $gOPD$2(O, key);
2615
+ if (typeof descriptor !== 'undefined') {
2616
+ CreateDataProperty(acc, key, descriptor);
2617
+ }
2618
+ return acc;
2619
+ },
2620
+ {}
2621
+ );
2622
+ };
2623
+
2624
+ var polyfill = function getPolyfill() {
2625
+ return typeof Object.getOwnPropertyDescriptors === 'function' ? Object.getOwnPropertyDescriptors : implementation$2;
2626
+ };
2627
+
2628
+ var shim = function shimGetOwnPropertyDescriptors() {
2629
+ var polyfill$1 = polyfill();
2630
+ defineProperties_1(
2631
+ Object,
2632
+ { getOwnPropertyDescriptors: polyfill$1 },
2633
+ { getOwnPropertyDescriptors: function () { return Object.getOwnPropertyDescriptors !== polyfill$1; } }
2634
+ );
2635
+ return polyfill$1;
2636
+ };
2637
+
2638
+ var bound = callBind(polyfill(), Object);
2639
+
2640
+ defineProperties_1(bound, {
2641
+ getPolyfill: polyfill,
2642
+ implementation: implementation$2,
2643
+ shim: shim
2644
+ });
2645
+
2646
+ var object_getownpropertydescriptors = bound;
2647
+
2648
+ /* globals
2649
+ Atomics,
2650
+ SharedArrayBuffer,
2651
+ */
2652
+
2653
+ var undefined$2;
2654
+
2655
+ var $TypeError$6 = TypeError;
2656
+
2657
+ var $gOPD$3 = Object.getOwnPropertyDescriptor;
2658
+ if ($gOPD$3) {
2659
+ try {
2660
+ $gOPD$3({}, '');
2661
+ } catch (e) {
2662
+ $gOPD$3 = null; // this is IE 8, which has a broken gOPD
2663
+ }
2664
+ }
2665
+
2666
+ var throwTypeError$1 = function () { throw new $TypeError$6(); };
2667
+ var ThrowTypeError$1 = $gOPD$3
2668
+ ? (function () {
2669
+ try {
2670
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
2671
+ arguments.callee; // IE 8 does not throw here
2672
+ return throwTypeError$1;
2673
+ } catch (calleeThrows) {
2674
+ try {
2675
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
2676
+ return $gOPD$3(arguments, 'callee').get;
2677
+ } catch (gOPDthrows) {
2678
+ return throwTypeError$1;
2679
+ }
2680
+ }
2681
+ }())
2682
+ : throwTypeError$1;
2683
+
2684
+ var hasSymbols$4 = hasSymbols$1();
2685
+
2686
+ var getProto$1 = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
2687
+ var generatorFunction = undefined$2;
2688
+ var asyncFunction = undefined$2;
2689
+ var asyncGenFunction = undefined$2;
2690
+
2691
+ var TypedArray$1 = typeof Uint8Array === 'undefined' ? undefined$2 : getProto$1(Uint8Array);
2692
+
2693
+ var INTRINSICS$1 = {
2694
+ '%Array%': Array,
2695
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$2 : ArrayBuffer,
2696
+ '%ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined$2 : ArrayBuffer.prototype,
2697
+ '%ArrayIteratorPrototype%': hasSymbols$4 ? getProto$1([][Symbol.iterator]()) : undefined$2,
2698
+ '%ArrayPrototype%': Array.prototype,
2699
+ '%ArrayProto_entries%': Array.prototype.entries,
2700
+ '%ArrayProto_forEach%': Array.prototype.forEach,
2701
+ '%ArrayProto_keys%': Array.prototype.keys,
2702
+ '%ArrayProto_values%': Array.prototype.values,
2703
+ '%AsyncFromSyncIteratorPrototype%': undefined$2,
2704
+ '%AsyncFunction%': asyncFunction,
2705
+ '%AsyncFunctionPrototype%': undefined$2,
2706
+ '%AsyncGenerator%': undefined$2,
2707
+ '%AsyncGeneratorFunction%': asyncGenFunction,
2708
+ '%AsyncGeneratorPrototype%': undefined$2,
2709
+ '%AsyncIteratorPrototype%': undefined$2,
2710
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$2 : Atomics,
2711
+ '%Boolean%': Boolean,
2712
+ '%BooleanPrototype%': Boolean.prototype,
2713
+ '%DataView%': typeof DataView === 'undefined' ? undefined$2 : DataView,
2714
+ '%DataViewPrototype%': typeof DataView === 'undefined' ? undefined$2 : DataView.prototype,
2715
+ '%Date%': Date,
2716
+ '%DatePrototype%': Date.prototype,
2717
+ '%decodeURI%': decodeURI,
2718
+ '%decodeURIComponent%': decodeURIComponent,
2719
+ '%encodeURI%': encodeURI,
2720
+ '%encodeURIComponent%': encodeURIComponent,
2721
+ '%Error%': Error,
2722
+ '%ErrorPrototype%': Error.prototype,
2723
+ '%eval%': eval, // eslint-disable-line no-eval
2724
+ '%EvalError%': EvalError,
2725
+ '%EvalErrorPrototype%': EvalError.prototype,
2726
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$2 : Float32Array,
2727
+ '%Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined$2 : Float32Array.prototype,
2728
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$2 : Float64Array,
2729
+ '%Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined$2 : Float64Array.prototype,
2730
+ '%Function%': Function,
2731
+ '%FunctionPrototype%': Function.prototype,
2732
+ '%Generator%': undefined$2,
2733
+ '%GeneratorFunction%': generatorFunction,
2734
+ '%GeneratorPrototype%': undefined$2,
2735
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$2 : Int8Array,
2736
+ '%Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined$2 : Int8Array.prototype,
2737
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$2 : Int16Array,
2738
+ '%Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined$2 : Int8Array.prototype,
2739
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$2 : Int32Array,
2740
+ '%Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined$2 : Int32Array.prototype,
2741
+ '%isFinite%': isFinite,
2742
+ '%isNaN%': isNaN,
2743
+ '%IteratorPrototype%': hasSymbols$4 ? getProto$1(getProto$1([][Symbol.iterator]())) : undefined$2,
2744
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$2,
2745
+ '%JSONParse%': typeof JSON === 'object' ? JSON.parse : undefined$2,
2746
+ '%Map%': typeof Map === 'undefined' ? undefined$2 : Map,
2747
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$4 ? undefined$2 : getProto$1(new Map()[Symbol.iterator]()),
2748
+ '%MapPrototype%': typeof Map === 'undefined' ? undefined$2 : Map.prototype,
2749
+ '%Math%': Math,
2750
+ '%Number%': Number,
2751
+ '%NumberPrototype%': Number.prototype,
2752
+ '%Object%': Object,
2753
+ '%ObjectPrototype%': Object.prototype,
2754
+ '%ObjProto_toString%': Object.prototype.toString,
2755
+ '%ObjProto_valueOf%': Object.prototype.valueOf,
2756
+ '%parseFloat%': parseFloat,
2757
+ '%parseInt%': parseInt,
2758
+ '%Promise%': typeof Promise === 'undefined' ? undefined$2 : Promise,
2759
+ '%PromisePrototype%': typeof Promise === 'undefined' ? undefined$2 : Promise.prototype,
2760
+ '%PromiseProto_then%': typeof Promise === 'undefined' ? undefined$2 : Promise.prototype.then,
2761
+ '%Promise_all%': typeof Promise === 'undefined' ? undefined$2 : Promise.all,
2762
+ '%Promise_reject%': typeof Promise === 'undefined' ? undefined$2 : Promise.reject,
2763
+ '%Promise_resolve%': typeof Promise === 'undefined' ? undefined$2 : Promise.resolve,
2764
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$2 : Proxy,
2765
+ '%RangeError%': RangeError,
2766
+ '%RangeErrorPrototype%': RangeError.prototype,
2767
+ '%ReferenceError%': ReferenceError,
2768
+ '%ReferenceErrorPrototype%': ReferenceError.prototype,
2769
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$2 : Reflect,
2770
+ '%RegExp%': RegExp,
2771
+ '%RegExpPrototype%': RegExp.prototype,
2772
+ '%Set%': typeof Set === 'undefined' ? undefined$2 : Set,
2773
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$4 ? undefined$2 : getProto$1(new Set()[Symbol.iterator]()),
2774
+ '%SetPrototype%': typeof Set === 'undefined' ? undefined$2 : Set.prototype,
2775
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$2 : SharedArrayBuffer,
2776
+ '%SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined$2 : SharedArrayBuffer.prototype,
2777
+ '%String%': String,
2778
+ '%StringIteratorPrototype%': hasSymbols$4 ? getProto$1(''[Symbol.iterator]()) : undefined$2,
2779
+ '%StringPrototype%': String.prototype,
2780
+ '%Symbol%': hasSymbols$4 ? Symbol : undefined$2,
2781
+ '%SymbolPrototype%': hasSymbols$4 ? Symbol.prototype : undefined$2,
2782
+ '%SyntaxError%': SyntaxError,
2783
+ '%SyntaxErrorPrototype%': SyntaxError.prototype,
2784
+ '%ThrowTypeError%': ThrowTypeError$1,
2785
+ '%TypedArray%': TypedArray$1,
2786
+ '%TypedArrayPrototype%': TypedArray$1 ? TypedArray$1.prototype : undefined$2,
2787
+ '%TypeError%': $TypeError$6,
2788
+ '%TypeErrorPrototype%': $TypeError$6.prototype,
2789
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$2 : Uint8Array,
2790
+ '%Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined$2 : Uint8Array.prototype,
2791
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$2 : Uint8ClampedArray,
2792
+ '%Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined$2 : Uint8ClampedArray.prototype,
2793
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$2 : Uint16Array,
2794
+ '%Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined$2 : Uint16Array.prototype,
2795
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$2 : Uint32Array,
2796
+ '%Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined$2 : Uint32Array.prototype,
2797
+ '%URIError%': URIError,
2798
+ '%URIErrorPrototype%': URIError.prototype,
2799
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$2 : WeakMap,
2800
+ '%WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined$2 : WeakMap.prototype,
2801
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$2 : WeakSet,
2802
+ '%WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined$2 : WeakSet.prototype
2803
+ };
2804
+
2805
+
2806
+ var $replace$1 = functionBind.call(Function.call, String.prototype.replace);
2807
+
2808
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
2809
+ var rePropName$1 = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
2810
+ var reEscapeChar$1 = /\\(\\)?/g; /** Used to match backslashes in property paths. */
2811
+ var stringToPath$1 = function stringToPath(string) {
2812
+ var result = [];
2813
+ $replace$1(string, rePropName$1, function (match, number, quote, subString) {
2814
+ result[result.length] = quote ? $replace$1(subString, reEscapeChar$1, '$1') : (number || match);
2815
+ });
2816
+ return result;
2817
+ };
2818
+ /* end adaptation */
2819
+
2820
+ var getBaseIntrinsic$1 = function getBaseIntrinsic(name, allowMissing) {
2821
+ if (!(name in INTRINSICS$1)) {
2822
+ throw new SyntaxError('intrinsic ' + name + ' does not exist!');
2823
+ }
2824
+
2825
+ // istanbul ignore if // hopefully this is impossible to test :-)
2826
+ if (typeof INTRINSICS$1[name] === 'undefined' && !allowMissing) {
2827
+ throw new $TypeError$6('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
2828
+ }
2829
+
2830
+ return INTRINSICS$1[name];
2831
+ };
2832
+
2833
+ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
2834
+ if (typeof name !== 'string' || name.length === 0) {
2835
+ throw new TypeError('intrinsic name must be a non-empty string');
2836
+ }
2837
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
2838
+ throw new TypeError('"allowMissing" argument must be a boolean');
2839
+ }
2840
+
2841
+ var parts = stringToPath$1(name);
2842
+
2843
+ var value = getBaseIntrinsic$1('%' + (parts.length > 0 ? parts[0] : '') + '%', allowMissing);
2844
+ for (var i = 1; i < parts.length; i += 1) {
2845
+ if (value != null) {
2846
+ if ($gOPD$3 && (i + 1) >= parts.length) {
2847
+ var desc = $gOPD$3(value, parts[i]);
2848
+ if (!allowMissing && !(parts[i] in value)) {
2849
+ throw new $TypeError$6('base intrinsic for ' + name + ' exists, but the property is not available.');
2850
+ }
2851
+ // By convention, when a data property is converted to an accessor
2852
+ // property to emulate a data property that does not suffer from
2853
+ // the override mistake, that accessor's getter is marked with
2854
+ // an `originalValue` property. Here, when we detect this, we
2855
+ // uphold the illusion by pretending to see that original data
2856
+ // property, i.e., returning the value rather than the getter
2857
+ // itself.
2858
+ value = desc && 'get' in desc && !('originalValue' in desc.get) ? desc.get : value[parts[i]];
2859
+ } else {
2860
+ value = value[parts[i]];
2861
+ }
2862
+ }
2863
+ }
2864
+ return value;
2865
+ };
2866
+
2867
+ var callBind$1 = _commonjsHelpers.createCommonjsModule(function (module) {
2868
+
2869
+
2870
+
2871
+
2872
+
2873
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
2874
+ var $call = GetIntrinsic('%Function.prototype.call%');
2875
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
2876
+
2877
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
2878
+
2879
+ if ($defineProperty) {
2880
+ try {
2881
+ $defineProperty({}, 'a', { value: 1 });
2882
+ } catch (e) {
2883
+ // IE 8 has a broken defineProperty
2884
+ $defineProperty = null;
2885
+ }
2886
+ }
2887
+
2888
+ module.exports = function callBind() {
2889
+ return $reflectApply(functionBind, $call, arguments);
2890
+ };
2891
+
2892
+ var applyBind = function applyBind() {
2893
+ return $reflectApply(functionBind, $apply, arguments);
2894
+ };
2895
+
2896
+ if ($defineProperty) {
2897
+ $defineProperty(module.exports, 'apply', { value: applyBind });
2898
+ } else {
2899
+ module.exports.apply = applyBind;
2900
+ }
2901
+ });
2902
+ callBind$1.apply;
2903
+
2904
+ var $indexOf$1 = callBind$1(GetIntrinsic('String.prototype.indexOf'));
2905
+
2906
+ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
2907
+ var intrinsic = GetIntrinsic(name, !!allowMissing);
2908
+ if (typeof intrinsic === 'function' && $indexOf$1(name, '.prototype.')) {
2909
+ return callBind$1(intrinsic);
2910
+ }
2911
+ return intrinsic;
2912
+ };
2913
+
2914
+ var isES5$1 = typeof Object.defineProperty === 'function'
2915
+ && typeof Object.defineProperties === 'function';
2916
+
2917
+ var hasProto = [].__proto__ === Array.prototype; // eslint-disable-line no-proto
2918
+
2919
+ if (!isES5$1 || !hasProto) {
2920
+ throw new TypeError('util.promisify requires a true ES5 environment, that also supports `__proto__`');
2921
+ }
2922
+
2923
+
2924
+
2925
+ if (typeof Promise !== 'function') {
2926
+ throw new TypeError('`Promise` must be globally available for util.promisify to work.');
2927
+ }
2928
+
2929
+
2930
+
2931
+ var $slice = callBound$1('Array.prototype.slice');
2932
+ var $concat$2 = callBound$1('Array.prototype.concat');
2933
+ var $forEach = callBound$1('Array.prototype.forEach');
2934
+
2935
+ var hasSymbols$5 = hasSymbols$1();
2936
+
2937
+ var kCustomPromisifiedSymbol = hasSymbols$5 ? Symbol('util.promisify.custom') : null;
2938
+ var kCustomPromisifyArgsSymbol = hasSymbols$5 ? Symbol('customPromisifyArgs') : null;
2939
+
2940
+ var implementation$3 = function promisify(orig) {
2941
+ if (typeof orig !== 'function') {
2942
+ var error = new TypeError('The "original" argument must be of type function');
2943
+ error.name = 'TypeError [ERR_INVALID_ARG_TYPE]';
2944
+ error.code = 'ERR_INVALID_ARG_TYPE';
2945
+ throw error;
2946
+ }
2947
+
2948
+ if (hasSymbols$5 && orig[kCustomPromisifiedSymbol]) {
2949
+ var customFunction = orig[kCustomPromisifiedSymbol];
2950
+ if (typeof customFunction !== 'function') {
2951
+ throw new TypeError('The [util.promisify.custom] property must be a function');
2952
+ }
2953
+ Object.defineProperty(customFunction, kCustomPromisifiedSymbol, {
2954
+ configurable: true,
2955
+ enumerable: false,
2956
+ value: customFunction,
2957
+ writable: false
2958
+ });
2959
+ return customFunction;
2960
+ }
2961
+
2962
+ // Names to create an object from in case the callback receives multiple
2963
+ // arguments, e.g. ['stdout', 'stderr'] for child_process.exec.
2964
+ var argumentNames = orig[kCustomPromisifyArgsSymbol];
2965
+
2966
+ var promisified = function fn() {
2967
+ var args = $slice(arguments);
2968
+ var self = this; // eslint-disable-line no-invalid-this
2969
+ return new Promise(function (resolve, reject) {
2970
+ orig.apply(self, $concat$2(args, function (err) {
2971
+ var values = arguments.length > 1 ? $slice(arguments, 1) : [];
2972
+ if (err) {
2973
+ reject(err);
2974
+ } else if (typeof argumentNames !== 'undefined' && values.length > 1) {
2975
+ var obj = {};
2976
+ $forEach(argumentNames, function (name, index) {
2977
+ obj[name] = values[index];
2978
+ });
2979
+ resolve(obj);
2980
+ } else {
2981
+ resolve(values[0]);
2982
+ }
2983
+ }));
2984
+ });
2985
+ };
2986
+
2987
+ promisified.__proto__ = orig.__proto__; // eslint-disable-line no-proto
2988
+
2989
+ Object.defineProperty(promisified, kCustomPromisifiedSymbol, {
2990
+ configurable: true,
2991
+ enumerable: false,
2992
+ value: promisified,
2993
+ writable: false
2994
+ });
2995
+ return Object.defineProperties(promisified, object_getownpropertydescriptors(orig));
2996
+ };
2997
+
2998
+ var custom = kCustomPromisifiedSymbol;
2999
+ var customPromisifyArgs = kCustomPromisifyArgsSymbol;
3000
+ implementation$3.custom = custom;
3001
+ implementation$3.customPromisifyArgs = customPromisifyArgs;
3002
+
3003
+ var polyfill$1 = function getPolyfill() {
3004
+ if (typeof util.util.promisify === 'function') {
3005
+ return util.util.promisify;
3006
+ }
3007
+ return implementation$3;
3008
+ };
3009
+
3010
+ var shim$1 = function shimUtilPromisify() {
3011
+ var polyfill = polyfill$1();
3012
+ if (polyfill !== util.util.promisify) {
3013
+ Object.defineProperty(util.util, 'promisify', {
3014
+ configurable: true,
3015
+ enumerable: true,
3016
+ value: polyfill,
3017
+ writable: true
3018
+ });
3019
+ }
3020
+ return polyfill;
3021
+ };
3022
+
3023
+ var polyfill$2 = polyfill$1();
3024
+
3025
+
3026
+ /* eslint-disable no-unused-vars */
3027
+ var boundPromisify = function promisify(orig) {
3028
+ /* eslint-enable no-unused-vars */
3029
+ return polyfill$2.apply(util.util, arguments);
3030
+ };
3031
+ defineProperties_1(boundPromisify, {
3032
+ custom: polyfill$2.custom,
3033
+ customPromisifyArgs: polyfill$2.customPromisifyArgs,
3034
+ getPolyfill: polyfill$1,
3035
+ implementation: implementation$3,
3036
+ shim: shim$1
3037
+ });
3038
+
3039
+ var util_promisify = boundPromisify;
3040
+
3041
+ util_promisify.shim();
3042
+
3043
+ function connect() {
3044
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
3045
+
3046
+ if (!config) {
3047
+ config = {
3048
+ host: 'sanity-datasource.cluster-crao688bsrdh.us-east-1.rds.amazonaws.com',
3049
+ user: 'nasp',
3050
+ password: 'uRNkF9SkfXQs6AKK',
3051
+ database: 'user'
3052
+ };
3053
+ }
3054
+
3055
+ var connection = mysql__default['default'].createConnection(config);
3056
+ return {
3057
+ query: function query(sql, args) {
3058
+ return util.util.promisify(connection.query).call(connection, sql, args);
3059
+ },
3060
+ beginTransaction: function beginTransaction() {
3061
+ return util.util.promisify(connection.beginTransaction).call(connection);
3062
+ },
3063
+ commit: function commit() {
3064
+ return util.util.promisify(connection.commit).call(connection);
3065
+ },
3066
+ rollback: function rollback() {
3067
+ return util.util.promisify(connection.rollback).call(connection);
3068
+ },
3069
+ close: function close() {
3070
+ return util.util.promisify(connection.end).call(connection);
3071
+ }
3072
+ };
3073
+ }
3074
+
3075
+ var db = connect;
3076
+
3077
+ var crypt = _commonjsHelpers.createCommonjsModule(function (module) {
3078
+ (function() {
3079
+ var base64map
3080
+ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
3081
+
3082
+ crypt = {
3083
+ // Bit-wise rotation left
3084
+ rotl: function(n, b) {
3085
+ return (n << b) | (n >>> (32 - b));
3086
+ },
3087
+
3088
+ // Bit-wise rotation right
3089
+ rotr: function(n, b) {
3090
+ return (n << (32 - b)) | (n >>> b);
3091
+ },
3092
+
3093
+ // Swap big-endian to little-endian and vice versa
3094
+ endian: function(n) {
3095
+ // If number given, swap endian
3096
+ if (n.constructor == Number) {
3097
+ return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
3098
+ }
3099
+
3100
+ // Else, assume array and swap all items
3101
+ for (var i = 0; i < n.length; i++)
3102
+ n[i] = crypt.endian(n[i]);
3103
+ return n;
3104
+ },
3105
+
3106
+ // Generate an array of any length of random bytes
3107
+ randomBytes: function(n) {
3108
+ for (var bytes = []; n > 0; n--)
3109
+ bytes.push(Math.floor(Math.random() * 256));
3110
+ return bytes;
3111
+ },
3112
+
3113
+ // Convert a byte array to big-endian 32-bit words
3114
+ bytesToWords: function(bytes) {
3115
+ for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
3116
+ words[b >>> 5] |= bytes[i] << (24 - b % 32);
3117
+ return words;
3118
+ },
3119
+
3120
+ // Convert big-endian 32-bit words to a byte array
3121
+ wordsToBytes: function(words) {
3122
+ for (var bytes = [], b = 0; b < words.length * 32; b += 8)
3123
+ bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
3124
+ return bytes;
3125
+ },
3126
+
3127
+ // Convert a byte array to a hex string
3128
+ bytesToHex: function(bytes) {
3129
+ for (var hex = [], i = 0; i < bytes.length; i++) {
3130
+ hex.push((bytes[i] >>> 4).toString(16));
3131
+ hex.push((bytes[i] & 0xF).toString(16));
3132
+ }
3133
+ return hex.join('');
3134
+ },
3135
+
3136
+ // Convert a hex string to a byte array
3137
+ hexToBytes: function(hex) {
3138
+ for (var bytes = [], c = 0; c < hex.length; c += 2)
3139
+ bytes.push(parseInt(hex.substr(c, 2), 16));
3140
+ return bytes;
3141
+ },
3142
+
3143
+ // Convert a byte array to a base-64 string
3144
+ bytesToBase64: function(bytes) {
3145
+ for (var base64 = [], i = 0; i < bytes.length; i += 3) {
3146
+ var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
3147
+ for (var j = 0; j < 4; j++)
3148
+ if (i * 8 + j * 6 <= bytes.length * 8)
3149
+ base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
3150
+ else
3151
+ base64.push('=');
3152
+ }
3153
+ return base64.join('');
3154
+ },
3155
+
3156
+ // Convert a base-64 string to a byte array
3157
+ base64ToBytes: function(base64) {
3158
+ // Remove non-base-64 characters
3159
+ base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
3160
+
3161
+ for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
3162
+ imod4 = ++i % 4) {
3163
+ if (imod4 == 0) continue;
3164
+ bytes.push(((base64map.indexOf(base64.charAt(i - 1))
3165
+ & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
3166
+ | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
3167
+ }
3168
+ return bytes;
3169
+ }
3170
+ };
3171
+
3172
+ module.exports = crypt;
3173
+ })();
3174
+ });
3175
+
3176
+ var charenc = {
3177
+ // UTF-8 encoding
3178
+ utf8: {
3179
+ // Convert a string to a byte array
3180
+ stringToBytes: function(str) {
3181
+ return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
3182
+ },
3183
+
3184
+ // Convert a byte array to a string
3185
+ bytesToString: function(bytes) {
3186
+ return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
3187
+ }
3188
+ },
3189
+
3190
+ // Binary encoding
3191
+ bin: {
3192
+ // Convert a string to a byte array
3193
+ stringToBytes: function(str) {
3194
+ for (var bytes = [], i = 0; i < str.length; i++)
3195
+ bytes.push(str.charCodeAt(i) & 0xFF);
3196
+ return bytes;
3197
+ },
3198
+
3199
+ // Convert a byte array to a string
3200
+ bytesToString: function(bytes) {
3201
+ for (var str = [], i = 0; i < bytes.length; i++)
3202
+ str.push(String.fromCharCode(bytes[i]));
3203
+ return str.join('');
3204
+ }
3205
+ }
3206
+ };
3207
+
3208
+ var charenc_1 = charenc;
3209
+
3210
+ /*!
3211
+ * Determine if an object is a Buffer
3212
+ *
3213
+ * @author Feross Aboukhadijeh <https://feross.org>
3214
+ * @license MIT
3215
+ */
3216
+
3217
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
3218
+ // Object.prototype.constructor. Remove this eventually
3219
+ var isBuffer_1 = function (obj) {
3220
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
3221
+ };
3222
+
3223
+ function isBuffer (obj) {
3224
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
3225
+ }
3226
+
3227
+ // For Node v0.10 support. Remove this eventually.
3228
+ function isSlowBuffer (obj) {
3229
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
3230
+ }
3231
+
3232
+ var md5 = _commonjsHelpers.createCommonjsModule(function (module) {
3233
+ (function(){
3234
+ var crypt$1 = crypt,
3235
+ utf8 = charenc_1.utf8,
3236
+ isBuffer = isBuffer_1,
3237
+ bin = charenc_1.bin,
3238
+
3239
+ // The core
3240
+ md5 = function (message, options) {
3241
+ // Convert to byte array
3242
+ if (message.constructor == String)
3243
+ if (options && options.encoding === 'binary')
3244
+ message = bin.stringToBytes(message);
3245
+ else
3246
+ message = utf8.stringToBytes(message);
3247
+ else if (isBuffer(message))
3248
+ message = Array.prototype.slice.call(message, 0);
3249
+ else if (!Array.isArray(message) && message.constructor !== Uint8Array)
3250
+ message = message.toString();
3251
+ // else, assume byte array already
3252
+
3253
+ var m = crypt$1.bytesToWords(message),
3254
+ l = message.length * 8,
3255
+ a = 1732584193,
3256
+ b = -271733879,
3257
+ c = -1732584194,
3258
+ d = 271733878;
3259
+
3260
+ // Swap endian
3261
+ for (var i = 0; i < m.length; i++) {
3262
+ m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
3263
+ ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
3264
+ }
3265
+
3266
+ // Padding
3267
+ m[l >>> 5] |= 0x80 << (l % 32);
3268
+ m[(((l + 64) >>> 9) << 4) + 14] = l;
3269
+
3270
+ // Method shortcuts
3271
+ var FF = md5._ff,
3272
+ GG = md5._gg,
3273
+ HH = md5._hh,
3274
+ II = md5._ii;
3275
+
3276
+ for (var i = 0; i < m.length; i += 16) {
3277
+
3278
+ var aa = a,
3279
+ bb = b,
3280
+ cc = c,
3281
+ dd = d;
3282
+
3283
+ a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
3284
+ d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
3285
+ c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
3286
+ b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
3287
+ a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
3288
+ d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
3289
+ c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
3290
+ b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
3291
+ a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
3292
+ d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
3293
+ c = FF(c, d, a, b, m[i+10], 17, -42063);
3294
+ b = FF(b, c, d, a, m[i+11], 22, -1990404162);
3295
+ a = FF(a, b, c, d, m[i+12], 7, 1804603682);
3296
+ d = FF(d, a, b, c, m[i+13], 12, -40341101);
3297
+ c = FF(c, d, a, b, m[i+14], 17, -1502002290);
3298
+ b = FF(b, c, d, a, m[i+15], 22, 1236535329);
3299
+
3300
+ a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
3301
+ d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
3302
+ c = GG(c, d, a, b, m[i+11], 14, 643717713);
3303
+ b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
3304
+ a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
3305
+ d = GG(d, a, b, c, m[i+10], 9, 38016083);
3306
+ c = GG(c, d, a, b, m[i+15], 14, -660478335);
3307
+ b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
3308
+ a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
3309
+ d = GG(d, a, b, c, m[i+14], 9, -1019803690);
3310
+ c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
3311
+ b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
3312
+ a = GG(a, b, c, d, m[i+13], 5, -1444681467);
3313
+ d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
3314
+ c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
3315
+ b = GG(b, c, d, a, m[i+12], 20, -1926607734);
3316
+
3317
+ a = HH(a, b, c, d, m[i+ 5], 4, -378558);
3318
+ d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
3319
+ c = HH(c, d, a, b, m[i+11], 16, 1839030562);
3320
+ b = HH(b, c, d, a, m[i+14], 23, -35309556);
3321
+ a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
3322
+ d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
3323
+ c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
3324
+ b = HH(b, c, d, a, m[i+10], 23, -1094730640);
3325
+ a = HH(a, b, c, d, m[i+13], 4, 681279174);
3326
+ d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
3327
+ c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
3328
+ b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
3329
+ a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
3330
+ d = HH(d, a, b, c, m[i+12], 11, -421815835);
3331
+ c = HH(c, d, a, b, m[i+15], 16, 530742520);
3332
+ b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
3333
+
3334
+ a = II(a, b, c, d, m[i+ 0], 6, -198630844);
3335
+ d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
3336
+ c = II(c, d, a, b, m[i+14], 15, -1416354905);
3337
+ b = II(b, c, d, a, m[i+ 5], 21, -57434055);
3338
+ a = II(a, b, c, d, m[i+12], 6, 1700485571);
3339
+ d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
3340
+ c = II(c, d, a, b, m[i+10], 15, -1051523);
3341
+ b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
3342
+ a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
3343
+ d = II(d, a, b, c, m[i+15], 10, -30611744);
3344
+ c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
3345
+ b = II(b, c, d, a, m[i+13], 21, 1309151649);
3346
+ a = II(a, b, c, d, m[i+ 4], 6, -145523070);
3347
+ d = II(d, a, b, c, m[i+11], 10, -1120210379);
3348
+ c = II(c, d, a, b, m[i+ 2], 15, 718787259);
3349
+ b = II(b, c, d, a, m[i+ 9], 21, -343485551);
3350
+
3351
+ a = (a + aa) >>> 0;
3352
+ b = (b + bb) >>> 0;
3353
+ c = (c + cc) >>> 0;
3354
+ d = (d + dd) >>> 0;
3355
+ }
3356
+
3357
+ return crypt$1.endian([a, b, c, d]);
3358
+ };
3359
+
3360
+ // Auxiliary functions
3361
+ md5._ff = function (a, b, c, d, x, s, t) {
3362
+ var n = a + (b & c | ~b & d) + (x >>> 0) + t;
3363
+ return ((n << s) | (n >>> (32 - s))) + b;
3364
+ };
3365
+ md5._gg = function (a, b, c, d, x, s, t) {
3366
+ var n = a + (b & d | c & ~d) + (x >>> 0) + t;
3367
+ return ((n << s) | (n >>> (32 - s))) + b;
3368
+ };
3369
+ md5._hh = function (a, b, c, d, x, s, t) {
3370
+ var n = a + (b ^ c ^ d) + (x >>> 0) + t;
3371
+ return ((n << s) | (n >>> (32 - s))) + b;
3372
+ };
3373
+ md5._ii = function (a, b, c, d, x, s, t) {
3374
+ var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
3375
+ return ((n << s) | (n >>> (32 - s))) + b;
3376
+ };
3377
+
3378
+ // Package private blocksize
3379
+ md5._blocksize = 16;
3380
+ md5._digestsize = 16;
3381
+
3382
+ module.exports = function (message, options) {
3383
+ if (message === undefined || message === null)
3384
+ throw new Error('Illegal argument ' + message);
3385
+
3386
+ var digestbytes = crypt$1.wordsToBytes(md5(message, options));
3387
+ return options && options.asBytes ? digestbytes :
3388
+ options && options.asString ? bin.bytesToString(digestbytes) :
3389
+ crypt$1.bytesToHex(digestbytes);
3390
+ };
3391
+
3392
+ })();
3393
+ });
3394
+
3395
+ var _this$3 = undefined;
3396
+
3397
+ var config = {
3398
+ host: 'sanity-datasource.cluster-crao688bsrdh.us-east-1.rds.amazonaws.com',
3399
+ user: 'nasp',
3400
+ password: 'uRNkF9SkfXQs6AKK',
3401
+ database: 'user'
3402
+ };
3403
+
3404
+ var findUser = function () {
3405
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(email) {
3406
+ var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
3407
+ var db$1, query, res, user, hash, passwordsMatch, user_shared, occupation_id;
3408
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
3409
+ while (1) {
3410
+ switch (_context.prev = _context.next) {
3411
+ case 0:
3412
+ db$1 = null;
3413
+ _context.prev = 1;
3414
+
3415
+
3416
+ db$1 = db(config);
3417
+
3418
+ query = '\n select * \n from user \n where trim(lower(email)) = ?\n ';
3419
+ _context.next = 6;
3420
+ return db$1.query(query, [email.toLowerCase().trim()]);
3421
+
3422
+ case 6:
3423
+ res = _context.sent;
3424
+ user = res.length > 0 ? res[0] : null;
3425
+
3426
+ if (user) {
3427
+ _context.next = 10;
3428
+ break;
3429
+ }
3430
+
3431
+ throw new Error('Invalid credential provided');
3432
+
3433
+ case 10:
3434
+ if (!password) {
3435
+ _context.next = 15;
3436
+ break;
3437
+ }
3438
+
3439
+ hash = md5(password);
3440
+ passwordsMatch = hash === user.password;
3441
+
3442
+ if (passwordsMatch) {
3443
+ _context.next = 15;
3444
+ break;
3445
+ }
3446
+
3447
+ throw new Error('Password doesn\'t match');
3448
+
3449
+ case 15:
3450
+
3451
+ query = '\n select * \n from user_shared \n where user_id = ?\n ';
3452
+ _context.next = 18;
3453
+ return db$1.query(query, [user.id]);
3454
+
3455
+ case 18:
3456
+ res = _context.sent;
3457
+ user_shared = res.length > 0 ? res[0] : null;
3458
+
3459
+ user.shared = user_shared;
3460
+
3461
+ // occupation
3462
+ query = '\n select id \n from occupation \n where name = ?\n ';
3463
+ _context.next = 24;
3464
+ return db$1.query(query, [user_shared.occupation]);
3465
+
3466
+ case 24:
3467
+ res = _context.sent;
3468
+ occupation_id = res.length > 0 ? res[0].id : '';
3469
+
3470
+ user.shared.occupation_id = occupation_id;
3471
+
3472
+ _context.next = 29;
3473
+ return db$1.close();
3474
+
3475
+ case 29:
3476
+ return _context.abrupt('return', {
3477
+ error: '',
3478
+ user: user
3479
+ });
3480
+
3481
+ case 32:
3482
+ _context.prev = 32;
3483
+ _context.t0 = _context['catch'](1);
3484
+
3485
+ if (!db$1) {
3486
+ _context.next = 37;
3487
+ break;
3488
+ }
3489
+
3490
+ _context.next = 37;
3491
+ return db$1.close();
3492
+
3493
+ case 37:
3494
+ return _context.abrupt('return', {
3495
+ error: _context.t0.message,
3496
+ user: null
3497
+ });
3498
+
3499
+ case 38:
3500
+ case 'end':
3501
+ return _context.stop();
3502
+ }
3503
+ }
3504
+ }, _callee, this, [[1, 32]]);
3505
+ }));
3506
+
3507
+ return function findUser(_x) {
3508
+ return _ref.apply(this, arguments);
3509
+ };
3510
+ }();
3511
+
3512
+ var updateUser = function () {
3513
+ var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(data) {
3514
+ var db$1, query, res, hash, columns, i, column, occupation_name;
3515
+ return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
3516
+ while (1) {
3517
+ switch (_context2.prev = _context2.next) {
3518
+ case 0:
3519
+ db$1 = null;
3520
+ _context2.prev = 1;
3521
+
3522
+
3523
+ validateUserData(data);
3524
+
3525
+ db$1 = db(config);
3526
+
3527
+ _context2.next = 6;
3528
+ return db$1.beginTransaction();
3529
+
3530
+ case 6:
3531
+ if (data.user_id) {
3532
+ _context2.next = 8;
3533
+ break;
3534
+ }
3535
+
3536
+ throw new Error('Please provide user ID');
3537
+
3538
+ case 8:
3539
+
3540
+ data.email = data.email.toLowerCase().trim();
3541
+
3542
+ // check if new email is taken
3543
+ query = '\n select * \n from user \n where lower(trim(email)) = ?\n and id != ?\n ';
3544
+ _context2.next = 12;
3545
+ return db$1.query(query, [data.email, data.user_id]);
3546
+
3547
+ case 12:
3548
+ res = _context2.sent;
3549
+
3550
+ if (!(res && res.length > 0)) {
3551
+ _context2.next = 15;
3552
+ break;
3553
+ }
3554
+
3555
+ throw new Error('Email already taken');
3556
+
3557
+ case 15:
3558
+ if (!data.password) {
3559
+ _context2.next = 23;
3560
+ break;
3561
+ }
3562
+
3563
+ hash = md5(data.password);
3564
+
3565
+ query = '\n update user \n set password = ?\n where user_id = ?\n ';
3566
+ _context2.next = 20;
3567
+ return db$1.query(query, [hash, data.user_id]);
3568
+
3569
+ case 20:
3570
+ res = _context2.sent;
3571
+
3572
+ if (!(!res || res.affectedRows < 1)) {
3573
+ _context2.next = 23;
3574
+ break;
3575
+ }
3576
+
3577
+ throw new Error('Failed to update password');
3578
+
3579
+ case 23:
3580
+
3581
+ query = 'show columns from user_shared';
3582
+ _context2.next = 26;
3583
+ return db$1.query(query);
3584
+
3585
+ case 26:
3586
+ columns = _context2.sent;
3587
+
3588
+
3589
+ for (i = 0; i < columns.length; i++) {
3590
+ column = columns[i].Field;
3591
+
3592
+ if (typeof data[column] === 'undefined') {
3593
+ data[column] = '';
3594
+ }
3595
+ }
3596
+
3597
+ // user_shared
3598
+ query = '\n update user_shared\n set \n first_name = ?,\n last_name = ?,\n country = ?,\n city = ?,\n state = ?,\n zip = ?,\n phone = ?,\n occupation = ?,\n primary_specialty = ?,\n area_of_practice = ?,\n work_place = ?,\n graduation_year = ?,\n medical_school = ?,\n npi = ?,\n role = ?,\n updated = current_timestamp\n where user_id = ?\n ';
3599
+
3600
+ _context2.next = 31;
3601
+ return getOccupationNameById(db$1, data.occupation);
3602
+
3603
+ case 31:
3604
+ occupation_name = _context2.sent;
3605
+ _context2.next = 34;
3606
+ return db$1.query(query, [data.first_name, data.last_name, data.country, data.city, data.state, data.zip, data.phone, occupation_name, data.primary_specialty, data.area_of_practice, data.work_place, data.graduation_year, data.medical_school, data.npi, data.role, data.user_id]);
3607
+
3608
+ case 34:
3609
+ res = _context2.sent;
3610
+
3611
+ if (!(!res || res.affectedRows < 1)) {
3612
+ _context2.next = 37;
3613
+ break;
3614
+ }
3615
+
3616
+ throw new Error('Failed to update user shared information record');
3617
+
3618
+ case 37:
3619
+ _context2.next = 39;
3620
+ return db$1.commit();
3621
+
3622
+ case 39:
3623
+ _context2.next = 41;
3624
+ return db$1.close();
3625
+
3626
+ case 41:
3627
+
3628
+ db$1 = null;
3629
+
3630
+ return _context2.abrupt('return', {
3631
+ error: '',
3632
+ user: findUser(data.email)
3633
+ });
3634
+
3635
+ case 45:
3636
+ _context2.prev = 45;
3637
+ _context2.t0 = _context2['catch'](1);
3638
+
3639
+
3640
+ console.log('error:', _context2.t0);
3641
+
3642
+ if (!db$1) {
3643
+ _context2.next = 53;
3644
+ break;
3645
+ }
3646
+
3647
+ _context2.next = 51;
3648
+ return db$1.rollback();
3649
+
3650
+ case 51:
3651
+ _context2.next = 53;
3652
+ return db$1.close();
3653
+
3654
+ case 53:
3655
+ return _context2.abrupt('return', {
3656
+ error: _context2.t0.message,
3657
+ user: null
3658
+ });
3659
+
3660
+ case 54:
3661
+ case 'end':
3662
+ return _context2.stop();
3663
+ }
3664
+ }
3665
+ }, _callee2, this, [[1, 45]]);
3666
+ }));
3667
+
3668
+ return function updateUser(_x3) {
3669
+ return _ref2.apply(this, arguments);
3670
+ };
3671
+ }();
3672
+
3673
+ var validateUserData = function validateUserData(data) {
3674
+ var requirePassword = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3675
+
3676
+ if (!data.email) {
3677
+ throw new Error('Email is required');
3678
+ }
3679
+
3680
+ if (requirePassword && !data.password) {
3681
+ throw new Error('Password is required');
3682
+ }
3683
+
3684
+ if (data.password && data.password !== data.rpassword) {
3685
+ throw new Error('Password does not match');
3686
+ }
3687
+
3688
+ if (!data.first_name) {
3689
+ throw new Error('First name is required');
3690
+ }
3691
+
3692
+ if (!data.last_name) {
3693
+ throw new Error('Last name is required');
3694
+ }
3695
+
3696
+ if (!data.country) {
3697
+ throw new Error('Country is required');
3698
+ }
3699
+
3700
+ if (data.country === 'United States') {
3701
+ if (!data.state) {
3702
+ throw new Error('State is required');
3703
+ }
3704
+
3705
+ if (!data.zip) {
3706
+ throw new Error('Zip code is required');
3707
+ }
3708
+
3709
+ if (!data.phone) {
3710
+ throw new Error('Phone is required');
3711
+ }
3712
+ }
3713
+ };
3714
+
3715
+ var getOccupationNameById = function () {
3716
+ var _ref3 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee3(db, occupation_id) {
3717
+ var query, res;
3718
+ return asyncToGenerator.regenerator.wrap(function _callee3$(_context3) {
3719
+ while (1) {
3720
+ switch (_context3.prev = _context3.next) {
3721
+ case 0:
3722
+ query = '\n select name\n from occupation \n where id = ?\n ';
3723
+ _context3.next = 3;
3724
+ return db.query(query, [occupation_id]);
3725
+
3726
+ case 3:
3727
+ res = _context3.sent;
3728
+
3729
+ if (!(res && res.length > 0)) {
3730
+ _context3.next = 6;
3731
+ break;
3732
+ }
3733
+
3734
+ return _context3.abrupt('return', res[0].name);
3735
+
3736
+ case 6:
3737
+ throw new Error('Failed to get occupation name by ID: ' + occupation_id);
3738
+
3739
+ case 7:
3740
+ case 'end':
3741
+ return _context3.stop();
3742
+ }
3743
+ }
3744
+ }, _callee3, _this$3);
3745
+ }));
3746
+
3747
+ return function getOccupationNameById(_x5, _x6) {
3748
+ return _ref3.apply(this, arguments);
3749
+ };
3750
+ }();
3751
+
3752
+ var createUser = function () {
3753
+ var _ref4 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee4(data) {
3754
+ var db$1, query, res, hash, columns, i, column, user_id, occupation_name;
3755
+ return asyncToGenerator.regenerator.wrap(function _callee4$(_context4) {
3756
+ while (1) {
3757
+ switch (_context4.prev = _context4.next) {
3758
+ case 0:
3759
+ db$1 = null;
3760
+ _context4.prev = 1;
3761
+
3762
+
3763
+ validateUserData(data, true);
3764
+
3765
+ db$1 = db(config);
3766
+
3767
+ _context4.next = 6;
3768
+ return db$1.beginTransaction();
3769
+
3770
+ case 6:
3771
+
3772
+ data.email = data.email.toLowerCase().trim();
3773
+
3774
+ // check if user exists
3775
+ query = '\n select * \n from user \n where lower(trim(email)) = ?\n ';
3776
+ _context4.next = 10;
3777
+ return db$1.query(query, [data.email]);
3778
+
3779
+ case 10:
3780
+ res = _context4.sent;
3781
+
3782
+ if (!(res && res.length > 0)) {
3783
+ _context4.next = 13;
3784
+ break;
3785
+ }
3786
+
3787
+ throw new Error('User already exists');
3788
+
3789
+ case 13:
3790
+ hash = md5(data.password);
3791
+
3792
+ // basic user info
3793
+
3794
+ query = '\n insert into user ( \n email, password, created\n ) values (\n ?, ?, current_timestamp\n )\n ';
3795
+ _context4.next = 17;
3796
+ return db$1.query(query, [data.email, hash]);
3797
+
3798
+ case 17:
3799
+ res = _context4.sent;
3800
+
3801
+ if (!(!res || res.insertId < 1)) {
3802
+ _context4.next = 20;
3803
+ break;
3804
+ }
3805
+
3806
+ throw new Error('Failed to create user');
3807
+
3808
+ case 20:
3809
+
3810
+ query = 'show columns from user_shared';
3811
+ _context4.next = 23;
3812
+ return db$1.query(query);
3813
+
3814
+ case 23:
3815
+ columns = _context4.sent;
3816
+
3817
+
3818
+ for (i = 0; i < columns.length; i++) {
3819
+ column = columns[i].Field;
3820
+
3821
+ if (typeof data[column] === 'undefined') {
3822
+ data[column] = '';
3823
+ }
3824
+ }
3825
+
3826
+ user_id = res.insertId;
3827
+
3828
+ // user_shared
3829
+
3830
+ query = '\n insert into user_shared (\n user_id, first_name, last_name, country, city, state, zip, phone, \n occupation, primary_specialty, area_of_practice, work_place, graduation_year, medical_school, \n npi, role, updated \n ) values (\n ?, ?, ?, ?, ?, ?, ?, ?,\n ?, ?, ?, ?, ?, ?,\n ?, ?, current_timestamp\n )\n ';
3831
+
3832
+ _context4.next = 29;
3833
+ return getOccupationNameById(db$1, data.occupation);
3834
+
3835
+ case 29:
3836
+ occupation_name = _context4.sent;
3837
+ _context4.next = 32;
3838
+ return db$1.query(query, [user_id, data.first_name, data.last_name, data.country, data.city, data.state, data.zip, data.phone, occupation_name, data.primary_specialty, data.area_of_practice, data.work_place, data.graduation_year, data.medical_school, data.npi, data.role]);
3839
+
3840
+ case 32:
3841
+ res = _context4.sent;
3842
+
3843
+ if (!(!res || res.affectedRows < 1)) {
3844
+ _context4.next = 35;
3845
+ break;
3846
+ }
3847
+
3848
+ throw new Error('Failed to create user shared information record');
3849
+
3850
+ case 35:
3851
+ _context4.next = 37;
3852
+ return db$1.commit();
3853
+
3854
+ case 37:
3855
+ _context4.next = 39;
3856
+ return db$1.close();
3857
+
3858
+ case 39:
3859
+ return _context4.abrupt('return', {
3860
+ error: '',
3861
+ user: findUser(data.email)
3862
+ });
3863
+
3864
+ case 42:
3865
+ _context4.prev = 42;
3866
+ _context4.t0 = _context4['catch'](1);
3867
+
3868
+ if (!db$1) {
3869
+ _context4.next = 49;
3870
+ break;
3871
+ }
3872
+
3873
+ _context4.next = 47;
3874
+ return db$1.rollback();
3875
+
3876
+ case 47:
3877
+ _context4.next = 49;
3878
+ return db$1.close();
3879
+
3880
+ case 49:
3881
+ return _context4.abrupt('return', {
3882
+ error: _context4.t0.message,
3883
+ user: null
3884
+ });
3885
+
3886
+ case 50:
3887
+ case 'end':
3888
+ return _context4.stop();
3889
+ }
3890
+ }
3891
+ }, _callee4, this, [[1, 42]]);
3892
+ }));
3893
+
3894
+ return function createUser(_x7) {
3895
+ return _ref4.apply(this, arguments);
3896
+ };
3897
+ }();
3898
+
3899
+ var createUser$1 = function () {
3900
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(data) {
3901
+ var res;
3902
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
3903
+ while (1) {
3904
+ switch (_context.prev = _context.next) {
3905
+ case 0:
3906
+ _context.next = 2;
3907
+ return createUser(data);
3908
+
3909
+ case 2:
3910
+ res = _context.sent;
3911
+
3912
+ if (!res.error) {
3913
+ _context.next = 5;
3914
+ break;
3915
+ }
3916
+
3917
+ throw new Error(res.error);
3918
+
3919
+ case 5:
3920
+ return _context.abrupt('return', res.user);
3921
+
3922
+ case 6:
3923
+ case 'end':
3924
+ return _context.stop();
3925
+ }
3926
+ }
3927
+ }, _callee, this);
3928
+ }));
3929
+
3930
+ return function createUser(_x) {
3931
+ return _ref.apply(this, arguments);
3932
+ };
3933
+ }();
3934
+
3935
+ var updateUser$1 = function () {
3936
+ var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(data) {
3937
+ var res;
3938
+ return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
3939
+ while (1) {
3940
+ switch (_context2.prev = _context2.next) {
3941
+ case 0:
3942
+ _context2.next = 2;
3943
+ return updateUser(data);
3944
+
3945
+ case 2:
3946
+ res = _context2.sent;
3947
+
3948
+ if (!res.error) {
3949
+ _context2.next = 5;
3950
+ break;
3951
+ }
3952
+
3953
+ throw new Error(res.error);
3954
+
3955
+ case 5:
3956
+ return _context2.abrupt('return', res.user);
3957
+
3958
+ case 6:
3959
+ case 'end':
3960
+ return _context2.stop();
3961
+ }
3962
+ }
3963
+ }, _callee2, this);
3964
+ }));
3965
+
3966
+ return function updateUser(_x2) {
3967
+ return _ref2.apply(this, arguments);
3968
+ };
3969
+ }();
3970
+
3971
+ var findUser$1 = function () {
3972
+ var _ref3 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee3(_ref4) {
3973
+ var email = _ref4.email,
3974
+ password = _ref4.password;
3975
+ var res;
3976
+ return asyncToGenerator.regenerator.wrap(function _callee3$(_context3) {
3977
+ while (1) {
3978
+ switch (_context3.prev = _context3.next) {
3979
+ case 0:
3980
+ _context3.next = 2;
3981
+ return findUser(email, password);
3982
+
3983
+ case 2:
3984
+ res = _context3.sent;
3985
+
3986
+ if (!res.error) {
3987
+ _context3.next = 5;
3988
+ break;
3989
+ }
3990
+
3991
+ throw new Error(res.error);
3992
+
3993
+ case 5:
3994
+ return _context3.abrupt('return', res.user);
3995
+
3996
+ case 6:
3997
+ case 'end':
3998
+ return _context3.stop();
3999
+ }
4000
+ }
4001
+ }, _callee3, this);
4002
+ }));
4003
+
4004
+ return function findUser(_x3) {
4005
+ return _ref3.apply(this, arguments);
4006
+ };
4007
+ }();
4008
+
4009
+ var user = /*#__PURE__*/Object.freeze({
4010
+ __proto__: null,
4011
+ createUser: createUser$1,
4012
+ updateUser: updateUser$1,
4013
+ findUser: findUser$1
4014
+ });
4015
+
4016
+ var localStrategy = new Local__default['default'].Strategy({
4017
+ usernameField: 'email',
4018
+ passwordField: 'password'
4019
+ }, function (email, password, done) {
4020
+
4021
+ findUser$1({ email: email, password: password }).then(function (user) {
4022
+ done(null, user);
4023
+ }).catch(function (error) {
4024
+ done(error);
4025
+ });
4026
+ });
4027
+
4028
+ var passportLocal = /*#__PURE__*/Object.freeze({
4029
+ __proto__: null,
4030
+ localStrategy: localStrategy
4031
+ });
4032
+
4033
+ var _this$4 = undefined;
4034
+
4035
+ var config$1 = {
4036
+ host: 'sanity-datasource.cluster-crao688bsrdh.us-east-1.rds.amazonaws.com',
4037
+ user: 'nasp',
4038
+ password: 'uRNkF9SkfXQs6AKK',
4039
+ database: 'user'
4040
+ };
4041
+
4042
+ var getOccupation = function () {
4043
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(type) {
4044
+ var db$1, query, result;
4045
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
4046
+ while (1) {
4047
+ switch (_context.prev = _context.next) {
4048
+ case 0:
4049
+ db$1 = db(config$1);
4050
+ query = '\n select name as label, id as value\n from occupation\n where type = ?\n ';
4051
+ _context.next = 4;
4052
+ return db$1.query(query, [type]);
4053
+
4054
+ case 4:
4055
+ result = _context.sent;
4056
+ _context.next = 7;
4057
+ return db$1.close();
4058
+
4059
+ case 7:
4060
+ return _context.abrupt('return', result);
4061
+
4062
+ case 8:
4063
+ case 'end':
4064
+ return _context.stop();
4065
+ }
4066
+ }
4067
+ }, _callee, _this$4);
4068
+ }));
4069
+
4070
+ return function getOccupation(_x) {
4071
+ return _ref.apply(this, arguments);
4072
+ };
4073
+ }();
4074
+
4075
+ var getFieldsAndOptions = function () {
4076
+ var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(occupation) {
4077
+ var db$1, query, result, i, field, optionQuery, options;
4078
+ return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
4079
+ while (1) {
4080
+ switch (_context2.prev = _context2.next) {
4081
+ case 0:
4082
+ db$1 = db(config$1);
4083
+ query = '\n select * \n from field\n where occupation_id = ?\n order by sorting\n ';
4084
+ _context2.next = 4;
4085
+ return db$1.query(query, [occupation]);
4086
+
4087
+ case 4:
4088
+ result = _context2.sent;
4089
+ i = 0;
4090
+
4091
+ case 6:
4092
+ if (!(i < result.length)) {
4093
+ _context2.next = 17;
4094
+ break;
4095
+ }
4096
+
4097
+ field = result[i];
4098
+
4099
+ if (!(field.type === 'select')) {
4100
+ _context2.next = 14;
4101
+ break;
4102
+ }
4103
+
4104
+ optionQuery = '\n select * \n from options\n where list_id = ?\n order by sorting\n ';
4105
+ _context2.next = 12;
4106
+ return db$1.query(optionQuery, [field.list_id]);
4107
+
4108
+ case 12:
4109
+ options = _context2.sent;
4110
+
4111
+ field.options = options ? options : [];
4112
+
4113
+ case 14:
4114
+ i++;
4115
+ _context2.next = 6;
4116
+ break;
4117
+
4118
+ case 17:
4119
+ _context2.next = 19;
4120
+ return db$1.close();
4121
+
4122
+ case 19:
4123
+ return _context2.abrupt('return', result);
4124
+
4125
+ case 20:
4126
+ case 'end':
4127
+ return _context2.stop();
4128
+ }
4129
+ }
4130
+ }, _callee2, _this$4);
4131
+ }));
4132
+
4133
+ return function getFieldsAndOptions(_x2) {
4134
+ return _ref2.apply(this, arguments);
4135
+ };
4136
+ }();
4137
+
4138
+ var ProcessData = (function () {
4139
+ var _ref3 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee3(req, res) {
4140
+ var action, data, type, occupation;
4141
+ return asyncToGenerator.regenerator.wrap(function _callee3$(_context3) {
4142
+ while (1) {
4143
+ switch (_context3.prev = _context3.next) {
4144
+ case 0:
4145
+ _context3.prev = 0;
4146
+ action = req.body.action;
4147
+ data = null;
4148
+ _context3.t0 = action;
4149
+ _context3.next = _context3.t0 === 'get-occupation' ? 6 : _context3.t0 === 'get-fields' ? 11 : 16;
4150
+ break;
4151
+
4152
+ case 6:
4153
+ type = req.body.type;
4154
+ _context3.next = 9;
4155
+ return getOccupation(type);
4156
+
4157
+ case 9:
4158
+ data = _context3.sent;
4159
+ return _context3.abrupt('break', 17);
4160
+
4161
+ case 11:
4162
+ occupation = req.body.occupation;
4163
+ _context3.next = 14;
4164
+ return getFieldsAndOptions(occupation);
4165
+
4166
+ case 14:
4167
+ data = _context3.sent;
4168
+ return _context3.abrupt('break', 17);
4169
+
4170
+ case 16:
4171
+ throw new Error('Invalid action: ' + action);
4172
+
4173
+ case 17:
4174
+ return _context3.abrupt('return', res.json({
4175
+ error: '',
4176
+ data: data
4177
+ }));
4178
+
4179
+ case 20:
4180
+ _context3.prev = 20;
4181
+ _context3.t1 = _context3['catch'](0);
4182
+ return _context3.abrupt('return', res.json({
4183
+ error: _context3.t1.message,
4184
+ data: null
4185
+ }));
4186
+
4187
+ case 23:
4188
+ case 'end':
4189
+ return _context3.stop();
4190
+ }
4191
+ }
4192
+ }, _callee3, this, [[0, 20]]);
4193
+ }));
4194
+
4195
+ return function (_x3, _x4) {
4196
+ return _ref3.apply(this, arguments);
4197
+ };
4198
+ })();
4199
+
4200
+ var LoginForm_1 = LoginForm;
4201
+ var SignupForm_1 = SignupForm;
4202
+ var ProfileForm_1 = SignupForm$1;
4203
+ var AuthCookies_1 = authCookies;
4204
+ var AuthHooks_1 = hooks;
4205
+ var Iron_1 = iron;
4206
+ var PassportLocal_1 = passportLocal;
4207
+ var User_1 = user;
4208
+ var ProcessData_1 = ProcessData;
4209
+
4210
+ var auth = {
4211
+ LoginForm: LoginForm_1,
4212
+ SignupForm: SignupForm_1,
4213
+ ProfileForm: ProfileForm_1,
4214
+ AuthCookies: AuthCookies_1,
4215
+ AuthHooks: AuthHooks_1,
4216
+ Iron: Iron_1,
4217
+ PassportLocal: PassportLocal_1,
4218
+ User: User_1,
4219
+ ProcessData: ProcessData_1
4220
+ };
4221
+
4222
+ exports.AuthCookies = AuthCookies_1;
4223
+ exports.AuthHooks = AuthHooks_1;
4224
+ exports.Iron = Iron_1;
4225
+ exports.LoginForm = LoginForm_1;
4226
+ exports.PassportLocal = PassportLocal_1;
4227
+ exports.ProcessData = ProcessData_1;
4228
+ exports.ProfileForm = ProfileForm_1;
4229
+ exports.SignupForm = SignupForm_1;
4230
+ exports.User = User_1;
4231
+ exports.default = auth;