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