UNPKG

@authgear/web

Version:

With Authgear SDK for Single Page Applications (SPA), you can easily integrate authentication features into your app (Angular, Vue, React, or any JavaScript websites). In most cases, it involves just a few lines of code to enable multiple authentication m

1,553 lines (1,358 loc) 304 kB
/** * UserInfo is the result of fetchUserInfo. * It contains `sub` which is the User ID, * as well as OIDC standard claims like `email`, * see https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims. * * In addition to these standard claims, it may include custom claims * defined by Authgear to support additional functionality like `isVerified`. * * @public */ /** * ColorScheme represents the color scheme supported by Authgear. * A colorscheme is either light or dark. Authgear supports both by default. * * @public */ var ColorScheme = /*#__PURE__*/function (ColorScheme) { ColorScheme["Light"] = "light"; ColorScheme["Dark"] = "dark"; return ColorScheme; }({}); /** * Prompt parameter options. * * @public */ var PromptOption = /*#__PURE__*/function (PromptOption) { PromptOption["None"] = "none"; PromptOption["Login"] = "login"; PromptOption["Consent"] = "consent"; PromptOption["SelectAccount"] = "select_account"; return PromptOption; }({}); /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ function _decodeUserInfo(r) { var _r$custom_attributes, _r$httpsAuthgearC, _r$httpsAuthgearC2, _r$httpsAuthgearC3, _r$address, _r$address2, _r$address3, _r$address4, _r$address5, _r$address6; var raw = r; var customAttributes = (_r$custom_attributes = r["custom_attributes"]) != null ? _r$custom_attributes : {}; return { sub: r["sub"], isVerified: (_r$httpsAuthgearC = r["https://authgear.com/claims/user/is_verified"]) != null ? _r$httpsAuthgearC : false, isAnonymous: (_r$httpsAuthgearC2 = r["https://authgear.com/claims/user/is_anonymous"]) != null ? _r$httpsAuthgearC2 : false, canReauthenticate: (_r$httpsAuthgearC3 = r["https://authgear.com/claims/user/can_reauthenticate"]) != null ? _r$httpsAuthgearC3 : false, roles: r["https://authgear.com/claims/user/roles"], raw: raw, customAttributes: customAttributes, email: r["email"], emailVerified: r["email_verified"], phoneNumber: r["phone_number"], phoneNumberVerified: r["phone_number_verified"], preferredUsername: r["preferred_username"], familyName: r["family_name"], givenName: r["given_name"], middleName: r["middle_name"], name: r["name"], nickname: r["nickname"], picture: r["picture"], profile: r["profile"], website: r["website"], gender: r["gender"], birthdate: r["birthdate"], zoneinfo: r["zoneinfo"], locale: r["locale"], address: { formatted: (_r$address = r["address"]) == null ? void 0 : _r$address["formatted"], streetAddress: (_r$address2 = r["address"]) == null ? void 0 : _r$address2["street_address"], locality: (_r$address3 = r["address"]) == null ? void 0 : _r$address3["locality"], region: (_r$address4 = r["address"]) == null ? void 0 : _r$address4["region"], postalCode: (_r$address5 = r["address"]) == null ? void 0 : _r$address5["postal_code"], country: (_r$address6 = r["address"]) == null ? void 0 : _r$address6["country"] } }; } /** * @internal */ /** * @internal */ /** * @internal */ /** * TokenStorage is an interface controlling when refresh tokens are stored. * Normally you do not need to implement this interface. * You can use one of those implementations provided by the SDK. * * @public */ /** * @internal */ /** * @internal */ /** * @internal */ /** * Options for the constructor of a Container. * * @public */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * The session state. * * An freshly constructed instance has the session state "UNKNOWN"; * * After a call to configure, the session state would become "AUTHENTICATED" if a previous session was found, * or "NO_SESSION" if such session was not found. * * Please refer to {@link SessionStateChangeReason} for more information. * * @public */ var SessionState = /*#__PURE__*/function (SessionState) { SessionState["Unknown"] = "UNKNOWN"; SessionState["NoSession"] = "NO_SESSION"; SessionState["Authenticated"] = "AUTHENTICATED"; return SessionState; }({}); /** * The reason why SessionState is changed. * * These reasons can be thought of as the transition of a SessionState, which is described as follows: * * ``` * LOGOUT / INVALID / CLEAR * +----------------------------------------------+ * v | * State: UNKNOWN ----- NO_TOKEN ----> State: NO_SESSION ---- AUTHENTICATED -----> State: AUTHENTICATED * | ^ * +--------------------------------------------------------------------------------+ * FOUND_TOKEN * ``` * @public */ var SessionStateChangeReason = /*#__PURE__*/function (SessionStateChangeReason) { SessionStateChangeReason["NoToken"] = "NO_TOKEN"; SessionStateChangeReason["FoundToken"] = "FOUND_TOKEN"; SessionStateChangeReason["Authenticated"] = "AUTHENTICATED"; SessionStateChangeReason["Logout"] = "LOGOUT"; SessionStateChangeReason["Invalid"] = "INVALID"; SessionStateChangeReason["Clear"] = "CLEAR"; return SessionStateChangeReason; }({}); /** * The path of the page in Authgear. * * @public */ var Page = /*#__PURE__*/function (Page) { Page["Settings"] = "/settings"; Page["Identities"] = "/settings/identities"; return Page; }({}); /** * The actions that can be performed in Authgear settings page. * * @public */ var SettingsAction = /*#__PURE__*/function (SettingsAction) { SettingsAction["ChangePassword"] = "change_password"; SettingsAction["DeleteAccount"] = "delete_account"; return SettingsAction; }({}); /** * @internal */ function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); } function toPrimitive$2(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return (String )(t); } function toPropertyKey$3(t) { var i = toPrimitive$2(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey$3(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } } function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function _isNativeReflectConstruct() { return !!t; })(); } function _construct(t, e, r) { if (_isNativeReflectConstruct$2()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; } function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); } function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); } /** * AuthgearError is the root class of error produced by the SDK. * * @public */ var AuthgearError = /*#__PURE__*/function (_Error) { function AuthgearError() { return _callSuper$1(this, AuthgearError, arguments); } _inherits(AuthgearError, _Error); return _createClass(AuthgearError); }( /*#__PURE__*/_wrapNativeSuper(Error)); /** * ErrorName contains all possible name in {@link ServerError} * * @public */ var ErrorName = /*#__PURE__*/function (ErrorName) { ErrorName["BadRequest"] = "BadRequest"; ErrorName["Invalid"] = "Invalid"; ErrorName["Unauthorized"] = "Unauthorized"; ErrorName["Forbidden"] = "Forbidden"; ErrorName["NotFound"] = "NotFound"; ErrorName["AlreadyExists"] = "AlreadyExists"; ErrorName["TooManyRequest"] = "TooManyRequest"; ErrorName["InternalError"] = "InternalError"; ErrorName["ServiceUnavailable"] = "ServiceUnavailable"; return ErrorName; }({}); /** * CancelError means cancel. * If you catch an error and it is instanceof CancelError, * then the operation was cancelled. * * @public */ var CancelError = /*#__PURE__*/function (_AuthgearError) { function CancelError() { return _callSuper$1(this, CancelError, arguments); } _inherits(CancelError, _AuthgearError); return _createClass(CancelError); }(AuthgearError); /** * ServerError represents error received from the server. * * @public */ var ServerError = /*#__PURE__*/function (_AuthgearError2) { /** * Error name. * * @remarks * See {@link ErrorName} for possible values. * New error names may be added in future. */ /** * Error message. * * @remarks * Error messages are provided for convenience, and not stable APIs; * Consumers should use {@link ServerError.name} or * {@link ServerError.reason} to distinguish between different errors. */ /** * Error reason. */ /** * Additional error information. */ function ServerError(message, name, reason, info) { var _this; _this = _callSuper$1(this, ServerError, [message]); _this.name = name; _this.reason = reason; _this.info = info; return _this; } _inherits(ServerError, _AuthgearError2); return _createClass(ServerError); }(AuthgearError); /** * OAuthError represents the oauth error response. * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 * * @public */ var OAuthError = /*#__PURE__*/function (_AuthgearError3) { function OAuthError(_ref) { var _this2; var state = _ref.state, error = _ref.error, error_description = _ref.error_description, error_uri = _ref.error_uri; _this2 = _callSuper$1(this, OAuthError, [error + (error_description != null ? ": " + error_description : "")]); _this2.state = state; _this2.error = error; _this2.error_description = error_description; _this2.error_uri = error_uri; return _this2; } _inherits(OAuthError, _AuthgearError3); return _createClass(OAuthError); }(AuthgearError); /** * @internal */ // eslint-disable-next-line complexity function _decodeError(err) { // Construct ServerError if it looks like one. if (err != null && !(err instanceof Error) && typeof err.name === "string" && typeof err.reason === "string" && typeof err.message === "string") { return new ServerError(err.message, err.name, err.reason, err.info); } // If it is an Error, just return it. if (err instanceof Error) { return err; } // If it has message, construct an Error from the message. if (err != null && typeof err.message === "string") { return new Error(err.message); } // If it can be turned into string, use it as message. if (err != null && typeof err.toString === "function") { return new Error(err.toString()); } // Otherwise cast it to string and use it as message. return new Error(String(err)); } /** * PreAuthenticatedURLNotAllowedError is the root class of errors related to pre-authenticated URL. * * @public */ var PreAuthenticatedURLNotAllowedError = /*#__PURE__*/function (_AuthgearError4) { function PreAuthenticatedURLNotAllowedError() { return _callSuper$1(this, PreAuthenticatedURLNotAllowedError, arguments); } _inherits(PreAuthenticatedURLNotAllowedError, _AuthgearError4); return _createClass(PreAuthenticatedURLNotAllowedError); }(AuthgearError); /** * This may happen if the "Pre-authenticated URL" feature was not enabled when the user logged in during this session. * Ask the user to log in again to enable this feature. * * @public */ var PreAuthenticatedURLInsufficientScopeError = /*#__PURE__*/function (_PreAuthenticatedURLN) { function PreAuthenticatedURLInsufficientScopeError() { return _callSuper$1(this, PreAuthenticatedURLInsufficientScopeError, arguments); } _inherits(PreAuthenticatedURLInsufficientScopeError, _PreAuthenticatedURLN); return _createClass(PreAuthenticatedURLInsufficientScopeError); }(PreAuthenticatedURLNotAllowedError); /** * The user logged in from an older SDK version that does not support the pre-authenticated URL. * Ask the user to log in again to resolve the problem. * * @public */ var PreAuthenticatedURLIDTokenNotFoundError = /*#__PURE__*/function (_PreAuthenticatedURLN2) { function PreAuthenticatedURLIDTokenNotFoundError() { return _callSuper$1(this, PreAuthenticatedURLIDTokenNotFoundError, arguments); } _inherits(PreAuthenticatedURLIDTokenNotFoundError, _PreAuthenticatedURLN2); return _createClass(PreAuthenticatedURLIDTokenNotFoundError); }(PreAuthenticatedURLNotAllowedError); /** * The device secret is not found. This may happen if the "Pre-authenticated URL" feature was not enabled when the user logged in during this session. * Ask the user to log in again to enable this feature. * * @public */ var PreAuthenticatedURLDeviceSecretNotFoundError = /*#__PURE__*/function (_PreAuthenticatedURLN3) { function PreAuthenticatedURLDeviceSecretNotFoundError() { return _callSuper$1(this, PreAuthenticatedURLDeviceSecretNotFoundError, arguments); } _inherits(PreAuthenticatedURLDeviceSecretNotFoundError, _PreAuthenticatedURLN3); return _createClass(PreAuthenticatedURLDeviceSecretNotFoundError); }(PreAuthenticatedURLNotAllowedError); function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var regeneratorRuntime$1 = {exports: {}}; var _typeof = {exports: {}}; (function (module) { function _typeof(o) { "@babel/helpers - typeof"; return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); } module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; } (_typeof)); var _typeofExports = _typeof.exports; (function (module) { var _typeof = _typeofExports["default"]; function _regeneratorRuntime() { module.exports = _regeneratorRuntime = function _regeneratorRuntime() { return e; }, module.exports.__esModule = true, module.exports["default"] = module.exports; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorRuntime$1)); var regeneratorRuntimeExports = regeneratorRuntime$1.exports; // TODO(Babel 8): Remove this file. var runtime = regeneratorRuntimeExports(); var regenerator = runtime; // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= try { regeneratorRuntime = runtime; } catch (accidentalStrictMode) { if (typeof globalThis === "object") { globalThis.regeneratorRuntime = runtime; } else { Function("r", "regeneratorRuntime = r")(runtime); } } var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator); var fails$d = function (exec) { try { return !!exec(); } catch (error) { return true; } }; var fails$c = fails$d; var functionBindNative = !fails$c(function () { // eslint-disable-next-line es/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test != 'function' || test.hasOwnProperty('prototype'); }); var NATIVE_BIND$3 = functionBindNative; var FunctionPrototype$2 = Function.prototype; var call$b = FunctionPrototype$2.call; var uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$2.bind.bind(call$b, call$b); var functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function (fn) { return function () { return call$b.apply(fn, arguments); }; }; var uncurryThis$g = functionUncurryThis; var toString$7 = uncurryThis$g({}.toString); var stringSlice$3 = uncurryThis$g(''.slice); var classofRaw$2 = function (it) { return stringSlice$3(toString$7(it), 8, -1); }; var uncurryThis$f = functionUncurryThis; var fails$b = fails$d; var classof$6 = classofRaw$2; var $Object$4 = Object; var split$3 = uncurryThis$f(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails$b(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !$Object$4('z').propertyIsEnumerable(0); }) ? function (it) { return classof$6(it) === 'String' ? split$3(it, '') : $Object$4(it); } : $Object$4; // we can't use just `it == null` since of `document.all` special case // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec var isNullOrUndefined$3 = function (it) { return it === null || it === undefined; }; var isNullOrUndefined$2 = isNullOrUndefined$3; var $TypeError$8 = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible$3 = function (it) { if (isNullOrUndefined$2(it)) throw new $TypeError$8("Can't call method on " + it); return it; }; // toObject with fallback for non-array-like ES3 strings var IndexedObject$1 = indexedObject; var requireObjectCoercible$2 = requireObjectCoercible$3; var toIndexedObject$5 = function (it) { return IndexedObject$1(requireObjectCoercible$2(it)); }; var iterators = {}; var check = function (it) { return it && it.Math === Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global$e = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot var documentAll = typeof document == 'object' && document.all; // `IsCallable` abstract operation // https://tc39.es/ecma262/#sec-iscallable // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing var isCallable$e = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) { return typeof argument == 'function' || argument === documentAll; } : function (argument) { return typeof argument == 'function'; }; var global$d = global$e; var isCallable$d = isCallable$e; var WeakMap$1 = global$d.WeakMap; var weakMapBasicDetection = isCallable$d(WeakMap$1) && /native code/.test(String(WeakMap$1)); var isCallable$c = isCallable$e; var isObject$7 = function (it) { return typeof it == 'object' ? it !== null : isCallable$c(it); }; var fails$a = fails$d; // Detect IE8's incomplete defineProperty implementation var descriptors = !fails$a(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7; }); var objectDefineProperty = {}; var global$c = global$e; var isObject$6 = isObject$7; var document$1 = global$c.document; // typeof document.createElement is 'object' in old IE var EXISTS$1 = isObject$6(document$1) && isObject$6(document$1.createElement); var documentCreateElement$1 = function (it) { return EXISTS$1 ? document$1.createElement(it) : {}; }; var DESCRIPTORS$c = descriptors; var fails$9 = fails$d; var createElement = documentCreateElement$1; // Thanks to IE8 for its funny defineProperty var ie8DomDefine = !DESCRIPTORS$c && !fails$9(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a !== 7; }); var DESCRIPTORS$b = descriptors; var fails$8 = fails$d; // V8 ~ Chrome 36- // https://bugs.chromium.org/p/v8/issues/detail?id=3334 var v8PrototypeDefineBug = DESCRIPTORS$b && fails$8(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype !== 42; }); var isObject$5 = isObject$7; var $String$3 = String; var $TypeError$7 = TypeError; // `Assert: Type(argument) is Object` var anObject$7 = function (argument) { if (isObject$5(argument)) return argument; throw new $TypeError$7($String$3(argument) + ' is not an object'); }; var NATIVE_BIND$2 = functionBindNative; var call$a = Function.prototype.call; var functionCall = NATIVE_BIND$2 ? call$a.bind(call$a) : function () { return call$a.apply(call$a, arguments); }; var path$4 = {}; var path$3 = path$4; var global$b = global$e; var isCallable$b = isCallable$e; var aFunction = function (variable) { return isCallable$b(variable) ? variable : undefined; }; var getBuiltIn$5 = function (namespace, method) { return arguments.length < 2 ? aFunction(path$3[namespace]) || aFunction(global$b[namespace]) : path$3[namespace] && path$3[namespace][method] || global$b[namespace] && global$b[namespace][method]; }; var uncurryThis$e = functionUncurryThis; var objectIsPrototypeOf = uncurryThis$e({}.isPrototypeOf); var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || ''; var global$a = global$e; var userAgent = engineUserAgent; var process = global$a.process; var Deno = global$a.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } var engineV8Version = version; /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = engineV8Version; var fails$7 = fails$d; var global$9 = global$e; var $String$2 = global$9.String; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$7(function () { var symbol = Symbol('symbol detection'); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, // of course, fail. return !$String$2(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); /* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL$1 = symbolConstructorDetection; var useSymbolAsUid = NATIVE_SYMBOL$1 && !Symbol.sham && typeof Symbol.iterator == 'symbol'; var getBuiltIn$4 = getBuiltIn$5; var isCallable$a = isCallable$e; var isPrototypeOf$1 = objectIsPrototypeOf; var USE_SYMBOL_AS_UID$1 = useSymbolAsUid; var $Object$3 = Object; var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn$4('Symbol'); return isCallable$a($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$3(it)); }; var $String$1 = String; var tryToString$2 = function (argument) { try { return $String$1(argument); } catch (error) { return 'Object'; } }; var isCallable$9 = isCallable$e; var tryToString$1 = tryToString$2; var $TypeError$6 = TypeError; // `Assert: IsCallable(argument) is true` var aCallable$3 = function (argument) { if (isCallable$9(argument)) return argument; throw new $TypeError$6(tryToString$1(argument) + ' is not a function'); }; var aCallable$2 = aCallable$3; var isNullOrUndefined$1 = isNullOrUndefined$3; // `GetMethod` abstract operation // https://tc39.es/ecma262/#sec-getmethod var getMethod$3 = function (V, P) { var func = V[P]; return isNullOrUndefined$1(func) ? undefined : aCallable$2(func); }; var call$9 = functionCall; var isCallable$8 = isCallable$e; var isObject$4 = isObject$7; var $TypeError$5 = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive var ordinaryToPrimitive$1 = function (input, pref) { var fn, val; if (pref === 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = call$9(fn, input))) return val; if (isCallable$8(fn = input.valueOf) && !isObject$4(val = call$9(fn, input))) return val; if (pref !== 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = call$9(fn, input))) return val; throw new $TypeError$5("Can't convert object to primitive value"); }; var sharedStore = {exports: {}}; var isPure = true; var global$8 = global$e; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty$3 = Object.defineProperty; var defineGlobalProperty$1 = function (key, value) { try { defineProperty$3(global$8, key, { value: value, configurable: true, writable: true }); } catch (error) { global$8[key] = value; } return value; }; var globalThis$1 = global$e; var defineGlobalProperty = defineGlobalProperty$1; var SHARED = '__core-js_shared__'; var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty(SHARED, {}); (store$3.versions || (store$3.versions = [])).push({ version: '3.37.1', mode: 'pure' , copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)', license: 'https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE', source: 'https://github.com/zloirock/core-js' }); var sharedStoreExports = sharedStore.exports; var store$2 = sharedStoreExports; var shared$3 = function (key, value) { return store$2[key] || (store$2[key] = value || {}); }; var requireObjectCoercible$1 = requireObjectCoercible$3; var $Object$2 = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject$4 = function (argument) { return $Object$2(requireObjectCoercible$1(argument)); }; var uncurryThis$d = functionUncurryThis; var toObject$3 = toObject$4; var hasOwnProperty = uncurryThis$d({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty // eslint-disable-next-line es/no-object-hasown -- safe var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject$3(it), key); }; var uncurryThis$c = functionUncurryThis; var id = 0; var postfix = Math.random(); var toString$6 = uncurryThis$c(1.0.toString); var uid$2 = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$6(++id + postfix, 36); }; var global$7 = global$e; var shared$2 = shared$3; var hasOwn$9 = hasOwnProperty_1; var uid$1 = uid$2; var NATIVE_SYMBOL = symbolConstructorDetection; var USE_SYMBOL_AS_UID = useSymbolAsUid; var Symbol$1 = global$7.Symbol; var WellKnownSymbolsStore = shared$2('wks'); var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1; var wellKnownSymbol$a = function (name) { if (!hasOwn$9(WellKnownSymbolsStore, name)) { WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$9(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; var call$8 = functionCall; var isObject$3 = isObject$7; var isSymbol$1 = isSymbol$2; var getMethod$2 = getMethod$3; var ordinaryToPrimitive = ordinaryToPrimitive$1; var wellKnownSymbol$9 = wellKnownSymbol$a; var $TypeError$4 = TypeError; var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive var toPrimitive$1 = function (input, pref) { if (!isObject$3(input) || isSymbol$1(input)) return input; var exoticToPrim = getMethod$2(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call$8(exoticToPrim, input, pref); if (!isObject$3(result) || isSymbol$1(result)) return result; throw new $TypeError$4("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; var toPrimitive = toPrimitive$1; var isSymbol = isSymbol$2; // `ToPropertyKey` abstract operation // https://tc39.es/ecma262/#sec-topropertykey var toPropertyKey$2 = function (argument) { var key = toPrimitive(argument, 'string'); return isSymbol(key) ? key : key + ''; }; var DESCRIPTORS$a = descriptors; var IE8_DOM_DEFINE$1 = ie8DomDefine; var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug; var anObject$6 = anObject$7; var toPropertyKey$1 = toPropertyKey$2; var $TypeError$3 = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; var ENUMERABLE = 'enumerable'; var CONFIGURABLE$1 = 'configurable'; var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) { anObject$6(O); P = toPropertyKey$1(P); anObject$6(Attributes); if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { var current = $getOwnPropertyDescriptor$1(O, P); if (current && current[WRITABLE]) { O[P] = Attributes.value; Attributes = { configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1], enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], writable: false }; } } return $defineProperty(O, P, Attributes); } : $defineProperty : function defineProperty(O, P, Attributes) { anObject$6(O); P = toPropertyKey$1(P); anObject$6(Attributes); if (IE8_DOM_DEFINE$1) try { return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$3('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var createPropertyDescriptor$5 = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var DESCRIPTORS$9 = descriptors; var definePropertyModule$2 = objectDefineProperty; var createPropertyDescriptor$4 = createPropertyDescriptor$5; var createNonEnumerableProperty$4 = DESCRIPTORS$9 ? function (object, key, value) { return definePropertyModule$2.f(object, key, createPropertyDescriptor$4(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var shared$1 = shared$3; var uid = uid$2; var keys = shared$1('keys'); var sharedKey$3 = function (key) { return keys[key] || (keys[key] = uid(key)); }; var hiddenKeys$3 = {}; var NATIVE_WEAK_MAP = weakMapBasicDetection; var global$6 = global$e; var isObject$2 = isObject$7; var createNonEnumerableProperty$3 = createNonEnumerableProperty$4; var hasOwn$8 = hasOwnProperty_1; var shared = sharedStoreExports; var sharedKey$2 = sharedKey$3; var hiddenKeys$2 = hiddenKeys$3; var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; var TypeError$3 = global$6.TypeError; var WeakMap = global$6.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject$2(it) || (state = get(it)).type !== TYPE) { throw new TypeError$3('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP || shared.state) { var store$1 = shared.state || (shared.state = new WeakMap()); /* eslint-disable no-self-assign -- prototype methods protection */ store$1.get = store$1.get; store$1.has = store$1.has; store$1.set = store$1.set; /* eslint-enable no-self-assign -- prototype methods protection */ set = function (it, metadata) { if (store$1.has(it)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; store$1.set(it, metadata); return metadata; }; get = function (it) { return store$1.get(it) || {}; }; has = function (it) { return store$1.has(it); }; } else { var STATE = sharedKey$2('state'); hiddenKeys$2[STATE] = true; set = function (it, metadata) { if (hasOwn$8(it, STATE)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty$3(it, STATE, metadata); return metadata; }; get = function (it) { return hasOwn$8(it, STATE) ? it[STATE] : {}; }; has = function (it) { return hasOwn$8(it, STATE); }; } var internalState = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; var NATIVE_BIND$1 = functionBindNative; var FunctionPrototype$1 = Function.prototype; var apply$1 = FunctionPrototype$1.apply; var call$7 = FunctionPrototype$1.call; // eslint-disable-next-line es/no-reflect -- safe var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$7.bind(apply$1) : function () { return call$7.apply(apply$1, arguments); }); var classofRaw$1 = classofRaw$2; var uncurryThis$b = functionUncurryThis; var functionUncurryThisClause = function (fn) { // Nashorn bug: // https://github.com/zloirock/core-js/issues/1128 // https://github.com/zloirock/core-js/issues/1130 if (classofRaw$1(fn) === 'Function') return uncurryThis$b(fn); }; var objectGetOwnPropertyDescriptor = {}; var objectPropertyIsEnumerable = {}; var $propertyIsEnumerable = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$2(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; var DESCRIPTORS$8 = descriptors; var call$6 = functionCall; var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable; var