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