@mjhls/mjh-framework 1.0.296 → 1.0.298

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 (30) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/{ADInfeed-824fcfb6.js → ADInfeed-6b94763a.js} +1 -1
  3. package/dist/cjs/{AdSlot-405b39eb.js → AdSlot-29aee917.js} +124 -62
  4. package/dist/cjs/DeckContent.js +3 -3
  5. package/dist/cjs/{Dfp-f75c65fd.js → Dfp-f871551d.js} +1 -1
  6. package/dist/cjs/{Figure-0681dd7d.js → Figure-434da9bb.js} +1 -1
  7. package/dist/cjs/{GridContent-929798bf.js → GridContent-380b5f9c.js} +2 -2
  8. package/dist/cjs/GridContent.js +4 -4
  9. package/dist/cjs/{Normal-d3a56ac1.js → Normal-71e6f75e.js} +86 -76
  10. package/dist/cjs/QueueDeckExpanded.js +3 -3
  11. package/dist/cjs/TemplateNormal.js +3 -3
  12. package/dist/cjs/{Ustream-85b14a8d.js → Ustream-3a3c56b8.js} +1 -1
  13. package/dist/cjs/Ustream.js +2 -2
  14. package/dist/cjs/index.js +3964 -10
  15. package/dist/cjs/{slicedToArray-e38fb29d.js → slicedToArray-bed4d943.js} +2 -1
  16. package/dist/esm/{ADInfeed-a1d8cb44.js → ADInfeed-94f767ec.js} +1 -1
  17. package/dist/esm/{AdSlot-b4f04c96.js → AdSlot-3d2ecc87.js} +125 -63
  18. package/dist/esm/DeckContent.js +3 -3
  19. package/dist/esm/{Dfp-ea8d4531.js → Dfp-d2d43384.js} +1 -1
  20. package/dist/esm/{Figure-cff72982.js → Figure-d0f95cc0.js} +1 -1
  21. package/dist/esm/{GridContent-862176ac.js → GridContent-7ea9958c.js} +2 -2
  22. package/dist/esm/GridContent.js +4 -4
  23. package/dist/esm/{Normal-4180d06d.js → Normal-46a7df31.js} +86 -76
  24. package/dist/esm/QueueDeckExpanded.js +3 -3
  25. package/dist/esm/TemplateNormal.js +3 -3
  26. package/dist/esm/{Ustream-d51b9b11.js → Ustream-c153a835.js} +1 -1
  27. package/dist/esm/Ustream.js +2 -2
  28. package/dist/esm/index.js +3968 -15
  29. package/dist/esm/{slicedToArray-d0a9593a.js → slicedToArray-d1db3163.js} +2 -2
  30. package/package.json +2 -1
package/dist/cjs/index.js CHANGED
@@ -28,13 +28,13 @@ require('react-dom');
28
28
  var index = require('./index-39beccb3.js');
29
29
  require('./index-fa0fb52c.js');
30
30
  var entities = require('./entities-310b46ee.js');
31
- var slicedToArray = require('./slicedToArray-e38fb29d.js');
32
- var AdSlot = require('./AdSlot-405b39eb.js');
31
+ var slicedToArray = require('./slicedToArray-bed4d943.js');
32
+ var AdSlot = require('./AdSlot-29aee917.js');
33
33
  require('./promise-2c453658.js');
34
- require('./ADInfeed-824fcfb6.js');
34
+ require('./ADInfeed-6b94763a.js');
35
35
  var DeckContent = require('./DeckContent.js');
36
36
  var get$1 = require('./get-de2660c3.js');
37
- var GridContent = require('./GridContent-929798bf.js');
37
+ var GridContent = require('./GridContent-380b5f9c.js');
38
38
  var DeckQueue = require('./DeckQueue.js');
39
39
  require('react-bootstrap/Media');
40
40
  var ThumbnailCard = require('./ThumbnailCard.js');
@@ -53,7 +53,7 @@ var IssueDeck = require('./IssueDeck.js');
53
53
  require('react-bootstrap/Badge');
54
54
  var IssueContentDeck = require('./IssueContentDeck.js');
55
55
  var Spinner = _interopDefault(require('react-bootstrap/Spinner'));
56
- var TemplateNormal = require('./Normal-d3a56ac1.js');
56
+ var TemplateNormal = require('./Normal-71e6f75e.js');
57
57
  require('react-bootstrap/ListGroup');
58
58
  var Head = _interopDefault(require('next/head'));
59
59
  var Accordion = _interopDefault(require('react-bootstrap/Accordion'));
@@ -70,7 +70,11 @@ var Carousel = _interopDefault(require('react-bootstrap/Carousel'));
70
70
  var Breadcrumb = _interopDefault(require('react-bootstrap/Breadcrumb'));
71
71
  var DropdownButton = _interopDefault(require('react-bootstrap/DropdownButton'));
72
72
  var Dropdown = _interopDefault(require('react-bootstrap/Dropdown'));
73
- var Ustream = require('./Ustream-85b14a8d.js');
73
+ var Ustream = require('./Ustream-3a3c56b8.js');
74
+ var useSWR = _interopDefault(require('swr'));
75
+ var Iron = _interopDefault(require('@hapi/iron'));
76
+ var Local = _interopDefault(require('passport-local'));
77
+ var mysql = _interopDefault(require('mysql'));
74
78
 
75
79
  var momentTimezone = _commonjsHelpers.createCommonjsModule(function (module) {
76
80
  //! moment-timezone.js
@@ -6488,7 +6492,7 @@ DocumentFragment.prototype.toString =
6488
6492
  }).join("")
6489
6493
  };
6490
6494
 
6491
- var event = Event$1;
6495
+ var event$1 = Event$1;
6492
6496
 
6493
6497
  function Event$1(family) {}
6494
6498
 
@@ -6537,7 +6541,7 @@ proto.createDocumentFragment = function createDocumentFragment() {
6537
6541
  };
6538
6542
 
6539
6543
  proto.createEvent = function createEvent(family) {
6540
- return new event(family)
6544
+ return new event$1(family)
6541
6545
  };
6542
6546
 
6543
6547
  proto.createComment = function createComment(data) {
@@ -13553,7 +13557,7 @@ var NativeAd = function NativeAd(props) {
13553
13557
  };
13554
13558
 
13555
13559
  var Figure = dynamic(function () {
13556
- return new Promise(function (resolve) { resolve(require('./Figure-0681dd7d.js')); });
13560
+ return new Promise(function (resolve) { resolve(require('./Figure-434da9bb.js')); });
13557
13561
  }, { ssr: false });
13558
13562
 
13559
13563
  var checkUrlIsExternal = function checkUrlIsExternal(url) {
@@ -14940,7 +14944,7 @@ var YahooHero = function YahooHero(props) {
14940
14944
  React__default.createElement(
14941
14945
  'style',
14942
14946
  { jsx: 'true' },
14943
- '\n .yh-top-article {\n display: flex;\n flex-direction: row;\n position: relative;\n font-family: \'Roboto\', sans-serif;\n margin-bottom: 1rem;\n border-radius: 15px;\n overflow: hidden;\n min-height: 315px;\n }\n .yh-top-article--img {\n width: 100%;\n min-height: 240px;\n overflow: hidden;\n }\n .yh-top-article--img img {\n width: 100%;\n height: auto;\n min-height: 100%;\n max-height: 315px;\n object-fit: cover;\n }\n .yh-top-article--body {\n height: 100%;\n width: 40%;\n min-width: 320px;\n right: 0;\n position: absolute;\n color: white;\n padding: 1.75rem;\n height: 315px;\n display: flex;\n align-items: flex-start;\n justify-content: center;\n flex-direction: column;\n }\n .yh-top-article--body h1 {\n color: white!important;\n font-size: 1.4rem;\n font-weight: 500;\n margin-bottom: 0.5rem;\n }\n .yh-top-article--body p {\n font-size: 0.9rem;\n margin-bottom: 0.5rem;\n }\n .yh-top-article--blur {\n height: 100%;\n width: 40%;\n right: 0;\n position: absolute;\n filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));\n background: rgba(0,0,0,.65);\n min-width: 320px;\n }\n .yh-sub-article-container {\n display: flex;\n justify-content: space-between;\n }\n .yh-sub-article {\n width: 23.25%;\n }\n .yh-sub-article p.yh-sub-article--title {\n font-weight: bold;\n }\n .yh-sub-article img {\n width: 100%;\n height: 150px;\n object-fit: cover;\n border-radius: 15px;\n }\n .yh-sub-article img[src=\'' + props.thumbnail + '\']{\n object-fit: contain;\n }\n .yh-sub-article--title {\n font-weight: bold;\n margin-top: .25rem;\n font-size: 1rem;\n margin-bottom: .25rem;\n }\n .yh-sub-article--info {\n font-size: .8rem;\n margin-bottom: 0;\n\n }\n @media screen and (max-width: 968px) {\n .yh-sub-article-container {\n flex-wrap: wrap;\n }\n .yh-sub-article {\n width: 48%;\n margin-bottom: 1rem;\n }\n }\n '
14947
+ '\n .yh-top-article {\n display: flex;\n flex-direction: row;\n position: relative;\n font-family: Roboto, sans-serif;\n margin-bottom: 1rem;\n border-radius: 15px;\n overflow: hidden;\n min-height: 315px;\n }\n .yh-top-article--img {\n width: 100%;\n min-height: 240px;\n overflow: hidden;\n }\n .yh-top-article--img img {\n width: 100%;\n height: auto;\n min-height: 100%;\n max-height: 315px;\n object-fit: cover;\n }\n .yh-top-article--body {\n height: 100%;\n width: 40%;\n min-width: 320px;\n right: 0;\n position: absolute;\n color: white;\n padding: 1.75rem;\n height: 315px;\n display: flex;\n align-items: flex-start;\n justify-content: center;\n flex-direction: column;\n }\n .yh-top-article--body h1 {\n color: white!important;\n font-size: 1.4rem;\n font-weight: 500;\n margin-bottom: 0.5rem;\n }\n .yh-top-article--body p {\n font-size: 0.9rem;\n margin-bottom: 0.5rem;\n }\n .yh-top-article--blur {\n height: 100%;\n width: 40%;\n right: 0;\n position: absolute;\n filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));\n background: rgba(0,0,0,.65);\n min-width: 320px;\n }\n .yh-sub-article-container {\n display: flex;\n justify-content: space-between;\n }\n .yh-sub-article {\n width: 23.25%;\n }\n .yh-sub-article p.yh-sub-article--title {\n font-weight: bold;\n }\n .yh-sub-article img {\n width: 100%;\n height: 150px;\n object-fit: cover;\n border-radius: 15px;\n }\n .yh-sub-article img[src=\'' + props.thumbnail + '\']{\n object-fit: contain;\n }\n .yh-sub-article--title {\n font-weight: bold;\n margin-top: .25rem;\n font-size: 1rem;\n margin-bottom: .25rem;\n }\n .yh-sub-article--info {\n font-size: .8rem;\n margin-bottom: 0;\n\n }\n @media screen and (max-width: 968px) {\n .yh-sub-article-container {\n flex-wrap: wrap;\n }\n .yh-sub-article {\n width: 48%;\n margin-bottom: 1rem;\n }\n }\n '
14944
14948
  )
14945
14949
  );
14946
14950
  };
@@ -16655,6 +16659,3955 @@ var KMTracker = function KMTracker(props) {
16655
16659
  }
16656
16660
  };
16657
16661
 
16662
+ var returnFormField = function returnFormField(_ref) {
16663
+ var name = _ref.name,
16664
+ label = _ref.label,
16665
+ type = _ref.type,
16666
+ _ref$required = _ref.required,
16667
+ required = _ref$required === undefined ? false : _ref$required,
16668
+ _ref$readonly = _ref.readonly,
16669
+ readonly = _ref$readonly === undefined ? false : _ref$readonly,
16670
+ _ref$options = _ref.options,
16671
+ options = _ref$options === undefined ? null : _ref$options,
16672
+ _ref$groupType = _ref.groupType,
16673
+ groupType = _ref$groupType === undefined ? '' : _ref$groupType,
16674
+ _ref$errors = _ref.errors,
16675
+ errors = _ref$errors === undefined ? {} : _ref$errors,
16676
+ _ref$handleChanged = _ref.handleChanged,
16677
+ handleChanged = _ref$handleChanged === undefined ? null : _ref$handleChanged,
16678
+ _ref$default_value = _ref.default_value,
16679
+ default_value = _ref$default_value === undefined ? null : _ref$default_value;
16680
+
16681
+ var opts = [];
16682
+ if (groupType) {
16683
+ opts['as'] = groupType;
16684
+ if (groupType === reactBootstrap.Col) {
16685
+ opts['xs'] = 12;
16686
+ opts['md'] = 6;
16687
+ }
16688
+ }
16689
+
16690
+ if (handleChanged) {
16691
+ opts['onChange'] = handleChanged;
16692
+ }
16693
+
16694
+ if (readonly) {
16695
+ opts['readOnly'] = readonly;
16696
+ }
16697
+
16698
+ if (type == 'text' || type == 'email' || type == 'password' || type == 'number') {
16699
+ return React__default.createElement(
16700
+ reactBootstrap.Form.Group,
16701
+ _extends$2._extends({}, opts, { controlId: name }),
16702
+ React__default.createElement(
16703
+ reactBootstrap.Form.Label,
16704
+ { kye: name + '_label' },
16705
+ label,
16706
+ required && React__default.createElement(
16707
+ 'span',
16708
+ { style: { color: 'red' } },
16709
+ '*'
16710
+ )
16711
+ ),
16712
+ React__default.createElement(reactBootstrap.Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
16713
+ React__default.createElement(
16714
+ reactBootstrap.Form.Control.Feedback,
16715
+ { key: name + '_feedback', type: 'invalid' },
16716
+ errors[name]
16717
+ )
16718
+ );
16719
+ }
16720
+ if (type == 'select') {
16721
+ return React__default.createElement(
16722
+ reactBootstrap.Form.Group,
16723
+ _extends$2._extends({}, opts, { key: name, controlId: name }),
16724
+ React__default.createElement(
16725
+ reactBootstrap.Form.Label,
16726
+ { key: name + '_' + label },
16727
+ label,
16728
+ required && React__default.createElement(
16729
+ 'span',
16730
+ { key: name + '_required_span', style: { color: 'red' } },
16731
+ '*'
16732
+ )
16733
+ ),
16734
+ React__default.createElement(
16735
+ reactBootstrap.Form.Control,
16736
+ { key: name + '_select', as: 'select', name: name, required: required, defaultValue: default_value },
16737
+ React__default.createElement('option', { value: '', key: name + '_options_empty' }),
16738
+ options.map(function (option, index) {
16739
+ var value = option.value ? option.value : option;
16740
+ var label = option.label ? option.label : option;
16741
+ var key = name + '_options_' + index;
16742
+ return React__default.createElement(
16743
+ 'option',
16744
+ { key: key, value: value },
16745
+ label
16746
+ );
16747
+ })
16748
+ )
16749
+ );
16750
+ }
16751
+
16752
+ if (type == 'radio' || type == 'checkbox') {
16753
+ return React__default.createElement(
16754
+ reactBootstrap.Form.Group,
16755
+ opts,
16756
+ React__default.createElement(
16757
+ reactBootstrap.Form.Label,
16758
+ null,
16759
+ label,
16760
+ required && React__default.createElement(
16761
+ 'span',
16762
+ { style: { color: 'red' } },
16763
+ '*'
16764
+ )
16765
+ ),
16766
+ options.map(function (option, index) {
16767
+ return React__default.createElement(
16768
+ reactBootstrap.Form.Check,
16769
+ { type: type, key: index, required: required },
16770
+ React__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 }),
16771
+ React__default.createElement(reactBootstrap.Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
16772
+ );
16773
+ })
16774
+ );
16775
+ }
16776
+ };
16777
+
16778
+ var _this = undefined;
16779
+
16780
+ var dataHandler = function () {
16781
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee(api_url, body) {
16782
+ var res, result;
16783
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
16784
+ while (1) {
16785
+ switch (_context.prev = _context.next) {
16786
+ case 0:
16787
+ _context.prev = 0;
16788
+ _context.next = 3;
16789
+ return fetch(api_url, {
16790
+ method: 'POST',
16791
+ headers: { 'Content-Type': 'application/json' },
16792
+ body: AdSlot._JSON$stringify(body)
16793
+ });
16794
+
16795
+ case 3:
16796
+ res = _context.sent;
16797
+
16798
+ if (!(res.status === 200)) {
16799
+ _context.next = 13;
16800
+ break;
16801
+ }
16802
+
16803
+ _context.next = 7;
16804
+ return res.json();
16805
+
16806
+ case 7:
16807
+ result = _context.sent;
16808
+
16809
+ if (!result.error) {
16810
+ _context.next = 10;
16811
+ break;
16812
+ }
16813
+
16814
+ throw new Error(result.error);
16815
+
16816
+ case 10:
16817
+ return _context.abrupt('return', result.data);
16818
+
16819
+ case 13:
16820
+ _context.t0 = Error;
16821
+ _context.next = 16;
16822
+ return res.text();
16823
+
16824
+ case 16:
16825
+ _context.t1 = _context.sent;
16826
+ throw new _context.t0(_context.t1);
16827
+
16828
+ case 18:
16829
+ _context.next = 24;
16830
+ break;
16831
+
16832
+ case 20:
16833
+ _context.prev = 20;
16834
+ _context.t2 = _context['catch'](0);
16835
+
16836
+ console.error('data handler failed : ' + api_url, _context.t2);
16837
+ return _context.abrupt('return', null);
16838
+
16839
+ case 24:
16840
+ case 'end':
16841
+ return _context.stop();
16842
+ }
16843
+ }
16844
+ }, _callee, _this, [[0, 20]]);
16845
+ }));
16846
+
16847
+ return function dataHandler(_x, _x2) {
16848
+ return _ref.apply(this, arguments);
16849
+ };
16850
+ }();
16851
+
16852
+ function useUser() {
16853
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16854
+ redirectTo = _ref.redirectTo,
16855
+ redirectIfFound = _ref.redirectIfFound;
16856
+
16857
+ var _useSWR = useSWR('/api/auth/user', dataHandler),
16858
+ data = _useSWR.data,
16859
+ error = _useSWR.error;
16860
+
16861
+ var user = data;
16862
+ var finished = Boolean(data);
16863
+ var hasUser = Boolean(user);
16864
+
16865
+ React.useEffect(function () {
16866
+ if (!redirectTo || !finished) return;
16867
+ if (
16868
+ // If redirectTo is set, redirect if the user was not found.
16869
+ redirectTo && !redirectIfFound && !hasUser ||
16870
+ // If redirectIfFound is also set, redirect if the user was found
16871
+ redirectIfFound && hasUser) {
16872
+ Router__default.push(redirectTo);
16873
+ }
16874
+ }, [redirectTo, redirectIfFound, finished, hasUser]);
16875
+
16876
+ return error ? null : user;
16877
+ }
16878
+
16879
+ var hooks = /*#__PURE__*/Object.freeze({
16880
+ __proto__: null,
16881
+ useUser: useUser
16882
+ });
16883
+
16884
+ var LoginForm = function LoginForm(props) {
16885
+ var handleSubmit = function () {
16886
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee(e) {
16887
+ var body, res;
16888
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
16889
+ while (1) {
16890
+ switch (_context.prev = _context.next) {
16891
+ case 0:
16892
+ event.preventDefault();
16893
+
16894
+ if (errorMsg) setErrorMsg('');
16895
+ setLoading(true);
16896
+
16897
+ body = {
16898
+ email: e.currentTarget.email.value,
16899
+ password: e.currentTarget.password.value
16900
+ };
16901
+ _context.prev = 4;
16902
+ _context.next = 7;
16903
+ return fetch('/api/auth/login', {
16904
+ method: 'POST',
16905
+ headers: { 'Content-Type': 'application/json' },
16906
+ body: AdSlot._JSON$stringify(body)
16907
+ });
16908
+
16909
+ case 7:
16910
+ res = _context.sent;
16911
+
16912
+ setLoading(false);
16913
+
16914
+ if (!(res.status === 200)) {
16915
+ _context.next = 13;
16916
+ break;
16917
+ }
16918
+
16919
+ // here, Router.push() does not carry new cookie value.
16920
+ // so need hard redirect
16921
+ window.location.href = '/';
16922
+ _context.next = 18;
16923
+ break;
16924
+
16925
+ case 13:
16926
+ _context.t0 = Error;
16927
+ _context.next = 16;
16928
+ return res.text();
16929
+
16930
+ case 16:
16931
+ _context.t1 = _context.sent;
16932
+ throw new _context.t0(_context.t1);
16933
+
16934
+ case 18:
16935
+ _context.next = 23;
16936
+ break;
16937
+
16938
+ case 20:
16939
+ _context.prev = 20;
16940
+ _context.t2 = _context['catch'](4);
16941
+
16942
+ setErrorMsg(_context.t2.message);
16943
+
16944
+ case 23:
16945
+ case 'end':
16946
+ return _context.stop();
16947
+ }
16948
+ }
16949
+ }, _callee, this, [[4, 20]]);
16950
+ }));
16951
+
16952
+ return function handleSubmit(_x) {
16953
+ return _ref.apply(this, arguments);
16954
+ };
16955
+ }();
16956
+
16957
+ React.useEffect(function () {
16958
+ if (props.user) {
16959
+ window.location.href = '/auth/profile';
16960
+ }
16961
+ }, []);
16962
+ useUser('/auth/profile', true);
16963
+
16964
+ var _useState = React.useState(''),
16965
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
16966
+ errorMsg = _useState2[0],
16967
+ setErrorMsg = _useState2[1];
16968
+
16969
+ var _useState3 = React.useState(false),
16970
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
16971
+ loading = _useState4[0],
16972
+ setLoading = _useState4[1];
16973
+
16974
+ return React__default.createElement(
16975
+ reactBootstrap.Form,
16976
+ { className: 'login', onSubmit: handleSubmit },
16977
+ React__default.createElement(
16978
+ 'h1',
16979
+ null,
16980
+ 'Login'
16981
+ ),
16982
+ React__default.createElement('hr', null),
16983
+ returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
16984
+ returnFormField({ name: 'password', label: 'Password', type: 'password', required: true }),
16985
+ React__default.createElement('hr', null),
16986
+ React__default.createElement(
16987
+ reactBootstrap.Form.Row,
16988
+ null,
16989
+ React__default.createElement(
16990
+ reactBootstrap.Form.Group,
16991
+ { as: reactBootstrap.Col },
16992
+ React__default.createElement(
16993
+ 'a',
16994
+ { href: '/auth/signup' },
16995
+ 'I don\'t have an account'
16996
+ )
16997
+ ),
16998
+ React__default.createElement(
16999
+ reactBootstrap.Form.Group,
17000
+ { as: reactBootstrap.Col, className: 'text-right' },
17001
+ !loading && React__default.createElement(
17002
+ reactBootstrap.Button,
17003
+ { type: 'submit' },
17004
+ 'Login'
17005
+ ),
17006
+ loading && React__default.createElement(
17007
+ reactBootstrap.Button,
17008
+ { variant: 'primary', disabled: true },
17009
+ React__default.createElement(reactBootstrap.Spinner, {
17010
+ as: 'span',
17011
+ animation: 'border',
17012
+ role: 'status',
17013
+ 'aria-hidden': 'true',
17014
+ size: 'sm'
17015
+ }),
17016
+ React__default.createElement(
17017
+ 'span',
17018
+ { className: 'sr-only' },
17019
+ 'Loading...'
17020
+ )
17021
+ )
17022
+ )
17023
+ ),
17024
+ errorMsg && React__default.createElement(
17025
+ 'p',
17026
+ { className: 'error' },
17027
+ errorMsg
17028
+ ),
17029
+ React__default.createElement(
17030
+ 'style',
17031
+ { jsx: 'true'.toString() },
17032
+ ' \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 '
17033
+ )
17034
+ );
17035
+ };
17036
+
17037
+ // get country & state options
17038
+ var countries$1 = ["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"];
17039
+
17040
+ 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'];
17041
+
17042
+ var _this$1 = undefined;
17043
+
17044
+ var SignupForm = function SignupForm(props) {
17045
+ var handleSubmit = function () {
17046
+ var _ref3 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee3(e) {
17047
+ var formData, body, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, key, res;
17048
+
17049
+ return AdSlot.regenerator.wrap(function _callee3$(_context3) {
17050
+ while (1) {
17051
+ switch (_context3.prev = _context3.next) {
17052
+ case 0:
17053
+ event.preventDefault();
17054
+ setLoading(true);
17055
+ if (errorMsg) setErrorMsg('');
17056
+
17057
+ formData = new FormData(e.currentTarget);
17058
+ body = {};
17059
+ _iteratorNormalCompletion = true;
17060
+ _didIteratorError = false;
17061
+ _iteratorError = undefined;
17062
+ _context3.prev = 8;
17063
+
17064
+ for (_iterator = slicedToArray._getIterator(formData.keys()); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
17065
+ key = _step.value;
17066
+
17067
+ body[key] = formData.get(key);
17068
+ }
17069
+
17070
+ _context3.next = 16;
17071
+ break;
17072
+
17073
+ case 12:
17074
+ _context3.prev = 12;
17075
+ _context3.t0 = _context3['catch'](8);
17076
+ _didIteratorError = true;
17077
+ _iteratorError = _context3.t0;
17078
+
17079
+ case 16:
17080
+ _context3.prev = 16;
17081
+ _context3.prev = 17;
17082
+
17083
+ if (!_iteratorNormalCompletion && _iterator.return) {
17084
+ _iterator.return();
17085
+ }
17086
+
17087
+ case 19:
17088
+ _context3.prev = 19;
17089
+
17090
+ if (!_didIteratorError) {
17091
+ _context3.next = 22;
17092
+ break;
17093
+ }
17094
+
17095
+ throw _iteratorError;
17096
+
17097
+ case 22:
17098
+ return _context3.finish(19);
17099
+
17100
+ case 23:
17101
+ return _context3.finish(16);
17102
+
17103
+ case 24:
17104
+ _context3.prev = 24;
17105
+ _context3.next = 27;
17106
+ return fetch('/api/auth/signup', {
17107
+ method: 'POST',
17108
+ headers: { 'Content-Type': 'application/json' },
17109
+ body: AdSlot._JSON$stringify(body)
17110
+ });
17111
+
17112
+ case 27:
17113
+ res = _context3.sent;
17114
+
17115
+ setLoading(false);
17116
+
17117
+ if (!(res.status === 200)) {
17118
+ _context3.next = 33;
17119
+ break;
17120
+ }
17121
+
17122
+ window.location.href = '/auth/login';
17123
+ _context3.next = 38;
17124
+ break;
17125
+
17126
+ case 33:
17127
+ _context3.t1 = Error;
17128
+ _context3.next = 36;
17129
+ return res.text();
17130
+
17131
+ case 36:
17132
+ _context3.t2 = _context3.sent;
17133
+ throw new _context3.t1(_context3.t2);
17134
+
17135
+ case 38:
17136
+ _context3.next = 43;
17137
+ break;
17138
+
17139
+ case 40:
17140
+ _context3.prev = 40;
17141
+ _context3.t3 = _context3['catch'](24);
17142
+
17143
+ setErrorMsg(_context3.t3.message);
17144
+
17145
+ case 43:
17146
+ case 'end':
17147
+ return _context3.stop();
17148
+ }
17149
+ }
17150
+ }, _callee3, this, [[8, 12, 16, 24], [17,, 19, 23], [24, 40]]);
17151
+ }));
17152
+
17153
+ return function handleSubmit(_x2) {
17154
+ return _ref3.apply(this, arguments);
17155
+ };
17156
+ }();
17157
+
17158
+ var _useState = React.useState(''),
17159
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
17160
+ errorMsg = _useState2[0],
17161
+ setErrorMsg = _useState2[1];
17162
+
17163
+ var _useState3 = React.useState(false),
17164
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
17165
+ countryUS = _useState4[0],
17166
+ setCountryUS = _useState4[1];
17167
+
17168
+ var _useState5 = React.useState([]),
17169
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
17170
+ healthcareOccupation = _useState6[0],
17171
+ setHealthcareOccupation = _useState6[1];
17172
+
17173
+ var _useState7 = React.useState([]),
17174
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
17175
+ nonHealthcareOccupation = _useState8[0],
17176
+ setNonHealthcareOccupation = _useState8[1];
17177
+
17178
+ var loadInitData = function () {
17179
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee() {
17180
+ var healthcare_occupation, non_healthcare_occupation;
17181
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
17182
+ while (1) {
17183
+ switch (_context.prev = _context.next) {
17184
+ case 0:
17185
+ _context.next = 2;
17186
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Healthcare' });
17187
+
17188
+ case 2:
17189
+ healthcare_occupation = _context.sent;
17190
+ _context.next = 5;
17191
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Non-Healthcare' });
17192
+
17193
+ case 5:
17194
+ non_healthcare_occupation = _context.sent;
17195
+
17196
+
17197
+ setHealthcareOccupation(healthcare_occupation);
17198
+ setNonHealthcareOccupation(non_healthcare_occupation);
17199
+
17200
+ case 8:
17201
+ case 'end':
17202
+ return _context.stop();
17203
+ }
17204
+ }
17205
+ }, _callee, _this$1);
17206
+ }));
17207
+
17208
+ return function loadInitData() {
17209
+ return _ref.apply(this, arguments);
17210
+ };
17211
+ }();
17212
+
17213
+ React.useEffect(function () {
17214
+ if (props.user) {
17215
+ window.location.href = '/auth/profile';
17216
+ } else {
17217
+ loadInitData();
17218
+ }
17219
+ }, []);
17220
+
17221
+ // make it to change layout based on radio buton
17222
+ var handleCountryChanged = function handleCountryChanged(e) {
17223
+ if (e.target.value === 'United States') {
17224
+ setCountryUS(true);
17225
+ } else {
17226
+ setCountryUS(false);
17227
+ }
17228
+ };
17229
+
17230
+ var _useState9 = React.useState(true),
17231
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
17232
+ healcareProfessional = _useState10[0],
17233
+ setHealthcareProfessional = _useState10[1];
17234
+
17235
+ var handleHealthcareProfessionalChanged = function handleHealthcareProfessionalChanged(e) {
17236
+
17237
+ if (e.target.value === 'Y') {
17238
+ setHealthcareProfessional(true);
17239
+ } else {
17240
+ setHealthcareProfessional(false);
17241
+ }
17242
+ document.getElementById('occupation').value = '';
17243
+ setOccupationFields(null);
17244
+ };
17245
+
17246
+ var _useState11 = React.useState(null),
17247
+ _useState12 = slicedToArray._slicedToArray(_useState11, 2),
17248
+ occupationFields = _useState12[0],
17249
+ setOccupationFields = _useState12[1];
17250
+
17251
+ var handleOccupationChanged = function () {
17252
+ var _ref2 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee2(e) {
17253
+ var occupation, fields;
17254
+ return AdSlot.regenerator.wrap(function _callee2$(_context2) {
17255
+ while (1) {
17256
+ switch (_context2.prev = _context2.next) {
17257
+ case 0:
17258
+ occupation = e.target.value;
17259
+ _context2.next = 3;
17260
+ return dataHandler('/api/auth/data', { action: 'get-fields', occupation: occupation });
17261
+
17262
+ case 3:
17263
+ fields = _context2.sent;
17264
+
17265
+ setOccupationFields(fields);
17266
+
17267
+ case 5:
17268
+ case 'end':
17269
+ return _context2.stop();
17270
+ }
17271
+ }
17272
+ }, _callee2, _this$1);
17273
+ }));
17274
+
17275
+ return function handleOccupationChanged(_x) {
17276
+ return _ref2.apply(this, arguments);
17277
+ };
17278
+ }();
17279
+
17280
+ var _useState13 = React.useState(false),
17281
+ _useState14 = slicedToArray._slicedToArray(_useState13, 2),
17282
+ loading = _useState14[0],
17283
+ setLoading = _useState14[1];
17284
+
17285
+ return React__default.createElement(
17286
+ reactBootstrap.Form,
17287
+ { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
17288
+ React__default.createElement(
17289
+ 'h1',
17290
+ null,
17291
+ 'Sign Up'
17292
+ ),
17293
+ React__default.createElement('hr', null),
17294
+ returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
17295
+ React__default.createElement(
17296
+ reactBootstrap.Form.Row,
17297
+ null,
17298
+ returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: reactBootstrap.Col, required: true }),
17299
+ returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: reactBootstrap.Col, required: true })
17300
+ ),
17301
+ React__default.createElement(
17302
+ reactBootstrap.Form.Row,
17303
+ null,
17304
+ returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: reactBootstrap.Col, required: true }),
17305
+ returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: reactBootstrap.Col, required: true })
17306
+ ),
17307
+ React__default.createElement(
17308
+ reactBootstrap.Form.Row,
17309
+ null,
17310
+ returnFormField({
17311
+ name: 'country',
17312
+ label: 'Country',
17313
+ type: 'select',
17314
+ required: true,
17315
+ groupType: reactBootstrap.Col,
17316
+ options: countries$1,
17317
+ handleChanged: handleCountryChanged
17318
+ }),
17319
+ countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: reactBootstrap.Col, options: states })
17320
+ ),
17321
+ React__default.createElement(
17322
+ reactBootstrap.Form.Row,
17323
+ null,
17324
+ countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: reactBootstrap.Col }),
17325
+ countryUS && returnFormField({ name: 'phone', label: 'Phone', type: 'text', required: true, groupType: reactBootstrap.Col })
17326
+ ),
17327
+ returnFormField({
17328
+ name: 'healthcare_professional',
17329
+ label: 'Are You a Health Care Professional?',
17330
+ type: 'radio',
17331
+ required: true,
17332
+ options: [{ value: 'Y', label: 'Yes', checked: true }, { value: 'N', label: 'No', checked: false }],
17333
+ handleChanged: handleHealthcareProfessionalChanged,
17334
+ default_value: 'Y'
17335
+ }),
17336
+ healcareProfessional && returnFormField({
17337
+ name: 'occupation',
17338
+ label: 'Occupation',
17339
+ type: 'select',
17340
+ required: true,
17341
+ options: healthcareOccupation,
17342
+ handleChanged: handleOccupationChanged
17343
+ }),
17344
+ !healcareProfessional && returnFormField({
17345
+ name: 'occupation',
17346
+ label: 'Non Provider Role',
17347
+ type: 'select',
17348
+ required: true,
17349
+ options: nonHealthcareOccupation,
17350
+ handleChanged: handleOccupationChanged
17351
+ }),
17352
+ occupationFields && occupationFields.map(function (field) {
17353
+ return returnFormField({
17354
+ name: field.name,
17355
+ label: field.label,
17356
+ type: field.type,
17357
+ required: field.required === 1,
17358
+ options: field.options
17359
+ });
17360
+ }),
17361
+ returnFormField({
17362
+ name: 'agree',
17363
+ label: 'Terms & Conditions | Privacy Policy',
17364
+ type: 'checkbox',
17365
+ required: true,
17366
+ 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' }]
17367
+ }),
17368
+ React__default.createElement('hr', null),
17369
+ React__default.createElement(
17370
+ reactBootstrap.Form.Row,
17371
+ null,
17372
+ React__default.createElement(
17373
+ reactBootstrap.Form.Group,
17374
+ { as: reactBootstrap.Col },
17375
+ React__default.createElement(
17376
+ 'a',
17377
+ { href: '/auth/login' },
17378
+ 'I already have an account'
17379
+ )
17380
+ ),
17381
+ React__default.createElement(
17382
+ reactBootstrap.Form.Group,
17383
+ { as: reactBootstrap.Col, className: 'text-right' },
17384
+ !loading && React__default.createElement(
17385
+ reactBootstrap.Button,
17386
+ { type: 'submit' },
17387
+ 'Sign Up'
17388
+ ),
17389
+ loading && React__default.createElement(
17390
+ reactBootstrap.Button,
17391
+ { variant: 'primary', disabled: true },
17392
+ React__default.createElement(reactBootstrap.Spinner, {
17393
+ as: 'span',
17394
+ animation: 'border',
17395
+ role: 'status',
17396
+ 'aria-hidden': 'true',
17397
+ size: 'sm'
17398
+ }),
17399
+ React__default.createElement(
17400
+ 'span',
17401
+ { className: 'sr-only' },
17402
+ 'Loading...'
17403
+ )
17404
+ )
17405
+ )
17406
+ ),
17407
+ errorMsg && React__default.createElement(
17408
+ 'p',
17409
+ { className: 'error' },
17410
+ errorMsg
17411
+ ),
17412
+ React__default.createElement(
17413
+ 'style',
17414
+ { jsx: 'true'.toString() },
17415
+ ' \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 '
17416
+ )
17417
+ );
17418
+ };
17419
+
17420
+ var _this$2 = undefined;
17421
+
17422
+ var SignupForm$1 = function SignupForm(props) {
17423
+ var handleSubmit = function () {
17424
+ var _ref3 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee3(e) {
17425
+ var formData, body, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, key, res;
17426
+
17427
+ return AdSlot.regenerator.wrap(function _callee3$(_context3) {
17428
+ while (1) {
17429
+ switch (_context3.prev = _context3.next) {
17430
+ case 0:
17431
+ event.preventDefault();
17432
+
17433
+ setErrorMsg('');
17434
+ setSuccessMsg('');
17435
+ setLoading(true);
17436
+
17437
+ formData = new FormData(e.currentTarget);
17438
+ body = {};
17439
+ _iteratorNormalCompletion = true;
17440
+ _didIteratorError = false;
17441
+ _iteratorError = undefined;
17442
+ _context3.prev = 9;
17443
+
17444
+ for (_iterator = slicedToArray._getIterator(formData.keys()); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
17445
+ key = _step.value;
17446
+
17447
+ body[key] = formData.get(key);
17448
+ }
17449
+
17450
+ _context3.next = 17;
17451
+ break;
17452
+
17453
+ case 13:
17454
+ _context3.prev = 13;
17455
+ _context3.t0 = _context3['catch'](9);
17456
+ _didIteratorError = true;
17457
+ _iteratorError = _context3.t0;
17458
+
17459
+ case 17:
17460
+ _context3.prev = 17;
17461
+ _context3.prev = 18;
17462
+
17463
+ if (!_iteratorNormalCompletion && _iterator.return) {
17464
+ _iterator.return();
17465
+ }
17466
+
17467
+ case 20:
17468
+ _context3.prev = 20;
17469
+
17470
+ if (!_didIteratorError) {
17471
+ _context3.next = 23;
17472
+ break;
17473
+ }
17474
+
17475
+ throw _iteratorError;
17476
+
17477
+ case 23:
17478
+ return _context3.finish(20);
17479
+
17480
+ case 24:
17481
+ return _context3.finish(17);
17482
+
17483
+ case 25:
17484
+ body['user_id'] = userData.id;
17485
+
17486
+ _context3.prev = 26;
17487
+ _context3.next = 29;
17488
+ return fetch('/api/auth/profile', {
17489
+ method: 'POST',
17490
+ headers: { 'Content-Type': 'application/json' },
17491
+ body: AdSlot._JSON$stringify(body)
17492
+ });
17493
+
17494
+ case 29:
17495
+ res = _context3.sent;
17496
+
17497
+ setLoading(false);
17498
+
17499
+ if (!(res.status === 200)) {
17500
+ _context3.next = 35;
17501
+ break;
17502
+ }
17503
+
17504
+ setSuccessMsg('Your request has been processed successfully!');
17505
+ _context3.next = 40;
17506
+ break;
17507
+
17508
+ case 35:
17509
+ _context3.t1 = Error;
17510
+ _context3.next = 38;
17511
+ return res.text();
17512
+
17513
+ case 38:
17514
+ _context3.t2 = _context3.sent;
17515
+ throw new _context3.t1(_context3.t2);
17516
+
17517
+ case 40:
17518
+ _context3.next = 45;
17519
+ break;
17520
+
17521
+ case 42:
17522
+ _context3.prev = 42;
17523
+ _context3.t3 = _context3['catch'](26);
17524
+
17525
+ setErrorMsg(_context3.t3.message);
17526
+
17527
+ case 45:
17528
+ case 'end':
17529
+ return _context3.stop();
17530
+ }
17531
+ }
17532
+ }, _callee3, this, [[9, 13, 17, 25], [18,, 20, 24], [26, 42]]);
17533
+ }));
17534
+
17535
+ return function handleSubmit(_x2) {
17536
+ return _ref3.apply(this, arguments);
17537
+ };
17538
+ }();
17539
+
17540
+ var _useState = React.useState(''),
17541
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
17542
+ errorMsg = _useState2[0],
17543
+ setErrorMsg = _useState2[1];
17544
+
17545
+ var _useState3 = React.useState(false),
17546
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
17547
+ countryUS = _useState4[0],
17548
+ setCountryUS = _useState4[1];
17549
+
17550
+ var _useState5 = React.useState([]),
17551
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
17552
+ healthcareOccupation = _useState6[0],
17553
+ setHealthcareOccupation = _useState6[1];
17554
+
17555
+ var _useState7 = React.useState([]),
17556
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
17557
+ nonHealthcareOccupation = _useState8[0],
17558
+ setNonHealthcareOccupation = _useState8[1];
17559
+
17560
+ var _useState9 = React.useState(null),
17561
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
17562
+ userData = _useState10[0],
17563
+ setUserData = _useState10[1];
17564
+
17565
+ var user = props.user;
17566
+
17567
+ var loadInitData = function () {
17568
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee() {
17569
+ var healthcare_occupation, non_healthcare_occupation, foundOccupation, fields;
17570
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
17571
+ while (1) {
17572
+ switch (_context.prev = _context.next) {
17573
+ case 0:
17574
+ _context.next = 2;
17575
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Healthcare' });
17576
+
17577
+ case 2:
17578
+ healthcare_occupation = _context.sent;
17579
+ _context.next = 5;
17580
+ return dataHandler('/api/auth/data', { action: 'get-occupation', type: 'Non-Healthcare' });
17581
+
17582
+ case 5:
17583
+ non_healthcare_occupation = _context.sent;
17584
+ foundOccupation = healthcare_occupation.find(function (item) {
17585
+ return item.value === user.shared.occupation_id;
17586
+ });
17587
+
17588
+ if (foundOccupation) {
17589
+ user.shared.healthcare_professional = 'Y';
17590
+ } else {
17591
+ user.shared.healthcare_professional = 'N';
17592
+ }
17593
+
17594
+ setHealthcareOccupation(healthcare_occupation);
17595
+ setNonHealthcareOccupation(non_healthcare_occupation);
17596
+ setUserData(user);
17597
+
17598
+ if (user.shared.country === 'United States') {
17599
+ setCountryUS(true);
17600
+ } else {
17601
+ setCountryUS(false);
17602
+ }
17603
+
17604
+ _context.next = 14;
17605
+ return dataHandler('/api/auth/data', { action: 'get-fields', occupation: user.shared.occupation_id });
17606
+
17607
+ case 14:
17608
+ fields = _context.sent;
17609
+
17610
+ setOccupationFields(fields);
17611
+
17612
+ case 16:
17613
+ case 'end':
17614
+ return _context.stop();
17615
+ }
17616
+ }
17617
+ }, _callee, _this$2);
17618
+ }));
17619
+
17620
+ return function loadInitData() {
17621
+ return _ref.apply(this, arguments);
17622
+ };
17623
+ }();
17624
+
17625
+ React.useEffect(function () {
17626
+ if (!user) {
17627
+ window.location.href = '/auth/login';
17628
+ } else {
17629
+ loadInitData();
17630
+ }
17631
+ }, []);
17632
+
17633
+ // make it to change layout based on radio buton
17634
+ var handleCountryChanged = function handleCountryChanged(e) {
17635
+ if (e.target.value === 'United States') {
17636
+ setCountryUS(true);
17637
+ } else {
17638
+ setCountryUS(false);
17639
+ }
17640
+ };
17641
+
17642
+ var _useState11 = React.useState(true),
17643
+ _useState12 = slicedToArray._slicedToArray(_useState11, 2),
17644
+ healcareProfessional = _useState12[0],
17645
+ setHealthcareProfessional = _useState12[1];
17646
+
17647
+ var handleHealthcareProfessionalChanged = function handleHealthcareProfessionalChanged(e) {
17648
+
17649
+ if (e.target.value === 'Y') {
17650
+ setHealthcareProfessional(true);
17651
+ } else {
17652
+ setHealthcareProfessional(false);
17653
+ }
17654
+ document.getElementById('occupation').value = '';
17655
+ setOccupationFields(null);
17656
+ };
17657
+
17658
+ var _useState13 = React.useState(null),
17659
+ _useState14 = slicedToArray._slicedToArray(_useState13, 2),
17660
+ occupationFields = _useState14[0],
17661
+ setOccupationFields = _useState14[1];
17662
+
17663
+ var handleOccupationChanged = function () {
17664
+ var _ref2 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee2(e) {
17665
+ var occupation, fields;
17666
+ return AdSlot.regenerator.wrap(function _callee2$(_context2) {
17667
+ while (1) {
17668
+ switch (_context2.prev = _context2.next) {
17669
+ case 0:
17670
+ occupation = e.target.value;
17671
+ _context2.next = 3;
17672
+ return dataHandler('/api/auth/data', { action: 'get-fields', occupation: occupation });
17673
+
17674
+ case 3:
17675
+ fields = _context2.sent;
17676
+
17677
+ setOccupationFields(fields);
17678
+
17679
+ case 5:
17680
+ case 'end':
17681
+ return _context2.stop();
17682
+ }
17683
+ }
17684
+ }, _callee2, _this$2);
17685
+ }));
17686
+
17687
+ return function handleOccupationChanged(_x) {
17688
+ return _ref2.apply(this, arguments);
17689
+ };
17690
+ }();
17691
+
17692
+ var _useState15 = React.useState(''),
17693
+ _useState16 = slicedToArray._slicedToArray(_useState15, 2),
17694
+ successMsg = _useState16[0],
17695
+ setSuccessMsg = _useState16[1];
17696
+
17697
+ var _useState17 = React.useState(false),
17698
+ _useState18 = slicedToArray._slicedToArray(_useState17, 2),
17699
+ loading = _useState18[0],
17700
+ setLoading = _useState18[1];
17701
+
17702
+ return React__default.createElement(
17703
+ reactBootstrap.Form,
17704
+ { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
17705
+ React__default.createElement(
17706
+ 'h1',
17707
+ null,
17708
+ 'Profile'
17709
+ ),
17710
+ React__default.createElement('hr', null),
17711
+ userData ? React__default.createElement(
17712
+ React__default.Fragment,
17713
+ null,
17714
+ returnFormField({ name: 'email', label: 'Email', type: 'email', required: true, readonly: true, default_value: userData.email }),
17715
+ React__default.createElement(
17716
+ reactBootstrap.Form.Row,
17717
+ null,
17718
+ returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: reactBootstrap.Col, required: false }),
17719
+ returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: reactBootstrap.Col, required: false })
17720
+ ),
17721
+ React__default.createElement(
17722
+ reactBootstrap.Form.Row,
17723
+ null,
17724
+ returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: reactBootstrap.Col, required: true, default_value: userData.shared.first_name }),
17725
+ returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: reactBootstrap.Col, required: true, default_value: userData.shared.last_name })
17726
+ ),
17727
+ React__default.createElement(
17728
+ reactBootstrap.Form.Row,
17729
+ null,
17730
+ returnFormField({
17731
+ name: 'country',
17732
+ label: 'Country',
17733
+ type: 'select',
17734
+ required: true,
17735
+ groupType: reactBootstrap.Col,
17736
+ options: countries$1,
17737
+ handleChanged: handleCountryChanged,
17738
+ default_value: userData.shared.country
17739
+ }),
17740
+ countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: reactBootstrap.Col, options: states, default_value: userData.shared.state })
17741
+ ),
17742
+ React__default.createElement(
17743
+ reactBootstrap.Form.Row,
17744
+ null,
17745
+ countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: reactBootstrap.Col, default_value: userData.shared.zip }),
17746
+ countryUS && returnFormField({ name: 'phone', label: 'Phone', type: 'text', required: true, groupType: reactBootstrap.Col, default_value: userData.shared.phone })
17747
+ ),
17748
+ returnFormField({
17749
+ name: 'healthcare_professional',
17750
+ label: 'Are You a Health Care Professional?',
17751
+ type: 'radio',
17752
+ required: true,
17753
+ options: [{ value: 'Y', label: 'Yes', checked: true }, { value: 'N', label: 'No', checked: false }],
17754
+ default_value: userData.shared.healthcare_professional,
17755
+ handleChanged: handleHealthcareProfessionalChanged
17756
+ }),
17757
+ healcareProfessional && returnFormField({
17758
+ name: 'occupation',
17759
+ label: 'Occupation',
17760
+ type: 'select',
17761
+ required: true,
17762
+ options: healthcareOccupation,
17763
+ handleChanged: handleOccupationChanged,
17764
+ default_value: userData.shared.occupation_id
17765
+ }),
17766
+ !healcareProfessional && returnFormField({
17767
+ name: 'occupation',
17768
+ label: 'Non Provider Role',
17769
+ type: 'select',
17770
+ required: true,
17771
+ options: nonHealthcareOccupation,
17772
+ handleChanged: handleOccupationChanged,
17773
+ default_value: userData.shared.occupation_id
17774
+ }),
17775
+ occupationFields && occupationFields.map(function (field) {
17776
+ return returnFormField({
17777
+ name: field.name,
17778
+ label: field.label,
17779
+ type: field.type,
17780
+ required: field.required === 1,
17781
+ options: field.options,
17782
+ default_value: userData.shared[field.name]
17783
+ });
17784
+ }),
17785
+ returnFormField({
17786
+ name: 'agree',
17787
+ label: 'Terms & Conditions | Privacy Policy',
17788
+ type: 'checkbox',
17789
+ required: true,
17790
+ 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' }]
17791
+ }),
17792
+ React__default.createElement('hr', null),
17793
+ React__default.createElement(
17794
+ reactBootstrap.Form.Row,
17795
+ null,
17796
+ React__default.createElement(
17797
+ reactBootstrap.Form.Group,
17798
+ { as: reactBootstrap.Col },
17799
+ !loading && React__default.createElement(
17800
+ reactBootstrap.Button,
17801
+ { type: 'submit' },
17802
+ 'Update'
17803
+ ),
17804
+ loading && React__default.createElement(
17805
+ reactBootstrap.Button,
17806
+ { variant: 'primary', disabled: true },
17807
+ React__default.createElement(reactBootstrap.Spinner, {
17808
+ as: 'span',
17809
+ animation: 'border',
17810
+ role: 'status',
17811
+ 'aria-hidden': 'true',
17812
+ size: 'sm'
17813
+ }),
17814
+ React__default.createElement(
17815
+ 'span',
17816
+ { className: 'sr-only' },
17817
+ 'Loading...'
17818
+ )
17819
+ )
17820
+ )
17821
+ )
17822
+ ) : React__default.createElement(reactBootstrap.Spinner, {
17823
+ as: 'span',
17824
+ animation: 'border',
17825
+ role: 'status',
17826
+ 'aria-hidden': 'true',
17827
+ size: 'sm'
17828
+ }),
17829
+ errorMsg && React__default.createElement(
17830
+ 'p',
17831
+ { className: 'error' },
17832
+ errorMsg
17833
+ ),
17834
+ successMsg && React__default.createElement(
17835
+ 'p',
17836
+ { className: 'success' },
17837
+ successMsg
17838
+ ),
17839
+ React__default.createElement(
17840
+ 'style',
17841
+ { jsx: 'true'.toString() },
17842
+ ' \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 '
17843
+ )
17844
+ );
17845
+ };
17846
+
17847
+ /*!
17848
+ * cookie
17849
+ * Copyright(c) 2012-2014 Roman Shtylman
17850
+ * Copyright(c) 2015 Douglas Christopher Wilson
17851
+ * MIT Licensed
17852
+ */
17853
+
17854
+ /**
17855
+ * Module exports.
17856
+ * @public
17857
+ */
17858
+
17859
+ var parse_1 = parse$1;
17860
+ var serialize_1 = serialize$1;
17861
+
17862
+ /**
17863
+ * Module variables.
17864
+ * @private
17865
+ */
17866
+
17867
+ var decode = decodeURIComponent;
17868
+ var encode = encodeURIComponent;
17869
+ var pairSplitRegExp = /; */;
17870
+
17871
+ /**
17872
+ * RegExp to match field-content in RFC 7230 sec 3.2
17873
+ *
17874
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
17875
+ * field-vchar = VCHAR / obs-text
17876
+ * obs-text = %x80-FF
17877
+ */
17878
+
17879
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
17880
+
17881
+ /**
17882
+ * Parse a cookie header.
17883
+ *
17884
+ * Parse the given cookie header string into an object
17885
+ * The object has the various cookies as keys(names) => values
17886
+ *
17887
+ * @param {string} str
17888
+ * @param {object} [options]
17889
+ * @return {object}
17890
+ * @public
17891
+ */
17892
+
17893
+ function parse$1(str, options) {
17894
+ if (typeof str !== 'string') {
17895
+ throw new TypeError('argument str must be a string');
17896
+ }
17897
+
17898
+ var obj = {};
17899
+ var opt = options || {};
17900
+ var pairs = str.split(pairSplitRegExp);
17901
+ var dec = opt.decode || decode;
17902
+
17903
+ for (var i = 0; i < pairs.length; i++) {
17904
+ var pair = pairs[i];
17905
+ var eq_idx = pair.indexOf('=');
17906
+
17907
+ // skip things that don't look like key=value
17908
+ if (eq_idx < 0) {
17909
+ continue;
17910
+ }
17911
+
17912
+ var key = pair.substr(0, eq_idx).trim();
17913
+ var val = pair.substr(++eq_idx, pair.length).trim();
17914
+
17915
+ // quoted values
17916
+ if ('"' == val[0]) {
17917
+ val = val.slice(1, -1);
17918
+ }
17919
+
17920
+ // only assign once
17921
+ if (undefined == obj[key]) {
17922
+ obj[key] = tryDecode(val, dec);
17923
+ }
17924
+ }
17925
+
17926
+ return obj;
17927
+ }
17928
+
17929
+ /**
17930
+ * Serialize data into a cookie header.
17931
+ *
17932
+ * Serialize the a name value pair into a cookie string suitable for
17933
+ * http headers. An optional options object specified cookie parameters.
17934
+ *
17935
+ * serialize('foo', 'bar', { httpOnly: true })
17936
+ * => "foo=bar; httpOnly"
17937
+ *
17938
+ * @param {string} name
17939
+ * @param {string} val
17940
+ * @param {object} [options]
17941
+ * @return {string}
17942
+ * @public
17943
+ */
17944
+
17945
+ function serialize$1(name, val, options) {
17946
+ var opt = options || {};
17947
+ var enc = opt.encode || encode;
17948
+
17949
+ if (typeof enc !== 'function') {
17950
+ throw new TypeError('option encode is invalid');
17951
+ }
17952
+
17953
+ if (!fieldContentRegExp.test(name)) {
17954
+ throw new TypeError('argument name is invalid');
17955
+ }
17956
+
17957
+ var value = enc(val);
17958
+
17959
+ if (value && !fieldContentRegExp.test(value)) {
17960
+ throw new TypeError('argument val is invalid');
17961
+ }
17962
+
17963
+ var str = name + '=' + value;
17964
+
17965
+ if (null != opt.maxAge) {
17966
+ var maxAge = opt.maxAge - 0;
17967
+
17968
+ if (isNaN(maxAge) || !isFinite(maxAge)) {
17969
+ throw new TypeError('option maxAge is invalid')
17970
+ }
17971
+
17972
+ str += '; Max-Age=' + Math.floor(maxAge);
17973
+ }
17974
+
17975
+ if (opt.domain) {
17976
+ if (!fieldContentRegExp.test(opt.domain)) {
17977
+ throw new TypeError('option domain is invalid');
17978
+ }
17979
+
17980
+ str += '; Domain=' + opt.domain;
17981
+ }
17982
+
17983
+ if (opt.path) {
17984
+ if (!fieldContentRegExp.test(opt.path)) {
17985
+ throw new TypeError('option path is invalid');
17986
+ }
17987
+
17988
+ str += '; Path=' + opt.path;
17989
+ }
17990
+
17991
+ if (opt.expires) {
17992
+ if (typeof opt.expires.toUTCString !== 'function') {
17993
+ throw new TypeError('option expires is invalid');
17994
+ }
17995
+
17996
+ str += '; Expires=' + opt.expires.toUTCString();
17997
+ }
17998
+
17999
+ if (opt.httpOnly) {
18000
+ str += '; HttpOnly';
18001
+ }
18002
+
18003
+ if (opt.secure) {
18004
+ str += '; Secure';
18005
+ }
18006
+
18007
+ if (opt.sameSite) {
18008
+ var sameSite = typeof opt.sameSite === 'string'
18009
+ ? opt.sameSite.toLowerCase() : opt.sameSite;
18010
+
18011
+ switch (sameSite) {
18012
+ case true:
18013
+ str += '; SameSite=Strict';
18014
+ break;
18015
+ case 'lax':
18016
+ str += '; SameSite=Lax';
18017
+ break;
18018
+ case 'strict':
18019
+ str += '; SameSite=Strict';
18020
+ break;
18021
+ case 'none':
18022
+ str += '; SameSite=None';
18023
+ break;
18024
+ default:
18025
+ throw new TypeError('option sameSite is invalid');
18026
+ }
18027
+ }
18028
+
18029
+ return str;
18030
+ }
18031
+
18032
+ /**
18033
+ * Try decoding a string using a decoding function.
18034
+ *
18035
+ * @param {string} str
18036
+ * @param {function} decode
18037
+ * @private
18038
+ */
18039
+
18040
+ function tryDecode(str, decode) {
18041
+ try {
18042
+ return decode(str);
18043
+ } catch (e) {
18044
+ return str;
18045
+ }
18046
+ }
18047
+
18048
+ var TOKEN_NAME = 'token';
18049
+ var MAX_AGE = 60 * 60 * 8; // 8 hours
18050
+
18051
+ function setTokenCookie(res, token, eKey) {
18052
+ var cookies_serailized = [];
18053
+ cookies_serailized.push(serialize_1(TOKEN_NAME, token, {
18054
+ //maxAge: MAX_AGE, // we want login cookie to expire when browser
18055
+ //expires: new Date(Date.now() + MAX_AGE * 1000),
18056
+ //httpOnly: true,
18057
+ //secure: process.env.NODE_ENV === 'production',
18058
+ path: '/'
18059
+ //sameSite: 'lax',
18060
+ }));
18061
+
18062
+ cookies_serailized.push(serialize_1('eKey', eKey, {
18063
+ //maxAge: MAX_AGE, // we want login cookie to expire when browser
18064
+ //expires: new Date(Date.now() + MAX_AGE * 1000),
18065
+ //httpOnly: true,
18066
+ //secure: process.env.NODE_ENV === 'production',
18067
+ path: '/'
18068
+ //sameSite: 'lax',
18069
+ }));
18070
+
18071
+ res.setHeader('Set-Cookie', cookies_serailized);
18072
+ }
18073
+
18074
+ function removeTokenCookie(res) {
18075
+ var cookies_serailized = [];
18076
+ cookies_serailized.push(serialize_1(TOKEN_NAME, '', {
18077
+ maxAge: -1,
18078
+ expires: new Date(Date.now() - MAX_AGE * 1000),
18079
+ path: '/'
18080
+ }));
18081
+ cookies_serailized.push(serialize_1('eKey', '', {
18082
+ maxAge: -1,
18083
+ expires: new Date(Date.now() - MAX_AGE * 1000),
18084
+ path: '/'
18085
+ }));
18086
+
18087
+ res.setHeader('Set-Cookie', cookies_serailized);
18088
+ }
18089
+
18090
+ function parseCookies(req) {
18091
+ // For API Routes we don't need to parse the cookies.
18092
+ if (req.cookies) return req.cookies;
18093
+
18094
+ // For pages we do need to parse the cookies.
18095
+ var cookie = req.headers ? req.headers.cookie : null;
18096
+ return parse_1(cookie || '');
18097
+ }
18098
+
18099
+ function getTokenCookie(req) {
18100
+ var cookies = parseCookies(req);
18101
+ return cookies[TOKEN_NAME];
18102
+ }
18103
+
18104
+ var authCookies = /*#__PURE__*/Object.freeze({
18105
+ __proto__: null,
18106
+ setTokenCookie: setTokenCookie,
18107
+ removeTokenCookie: removeTokenCookie,
18108
+ parseCookies: parseCookies,
18109
+ getTokenCookie: getTokenCookie
18110
+ });
18111
+
18112
+ var TOKEN_SECRET = ',Qjn4rG\'Is=&wx,EXd<AYW|<{THTrspDkKJV5J{@@=?zDh,OX6Ky=0&T"L419;)';
18113
+
18114
+ function encryptSession(session) {
18115
+ return Iron.seal(session, TOKEN_SECRET, Iron.defaults);
18116
+ }
18117
+
18118
+ var getSession = function () {
18119
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee(req) {
18120
+ var token;
18121
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
18122
+ while (1) {
18123
+ switch (_context.prev = _context.next) {
18124
+ case 0:
18125
+ token = getTokenCookie(req);
18126
+ return _context.abrupt('return', token ? Iron.unseal(token, TOKEN_SECRET, Iron.defaults) : null);
18127
+
18128
+ case 2:
18129
+ case 'end':
18130
+ return _context.stop();
18131
+ }
18132
+ }
18133
+ }, _callee, this);
18134
+ }));
18135
+
18136
+ return function getSession(_x) {
18137
+ return _ref.apply(this, arguments);
18138
+ };
18139
+ }();
18140
+
18141
+ var iron = /*#__PURE__*/Object.freeze({
18142
+ __proto__: null,
18143
+ encryptSession: encryptSession,
18144
+ getSession: getSession
18145
+ });
18146
+
18147
+ var toStr = Object.prototype.toString;
18148
+
18149
+ var isArguments$1 = function isArguments(value) {
18150
+ var str = toStr.call(value);
18151
+ var isArgs = str === '[object Arguments]';
18152
+ if (!isArgs) {
18153
+ isArgs = str !== '[object Array]' &&
18154
+ value !== null &&
18155
+ typeof value === 'object' &&
18156
+ typeof value.length === 'number' &&
18157
+ value.length >= 0 &&
18158
+ toStr.call(value.callee) === '[object Function]';
18159
+ }
18160
+ return isArgs;
18161
+ };
18162
+
18163
+ var keysShim;
18164
+ if (!Object.keys) {
18165
+ // modified from https://github.com/es-shims/es5-shim
18166
+ var has$1 = Object.prototype.hasOwnProperty;
18167
+ var toStr$1 = Object.prototype.toString;
18168
+ var isArgs = isArguments$1; // eslint-disable-line global-require
18169
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
18170
+ var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
18171
+ var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
18172
+ var dontEnums = [
18173
+ 'toString',
18174
+ 'toLocaleString',
18175
+ 'valueOf',
18176
+ 'hasOwnProperty',
18177
+ 'isPrototypeOf',
18178
+ 'propertyIsEnumerable',
18179
+ 'constructor'
18180
+ ];
18181
+ var equalsConstructorPrototype = function (o) {
18182
+ var ctor = o.constructor;
18183
+ return ctor && ctor.prototype === o;
18184
+ };
18185
+ var excludedKeys = {
18186
+ $applicationCache: true,
18187
+ $console: true,
18188
+ $external: true,
18189
+ $frame: true,
18190
+ $frameElement: true,
18191
+ $frames: true,
18192
+ $innerHeight: true,
18193
+ $innerWidth: true,
18194
+ $onmozfullscreenchange: true,
18195
+ $onmozfullscreenerror: true,
18196
+ $outerHeight: true,
18197
+ $outerWidth: true,
18198
+ $pageXOffset: true,
18199
+ $pageYOffset: true,
18200
+ $parent: true,
18201
+ $scrollLeft: true,
18202
+ $scrollTop: true,
18203
+ $scrollX: true,
18204
+ $scrollY: true,
18205
+ $self: true,
18206
+ $webkitIndexedDB: true,
18207
+ $webkitStorageInfo: true,
18208
+ $window: true
18209
+ };
18210
+ var hasAutomationEqualityBug = (function () {
18211
+ /* global window */
18212
+ if (typeof window === 'undefined') { return false; }
18213
+ for (var k in window) {
18214
+ try {
18215
+ if (!excludedKeys['$' + k] && has$1.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
18216
+ try {
18217
+ equalsConstructorPrototype(window[k]);
18218
+ } catch (e) {
18219
+ return true;
18220
+ }
18221
+ }
18222
+ } catch (e) {
18223
+ return true;
18224
+ }
18225
+ }
18226
+ return false;
18227
+ }());
18228
+ var equalsConstructorPrototypeIfNotBuggy = function (o) {
18229
+ /* global window */
18230
+ if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
18231
+ return equalsConstructorPrototype(o);
18232
+ }
18233
+ try {
18234
+ return equalsConstructorPrototype(o);
18235
+ } catch (e) {
18236
+ return false;
18237
+ }
18238
+ };
18239
+
18240
+ keysShim = function keys(object) {
18241
+ var isObject = object !== null && typeof object === 'object';
18242
+ var isFunction = toStr$1.call(object) === '[object Function]';
18243
+ var isArguments = isArgs(object);
18244
+ var isString = isObject && toStr$1.call(object) === '[object String]';
18245
+ var theKeys = [];
18246
+
18247
+ if (!isObject && !isFunction && !isArguments) {
18248
+ throw new TypeError('Object.keys called on a non-object');
18249
+ }
18250
+
18251
+ var skipProto = hasProtoEnumBug && isFunction;
18252
+ if (isString && object.length > 0 && !has$1.call(object, 0)) {
18253
+ for (var i = 0; i < object.length; ++i) {
18254
+ theKeys.push(String(i));
18255
+ }
18256
+ }
18257
+
18258
+ if (isArguments && object.length > 0) {
18259
+ for (var j = 0; j < object.length; ++j) {
18260
+ theKeys.push(String(j));
18261
+ }
18262
+ } else {
18263
+ for (var name in object) {
18264
+ if (!(skipProto && name === 'prototype') && has$1.call(object, name)) {
18265
+ theKeys.push(String(name));
18266
+ }
18267
+ }
18268
+ }
18269
+
18270
+ if (hasDontEnumBug) {
18271
+ var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
18272
+
18273
+ for (var k = 0; k < dontEnums.length; ++k) {
18274
+ if (!(skipConstructor && dontEnums[k] === 'constructor') && has$1.call(object, dontEnums[k])) {
18275
+ theKeys.push(dontEnums[k]);
18276
+ }
18277
+ }
18278
+ }
18279
+ return theKeys;
18280
+ };
18281
+ }
18282
+ var implementation = keysShim;
18283
+
18284
+ var slice$1 = Array.prototype.slice;
18285
+
18286
+
18287
+ var origKeys = Object.keys;
18288
+ var keysShim$1 = origKeys ? function keys(o) { return origKeys(o); } : implementation;
18289
+
18290
+ var originalKeys = Object.keys;
18291
+
18292
+ keysShim$1.shim = function shimObjectKeys() {
18293
+ if (Object.keys) {
18294
+ var keysWorksWithArguments = (function () {
18295
+ // Safari 5.0 bug
18296
+ var args = Object.keys(arguments);
18297
+ return args && args.length === arguments.length;
18298
+ }(1, 2));
18299
+ if (!keysWorksWithArguments) {
18300
+ Object.keys = function keys(object) { // eslint-disable-line func-name-matching
18301
+ if (isArguments$1(object)) {
18302
+ return originalKeys(slice$1.call(object));
18303
+ }
18304
+ return originalKeys(object);
18305
+ };
18306
+ }
18307
+ } else {
18308
+ Object.keys = keysShim$1;
18309
+ }
18310
+ return Object.keys || keysShim$1;
18311
+ };
18312
+
18313
+ var objectKeys = keysShim$1;
18314
+
18315
+ var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
18316
+
18317
+ var toStr$2 = Object.prototype.toString;
18318
+ var concat = Array.prototype.concat;
18319
+ var origDefineProperty = Object.defineProperty;
18320
+
18321
+ var isFunction$1 = function (fn) {
18322
+ return typeof fn === 'function' && toStr$2.call(fn) === '[object Function]';
18323
+ };
18324
+
18325
+ var arePropertyDescriptorsSupported = function () {
18326
+ var obj = {};
18327
+ try {
18328
+ origDefineProperty(obj, 'x', { enumerable: false, value: obj });
18329
+ // eslint-disable-next-line no-unused-vars, no-restricted-syntax
18330
+ for (var _ in obj) { // jscs:ignore disallowUnusedVariables
18331
+ return false;
18332
+ }
18333
+ return obj.x === obj;
18334
+ } catch (e) { /* this is IE 8. */
18335
+ return false;
18336
+ }
18337
+ };
18338
+ var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
18339
+
18340
+ var defineProperty = function (object, name, value, predicate) {
18341
+ if (name in object && (!isFunction$1(predicate) || !predicate())) {
18342
+ return;
18343
+ }
18344
+ if (supportsDescriptors) {
18345
+ origDefineProperty(object, name, {
18346
+ configurable: true,
18347
+ enumerable: false,
18348
+ value: value,
18349
+ writable: true
18350
+ });
18351
+ } else {
18352
+ object[name] = value;
18353
+ }
18354
+ };
18355
+
18356
+ var defineProperties = function (object, map) {
18357
+ var predicates = arguments.length > 2 ? arguments[2] : {};
18358
+ var props = objectKeys(map);
18359
+ if (hasSymbols) {
18360
+ props = concat.call(props, Object.getOwnPropertySymbols(map));
18361
+ }
18362
+ for (var i = 0; i < props.length; i += 1) {
18363
+ defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
18364
+ }
18365
+ };
18366
+
18367
+ defineProperties.supportsDescriptors = !!supportsDescriptors;
18368
+
18369
+ var defineProperties_1 = defineProperties;
18370
+
18371
+ /* eslint complexity: [2, 18], max-statements: [2, 33] */
18372
+ var shams = function hasSymbols() {
18373
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
18374
+ if (typeof Symbol.iterator === 'symbol') { return true; }
18375
+
18376
+ var obj = {};
18377
+ var sym = Symbol('test');
18378
+ var symObj = Object(sym);
18379
+ if (typeof sym === 'string') { return false; }
18380
+
18381
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
18382
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
18383
+
18384
+ // temp disabled per https://github.com/ljharb/object.assign/issues/17
18385
+ // if (sym instanceof Symbol) { return false; }
18386
+ // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
18387
+ // if (!(symObj instanceof Symbol)) { return false; }
18388
+
18389
+ // if (typeof Symbol.prototype.toString !== 'function') { return false; }
18390
+ // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
18391
+
18392
+ var symVal = 42;
18393
+ obj[sym] = symVal;
18394
+ for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
18395
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
18396
+
18397
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
18398
+
18399
+ var syms = Object.getOwnPropertySymbols(obj);
18400
+ if (syms.length !== 1 || syms[0] !== sym) { return false; }
18401
+
18402
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
18403
+
18404
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
18405
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
18406
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
18407
+ }
18408
+
18409
+ return true;
18410
+ };
18411
+
18412
+ var origSymbol = _commonjsHelpers.commonjsGlobal.Symbol;
18413
+
18414
+
18415
+ var hasSymbols$1 = function hasNativeSymbols() {
18416
+ if (typeof origSymbol !== 'function') { return false; }
18417
+ if (typeof Symbol !== 'function') { return false; }
18418
+ if (typeof origSymbol('foo') !== 'symbol') { return false; }
18419
+ if (typeof Symbol('bar') !== 'symbol') { return false; }
18420
+
18421
+ return shams();
18422
+ };
18423
+
18424
+ /* eslint no-invalid-this: 1 */
18425
+
18426
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
18427
+ var slice$2 = Array.prototype.slice;
18428
+ var toStr$3 = Object.prototype.toString;
18429
+ var funcType = '[object Function]';
18430
+
18431
+ var implementation$1 = function bind(that) {
18432
+ var target = this;
18433
+ if (typeof target !== 'function' || toStr$3.call(target) !== funcType) {
18434
+ throw new TypeError(ERROR_MESSAGE + target);
18435
+ }
18436
+ var args = slice$2.call(arguments, 1);
18437
+
18438
+ var bound;
18439
+ var binder = function () {
18440
+ if (this instanceof bound) {
18441
+ var result = target.apply(
18442
+ this,
18443
+ args.concat(slice$2.call(arguments))
18444
+ );
18445
+ if (Object(result) === result) {
18446
+ return result;
18447
+ }
18448
+ return this;
18449
+ } else {
18450
+ return target.apply(
18451
+ that,
18452
+ args.concat(slice$2.call(arguments))
18453
+ );
18454
+ }
18455
+ };
18456
+
18457
+ var boundLength = Math.max(0, target.length - args.length);
18458
+ var boundArgs = [];
18459
+ for (var i = 0; i < boundLength; i++) {
18460
+ boundArgs.push('$' + i);
18461
+ }
18462
+
18463
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
18464
+
18465
+ if (target.prototype) {
18466
+ var Empty = function Empty() {};
18467
+ Empty.prototype = target.prototype;
18468
+ bound.prototype = new Empty();
18469
+ Empty.prototype = null;
18470
+ }
18471
+
18472
+ return bound;
18473
+ };
18474
+
18475
+ var functionBind = Function.prototype.bind || implementation$1;
18476
+
18477
+ /* globals
18478
+ Atomics,
18479
+ SharedArrayBuffer,
18480
+ */
18481
+
18482
+ var undefined$1;
18483
+
18484
+ var $TypeError = TypeError;
18485
+
18486
+ var $gOPD = Object.getOwnPropertyDescriptor;
18487
+ if ($gOPD) {
18488
+ try {
18489
+ $gOPD({}, '');
18490
+ } catch (e) {
18491
+ $gOPD = null; // this is IE 8, which has a broken gOPD
18492
+ }
18493
+ }
18494
+
18495
+ var throwTypeError = function () { throw new $TypeError(); };
18496
+ var ThrowTypeError = $gOPD
18497
+ ? (function () {
18498
+ try {
18499
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
18500
+ arguments.callee; // IE 8 does not throw here
18501
+ return throwTypeError;
18502
+ } catch (calleeThrows) {
18503
+ try {
18504
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
18505
+ return $gOPD(arguments, 'callee').get;
18506
+ } catch (gOPDthrows) {
18507
+ return throwTypeError;
18508
+ }
18509
+ }
18510
+ }())
18511
+ : throwTypeError;
18512
+
18513
+ var hasSymbols$2 = hasSymbols$1();
18514
+
18515
+ var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
18516
+ var generatorFunction = undefined$1;
18517
+ var asyncFunction = undefined$1;
18518
+ var asyncGenFunction = undefined$1;
18519
+
18520
+ var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
18521
+
18522
+ var INTRINSICS = {
18523
+ '%Array%': Array,
18524
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
18525
+ '%ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer.prototype,
18526
+ '%ArrayIteratorPrototype%': hasSymbols$2 ? getProto([][Symbol.iterator]()) : undefined$1,
18527
+ '%ArrayPrototype%': Array.prototype,
18528
+ '%ArrayProto_entries%': Array.prototype.entries,
18529
+ '%ArrayProto_forEach%': Array.prototype.forEach,
18530
+ '%ArrayProto_keys%': Array.prototype.keys,
18531
+ '%ArrayProto_values%': Array.prototype.values,
18532
+ '%AsyncFromSyncIteratorPrototype%': undefined$1,
18533
+ '%AsyncFunction%': asyncFunction,
18534
+ '%AsyncFunctionPrototype%': undefined$1,
18535
+ '%AsyncGenerator%': undefined$1,
18536
+ '%AsyncGeneratorFunction%': asyncGenFunction,
18537
+ '%AsyncGeneratorPrototype%': undefined$1,
18538
+ '%AsyncIteratorPrototype%': undefined$1,
18539
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
18540
+ '%Boolean%': Boolean,
18541
+ '%BooleanPrototype%': Boolean.prototype,
18542
+ '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
18543
+ '%DataViewPrototype%': typeof DataView === 'undefined' ? undefined$1 : DataView.prototype,
18544
+ '%Date%': Date,
18545
+ '%DatePrototype%': Date.prototype,
18546
+ '%decodeURI%': decodeURI,
18547
+ '%decodeURIComponent%': decodeURIComponent,
18548
+ '%encodeURI%': encodeURI,
18549
+ '%encodeURIComponent%': encodeURIComponent,
18550
+ '%Error%': Error,
18551
+ '%ErrorPrototype%': Error.prototype,
18552
+ '%eval%': eval, // eslint-disable-line no-eval
18553
+ '%EvalError%': EvalError,
18554
+ '%EvalErrorPrototype%': EvalError.prototype,
18555
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
18556
+ '%Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array.prototype,
18557
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
18558
+ '%Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array.prototype,
18559
+ '%Function%': Function,
18560
+ '%FunctionPrototype%': Function.prototype,
18561
+ '%Generator%': undefined$1,
18562
+ '%GeneratorFunction%': generatorFunction,
18563
+ '%GeneratorPrototype%': undefined$1,
18564
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
18565
+ '%Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array.prototype,
18566
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
18567
+ '%Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined$1 : Int8Array.prototype,
18568
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
18569
+ '%Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array.prototype,
18570
+ '%isFinite%': isFinite,
18571
+ '%isNaN%': isNaN,
18572
+ '%IteratorPrototype%': hasSymbols$2 ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
18573
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
18574
+ '%JSONParse%': typeof JSON === 'object' ? JSON.parse : undefined$1,
18575
+ '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
18576
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$2 ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
18577
+ '%MapPrototype%': typeof Map === 'undefined' ? undefined$1 : Map.prototype,
18578
+ '%Math%': Math,
18579
+ '%Number%': Number,
18580
+ '%NumberPrototype%': Number.prototype,
18581
+ '%Object%': Object,
18582
+ '%ObjectPrototype%': Object.prototype,
18583
+ '%ObjProto_toString%': Object.prototype.toString,
18584
+ '%ObjProto_valueOf%': Object.prototype.valueOf,
18585
+ '%parseFloat%': parseFloat,
18586
+ '%parseInt%': parseInt,
18587
+ '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
18588
+ '%PromisePrototype%': typeof Promise === 'undefined' ? undefined$1 : Promise.prototype,
18589
+ '%PromiseProto_then%': typeof Promise === 'undefined' ? undefined$1 : Promise.prototype.then,
18590
+ '%Promise_all%': typeof Promise === 'undefined' ? undefined$1 : Promise.all,
18591
+ '%Promise_reject%': typeof Promise === 'undefined' ? undefined$1 : Promise.reject,
18592
+ '%Promise_resolve%': typeof Promise === 'undefined' ? undefined$1 : Promise.resolve,
18593
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
18594
+ '%RangeError%': RangeError,
18595
+ '%RangeErrorPrototype%': RangeError.prototype,
18596
+ '%ReferenceError%': ReferenceError,
18597
+ '%ReferenceErrorPrototype%': ReferenceError.prototype,
18598
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
18599
+ '%RegExp%': RegExp,
18600
+ '%RegExpPrototype%': RegExp.prototype,
18601
+ '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
18602
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$2 ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
18603
+ '%SetPrototype%': typeof Set === 'undefined' ? undefined$1 : Set.prototype,
18604
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
18605
+ '%SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer.prototype,
18606
+ '%String%': String,
18607
+ '%StringIteratorPrototype%': hasSymbols$2 ? getProto(''[Symbol.iterator]()) : undefined$1,
18608
+ '%StringPrototype%': String.prototype,
18609
+ '%Symbol%': hasSymbols$2 ? Symbol : undefined$1,
18610
+ '%SymbolPrototype%': hasSymbols$2 ? Symbol.prototype : undefined$1,
18611
+ '%SyntaxError%': SyntaxError,
18612
+ '%SyntaxErrorPrototype%': SyntaxError.prototype,
18613
+ '%ThrowTypeError%': ThrowTypeError,
18614
+ '%TypedArray%': TypedArray,
18615
+ '%TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined$1,
18616
+ '%TypeError%': $TypeError,
18617
+ '%TypeErrorPrototype%': $TypeError.prototype,
18618
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
18619
+ '%Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array.prototype,
18620
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
18621
+ '%Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray.prototype,
18622
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
18623
+ '%Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array.prototype,
18624
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
18625
+ '%Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array.prototype,
18626
+ '%URIError%': URIError,
18627
+ '%URIErrorPrototype%': URIError.prototype,
18628
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
18629
+ '%WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap.prototype,
18630
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet,
18631
+ '%WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet.prototype
18632
+ };
18633
+
18634
+
18635
+ var $replace = functionBind.call(Function.call, String.prototype.replace);
18636
+
18637
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
18638
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
18639
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
18640
+ var stringToPath = function stringToPath(string) {
18641
+ var result = [];
18642
+ $replace(string, rePropName, function (match, number, quote, subString) {
18643
+ result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : (number || match);
18644
+ });
18645
+ return result;
18646
+ };
18647
+ /* end adaptation */
18648
+
18649
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
18650
+ if (!(name in INTRINSICS)) {
18651
+ throw new SyntaxError('intrinsic ' + name + ' does not exist!');
18652
+ }
18653
+
18654
+ // istanbul ignore if // hopefully this is impossible to test :-)
18655
+ if (typeof INTRINSICS[name] === 'undefined' && !allowMissing) {
18656
+ throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
18657
+ }
18658
+
18659
+ return INTRINSICS[name];
18660
+ };
18661
+
18662
+ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
18663
+ if (typeof name !== 'string' || name.length === 0) {
18664
+ throw new TypeError('intrinsic name must be a non-empty string');
18665
+ }
18666
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
18667
+ throw new TypeError('"allowMissing" argument must be a boolean');
18668
+ }
18669
+
18670
+ var parts = stringToPath(name);
18671
+
18672
+ var value = getBaseIntrinsic('%' + (parts.length > 0 ? parts[0] : '') + '%', allowMissing);
18673
+ for (var i = 1; i < parts.length; i += 1) {
18674
+ if (value != null) {
18675
+ if ($gOPD && (i + 1) >= parts.length) {
18676
+ var desc = $gOPD(value, parts[i]);
18677
+ value = desc ? (desc.get || desc.value) : value[parts[i]];
18678
+ } else {
18679
+ value = value[parts[i]];
18680
+ }
18681
+ }
18682
+ }
18683
+ return value;
18684
+ };
18685
+
18686
+ var $Function = GetIntrinsic('%Function%');
18687
+ var $apply = $Function.apply;
18688
+ var $call = $Function.call;
18689
+
18690
+ var callBind = function callBind() {
18691
+ return functionBind.apply($call, arguments);
18692
+ };
18693
+
18694
+ var apply = function applyBind() {
18695
+ return functionBind.apply($apply, arguments);
18696
+ };
18697
+ callBind.apply = apply;
18698
+
18699
+ var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
18700
+
18701
+ var callBound = function callBoundIntrinsic(name, allowMissing) {
18702
+ var intrinsic = GetIntrinsic(name, !!allowMissing);
18703
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.')) {
18704
+ return callBind(intrinsic);
18705
+ }
18706
+ return intrinsic;
18707
+ };
18708
+
18709
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%');
18710
+
18711
+
18712
+
18713
+ var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
18714
+
18715
+ // eslint-disable-next-line max-params
18716
+ var DefineOwnProperty = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) {
18717
+ if (!$defineProperty) {
18718
+ if (!IsDataDescriptor(desc)) {
18719
+ // ES3 does not support getters/setters
18720
+ return false;
18721
+ }
18722
+ if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
18723
+ return false;
18724
+ }
18725
+
18726
+ // fallback for ES3
18727
+ if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
18728
+ // a non-enumerable existing property
18729
+ return false;
18730
+ }
18731
+
18732
+ // property does not exist at all, or exists but is enumerable
18733
+ var V = desc['[[Value]]'];
18734
+ // eslint-disable-next-line no-param-reassign
18735
+ O[P] = V; // will use [[Define]]
18736
+ return SameValue(O[P], V);
18737
+ }
18738
+ $defineProperty(O, P, FromPropertyDescriptor(desc));
18739
+ return true;
18740
+ };
18741
+
18742
+ var src$1 = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
18743
+
18744
+ var $TypeError$1 = GetIntrinsic('%TypeError%');
18745
+ var $SyntaxError = GetIntrinsic('%SyntaxError%');
18746
+
18747
+
18748
+
18749
+ var predicates = {
18750
+ // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
18751
+ 'Property Descriptor': function isPropertyDescriptor(Type, Desc) {
18752
+ if (Type(Desc) !== 'Object') {
18753
+ return false;
18754
+ }
18755
+ var allowed = {
18756
+ '[[Configurable]]': true,
18757
+ '[[Enumerable]]': true,
18758
+ '[[Get]]': true,
18759
+ '[[Set]]': true,
18760
+ '[[Value]]': true,
18761
+ '[[Writable]]': true
18762
+ };
18763
+
18764
+ for (var key in Desc) { // eslint-disable-line
18765
+ if (src$1(Desc, key) && !allowed[key]) {
18766
+ return false;
18767
+ }
18768
+ }
18769
+
18770
+ var isData = src$1(Desc, '[[Value]]');
18771
+ var IsAccessor = src$1(Desc, '[[Get]]') || src$1(Desc, '[[Set]]');
18772
+ if (isData && IsAccessor) {
18773
+ throw new $TypeError$1('Property Descriptors may not be both accessor and data descriptors');
18774
+ }
18775
+ return true;
18776
+ }
18777
+ };
18778
+
18779
+ var assertRecord = function assertRecord(Type, recordType, argumentName, value) {
18780
+ var predicate = predicates[recordType];
18781
+ if (typeof predicate !== 'function') {
18782
+ throw new $SyntaxError('unknown record type: ' + recordType);
18783
+ }
18784
+ if (!predicate(Type, value)) {
18785
+ throw new $TypeError$1(argumentName + ' must be a ' + recordType);
18786
+ }
18787
+ };
18788
+
18789
+ // https://www.ecma-international.org/ecma-262/5.1/#sec-8
18790
+
18791
+ var Type = function Type(x) {
18792
+ if (x === null) {
18793
+ return 'Null';
18794
+ }
18795
+ if (typeof x === 'undefined') {
18796
+ return 'Undefined';
18797
+ }
18798
+ if (typeof x === 'function' || typeof x === 'object') {
18799
+ return 'Object';
18800
+ }
18801
+ if (typeof x === 'number') {
18802
+ return 'Number';
18803
+ }
18804
+ if (typeof x === 'boolean') {
18805
+ return 'Boolean';
18806
+ }
18807
+ if (typeof x === 'string') {
18808
+ return 'String';
18809
+ }
18810
+ };
18811
+
18812
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
18813
+
18814
+ var Type$1 = function Type$1(x) {
18815
+ if (typeof x === 'symbol') {
18816
+ return 'Symbol';
18817
+ }
18818
+ return Type(x);
18819
+ };
18820
+
18821
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
18822
+
18823
+ var FromPropertyDescriptor = function FromPropertyDescriptor(Desc) {
18824
+ if (typeof Desc === 'undefined') {
18825
+ return Desc;
18826
+ }
18827
+
18828
+ assertRecord(Type$1, 'Property Descriptor', 'Desc', Desc);
18829
+
18830
+ var obj = {};
18831
+ if ('[[Value]]' in Desc) {
18832
+ obj.value = Desc['[[Value]]'];
18833
+ }
18834
+ if ('[[Writable]]' in Desc) {
18835
+ obj.writable = Desc['[[Writable]]'];
18836
+ }
18837
+ if ('[[Get]]' in Desc) {
18838
+ obj.get = Desc['[[Get]]'];
18839
+ }
18840
+ if ('[[Set]]' in Desc) {
18841
+ obj.set = Desc['[[Set]]'];
18842
+ }
18843
+ if ('[[Enumerable]]' in Desc) {
18844
+ obj.enumerable = Desc['[[Enumerable]]'];
18845
+ }
18846
+ if ('[[Configurable]]' in Desc) {
18847
+ obj.configurable = Desc['[[Configurable]]'];
18848
+ }
18849
+ return obj;
18850
+ };
18851
+
18852
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
18853
+
18854
+ var IsDataDescriptor = function IsDataDescriptor(Desc) {
18855
+ if (typeof Desc === 'undefined') {
18856
+ return false;
18857
+ }
18858
+
18859
+ assertRecord(Type$1, 'Property Descriptor', 'Desc', Desc);
18860
+
18861
+ if (!src$1(Desc, '[[Value]]') && !src$1(Desc, '[[Writable]]')) {
18862
+ return false;
18863
+ }
18864
+
18865
+ return true;
18866
+ };
18867
+
18868
+ var isPrimitive$1 = function isPrimitive(value) {
18869
+ return value === null || (typeof value !== 'function' && typeof value !== 'object');
18870
+ };
18871
+
18872
+ var $Object = GetIntrinsic('%Object%');
18873
+
18874
+
18875
+
18876
+ var $preventExtensions = $Object.preventExtensions;
18877
+ var $isExtensible = $Object.isExtensible;
18878
+
18879
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-isextensible-o
18880
+
18881
+ var IsExtensible = $preventExtensions
18882
+ ? function IsExtensible(obj) {
18883
+ return !isPrimitive$1(obj) && $isExtensible(obj);
18884
+ }
18885
+ : function IsExtensible(obj) { // eslint-disable-line no-unused-vars
18886
+ return true;
18887
+ };
18888
+
18889
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-ispropertykey
18890
+
18891
+ var IsPropertyKey = function IsPropertyKey(argument) {
18892
+ return typeof argument === 'string' || typeof argument === 'symbol';
18893
+ };
18894
+
18895
+ var _isNaN = Number.isNaN || function isNaN(a) {
18896
+ return a !== a;
18897
+ };
18898
+
18899
+ // http://www.ecma-international.org/ecma-262/5.1/#sec-9.12
18900
+
18901
+ var SameValue = function SameValue(x, y) {
18902
+ if (x === y) { // 0 === -0, but they are not identical.
18903
+ if (x === 0) { return 1 / x === 1 / y; }
18904
+ return true;
18905
+ }
18906
+ return _isNaN(x) && _isNaN(y);
18907
+ };
18908
+
18909
+ var $gOPD$1 = GetIntrinsic('%Object.getOwnPropertyDescriptor%');
18910
+ var $TypeError$2 = GetIntrinsic('%TypeError%');
18911
+
18912
+
18913
+
18914
+
18915
+
18916
+
18917
+
18918
+
18919
+
18920
+
18921
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-createdataproperty
18922
+
18923
+ var CreateDataProperty = function CreateDataProperty(O, P, V) {
18924
+ if (Type$1(O) !== 'Object') {
18925
+ throw new $TypeError$2('Assertion failed: Type(O) is not Object');
18926
+ }
18927
+ if (!IsPropertyKey(P)) {
18928
+ throw new $TypeError$2('Assertion failed: IsPropertyKey(P) is not true');
18929
+ }
18930
+ var oldDesc = $gOPD$1(O, P);
18931
+ var extensible = oldDesc || IsExtensible(O);
18932
+ var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
18933
+ if (immutable || !extensible) {
18934
+ return false;
18935
+ }
18936
+ return DefineOwnProperty(
18937
+ IsDataDescriptor,
18938
+ SameValue,
18939
+ FromPropertyDescriptor,
18940
+ O,
18941
+ P,
18942
+ {
18943
+ '[[Configurable]]': true,
18944
+ '[[Enumerable]]': true,
18945
+ '[[Value]]': V,
18946
+ '[[Writable]]': true
18947
+ }
18948
+ );
18949
+ };
18950
+
18951
+ var fnToStr = Function.prototype.toString;
18952
+
18953
+ var constructorRegex = /^\s*class\b/;
18954
+ var isES6ClassFn = function isES6ClassFunction(value) {
18955
+ try {
18956
+ var fnStr = fnToStr.call(value);
18957
+ return constructorRegex.test(fnStr);
18958
+ } catch (e) {
18959
+ return false; // not a function
18960
+ }
18961
+ };
18962
+
18963
+ var tryFunctionObject = function tryFunctionToStr(value) {
18964
+ try {
18965
+ if (isES6ClassFn(value)) { return false; }
18966
+ fnToStr.call(value);
18967
+ return true;
18968
+ } catch (e) {
18969
+ return false;
18970
+ }
18971
+ };
18972
+ var toStr$4 = Object.prototype.toString;
18973
+ var fnClass = '[object Function]';
18974
+ var genClass = '[object GeneratorFunction]';
18975
+ var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
18976
+
18977
+ var isCallable = function isCallable(value) {
18978
+ if (!value) { return false; }
18979
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
18980
+ if (typeof value === 'function' && !value.prototype) { return true; }
18981
+ if (hasToStringTag) { return tryFunctionObject(value); }
18982
+ if (isES6ClassFn(value)) { return false; }
18983
+ var strClass = toStr$4.call(value);
18984
+ return strClass === fnClass || strClass === genClass;
18985
+ };
18986
+
18987
+ // http://www.ecma-international.org/ecma-262/5.1/#sec-9.11
18988
+
18989
+ var IsCallable = isCallable;
18990
+
18991
+ var $TypeError$3 = GetIntrinsic('%TypeError%');
18992
+
18993
+ // http://www.ecma-international.org/ecma-262/5.1/#sec-9.10
18994
+
18995
+ var CheckObjectCoercible = function CheckObjectCoercible(value, optMessage) {
18996
+ if (value == null) {
18997
+ throw new $TypeError$3(optMessage || ('Cannot call method on ' + value));
18998
+ }
18999
+ return value;
19000
+ };
19001
+
19002
+ var RequireObjectCoercible = CheckObjectCoercible;
19003
+
19004
+ var $Object$1 = GetIntrinsic('%Object%');
19005
+
19006
+
19007
+
19008
+ // https://www.ecma-international.org/ecma-262/6.0/#sec-toobject
19009
+
19010
+ var ToObject = function ToObject(value) {
19011
+ RequireObjectCoercible(value);
19012
+ return $Object$1(value);
19013
+ };
19014
+
19015
+ var $gOPD$2 = Object.getOwnPropertyDescriptor;
19016
+ var $getOwnNames = Object.getOwnPropertyNames;
19017
+ var $getSymbols = Object.getOwnPropertySymbols;
19018
+ var $concat = callBound('Array.prototype.concat');
19019
+ var $reduce = callBound('Array.prototype.reduce');
19020
+ var getAll = $getSymbols ? function (obj) {
19021
+ return $concat($getOwnNames(obj), $getSymbols(obj));
19022
+ } : $getOwnNames;
19023
+
19024
+ var isES5 = IsCallable($gOPD$2) && IsCallable($getOwnNames);
19025
+
19026
+ var implementation$2 = function getOwnPropertyDescriptors(value) {
19027
+ RequireObjectCoercible(value);
19028
+ if (!isES5) {
19029
+ throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor');
19030
+ }
19031
+
19032
+ var O = ToObject(value);
19033
+ return $reduce(
19034
+ getAll(O),
19035
+ function (acc, key) {
19036
+ var descriptor = $gOPD$2(O, key);
19037
+ if (typeof descriptor !== 'undefined') {
19038
+ CreateDataProperty(acc, key, descriptor);
19039
+ }
19040
+ return acc;
19041
+ },
19042
+ {}
19043
+ );
19044
+ };
19045
+
19046
+ var polyfill = function getPolyfill() {
19047
+ return typeof Object.getOwnPropertyDescriptors === 'function' ? Object.getOwnPropertyDescriptors : implementation$2;
19048
+ };
19049
+
19050
+ var shim = function shimGetOwnPropertyDescriptors() {
19051
+ var polyfill$1 = polyfill();
19052
+ defineProperties_1(
19053
+ Object,
19054
+ { getOwnPropertyDescriptors: polyfill$1 },
19055
+ { getOwnPropertyDescriptors: function () { return Object.getOwnPropertyDescriptors !== polyfill$1; } }
19056
+ );
19057
+ return polyfill$1;
19058
+ };
19059
+
19060
+ defineProperties_1(implementation$2, {
19061
+ getPolyfill: polyfill,
19062
+ implementation: implementation$2,
19063
+ shim: shim
19064
+ });
19065
+
19066
+ var object_getownpropertydescriptors = implementation$2;
19067
+
19068
+ /* globals
19069
+ Atomics,
19070
+ SharedArrayBuffer,
19071
+ */
19072
+
19073
+ var undefined$2;
19074
+
19075
+ var $TypeError$4 = TypeError;
19076
+
19077
+ var $gOPD$3 = Object.getOwnPropertyDescriptor;
19078
+ if ($gOPD$3) {
19079
+ try {
19080
+ $gOPD$3({}, '');
19081
+ } catch (e) {
19082
+ $gOPD$3 = null; // this is IE 8, which has a broken gOPD
19083
+ }
19084
+ }
19085
+
19086
+ var throwTypeError$1 = function () { throw new $TypeError$4(); };
19087
+ var ThrowTypeError$1 = $gOPD$3
19088
+ ? (function () {
19089
+ try {
19090
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
19091
+ arguments.callee; // IE 8 does not throw here
19092
+ return throwTypeError$1;
19093
+ } catch (calleeThrows) {
19094
+ try {
19095
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
19096
+ return $gOPD$3(arguments, 'callee').get;
19097
+ } catch (gOPDthrows) {
19098
+ return throwTypeError$1;
19099
+ }
19100
+ }
19101
+ }())
19102
+ : throwTypeError$1;
19103
+
19104
+ var hasSymbols$3 = hasSymbols$1();
19105
+
19106
+ var getProto$1 = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
19107
+ var generatorFunction$1 = undefined$2;
19108
+ var asyncFunction$1 = undefined$2;
19109
+ var asyncGenFunction$1 = undefined$2;
19110
+
19111
+ var TypedArray$1 = typeof Uint8Array === 'undefined' ? undefined$2 : getProto$1(Uint8Array);
19112
+
19113
+ var INTRINSICS$1 = {
19114
+ '%Array%': Array,
19115
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$2 : ArrayBuffer,
19116
+ '%ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined$2 : ArrayBuffer.prototype,
19117
+ '%ArrayIteratorPrototype%': hasSymbols$3 ? getProto$1([][Symbol.iterator]()) : undefined$2,
19118
+ '%ArrayPrototype%': Array.prototype,
19119
+ '%ArrayProto_entries%': Array.prototype.entries,
19120
+ '%ArrayProto_forEach%': Array.prototype.forEach,
19121
+ '%ArrayProto_keys%': Array.prototype.keys,
19122
+ '%ArrayProto_values%': Array.prototype.values,
19123
+ '%AsyncFromSyncIteratorPrototype%': undefined$2,
19124
+ '%AsyncFunction%': asyncFunction$1,
19125
+ '%AsyncFunctionPrototype%': undefined$2,
19126
+ '%AsyncGenerator%': undefined$2,
19127
+ '%AsyncGeneratorFunction%': asyncGenFunction$1,
19128
+ '%AsyncGeneratorPrototype%': undefined$2,
19129
+ '%AsyncIteratorPrototype%': undefined$2,
19130
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$2 : Atomics,
19131
+ '%Boolean%': Boolean,
19132
+ '%BooleanPrototype%': Boolean.prototype,
19133
+ '%DataView%': typeof DataView === 'undefined' ? undefined$2 : DataView,
19134
+ '%DataViewPrototype%': typeof DataView === 'undefined' ? undefined$2 : DataView.prototype,
19135
+ '%Date%': Date,
19136
+ '%DatePrototype%': Date.prototype,
19137
+ '%decodeURI%': decodeURI,
19138
+ '%decodeURIComponent%': decodeURIComponent,
19139
+ '%encodeURI%': encodeURI,
19140
+ '%encodeURIComponent%': encodeURIComponent,
19141
+ '%Error%': Error,
19142
+ '%ErrorPrototype%': Error.prototype,
19143
+ '%eval%': eval, // eslint-disable-line no-eval
19144
+ '%EvalError%': EvalError,
19145
+ '%EvalErrorPrototype%': EvalError.prototype,
19146
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$2 : Float32Array,
19147
+ '%Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined$2 : Float32Array.prototype,
19148
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$2 : Float64Array,
19149
+ '%Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined$2 : Float64Array.prototype,
19150
+ '%Function%': Function,
19151
+ '%FunctionPrototype%': Function.prototype,
19152
+ '%Generator%': undefined$2,
19153
+ '%GeneratorFunction%': generatorFunction$1,
19154
+ '%GeneratorPrototype%': undefined$2,
19155
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$2 : Int8Array,
19156
+ '%Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined$2 : Int8Array.prototype,
19157
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$2 : Int16Array,
19158
+ '%Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined$2 : Int8Array.prototype,
19159
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$2 : Int32Array,
19160
+ '%Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined$2 : Int32Array.prototype,
19161
+ '%isFinite%': isFinite,
19162
+ '%isNaN%': isNaN,
19163
+ '%IteratorPrototype%': hasSymbols$3 ? getProto$1(getProto$1([][Symbol.iterator]())) : undefined$2,
19164
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$2,
19165
+ '%JSONParse%': typeof JSON === 'object' ? JSON.parse : undefined$2,
19166
+ '%Map%': typeof Map === 'undefined' ? undefined$2 : Map,
19167
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$3 ? undefined$2 : getProto$1(new Map()[Symbol.iterator]()),
19168
+ '%MapPrototype%': typeof Map === 'undefined' ? undefined$2 : Map.prototype,
19169
+ '%Math%': Math,
19170
+ '%Number%': Number,
19171
+ '%NumberPrototype%': Number.prototype,
19172
+ '%Object%': Object,
19173
+ '%ObjectPrototype%': Object.prototype,
19174
+ '%ObjProto_toString%': Object.prototype.toString,
19175
+ '%ObjProto_valueOf%': Object.prototype.valueOf,
19176
+ '%parseFloat%': parseFloat,
19177
+ '%parseInt%': parseInt,
19178
+ '%Promise%': typeof Promise === 'undefined' ? undefined$2 : Promise,
19179
+ '%PromisePrototype%': typeof Promise === 'undefined' ? undefined$2 : Promise.prototype,
19180
+ '%PromiseProto_then%': typeof Promise === 'undefined' ? undefined$2 : Promise.prototype.then,
19181
+ '%Promise_all%': typeof Promise === 'undefined' ? undefined$2 : Promise.all,
19182
+ '%Promise_reject%': typeof Promise === 'undefined' ? undefined$2 : Promise.reject,
19183
+ '%Promise_resolve%': typeof Promise === 'undefined' ? undefined$2 : Promise.resolve,
19184
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$2 : Proxy,
19185
+ '%RangeError%': RangeError,
19186
+ '%RangeErrorPrototype%': RangeError.prototype,
19187
+ '%ReferenceError%': ReferenceError,
19188
+ '%ReferenceErrorPrototype%': ReferenceError.prototype,
19189
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$2 : Reflect,
19190
+ '%RegExp%': RegExp,
19191
+ '%RegExpPrototype%': RegExp.prototype,
19192
+ '%Set%': typeof Set === 'undefined' ? undefined$2 : Set,
19193
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$3 ? undefined$2 : getProto$1(new Set()[Symbol.iterator]()),
19194
+ '%SetPrototype%': typeof Set === 'undefined' ? undefined$2 : Set.prototype,
19195
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$2 : SharedArrayBuffer,
19196
+ '%SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined$2 : SharedArrayBuffer.prototype,
19197
+ '%String%': String,
19198
+ '%StringIteratorPrototype%': hasSymbols$3 ? getProto$1(''[Symbol.iterator]()) : undefined$2,
19199
+ '%StringPrototype%': String.prototype,
19200
+ '%Symbol%': hasSymbols$3 ? Symbol : undefined$2,
19201
+ '%SymbolPrototype%': hasSymbols$3 ? Symbol.prototype : undefined$2,
19202
+ '%SyntaxError%': SyntaxError,
19203
+ '%SyntaxErrorPrototype%': SyntaxError.prototype,
19204
+ '%ThrowTypeError%': ThrowTypeError$1,
19205
+ '%TypedArray%': TypedArray$1,
19206
+ '%TypedArrayPrototype%': TypedArray$1 ? TypedArray$1.prototype : undefined$2,
19207
+ '%TypeError%': $TypeError$4,
19208
+ '%TypeErrorPrototype%': $TypeError$4.prototype,
19209
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$2 : Uint8Array,
19210
+ '%Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined$2 : Uint8Array.prototype,
19211
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$2 : Uint8ClampedArray,
19212
+ '%Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined$2 : Uint8ClampedArray.prototype,
19213
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$2 : Uint16Array,
19214
+ '%Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined$2 : Uint16Array.prototype,
19215
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$2 : Uint32Array,
19216
+ '%Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined$2 : Uint32Array.prototype,
19217
+ '%URIError%': URIError,
19218
+ '%URIErrorPrototype%': URIError.prototype,
19219
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$2 : WeakMap,
19220
+ '%WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined$2 : WeakMap.prototype,
19221
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$2 : WeakSet,
19222
+ '%WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined$2 : WeakSet.prototype
19223
+ };
19224
+
19225
+
19226
+ var $replace$1 = functionBind.call(Function.call, String.prototype.replace);
19227
+
19228
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
19229
+ var rePropName$1 = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
19230
+ var reEscapeChar$1 = /\\(\\)?/g; /** Used to match backslashes in property paths. */
19231
+ var stringToPath$1 = function stringToPath(string) {
19232
+ var result = [];
19233
+ $replace$1(string, rePropName$1, function (match, number, quote, subString) {
19234
+ result[result.length] = quote ? $replace$1(subString, reEscapeChar$1, '$1') : (number || match);
19235
+ });
19236
+ return result;
19237
+ };
19238
+ /* end adaptation */
19239
+
19240
+ var getBaseIntrinsic$1 = function getBaseIntrinsic(name, allowMissing) {
19241
+ if (!(name in INTRINSICS$1)) {
19242
+ throw new SyntaxError('intrinsic ' + name + ' does not exist!');
19243
+ }
19244
+
19245
+ // istanbul ignore if // hopefully this is impossible to test :-)
19246
+ if (typeof INTRINSICS$1[name] === 'undefined' && !allowMissing) {
19247
+ throw new $TypeError$4('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
19248
+ }
19249
+
19250
+ return INTRINSICS$1[name];
19251
+ };
19252
+
19253
+ var GetIntrinsic$1 = function GetIntrinsic(name, allowMissing) {
19254
+ if (typeof name !== 'string' || name.length === 0) {
19255
+ throw new TypeError('intrinsic name must be a non-empty string');
19256
+ }
19257
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
19258
+ throw new TypeError('"allowMissing" argument must be a boolean');
19259
+ }
19260
+
19261
+ var parts = stringToPath$1(name);
19262
+
19263
+ var value = getBaseIntrinsic$1('%' + (parts.length > 0 ? parts[0] : '') + '%', allowMissing);
19264
+ for (var i = 1; i < parts.length; i += 1) {
19265
+ if (value != null) {
19266
+ if ($gOPD$3 && (i + 1) >= parts.length) {
19267
+ var desc = $gOPD$3(value, parts[i]);
19268
+ if (!allowMissing && !(parts[i] in value)) {
19269
+ throw new $TypeError$4('base intrinsic for ' + name + ' exists, but the property is not available.');
19270
+ }
19271
+ value = desc ? (desc.get || desc.value) : value[parts[i]];
19272
+ } else {
19273
+ value = value[parts[i]];
19274
+ }
19275
+ }
19276
+ }
19277
+ return value;
19278
+ };
19279
+
19280
+ var $apply$1 = GetIntrinsic$1('%Function.prototype.apply%');
19281
+ var $call$1 = GetIntrinsic$1('%Function.prototype.call%');
19282
+ var $reflectApply = GetIntrinsic$1('%Reflect.apply%', true) || functionBind.call($call$1, $apply$1);
19283
+
19284
+ var callBind$1 = function callBind() {
19285
+ return $reflectApply(functionBind, $call$1, arguments);
19286
+ };
19287
+
19288
+ var apply$1 = function applyBind() {
19289
+ return $reflectApply(functionBind, $apply$1, arguments);
19290
+ };
19291
+ callBind$1.apply = apply$1;
19292
+
19293
+ var $indexOf$1 = callBind$1(GetIntrinsic$1('String.prototype.indexOf'));
19294
+
19295
+ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
19296
+ var intrinsic = GetIntrinsic$1(name, !!allowMissing);
19297
+ if (typeof intrinsic === 'function' && $indexOf$1(name, '.prototype.')) {
19298
+ return callBind$1(intrinsic);
19299
+ }
19300
+ return intrinsic;
19301
+ };
19302
+
19303
+ var isES5$1 = typeof Object.defineProperty === 'function'
19304
+ && typeof Object.defineProperties === 'function';
19305
+
19306
+ var hasProto = [].__proto__ === Array.prototype; // eslint-disable-line no-proto
19307
+
19308
+ if (!isES5$1 || !hasProto) {
19309
+ throw new TypeError('util.promisify requires a true ES5 environment, that also supports `__proto__`');
19310
+ }
19311
+
19312
+
19313
+
19314
+ if (typeof Promise !== 'function') {
19315
+ throw new TypeError('`Promise` must be globally available for util.promisify to work.');
19316
+ }
19317
+
19318
+
19319
+
19320
+ var $slice = callBound$1('Array.prototype.slice');
19321
+ var $concat$1 = callBound$1('Array.prototype.concat');
19322
+ var $forEach = callBound$1('Array.prototype.forEach');
19323
+
19324
+ var hasSymbols$4 = hasSymbols$1();
19325
+
19326
+ var kCustomPromisifiedSymbol = hasSymbols$4 ? Symbol('util.promisify.custom') : null;
19327
+ var kCustomPromisifyArgsSymbol = hasSymbols$4 ? Symbol('customPromisifyArgs') : null;
19328
+
19329
+ var implementation$3 = function promisify(orig) {
19330
+ if (typeof orig !== 'function') {
19331
+ var error = new TypeError('The "original" argument must be of type function');
19332
+ error.name = 'TypeError [ERR_INVALID_ARG_TYPE]';
19333
+ error.code = 'ERR_INVALID_ARG_TYPE';
19334
+ throw error;
19335
+ }
19336
+
19337
+ if (hasSymbols$4 && orig[kCustomPromisifiedSymbol]) {
19338
+ var customFunction = orig[kCustomPromisifiedSymbol];
19339
+ if (typeof customFunction !== 'function') {
19340
+ throw new TypeError('The [util.promisify.custom] property must be a function');
19341
+ }
19342
+ Object.defineProperty(customFunction, kCustomPromisifiedSymbol, {
19343
+ configurable: true,
19344
+ enumerable: false,
19345
+ value: customFunction,
19346
+ writable: false
19347
+ });
19348
+ return customFunction;
19349
+ }
19350
+
19351
+ // Names to create an object from in case the callback receives multiple
19352
+ // arguments, e.g. ['stdout', 'stderr'] for child_process.exec.
19353
+ var argumentNames = orig[kCustomPromisifyArgsSymbol];
19354
+
19355
+ var promisified = function fn() {
19356
+ var args = $slice(arguments);
19357
+ var self = this; // eslint-disable-line no-invalid-this
19358
+ return new Promise(function (resolve, reject) {
19359
+ orig.apply(self, $concat$1(args, function (err) {
19360
+ var values = arguments.length > 1 ? $slice(arguments, 1) : [];
19361
+ if (err) {
19362
+ reject(err);
19363
+ } else if (typeof argumentNames !== 'undefined' && values.length > 1) {
19364
+ var obj = {};
19365
+ $forEach(argumentNames, function (name, index) {
19366
+ obj[name] = values[index];
19367
+ });
19368
+ resolve(obj);
19369
+ } else {
19370
+ resolve(values[0]);
19371
+ }
19372
+ }));
19373
+ });
19374
+ };
19375
+
19376
+ promisified.__proto__ = orig.__proto__; // eslint-disable-line no-proto
19377
+
19378
+ Object.defineProperty(promisified, kCustomPromisifiedSymbol, {
19379
+ configurable: true,
19380
+ enumerable: false,
19381
+ value: promisified,
19382
+ writable: false
19383
+ });
19384
+ return Object.defineProperties(promisified, object_getownpropertydescriptors(orig));
19385
+ };
19386
+
19387
+ var custom = kCustomPromisifiedSymbol;
19388
+ var customPromisifyArgs = kCustomPromisifyArgsSymbol;
19389
+ implementation$3.custom = custom;
19390
+ implementation$3.customPromisifyArgs = customPromisifyArgs;
19391
+
19392
+ var polyfill$1 = function getPolyfill() {
19393
+ if (typeof util.promisify === 'function') {
19394
+ return util.promisify;
19395
+ }
19396
+ return implementation$3;
19397
+ };
19398
+
19399
+ var shim$1 = function shimUtilPromisify() {
19400
+ var polyfill = polyfill$1();
19401
+ if (polyfill !== util.promisify) {
19402
+ Object.defineProperty(util, 'promisify', {
19403
+ configurable: true,
19404
+ enumerable: true,
19405
+ value: polyfill,
19406
+ writable: true
19407
+ });
19408
+ }
19409
+ return polyfill;
19410
+ };
19411
+
19412
+ var polyfill$2 = polyfill$1();
19413
+
19414
+
19415
+ /* eslint-disable no-unused-vars */
19416
+ var boundPromisify = function promisify(orig) {
19417
+ /* eslint-enable no-unused-vars */
19418
+ return polyfill$2.apply(util, arguments);
19419
+ };
19420
+ defineProperties_1(boundPromisify, {
19421
+ custom: polyfill$2.custom,
19422
+ customPromisifyArgs: polyfill$2.customPromisifyArgs,
19423
+ getPolyfill: polyfill$1,
19424
+ implementation: implementation$3,
19425
+ shim: shim$1
19426
+ });
19427
+
19428
+ var util_promisify = boundPromisify;
19429
+
19430
+ util_promisify.shim();
19431
+
19432
+ function connect() {
19433
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
19434
+
19435
+ if (!config) {
19436
+ config = {
19437
+ host: 'sanity-datasource.cluster-crao688bsrdh.us-east-1.rds.amazonaws.com',
19438
+ user: 'nasp',
19439
+ password: 'uRNkF9SkfXQs6AKK',
19440
+ database: 'user'
19441
+ };
19442
+ }
19443
+
19444
+ var connection = mysql.createConnection(config);
19445
+ return {
19446
+ query: function query(sql, args) {
19447
+ return util.promisify(connection.query).call(connection, sql, args);
19448
+ },
19449
+ beginTransaction: function beginTransaction() {
19450
+ return util.promisify(connection.beginTransaction).call(connection);
19451
+ },
19452
+ commit: function commit() {
19453
+ return util.promisify(connection.commit).call(connection);
19454
+ },
19455
+ rollback: function rollback() {
19456
+ return util.promisify(connection.rollback).call(connection);
19457
+ },
19458
+ close: function close() {
19459
+ return util.promisify(connection.end).call(connection);
19460
+ }
19461
+ };
19462
+ }
19463
+
19464
+ var db = connect;
19465
+
19466
+ var crypt = _commonjsHelpers.createCommonjsModule(function (module) {
19467
+ (function() {
19468
+ var base64map
19469
+ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
19470
+
19471
+ crypt = {
19472
+ // Bit-wise rotation left
19473
+ rotl: function(n, b) {
19474
+ return (n << b) | (n >>> (32 - b));
19475
+ },
19476
+
19477
+ // Bit-wise rotation right
19478
+ rotr: function(n, b) {
19479
+ return (n << (32 - b)) | (n >>> b);
19480
+ },
19481
+
19482
+ // Swap big-endian to little-endian and vice versa
19483
+ endian: function(n) {
19484
+ // If number given, swap endian
19485
+ if (n.constructor == Number) {
19486
+ return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
19487
+ }
19488
+
19489
+ // Else, assume array and swap all items
19490
+ for (var i = 0; i < n.length; i++)
19491
+ n[i] = crypt.endian(n[i]);
19492
+ return n;
19493
+ },
19494
+
19495
+ // Generate an array of any length of random bytes
19496
+ randomBytes: function(n) {
19497
+ for (var bytes = []; n > 0; n--)
19498
+ bytes.push(Math.floor(Math.random() * 256));
19499
+ return bytes;
19500
+ },
19501
+
19502
+ // Convert a byte array to big-endian 32-bit words
19503
+ bytesToWords: function(bytes) {
19504
+ for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
19505
+ words[b >>> 5] |= bytes[i] << (24 - b % 32);
19506
+ return words;
19507
+ },
19508
+
19509
+ // Convert big-endian 32-bit words to a byte array
19510
+ wordsToBytes: function(words) {
19511
+ for (var bytes = [], b = 0; b < words.length * 32; b += 8)
19512
+ bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
19513
+ return bytes;
19514
+ },
19515
+
19516
+ // Convert a byte array to a hex string
19517
+ bytesToHex: function(bytes) {
19518
+ for (var hex = [], i = 0; i < bytes.length; i++) {
19519
+ hex.push((bytes[i] >>> 4).toString(16));
19520
+ hex.push((bytes[i] & 0xF).toString(16));
19521
+ }
19522
+ return hex.join('');
19523
+ },
19524
+
19525
+ // Convert a hex string to a byte array
19526
+ hexToBytes: function(hex) {
19527
+ for (var bytes = [], c = 0; c < hex.length; c += 2)
19528
+ bytes.push(parseInt(hex.substr(c, 2), 16));
19529
+ return bytes;
19530
+ },
19531
+
19532
+ // Convert a byte array to a base-64 string
19533
+ bytesToBase64: function(bytes) {
19534
+ for (var base64 = [], i = 0; i < bytes.length; i += 3) {
19535
+ var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
19536
+ for (var j = 0; j < 4; j++)
19537
+ if (i * 8 + j * 6 <= bytes.length * 8)
19538
+ base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
19539
+ else
19540
+ base64.push('=');
19541
+ }
19542
+ return base64.join('');
19543
+ },
19544
+
19545
+ // Convert a base-64 string to a byte array
19546
+ base64ToBytes: function(base64) {
19547
+ // Remove non-base-64 characters
19548
+ base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
19549
+
19550
+ for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
19551
+ imod4 = ++i % 4) {
19552
+ if (imod4 == 0) continue;
19553
+ bytes.push(((base64map.indexOf(base64.charAt(i - 1))
19554
+ & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
19555
+ | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
19556
+ }
19557
+ return bytes;
19558
+ }
19559
+ };
19560
+
19561
+ module.exports = crypt;
19562
+ })();
19563
+ });
19564
+
19565
+ var charenc = {
19566
+ // UTF-8 encoding
19567
+ utf8: {
19568
+ // Convert a string to a byte array
19569
+ stringToBytes: function(str) {
19570
+ return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
19571
+ },
19572
+
19573
+ // Convert a byte array to a string
19574
+ bytesToString: function(bytes) {
19575
+ return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
19576
+ }
19577
+ },
19578
+
19579
+ // Binary encoding
19580
+ bin: {
19581
+ // Convert a string to a byte array
19582
+ stringToBytes: function(str) {
19583
+ for (var bytes = [], i = 0; i < str.length; i++)
19584
+ bytes.push(str.charCodeAt(i) & 0xFF);
19585
+ return bytes;
19586
+ },
19587
+
19588
+ // Convert a byte array to a string
19589
+ bytesToString: function(bytes) {
19590
+ for (var str = [], i = 0; i < bytes.length; i++)
19591
+ str.push(String.fromCharCode(bytes[i]));
19592
+ return str.join('');
19593
+ }
19594
+ }
19595
+ };
19596
+
19597
+ var charenc_1 = charenc;
19598
+
19599
+ /*!
19600
+ * Determine if an object is a Buffer
19601
+ *
19602
+ * @author Feross Aboukhadijeh <https://feross.org>
19603
+ * @license MIT
19604
+ */
19605
+
19606
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
19607
+ // Object.prototype.constructor. Remove this eventually
19608
+ var isBuffer_1$1 = function (obj) {
19609
+ return obj != null && (isBuffer$1(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
19610
+ };
19611
+
19612
+ function isBuffer$1 (obj) {
19613
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
19614
+ }
19615
+
19616
+ // For Node v0.10 support. Remove this eventually.
19617
+ function isSlowBuffer (obj) {
19618
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer$1(obj.slice(0, 0))
19619
+ }
19620
+
19621
+ var md5 = _commonjsHelpers.createCommonjsModule(function (module) {
19622
+ (function(){
19623
+ var crypt$1 = crypt,
19624
+ utf8 = charenc_1.utf8,
19625
+ isBuffer = isBuffer_1$1,
19626
+ bin = charenc_1.bin,
19627
+
19628
+ // The core
19629
+ md5 = function (message, options) {
19630
+ // Convert to byte array
19631
+ if (message.constructor == String)
19632
+ if (options && options.encoding === 'binary')
19633
+ message = bin.stringToBytes(message);
19634
+ else
19635
+ message = utf8.stringToBytes(message);
19636
+ else if (isBuffer(message))
19637
+ message = Array.prototype.slice.call(message, 0);
19638
+ else if (!Array.isArray(message))
19639
+ message = message.toString();
19640
+ // else, assume byte array already
19641
+
19642
+ var m = crypt$1.bytesToWords(message),
19643
+ l = message.length * 8,
19644
+ a = 1732584193,
19645
+ b = -271733879,
19646
+ c = -1732584194,
19647
+ d = 271733878;
19648
+
19649
+ // Swap endian
19650
+ for (var i = 0; i < m.length; i++) {
19651
+ m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
19652
+ ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
19653
+ }
19654
+
19655
+ // Padding
19656
+ m[l >>> 5] |= 0x80 << (l % 32);
19657
+ m[(((l + 64) >>> 9) << 4) + 14] = l;
19658
+
19659
+ // Method shortcuts
19660
+ var FF = md5._ff,
19661
+ GG = md5._gg,
19662
+ HH = md5._hh,
19663
+ II = md5._ii;
19664
+
19665
+ for (var i = 0; i < m.length; i += 16) {
19666
+
19667
+ var aa = a,
19668
+ bb = b,
19669
+ cc = c,
19670
+ dd = d;
19671
+
19672
+ a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
19673
+ d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
19674
+ c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
19675
+ b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
19676
+ a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
19677
+ d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
19678
+ c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
19679
+ b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
19680
+ a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
19681
+ d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
19682
+ c = FF(c, d, a, b, m[i+10], 17, -42063);
19683
+ b = FF(b, c, d, a, m[i+11], 22, -1990404162);
19684
+ a = FF(a, b, c, d, m[i+12], 7, 1804603682);
19685
+ d = FF(d, a, b, c, m[i+13], 12, -40341101);
19686
+ c = FF(c, d, a, b, m[i+14], 17, -1502002290);
19687
+ b = FF(b, c, d, a, m[i+15], 22, 1236535329);
19688
+
19689
+ a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
19690
+ d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
19691
+ c = GG(c, d, a, b, m[i+11], 14, 643717713);
19692
+ b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
19693
+ a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
19694
+ d = GG(d, a, b, c, m[i+10], 9, 38016083);
19695
+ c = GG(c, d, a, b, m[i+15], 14, -660478335);
19696
+ b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
19697
+ a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
19698
+ d = GG(d, a, b, c, m[i+14], 9, -1019803690);
19699
+ c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
19700
+ b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
19701
+ a = GG(a, b, c, d, m[i+13], 5, -1444681467);
19702
+ d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
19703
+ c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
19704
+ b = GG(b, c, d, a, m[i+12], 20, -1926607734);
19705
+
19706
+ a = HH(a, b, c, d, m[i+ 5], 4, -378558);
19707
+ d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
19708
+ c = HH(c, d, a, b, m[i+11], 16, 1839030562);
19709
+ b = HH(b, c, d, a, m[i+14], 23, -35309556);
19710
+ a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
19711
+ d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
19712
+ c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
19713
+ b = HH(b, c, d, a, m[i+10], 23, -1094730640);
19714
+ a = HH(a, b, c, d, m[i+13], 4, 681279174);
19715
+ d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
19716
+ c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
19717
+ b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
19718
+ a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
19719
+ d = HH(d, a, b, c, m[i+12], 11, -421815835);
19720
+ c = HH(c, d, a, b, m[i+15], 16, 530742520);
19721
+ b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
19722
+
19723
+ a = II(a, b, c, d, m[i+ 0], 6, -198630844);
19724
+ d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
19725
+ c = II(c, d, a, b, m[i+14], 15, -1416354905);
19726
+ b = II(b, c, d, a, m[i+ 5], 21, -57434055);
19727
+ a = II(a, b, c, d, m[i+12], 6, 1700485571);
19728
+ d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
19729
+ c = II(c, d, a, b, m[i+10], 15, -1051523);
19730
+ b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
19731
+ a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
19732
+ d = II(d, a, b, c, m[i+15], 10, -30611744);
19733
+ c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
19734
+ b = II(b, c, d, a, m[i+13], 21, 1309151649);
19735
+ a = II(a, b, c, d, m[i+ 4], 6, -145523070);
19736
+ d = II(d, a, b, c, m[i+11], 10, -1120210379);
19737
+ c = II(c, d, a, b, m[i+ 2], 15, 718787259);
19738
+ b = II(b, c, d, a, m[i+ 9], 21, -343485551);
19739
+
19740
+ a = (a + aa) >>> 0;
19741
+ b = (b + bb) >>> 0;
19742
+ c = (c + cc) >>> 0;
19743
+ d = (d + dd) >>> 0;
19744
+ }
19745
+
19746
+ return crypt$1.endian([a, b, c, d]);
19747
+ };
19748
+
19749
+ // Auxiliary functions
19750
+ md5._ff = function (a, b, c, d, x, s, t) {
19751
+ var n = a + (b & c | ~b & d) + (x >>> 0) + t;
19752
+ return ((n << s) | (n >>> (32 - s))) + b;
19753
+ };
19754
+ md5._gg = function (a, b, c, d, x, s, t) {
19755
+ var n = a + (b & d | c & ~d) + (x >>> 0) + t;
19756
+ return ((n << s) | (n >>> (32 - s))) + b;
19757
+ };
19758
+ md5._hh = function (a, b, c, d, x, s, t) {
19759
+ var n = a + (b ^ c ^ d) + (x >>> 0) + t;
19760
+ return ((n << s) | (n >>> (32 - s))) + b;
19761
+ };
19762
+ md5._ii = function (a, b, c, d, x, s, t) {
19763
+ var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
19764
+ return ((n << s) | (n >>> (32 - s))) + b;
19765
+ };
19766
+
19767
+ // Package private blocksize
19768
+ md5._blocksize = 16;
19769
+ md5._digestsize = 16;
19770
+
19771
+ module.exports = function (message, options) {
19772
+ if (message === undefined || message === null)
19773
+ throw new Error('Illegal argument ' + message);
19774
+
19775
+ var digestbytes = crypt$1.wordsToBytes(md5(message, options));
19776
+ return options && options.asBytes ? digestbytes :
19777
+ options && options.asString ? bin.bytesToString(digestbytes) :
19778
+ crypt$1.bytesToHex(digestbytes);
19779
+ };
19780
+
19781
+ })();
19782
+ });
19783
+
19784
+ var _this$3 = undefined;
19785
+
19786
+ var config = {
19787
+ host: 'sanity-datasource.cluster-crao688bsrdh.us-east-1.rds.amazonaws.com',
19788
+ user: 'nasp',
19789
+ password: 'uRNkF9SkfXQs6AKK',
19790
+ database: 'user'
19791
+ };
19792
+
19793
+ var findUser = function () {
19794
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee(email) {
19795
+ var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
19796
+ var db$1, query, res, user, hash, passwordsMatch, user_shared, occupation_id;
19797
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
19798
+ while (1) {
19799
+ switch (_context.prev = _context.next) {
19800
+ case 0:
19801
+ db$1 = null;
19802
+ _context.prev = 1;
19803
+
19804
+
19805
+ db$1 = db(config);
19806
+
19807
+ query = '\n select * \n from user \n where trim(lower(email)) = ?\n ';
19808
+ _context.next = 6;
19809
+ return db$1.query(query, [email.toLowerCase().trim()]);
19810
+
19811
+ case 6:
19812
+ res = _context.sent;
19813
+ user = res.length > 0 ? res[0] : null;
19814
+
19815
+ if (user) {
19816
+ _context.next = 10;
19817
+ break;
19818
+ }
19819
+
19820
+ throw new Error('Invalid credential provided');
19821
+
19822
+ case 10:
19823
+ if (!password) {
19824
+ _context.next = 15;
19825
+ break;
19826
+ }
19827
+
19828
+ hash = md5(password);
19829
+ passwordsMatch = hash === user.password;
19830
+
19831
+ if (passwordsMatch) {
19832
+ _context.next = 15;
19833
+ break;
19834
+ }
19835
+
19836
+ throw new Error('Password doesn\'t match');
19837
+
19838
+ case 15:
19839
+
19840
+ query = '\n select * \n from user_shared \n where user_id = ?\n ';
19841
+ _context.next = 18;
19842
+ return db$1.query(query, [user.id]);
19843
+
19844
+ case 18:
19845
+ res = _context.sent;
19846
+ user_shared = res.length > 0 ? res[0] : null;
19847
+
19848
+ user.shared = user_shared;
19849
+
19850
+ // occupation
19851
+ query = '\n select id \n from occupation \n where name = ?\n ';
19852
+ _context.next = 24;
19853
+ return db$1.query(query, [user_shared.occupation]);
19854
+
19855
+ case 24:
19856
+ res = _context.sent;
19857
+ occupation_id = res.length > 0 ? res[0].id : '';
19858
+
19859
+ user.shared.occupation_id = occupation_id;
19860
+
19861
+ _context.next = 29;
19862
+ return db$1.close();
19863
+
19864
+ case 29:
19865
+ return _context.abrupt('return', {
19866
+ error: '',
19867
+ user: user
19868
+ });
19869
+
19870
+ case 32:
19871
+ _context.prev = 32;
19872
+ _context.t0 = _context['catch'](1);
19873
+
19874
+ if (!db$1) {
19875
+ _context.next = 37;
19876
+ break;
19877
+ }
19878
+
19879
+ _context.next = 37;
19880
+ return db$1.close();
19881
+
19882
+ case 37:
19883
+ return _context.abrupt('return', {
19884
+ error: _context.t0.message,
19885
+ user: null
19886
+ });
19887
+
19888
+ case 38:
19889
+ case 'end':
19890
+ return _context.stop();
19891
+ }
19892
+ }
19893
+ }, _callee, this, [[1, 32]]);
19894
+ }));
19895
+
19896
+ return function findUser(_x) {
19897
+ return _ref.apply(this, arguments);
19898
+ };
19899
+ }();
19900
+
19901
+ var updateUser = function () {
19902
+ var _ref2 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee2(data) {
19903
+ var db$1, query, res, hash, columns, i, column, occupation_name;
19904
+ return AdSlot.regenerator.wrap(function _callee2$(_context2) {
19905
+ while (1) {
19906
+ switch (_context2.prev = _context2.next) {
19907
+ case 0:
19908
+ db$1 = null;
19909
+ _context2.prev = 1;
19910
+
19911
+
19912
+ validateUserData(data);
19913
+
19914
+ db$1 = db(config);
19915
+
19916
+ _context2.next = 6;
19917
+ return db$1.beginTransaction();
19918
+
19919
+ case 6:
19920
+ if (data.user_id) {
19921
+ _context2.next = 8;
19922
+ break;
19923
+ }
19924
+
19925
+ throw new Error('Please provide user ID');
19926
+
19927
+ case 8:
19928
+
19929
+ data.email = data.email.toLowerCase().trim();
19930
+
19931
+ // check if new email is taken
19932
+ query = '\n select * \n from user \n where lower(trim(email)) = ?\n and id != ?\n ';
19933
+ _context2.next = 12;
19934
+ return db$1.query(query, [data.email, data.user_id]);
19935
+
19936
+ case 12:
19937
+ res = _context2.sent;
19938
+
19939
+ if (!(res && res.length > 0)) {
19940
+ _context2.next = 15;
19941
+ break;
19942
+ }
19943
+
19944
+ throw new Error('Email already taken');
19945
+
19946
+ case 15:
19947
+ if (!data.password) {
19948
+ _context2.next = 23;
19949
+ break;
19950
+ }
19951
+
19952
+ hash = md5(data.password);
19953
+
19954
+ query = '\n update user \n set password = ?\n where user_id = ?\n ';
19955
+ _context2.next = 20;
19956
+ return db$1.query(query, [hash, data.user_id]);
19957
+
19958
+ case 20:
19959
+ res = _context2.sent;
19960
+
19961
+ if (!(!res || res.affectedRows < 1)) {
19962
+ _context2.next = 23;
19963
+ break;
19964
+ }
19965
+
19966
+ throw new Error('Failed to update password');
19967
+
19968
+ case 23:
19969
+
19970
+ query = 'show columns from user_shared';
19971
+ _context2.next = 26;
19972
+ return db$1.query(query);
19973
+
19974
+ case 26:
19975
+ columns = _context2.sent;
19976
+
19977
+
19978
+ for (i = 0; i < columns.length; i++) {
19979
+ column = columns[i].Field;
19980
+
19981
+ if (typeof data[column] === 'undefined') {
19982
+ data[column] = '';
19983
+ }
19984
+ }
19985
+
19986
+ // user_shared
19987
+ 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 ';
19988
+
19989
+ _context2.next = 31;
19990
+ return getOccupationNameById(db$1, data.occupation);
19991
+
19992
+ case 31:
19993
+ occupation_name = _context2.sent;
19994
+ _context2.next = 34;
19995
+ 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]);
19996
+
19997
+ case 34:
19998
+ res = _context2.sent;
19999
+
20000
+ if (!(!res || res.affectedRows < 1)) {
20001
+ _context2.next = 37;
20002
+ break;
20003
+ }
20004
+
20005
+ throw new Error('Failed to update user shared information record');
20006
+
20007
+ case 37:
20008
+ _context2.next = 39;
20009
+ return db$1.commit();
20010
+
20011
+ case 39:
20012
+ _context2.next = 41;
20013
+ return db$1.close();
20014
+
20015
+ case 41:
20016
+
20017
+ db$1 = null;
20018
+
20019
+ return _context2.abrupt('return', {
20020
+ error: '',
20021
+ user: findUser(data.email)
20022
+ });
20023
+
20024
+ case 45:
20025
+ _context2.prev = 45;
20026
+ _context2.t0 = _context2['catch'](1);
20027
+
20028
+
20029
+ console.log('error:', _context2.t0);
20030
+
20031
+ if (!db$1) {
20032
+ _context2.next = 53;
20033
+ break;
20034
+ }
20035
+
20036
+ _context2.next = 51;
20037
+ return db$1.rollback();
20038
+
20039
+ case 51:
20040
+ _context2.next = 53;
20041
+ return db$1.close();
20042
+
20043
+ case 53:
20044
+ return _context2.abrupt('return', {
20045
+ error: _context2.t0.message,
20046
+ user: null
20047
+ });
20048
+
20049
+ case 54:
20050
+ case 'end':
20051
+ return _context2.stop();
20052
+ }
20053
+ }
20054
+ }, _callee2, this, [[1, 45]]);
20055
+ }));
20056
+
20057
+ return function updateUser(_x3) {
20058
+ return _ref2.apply(this, arguments);
20059
+ };
20060
+ }();
20061
+
20062
+ var validateUserData = function validateUserData(data) {
20063
+ var requirePassword = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20064
+
20065
+ if (!data.email) {
20066
+ throw new Error('Email is required');
20067
+ }
20068
+
20069
+ if (requirePassword && !data.password) {
20070
+ throw new Error('Password is required');
20071
+ }
20072
+
20073
+ if (data.password && data.password !== data.rpassword) {
20074
+ throw new Error('Password does not match');
20075
+ }
20076
+
20077
+ if (!data.first_name) {
20078
+ throw new Error('First name is required');
20079
+ }
20080
+
20081
+ if (!data.last_name) {
20082
+ throw new Error('Last name is required');
20083
+ }
20084
+
20085
+ if (!data.country) {
20086
+ throw new Error('Country is required');
20087
+ }
20088
+
20089
+ if (data.country === 'United States') {
20090
+ if (!data.state) {
20091
+ throw new Error('State is required');
20092
+ }
20093
+
20094
+ if (!data.zip) {
20095
+ throw new Error('Zip code is required');
20096
+ }
20097
+
20098
+ if (!data.phone) {
20099
+ throw new Error('Phone is required');
20100
+ }
20101
+ }
20102
+ };
20103
+
20104
+ var getOccupationNameById = function () {
20105
+ var _ref3 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee3(db, occupation_id) {
20106
+ var query, res;
20107
+ return AdSlot.regenerator.wrap(function _callee3$(_context3) {
20108
+ while (1) {
20109
+ switch (_context3.prev = _context3.next) {
20110
+ case 0:
20111
+ query = '\n select name\n from occupation \n where id = ?\n ';
20112
+ _context3.next = 3;
20113
+ return db.query(query, [occupation_id]);
20114
+
20115
+ case 3:
20116
+ res = _context3.sent;
20117
+
20118
+ if (!(res && res.length > 0)) {
20119
+ _context3.next = 6;
20120
+ break;
20121
+ }
20122
+
20123
+ return _context3.abrupt('return', res[0].name);
20124
+
20125
+ case 6:
20126
+ throw new Error('Failed to get occupation name by ID: ' + occupation_id);
20127
+
20128
+ case 7:
20129
+ case 'end':
20130
+ return _context3.stop();
20131
+ }
20132
+ }
20133
+ }, _callee3, _this$3);
20134
+ }));
20135
+
20136
+ return function getOccupationNameById(_x5, _x6) {
20137
+ return _ref3.apply(this, arguments);
20138
+ };
20139
+ }();
20140
+
20141
+ var createUser = function () {
20142
+ var _ref4 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee4(data) {
20143
+ var db$1, query, res, hash, columns, i, column, user_id, occupation_name;
20144
+ return AdSlot.regenerator.wrap(function _callee4$(_context4) {
20145
+ while (1) {
20146
+ switch (_context4.prev = _context4.next) {
20147
+ case 0:
20148
+ db$1 = null;
20149
+ _context4.prev = 1;
20150
+
20151
+
20152
+ validateUserData(data, true);
20153
+
20154
+ db$1 = db(config);
20155
+
20156
+ _context4.next = 6;
20157
+ return db$1.beginTransaction();
20158
+
20159
+ case 6:
20160
+
20161
+ data.email = data.email.toLowerCase().trim();
20162
+
20163
+ // check if user exists
20164
+ query = '\n select * \n from user \n where lower(trim(email)) = ?\n ';
20165
+ _context4.next = 10;
20166
+ return db$1.query(query, [data.email]);
20167
+
20168
+ case 10:
20169
+ res = _context4.sent;
20170
+
20171
+ if (!(res && res.length > 0)) {
20172
+ _context4.next = 13;
20173
+ break;
20174
+ }
20175
+
20176
+ throw new Error('User already exists');
20177
+
20178
+ case 13:
20179
+ hash = md5(data.password);
20180
+
20181
+ // basic user info
20182
+
20183
+ query = '\n insert into user ( \n email, password, created\n ) values (\n ?, ?, current_timestamp\n )\n ';
20184
+ _context4.next = 17;
20185
+ return db$1.query(query, [data.email, hash]);
20186
+
20187
+ case 17:
20188
+ res = _context4.sent;
20189
+
20190
+ if (!(!res || res.insertId < 1)) {
20191
+ _context4.next = 20;
20192
+ break;
20193
+ }
20194
+
20195
+ throw new Error('Failed to create user');
20196
+
20197
+ case 20:
20198
+
20199
+ query = 'show columns from user_shared';
20200
+ _context4.next = 23;
20201
+ return db$1.query(query);
20202
+
20203
+ case 23:
20204
+ columns = _context4.sent;
20205
+
20206
+
20207
+ for (i = 0; i < columns.length; i++) {
20208
+ column = columns[i].Field;
20209
+
20210
+ if (typeof data[column] === 'undefined') {
20211
+ data[column] = '';
20212
+ }
20213
+ }
20214
+
20215
+ user_id = res.insertId;
20216
+
20217
+ // user_shared
20218
+
20219
+ 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 ';
20220
+
20221
+ _context4.next = 29;
20222
+ return getOccupationNameById(db$1, data.occupation);
20223
+
20224
+ case 29:
20225
+ occupation_name = _context4.sent;
20226
+ _context4.next = 32;
20227
+ 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]);
20228
+
20229
+ case 32:
20230
+ res = _context4.sent;
20231
+
20232
+ if (!(!res || res.affectedRows < 1)) {
20233
+ _context4.next = 35;
20234
+ break;
20235
+ }
20236
+
20237
+ throw new Error('Failed to create user shared information record');
20238
+
20239
+ case 35:
20240
+ _context4.next = 37;
20241
+ return db$1.commit();
20242
+
20243
+ case 37:
20244
+ _context4.next = 39;
20245
+ return db$1.close();
20246
+
20247
+ case 39:
20248
+ return _context4.abrupt('return', {
20249
+ error: '',
20250
+ user: findUser(data.email)
20251
+ });
20252
+
20253
+ case 42:
20254
+ _context4.prev = 42;
20255
+ _context4.t0 = _context4['catch'](1);
20256
+
20257
+ if (!db$1) {
20258
+ _context4.next = 49;
20259
+ break;
20260
+ }
20261
+
20262
+ _context4.next = 47;
20263
+ return db$1.rollback();
20264
+
20265
+ case 47:
20266
+ _context4.next = 49;
20267
+ return db$1.close();
20268
+
20269
+ case 49:
20270
+ return _context4.abrupt('return', {
20271
+ error: _context4.t0.message,
20272
+ user: null
20273
+ });
20274
+
20275
+ case 50:
20276
+ case 'end':
20277
+ return _context4.stop();
20278
+ }
20279
+ }
20280
+ }, _callee4, this, [[1, 42]]);
20281
+ }));
20282
+
20283
+ return function createUser(_x7) {
20284
+ return _ref4.apply(this, arguments);
20285
+ };
20286
+ }();
20287
+
20288
+ var createUser$1 = function () {
20289
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee(data) {
20290
+ var res;
20291
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
20292
+ while (1) {
20293
+ switch (_context.prev = _context.next) {
20294
+ case 0:
20295
+ _context.next = 2;
20296
+ return createUser(data);
20297
+
20298
+ case 2:
20299
+ res = _context.sent;
20300
+
20301
+ if (!res.error) {
20302
+ _context.next = 5;
20303
+ break;
20304
+ }
20305
+
20306
+ throw new Error(res.error);
20307
+
20308
+ case 5:
20309
+ return _context.abrupt('return', res.user);
20310
+
20311
+ case 6:
20312
+ case 'end':
20313
+ return _context.stop();
20314
+ }
20315
+ }
20316
+ }, _callee, this);
20317
+ }));
20318
+
20319
+ return function createUser(_x) {
20320
+ return _ref.apply(this, arguments);
20321
+ };
20322
+ }();
20323
+
20324
+ var updateUser$1 = function () {
20325
+ var _ref2 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee2(data) {
20326
+ var res;
20327
+ return AdSlot.regenerator.wrap(function _callee2$(_context2) {
20328
+ while (1) {
20329
+ switch (_context2.prev = _context2.next) {
20330
+ case 0:
20331
+ _context2.next = 2;
20332
+ return updateUser(data);
20333
+
20334
+ case 2:
20335
+ res = _context2.sent;
20336
+
20337
+ if (!res.error) {
20338
+ _context2.next = 5;
20339
+ break;
20340
+ }
20341
+
20342
+ throw new Error(res.error);
20343
+
20344
+ case 5:
20345
+ return _context2.abrupt('return', res.user);
20346
+
20347
+ case 6:
20348
+ case 'end':
20349
+ return _context2.stop();
20350
+ }
20351
+ }
20352
+ }, _callee2, this);
20353
+ }));
20354
+
20355
+ return function updateUser(_x2) {
20356
+ return _ref2.apply(this, arguments);
20357
+ };
20358
+ }();
20359
+
20360
+ var findUser$1 = function () {
20361
+ var _ref3 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee3(_ref4) {
20362
+ var email = _ref4.email,
20363
+ password = _ref4.password;
20364
+ var res;
20365
+ return AdSlot.regenerator.wrap(function _callee3$(_context3) {
20366
+ while (1) {
20367
+ switch (_context3.prev = _context3.next) {
20368
+ case 0:
20369
+ _context3.next = 2;
20370
+ return findUser(email, password);
20371
+
20372
+ case 2:
20373
+ res = _context3.sent;
20374
+
20375
+ if (!res.error) {
20376
+ _context3.next = 5;
20377
+ break;
20378
+ }
20379
+
20380
+ throw new Error(res.error);
20381
+
20382
+ case 5:
20383
+ return _context3.abrupt('return', res.user);
20384
+
20385
+ case 6:
20386
+ case 'end':
20387
+ return _context3.stop();
20388
+ }
20389
+ }
20390
+ }, _callee3, this);
20391
+ }));
20392
+
20393
+ return function findUser(_x3) {
20394
+ return _ref3.apply(this, arguments);
20395
+ };
20396
+ }();
20397
+
20398
+ var user = /*#__PURE__*/Object.freeze({
20399
+ __proto__: null,
20400
+ createUser: createUser$1,
20401
+ updateUser: updateUser$1,
20402
+ findUser: findUser$1
20403
+ });
20404
+
20405
+ var localStrategy = new Local.Strategy({
20406
+ usernameField: 'email',
20407
+ passwordField: 'password'
20408
+ }, function (email, password, done) {
20409
+
20410
+ findUser$1({ email: email, password: password }).then(function (user) {
20411
+ done(null, user);
20412
+ }).catch(function (error) {
20413
+ done(error);
20414
+ });
20415
+ });
20416
+
20417
+ var passportLocal = /*#__PURE__*/Object.freeze({
20418
+ __proto__: null,
20419
+ localStrategy: localStrategy
20420
+ });
20421
+
20422
+ var _this$4 = undefined;
20423
+
20424
+ var config$1 = {
20425
+ host: 'sanity-datasource.cluster-crao688bsrdh.us-east-1.rds.amazonaws.com',
20426
+ user: 'nasp',
20427
+ password: 'uRNkF9SkfXQs6AKK',
20428
+ database: 'user'
20429
+ };
20430
+
20431
+ var getOccupation = function () {
20432
+ var _ref = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee(type) {
20433
+ var db$1, query, result;
20434
+ return AdSlot.regenerator.wrap(function _callee$(_context) {
20435
+ while (1) {
20436
+ switch (_context.prev = _context.next) {
20437
+ case 0:
20438
+ db$1 = db(config$1);
20439
+ query = '\n select name as label, id as value\n from occupation\n where type = ?\n ';
20440
+ _context.next = 4;
20441
+ return db$1.query(query, [type]);
20442
+
20443
+ case 4:
20444
+ result = _context.sent;
20445
+ _context.next = 7;
20446
+ return db$1.close();
20447
+
20448
+ case 7:
20449
+ return _context.abrupt('return', result);
20450
+
20451
+ case 8:
20452
+ case 'end':
20453
+ return _context.stop();
20454
+ }
20455
+ }
20456
+ }, _callee, _this$4);
20457
+ }));
20458
+
20459
+ return function getOccupation(_x) {
20460
+ return _ref.apply(this, arguments);
20461
+ };
20462
+ }();
20463
+
20464
+ var getFieldsAndOptions = function () {
20465
+ var _ref2 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee2(occupation) {
20466
+ var db$1, query, result, i, field, optionQuery, options;
20467
+ return AdSlot.regenerator.wrap(function _callee2$(_context2) {
20468
+ while (1) {
20469
+ switch (_context2.prev = _context2.next) {
20470
+ case 0:
20471
+ db$1 = db(config$1);
20472
+ query = '\n select * \n from field\n where occupation_id = ?\n order by sorting\n ';
20473
+ _context2.next = 4;
20474
+ return db$1.query(query, [occupation]);
20475
+
20476
+ case 4:
20477
+ result = _context2.sent;
20478
+ i = 0;
20479
+
20480
+ case 6:
20481
+ if (!(i < result.length)) {
20482
+ _context2.next = 17;
20483
+ break;
20484
+ }
20485
+
20486
+ field = result[i];
20487
+
20488
+ if (!(field.type === 'select')) {
20489
+ _context2.next = 14;
20490
+ break;
20491
+ }
20492
+
20493
+ optionQuery = '\n select * \n from options\n where list_id = ?\n order by sorting\n ';
20494
+ _context2.next = 12;
20495
+ return db$1.query(optionQuery, [field.list_id]);
20496
+
20497
+ case 12:
20498
+ options = _context2.sent;
20499
+
20500
+ field.options = options ? options : [];
20501
+
20502
+ case 14:
20503
+ i++;
20504
+ _context2.next = 6;
20505
+ break;
20506
+
20507
+ case 17:
20508
+ _context2.next = 19;
20509
+ return db$1.close();
20510
+
20511
+ case 19:
20512
+ return _context2.abrupt('return', result);
20513
+
20514
+ case 20:
20515
+ case 'end':
20516
+ return _context2.stop();
20517
+ }
20518
+ }
20519
+ }, _callee2, _this$4);
20520
+ }));
20521
+
20522
+ return function getFieldsAndOptions(_x2) {
20523
+ return _ref2.apply(this, arguments);
20524
+ };
20525
+ }();
20526
+
20527
+ var ProcessData = (function () {
20528
+ var _ref3 = AdSlot._asyncToGenerator( /*#__PURE__*/AdSlot.regenerator.mark(function _callee3(req, res) {
20529
+ var action, data, type, occupation;
20530
+ return AdSlot.regenerator.wrap(function _callee3$(_context3) {
20531
+ while (1) {
20532
+ switch (_context3.prev = _context3.next) {
20533
+ case 0:
20534
+ _context3.prev = 0;
20535
+ action = req.body.action;
20536
+ data = null;
20537
+ _context3.t0 = action;
20538
+ _context3.next = _context3.t0 === 'get-occupation' ? 6 : _context3.t0 === 'get-fields' ? 11 : 16;
20539
+ break;
20540
+
20541
+ case 6:
20542
+ type = req.body.type;
20543
+ _context3.next = 9;
20544
+ return getOccupation(type);
20545
+
20546
+ case 9:
20547
+ data = _context3.sent;
20548
+ return _context3.abrupt('break', 17);
20549
+
20550
+ case 11:
20551
+ occupation = req.body.occupation;
20552
+ _context3.next = 14;
20553
+ return getFieldsAndOptions(occupation);
20554
+
20555
+ case 14:
20556
+ data = _context3.sent;
20557
+ return _context3.abrupt('break', 17);
20558
+
20559
+ case 16:
20560
+ throw new Error('Invalid action: ' + action);
20561
+
20562
+ case 17:
20563
+ return _context3.abrupt('return', res.json({
20564
+ error: '',
20565
+ data: data
20566
+ }));
20567
+
20568
+ case 20:
20569
+ _context3.prev = 20;
20570
+ _context3.t1 = _context3['catch'](0);
20571
+ return _context3.abrupt('return', res.json({
20572
+ error: _context3.t1.message,
20573
+ data: null
20574
+ }));
20575
+
20576
+ case 23:
20577
+ case 'end':
20578
+ return _context3.stop();
20579
+ }
20580
+ }
20581
+ }, _callee3, this, [[0, 20]]);
20582
+ }));
20583
+
20584
+ return function (_x3, _x4) {
20585
+ return _ref3.apply(this, arguments);
20586
+ };
20587
+ })();
20588
+
20589
+ var LoginForm_1 = LoginForm;
20590
+ var SignupForm_1 = SignupForm;
20591
+ var ProfileForm_1 = SignupForm$1;
20592
+ var AuthCookies_1 = authCookies;
20593
+ var AuthHooks_1 = hooks;
20594
+ var Iron_1 = iron;
20595
+ var PassportLocal_1 = passportLocal;
20596
+ var User_1 = user;
20597
+ var ProcessData_1 = ProcessData;
20598
+
20599
+ var auth = {
20600
+ LoginForm: LoginForm_1,
20601
+ SignupForm: SignupForm_1,
20602
+ ProfileForm: ProfileForm_1,
20603
+ AuthCookies: AuthCookies_1,
20604
+ AuthHooks: AuthHooks_1,
20605
+ Iron: Iron_1,
20606
+ PassportLocal: PassportLocal_1,
20607
+ User: User_1,
20608
+ ProcessData: ProcessData_1
20609
+ };
20610
+
16658
20611
  exports.AdSlot = AdSlot.DFPAdSlot;
16659
20612
  exports.Beam = AdSlot.Beam;
16660
20613
  exports.DeckContent = DeckContent;
@@ -16698,6 +20651,7 @@ exports.AdSlotsProvider = AdSlotsProvider;
16698
20651
  exports.AlphabeticList = AlphabeticList;
16699
20652
  exports.ArticleDetailDropdown = ArticleDetailDropdown;
16700
20653
  exports.ArticleQueue = ArticleQueue;
20654
+ exports.Auth = auth;
16701
20655
  exports.Breadcrumbs = Breadcrumbs$1;
16702
20656
  exports.CMEDeck = CMEDeck;
16703
20657
  exports.ConferenceArticleCard = ConferenceArticleCard;