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