@stytch/nextjs 3.0.2 → 4.0.0

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/dist/b2b/index.js CHANGED
@@ -211,13 +211,30 @@ const StytchB2BProvider = ({ stytch, children }) => {
211
211
  };
212
212
 
213
213
  function e(t) { return e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, e(t); }
214
- function t(e) { return function (e) { if (Array.isArray(e))
215
- return f(e); }(e) || function (e) { if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"])
216
- return Array.from(e); }(e) || h(e) || function () { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); }
217
- function r(e, t) { if ("function" != typeof t && null !== t)
218
- throw new TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && n(e, t); }
219
- function n(e, t) { return n = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) { return e.__proto__ = t, e; }, n(e, t); }
220
- function o(t) { var r = function () { if ("undefined" == typeof Reflect || !Reflect.construct)
214
+ function t(e) { var n = "function" == typeof Map ? new Map : void 0; return t = function (e) { if (null === e || (t = e, -1 === Function.toString.call(t).indexOf("[native code]")))
215
+ return e; var t; if ("function" != typeof e)
216
+ throw new TypeError("Super expression must either be null or a function"); if (void 0 !== n) {
217
+ if (n.has(e))
218
+ return n.get(e);
219
+ n.set(e, i);
220
+ } function i() { return r(e, arguments, c(this).constructor); } return i.prototype = Object.create(e.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), o(i, e); }, t(e); }
221
+ function r(e, t, n) { return r = s() ? Reflect.construct.bind() : function (e, t, r) { var n = [null]; n.push.apply(n, t); var i = new (Function.bind.apply(e, n)); return r && o(i, r.prototype), i; }, r.apply(null, arguments); }
222
+ function n(e) { return function (e) { if (Array.isArray(e))
223
+ return v(e); }(e) || function (e) { if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"])
224
+ return Array.from(e); }(e) || p(e) || function () { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); }
225
+ function i(e, t) { if ("function" != typeof t && null !== t)
226
+ throw new TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && o(e, t); }
227
+ function o(e, t) { return o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) { return e.__proto__ = t, e; }, o(e, t); }
228
+ function a(t) { var r = s(); return function () { var n, i = c(t); if (r) {
229
+ var o = c(this).constructor;
230
+ n = Reflect.construct(i, arguments, o);
231
+ }
232
+ else
233
+ n = i.apply(this, arguments); return function (t, r) { if (r && ("object" === e(r) || "function" == typeof r))
234
+ return r; if (void 0 !== r)
235
+ throw new TypeError("Derived constructors may only return object or undefined"); return function (e) { if (void 0 === e)
236
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }(t); }(this, n); }; }
237
+ function s() { if ("undefined" == typeof Reflect || !Reflect.construct)
221
238
  return !1; if (Reflect.construct.sham)
222
239
  return !1; if ("function" == typeof Proxy)
223
240
  return !0; try {
@@ -225,40 +242,32 @@ function o(t) { var r = function () { if ("undefined" == typeof Reflect || !Refl
225
242
  }
226
243
  catch (e) {
227
244
  return !1;
228
- } }(); return function () { var n, o = i(t); if (r) {
229
- var a = i(this).constructor;
230
- n = Reflect.construct(o, arguments, a);
231
- }
232
- else
233
- n = o.apply(this, arguments); return function (t, r) { if (r && ("object" === e(r) || "function" == typeof r))
234
- return r; if (void 0 !== r)
235
- throw new TypeError("Derived constructors may only return object or undefined"); return function (e) { if (void 0 === e)
236
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }(t); }(this, n); }; }
237
- function i(e) { return i = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) { return e.__proto__ || Object.getPrototypeOf(e); }, i(e); }
238
- function a() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ a = function () { return t; }; var t = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (e, t, r) { e[t] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, s = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function l(e, t, r) { return Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }), e[t]; } try {
245
+ } }
246
+ function c(e) { return c = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) { return e.__proto__ || Object.getPrototypeOf(e); }, c(e); }
247
+ function u() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ u = function () { return t; }; var t = {}, r = Object.prototype, n = r.hasOwnProperty, i = Object.defineProperty || function (e, t, r) { e[t] = r.value; }, o = "function" == typeof Symbol ? Symbol : {}, a = o.iterator || "@@iterator", s = o.asyncIterator || "@@asyncIterator", c = o.toStringTag || "@@toStringTag"; function l(e, t, r) { return Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }), e[t]; } try {
239
248
  l({}, "");
240
249
  }
241
250
  catch (e) {
242
251
  l = function (e, t, r) { return e[t] = r; };
243
- } function h(e, t, r, n) { var i = t && t.prototype instanceof p ? t : p, a = Object.create(i.prototype), s = new x(n || []); return o(a, "_invoke", { value: S(e, r, s) }), a; } function f(e, t, r) { try {
252
+ } function d(e, t, r, n) { var o = t && t.prototype instanceof p ? t : p, a = Object.create(o.prototype), s = new x(n || []); return i(a, "_invoke", { value: S(e, r, s) }), a; } function h(e, t, r) { try {
244
253
  return { type: "normal", arg: e.call(t, r) };
245
254
  }
246
255
  catch (e) {
247
256
  return { type: "throw", arg: e };
248
- } } t.wrap = h; var d = {}; function p() { } function v() { } function m() { } var y = {}; l(y, s, (function () { return this; })); var _ = Object.getPrototypeOf, b = _ && _(_(C([]))); b && b !== r && n.call(b, s) && (y = b); var g = m.prototype = p.prototype = Object.create(y); function k(e) { ["next", "throw", "return"].forEach((function (t) { l(e, t, (function (e) { return this._invoke(t, e); })); })); } function w(t, r) { function i(o, a, s, c) { var u = f(t[o], t, a); if ("throw" !== u.type) {
249
- var l = u.arg, h = l.value;
250
- return h && "object" == e(h) && n.call(h, "__await") ? r.resolve(h.__await).then((function (e) { i("next", e, s, c); }), (function (e) { i("throw", e, s, c); })) : r.resolve(h).then((function (e) { l.value = e, s(l); }), (function (e) { return i("throw", e, s, c); }));
251
- } c(u.arg); } var a; o(this, "_invoke", { value: function (e, t) { function n() { return new r((function (r, n) { i(e, t, r, n); })); } return a = a ? a.then(n, n) : n(); } }); } function S(e, t, r) { var n = "suspendedStart"; return function (o, i) { if ("executing" === n)
257
+ } } t.wrap = d; var f = {}; function p() { } function v() { } function m() { } var _ = {}; l(_, a, (function () { return this; })); var y = Object.getPrototypeOf, b = y && y(y(P([]))); b && b !== r && n.call(b, a) && (_ = b); var g = m.prototype = p.prototype = Object.create(_); function w(e) { ["next", "throw", "return"].forEach((function (t) { l(e, t, (function (e) { return this._invoke(t, e); })); })); } function k(t, r) { function o(i, a, s, c) { var u = h(t[i], t, a); if ("throw" !== u.type) {
258
+ var l = u.arg, d = l.value;
259
+ return d && "object" == e(d) && n.call(d, "__await") ? r.resolve(d.__await).then((function (e) { o("next", e, s, c); }), (function (e) { o("throw", e, s, c); })) : r.resolve(d).then((function (e) { l.value = e, s(l); }), (function (e) { return o("throw", e, s, c); }));
260
+ } c(u.arg); } var a; i(this, "_invoke", { value: function (e, t) { function n() { return new r((function (r, n) { o(e, t, r, n); })); } return a = a ? a.then(n, n) : n(); } }); } function S(e, t, r) { var n = "suspendedStart"; return function (i, o) { if ("executing" === n)
252
261
  throw new Error("Generator is already running"); if ("completed" === n) {
253
- if ("throw" === o)
254
- throw i;
255
- return P();
256
- } for (r.method = o, r.arg = i;;) {
262
+ if ("throw" === i)
263
+ throw o;
264
+ return C();
265
+ } for (r.method = i, r.arg = o;;) {
257
266
  var a = r.delegate;
258
267
  if (a) {
259
268
  var s = O(a, r);
260
269
  if (s) {
261
- if (s === d)
270
+ if (s === f)
262
271
  continue;
263
272
  return s;
264
273
  }
@@ -273,103 +282,103 @@ catch (e) {
273
282
  else
274
283
  "return" === r.method && r.abrupt("return", r.arg);
275
284
  n = "executing";
276
- var c = f(e, t, r);
285
+ var c = h(e, t, r);
277
286
  if ("normal" === c.type) {
278
- if (n = r.done ? "completed" : "suspendedYield", c.arg === d)
287
+ if (n = r.done ? "completed" : "suspendedYield", c.arg === f)
279
288
  continue;
280
289
  return { value: c.arg, done: r.done };
281
290
  }
282
291
  "throw" === c.type && (n = "completed", r.method = "throw", r.arg = c.arg);
283
292
  } }; } function O(e, t) { var r = t.method, n = e.iterator[r]; if (void 0 === n)
284
- return t.delegate = null, "throw" === r && e.iterator.return && (t.method = "return", t.arg = void 0, O(e, t), "throw" === t.method) || "return" !== r && (t.method = "throw", t.arg = new TypeError("The iterator does not provide a '" + r + "' method")), d; var o = f(n, e.iterator, t.arg); if ("throw" === o.type)
285
- return t.method = "throw", t.arg = o.arg, t.delegate = null, d; var i = o.arg; return i ? i.done ? (t[e.resultName] = i.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, d) : i : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, d); } function E(e) { var t = { tryLoc: e[0] }; 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t); } function T(e) { var t = e.completion || {}; t.type = "normal", delete t.arg, e.completion = t; } function x(e) { this.tryEntries = [{ tryLoc: "root" }], e.forEach(E, this), this.reset(!0); } function C(e) { if (e) {
286
- var t = e[s];
293
+ return t.delegate = null, "throw" === r && e.iterator.return && (t.method = "return", t.arg = void 0, O(e, t), "throw" === t.method) || "return" !== r && (t.method = "throw", t.arg = new TypeError("The iterator does not provide a '" + r + "' method")), f; var i = h(n, e.iterator, t.arg); if ("throw" === i.type)
294
+ return t.method = "throw", t.arg = i.arg, t.delegate = null, f; var o = i.arg; return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, f) : o : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, f); } function E(e) { var t = { tryLoc: e[0] }; 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t); } function T(e) { var t = e.completion || {}; t.type = "normal", delete t.arg, e.completion = t; } function x(e) { this.tryEntries = [{ tryLoc: "root" }], e.forEach(E, this), this.reset(!0); } function P(e) { if (e) {
295
+ var t = e[a];
287
296
  if (t)
288
297
  return t.call(e);
289
298
  if ("function" == typeof e.next)
290
299
  return e;
291
300
  if (!isNaN(e.length)) {
292
- var r = -1, o = function t() { for (; ++r < e.length;)
301
+ var r = -1, i = function t() { for (; ++r < e.length;)
293
302
  if (n.call(e, r))
294
303
  return t.value = e[r], t.done = !1, t; return t.value = void 0, t.done = !0, t; };
295
- return o.next = o;
304
+ return i.next = i;
296
305
  }
297
- } return { next: P }; } function P() { return { value: void 0, done: !0 }; } return v.prototype = m, o(g, "constructor", { value: m, configurable: !0 }), o(m, "constructor", { value: v, configurable: !0 }), v.displayName = l(m, u, "GeneratorFunction"), t.isGeneratorFunction = function (e) { var t = "function" == typeof e && e.constructor; return !!t && (t === v || "GeneratorFunction" === (t.displayName || t.name)); }, t.mark = function (e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, m) : (e.__proto__ = m, l(e, u, "GeneratorFunction")), e.prototype = Object.create(g), e; }, t.awrap = function (e) { return { __await: e }; }, k(w.prototype), l(w.prototype, c, (function () { return this; })), t.AsyncIterator = w, t.async = function (e, r, n, o, i) { void 0 === i && (i = Promise); var a = new w(h(e, r, n, o), i); return t.isGeneratorFunction(r) ? a : a.next().then((function (e) { return e.done ? e.value : a.next(); })); }, k(g), l(g, u, "Generator"), l(g, s, (function () { return this; })), l(g, "toString", (function () { return "[object Generator]"; })), t.keys = function (e) { var t = Object(e), r = []; for (var n in t)
306
+ } return { next: C }; } function C() { return { value: void 0, done: !0 }; } return v.prototype = m, i(g, "constructor", { value: m, configurable: !0 }), i(m, "constructor", { value: v, configurable: !0 }), v.displayName = l(m, c, "GeneratorFunction"), t.isGeneratorFunction = function (e) { var t = "function" == typeof e && e.constructor; return !!t && (t === v || "GeneratorFunction" === (t.displayName || t.name)); }, t.mark = function (e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, m) : (e.__proto__ = m, l(e, c, "GeneratorFunction")), e.prototype = Object.create(g), e; }, t.awrap = function (e) { return { __await: e }; }, w(k.prototype), l(k.prototype, s, (function () { return this; })), t.AsyncIterator = k, t.async = function (e, r, n, i, o) { void 0 === o && (o = Promise); var a = new k(d(e, r, n, i), o); return t.isGeneratorFunction(r) ? a : a.next().then((function (e) { return e.done ? e.value : a.next(); })); }, w(g), l(g, c, "Generator"), l(g, a, (function () { return this; })), l(g, "toString", (function () { return "[object Generator]"; })), t.keys = function (e) { var t = Object(e), r = []; for (var n in t)
298
307
  r.push(n); return r.reverse(), function e() { for (; r.length;) {
299
308
  var n = r.pop();
300
309
  if (n in t)
301
310
  return e.value = n, e.done = !1, e;
302
- } return e.done = !0, e; }; }, t.values = C, x.prototype = { constructor: x, reset: function (e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(T), !e)
311
+ } return e.done = !0, e; }; }, t.values = P, x.prototype = { constructor: x, reset: function (e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(T), !e)
303
312
  for (var t in this)
304
313
  "t" === t.charAt(0) && n.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = void 0); }, stop: function () { this.done = !0; var e = this.tryEntries[0].completion; if ("throw" === e.type)
305
314
  throw e.arg; return this.rval; }, dispatchException: function (e) { if (this.done)
306
- throw e; var t = this; function r(r, n) { return a.type = "throw", a.arg = e, t.next = r, n && (t.method = "next", t.arg = void 0), !!n; } for (var o = this.tryEntries.length - 1; o >= 0; --o) {
307
- var i = this.tryEntries[o], a = i.completion;
308
- if ("root" === i.tryLoc)
315
+ throw e; var t = this; function r(r, n) { return a.type = "throw", a.arg = e, t.next = r, n && (t.method = "next", t.arg = void 0), !!n; } for (var i = this.tryEntries.length - 1; i >= 0; --i) {
316
+ var o = this.tryEntries[i], a = o.completion;
317
+ if ("root" === o.tryLoc)
309
318
  return r("end");
310
- if (i.tryLoc <= this.prev) {
311
- var s = n.call(i, "catchLoc"), c = n.call(i, "finallyLoc");
319
+ if (o.tryLoc <= this.prev) {
320
+ var s = n.call(o, "catchLoc"), c = n.call(o, "finallyLoc");
312
321
  if (s && c) {
313
- if (this.prev < i.catchLoc)
314
- return r(i.catchLoc, !0);
315
- if (this.prev < i.finallyLoc)
316
- return r(i.finallyLoc);
322
+ if (this.prev < o.catchLoc)
323
+ return r(o.catchLoc, !0);
324
+ if (this.prev < o.finallyLoc)
325
+ return r(o.finallyLoc);
317
326
  }
318
327
  else if (s) {
319
- if (this.prev < i.catchLoc)
320
- return r(i.catchLoc, !0);
328
+ if (this.prev < o.catchLoc)
329
+ return r(o.catchLoc, !0);
321
330
  }
322
331
  else {
323
332
  if (!c)
324
333
  throw new Error("try statement without catch or finally");
325
- if (this.prev < i.finallyLoc)
326
- return r(i.finallyLoc);
334
+ if (this.prev < o.finallyLoc)
335
+ return r(o.finallyLoc);
327
336
  }
328
337
  }
329
338
  } }, abrupt: function (e, t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) {
330
- var o = this.tryEntries[r];
331
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
332
- var i = o;
339
+ var i = this.tryEntries[r];
340
+ if (i.tryLoc <= this.prev && n.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
341
+ var o = i;
333
342
  break;
334
343
  }
335
- } i && ("break" === e || "continue" === e) && i.tryLoc <= t && t <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = e, a.arg = t, i ? (this.method = "next", this.next = i.finallyLoc, d) : this.complete(a); }, complete: function (e, t) { if ("throw" === e.type)
336
- throw e.arg; return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), d; }, finish: function (e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) {
344
+ } o && ("break" === e || "continue" === e) && o.tryLoc <= t && t <= o.finallyLoc && (o = null); var a = o ? o.completion : {}; return a.type = e, a.arg = t, o ? (this.method = "next", this.next = o.finallyLoc, f) : this.complete(a); }, complete: function (e, t) { if ("throw" === e.type)
345
+ throw e.arg; return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), f; }, finish: function (e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) {
337
346
  var r = this.tryEntries[t];
338
347
  if (r.finallyLoc === e)
339
- return this.complete(r.completion, r.afterLoc), T(r), d;
348
+ return this.complete(r.completion, r.afterLoc), T(r), f;
340
349
  } }, catch: function (e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) {
341
350
  var r = this.tryEntries[t];
342
351
  if (r.tryLoc === e) {
343
352
  var n = r.completion;
344
353
  if ("throw" === n.type) {
345
- var o = n.arg;
354
+ var i = n.arg;
346
355
  T(r);
347
356
  }
348
- return o;
357
+ return i;
349
358
  }
350
- } throw new Error("illegal catch attempt"); }, delegateYield: function (e, t, r) { return this.delegate = { iterator: C(e), resultName: t, nextLoc: r }, "next" === this.method && (this.arg = void 0), d; } }, t; }
351
- function s(e, t) { if (!(e instanceof t))
359
+ } throw new Error("illegal catch attempt"); }, delegateYield: function (e, t, r) { return this.delegate = { iterator: P(e), resultName: t, nextLoc: r }, "next" === this.method && (this.arg = void 0), f; } }, t; }
360
+ function l(e, t) { if (!(e instanceof t))
352
361
  throw new TypeError("Cannot call a class as a function"); }
353
- function c(e, t) { for (var r = 0; r < t.length; r++) {
362
+ function d(e, t) { for (var r = 0; r < t.length; r++) {
354
363
  var n = t[r];
355
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, d(n.key), n);
364
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, m(n.key), n);
356
365
  } }
357
- function u(e, t, r) { return t && c(e.prototype, t), r && c(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
358
- function l(e, t) { return function (e) { if (Array.isArray(e))
366
+ function h(e, t, r) { return t && d(e.prototype, t), r && d(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
367
+ function f(e, t) { return function (e) { if (Array.isArray(e))
359
368
  return e; }(e) || function (e, t) { var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (null != r) {
360
- var n, o, i, a, s = [], c = !0, u = !1;
369
+ var n, i, o, a, s = [], c = !0, u = !1;
361
370
  try {
362
- if (i = (r = r.call(e)).next, 0 === t) {
371
+ if (o = (r = r.call(e)).next, 0 === t) {
363
372
  if (Object(r) !== r)
364
373
  return;
365
374
  c = !1;
366
375
  }
367
376
  else
368
- for (; !(c = (n = i.call(r)).done) && (s.push(n.value), s.length !== t); c = !0)
377
+ for (; !(c = (n = o.call(r)).done) && (s.push(n.value), s.length !== t); c = !0)
369
378
  ;
370
379
  }
371
380
  catch (e) {
372
- u = !0, o = e;
381
+ u = !0, i = e;
373
382
  }
374
383
  finally {
375
384
  try {
@@ -378,41 +387,41 @@ function l(e, t) { return function (e) { if (Array.isArray(e))
378
387
  }
379
388
  finally {
380
389
  if (u)
381
- throw o;
390
+ throw i;
382
391
  }
383
392
  }
384
393
  return s;
385
- } }(e, t) || h(e, t) || function () { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); }
386
- function h(e, t) { if (e) {
394
+ } }(e, t) || p(e, t) || function () { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); }
395
+ function p(e, t) { if (e) {
387
396
  if ("string" == typeof e)
388
- return f(e, t);
397
+ return v(e, t);
389
398
  var r = Object.prototype.toString.call(e).slice(8, -1);
390
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? f(e, t) : void 0;
399
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? v(e, t) : void 0;
391
400
  } }
392
- function f(e, t) { (null == t || t > e.length) && (t = e.length); for (var r = 0, n = new Array(t); r < t; r++)
401
+ function v(e, t) { (null == t || t > e.length) && (t = e.length); for (var r = 0, n = new Array(t); r < t; r++)
393
402
  n[r] = e[r]; return n; }
394
- function d(t) { var r = function (t, r) { if ("object" !== e(t) || null === t)
403
+ function m(t) { var r = function (t, r) { if ("object" !== e(t) || null === t)
395
404
  return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) {
396
- var o = n.call(t, r || "default");
397
- if ("object" !== e(o))
398
- return o;
405
+ var i = n.call(t, r || "default");
406
+ if ("object" !== e(i))
407
+ return i;
399
408
  throw new TypeError("@@toPrimitive must return a primitive value.");
400
409
  } return ("string" === r ? String : Number)(t); }(t, "string"); return "symbol" === e(r) ? r : String(r); }
401
- function p(e, t) { return function (e) { if (Array.isArray(e))
410
+ function _(e, t) { return function (e) { if (Array.isArray(e))
402
411
  return e; }(e) || function (e, t) { var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (null != r) {
403
- var n, o, i, a, s = [], c = !0, u = !1;
412
+ var n, i, o, a, s = [], c = !0, u = !1;
404
413
  try {
405
- if (i = (r = r.call(e)).next, 0 === t) {
414
+ if (o = (r = r.call(e)).next, 0 === t) {
406
415
  if (Object(r) !== r)
407
416
  return;
408
417
  c = !1;
409
418
  }
410
419
  else
411
- for (; !(c = (n = i.call(r)).done) && (s.push(n.value), s.length !== t); c = !0)
420
+ for (; !(c = (n = o.call(r)).done) && (s.push(n.value), s.length !== t); c = !0)
412
421
  ;
413
422
  }
414
423
  catch (e) {
415
- u = !0, o = e;
424
+ u = !0, i = e;
416
425
  }
417
426
  finally {
418
427
  try {
@@ -421,24 +430,24 @@ function p(e, t) { return function (e) { if (Array.isArray(e))
421
430
  }
422
431
  finally {
423
432
  if (u)
424
- throw o;
433
+ throw i;
425
434
  }
426
435
  }
427
436
  return s;
428
- } }(e, t) || m(e, t) || function () { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); }
429
- function v(e) { return v = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, v(e); }
430
- function m(e, t) { if (e) {
437
+ } }(e, t) || b(e, t) || function () { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); }
438
+ function y(e) { return y = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, y(e); }
439
+ function b(e, t) { if (e) {
431
440
  if ("string" == typeof e)
432
- return y(e, t);
441
+ return g(e, t);
433
442
  var r = Object.prototype.toString.call(e).slice(8, -1);
434
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? y(e, t) : void 0;
443
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? g(e, t) : void 0;
435
444
  } }
436
- function y(e, t) { (null == t || t > e.length) && (t = e.length); for (var r = 0, n = new Array(t); r < t; r++)
445
+ function g(e, t) { (null == t || t > e.length) && (t = e.length); for (var r = 0, n = new Array(t); r < t; r++)
437
446
  n[r] = e[r]; return n; }
438
- function _() {
447
+ function w() {
439
448
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
440
- _ = function () { return e; };
441
- var e = {}, t = Object.prototype, r = t.hasOwnProperty, n = Object.defineProperty || function (e, t, r) { e[t] = r.value; }, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", s = o.toStringTag || "@@toStringTag";
449
+ w = function () { return e; };
450
+ var e = {}, t = Object.prototype, r = t.hasOwnProperty, n = Object.defineProperty || function (e, t, r) { e[t] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, o = i.iterator || "@@iterator", a = i.asyncIterator || "@@asyncIterator", s = i.toStringTag || "@@toStringTag";
442
451
  function c(e, t, r) { return Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }), e[t]; }
443
452
  try {
444
453
  c({}, "");
@@ -446,7 +455,7 @@ function _() {
446
455
  catch (e) {
447
456
  c = function (e, t, r) { return e[t] = r; };
448
457
  }
449
- function u(e, t, r, o) { var i = t && t.prototype instanceof f ? t : f, a = Object.create(i.prototype), s = new x(o || []); return n(a, "_invoke", { value: S(e, r, s) }), a; }
458
+ function u(e, t, r, i) { var o = t && t.prototype instanceof h ? t : h, a = Object.create(o.prototype), s = new x(i || []); return n(a, "_invoke", { value: S(e, r, s) }), a; }
450
459
  function l(e, t, r) { try {
451
460
  return { type: "normal", arg: e.call(t, r) };
452
461
  }
@@ -454,31 +463,31 @@ function _() {
454
463
  return { type: "throw", arg: e };
455
464
  } }
456
465
  e.wrap = u;
457
- var h = {};
466
+ var d = {};
467
+ function h() { }
458
468
  function f() { }
459
- function d() { }
460
469
  function p() { }
461
- var m = {};
462
- c(m, i, (function () { return this; }));
463
- var y = Object.getPrototypeOf, b = y && y(y(C([])));
464
- b && b !== t && r.call(b, i) && (m = b);
465
- var g = p.prototype = f.prototype = Object.create(m);
466
- function k(e) { ["next", "throw", "return"].forEach((function (t) { c(e, t, (function (e) { return this._invoke(t, e); })); })); }
467
- function w(e, t) { function o(n, i, a, s) { var c = l(e[n], e, i); if ("throw" !== c.type) {
468
- var u = c.arg, h = u.value;
469
- return h && "object" == v(h) && r.call(h, "__await") ? t.resolve(h.__await).then((function (e) { o("next", e, a, s); }), (function (e) { o("throw", e, a, s); })) : t.resolve(h).then((function (e) { u.value = e, a(u); }), (function (e) { return o("throw", e, a, s); }));
470
- } s(c.arg); } var i; n(this, "_invoke", { value: function (e, r) { function n() { return new t((function (t, n) { o(e, r, t, n); })); } return i = i ? i.then(n, n) : n(); } }); }
471
- function S(e, t, r) { var n = "suspendedStart"; return function (o, i) { if ("executing" === n)
470
+ var v = {};
471
+ c(v, o, (function () { return this; }));
472
+ var m = Object.getPrototypeOf, _ = m && m(m(P([])));
473
+ _ && _ !== t && r.call(_, o) && (v = _);
474
+ var b = p.prototype = h.prototype = Object.create(v);
475
+ function g(e) { ["next", "throw", "return"].forEach((function (t) { c(e, t, (function (e) { return this._invoke(t, e); })); })); }
476
+ function k(e, t) { function i(n, o, a, s) { var c = l(e[n], e, o); if ("throw" !== c.type) {
477
+ var u = c.arg, d = u.value;
478
+ return d && "object" == y(d) && r.call(d, "__await") ? t.resolve(d.__await).then((function (e) { i("next", e, a, s); }), (function (e) { i("throw", e, a, s); })) : t.resolve(d).then((function (e) { u.value = e, a(u); }), (function (e) { return i("throw", e, a, s); }));
479
+ } s(c.arg); } var o; n(this, "_invoke", { value: function (e, r) { function n() { return new t((function (t, n) { i(e, r, t, n); })); } return o = o ? o.then(n, n) : n(); } }); }
480
+ function S(e, t, r) { var n = "suspendedStart"; return function (i, o) { if ("executing" === n)
472
481
  throw new Error("Generator is already running"); if ("completed" === n) {
473
- if ("throw" === o)
474
- throw i;
475
- return P();
476
- } for (r.method = o, r.arg = i;;) {
482
+ if ("throw" === i)
483
+ throw o;
484
+ return C();
485
+ } for (r.method = i, r.arg = o;;) {
477
486
  var a = r.delegate;
478
487
  if (a) {
479
488
  var s = O(a, r);
480
489
  if (s) {
481
- if (s === h)
490
+ if (s === d)
482
491
  continue;
483
492
  return s;
484
493
  }
@@ -495,121 +504,121 @@ function _() {
495
504
  n = "executing";
496
505
  var c = l(e, t, r);
497
506
  if ("normal" === c.type) {
498
- if (n = r.done ? "completed" : "suspendedYield", c.arg === h)
507
+ if (n = r.done ? "completed" : "suspendedYield", c.arg === d)
499
508
  continue;
500
509
  return { value: c.arg, done: r.done };
501
510
  }
502
511
  "throw" === c.type && (n = "completed", r.method = "throw", r.arg = c.arg);
503
512
  } }; }
504
513
  function O(e, t) { var r = t.method, n = e.iterator[r]; if (void 0 === n)
505
- return t.delegate = null, "throw" === r && e.iterator.return && (t.method = "return", t.arg = void 0, O(e, t), "throw" === t.method) || "return" !== r && (t.method = "throw", t.arg = new TypeError("The iterator does not provide a '" + r + "' method")), h; var o = l(n, e.iterator, t.arg); if ("throw" === o.type)
506
- return t.method = "throw", t.arg = o.arg, t.delegate = null, h; var i = o.arg; return i ? i.done ? (t[e.resultName] = i.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, h) : i : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, h); }
514
+ return t.delegate = null, "throw" === r && e.iterator.return && (t.method = "return", t.arg = void 0, O(e, t), "throw" === t.method) || "return" !== r && (t.method = "throw", t.arg = new TypeError("The iterator does not provide a '" + r + "' method")), d; var i = l(n, e.iterator, t.arg); if ("throw" === i.type)
515
+ return t.method = "throw", t.arg = i.arg, t.delegate = null, d; var o = i.arg; return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, d) : o : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, d); }
507
516
  function E(e) { var t = { tryLoc: e[0] }; 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t); }
508
517
  function T(e) { var t = e.completion || {}; t.type = "normal", delete t.arg, e.completion = t; }
509
518
  function x(e) { this.tryEntries = [{ tryLoc: "root" }], e.forEach(E, this), this.reset(!0); }
510
- function C(e) { if (e) {
511
- var t = e[i];
519
+ function P(e) { if (e) {
520
+ var t = e[o];
512
521
  if (t)
513
522
  return t.call(e);
514
523
  if ("function" == typeof e.next)
515
524
  return e;
516
525
  if (!isNaN(e.length)) {
517
- var n = -1, o = function t() { for (; ++n < e.length;)
526
+ var n = -1, i = function t() { for (; ++n < e.length;)
518
527
  if (r.call(e, n))
519
528
  return t.value = e[n], t.done = !1, t; return t.value = void 0, t.done = !0, t; };
520
- return o.next = o;
529
+ return i.next = i;
521
530
  }
522
- } return { next: P }; }
523
- function P() { return { value: void 0, done: !0 }; }
524
- return d.prototype = p, n(g, "constructor", { value: p, configurable: !0 }), n(p, "constructor", { value: d, configurable: !0 }), d.displayName = c(p, s, "GeneratorFunction"), e.isGeneratorFunction = function (e) { var t = "function" == typeof e && e.constructor; return !!t && (t === d || "GeneratorFunction" === (t.displayName || t.name)); }, e.mark = function (e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, p) : (e.__proto__ = p, c(e, s, "GeneratorFunction")), e.prototype = Object.create(g), e; }, e.awrap = function (e) { return { __await: e }; }, k(w.prototype), c(w.prototype, a, (function () { return this; })), e.AsyncIterator = w, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new w(u(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then((function (e) { return e.done ? e.value : a.next(); })); }, k(g), c(g, s, "Generator"), c(g, i, (function () { return this; })), c(g, "toString", (function () { return "[object Generator]"; })), e.keys = function (e) { var t = Object(e), r = []; for (var n in t)
531
+ } return { next: C }; }
532
+ function C() { return { value: void 0, done: !0 }; }
533
+ return f.prototype = p, n(b, "constructor", { value: p, configurable: !0 }), n(p, "constructor", { value: f, configurable: !0 }), f.displayName = c(p, s, "GeneratorFunction"), e.isGeneratorFunction = function (e) { var t = "function" == typeof e && e.constructor; return !!t && (t === f || "GeneratorFunction" === (t.displayName || t.name)); }, e.mark = function (e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, p) : (e.__proto__ = p, c(e, s, "GeneratorFunction")), e.prototype = Object.create(b), e; }, e.awrap = function (e) { return { __await: e }; }, g(k.prototype), c(k.prototype, a, (function () { return this; })), e.AsyncIterator = k, e.async = function (t, r, n, i, o) { void 0 === o && (o = Promise); var a = new k(u(t, r, n, i), o); return e.isGeneratorFunction(r) ? a : a.next().then((function (e) { return e.done ? e.value : a.next(); })); }, g(b), c(b, s, "Generator"), c(b, o, (function () { return this; })), c(b, "toString", (function () { return "[object Generator]"; })), e.keys = function (e) { var t = Object(e), r = []; for (var n in t)
525
534
  r.push(n); return r.reverse(), function e() { for (; r.length;) {
526
535
  var n = r.pop();
527
536
  if (n in t)
528
537
  return e.value = n, e.done = !1, e;
529
- } return e.done = !0, e; }; }, e.values = C, x.prototype = { constructor: x, reset: function (e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(T), !e)
538
+ } return e.done = !0, e; }; }, e.values = P, x.prototype = { constructor: x, reset: function (e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(T), !e)
530
539
  for (var t in this)
531
540
  "t" === t.charAt(0) && r.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = void 0); }, stop: function () { this.done = !0; var e = this.tryEntries[0].completion; if ("throw" === e.type)
532
541
  throw e.arg; return this.rval; }, dispatchException: function (e) { if (this.done)
533
- throw e; var t = this; function n(r, n) { return a.type = "throw", a.arg = e, t.next = r, n && (t.method = "next", t.arg = void 0), !!n; } for (var o = this.tryEntries.length - 1; o >= 0; --o) {
534
- var i = this.tryEntries[o], a = i.completion;
535
- if ("root" === i.tryLoc)
542
+ throw e; var t = this; function n(r, n) { return a.type = "throw", a.arg = e, t.next = r, n && (t.method = "next", t.arg = void 0), !!n; } for (var i = this.tryEntries.length - 1; i >= 0; --i) {
543
+ var o = this.tryEntries[i], a = o.completion;
544
+ if ("root" === o.tryLoc)
536
545
  return n("end");
537
- if (i.tryLoc <= this.prev) {
538
- var s = r.call(i, "catchLoc"), c = r.call(i, "finallyLoc");
546
+ if (o.tryLoc <= this.prev) {
547
+ var s = r.call(o, "catchLoc"), c = r.call(o, "finallyLoc");
539
548
  if (s && c) {
540
- if (this.prev < i.catchLoc)
541
- return n(i.catchLoc, !0);
542
- if (this.prev < i.finallyLoc)
543
- return n(i.finallyLoc);
549
+ if (this.prev < o.catchLoc)
550
+ return n(o.catchLoc, !0);
551
+ if (this.prev < o.finallyLoc)
552
+ return n(o.finallyLoc);
544
553
  }
545
554
  else if (s) {
546
- if (this.prev < i.catchLoc)
547
- return n(i.catchLoc, !0);
555
+ if (this.prev < o.catchLoc)
556
+ return n(o.catchLoc, !0);
548
557
  }
549
558
  else {
550
559
  if (!c)
551
560
  throw new Error("try statement without catch or finally");
552
- if (this.prev < i.finallyLoc)
553
- return n(i.finallyLoc);
561
+ if (this.prev < o.finallyLoc)
562
+ return n(o.finallyLoc);
554
563
  }
555
564
  }
556
565
  } }, abrupt: function (e, t) { for (var n = this.tryEntries.length - 1; n >= 0; --n) {
557
- var o = this.tryEntries[n];
558
- if (o.tryLoc <= this.prev && r.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
559
- var i = o;
566
+ var i = this.tryEntries[n];
567
+ if (i.tryLoc <= this.prev && r.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
568
+ var o = i;
560
569
  break;
561
570
  }
562
- } i && ("break" === e || "continue" === e) && i.tryLoc <= t && t <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = e, a.arg = t, i ? (this.method = "next", this.next = i.finallyLoc, h) : this.complete(a); }, complete: function (e, t) { if ("throw" === e.type)
563
- throw e.arg; return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), h; }, finish: function (e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) {
571
+ } o && ("break" === e || "continue" === e) && o.tryLoc <= t && t <= o.finallyLoc && (o = null); var a = o ? o.completion : {}; return a.type = e, a.arg = t, o ? (this.method = "next", this.next = o.finallyLoc, d) : this.complete(a); }, complete: function (e, t) { if ("throw" === e.type)
572
+ throw e.arg; return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), d; }, finish: function (e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) {
564
573
  var r = this.tryEntries[t];
565
574
  if (r.finallyLoc === e)
566
- return this.complete(r.completion, r.afterLoc), T(r), h;
575
+ return this.complete(r.completion, r.afterLoc), T(r), d;
567
576
  } }, catch: function (e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) {
568
577
  var r = this.tryEntries[t];
569
578
  if (r.tryLoc === e) {
570
579
  var n = r.completion;
571
580
  if ("throw" === n.type) {
572
- var o = n.arg;
581
+ var i = n.arg;
573
582
  T(r);
574
583
  }
575
- return o;
584
+ return i;
576
585
  }
577
- } throw new Error("illegal catch attempt"); }, delegateYield: function (e, t, r) { return this.delegate = { iterator: C(e), resultName: t, nextLoc: r }, "next" === this.method && (this.arg = void 0), h; } }, e;
586
+ } throw new Error("illegal catch attempt"); }, delegateYield: function (e, t, r) { return this.delegate = { iterator: P(e), resultName: t, nextLoc: r }, "next" === this.method && (this.arg = void 0), d; } }, e;
578
587
  }
579
- function b(e, t) { for (var r = 0; r < t.length; r++) {
588
+ function k(e, t) { for (var r = 0; r < t.length; r++) {
580
589
  var n = t[r];
581
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (o = n.key, i = void 0, i = function (e, t) { if ("object" !== v(e) || null === e)
590
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) { if ("object" !== y(e) || null === e)
582
591
  return e; var r = e[Symbol.toPrimitive]; if (void 0 !== r) {
583
592
  var n = r.call(e, t || "default");
584
- if ("object" !== v(n))
593
+ if ("object" !== y(n))
585
594
  return n;
586
595
  throw new TypeError("@@toPrimitive must return a primitive value.");
587
- } return ("string" === t ? String : Number)(e); }(o, "string"), "symbol" === v(i) ? i : String(i)), n);
588
- } var o, i; }
589
- function g(e, t, r) { return t && b(e.prototype, t), r && b(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
590
- function k(e, t) { if (!(e instanceof t))
596
+ } return ("string" === t ? String : Number)(e); }(i, "string"), "symbol" === y(o) ? o : String(o)), n);
597
+ } var i, o; }
598
+ function S(e, t, r) { return t && k(e.prototype, t), r && k(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
599
+ function O(e, t) { if (!(e instanceof t))
591
600
  throw new TypeError("Cannot call a class as a function"); }
592
- function w(e, t) { if ("function" != typeof t && null !== t)
593
- throw new TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && C(e, t); }
594
- function S(e) { var t = x(); return function () { var r, n = P(e); if (t) {
595
- var o = P(this).constructor;
596
- r = Reflect.construct(n, arguments, o);
601
+ function E(e, t) { if ("function" != typeof t && null !== t)
602
+ throw new TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && L(e, t); }
603
+ function T(e) { var t = A(); return function () { var r, n = j(e); if (t) {
604
+ var i = j(this).constructor;
605
+ r = Reflect.construct(n, arguments, i);
597
606
  }
598
607
  else
599
- r = n.apply(this, arguments); return function (e, t) { if (t && ("object" === v(t) || "function" == typeof t))
608
+ r = n.apply(this, arguments); return function (e, t) { if (t && ("object" === y(t) || "function" == typeof t))
600
609
  return t; if (void 0 !== t)
601
- throw new TypeError("Derived constructors may only return object or undefined"); return O(e); }(this, r); }; }
602
- function O(e) { if (void 0 === e)
610
+ throw new TypeError("Derived constructors may only return object or undefined"); return x(e); }(this, r); }; }
611
+ function x(e) { if (void 0 === e)
603
612
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
604
- function E(e) { var t = "function" == typeof Map ? new Map : void 0; return E = function (e) { if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]")))
613
+ function P(e) { var t = "function" == typeof Map ? new Map : void 0; return P = function (e) { if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]")))
605
614
  return e; var r; if ("function" != typeof e)
606
615
  throw new TypeError("Super expression must either be null or a function"); if (void 0 !== t) {
607
616
  if (t.has(e))
608
617
  return t.get(e);
609
618
  t.set(e, n);
610
- } function n() { return T(e, arguments, P(this).constructor); } return n.prototype = Object.create(e.prototype, { constructor: { value: n, enumerable: !1, writable: !0, configurable: !0 } }), C(n, e); }, E(e); }
611
- function T(e, t, r) { return T = x() ? Reflect.construct.bind() : function (e, t, r) { var n = [null]; n.push.apply(n, t); var o = new (Function.bind.apply(e, n)); return r && C(o, r.prototype), o; }, T.apply(null, arguments); }
612
- function x() { if ("undefined" == typeof Reflect || !Reflect.construct)
619
+ } function n() { return C(e, arguments, j(this).constructor); } return n.prototype = Object.create(e.prototype, { constructor: { value: n, enumerable: !1, writable: !0, configurable: !0 } }), L(n, e); }, P(e); }
620
+ function C(e, t, r) { return C = A() ? Reflect.construct.bind() : function (e, t, r) { var n = [null]; n.push.apply(n, t); var i = new (Function.bind.apply(e, n)); return r && L(i, r.prototype), i; }, C.apply(null, arguments); }
621
+ function A() { if ("undefined" == typeof Reflect || !Reflect.construct)
613
622
  return !1; if (Reflect.construct.sham)
614
623
  return !1; if ("function" == typeof Proxy)
615
624
  return !0; try {
@@ -618,71 +627,86 @@ function x() { if ("undefined" == typeof Reflect || !Reflect.construct)
618
627
  catch (e) {
619
628
  return !1;
620
629
  } }
621
- function C(e, t) { return C = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) { return e.__proto__ = t, e; }, C(e, t); }
622
- function P(e) { return P = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) { return e.__proto__ || Object.getPrototypeOf(e); }, P(e); }
623
- var j, L, A, R, I, D;
624
- !function (e) { e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords"; }(j || (j = {})), function (e) { e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch"; }(L || (L = {})), function (e) { e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet"; }(A || (A = {})), function (e) { e.embedded = "embedded", e.floating = "floating"; }(R || (R = {})), function (e) { e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email"; }(I || (I = {})), function (e) { e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL"; }(D || (D = {}));
625
- var N, M, U = function (e) { w(r, E(Error)); var t = S(r); function r(e, n) { var o; return k(this, r), (o = t.call(this, e + "\n" + n)).message = e + "\n" + n, o.name = "SDKAPIUnreachableError", o.details = n, Object.setPrototypeOf(O(o), r.prototype), o; } return g(r); }(), B = function (e) { w(r, E(Error)); var t = S(r); function r(e, n) { var o; return k(this, r), (o = t.call(this)).name = "StytchSDKUsageError", o.message = "Invalid call to ".concat(e, "\n") + n, o; } return g(r); }(), F = function (e) { w(r, E(Error)); var t = S(r); function r(e) { var n, o; k(this, r), (n = t.call(this)).name = "StytchSDKSchemaError"; var i = null === (o = e.body) || void 0 === o ? void 0 : o.map((function (e) { return "".concat(e.dataPath, ": ").concat(e.message); })).join("\n"); return n.message = "[400] Request does not match expected schema\n".concat(i), n; } return g(r); }(), K = function (e) { w(r, E(Error)); var t = S(r); function r(e) { var n; k(this, r), (n = t.call(this)).name = "StytchSDKAPIError"; var o = e.status_code, i = e.error_type, a = e.error_message, s = e.error_url, c = e.request_id; return n.error_type = i, n.error_message = a, n.error_url = s, n.request_id = c, n.status_code = o, n.message = "[".concat(o, "] ").concat(i, "\n") + "".concat(a, "\n") + "See ".concat(s, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n; } return g(r); }(), q = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
626
- function z(e, t, r, n) { return new (r || (r = Promise))((function (o, i) { function a(e) { try {
630
+ function L(e, t) { return L = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) { return e.__proto__ = t, e; }, L(e, t); }
631
+ function j(e) { return j = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) { return e.__proto__ || Object.getPrototypeOf(e); }, j(e); }
632
+ var R, I, N, D, M, B;
633
+ !function (e) { e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords"; }(R || (R = {})), function (e) { e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch"; }(I || (I = {})), function (e) { e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet"; }(N || (N = {})), function (e) { e.embedded = "embedded", e.floating = "floating"; }(D || (D = {})), function (e) { e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email"; }(M || (M = {})), function (e) { e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL"; }(B || (B = {}));
634
+ var K, F, U = function (e) { E(r, P(Error)); var t = T(r); function r(e, n) { var i; return O(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(x(i), r.prototype), i; } return S(r); }(), q = function (e) { E(r, P(Error)); var t = T(r); function r(e, n) { var i; return O(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i; } return S(r); }(), z = function (e) { E(r, P(Error)); var t = T(r); function r(e) { var n, i; O(this, r), (n = t.call(this)).name = "StytchSDKSchemaError"; var o = null === (i = e.body) || void 0 === i ? void 0 : i.map((function (e) { return "".concat(e.dataPath, ": ").concat(e.message); })).join("\n"); return n.message = "[400] Request does not match expected schema\n".concat(o), n; } return S(r); }(), W = function (e) { E(r, P(Error)); var t = T(r); function r(e) { var n; O(this, r), (n = t.call(this)).name = "StytchSDKAPIError"; var i = e.status_code, o = e.error_type, a = e.error_message, s = e.error_url, c = e.request_id; return n.error_type = o, n.error_message = a, n.error_url = s, n.request_id = c, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(s, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n; } return S(r); }(), G = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
635
+ function H(e, t, r, n) { return new (r || (r = Promise))((function (i, o) { function a(e) { try {
627
636
  c(n.next(e));
628
637
  }
629
638
  catch (e) {
630
- i(e);
639
+ o(e);
631
640
  } } function s(e) { try {
632
641
  c(n.throw(e));
633
642
  }
634
643
  catch (e) {
635
- i(e);
636
- } } function c(e) { var t; e.done ? o(e.value) : (t = e.value, t instanceof r ? t : new r((function (e) { e(t); }))).then(a, s); } c((n = n.apply(e, t || [])).next()); })); }
637
- !function (e) { e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out"; }(N || (N = {}));
638
- var G = new Uint8Array(16);
639
- function W() { if (!M && !(M = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto)))
640
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); return M(G); }
641
- var H = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
642
- for (var V = [], Y = 0; Y < 256; ++Y)
643
- V.push((Y + 256).toString(16).substr(1));
644
- function J(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = (V[e[t + 0]] + V[e[t + 1]] + V[e[t + 2]] + V[e[t + 3]] + "-" + V[e[t + 4]] + V[e[t + 5]] + "-" + V[e[t + 6]] + V[e[t + 7]] + "-" + V[e[t + 8]] + V[e[t + 9]] + "-" + V[e[t + 10]] + V[e[t + 11]] + V[e[t + 12]] + V[e[t + 13]] + V[e[t + 14]] + V[e[t + 15]]).toLowerCase(); if (!function (e) { return "string" == typeof e && H.test(e); }(r))
644
+ o(e);
645
+ } } function c(e) { var t; e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r((function (e) { e(t); }))).then(a, s); } c((n = n.apply(e, t || [])).next()); })); }
646
+ !function (e) { e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out"; }(K || (K = {}));
647
+ var Y = new Uint8Array(16);
648
+ function V() { if (!F && !(F = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto)))
649
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); return F(Y); }
650
+ var J = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
651
+ for (var $ = [], X = 0; X < 256; ++X)
652
+ $.push((X + 256).toString(16).substr(1));
653
+ function Z(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = ($[e[t + 0]] + $[e[t + 1]] + $[e[t + 2]] + $[e[t + 3]] + "-" + $[e[t + 4]] + $[e[t + 5]] + "-" + $[e[t + 6]] + $[e[t + 7]] + "-" + $[e[t + 8]] + $[e[t + 9]] + "-" + $[e[t + 10]] + $[e[t + 11]] + $[e[t + 12]] + $[e[t + 13]] + $[e[t + 14]] + $[e[t + 15]]).toLowerCase(); if (!function (e) { return "string" == typeof e && J.test(e); }(r))
645
654
  throw TypeError("Stringified UUID is invalid"); return r; }
646
- function $(e, t, r) { var n = (e = e || {}).random || (e.rng || W)(); if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
655
+ function Q(e, t, r) { var n = (e = e || {}).random || (e.rng || V)(); if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
647
656
  r = r || 0;
648
- for (var o = 0; o < 16; ++o)
649
- t[r + o] = n[o];
657
+ for (var i = 0; i < 16; ++i)
658
+ t[r + i] = n[i];
650
659
  return t;
651
- } return J(n); }
652
- var X = ["[Stytch]"], Z = function () { for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++)
653
- r[n] = arguments[n]; return (e = console).warn.apply(e, X.concat(r)); }, Q = function () { for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++)
654
- r[n] = arguments[n]; return (e = console).error.apply(e, X.concat(r)); }, ee = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.", te = function (e) { var t = { isObject: function (r, n) { var o = "object" === v(n) && !Array.isArray(n) && null !== n; if (!o)
655
- throw new B(e, r + " must be an object."); return t; }, isOptionalObject: function (e, r) { return void 0 === r ? t : t.isObject(e, r); }, isString: function (r, n) { if ("string" != typeof n)
656
- throw new B(e, r + " must be a string."); return t; }, isOptionalString: function (e, r) { return void 0 === r ? t : t.isString(e, r); }, isStringArray: function (r, n) { if (!Array.isArray(n))
657
- throw new B(e, r + " must be an array of strings."); var o, i = function (e, t) { var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (!r) {
658
- if (Array.isArray(e) || (r = m(e)) || t && e && "number" == typeof e.length) {
660
+ } return Z(n); }
661
+ var ee = {};
662
+ function te(e, t) { return new Promise((function (r, n) { var i = function (e) { var t = re(e); if (t[0])
663
+ return t[0]; }(e); if (i && "true" === i.dataset.loaded)
664
+ try {
665
+ r(t());
666
+ }
667
+ catch (t) {
668
+ return n(new Error("".concat(e, " already loaded, but module was not found in global scope: ").concat(t)));
669
+ } var o = function (e) { var t = document.createElement("script"); return t.setAttribute("src", e), t.setAttribute("async", "true"), t.setAttribute("defer", "true"), document.head.appendChild(t), t; }(e); o.addEventListener("load", (function () { o.dataset.loaded = "true"; try {
670
+ r(t());
671
+ }
672
+ catch (t) {
673
+ n(new Error("".concat(e, " was loaded, but module was not found in global scope: ").concat(t)));
674
+ } })), o.addEventListener("error", (function (t) { n(new Error("".concat(e, " could not be loaded: ").concat(t))); })); })); }
675
+ var re = function (e) { return document.querySelectorAll('script[src="'.concat(e, '"]')); };
676
+ var ne = ["[Stytch]"], ie = function () { for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++)
677
+ r[n] = arguments[n]; return (e = console).warn.apply(e, ne.concat(r)); }, oe = function () { for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++)
678
+ r[n] = arguments[n]; return (e = console).error.apply(e, ne.concat(r)); }, ae = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.", se = function (e) { var t = { isObject: function (r, n) { var i = "object" === y(n) && !Array.isArray(n) && null !== n; if (!i)
679
+ throw new q(e, r + " must be an object."); return t; }, isOptionalObject: function (e, r) { return void 0 === r ? t : t.isObject(e, r); }, isString: function (r, n) { if ("string" != typeof n)
680
+ throw new q(e, r + " must be a string."); return t; }, isOptionalString: function (e, r) { return void 0 === r ? t : t.isString(e, r); }, isStringArray: function (r, n) { if (!Array.isArray(n))
681
+ throw new q(e, r + " must be an array of strings."); var i, o = function (e, t) { var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (!r) {
682
+ if (Array.isArray(e) || (r = b(e)) || t && e && "number" == typeof e.length) {
659
683
  r && (e = r);
660
- var n = 0, o = function () { };
661
- return { s: o, n: function () { return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] }; }, e: function (e) { throw e; }, f: o };
684
+ var n = 0, i = function () { };
685
+ return { s: i, n: function () { return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] }; }, e: function (e) { throw e; }, f: i };
662
686
  }
663
687
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
664
- } var i, a = !0, s = !1; return { s: function () { r = r.call(e); }, n: function () { var e = r.next(); return a = e.done, e; }, e: function (e) { s = !0, i = e; }, f: function () { try {
688
+ } var o, a = !0, s = !1; return { s: function () { r = r.call(e); }, n: function () { var e = r.next(); return a = e.done, e; }, e: function (e) { s = !0, o = e; }, f: function () { try {
665
689
  a || null == r.return || r.return();
666
690
  }
667
691
  finally {
668
692
  if (s)
669
- throw i;
693
+ throw o;
670
694
  } } }; }(n); try {
671
- for (i.s(); !(o = i.n()).done;) {
672
- if ("string" != typeof o.value)
673
- throw new B(e, r + " must be an array of strings.");
695
+ for (o.s(); !(i = o.n()).done;) {
696
+ if ("string" != typeof i.value)
697
+ throw new q(e, r + " must be an array of strings.");
674
698
  }
675
699
  }
676
700
  catch (e) {
677
- i.e(e);
701
+ o.e(e);
678
702
  }
679
703
  finally {
680
- i.f();
704
+ o.f();
681
705
  } return t; }, isOptionalStringArray: function (e, r) { return void 0 === r ? t : t.isStringArray(e, r); }, isNumber: function (r, n) { if ("number" != typeof n)
682
- throw new B(e, r + " must be a number."); return t; }, isOptionalNumber: function (e, r) { return void 0 === r ? t : t.isNumber(e, r); } }; return t; };
683
- function re(e) { var t = e.method, r = e.errorMessage, n = e.finalURL, o = e.basicAuthHeader, i = e.xSDKClientHeader, a = e.xSDKParentHostHeader, s = e.body; return z(this, void 0, void 0, _().mark((function e() { var c, u, l, h, f; return _().wrap((function (e) { for (;;)
706
+ throw new q(e, r + " must be a number."); return t; }, isOptionalNumber: function (e, r) { return void 0 === r ? t : t.isNumber(e, r); } }; return t; };
707
+ function ce(e) { var t = e.method, r = e.errorMessage, n = e.finalURL, i = e.basicAuthHeader, o = e.xSDKClientHeader, a = e.xSDKParentHostHeader, s = e.body; return H(this, void 0, void 0, w().mark((function e() { var c, u, l, d, h; return w().wrap((function (e) { for (;;)
684
708
  switch (e.prev = e.next) {
685
- case 0: return c = { Authorization: o, "Content-Type": "application/json", "X-SDK-Client": i }, a && (c["X-SDK-Parent-Host"] = a), u = { method: t, headers: c, body: s && JSON.stringify(s) }, e.prev = 3, e.next = 6, fetch(n, u);
709
+ case 0: return c = { Authorization: i, "Content-Type": "application/json", "X-SDK-Client": o }, a && (c["X-SDK-Parent-Host"] = a), u = { method: t, headers: c, body: s && JSON.stringify(s) }, e.prev = 3, e.next = 6, fetch(n, u);
686
710
  case 6:
687
711
  l = e.sent, e.next = 14;
688
712
  break;
@@ -700,25 +724,25 @@ function re(e) { var t = e.method, r = e.errorMessage, n = e.finalURL, o = e.bas
700
724
  }
701
725
  return e.prev = 15, e.next = 18, l.json();
702
726
  case 18:
703
- h = e.sent, e.next = 24;
727
+ d = e.sent, e.next = 24;
704
728
  break;
705
729
  case 21: throw e.prev = 21, e.t1 = e.catch(15), new U(r, "Invalid or no response from server");
706
730
  case 24:
707
- if (!("body" in h || "params" in h || "query" in h)) {
731
+ if (!("body" in d || "params" in d || "query" in d)) {
708
732
  e.next = 26;
709
733
  break;
710
734
  }
711
- throw new F(h);
712
- case 26: throw new K(h);
735
+ throw new z(d);
736
+ case 26: throw new W(d);
713
737
  case 27: return e.prev = 27, e.next = 30, l.json();
714
- case 30: return f = e.sent, e.abrupt("return", f.data);
738
+ case 30: return h = e.sent, e.abrupt("return", h.data);
715
739
  case 34: throw e.prev = 34, e.t2 = e.catch(27), new U(r, "Invalid response from the Stytch servers.");
716
740
  case 37:
717
741
  case "end": return e.stop();
718
742
  } }), e, null, [[3, 9], [15, 21], [27, 34]]); }))); }
719
- var ne = function () { function e(t, r) { var n = this; k(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) { (null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh(); }, this._reauthenticateWithBackoff = function () { var t = function (t) { return function (r) { return e.isUnrecoverableError(r) ? Promise.reject(r) : new Promise((function (r) { return setTimeout(r, e.timeoutForAttempt(t)); })).then((function () { return n._headlessSessionClient.authenticate(); })); }; }; return n._headlessSessionClient.authenticate().catch(t(0)).catch(t(1)).catch(t(2)).catch(t(3)).catch(t(4)); }, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange); } return g(e, [{ key: "performBackgroundRefresh", value: function () { var e = this; this._reauthenticateWithBackoff().then((function () { e.scheduleBackgroundRefresh(); })).catch((function () { Z("Session background refresh failed. Signalling to app that user is logged out."), e._subscriptionService.destroyState(); })); } }, { key: "scheduleBackgroundRefresh", value: function () { var t = this; this.cancelBackgroundRefresh(), this.timeout = setTimeout((function () { t.performBackgroundRefresh(); }), e.REFRESH_INTERVAL_MS); } }, { key: "cancelBackgroundRefresh", value: function () { null !== this.timeout && (clearTimeout(this.timeout), this.timeout = null); } }], [{ key: "timeoutForAttempt", value: function (e) { return Math.floor(350 * Math.random()) - 175 + 2e3 * Math.pow(2, e); } }, { key: "isUnrecoverableError", value: function (e) { return q.includes(e.error_type); } }]), e; }();
720
- ne.REFRESH_INTERVAL_MS = 18e4;
721
- var oe = function () { function e(t) { k(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = []; } return g(e, [{ key: "logEvent", value: function (e, t) { this.batch.push({ telemetry: e, event: t }), this.batch.length >= this.maxBatchSize && this.flush(); } }, { key: "flush", value: function () { return z(this, void 0, void 0, _().mark((function e() { var t; return _().wrap((function (e) { for (;;)
743
+ var ue = function () { function e(t, r) { var n = this; O(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) { (null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh(); }, this._reauthenticateWithBackoff = function () { var t = function (t) { return function (r) { return e.isUnrecoverableError(r) ? Promise.reject(r) : new Promise((function (r) { return setTimeout(r, e.timeoutForAttempt(t)); })).then((function () { return n._headlessSessionClient.authenticate(); })); }; }; return n._headlessSessionClient.authenticate().catch(t(0)).catch(t(1)).catch(t(2)).catch(t(3)).catch(t(4)); }, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange); } return S(e, [{ key: "performBackgroundRefresh", value: function () { var e = this; this._reauthenticateWithBackoff().then((function () { e.scheduleBackgroundRefresh(); })).catch((function () { ie("Session background refresh failed. Signalling to app that user is logged out."), e._subscriptionService.destroyState(); })); } }, { key: "scheduleBackgroundRefresh", value: function () { var t = this; this.cancelBackgroundRefresh(), this.timeout = setTimeout((function () { t.performBackgroundRefresh(); }), e.REFRESH_INTERVAL_MS); } }, { key: "cancelBackgroundRefresh", value: function () { null !== this.timeout && (clearTimeout(this.timeout), this.timeout = null); } }], [{ key: "timeoutForAttempt", value: function (e) { return Math.floor(350 * Math.random()) - 175 + 2e3 * Math.pow(2, e); } }, { key: "isUnrecoverableError", value: function (e) { return G.includes(e.error_type); } }]), e; }();
744
+ ue.REFRESH_INTERVAL_MS = 18e4;
745
+ var le = function () { function e(t) { O(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = []; } return S(e, [{ key: "logEvent", value: function (e, t) { this.batch.push({ telemetry: e, event: t }), this.batch.length >= this.maxBatchSize && this.flush(); } }, { key: "flush", value: function () { return H(this, void 0, void 0, w().mark((function e() { var t; return w().wrap((function (e) { for (;;)
722
746
  switch (e.prev = e.next) {
723
747
  case 0:
724
748
  if (this.batch.length) {
@@ -735,33 +759,33 @@ var oe = function () { function e(t) { k(this, e), this.maxBatchSize = t.maxBatc
735
759
  case "end": return e.stop();
736
760
  } }), e, this, [[4, 9]]); }))); } }]), e; }();
737
761
  Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 }), Promise.resolve({ pkceRequiredForPasswordResets: !1 });
738
- var ie = Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 }), ae = function () { function e(t, r, n) { var o = this, i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : ie; k(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.email = { loginOrSignup: function (e) { return z(o, void 0, void 0, _().mark((function t() { var r, n; return _().wrap((function (t) { for (;;)
762
+ var de = Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 }), he = function () { function e(t, r, n) { var i = this, o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : de; O(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = o, this.email = { loginOrSignup: function (e) { return H(i, void 0, void 0, w().mark((function t() { var r, n; return w().wrap((function (t) { for (;;)
739
763
  switch (t.prev = t.next) {
740
- case 0: return te("stytch.magicLinks.email.loginOrSignup").isString("email", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
764
+ case 0: return se("stytch.magicLinks.email.loginOrSignup").isString("email", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
741
765
  case 3: return r = t.sent, n = Object.assign(Object.assign({}, e), { pkce_code_challenge: r }), t.abrupt("return", this._networkClient.fetchSDK({ url: "/b2b/magic_links/email/login_or_signup", body: n, errorMessage: "Failed to send magic link", method: "POST" }));
742
766
  case 6:
743
767
  case "end": return t.stop();
744
- } }), t, this); }))); }, discovery: { send: function (e) { return z(o, void 0, void 0, _().mark((function t() { var r, n; return _().wrap((function (t) { for (;;)
768
+ } }), t, this); }))); }, discovery: { send: function (e) { return H(i, void 0, void 0, w().mark((function t() { var r, n; return w().wrap((function (t) { for (;;)
745
769
  switch (t.prev = t.next) {
746
- case 0: return te("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
770
+ case 0: return se("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
747
771
  case 3: return r = t.sent, n = Object.assign(Object.assign({}, e), { pkce_code_challenge: r }), t.abrupt("return", this._networkClient.fetchSDK({ url: "/b2b/magic_links/email/discovery/send", body: n, errorMessage: "Failed to send discovery magic link", method: "POST" }));
748
772
  case 6:
749
773
  case "end": return t.stop();
750
- } }), t, this); }))); } } }, this.authenticate = function (e) { return z(o, void 0, void 0, _().mark((function t() { var r, n, o; return _().wrap((function (t) { for (;;)
774
+ } }), t, this); }))); } } }, this.authenticate = function (e) { return H(i, void 0, void 0, w().mark((function t() { var r, n, i; return w().wrap((function (t) { for (;;)
751
775
  switch (t.prev = t.next) {
752
- case 0: return te("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this._pkceManager.getPKPair();
776
+ case 0: return se("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this._pkceManager.getPKPair();
753
777
  case 3: return r = t.sent, n = Object.assign({ pkce_code_verifier: null == r ? void 0 : r.code_verifier }, e), t.next = 7, this._networkClient.fetchSDK({ url: "/b2b/magic_links/authenticate", body: n, errorMessage: "Failed to authenticate token", method: "POST" });
754
- case 7: return o = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({ state: { session: o.member_session, member: o.member }, session_token: o.session_token, session_jwt: o.session_jwt }), t.abrupt("return", o);
778
+ case 7: return i = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({ state: { session: i.member_session, member: i.member }, session_token: i.session_token, session_jwt: i.session_jwt }), t.abrupt("return", i);
755
779
  case 11:
756
780
  case "end": return t.stop();
757
- } }), t, this); }))); }, this.discovery = { authenticate: function (e) { return z(o, void 0, void 0, _().mark((function t() { var r, n, o; return _().wrap((function (t) { for (;;)
781
+ } }), t, this); }))); }, this.discovery = { authenticate: function (e) { return H(i, void 0, void 0, w().mark((function t() { var r, n, i; return w().wrap((function (t) { for (;;)
758
782
  switch (t.prev = t.next) {
759
- case 0: return te("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
783
+ case 0: return se("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
760
784
  case 3: return r = t.sent, n = Object.assign({ pkce_code_verifier: null == r ? void 0 : r.code_verifier }, e), t.next = 7, this._networkClient.fetchSDK({ url: "/b2b/magic_links/discovery/authenticate", body: n, errorMessage: "Failed to authenticate intermediate magic link token", method: "POST" });
761
- case 7: return o = t.sent, this._pkceManager.clearPKPair(), t.abrupt("return", o);
785
+ case 7: return i = t.sent, this._pkceManager.clearPKPair(), t.abrupt("return", i);
762
786
  case 10:
763
787
  case "end": return t.stop();
764
- } }), t, this); }))); } }; } return g(e, [{ key: "getCodeChallenge", value: function () { return z(this, void 0, void 0, _().mark((function e() { var t, r; return _().wrap((function (e) { for (;;)
788
+ } }), t, this); }))); } }; } return S(e, [{ key: "getCodeChallenge", value: function () { return H(this, void 0, void 0, w().mark((function e() { var t, r; return w().wrap((function (e) { for (;;)
765
789
  switch (e.prev = e.next) {
766
790
  case 0: return e.next = 2, this._config;
767
791
  case 2:
@@ -781,20 +805,20 @@ var ie = Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 }), ae = function
781
805
  case 13: return r = e.sent, e.abrupt("return", r.code_challenge);
782
806
  case 15:
783
807
  case "end": return e.stop();
784
- } }), e, this); }))); } }]), e; }(), se = g((function e(t, r) { var n = this; k(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () { return z(n, void 0, void 0, _().mark((function e() { var t; return _().wrap((function (e) { for (;;)
808
+ } }), e, this); }))); } }]), e; }(), fe = S((function e(t, r) { var n = this; O(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () { return H(n, void 0, void 0, w().mark((function e() { var t; return w().wrap((function (e) { for (;;)
785
809
  switch (e.prev = e.next) {
786
810
  case 0: return e.next = 2, this._networkClient.fetchSDK({ url: "/b2b/organizations/members/me", errorMessage: "Failed to retrieve member info.", method: "GET" });
787
811
  case 2: return t = e.sent, this._subscriptionService.updateMember(t.member), e.abrupt("return", t.member);
788
812
  case 5:
789
813
  case "end": return e.stop();
790
- } }), e, this); }))); }, this.getSync = function () { return n._subscriptionService.getMember(); }, this.onChange = function (e) { return n._subscriptionService.subscribeToState((function (t) { var r; return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null); })); }; })), ce = function () { function e(t, r, n, o, i) { k(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = o, this._config = i; } return g(e, [{ key: "authenticate", value: function (e) { return z(this, void 0, void 0, _().mark((function t() { var r, n; return _().wrap((function (t) { for (;;)
814
+ } }), e, this); }))); }, this.getSync = function () { return n._subscriptionService.getMember(); }, this.onChange = function (e) { return n._subscriptionService.subscribeToState((function (t) { var r; return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null); })); }; })), pe = function () { function e(t, r, n, i, o) { O(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o; } return S(e, [{ key: "authenticate", value: function (e) { return H(this, void 0, void 0, w().mark((function t() { var r, n; return w().wrap((function (t) { for (;;)
791
815
  switch (t.prev = t.next) {
792
- case 0: return te("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this._pkceManager.getPKPair();
793
- case 3: return (r = t.sent) || Z("No code verifier found in local storage for SSO flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this._networkClient.fetchSDK({ url: "/sso/authenticate", method: "POST", body: Object.assign({ pkce_code_verifier: null == r ? void 0 : r.code_verifier }, e), errorMessage: "Failed to authenticate token" });
816
+ case 0: return se("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this._pkceManager.getPKPair();
817
+ case 3: return (r = t.sent) || ie("No code verifier found in local storage for SSO flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this._networkClient.fetchSDK({ url: "/sso/authenticate", method: "POST", body: Object.assign({ pkce_code_verifier: null == r ? void 0 : r.code_verifier }, e), errorMessage: "Failed to authenticate token" });
794
818
  case 7: return n = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({ state: { session: n.member_session, member: n.member }, session_token: n.session_token, session_jwt: n.session_jwt }), t.abrupt("return", n);
795
819
  case 11:
796
820
  case "end": return t.stop();
797
- } }), t, this); }))); } }, { key: "getBaseApiUrl", value: function () { return z(this, void 0, void 0, _().mark((function e() { return _().wrap((function (e) { for (;;)
821
+ } }), t, this); }))); } }, { key: "getBaseApiUrl", value: function () { return H(this, void 0, void 0, w().mark((function e() { return w().wrap((function (e) { for (;;)
798
822
  switch (e.prev = e.next) {
799
823
  case 0:
800
824
  if (!this._config.publicToken.includes("public-token-test")) {
@@ -805,12 +829,12 @@ var ie = Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 }), ae = function
805
829
  case 2: return e.abrupt("return", this._config.liveAPIURL);
806
830
  case 3:
807
831
  case "end": return e.stop();
808
- } }), e, this); }))); } }, { key: "start", value: function (e) { var t = e.connection_id, r = e.login_redirect_url, n = e.signup_redirect_url; return z(this, void 0, void 0, _().mark((function e() { var o, i, a, s, c; return _().wrap((function (e) { for (;;)
832
+ } }), e, this); }))); } }, { key: "start", value: function (e) { var t = e.connection_id, r = e.login_redirect_url, n = e.signup_redirect_url; return H(this, void 0, void 0, w().mark((function e() { var i, o, a, s, c; return w().wrap((function (e) { for (;;)
809
833
  switch (e.prev = e.next) {
810
834
  case 0: return e.next = 2, this._dynamicConfig;
811
- case 2: return o = e.sent, i = o.pkceRequiredForSso, e.next = 6, this.getBaseApiUrl();
835
+ case 2: return i = e.sent, o = i.pkceRequiredForSso, e.next = 6, this.getBaseApiUrl();
812
836
  case 6:
813
- if (a = e.sent, (s = new URL("".concat(a, "/v1/public/sso/start"))).searchParams.set("public_token", this._config.publicToken), s.searchParams.set("connection_id", t), !i) {
837
+ if (a = e.sent, (s = new URL("".concat(a, "/v1/public/sso/start"))).searchParams.set("public_token", this._config.publicToken), s.searchParams.set("connection_id", t), !o) {
814
838
  e.next = 17;
815
839
  break;
816
840
  }
@@ -822,111 +846,113 @@ var ie = Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 }), ae = function
822
846
  case 18: r && s.searchParams.set("login_redirect_url", r), n && s.searchParams.set("signup_redirect_url", n), window.location.href = s.toString();
823
847
  case 21:
824
848
  case "end": return e.stop();
825
- } }), e, this); }))); } }]), e; }(), ue = g((function e(t) { var r = this; k(this, e), this._networkClient = t, this.get = function () { return z(r, void 0, void 0, _().mark((function e() { var t; return _().wrap((function (e) { for (;;)
849
+ } }), e, this); }))); } }]), e; }(), ve = S((function e(t) { var r = this; O(this, e), this._networkClient = t, this.get = function () { return H(r, void 0, void 0, w().mark((function e() { var t; return w().wrap((function (e) { for (;;)
826
850
  switch (e.prev = e.next) {
827
851
  case 0: return e.next = 2, this._networkClient.fetchSDK({ url: "/b2b/organizations/me", errorMessage: "Failed to retrieve organization info.", method: "GET" });
828
852
  case 2: return t = e.sent, e.abrupt("return", t.organization);
829
853
  case 4:
830
854
  case "end": return e.stop();
831
- } }), e, this); }))); }; })), le = function () { function e(t, r) { var n = this; k(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () { return n._subscriptionService.getSession(); }, this.onChange = function (e) { return n._subscriptionService.subscribeToState((function (t) { var r; return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null); })); }, this.revoke = function (e) { return z(n, void 0, void 0, _().mark((function t() { var r; return _().wrap((function (t) { for (;;)
855
+ } }), e, this); }))); }; })), me = function () { function e(t, r) { var n = this; O(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () { return n._subscriptionService.getSession(); }, this.onChange = function (e) { return n._subscriptionService.subscribeToState((function (t) { var r; return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null); })); }, this.revoke = function (e) { return H(n, void 0, void 0, w().mark((function t() { var r; return w().wrap((function (t) { for (;;)
832
856
  switch (t.prev = t.next) {
833
857
  case 0: return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({ url: "/b2b/sessions/revoke", errorMessage: "Error revoking session", method: "POST" });
834
858
  case 3: return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
835
- case 8: throw t.prev = 8, t.t0 = t.catch(0), ((null == e ? void 0 : e.forceClear) || q.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
859
+ case 8: throw t.prev = 8, t.t0 = t.catch(0), ((null == e ? void 0 : e.forceClear) || G.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
836
860
  case 12:
837
861
  case "end": return t.stop();
838
- } }), t, this, [[0, 8]]); }))); }, this.authenticate = function (e) { return z(n, void 0, void 0, _().mark((function t() { var r, n; return _().wrap((function (t) { for (;;)
862
+ } }), t, this, [[0, 8]]); }))); }, this.authenticate = function (e) { return H(n, void 0, void 0, w().mark((function t() { var r, n; return w().wrap((function (t) { for (;;)
839
863
  switch (t.prev = t.next) {
840
864
  case 0: return t.prev = 0, r = { session_duration_minutes: null == e ? void 0 : e.session_duration_minutes }, t.next = 4, this._networkClient.fetchSDK({ url: "/b2b/sessions/authenticate", body: r, errorMessage: "Error authenticating session", method: "POST" });
841
865
  case 4: return n = t.sent, this._subscriptionService.updateStateAndTokens({ state: { session: n.member_session, member: n.member }, session_token: n.session_token, session_jwt: n.session_jwt }), t.abrupt("return", n);
842
- case 9: throw t.prev = 9, t.t0 = t.catch(0), q.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
866
+ case 9: throw t.prev = 9, t.t0 = t.catch(0), G.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
843
867
  case 13:
844
868
  case "end": return t.stop();
845
- } }), t, this, [[0, 9]]); }))); }, this.exchange = function (e) { return z(n, void 0, void 0, _().mark((function t() { var r; return _().wrap((function (t) { for (;;)
869
+ } }), t, this, [[0, 9]]); }))); }, this.exchange = function (e) { return H(n, void 0, void 0, w().mark((function t() { var r; return w().wrap((function (t) { for (;;)
846
870
  switch (t.prev = t.next) {
847
- case 0: return te("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({ url: "/b2b/sessions/exchange", body: e, errorMessage: "Failed to exchange session", method: "POST" });
871
+ case 0: return se("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({ url: "/b2b/sessions/exchange", body: e, errorMessage: "Failed to exchange session", method: "POST" });
848
872
  case 4: return r = t.sent, this._subscriptionService.updateStateAndTokens({ state: { session: r.member_session, member: r.member }, session_token: r.session_token, session_jwt: r.session_jwt }), t.abrupt("return", r);
849
873
  case 9: throw t.prev = 9, t.t0 = t.catch(1), t.t0;
850
874
  case 12:
851
875
  case "end": return t.stop();
852
- } }), t, this, [[1, 9]]); }))); }; } return g(e, [{ key: "getTokens", value: function () { return this._subscriptionService.getTokens(); } }]), e; }(), he = g((function e(t, r) { var n = this; k(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = { list: function (e) { return z(n, void 0, void 0, _().mark((function t() { return _().wrap((function (t) { for (;;)
876
+ } }), t, this, [[1, 9]]); }))); }; } return S(e, [{ key: "getTokens", value: function () { return this._subscriptionService.getTokens(); } }]), e; }(), _e = S((function e(t, r) { var n = this; O(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = { list: function (e) { return H(n, void 0, void 0, w().mark((function t() { return w().wrap((function (t) { for (;;)
853
877
  switch (t.prev = t.next) {
854
- case 0: return te("stytch.discovery.organizations.list").isOptionalString("intermediate_session_token", e.intermediate_session_token), t.abrupt("return", this._networkClient.fetchSDK({ url: "/b2b/discovery/organizations", body: e, errorMessage: "Failed to retrieve discovered organizations", method: "POST" }));
878
+ case 0: return se("stytch.discovery.organizations.list").isOptionalString("intermediate_session_token", e.intermediate_session_token), t.abrupt("return", this._networkClient.fetchSDK({ url: "/b2b/discovery/organizations", body: e, errorMessage: "Failed to retrieve discovered organizations", method: "POST" }));
855
879
  case 2:
856
880
  case "end": return t.stop();
857
- } }), t, this); }))); }, create: function (e) { return z(n, void 0, void 0, _().mark((function t() { var r; return _().wrap((function (t) { for (;;)
881
+ } }), t, this); }))); }, create: function (e) { return H(n, void 0, void 0, w().mark((function t() { var r; return w().wrap((function (t) { for (;;)
858
882
  switch (t.prev = t.next) {
859
- case 0: return te("stytch.discovery.organizations.create").isString("intermediate_session_token", e.intermediate_session_token).isNumber("session_duration_minutes", e.session_duration_minutes).isString("organization_name", e.organization_name).isString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods), t.next = 3, this._networkClient.fetchSDK({ url: "/b2b/discovery/organizations/create", body: e, errorMessage: "Failed to create organization and member", method: "POST" });
883
+ case 0: return se("stytch.discovery.organizations.create").isString("intermediate_session_token", e.intermediate_session_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods), t.next = 3, this._networkClient.fetchSDK({ url: "/b2b/discovery/organizations/create", body: e, errorMessage: "Failed to create organization and member", method: "POST" });
860
884
  case 3: return r = t.sent, this._subscriptionService.updateStateAndTokens({ state: { session: r.member_session, member: r.member }, session_token: r.session_token, session_jwt: r.session_jwt }), t.abrupt("return", r);
861
885
  case 6:
862
886
  case "end": return t.stop();
863
- } }), t, this); }))); } }, this.intermediateSessions = { exchange: function (e) { return z(n, void 0, void 0, _().mark((function t() { var r; return _().wrap((function (t) { for (;;)
887
+ } }), t, this); }))); } }, this.intermediateSessions = { exchange: function (e) { return H(n, void 0, void 0, w().mark((function t() { var r; return w().wrap((function (t) { for (;;)
864
888
  switch (t.prev = t.next) {
865
- case 0: return te("stytch.discovery.intermediateSessions.exchange").isString("intermediate_session_token", e.intermediate_session_token).isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this._networkClient.fetchSDK({ url: "/b2b/discovery/intermediate_sessions/exchange", body: e, errorMessage: "Failed to exchange intermediate session", method: "POST" });
889
+ case 0: return se("stytch.discovery.intermediateSessions.exchange").isString("intermediate_session_token", e.intermediate_session_token).isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this._networkClient.fetchSDK({ url: "/b2b/discovery/intermediate_sessions/exchange", body: e, errorMessage: "Failed to exchange intermediate session", method: "POST" });
866
890
  case 3: return r = t.sent, this._subscriptionService.updateStateAndTokens({ state: { session: r.member_session, member: r.member }, session_token: r.session_token, session_jwt: r.session_jwt }), t.abrupt("return", r);
867
891
  case 6:
868
892
  case "end": return t.stop();
869
- } }), t, this); }))); } }; })), fe = Symbol.for("stytch__internal"), de = function (e, t) { Object.assign(e, function (e, t, r) { return (t = d(t)) in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e; }({}, fe, t)); }, pe = function (e) { return (document.cookie ? document.cookie.split("; ") : []).filter((function (t) { var r = l(t.split("="), 1)[0]; return e === r; })).length > 1; };
870
- function ve(e, t, r, n) { return new (r || (r = Promise))((function (o, i) { function a(e) { try {
893
+ } }), t, this); }))); } }; }));
894
+ Promise.resolve({ pkceRequiredForPasswordResets: !1 });
895
+ var ye = Symbol.for("stytch__internal"), be = function (e, t) { Object.assign(e, function (e, t, r) { return (t = m(t)) in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e; }({}, ye, t)); }, ge = function (e) { return (document.cookie ? document.cookie.split("; ") : []).filter((function (t) { var r = f(t.split("="), 1)[0]; return e === r; })).length > 1; };
896
+ function we(e, t, r, n) { return new (r || (r = Promise))((function (i, o) { function a(e) { try {
871
897
  c(n.next(e));
872
898
  }
873
899
  catch (e) {
874
- i(e);
900
+ o(e);
875
901
  } } function s(e) { try {
876
902
  c(n.throw(e));
877
903
  }
878
904
  catch (e) {
879
- i(e);
880
- } } function c(e) { var t; e.done ? o(e.value) : (t = e.value, t instanceof r ? t : new r((function (e) { e(t); }))).then(a, s); } c((n = n.apply(e, t || [])).next()); })); }
881
- var me = function () { function e(t, r, n, o) { s(this, e), this._publicToken = t, this._subscriptionDataLayer = r, this.baseURL = n, this.additionalTelemetryDataFn = o, this.updateSessionToken = function () { return null; }, this.eventLogger = new oe({ maxBatchSize: 15, intervalDurationMs: 800, logEventURL: this.buildSDKUrl("/events") }); } return u(e, [{ key: "logEvent", value: function (e) { var t = e.name, r = e.details, n = e.error, o = void 0 === n ? {} : n; this.eventLogger.logEvent(this.createTelemetryBlob(), { public_token: this._publicToken, event_name: t, details: r, error_code: o.error_code, error_description: o.error_description, http_status_code: o.http_status_code }); } }, { key: "createTelemetryBlob", value: function () { return Object.assign(Object.assign({ event_id: "event-id-".concat($()), app_session_id: "app-session-id-".concat($()), persistent_id: "persistent-id-".concat($()), client_sent_at: (new Date).toISOString(), timezone: Intl.DateTimeFormat().resolvedOptions().timeZone }, this.additionalTelemetryDataFn()), { app: { identifier: window.location.hostname }, sdk: { identifier: "Stytch.js Javascript SDK", version: "0.11.3" } }); } }, { key: "fetchSDK", value: function (e) { var t = e.url, r = e.body, n = e.errorMessage, o = e.method; return ve(this, void 0, void 0, a().mark((function e() { var i, s, c, u; return a().wrap((function (e) { for (;;)
905
+ o(e);
906
+ } } function c(e) { var t; e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r((function (e) { e(t); }))).then(a, s); } c((n = n.apply(e, t || [])).next()); })); }
907
+ var ke = function () { function e(t, r, n, i) { l(this, e), this._publicToken = t, this._subscriptionDataLayer = r, this.baseURL = n, this.additionalTelemetryDataFn = i, this.updateSessionToken = function () { return null; }, this.eventLogger = new le({ maxBatchSize: 15, intervalDurationMs: 800, logEventURL: this.buildSDKUrl("/events") }); } return h(e, [{ key: "logEvent", value: function (e) { var t = e.name, r = e.details, n = e.error, i = void 0 === n ? {} : n; this.eventLogger.logEvent(this.createTelemetryBlob(), { public_token: this._publicToken, event_name: t, details: r, error_code: i.error_code, error_description: i.error_description, http_status_code: i.http_status_code }); } }, { key: "createTelemetryBlob", value: function () { return Object.assign(Object.assign({ event_id: "event-id-".concat(Q()), app_session_id: "app-session-id-".concat(Q()), persistent_id: "persistent-id-".concat(Q()), client_sent_at: (new Date).toISOString(), timezone: Intl.DateTimeFormat().resolvedOptions().timeZone }, this.additionalTelemetryDataFn()), { app: { identifier: window.location.hostname }, sdk: { identifier: "Stytch.js Javascript SDK", version: "0.12.0" } }); } }, { key: "fetchSDK", value: function (e) { var t = e.url, r = e.body, n = e.errorMessage, i = e.method; return we(this, void 0, void 0, u().mark((function e() { var o, a, s, c; return u().wrap((function (e) { for (;;)
882
908
  switch (e.prev = e.next) {
883
- case 0: return i = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), c = window.btoa(JSON.stringify(this.createTelemetryBlob())), u = window.location.origin, e.abrupt("return", re({ basicAuthHeader: s, body: r, errorMessage: n, finalURL: this.buildSDKUrl(t), method: o, xSDKClientHeader: c, xSDKParentHostHeader: u }));
909
+ case 0: return o = this._subscriptionDataLayer.readSessionCookie().session_token, a = "Basic " + window.btoa(this._publicToken + ":" + (o || this._publicToken)), s = window.btoa(JSON.stringify(this.createTelemetryBlob())), c = window.location.origin, e.abrupt("return", ce({ basicAuthHeader: a, body: r, errorMessage: n, finalURL: this.buildSDKUrl(t), method: i, xSDKClientHeader: s, xSDKParentHostHeader: c }));
884
910
  case 5:
885
911
  case "end": return e.stop();
886
912
  } }), e, this); }))); } }, { key: "buildSDKUrl", value: function (e) { return "".concat(this.baseURL, "/sdk/v1").concat(e); } }]), e; }();
887
913
  /*! js-cookie v3.0.1 | MIT */
888
- function ye(e) { for (var t = 1; t < arguments.length; t++) {
914
+ function Se(e) { for (var t = 1; t < arguments.length; t++) {
889
915
  var r = arguments[t];
890
916
  for (var n in r)
891
917
  e[n] = r[n];
892
918
  } return e; }
893
- var _e = function e(t, r) { function n(e, n, o) { if ("undefined" != typeof document) {
894
- "number" == typeof (o = ye({}, r, o)).expires && (o.expires = new Date(Date.now() + 864e5 * o.expires)), o.expires && (o.expires = o.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
895
- var i = "";
896
- for (var a in o)
897
- o[a] && (i += "; " + a, !0 !== o[a] && (i += "=" + o[a].split(";")[0]));
898
- return document.cookie = e + "=" + t.write(n, e) + i;
919
+ var Oe = function e(t, r) { function n(e, n, i) { if ("undefined" != typeof document) {
920
+ "number" == typeof (i = Se({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
921
+ var o = "";
922
+ for (var a in i)
923
+ i[a] && (o += "; " + a, !0 !== i[a] && (o += "=" + i[a].split(";")[0]));
924
+ return document.cookie = e + "=" + t.write(n, e) + o;
899
925
  } } return Object.create({ set: n, get: function (e) { if ("undefined" != typeof document && (!arguments.length || e)) {
900
- for (var r = document.cookie ? document.cookie.split("; ") : [], n = {}, o = 0; o < r.length; o++) {
901
- var i = r[o].split("="), a = i.slice(1).join("=");
926
+ for (var r = document.cookie ? document.cookie.split("; ") : [], n = {}, i = 0; i < r.length; i++) {
927
+ var o = r[i].split("="), a = o.slice(1).join("=");
902
928
  try {
903
- var s = decodeURIComponent(i[0]);
929
+ var s = decodeURIComponent(o[0]);
904
930
  if (n[s] = t.read(a, s), e === s)
905
931
  break;
906
932
  }
907
933
  catch (e) { }
908
934
  }
909
935
  return e ? n[e] : n;
910
- } }, remove: function (e, t) { n(e, "", ye({}, t, { expires: -1 })); }, withAttributes: function (t) { return e(this.converter, ye({}, this.attributes, t)); }, withConverter: function (t) { return e(ye({}, this.converter, t), this.attributes); } }, { attributes: { value: Object.freeze(r) }, converter: { value: Object.freeze(t) } }); }({ read: function (e) { return '"' === e[0] && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent); }, write: function (e) { return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent); } }, { path: "/" }), be = function (e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""; return "".concat("stytch_sdk_state_").concat(e).concat(t ? "::".concat(t) : ""); }, ge = function () { function e(t, r) { var n = this; s(this, e), this.browserSessionStorage = { getItem: function (e) { return sessionStorage.getItem(be(n.publicToken, e)); }, setItem: function (e, t) { return sessionStorage.setItem(be(n.publicToken, e), t); }, removeItem: function (e) { return sessionStorage.removeItem(be(n.publicToken, e)); } }, this.publicToken = t, this.state = null, this.subscriptions = {}, (null == r ? void 0 : r.cookieOptions) ? (te("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", r.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", r.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.path", r.cookieOptions.path), this._jwtCookieName = r.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = r.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = r.cookieOptions.path || null, this._cookieAvailableToSubdomains = r.cookieOptions.availableToSubdomains || !1) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._cookieAvailableToSubdomains = !1); var o = localStorage.getItem(be(this.publicToken)); if (o) {
911
- var i;
936
+ } }, remove: function (e, t) { n(e, "", Se({}, t, { expires: -1 })); }, withAttributes: function (t) { return e(this.converter, Se({}, this.attributes, t)); }, withConverter: function (t) { return e(Se({}, this.converter, t), this.attributes); } }, { attributes: { value: Object.freeze(r) }, converter: { value: Object.freeze(t) } }); }({ read: function (e) { return '"' === e[0] && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent); }, write: function (e) { return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent); } }, { path: "/" }), Ee = function (e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""; return "".concat("stytch_sdk_state_").concat(e).concat(t ? "::".concat(t) : ""); }, Te = function () { function e(t, r) { var n = this; l(this, e), this.browserSessionStorage = { getItem: function (e) { return sessionStorage.getItem(Ee(n.publicToken, e)); }, setItem: function (e, t) { return sessionStorage.setItem(Ee(n.publicToken, e), t); }, removeItem: function (e) { return sessionStorage.removeItem(Ee(n.publicToken, e)); } }, this.publicToken = t, this.state = null, this.subscriptions = {}, (null == r ? void 0 : r.cookieOptions) ? (se("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", r.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", r.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.path", r.cookieOptions.path), this._jwtCookieName = r.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = r.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = r.cookieOptions.path || null, this._cookieAvailableToSubdomains = r.cookieOptions.availableToSubdomains || !1) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._cookieAvailableToSubdomains = !1); var i = localStorage.getItem(Ee(this.publicToken)); if (i) {
937
+ var o;
912
938
  try {
913
- i = JSON.parse(o);
939
+ o = JSON.parse(i);
914
940
  }
915
941
  catch (e) {
916
942
  return this.syncToLocalStorage(), void this.removeSessionCookie();
917
943
  }
918
- this.state = i;
944
+ this.state = o;
919
945
  }
920
946
  else
921
- this.removeSessionCookie(); } return u(e, [{ key: "opaqueTokenCookieName", get: function () { var e; return null !== (e = this._opaqueTokenCookieName) && void 0 !== e ? e : "stytch_session"; } }, { key: "jwtCookieName", get: function () { var e; return null !== (e = this._jwtCookieName) && void 0 !== e ? e : "stytch_session_jwt"; } }, { key: "readSessionCookie", value: function () { return { session_token: _e.get(this.opaqueTokenCookieName), session_jwt: _e.get(this.jwtCookieName) }; } }, { key: "writeSessionCookie", value: function (t) { var r, n, o, i, a = t.state, s = t.session_token, c = t.session_jwt, u = e.generateCookieOpts({ expiresAt: null !== (n = null === (r = null == a ? void 0 : a.session) || void 0 === r ? void 0 : r.expires_at) && void 0 !== n ? n : "", availableToSubdomains: this._cookieAvailableToSubdomains, path: this._cookiePath }); _e.set(this.opaqueTokenCookieName, s, u), _e.set(this.jwtCookieName, c, u); var l = e.generateCookieOpts({ expiresAt: null !== (i = null === (o = null == a ? void 0 : a.session) || void 0 === o ? void 0 : o.expires_at) && void 0 !== i ? i : "", availableToSubdomains: !this._cookieAvailableToSubdomains, path: this._cookiePath }); pe(this.jwtCookieName) && _e.remove(this.jwtCookieName, l), pe(this.opaqueTokenCookieName) && _e.remove(this.opaqueTokenCookieName, l), pe(this.jwtCookieName) && Z("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), pe(this.opaqueTokenCookieName) && Z("Could not remove extraneous opaque token cookie."); } }, { key: "removeSessionCookie", value: function () { var t = this; [!0, !1].forEach((function (r) { [t._cookiePath, null].forEach((function (n) { var o = e.generateCookieOpts({ expiresAt: new Date(0).toString(), availableToSubdomains: r, path: n }); _e.remove(t.opaqueTokenCookieName, o), _e.remove(t.jwtCookieName, o); })); })); } }, { key: "syncToLocalStorage", value: function () { localStorage.setItem(be(this.publicToken), JSON.stringify(this.state)); } }, { key: "getItem", value: function (e) { return localStorage.getItem(be(this.publicToken, e)); } }, { key: "setItem", value: function (e, t) { return localStorage.setItem(be(this.publicToken, e), t); } }, { key: "removeItem", value: function (e) { return localStorage.removeItem(be(this.publicToken, e)); } }], [{ key: "generateCookieOpts", value: function (e) { var t = e.path, r = e.availableToSubdomains, n = e.expiresAt, o = { expires: new Date(n), sameSite: "lax" }; return t && (o.path = t), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? o.secure = !1 : (r && (o.domain = window.location.host), o.secure = !0), o; } }]), e; }(), ke = function (e) { r(n, ge); var t = o(n); function n() { return s(this, n), t.apply(this, arguments); } return u(n); }(), we = Symbol.for("__stytch_b2b_DataLayer"), Se = function (e, t) { var r, n = ((r = window)[we] || (r[we] = {}), r[we]); return n[e] || (n[e] = new ke(e, t)), n[e]; }, Oe = function (e, t) { Object.values(e).forEach((function (e) { return e(t); })); }, Ee = function () { var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE, t = void 0 === e ? [] : e; return function e(r, n) { return v(r) === v(n) && (null === r || null === n ? r === n : "object" === v(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some((function (e) { return !(e in n); })) && Object.entries(r).filter((function (e) { var r = p(e, 1)[0]; return !t.includes(r); })).every((function (t) { var r = p(t, 2), o = r[0], i = r[1]; return e(i, n[o]); })) : r === n); }; }({ KEYS_TO_EXCLUDE: ["last_accessed_at"] }), Te = function () { function e(t, r) { var n, o = this; s(this, e), this._publicToken = t, this._datalayer = r, this._listen = function (e) { if (e.key === be(o._publicToken))
947
+ this.removeSessionCookie(); } return h(e, [{ key: "opaqueTokenCookieName", get: function () { var e; return null !== (e = this._opaqueTokenCookieName) && void 0 !== e ? e : "stytch_session"; } }, { key: "jwtCookieName", get: function () { var e; return null !== (e = this._jwtCookieName) && void 0 !== e ? e : "stytch_session_jwt"; } }, { key: "readSessionCookie", value: function () { return { session_token: Oe.get(this.opaqueTokenCookieName), session_jwt: Oe.get(this.jwtCookieName) }; } }, { key: "writeSessionCookie", value: function (t) { var r, n, i, o, a = t.state, s = t.session_token, c = t.session_jwt, u = e.generateCookieOpts({ expiresAt: null !== (n = null === (r = null == a ? void 0 : a.session) || void 0 === r ? void 0 : r.expires_at) && void 0 !== n ? n : "", availableToSubdomains: this._cookieAvailableToSubdomains, path: this._cookiePath }); Oe.set(this.opaqueTokenCookieName, s, u), Oe.set(this.jwtCookieName, c, u); var l = e.generateCookieOpts({ expiresAt: null !== (o = null === (i = null == a ? void 0 : a.session) || void 0 === i ? void 0 : i.expires_at) && void 0 !== o ? o : "", availableToSubdomains: !this._cookieAvailableToSubdomains, path: this._cookiePath }); ge(this.jwtCookieName) && Oe.remove(this.jwtCookieName, l), ge(this.opaqueTokenCookieName) && Oe.remove(this.opaqueTokenCookieName, l), ge(this.jwtCookieName) && ie("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), ge(this.opaqueTokenCookieName) && ie("Could not remove extraneous opaque token cookie."); } }, { key: "removeSessionCookie", value: function () { var t = this; [!0, !1].forEach((function (r) { [t._cookiePath, null].forEach((function (n) { var i = e.generateCookieOpts({ expiresAt: new Date(0).toString(), availableToSubdomains: r, path: n }); Oe.remove(t.opaqueTokenCookieName, i), Oe.remove(t.jwtCookieName, i); })); })); } }, { key: "syncToLocalStorage", value: function () { localStorage.setItem(Ee(this.publicToken), JSON.stringify(this.state)); } }, { key: "getItem", value: function (e) { return localStorage.getItem(Ee(this.publicToken, e)); } }, { key: "setItem", value: function (e, t) { return localStorage.setItem(Ee(this.publicToken, e), t); } }, { key: "removeItem", value: function (e) { return localStorage.removeItem(Ee(this.publicToken, e)); } }], [{ key: "generateCookieOpts", value: function (e) { var t = e.path, r = e.availableToSubdomains, n = e.expiresAt, i = { expires: new Date(n), sameSite: "lax" }; return t && (i.path = t), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? i.secure = !1 : (r && (i.domain = window.location.host), i.secure = !0), i; } }]), e; }(), xe = function (e) { i(r, Te); var t = a(r); function r() { return l(this, r), t.apply(this, arguments); } return h(r); }(), Pe = Symbol.for("__stytch_b2b_DataLayer"), Ce = function (e, t) { var r, n = ((r = window)[Pe] || (r[Pe] = {}), r[Pe]); return n[e] || (n[e] = new xe(e, t)), n[e]; }, Ae = function (e, t) { Object.values(e).forEach((function (e) { return e(t); })); }, Le = function () { var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE, t = void 0 === e ? [] : e; return function e(r, n) { return y(r) === y(n) && (null === r || null === n ? r === n : "object" === y(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some((function (e) { return !(e in n); })) && Object.entries(r).filter((function (e) { var r = _(e, 1)[0]; return !t.includes(r); })).every((function (t) { var r = _(t, 2), i = r[0], o = r[1]; return e(o, n[i]); })) : r === n); }; }({ KEYS_TO_EXCLUDE: ["last_accessed_at"] }), je = function () { function e(t, r) { var n, i = this; l(this, e), this._publicToken = t, this._datalayer = r, this._listen = function (e) { if (e.key === Ee(i._publicToken))
922
948
  if (null !== e.newValue && "null" !== e.newValue) {
923
949
  var t = JSON.parse(e.newValue);
924
- o.updateState(t);
950
+ i.updateState(t);
925
951
  }
926
952
  else
927
- o.destroyState(); }, window.addEventListener("storage", this._listen); var i = null === (n = this._datalayer.state) || void 0 === n ? void 0 : n.session; i && Date.parse(i.expires_at) < Date.now() ? this.destroyState() : this._datalayer.readSessionCookie().session_token || this.destroyState(); } return u(e, [{ key: "getTokens", value: function () { var e = this._datalayer.readSessionCookie(), t = e.session_token, r = e.session_jwt; return t && r ? { session_token: t, session_jwt: r } : null; } }, { key: "destroyState", value: function () { this.updateStateAndTokens({ state: null, session_token: null, session_jwt: null }); } }, { key: "_updateStateAndTokensInternal", value: function (e) { var t = this._datalayer.state, r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state); this._datalayer.state = r, Ee(t, r) || Oe(this._datalayer.subscriptions, r); } }, { key: "updateStateAndTokens", value: function (e) { e.state ? this._datalayer.writeSessionCookie(e) : this._datalayer.removeSessionCookie(), this._updateStateAndTokensInternal(e), this._datalayer.syncToLocalStorage(); } }, { key: "updateState", value: function (e) { var t = this._datalayer.state, r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e); this._datalayer.state = r, Ee(t, r) || (Oe(this._datalayer.subscriptions, r), this._datalayer.syncToLocalStorage()); } }, { key: "updateTokens", value: function (e) { var t = e.session_token, r = e.session_jwt, n = this._datalayer.readSessionCookie(), o = Object.assign(Object.assign({}, n), { session_token: t, session_jwt: r }); t && r ? this._datalayer.writeSessionCookie(o) : this._datalayer.removeSessionCookie(); } }, { key: "subscribeToState", value: function (e) { return t = this._datalayer.subscriptions, r = e, n = Math.random().toString(36).slice(-10), t[n] = r, function () { return delete t[n]; }; var t, r, n; } }, { key: "getState", value: function () { return this._datalayer.state; } }, { key: "destroy", value: function () { window.removeEventListener("storage", this._listen); } }, { key: "syncFromDeviceStorage", value: function () { return null; } }]), e; }(), xe = function (e) { r(n, Te); var t = o(n); function n() { var e; return s(this, n), (e = t.apply(this, arguments)).updateMember = function (t) { return e.updateState({ member: t }); }, e.getMember = function () { var t, r; return null !== (r = null === (t = e.getState()) || void 0 === t ? void 0 : t.member) && void 0 !== r ? r : null; }, e.getSession = function () { var t, r; return null !== (r = null === (t = e.getState()) || void 0 === t ? void 0 : t.session) && void 0 !== r ? r : null; }, e; } return u(n); }();
928
- function Ce(e) { var t = e.toString(16); return 1 === t.length && (t = "0" + t), t; }
929
- var Pe, je, Le, Ae, Re, Ie, De = function () { function e(t, r) { s(this, e), this._dataLayer = t, this.namespace = r; } return u(e, [{ key: "key", value: function () { return "PKCE_VERIFIER:" + this.namespace; } }, { key: "startPKCETransaction", value: function () { return ve(this, void 0, void 0, a().mark((function t() { var r; return a().wrap((function (t) { for (;;)
953
+ i.destroyState(); }, window.addEventListener("storage", this._listen); var o = null === (n = this._datalayer.state) || void 0 === n ? void 0 : n.session; o && Date.parse(o.expires_at) < Date.now() ? this.destroyState() : this._datalayer.readSessionCookie().session_token || this.destroyState(); } return h(e, [{ key: "getTokens", value: function () { var e = this._datalayer.readSessionCookie(), t = e.session_token, r = e.session_jwt; return t && r ? { session_token: t, session_jwt: r } : null; } }, { key: "destroyState", value: function () { this.updateStateAndTokens({ state: null, session_token: null, session_jwt: null }); } }, { key: "_updateStateAndTokensInternal", value: function (e) { var t = this._datalayer.state, r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state); this._datalayer.state = r, Le(t, r) || Ae(this._datalayer.subscriptions, r); } }, { key: "updateStateAndTokens", value: function (e) { e.state ? this._datalayer.writeSessionCookie(e) : this._datalayer.removeSessionCookie(), this._updateStateAndTokensInternal(e), this._datalayer.syncToLocalStorage(); } }, { key: "updateState", value: function (e) { var t = this._datalayer.state, r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e); this._datalayer.state = r, Le(t, r) || (Ae(this._datalayer.subscriptions, r), this._datalayer.syncToLocalStorage()); } }, { key: "updateTokens", value: function (e) { var t = e.session_token, r = e.session_jwt, n = this._datalayer.readSessionCookie(), i = Object.assign(Object.assign({}, n), { session_token: t, session_jwt: r }); t && r ? this._datalayer.writeSessionCookie(i) : this._datalayer.removeSessionCookie(); } }, { key: "subscribeToState", value: function (e) { return t = this._datalayer.subscriptions, r = e, n = Math.random().toString(36).slice(-10), t[n] = r, function () { return delete t[n]; }; var t, r, n; } }, { key: "getState", value: function () { return this._datalayer.state; } }, { key: "destroy", value: function () { window.removeEventListener("storage", this._listen); } }, { key: "syncFromDeviceStorage", value: function () { return null; } }]), e; }(), Re = function (e) { i(r, je); var t = a(r); function r() { var e; return l(this, r), (e = t.apply(this, arguments)).updateMember = function (t) { return e.updateState({ member: t }); }, e.getMember = function () { var t, r; return null !== (r = null === (t = e.getState()) || void 0 === t ? void 0 : t.member) && void 0 !== r ? r : null; }, e.getSession = function () { var t, r; return null !== (r = null === (t = e.getState()) || void 0 === t ? void 0 : t.session) && void 0 !== r ? r : null; }, e; } return h(r); }();
954
+ function Ie(e) { var t = e.toString(16); return 1 === t.length && (t = "0" + t), t; }
955
+ var Ne, De, Me, Be, Ke, Fe, Ue = function () { function e(t, r) { l(this, e), this._dataLayer = t, this.namespace = r; } return h(e, [{ key: "key", value: function () { return "PKCE_VERIFIER:" + this.namespace; } }, { key: "startPKCETransaction", value: function () { return we(this, void 0, void 0, u().mark((function t() { var r; return u().wrap((function (t) { for (;;)
930
956
  switch (t.prev = t.next) {
931
957
  case 0: return t.next = 2, e.createProofkeyPair();
932
958
  case 2: return r = t.sent, this._dataLayer.setItem(this.key(), JSON.stringify(r)), t.abrupt("return", r);
@@ -937,56 +963,186 @@ var Pe, je, Le, Ae, Re, Ie, De = function () { function e(t, r) { s(this, e), th
937
963
  return JSON.parse(e);
938
964
  }
939
965
  catch (e) {
940
- return void Z("Found malformed Proof Key pair in localstorage.");
941
- } } }, { key: "clearPKPair", value: function () { return this._dataLayer.removeItem(this.key()); } }], [{ key: "createProofkeyPair", value: function () { return ve(this, void 0, void 0, a().mark((function e() { var r, n, o; return a().wrap((function (e) { for (;;)
966
+ return void ie("Found malformed Proof Key pair in localstorage.");
967
+ } } }, { key: "clearPKPair", value: function () { return this._dataLayer.removeItem(this.key()); } }], [{ key: "createProofkeyPair", value: function () { return we(this, void 0, void 0, u().mark((function e() { var t, r, i; return u().wrap((function (e) { for (;;)
942
968
  switch (e.prev = e.next) {
943
- case 0: return r = new Uint32Array(16), window.crypto.getRandomValues(r), n = Array.from(r).map(Ce).join(""), e.next = 5, window.crypto.subtle.digest("SHA-256", (new TextEncoder).encode(n));
944
- case 5: return o = e.sent, e.abrupt("return", { code_challenge: (i = o, a = void 0, btoa((a = String.fromCharCode).call.apply(a, [null].concat(t(new Uint8Array(i))))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")), code_verifier: n });
969
+ case 0: return t = new Uint32Array(16), window.crypto.getRandomValues(t), r = Array.from(t).map(Ie).join(""), e.next = 5, window.crypto.subtle.digest("SHA-256", (new TextEncoder).encode(r));
970
+ case 5: return i = e.sent, e.abrupt("return", { code_challenge: (o = i, a = void 0, btoa((a = String.fromCharCode).call.apply(a, [null].concat(n(new Uint8Array(o))))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")), code_verifier: r });
945
971
  case 7:
946
972
  case "end": return e.stop();
947
- } var i, a; }), e); }))); } }]), e; }(), Ne = "bootstrap", Me = function () { function e(t, r, n) { var o = this; s(this, e), this._publicToken = t, this._networkClient = r, this._dataLayer = n, this._bootstrapDataPromise = this._networkClient.fetchSDK({ url: "/projects/bootstrap/".concat(this._publicToken), method: "GET", errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken) }).then(e.mapBootstrapData).then((function (e) { return o._dataLayer.setItem(Ne, JSON.stringify(e)), e; })).catch((function (e) { return Q(e), { displayWatermark: !1, cnameDomain: null, emailDomains: ["stytch.com"], captchaSettings: { enabled: !1 }, pkceRequiredForEmailMagicLinks: !1, pkceRequiredForPasswordResets: !1, pkceRequiredForOAuth: !1, pkceRequiredForSso: !1 }; })); } return u(e, [{ key: "getSync", value: function () { var e = this._dataLayer.getItem(Ne); if (null === e)
973
+ } var o, a; }), e); }))); } }]), e; }(), qe = "bootstrap", ze = function () { function e(t, r, n) { var i = this; l(this, e), this._publicToken = t, this._networkClient = r, this._dataLayer = n, this._bootstrapDataPromise = this._networkClient.fetchSDK({ url: "/projects/bootstrap/".concat(this._publicToken), method: "GET", errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken) }).then(e.mapBootstrapData).then((function (e) { return i._dataLayer.setItem(qe, JSON.stringify(e)), e; })).catch((function (e) { return oe(e), { displayWatermark: !1, cnameDomain: null, emailDomains: ["stytch.com"], captchaSettings: { enabled: !1 }, pkceRequiredForEmailMagicLinks: !1, pkceRequiredForPasswordResets: !1, pkceRequiredForOAuth: !1, pkceRequiredForSso: !1 }; })); } return h(e, [{ key: "getSync", value: function () { var e = this._dataLayer.getItem(qe); if (null === e)
948
974
  return { displayWatermark: !1, cnameDomain: null, emailDomains: ["stytch.com"], captchaSettings: { enabled: !1 }, pkceRequiredForEmailMagicLinks: !1, pkceRequiredForPasswordResets: !1, pkceRequiredForOAuth: !1, pkceRequiredForSso: !1 }; try {
949
975
  return JSON.parse(e);
950
976
  }
951
977
  catch (e) {
952
978
  return { displayWatermark: !1, cnameDomain: null, emailDomains: ["stytch.com"], captchaSettings: { enabled: !1 }, pkceRequiredForEmailMagicLinks: !1, pkceRequiredForPasswordResets: !1, pkceRequiredForOAuth: !1, pkceRequiredForSso: !1 };
953
- } } }, { key: "getAsync", value: function () { return this._bootstrapDataPromise; } }], [{ key: "mapBootstrapData", value: function (e) { return { displayWatermark: !e.disable_sdk_watermark, captchaSettings: e.captcha_settings, cnameDomain: e.cname_domain, emailDomains: e.email_domains, pkceRequiredForEmailMagicLinks: e.pkce_required_for_email_magic_links, pkceRequiredForPasswordResets: e.pkce_required_for_password_resets, pkceRequiredForOAuth: e.pkce_required_for_oauth, pkceRequiredForSso: e.pkce_required_for_sso }; } }]), e; }(), Ue = u((function e(t, r) { var n, o = this; s(this, e), function (e) { if ("undefined" == typeof window)
954
- throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n")); }("StytchB2BHeadlessClient"), "string" != typeof (n = t) ? Z("Public token is malformed. Expected a string, got ".concat(v(n), ".").concat(ee)) : "" === n ? Z('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(ee)) : n.startsWith("public-token-") || Z('Public token is malformed. Expected "public-token-...", got '.concat(n, ".").concat(ee)); var i, a, c, u, l, h, f, d, p, m = r, y = { cookieOptions: null == (i = m) ? void 0 : i.cookieOptions, endpoints: { sdkBackendURL: null !== (c = null === (a = null == i ? void 0 : i.endpoints) || void 0 === a ? void 0 : a.sdkBackendURL) && void 0 !== c ? c : "https://web.stytch.com", testAPIURL: null !== (l = null === (u = null == i ? void 0 : i.endpoints) || void 0 === u ? void 0 : u.testAPIURL) && void 0 !== l ? l : "https://test.stytch.com", liveAPIURL: null !== (f = null === (h = null == i ? void 0 : i.endpoints) || void 0 === h ? void 0 : h.liveAPIURL) && void 0 !== f ? f : "https://api.stytch.com", clientsideServicesIframeURL: null !== (p = null === (d = null == i ? void 0 : i.endpoints) || void 0 === d ? void 0 : d.clientsideServicesIframeURL) && void 0 !== p ? p : "https://js.stytch.com/clientside-services/index.html" } }; this._dataLayer = Se(t, m), this._subscriptionService = new xe(t, this._dataLayer); this._networkClient = new me(t, this._dataLayer, y.endpoints.sdkBackendURL, (function () { var e, t, r, n; return { stytch_member_id: null === (t = null === (e = o._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id, stytch_member_session_id: null === (n = null === (r = o._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id }; })); var _ = new Me(t, this._networkClient, this._dataLayer); this.organization = new ue(this._networkClient), this.member = new se(this._networkClient, this._subscriptionService), this.session = new le(this._networkClient, this._subscriptionService), this.magicLinks = new ae(this._networkClient, this._subscriptionService, new De(this._dataLayer, "magic_links"), _.getAsync()), this.sso = new ce(this._networkClient, this._subscriptionService, new De(this._dataLayer, "sso"), _.getAsync(), { publicToken: t, testAPIURL: y.endpoints.testAPIURL, liveAPIURL: y.endpoints.liveAPIURL }), this.discovery = new he(this._networkClient, this._subscriptionService), this._sessionManager = new ne(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({ name: "b2b_sdk_instance_instantiated", details: { event_callback_registered: !1, error_callback_registered: !1, success_callback_registered: !1 } }), de(this, { bootstrap: _, publicToken: t }); }));
955
- function Be(e) { return Be = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, Be(e); }
956
- function Fe(e, t) { for (var r = 0; r < t.length; r++) {
979
+ } } }, { key: "getAsync", value: function () { return this._bootstrapDataPromise; } }], [{ key: "mapBootstrapData", value: function (e) { return { displayWatermark: !e.disable_sdk_watermark, captchaSettings: e.captcha_settings, cnameDomain: e.cname_domain, emailDomains: e.email_domains, pkceRequiredForEmailMagicLinks: e.pkce_required_for_email_magic_links, pkceRequiredForPasswordResets: e.pkce_required_for_password_resets, pkceRequiredForOAuth: e.pkce_required_for_oauth, pkceRequiredForSso: e.pkce_required_for_sso }; } }]), e; }();
980
+ !function (e) { e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords"; }(Ne || (Ne = {})), function (e) { e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch"; }(De || (De = {})), function (e) { e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet"; }(Me || (Me = {})), function (e) { e.embedded = "embedded", e.floating = "floating"; }(Be || (Be = {})), function (e) { e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email"; }(Ke || (Ke = {})), function (e) { e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL"; }(Fe || (Fe = {}));
981
+ var We, Ge = function (e) { i(n, t(Error)); var r = a(n); function n(e, t) { var i; return l(this, n), (i = r.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + t, i; } return h(n); }();
982
+ !function (e) { e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out"; }(We || (We = {}));
983
+ var He = function (t) { var r = { isObject: function (n, i) { var o = "object" === e(i) && !Array.isArray(i) && null !== i; if (!o)
984
+ throw new Ge(t, n + " must be an object."); return r; }, isOptionalObject: function (e, t) { return void 0 === t ? r : r.isObject(e, t); }, isString: function (e, n) { if ("string" != typeof n)
985
+ throw new Ge(t, e + " must be a string."); return r; }, isOptionalString: function (e, t) { return void 0 === t ? r : r.isString(e, t); }, isStringArray: function (e, n) { if (!Array.isArray(n))
986
+ throw new Ge(t, e + " must be an array of strings."); var i, o = function (e, t) { var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (!r) {
987
+ if (Array.isArray(e) || (r = p(e)) || t && e && "number" == typeof e.length) {
988
+ r && (e = r);
989
+ var n = 0, i = function () { };
990
+ return { s: i, n: function () { return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] }; }, e: function (e) { throw e; }, f: i };
991
+ }
992
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
993
+ } var o, a = !0, s = !1; return { s: function () { r = r.call(e); }, n: function () { var e = r.next(); return a = e.done, e; }, e: function (e) { s = !0, o = e; }, f: function () { try {
994
+ a || null == r.return || r.return();
995
+ }
996
+ finally {
997
+ if (s)
998
+ throw o;
999
+ } } }; }(n); try {
1000
+ for (o.s(); !(i = o.n()).done;) {
1001
+ if ("string" != typeof i.value)
1002
+ throw new Ge(t, e + " must be an array of strings.");
1003
+ }
1004
+ }
1005
+ catch (e) {
1006
+ o.e(e);
1007
+ }
1008
+ finally {
1009
+ o.f();
1010
+ } return r; }, isOptionalStringArray: function (e, t) { return void 0 === t ? r : r.isStringArray(e, t); }, isNumber: function (e, n) { if ("number" != typeof n)
1011
+ throw new Ge(t, e + " must be a number."); return r; }, isOptionalNumber: function (e, t) { return void 0 === t ? r : r.isNumber(e, t); } }; return r; };
1012
+ Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 }), Promise.resolve({ pkceRequiredForPasswordResets: !1 }), Promise.resolve({ pkceRequiredForEmailMagicLinks: !1 });
1013
+ var Ye, Ve, Je, $e, Xe, Ze, Qe = Promise.resolve({ pkceRequiredForPasswordResets: !1 }), et = function () { function e(t, r, n) { var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : Qe, o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : function () { return Promise.resolve(void 0); }; l(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.executeRecaptcha = o; } return h(e, [{ key: "getCodeChallenge", value: function () { return we(this, void 0, void 0, u().mark((function e() { var t, r; return u().wrap((function (e) { for (;;)
1014
+ switch (e.prev = e.next) {
1015
+ case 0: return e.next = 2, this._config;
1016
+ case 2:
1017
+ if (t = e.sent, t.pkceRequiredForPasswordResets) {
1018
+ e.next = 6;
1019
+ break;
1020
+ }
1021
+ return e.abrupt("return", void 0);
1022
+ case 6: return e.next = 8, this._pkceManager.getPKPair();
1023
+ case 8:
1024
+ if (!(r = e.sent)) {
1025
+ e.next = 11;
1026
+ break;
1027
+ }
1028
+ return e.abrupt("return", r.code_challenge);
1029
+ case 11: return e.next = 13, this._pkceManager.startPKCETransaction();
1030
+ case 13: return r = e.sent, e.abrupt("return", r.code_challenge);
1031
+ case 15:
1032
+ case "end": return e.stop();
1033
+ } }), e, this); }))); } }, { key: "authenticate", value: function (e) { return we(this, void 0, void 0, u().mark((function t() { var r, n, i, o; return u().wrap((function (t) { for (;;)
1034
+ switch (t.prev = t.next) {
1035
+ case 0: return He("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.executeRecaptcha();
1036
+ case 3: return r = t.sent, t.next = 6, this._pkceManager.getPKPair();
1037
+ case 6: return n = t.sent, i = null == n ? void 0 : n.code_verifier, t.next = 10, this._networkClient.fetchSDK({ url: "/b2b/passwords/authenticate", method: "POST", errorMessage: "Failed to authenticate password.", body: { organization_id: e.organization_id, email_address: e.email_address, password: e.password, session_duration_minutes: e.session_duration_minutes, captcha_token: r, code_verifier: i } });
1038
+ case 10: return o = t.sent, this._subscriptionService.updateStateAndTokens({ state: { session: o.member_session, member: o.member }, session_token: o.session_token, session_jwt: o.session_jwt }), t.abrupt("return", o);
1039
+ case 13:
1040
+ case "end": return t.stop();
1041
+ } }), t, this); }))); } }, { key: "resetByEmailStart", value: function (e) { return we(this, void 0, void 0, u().mark((function t() { var r, n; return u().wrap((function (t) { for (;;)
1042
+ switch (t.prev = t.next) {
1043
+ case 0: return He("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes), t.next = 3, this.getCodeChallenge();
1044
+ case 3: return r = t.sent, t.next = 6, this.executeRecaptcha();
1045
+ case 6: return n = t.sent, t.abrupt("return", this._networkClient.fetchSDK({ url: "/b2b/passwords/email/reset/start", method: "POST", errorMessage: "Failed to start password reset flow.", body: { organization_id: e.organization_id, email_address: e.email_address, login_redirect_url: e.login_redirect_url, reset_password_redirect_url: e.reset_password_redirect_url, reset_password_expiration_minutes: e.reset_password_expiration_minutes, reset_password_template_id: e.reset_password_template_id, code_challenge: r, captcha_token: n } }));
1046
+ case 8:
1047
+ case "end": return t.stop();
1048
+ } }), t, this); }))); } }, { key: "resetByEmail", value: function (e) { return we(this, void 0, void 0, u().mark((function t() { var r, n, i, o; return u().wrap((function (t) { for (;;)
1049
+ switch (t.prev = t.next) {
1050
+ case 0: return He("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.executeRecaptcha();
1051
+ case 3: return r = t.sent, t.next = 6, this._pkceManager.getPKPair();
1052
+ case 6: return n = t.sent, i = null == n ? void 0 : n.code_verifier, t.next = 10, this._networkClient.fetchSDK({ url: "/b2b/passwords/email/reset", method: "POST", errorMessage: "Failed to reset password.", body: { password_reset_token: e.password_reset_token, password: e.password, session_duration_minutes: e.session_duration_minutes, captcha_token: r, code_verifier: i } });
1053
+ case 10: return o = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({ state: { session: o.member_session, member: o.member }, session_token: o.session_token, session_jwt: o.session_jwt }), t.abrupt("return", o);
1054
+ case 14:
1055
+ case "end": return t.stop();
1056
+ } }), t, this); }))); } }, { key: "resetByExistingPassword", value: function (e) { return we(this, void 0, void 0, u().mark((function t() { var r; return u().wrap((function (t) { for (;;)
1057
+ switch (t.prev = t.next) {
1058
+ case 0: return He("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password), t.next = 3, this._networkClient.fetchSDK({ url: "/b2b/passwords/existing_password/reset", method: "POST", errorMessage: "Failed to reset password.", body: { organization_id: e.organization_id, email_address: e.email_address, existing_password: e.existing_password, new_password: e.new_password } });
1059
+ case 3: return r = t.sent, this._subscriptionService.updateStateAndTokens({ state: { session: r.member_session, member: r.member }, session_token: r.session_token, session_jwt: r.session_jwt }), t.abrupt("return", r);
1060
+ case 6:
1061
+ case "end": return t.stop();
1062
+ } }), t, this); }))); } }, { key: "resetBySession", value: function (e) { return we(this, void 0, void 0, u().mark((function t() { var r; return u().wrap((function (t) { for (;;)
1063
+ switch (t.prev = t.next) {
1064
+ case 0: return He("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this._networkClient.fetchSDK({ url: "/b2b/passwords/session/reset", method: "POST", errorMessage: "Failed to reset session.", body: { organization_id: e.organization_id, password: e.password } });
1065
+ case 3: return r = t.sent, this._subscriptionService.updateStateAndTokens({ state: { session: r.member_session, member: r.member }, session_token: r.session_token, session_jwt: r.session_jwt }), t.abrupt("return", r);
1066
+ case 6:
1067
+ case "end": return t.stop();
1068
+ } }), t, this); }))); } }, { key: "strengthCheck", value: function (e) { return we(this, void 0, void 0, u().mark((function t() { return u().wrap((function (t) { for (;;)
1069
+ switch (t.prev = t.next) {
1070
+ case 0: return He("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({ url: "/b2b/passwords/strength_check", method: "POST", errorMessage: "Failed to check password strength.", body: { email_address: e.email_address, password: e.password } }));
1071
+ case 2:
1072
+ case "end": return t.stop();
1073
+ } }), t, this); }))); } }]), e; }(), tt = function (e) { return function (e, t) { return H(this, void 0, void 0, w().mark((function r() { return w().wrap((function (r) { for (;;)
1074
+ switch (r.prev = r.next) {
1075
+ case 0:
1076
+ if (void 0 === ee[e]) {
1077
+ r.next = 2;
1078
+ break;
1079
+ }
1080
+ return r.abrupt("return", ee[e]);
1081
+ case 2: return ee[e] = te(e, t), r.abrupt("return", ee[e]);
1082
+ case 4:
1083
+ case "end": return r.stop();
1084
+ } }), r); }))); }("https://www.google.com/recaptcha/enterprise.js?render=".concat(e), (function () { return window.grecaptcha.enterprise; })); }, rt = h((function e(t) { var r = this; l(this, e), this.bootstrapPromise = t, this.executeRecaptcha = function () { return we(r, void 0, void 0, u().mark((function e() { var t, r, n, i; return u().wrap((function (e) { for (;;)
1085
+ switch (e.prev = e.next) {
1086
+ case 0: return e.next = 2, this.state;
1087
+ case 2:
1088
+ if (t = e.sent, r = t.captchaClient, n = t.configured, i = t.siteKey, n) {
1089
+ e.next = 8;
1090
+ break;
1091
+ }
1092
+ return e.abrupt("return", void 0);
1093
+ case 8: return e.next = 10, new Promise((function (e) { return r.ready(e); }));
1094
+ case 10: return e.abrupt("return", r.execute(i, { action: "LOGIN" }));
1095
+ case 11:
1096
+ case "end": return e.stop();
1097
+ } }), e, this); }))); }, this.state = t.then((function (e) { return we(r, void 0, void 0, u().mark((function t() { return u().wrap((function (t) { for (;;)
1098
+ switch (t.prev = t.next) {
1099
+ case 0:
1100
+ if (e.captchaSettings.enabled) {
1101
+ t.next = 2;
1102
+ break;
1103
+ }
1104
+ return t.abrupt("return", { configured: !1 });
1105
+ case 2: return t.next = 4, tt(e.captchaSettings.siteKey);
1106
+ case 4: return t.t0 = t.sent, t.t1 = e.captchaSettings.siteKey, t.abrupt("return", { configured: !0, captchaClient: t.t0, siteKey: t.t1 });
1107
+ case 7:
1108
+ case "end": return t.stop();
1109
+ } }), t); }))); })); })), nt = h((function e(t, r) { var n, i = this; l(this, e), function (e) { if ("undefined" == typeof window)
1110
+ throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n")); }("StytchB2BHeadlessClient"), "string" != typeof (n = t) ? ie("Public token is malformed. Expected a string, got ".concat(y(n), ".").concat(ae)) : "" === n ? ie('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(ae)) : n.startsWith("public-token-") || ie('Public token is malformed. Expected "public-token-...", got '.concat(n, ".").concat(ae)); var o, a, s, c, u, d, h, f, p, v = r, m = { cookieOptions: null == (o = v) ? void 0 : o.cookieOptions, endpoints: { sdkBackendURL: null !== (s = null === (a = null == o ? void 0 : o.endpoints) || void 0 === a ? void 0 : a.sdkBackendURL) && void 0 !== s ? s : "https://web.stytch.com", testAPIURL: null !== (u = null === (c = null == o ? void 0 : o.endpoints) || void 0 === c ? void 0 : c.testAPIURL) && void 0 !== u ? u : "https://test.stytch.com", liveAPIURL: null !== (h = null === (d = null == o ? void 0 : o.endpoints) || void 0 === d ? void 0 : d.liveAPIURL) && void 0 !== h ? h : "https://api.stytch.com", clientsideServicesIframeURL: null !== (p = null === (f = null == o ? void 0 : o.endpoints) || void 0 === f ? void 0 : f.clientsideServicesIframeURL) && void 0 !== p ? p : "https://js.stytch.com/clientside-services/index.html" } }; this._dataLayer = Ce(t, v), this._subscriptionService = new Re(t, this._dataLayer); this._networkClient = new ke(t, this._dataLayer, m.endpoints.sdkBackendURL, (function () { var e, t, r, n; return { stytch_member_id: null === (t = null === (e = i._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id, stytch_member_session_id: null === (n = null === (r = i._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id }; })); var _ = new ze(t, this._networkClient, this._dataLayer), b = new rt(_.getAsync()); this.organization = new ve(this._networkClient), this.member = new fe(this._networkClient, this._subscriptionService), this.session = new me(this._networkClient, this._subscriptionService), this.magicLinks = new he(this._networkClient, this._subscriptionService, new Ue(this._dataLayer, "magic_links"), _.getAsync()), this.sso = new pe(this._networkClient, this._subscriptionService, new Ue(this._dataLayer, "sso"), _.getAsync(), { publicToken: t, testAPIURL: m.endpoints.testAPIURL, liveAPIURL: m.endpoints.liveAPIURL }), this.discovery = new _e(this._networkClient, this._subscriptionService), this.passwords = new et(this._networkClient, this._subscriptionService, new Ue(this._dataLayer, "passwords"), _.getAsync(), b.executeRecaptcha), this._sessionManager = new ue(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({ name: "b2b_sdk_instance_instantiated", details: { event_callback_registered: !1, error_callback_registered: !1, success_callback_registered: !1 } }), be(this, { bootstrap: _, publicToken: t }); }));
1111
+ function it(e) { return it = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, it(e); }
1112
+ function ot(e, t) { for (var r = 0; r < t.length; r++) {
957
1113
  var n = t[r];
958
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (o = n.key, i = void 0, i = function (e, t) { if ("object" !== Be(e) || null === e)
1114
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) { if ("object" !== it(e) || null === e)
959
1115
  return e; var r = e[Symbol.toPrimitive]; if (void 0 !== r) {
960
1116
  var n = r.call(e, t || "default");
961
- if ("object" !== Be(n))
1117
+ if ("object" !== it(n))
962
1118
  return n;
963
1119
  throw new TypeError("@@toPrimitive must return a primitive value.");
964
- } return ("string" === t ? String : Number)(e); }(o, "string"), "symbol" === Be(i) ? i : String(i)), n);
965
- } var o, i; }
966
- function Ke(e, t, r) { return t && Fe(e.prototype, t), r && Fe(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
967
- function qe(e, t) { if (!(e instanceof t))
1120
+ } return ("string" === t ? String : Number)(e); }(i, "string"), "symbol" === it(o) ? o : String(o)), n);
1121
+ } var i, o; }
1122
+ function at(e, t, r) { return t && ot(e.prototype, t), r && ot(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
1123
+ function st(e, t) { if (!(e instanceof t))
968
1124
  throw new TypeError("Cannot call a class as a function"); }
969
- function ze(e, t) { if ("function" != typeof t && null !== t)
970
- throw new TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && Je(e, t); }
971
- function Ge(e) { var t = Ye(); return function () { var r, n = $e(e); if (t) {
972
- var o = $e(this).constructor;
973
- r = Reflect.construct(n, arguments, o);
1125
+ function ct(e, t) { if ("function" != typeof t && null !== t)
1126
+ throw new TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && pt(e, t); }
1127
+ function ut(e) { var t = ft(); return function () { var r, n = vt(e); if (t) {
1128
+ var i = vt(this).constructor;
1129
+ r = Reflect.construct(n, arguments, i);
974
1130
  }
975
1131
  else
976
- r = n.apply(this, arguments); return function (e, t) { if (t && ("object" === Be(t) || "function" == typeof t))
1132
+ r = n.apply(this, arguments); return function (e, t) { if (t && ("object" === it(t) || "function" == typeof t))
977
1133
  return t; if (void 0 !== t)
978
- throw new TypeError("Derived constructors may only return object or undefined"); return We(e); }(this, r); }; }
979
- function We(e) { if (void 0 === e)
1134
+ throw new TypeError("Derived constructors may only return object or undefined"); return lt(e); }(this, r); }; }
1135
+ function lt(e) { if (void 0 === e)
980
1136
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
981
- function He(e) { var t = "function" == typeof Map ? new Map : void 0; return He = function (e) { if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]")))
1137
+ function dt(e) { var t = "function" == typeof Map ? new Map : void 0; return dt = function (e) { if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]")))
982
1138
  return e; var r; if ("function" != typeof e)
983
1139
  throw new TypeError("Super expression must either be null or a function"); if (void 0 !== t) {
984
1140
  if (t.has(e))
985
1141
  return t.get(e);
986
1142
  t.set(e, n);
987
- } function n() { return Ve(e, arguments, $e(this).constructor); } return n.prototype = Object.create(e.prototype, { constructor: { value: n, enumerable: !1, writable: !0, configurable: !0 } }), Je(n, e); }, He(e); }
988
- function Ve(e, t, r) { return Ve = Ye() ? Reflect.construct.bind() : function (e, t, r) { var n = [null]; n.push.apply(n, t); var o = new (Function.bind.apply(e, n)); return r && Je(o, r.prototype), o; }, Ve.apply(null, arguments); }
989
- function Ye() { if ("undefined" == typeof Reflect || !Reflect.construct)
1143
+ } function n() { return ht(e, arguments, vt(this).constructor); } return n.prototype = Object.create(e.prototype, { constructor: { value: n, enumerable: !1, writable: !0, configurable: !0 } }), pt(n, e); }, dt(e); }
1144
+ function ht(e, t, r) { return ht = ft() ? Reflect.construct.bind() : function (e, t, r) { var n = [null]; n.push.apply(n, t); var i = new (Function.bind.apply(e, n)); return r && pt(i, r.prototype), i; }, ht.apply(null, arguments); }
1145
+ function ft() { if ("undefined" == typeof Reflect || !Reflect.construct)
990
1146
  return !1; if (Reflect.construct.sham)
991
1147
  return !1; if ("function" == typeof Proxy)
992
1148
  return !0; try {
@@ -995,11 +1151,11 @@ function Ye() { if ("undefined" == typeof Reflect || !Reflect.construct)
995
1151
  catch (e) {
996
1152
  return !1;
997
1153
  } }
998
- function Je(e, t) { return Je = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) { return e.__proto__ = t, e; }, Je(e, t); }
999
- function $e(e) { return $e = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) { return e.__proto__ || Object.getPrototypeOf(e); }, $e(e); }
1000
- !function (e) { e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords"; }(Pe || (Pe = {})), function (e) { e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch"; }(je || (je = {})), function (e) { e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet"; }(Le || (Le = {})), function (e) { e.embedded = "embedded", e.floating = "floating"; }(Ae || (Ae = {})), function (e) { e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email"; }(Re || (Re = {})), function (e) { e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL"; }(Ie || (Ie = {}));
1001
- var Xe; (function (e) { ze(r, He(Error)); var t = Ge(r); function r(e, n) { var o; return qe(this, r), (o = t.call(this, e + "\n" + n)).message = e + "\n" + n, o.name = "SDKAPIUnreachableError", o.details = n, Object.setPrototypeOf(We(o), r.prototype), o; } return Ke(r); })(); (function (e) { ze(r, He(Error)); var t = Ge(r); function r(e, n) { var o; return qe(this, r), (o = t.call(this)).name = "StytchSDKUsageError", o.message = "Invalid call to ".concat(e, "\n") + n, o; } return Ke(r); })(); (function (e) { ze(r, He(Error)); var t = Ge(r); function r(e) { var n, o; qe(this, r), (n = t.call(this)).name = "StytchSDKSchemaError"; var i = null === (o = e.body) || void 0 === o ? void 0 : o.map((function (e) { return "".concat(e.dataPath, ": ").concat(e.message); })).join("\n"); return n.message = "[400] Request does not match expected schema\n".concat(i), n; } return Ke(r); })(); (function (e) { ze(r, He(Error)); var t = Ge(r); function r(e) { var n; qe(this, r), (n = t.call(this)).name = "StytchSDKAPIError"; var o = e.status_code, i = e.error_type, a = e.error_message, s = e.error_url, c = e.request_id; return n.error_type = i, n.error_message = a, n.error_url = s, n.request_id = c, n.status_code = o, n.message = "[".concat(o, "] ").concat(i, "\n") + "".concat(a, "\n") + "See ".concat(s, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n; } return Ke(r); })(); (function (e) { ze(r, He(Error)); var t = Ge(r); function r(e) { var n; return qe(this, r), (n = t.call(this)).name = "StytchSDKNativeError", n.error_type = e, n.message = "".concat(e), n; } return Ke(r); })();
1002
- !function (e) { e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out"; }(Xe || (Xe = {}));
1154
+ function pt(e, t) { return pt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) { return e.__proto__ = t, e; }, pt(e, t); }
1155
+ function vt(e) { return vt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) { return e.__proto__ || Object.getPrototypeOf(e); }, vt(e); }
1156
+ !function (e) { e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords"; }(Ye || (Ye = {})), function (e) { e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch"; }(Ve || (Ve = {})), function (e) { e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet"; }(Je || (Je = {})), function (e) { e.embedded = "embedded", e.floating = "floating"; }($e || ($e = {})), function (e) { e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email"; }(Xe || (Xe = {})), function (e) { e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL"; }(Ze || (Ze = {}));
1157
+ var mt; (function (e) { ct(r, dt(Error)); var t = ut(r); function r(e, n) { var i; return st(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(lt(i), r.prototype), i; } return at(r); })(); (function (e) { ct(r, dt(Error)); var t = ut(r); function r(e, n) { var i; return st(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i; } return at(r); })(); (function (e) { ct(r, dt(Error)); var t = ut(r); function r(e) { var n, i; st(this, r), (n = t.call(this)).name = "StytchSDKSchemaError"; var o = null === (i = e.body) || void 0 === i ? void 0 : i.map((function (e) { return "".concat(e.dataPath, ": ").concat(e.message); })).join("\n"); return n.message = "[400] Request does not match expected schema\n".concat(o), n; } return at(r); })(); (function (e) { ct(r, dt(Error)); var t = ut(r); function r(e) { var n; st(this, r), (n = t.call(this)).name = "StytchSDKAPIError"; var i = e.status_code, o = e.error_type, a = e.error_message, s = e.error_url, c = e.request_id; return n.error_type = o, n.error_message = a, n.error_url = s, n.request_id = c, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(s, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n; } return at(r); })(); (function (e) { ct(r, dt(Error)); var t = ut(r); function r(e) { var n; return st(this, r), (n = t.call(this)).name = "StytchSDKNativeError", n.error_type = e, n.message = "".concat(e), n; } return at(r); })();
1158
+ !function (e) { e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out"; }(mt || (mt = {}));
1003
1159
 
1004
1160
  /**
1005
1161
  * Creates a Headless Stytch client object to call the stytch B2B APIs.
@@ -1018,7 +1174,7 @@ const createStytchB2BHeadlessClient = (...args) => {
1018
1174
  if (typeof window === 'undefined') {
1019
1175
  return createStytchSSRProxy();
1020
1176
  }
1021
- return new Ue(...args);
1177
+ return new nt(...args);
1022
1178
  };
1023
1179
 
1024
1180
  exports.StytchB2BProvider = StytchB2BProvider;