/*! For license information please see main.js.LICENSE.txt */ !(function () { var e, t, n, i, o = { 7025: function (e, t, n) { "use strict"; n.a( e, async function (e, t) { try { var i = n(6887), o = n(9824), r = n(2905), a = n.n(r), s = n(3325), l = n(6910), d = n(1409), c = n(2824), u = n(8206), p = n(6771), h = n.n(p); function E() { E = function () { return t; }; var e, t = {}, n = Object.prototype, i = n.hasOwnProperty, o = Object.defineProperty || function (e, t, n) { e[t] = n.value; }, r = "function" == typeof Symbol ? Symbol : {}, a = r.iterator || "@@iterator", s = r.asyncIterator || "@@asyncIterator", l = r.toStringTag || "@@toStringTag"; function d(e, t, n) { return ( Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0, }), e[t] ); } try { d({}, ""); } catch (e) { d = function (e, t, n) { return (e[t] = n); }; } function c(e, t, n, i) { var r = t && t.prototype instanceof v ? t : v, a = Object.create(r.prototype), s = new C(i || []); return o(a, "_invoke", { value: $(e, n, s) }), a; } function u(e, t, n) { try { return { type: "normal", arg: e.call(t, n) }; } catch (e) { return { type: "throw", arg: e }; } } t.wrap = c; var p = "suspendedStart", h = "suspendedYield", g = "executing", m = "completed", f = {}; function v() {} function w() {} function b() {} var y = {}; d(y, a, function () { return this; }); var k = Object.getPrototypeOf, x = k && k(k(L([]))); x && x !== n && i.call(x, a) && (y = x); var S = (b.prototype = v.prototype = Object.create(y)); function _(e) { ["next", "throw", "return"].forEach(function (t) { d(e, t, function (e) { return this._invoke(t, e); }); }); } function I(e, t) { function n(o, r, a, s) { var l = u(e[o], e, r); if ("throw" !== l.type) { var d = l.arg, c = d.value; return c && "object" == typeof c && i.call(c, "__await") ? t.resolve(c.__await).then( function (e) { n("next", e, a, s); }, function (e) { n("throw", e, a, s); } ) : t.resolve(c).then( function (e) { (d.value = e), a(d); }, function (e) { return n("throw", e, a, s); } ); } s(l.arg); } var r; o(this, "_invoke", { value: function (e, i) { function o() { return new t(function (t, o) { n(e, i, t, o); }); } return (r = r ? r.then(o, o) : o()); }, }); } function $(t, n, i) { var o = p; return function (r, a) { if (o === g) throw Error("Generator is already running"); if (o === m) { if ("throw" === r) throw a; return { value: e, done: !0 }; } for (i.method = r, i.arg = a; ; ) { var s = i.delegate; if (s) { var l = A(s, i); if (l) { if (l === f) continue; return l; } } if ("next" === i.method) i.sent = i._sent = i.arg; else if ("throw" === i.method) { if (o === p) throw ((o = m), i.arg); i.dispatchException(i.arg); } else "return" === i.method && i.abrupt("return", i.arg); o = g; var d = u(t, n, i); if ("normal" === d.type) { if (((o = i.done ? m : h), d.arg === f)) continue; return { value: d.arg, done: i.done }; } "throw" === d.type && ((o = m), (i.method = "throw"), (i.arg = d.arg)); } }; } function A(t, n) { var i = n.method, o = t.iterator[i]; if (o === e) return ( (n.delegate = null), ("throw" === i && t.iterator.return && ((n.method = "return"), (n.arg = e), A(t, n), "throw" === n.method)) || ("return" !== i && ((n.method = "throw"), (n.arg = new TypeError( "The iterator does not provide a '" + i + "' method" )))), f ); var r = u(o, t.iterator, n.arg); if ("throw" === r.type) return ( (n.method = "throw"), (n.arg = r.arg), (n.delegate = null), f ); var a = r.arg; return a ? a.done ? ((n[t.resultName] = a.value), (n.next = t.nextLoc), "return" !== n.method && ((n.method = "next"), (n.arg = e)), (n.delegate = null), f) : a : ((n.method = "throw"), (n.arg = new TypeError( "iterator result is not an object" )), (n.delegate = null), f); } function O(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 C(e) { (this.tryEntries = [{ tryLoc: "root" }]), e.forEach(O, this), this.reset(!0); } function L(t) { if (t || "" === t) { var n = t[a]; if (n) return n.call(t); if ("function" == typeof t.next) return t; if (!isNaN(t.length)) { var o = -1, r = function n() { for (; ++o < t.length; ) if (i.call(t, o)) return (n.value = t[o]), (n.done = !1), n; return (n.value = e), (n.done = !0), n; }; return (r.next = r); } } throw new TypeError(typeof t + " is not iterable"); } return ( (w.prototype = b), o(S, "constructor", { value: b, configurable: !0 }), o(b, "constructor", { value: w, configurable: !0 }), (w.displayName = d(b, l, "GeneratorFunction")), (t.isGeneratorFunction = function (e) { var t = "function" == typeof e && e.constructor; return ( !!t && (t === w || "GeneratorFunction" === (t.displayName || t.name)) ); }), (t.mark = function (e) { return ( Object.setPrototypeOf ? Object.setPrototypeOf(e, b) : ((e.__proto__ = b), d(e, l, "GeneratorFunction")), (e.prototype = Object.create(S)), e ); }), (t.awrap = function (e) { return { __await: e }; }), _(I.prototype), d(I.prototype, s, function () { return this; }), (t.AsyncIterator = I), (t.async = function (e, n, i, o, r) { void 0 === r && (r = Promise); var a = new I(c(e, n, i, o), r); return t.isGeneratorFunction(n) ? a : a.next().then(function (e) { return e.done ? e.value : a.next(); }); }), _(S), d(S, l, "Generator"), d(S, a, function () { return this; }), d(S, "toString", function () { return "[object Generator]"; }), (t.keys = function (e) { var t = Object(e), n = []; for (var i in t) n.push(i); return ( n.reverse(), function e() { for (; n.length; ) { var i = n.pop(); if (i in t) return (e.value = i), (e.done = !1), e; } return (e.done = !0), e; } ); }), (t.values = L), (C.prototype = { constructor: C, reset: function (t) { if ( ((this.prev = 0), (this.next = 0), (this.sent = this._sent = e), (this.done = !1), (this.delegate = null), (this.method = "next"), (this.arg = e), this.tryEntries.forEach(T), !t) ) for (var n in this) "t" === n.charAt(0) && i.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = e); }, stop: function () { this.done = !0; var e = this.tryEntries[0].completion; if ("throw" === e.type) throw e.arg; return this.rval; }, dispatchException: function (t) { if (this.done) throw t; var n = this; function o(i, o) { return ( (s.type = "throw"), (s.arg = t), (n.next = i), o && ((n.method = "next"), (n.arg = e)), !!o ); } for (var r = this.tryEntries.length - 1; r >= 0; --r) { var a = this.tryEntries[r], s = a.completion; if ("root" === a.tryLoc) return o("end"); if (a.tryLoc <= this.prev) { var l = i.call(a, "catchLoc"), d = i.call(a, "finallyLoc"); if (l && d) { if (this.prev < a.catchLoc) return o(a.catchLoc, !0); if (this.prev < a.finallyLoc) return o(a.finallyLoc); } else if (l) { if (this.prev < a.catchLoc) return o(a.catchLoc, !0); } else { if (!d) throw Error( "try statement without catch or finally" ); if (this.prev < a.finallyLoc) return o(a.finallyLoc); } } } }, abrupt: function (e, t) { for (var n = this.tryEntries.length - 1; n >= 0; --n) { var o = this.tryEntries[n]; if ( o.tryLoc <= this.prev && i.call(o, "finallyLoc") && this.prev < o.finallyLoc ) { var r = o; break; } } r && ("break" === e || "continue" === e) && r.tryLoc <= t && t <= r.finallyLoc && (r = null); var a = r ? r.completion : {}; return ( (a.type = e), (a.arg = t), r ? ((this.method = "next"), (this.next = r.finallyLoc), f) : this.complete(a) ); }, complete: function (e, t) { if ("throw" === e.type) 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) { var n = this.tryEntries[t]; if (n.finallyLoc === e) return ( this.complete(n.completion, n.afterLoc), T(n), f ); } }, catch: function (e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) { var n = this.tryEntries[t]; if (n.tryLoc === e) { var i = n.completion; if ("throw" === i.type) { var o = i.arg; T(n); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function (t, n, i) { return ( (this.delegate = { iterator: L(t), resultName: n, nextLoc: i, }), "next" === this.method && (this.arg = e), f ); }, }), t ); } function L(e, t, n, i, o, r, a) { try { var s = e[r](a), l = s.value; } catch (e) { return void n(e); } s.done ? t(l) : Promise.resolve(l).then(i, o); } function P(e) { return function () { var t = this, n = arguments; return new Promise(function (i, o) { var r = e.apply(t, n); function a(e) { L(r, i, o, a, s, "next", e); } function s(e) { L(r, i, o, a, s, "throw", e); } a(void 0); }); }; } var g = new Event("loginModalCloseEvent"); (window.onLoginCallbacks = window.onLoginCallbacks || []), (window.onRegisterCallbacks = window.onRegisterCallbacks || []); var m = !1; function R() { return M.apply(this, arguments); } function M() { return (M = P( E().mark(function e() { var t; return E().wrap(function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if (0 != window.onLoginCallbacks.length) { e.next = 2; break; } return e.abrupt("return"); case 2: return ( (t = window.onLoginCallbacks.map(function (e) { try { return e(); } catch (e) { return recordError(e), null; } })), e.abrupt("return", Promise.all(t)) ); case 4: case "end": return e.stop(); } }, e); }) )).apply(this, arguments); } function D(e) { return j.apply(this, arguments); } function j() { return (j = P( E().mark(function e(t) { return E().wrap(function (e) { for (;;) switch ((e.prev = e.next)) { case 0: return ( (e.next = 2), Promise.resolve( $.post("/settings/save", { cardBack: "back_red", cardDeck: "style-classic-2", backgroundImage: t, factorHeight: "1.45", }) ) ); case 2: case "end": return e.stop(); } }, e); }) )).apply(this, arguments); } function U() { return F.apply(this, arguments); } function F() { return (F = P( E().mark(function e() { var t; return E().wrap(function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if (0 != window.onRegisterCallbacks.length) { e.next = 2; break; } return e.abrupt("return"); case 2: return ( (t = window.onRegisterCallbacks.map(function (e) { try { return e(); } catch (e) { return recordError(e), null; } })), e.abrupt("return", Promise.all(t)) ); case 4: case "end": return e.stop(); } }, e); }) )).apply(this, arguments); } function q(e) { var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; if (!window.GLOBAL || !window.GLOBAL.LOGIN_NO_RELOAD) if (e && t) window.open(e, "_blank").focus(); else if (e) location.href = e; else if ($("#canvas").length > 0) if ("undefined" != typeof turns && turns > 0) { try { save_game(); } catch (e) { console.log("Save game error: ", e); } window.removeAdIfSubscriber(), window.dispatchEvent(g); } else location.href = location.href; else location.href = "/account"; } function B() { return N.apply(this, arguments); } function N() { return ( (N = P( E().mark(function e() { var t, n, i, o, r, s, d, c, u = arguments; return E().wrap(function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if ( ((t = u.length > 0 && void 0 !== u[0] ? u[0] : "google"), (i = u.length > 2 ? u[2] : void 0), (o = u.length > 3 && void 0 !== u[3] && u[3]), "error" != (n = u.length > 1 ? u[1] : void 0).status) ) { e.next = 9; break; } $("#loginForm .message").text(n.message).show(), _( "Login failed. ".concat( n.message, ". Redirecting. Please try again." ), i, 5 ), (e.next = 32); break; case 9: if ( ((r = n.userCreated ? "".concat(t, "-register") : "".concat(t, "-log-in")), window.tsRecordEvent(r), $(".logged-out").hide(), $(".logged-in").show(), $( "#loginModal, #registerModal, .registerModal" ).modal("hide"), (s = n.userCreated ? "".concat(t, "-sign-up") : "".concat(t, "-log-in")), gtag("event", s, { event_category: "registration", event_label: s, value: 1, }), !n.userCreated) ) { e.next = 24; break; } return ( (d = new (a())(!1)), (e.next = 20), d.tryMigrateGuestInventory() ); case 20: return ( (e.next = 22), l.PersonalStats.saveAllToServer() ); case 22: return (e.next = 24), U(); case 24: if (n.userCreated) { e.next = 28; break; } return (e.next = 27), R(); case 27: return e.abrupt("return", q(i, o)); case 28: (c = n.username), $("#playerName").val(c), $("#choose-name").modal("show"), $(document).on( "click", "#playerNameButton", function () { if ($("#playerName").val() == c) return ( $("#choose-name").modal("hide"), q(i, o) ); $.post( "/user/update-profile", { username: $("#playerName").val() }, function (e) { if ("error" != e.status) return ( $("#choose-name").modal("hide"), q(i, o) ); $("#choose-name-message") .text(e.message) .show(); } ); } ); case 32: case "end": return e.stop(); } }, e); }) )), N.apply(this, arguments) ); } (window.loadContactModal = P( E().mark(function e() { return E().wrap(function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if (!m) { e.next = 3; break; } return ( $("#contactModal").modal("show"), e.abrupt("return") ); case 3: return ( (m = !0), e.abrupt( "return", $.ajax({ url: "/modals/contact", success: function (e) { $("body").append(e), $("#contactModal").modal("show"); }, }) ) ); case 5: case "end": return e.stop(); } }, e); }) )), $("#navbarToggler a").on("click", function () { var e = $(this).text(), t = location.pathname; gtag("event", e, { event_category: "mainNav", event_label: t, value: 1, }); }), $(".menu-buttons a").on("click", function () { var e = $(this).text(), t = location.pathname; gtag("event", e, { event_category: "gameNav", event_label: t, value: 1, }); }); var f = 0, v = /ima is not a function/; function G() { $.get("/subscribe/payment", function (e) { "error" != e.status ? e.upgraded ? (location.href = location.href) : "register" != e.redirect ? (window.subscribeModalLoaded || (gtag("event", "showSubscribeScreen", { event_category: "subscribe", event_label: "shown", value: 1, }), $("#subscribeModal .modal-body").html(e)), $("#subscribeModal").modal("show")) : window.showRegisterModal() : (location.href = location.href); }); } (window.recordError = function (e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; try { consoleErrors.push([e.message, e.stack]), f < 5 && !v.test(e.message) && ($.post("/stream/record-error", { eventMessage: e.message, errorMessage: e.message, stackStrace: e.stack, extras: t, }), f++); } catch (e) { console.log("recordError error", e); } }), (window.removeAdIfSubscriber = function () { $.get("/user/is-subscriber", function (e) { "ok" == e.status && $("#adSidebarContainer, #subscribeButton").remove(); }); }), (window.finishRegistration = P( E().mark(function e() { var t; return E().wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: return ( (e.prev = 0), (t = new (a())(!1)), (e.next = 4), t.tryMigrateGuestInventory() ); case 4: return ( (e.next = 6), l.PersonalStats.saveAllToServer() ); case 6: return (e.next = 8), U(); case 8: e.next = 13; break; case 10: (e.prev = 10), (e.t0 = e.catch(0)), recordError(e.t0); case 13: $(".logged-out").hide(), $(".logged-in").show(); case 15: case "end": return e.stop(); } }, e, null, [[0, 10]] ); }) )), $(document).on( "click", "#customizeRegisterFormBtn", function (e) { e.preventDefault(); var t = { email: $("#customizeRegisterFormInput").val(), newsletter: "", generatePassword: !0, }; $.post( "/user/register", t, (function () { var e = P( E().mark(function e(n) { var i; return E().wrap(function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if ("error" != n.status) { e.next = 7; break; } (i = n.message), "duplicate email" == n.message && (i = 'An account with that email already exists. Please login.'), $("#customizeRegisterModal").modal( "hide" ), window.showRegisterModal( null, null, null, function () { $("#registerForm .email").val( t.email ), $(".register-message") .addClass("alert-danger") .html(i) .show(); } ), (e.next = 11); break; case 7: return ( (e.next = 9), window.finishRegistration() ); case 9: gtag("event", "sign-up", { event_category: "registration", event_label: "sign-up", value: 1, }), (location.href = "/account"); case 11: case "end": return e.stop(); } }, e); }) ); return function (t) { return e.apply(this, arguments); }; })() ); } ), $(document).on( "click", "#registerForm .submit, .emailOnlyRegisterFormBtn", function (e) { e.preventDefault(); var t = ""; $("#newsletterCheck").is(":checked") && (t = "yes"); var n = "emailOnly" == $(this).data("regtype"), i = $(this).data("formtype"), o = $(this).data("registration-offer"), r = $(this).data("redirect"), a = !!$(this).data("newtab"), s = null, l = null; n ? ((s = { email: (l = $( 'input[type="email"][data-formtype="'.concat( i, '"]' ) ).val()), newsletter: t, generatePassword: !0, }), o && (s.registrationOffer = o), "trophy" == i && (s.sendTrophy = $("#forceRegisterFormTrophy").val())) : (s = { email: $("#registerForm .email").val(), username: $("#registerForm .username").val(), password: $("#registerForm .password").val(), newsletter: t, nextPage: $("#registerForm #nextPage").val(), }), $.post( "/user/register", s, (function () { var e = P( E().mark(function e(t) { var o, s; return E().wrap(function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if ("error" != t.status) { e.next = 6; break; } (o = t.message), "duplicate email" == t.message && (o = 'An account with that email already exists. Please login.'), n ? ($(".registerModal").modal("hide"), window.showRegisterModal( null, null, null, function () { $("#registerForm .email").val( l ), $(".register-message") .addClass("alert-danger") .html(o) .show(); } )) : $(".register-message") .addClass("alert-danger") .html(o) .show(), (e.next = 11); break; case 6: if ("theme" != i) { e.next = 9; break; } return ( (e.next = 9), D($("#forceRegisterFormTheme").val()) ); case 9: (s = r || $("#registerModal").data( "redirectUrl" )), B("email", t, s, a); case 11: case "end": return e.stop(); } }, e); }) ); return function (t) { return e.apply(this, arguments); }; })() ); } ), $("#loginModal, #registerModal").on( "show.bs.modal", function () { "undefined" != typeof turns && turns > 0 && $(".save-message").show(); } ), $("#loginModal, #registerModal").on( "shown.bs.modal", function () { var e = $(this).attr("id"); gtag("event", e, { event_category: "showAuthModal", event_label: e, value: 1, }); } ), $(document).on("click", ".registerToLogin", function () { return $("#registerModal").modal("hide"), H(), !1; }), $(document).on("click", ".loginToRegister", function () { return ( $("#loginModal").modal("hide"), window.showRegisterModal(), !1 ); }); var w = function (e) { e.preventDefault(); var t = $(".congratsUsername").val(); return ( window.showRegisterModal( "username=" + t, null, "Finish registering to save your name on the leaderboard." ), gtag("event", "clickSaveUsername", { event_category: "showAuthModal", event_label: "clickSaveUsername", value: 1, }), !1 ); }; $("body").on("click", ".saveUsername", w), $("body").on("submit", ".save-username", w); var b = window.innerWidth, y = !1; function z() { $("#openPassRegisterLinkContainer").hide(), $("#openPassSignInLinkContainer").hide(), $(".email_and_pw_inputs").show(), $("#openPassSignInLink").show(), $("#openpass-sso-container").show(), $("#openPassRegisterLink").show(), $(".email_and_pw_button").hide(), $(".email-register-section").show(); } function H(e, t) { (0, u.ifMobileTryLngtdRetireAnchor)(), null == e && (e = ""), $.get( "/user/login?action=" + e, (function () { var e = P( E().mark(function e(n) { var i, o; return E().wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if ("paymentRedirect" != n.status) { e.next = 3; break; } return G(), e.abrupt("return"); case 3: if ( ($("#loginModal .modal-body").html(n), null === (i = SOLITAIRED_GLOBAL.openPass) || void 0 === i || !i.clientId) ) { e.next = 15; break; } return ( window.tsRecordEvent("authOpen"), (o = { redirectUrl: "".concat( window.location.origin, "/user/openpass/callback" ), parentContainerElementId: "openPassSignInLinkContainer", authenticationMode: "redirect", signinButtonTextOption: "signin", }), (e.prev = 7), (e.next = 10), k.renderInlineSignInForm(o) ); case 10: e.next = 15; break; case 12: (e.prev = 12), (e.t0 = e.catch(7)), console.error(e.t0); case 15: $("#loginModal").modal("show"), t && setTimeout(t, 100); case 17: case "end": return e.stop(); } }, e, null, [[7, 12]] ); }) ); return function (t) { return e.apply(this, arguments); }; })() ); } // $(window).resize(function () { // b >= 1019 && window.innerWidth < 1019 // ? "undefined" == typeof googletag || // void 0 === googletag.destroySlots || // y || // (googletag.destroySlots([adSlot1]), // $( // "#adSidebarContainer #solitaired_desktop_right_rail_2, #adSidebarContainer #solitaired_desktop_right_rail_2_container" // ).remove(), // (y = !0), // gtag("event", "removeGAM_1019", { // event_category: "adRemoval", // event_label: window.innerWidth, // value: 1, // })) // : b >= 920 && // window.innerWidth < 920 && // ("undefined" == typeof googletag || // void 0 === googletag.destroySlots || // y || // (googletag.destroySlots(), // $( // "#adSidebarContainer #solitaired_desktop_right_rail_2, #adSidebarContainer #solitaired_desktop_right_rail_2_container" // ).remove(), // (y = !0), // gtag("event", "removeGAM_920", { // event_category: "adRemoval", // event_label: window.innerWidth, // value: 1, // }))); // }), window.innerWidth < 450 && ($(".audio-toggle-off").click(), $(".audio-toggle").remove()), "undefined" != typeof isEdition && $("a").on("click", function (e) { var t = e.target.href; t.length < 1 || (t.indexOf("?") > -1 ? -1 == t.indexOf("edition") && (e.target.href = t + "&edition=true") : (e.target.href = t + "?edition=true")); }), $(function () { $(document).on("click", ".email_and_pw_button", z); }), (window.showRegisterModal = function (e, t, n, i) { (0, u.ifMobileTryLngtdRetireAnchor)(), null == e && (e = ""), $.get( "/user/register?" + e, (function () { var e = P( E().mark(function e(o) { var r, a; return E().wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if ("paymentRedirect" != o.status) { e.next = 4; break; } return ( $("#registerModal").modal("hide"), G(), e.abrupt("return") ); case 4: if ( ($("#registerModal .modal-body").html( o ), $("#register-message").text(n), t && $("#registerModal").data( "redirectUrl", t ), null === (r = SOLITAIRED_GLOBAL.openPass) || void 0 === r || !r.clientId) ) { e.next = 18; break; } return ( window.tsRecordEvent("authOpen"), (a = { redirectUrl: "".concat( window.location.origin, "/user/openpass/callback" ), parentContainerElementId: "openPassRegisterLinkContainer", authenticationMode: "redirect", signinButtonTextOption: "continue", }), (e.prev = 10), (e.next = 13), k.renderInlineSignInForm(a) ); case 13: e.next = 18; break; case 15: (e.prev = 15), (e.t0 = e.catch(10)), console.error(e.t0); case 18: $("#registerForm .email").focus(), $("#registerModal").modal("show"), i && i(); case 21: case "end": return e.stop(); } }, e, null, [[10, 15]] ); }) ); return function (t) { return e.apply(this, arguments); }; })() ); }), (window.copyToClipboard = function (e) { var t = document.getElementById(e); t.select(), t.setSelectionRange(0, 99999), document.execCommand("copy"), alert("Copied the text: " + t.value); }), $("#tiktokUrl .close").on("click", function () { $("#tiktokUrl").remove(); }), $("#loginModal").on("show.bs.modal", function () { H(); }), $("#registerModal").on("hide.bs.modal", function () { var e = $("#registerModal").data("redirectUrl"), t = $("#registerIsNoMoments"); if (e && t.length > 0) return (location.href = e); }), $( ".subscribeTrigger, #subscribeButton, #subscribeButtonMobile" ).on("click", function () { gtag("event", "showRegLoginScreen", { event_category: "subscribe", event_label: "shown", value: 1, }), G(); }), $("#moreMenuDropdown").on( "click", ".enable-autoplay", function () { var e = $(this); e.removeClass("enable-autoplay"), e.addClass("disable-autoplay"), e.text("Disable Auto Play") // $.post("/settings/save", { autoplayDisabled: "false" }); } ), $("#moreMenuDropdown").on( "click", ".disable-autoplay", function () { var e = $(this); e.removeClass("disable-autoplay"), e.addClass("enable-autoplay"), e.text("Enable Auto Play") // $.post("/settings/save", { autoplayDisabled: "true" }); } ), $("#moreMenuDropdown").on( "click", ".enable-autocomplete", function () { var e = $(this); e.removeClass("enable-autocomplete"), e.addClass("disable-autocomplete"), e.text("Disable Autocomplete"), $.post("/settings/save", { autocompleteDisabled: "false", }); } ), $("#moreMenuDropdown").on( "click", ".disable-autocomplete", function () { var e = $(this); e.removeClass("disable-autocomplete"), e.addClass("enable-autocomplete"), e.text("Enable Autocomplete") // $.post("/settings/save", { // autocompleteDisabled: "true", // }); } ), $("#moreMenuDropdown").on( "click", ".audio-toggle-off", function () { $(this).removeClass("audio-toggle-off"), $(this).addClass("audio-toggle-on"), $(this).text("Turn sounds off") // $.post("/settings/save", { sounds: "on" }); } ), $("#moreMenuDropdown").on( "click", ".audio-toggle-on", function () { $(this).removeClass("audio-toggle-on"), $(this).addClass("audio-toggle-off"), $(this).text("Turn sounds on"), $.post("/settings/save", { sounds: "off" }); } ), $("#animations-toggle").on("click", function () { var e = "off"; $(this).hasClass("animations-toggle-on") ? ($(this).removeClass("animations-toggle-on"), $(this).addClass("animations-toggle-off"), $(this).text("Turn animations off"), (e = "on")) : ($(this).removeClass("animations-toggle-off"), $(this).addClass("animations-toggle-on"), $(this).text("Turn animations on")) // $.post("/settings/save", { animations: e }); }), $("#hotkeys-toggle").on("click", function () { var e = "off"; $(this).hasClass("hotkeys-toggle-on") ? ($(this).removeClass("hotkeys-toggle-on"), $(this).addClass("hotkeys-toggle-off"), $(this).text("Turn hotkeys off"), (e = "on")) : ($(this).removeClass("hotkeys-toggle-off"), $(this).addClass("hotkeys-toggle-on"), $(this).text("Turn hotkeys on")) // $.post("/settings/save", { hotkeys: e }); }), $(".menu-buttons").on("click", ".left-hand-mode", async function (e) { e.preventDefault(), $(this).text("Right hand"), $(this).removeClass("left-hand-mode"), $(this).addClass("right-hand-mode"), await new Promise((resolve) => {//接口改成本地存储 异步防止页面刷新导致修改中断 if(localStorage.getItem('handMode') == 'right'){ localStorage.setItem("handMode", "left"); }else{ localStorage.setItem("handMode", "right"); } resolve(); }); location.href = location.href; // $.post( // "https://settings/save", // { handmode: "left" }, // function () { // location.href = location.href; // } // ); }) $(".menu-buttons").on("click", ".right-hand-mode", async function () { $(this).removeClass("right-hand-mode"), $(this).addClass("left-hand-mode"), $(this).text("Left hand"), await new Promise((resolve) => { localStorage.setItem("handMode", "left"); resolve(); }); location.href = location.href; // $.post( // "https:///settings/save", // { handmode: "right" }, // function () { // location.href = location.href; // } // ); }) $("#playAnotherGame").on("click", function () { window.setTimeout(function () { $("#dropdownMenuOffset").dropdown("toggle"); }, 50); }), $(document).on("click", "#personalizedStatsLink", function () { window.showRegisterModal( null, null, "Sign up to see personalized stats!" ); }), $("#fullscreenBtn").on("click", function () { var e = document.getElementById("gameContainer"); $(this).hasClass("show") ? ($(this).removeClass("show"), $(this).text("Exit Fullscreen"), (0, o.enterFullScreen)(e)) : ($(this).text("Fullscreen"), $(this).addClass("show"), (0, o.exitFullScreen)()); }); try { $('[data-toggle="popover"]').popover(); } catch (K) { recordError(K); } $("#playStore").on("click", function () { gtag("event", "click", { event_category: "android", event_label: "shown", value: 1, }); }), (window.tsRecordEvent = function (e, t, n) { var i = (0, o.getQueryStringValue)("difficulty"), r = { eventType: String(e), path: location.pathname, innerWidth: window.innerWidth, innerHeight: window.innerHeight, game: window.nameSlug, cardBack: window.cardBack, imageFolder: window.imageFolder, gameOfTheDay: window.gameOfTheDay, difficulty: i, }; void 0 !== t && (r.stepName = String(t)), void 0 !== n && (r.stepNum = String(n)), navigator.sendBeacon ? 1 // navigator.sendBeacon( // "/stream/record-experiment", // new Blob([JSON.stringify(r, null, 2)], { // type: "text/plain", // }) // ) : 2; // $.post("/stream/record-experiment", r, function () {}); }), window.tsRecordEvent("pageview"); var k, x = !1; window.callLngtdStart = function () { try { "function" != typeof window.lngtdStart || x || ((x = !0), window.lngtdStart()); } catch (e) { window.recordError(e); } }; try { (0, i.cleanUpLocalStorage)(); } catch (Y) { console.log(Y); } if ( ($(".logout-link").on("click", function () { try { l.PersonalStats.clearLocalStorage(), a().clearLocalStorage(), (0, o.tryClearValueFromLocalStorage)("username"); } catch (e) { console.log(e); } }), window.location.search.indexOf("registered=true") > -1) ) try { var S = new (a())(!1); await S.tryMigrateGuestInventory(), l.PersonalStats.saveAllToServer(); } catch (X) { recordError(X); } $( P( E().mark(function e() { var t, n, i, r; return E().wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if ( null !== (t = SOLITAIRED_GLOBAL.openPass) && void 0 !== t && t.clientId ) { e.next = 2; break; } return e.abrupt("return"); case 2: if ( ((k = new d.OpenPassClient({ clientId: SOLITAIRED_GLOBAL.openPass.clientId, })), (0, o.checkTestBucket)("TTD_QUICKAUTH3", 1) && window.nameSlug && !SOLITAIRED_GLOBAL.loggedInUser && !SOLITAIRED_GLOBAL.isEdition) ) try { (0, o.tryGetValueFromLocalStorage)( "ttdQuickAuthHiddenTime" ) || k.renderQuickAuth({ parentContainerElementId: "op-quick-auth", authenticationMode: "redirect", redirectUrl: "".concat( window.location.origin, "/user/openpass/callback" ), visibility: "displayOnInit", clientState: { isQuickAuth: "true" }, visibilityChangedCallback: function (e) { "hidden" == e.visibility && (0, o.trySetValueInLocalStorage)( "ttdQuickAuthHiddenTime", Date.now() ); }, }); } catch (e) { console.error(e); } if ( ($(document).on( "click", "#openPassSignInLink, #openPassRegisterLink", function (e) { var t = "openPassSignInLink" === e.currentTarget.id ? "openpass signin clicked" : "openpass register clicked"; gtag("event", t, { event_category: "registration", event_label: t, value: 1, }), k.signInWithRedirect({ redirectUrl: "".concat( window.location.origin, "/user/openpass/callback" ), }); } ), (window.trackClick = function (e, t, n) { try { gtag("event", e, { event_category: t, event_label: n, value: 1, }); } catch (e) {} }), !k.isAuthenticationRedirect()) ) { e.next = 20; break; } return ( (e.prev = 7), (e.next = 10), k.handleAuthenticationRedirect() ); case 10: (i = e.sent), (r = null === (n = i.clientState) || void 0 === n ? void 0 : n.isQuickAuth), $.post( "/user/openpass-login", { rawIdToken: i.rawIdToken, isQuickAuth: r }, function (e) { "error" === e.status ? _( "Login failed. ".concat( e.message, ". Redirecting. Please try again." ), i.originatingUri, 5 ) : B("openpass", e, i.originatingUri); } ).fail(function () { _( "Login failed. Redirecting. Please try again.", i.originatingUri, 5 ); }), (e.next = 18); break; case 15: (e.prev = 15), (e.t0 = e.catch(7)), _( "Login failed. Redirecting to home page. Please try again.", "/", 5 ); case 18: e.next = 21; break; case 20: location.href.indexOf( "/user/openpass/callback" ) >= 0 && _( "Hmm, something went wrong. Redirecting to home page. Please try again.", "/", 5 ); case 21: case "end": return e.stop(); } }, e, null, [[7, 15]] ); }) ) ); var _ = function (e, t, n) { if ($("#loginMessage").length > 0) { $("#loginMessage").text("".concat(e, " ").concat(n)); var i = setInterval(function () { n > 0 ? ($("#loginMessage").text( "".concat(e, " ").concat(n - 1) ), n--) : (clearInterval(i), (window.location = t)); }, 1e3); } }; function W() { $("#viewInterstitialModal").length || $(".modal.show").length || ($(window).off("click touchstart", W), window.setTimeout(Q, 50)); } $(document).on( "click", ".sidebar-cal-link a, span.sidebar-cal-link", function () { try { gtag("event", "calendar-sidebar-click", { event_category: "calendar-sidebar-click", event_label: "calendar-sidebar-click", value: 1, }); } catch (e) { console.log("unable to record ga event"); } } ), $(function () { $(document).on("click", "a.trending-game-flex", function () { try { gtag("event", "trending-game-click", { event_category: "trending-game-click", event_label: "trending-game-click", value: 1, }); } catch (e) { console.log("unable to record ga event"); } }), SOLITAIRED_GLOBAL.loggedInUser || $(document).on( "click", "a.trending-game-flex", function (e) { e.preventDefault(); try { gtag("event", "show-trending-games-registration", { event_category: "registration", event_label: "show-trending-games-registration", value: 1, }); } catch (e) { console.log("unable to record ga event"); } window.showRegisterModal( null, null, "Register to play daily journeys." ); } ); }), $(function () { var e = null; SOLITAIRED_GLOBAL.loggedInUser || $(document).on( "click", ".gotd-cal-day.previous-game a, .signup-link", function (t) { var n; t.preventDefault(), null === (n = e) || void 0 === n || n.hide(); try { gtag("event", "show-gotd-calendar-registration", { event_category: "registration", event_label: "show-gotd-calendar-registration", value: 1, }); } catch (t) { console.log("unable to record ga event"); } window.showRegisterModal( null, null, "Register to play previous games of the day.", function () { $("#registerModal").on( "hidden.bs.modal", function () { var t; null === (t = e) || void 0 === t || t.show(); } ); } ); } ), $("#gameOfDayBtn, #gameOfDayStatsBtn").on( "click", function (t) { var n; (0, u.ifMobileTryLngtdRetireAnchor)(), t.preventDefault(); var i = window.mjGameName || window.nameSlug, o = new Date(), r = o.getUTCFullYear(), a = o.getUTCMonth() + 1; e = new s.GotdCalendar( r, a, null === (n = window.SOLITAIRED_GLOBAL) || void 0 === n ? void 0 : n.loggedInUser, i, window.gotdCalendarTabs ); } ); }); var I, A, O, T, C = !1; function V() { if (!C) if (window.lngtdStart) try { window.lngtdStart(); } catch (e) { console.log("Lngtd start error: ", e); } else setTimeout(V, 100); } function Q() { $(".sidebar-slogan").fadeOut(), $(".sidebar-stats").fadeIn(); try { (window.shownAd1 = !0), V(); } catch (e) {} } function J() { var e; if (window.nameSlug) if ( null !== (e = SOLITAIRED_GLOBAL) && void 0 !== e && e.username ) (0, o.trySetValueInLocalStorage)( "username", SOLITAIRED_GLOBAL.username ); else { var t, n = (0, o.tryGetValueFromLocalStorage)("username"); n && $.get( "/user/previous-login-method?un=".concat(n), function (e) { "ok" == e.status ? ((t = e.initial_login_method), window.tsRecordEvent( "previous-login-method-found-".concat(t) )) : recordError( new Error( "previous-login-method status not okay" ) ), "Google" == t && $("#google_relogin_button").show(), window.tsRecordEvent("request-login-modal-shown"); var n = $("#request-login"); n.modal("show"), $("#request-login-login").on("click", function () { window.tsRecordEvent( "request-login-modal-login-start" ), window.onLoginCallbacks.push(function () { return ( window.tsRecordEvent( "request-login-modal-login-success" ), Promise.resolve() ); }), n.modal("hide"), H(); }), $("#request-login-nothanks").on( "click", function () { window.tsRecordEvent( "request-login-modal-dismissed" ), (0, o.tryClearValueFromLocalStorage)( "username" ); } ); } ).fail(function () { recordError( new Error("previous-login-method request failed") ); }); } } // (window.shownAd1 = !1), // $(J), // $(window).on("click touchstart", W), // window.innerWidth >= 770 // ? (null !== (I = SOLITAIRED_GLOBAL) && // void 0 !== I && // I.noAds) || // "subscriber" == // (null === (A = SOLITAIRED_GLOBAL) || void 0 === A // ? void 0 // : A.role) // ? window.loadAdditionalScripts() // : (window.loadAdditionalScripts(), window.loadAdCode()) // : (null !== (O = SOLITAIRED_GLOBAL) && // void 0 !== O && // O.noAds) || // "subscriber" == // (null === (T = SOLITAIRED_GLOBAL) || void 0 === T // ? void 0 // : T.role) // ? $(window).on( // "click touchstart", // window.loadAdditionalScripts // ) // : ($(window).on( // "click touchstart", // window.loadAdditionalScripts // ), // $(window).on("click touchstart", window.loadAdCode)), // $(function () { // var e = window.SOLITAIRED_GLOBAL.registrationModalName; // if ( // e && // "" != e && // window.nameSlug && // !(0, o.tryGetValueFromLocalStorage)("username") // ) { // var t = $("#".concat(e)); // window.tsRecordEvent("showModalReached-".concat(e)), // t.modal("show"), // window.onRegisterCallbacks || // (window.onRegisterCallbacks = []), // window.onRegisterCallbacks.push( // P( // E().mark(function t() { // return E().wrap(function (t) { // for (;;) // switch ((t.prev = t.next)) { // case 0: // return ( // window.tsRecordEvent( // "registerSuccess-".concat(e) // ), // t.abrupt( // "return", // c.default.trackRequireRegistrationActivity( // { source: "register", modalName: e } // ) // ) // ); // case 2: // case "end": // return t.stop(); // } // }, t); // }) // ) // ), // window.onLoginCallbacks || (window.onLoginCallbacks = []), // window.onLoginCallbacks.push( // P( // E().mark(function t() { // return E().wrap(function (t) { // for (;;) // switch ((t.prev = t.next)) { // case 0: // return t.abrupt( // "return", // c.default // .trackRequireRegistrationActivity({ // source: "login", // modalName: e, // }) // .then(function () { // window.location.reload(); // }) // ); // case 1: // case "end": // return t.stop(); // } // }, t); // }) // ) // ), // $("#forceRegisterBtn").on("click", function (e) { // e.preventDefault(), // t.modal("hide"), // window.showRegisterModal( // "hideYahoo=true", // window.location.href, // "Register to play unlimited games and save your stats!" // ); // }); // } // }), $(function () { $(window).on("scroll", function () { var e = window.innerHeight / 2; $(this).scrollTop() > e ? $("#scrollToTop").fadeIn() : $("#scrollToTop").fadeOut(); }), $("#scrollToTop").on("click", function (e) { return ( e.preventDefault(), $("html, body").animate({ scrollTop: 0 }, 800), !1 ); }); }), $(function () { $('[data-toggle="tooltip"]').tooltip(); }), $(".modal-header .close").on("click", function () { (0, u.ifMobileTryResetAndRunAuction)(); }), h().listenTestRedirect(), window.addEventListener( "contextmenu", function (e) { if ("canvas" == e.target.id) return e.preventDefault(), !1; }, !1 ), $(document).on("keydown", function (e) { var t; if (88 == e.keyCode && e.shiftKey && e.metaKey) t = "url(/images/excel.png)"; else { if (90 != e.keyCode || !e.shiftKey || !e.metaKey) return; t = "url(/images/zoom.png)"; } $(".work-mode").is(":visible") ? $(".work-mode").hide() : ($(".work-mode").css({ "background-image": t, "background-size": "cover", }), $(".work-mode").show()), e.preventDefault(); }), $(".work-mode-btn").on("click", function () { $(".work-mode").hide(); }), $(".bookmark-us").on("click", function () { $("#bookmarkModal").modal("show"), gtag("event", "bookmarkModalShown", { event_category: "bookmark", event_label: "bookmarkModalShown", value: 1, }); }), t(); } catch (Z) { t(Z); } }, 1 ); }, 1409: function (e) { var t; self, (t = () => (() => { "use strict"; var e = { d: (t, n) => { for (var i in n) e.o(n, i) && !e.o(t, i) && Object.defineProperty(t, i, { enumerable: !0, get: n[i], }); }, o: (e, t) => Object.prototype.hasOwnProperty.call(e, t), r: (e) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module", }), Object.defineProperty(e, "__esModule", { value: !0 }); }, }, t = {}; e.d(t, { default: () => te }); var n = {}; e.r(n), e.d(n, { AuthError: () => o, OpenPassClient: () => Y, SdkError: () => i, }); class i extends Error { constructor(e) { super(e), Object.setPrototypeOf(this, new.target.prototype); } } class o extends i { constructor(e, t, n, i) { super(t || e), (this.error = e), (this.errorDescription = t), (this.errorUri = n), (this.clientState = i); } } class r extends i { constructor(e) { super(e); } } function a(e, t, n) { const i = e.split("."), o = i.pop(); if (void 0 === o) throw Error("Function name not provided"); for (let e = 0; e < i.length; e++) t = t[i[e]]; const r = t[o]; if (void 0 === r) throw Error(`Function '${o}' not found`); return r.apply(t, n); } function s(e) { return e .map((e) => { const t = e.endsWith("/") ? e.substring(0, e.length - 1) : e; return t.startsWith("/") ? t.substring(1) : t; }) .join("/"); } const l = "openpass-js-sdk", d = "OpenPass-SDK-Name", c = "OpenPass-SDK-Version", u = "state", p = "S256", h = "https://auth.myopenpass.com", g = "/v1/api/authorize", m = (e) => e || h, f = async (e, t) => { if (t.timeout) return await v(e, t); const n = await fetch(e, t); return { status: n.status, json: await b(n) }; }, v = async (e, t) => { let n; try { const i = new AbortController(); n = setTimeout(() => i.abort(), t.timeout); const o = await fetch(e, { ...t, signal: i.signal }); return { status: o.status, json: await b(o) }; } finally { n && clearTimeout(n); } }, w = (e) => { const t = []; return ( Object.keys(e).forEach((n) => { if (e[n]) { const i = encodeURIComponent(n), o = encodeURIComponent(e[n]); t.push(i + "=" + o); } }), t.length > 0 ? t.join("&") : "" ); }, b = async (e) => { var t; return ( null === (t = e.headers.get("content-type")) || void 0 === t ? void 0 : t.toLowerCase().includes("application/json") ) ? await e.json() : null; }, y = "invalid_redirect"; function k(e) { this.message = e; } (k.prototype = new Error()), (k.prototype.name = "InvalidCharacterError"); var x = ("undefined" != typeof window && window.atob && window.atob.bind(window)) || function (e) { var t = String(e).replace(/=+$/, ""); if (t.length % 4 == 1) throw new k( "'atob' failed: The string to be decoded is not correctly encoded." ); for ( var n, i, o = 0, r = 0, a = ""; (i = t.charAt(r++)); ~i && ((n = o % 4 ? 64 * n + i : i), o++ % 4) ? (a += String.fromCharCode(255 & (n >> ((-2 * o) & 6)))) : 0 ) i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf( i ); return a; }; function S(e) { this.message = e; } (S.prototype = new Error()), (S.prototype.name = "InvalidTokenError"); const _ = (e) => (function (e, t) { if ("string" != typeof e) throw new S("Invalid token specified"); var n = !0 === (t = t || {}).header ? 0 : 1; try { return JSON.parse( (function (e) { var t = e.replace(/-/g, "+").replace(/_/g, "/"); switch (t.length % 4) { case 0: break; case 2: t += "=="; break; case 3: t += "="; break; default: throw "Illegal base64url string!"; } try { return (function (e) { return decodeURIComponent( x(e).replace(/(.)/g, function (e, t) { var n = t .charCodeAt(0) .toString(16) .toUpperCase(); return n.length < 2 && (n = "0" + n), "%" + n; }) ); })(t); } catch (e) { return x(t); } })(e.split(".")[n]) ); } catch (e) { throw new S("Invalid token specified: " + e.message); } })(e), I = "4.7.0"; class $ { constructor(e) { (this.options = e), this.validateOptions(e); } async exchangeAuthCodeForTokens(e, t) { var n, i, r; const a = { grant_type: "authorization_code", client_id: t.clientId, redirect_uri: t.redirectUrl, code: e, code_verifier: t.codeVerifier, }, s = {}; (s[d] = l), (s[c] = I), (s["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"); const u = ( await f(this.resolveUri("/v1/api/token"), { method: "POST", headers: s, body: w(a), timeout: 6e4, }) ).json; if (this.isErrorResponse(u)) throw new o( null !== (n = u.error) && void 0 !== n ? n : "token_oidc_id_request_failed", null !== (i = u.error_description) && void 0 !== i ? i : "Error retrieving token", null !== (r = u.error_uri) && void 0 !== r ? r : "", t.clientState ); const p = u.id_token, h = _(p); if (!h) throw new o( "decode_jwt", "Unable to decode jwt", "", t.clientState ); const g = u.access_token, m = u.refresh_token; if (!g) throw new o( "no_access_token", "No access token was returned", "", t.clientState ); return { idToken: h, rawIdToken: p, accessToken: g, refreshToken: m, rawAccessToken: g, tokenType: u.token_type, expiresIn: u.expires_in, }; } async authorizeDevice(e, t, n) { var i, r, a; const s = { scope: "openid", client_id: e }; t && (s.login_hint = t), n && (s.disable_login_hint_editing = n); const u = {}; (u[d] = l), (u[c] = I), (u["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"); const p = ( await f(this.resolveUri("/v1/api/authorize-device"), { method: "POST", headers: u, body: w(s), timeout: 6e4, }) ).json; if (this.isErrorResponse(p)) throw new o( null !== (i = p.error) && void 0 !== i ? i : "authorize_device_request_failed", null !== (r = p.error_description) && void 0 !== r ? r : "Error authorizing device", null !== (a = p.error_uri) && void 0 !== a ? a : "" ); return p; } async deviceToken(e, t) { var n, i, r; const a = { client_id: e, grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code: t, }, s = {}; (s[d] = l), (s[c] = I), (s["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"); const u = ( await f(this.resolveUri("/v1/api/device-token"), { method: "POST", headers: s, body: w(a), timeout: 6e4, }) ).json; if (this.isErrorResponse(u)) { if ("authorization_pending" === u.error) return { status: "authorization_pending" }; if ("slow_down" === u.error) return { status: "slow_down" }; throw new o( null !== (n = u.error) && void 0 !== n ? n : "device_token_request_failed", null !== (i = u.error_description) && void 0 !== i ? i : "Error getting device token", null !== (r = u.error_uri) && void 0 !== r ? r : "" ); } return { status: "ok", tokensResponse: u }; } async sendTelemetryEvent(e) { const t = {}; (t[d] = l), (t[c] = I), (t["Content-Type"] = "application/json"); const n = { client_id: this.options.clientId, event_type: e }; await f(this.resolveUri("/v1/api/telemetry/event"), { method: "POST", headers: t, body: JSON.stringify(n), }); } resolveUri(e) { return s([this.options.baseUrl || h, e]); } isErrorResponse(e) { return void 0 !== e.error; } validateOptions(e) { if (!e.clientId) throw new i( "Error clientId is invalid. Please use a valid clientId" ); } } const A = "__openpass__client_session"; class O { constructor(e) { this.signInStateStorage = e; } add(e) { this.signInStateStorage.set(A, JSON.stringify(e)); } get() { const e = this.signInStateStorage.get(A, ""); return e ? JSON.parse(e) : null; } remove() { this.signInStateStorage.remove(A); } } class T { set(e, t) { sessionStorage.setItem(e, t); } get(e, t) { return sessionStorage.getItem(e) || t; } remove(e) { sessionStorage.removeItem(e); } } const C = (e) => { const t = new URLSearchParams(e); return { code: P("code", t), state: P(u, t), error: P("error", t), errorDescription: P("error_description", t), errorUri: P("error_uri", t), }; }, E = (e, t, n, i, o) => { const r = new URLSearchParams(); if ( (r.set("response_type", "code"), r.set("client_id", n.clientId), r.set("scope", "openid"), r.set(u, n.state), r.set("sdk_name", l), r.set("sdk_version", I), r.set("op_auth_session_source", i), n.redirectUrl && r.set("redirect_uri", n.redirectUrl), n.codeChallengeMethod && r.set("code_challenge_method", n.codeChallengeMethod), n.codeChallenge && r.set("code_challenge", n.codeChallenge), n.responseMode && r.set("response_mode", n.responseMode), n.loginHint && r.set("login_hint", n.loginHint), n.consentJwt && r.set("consent_jwt", n.consentJwt), n.disableLoginHintEditing && r.set( "disable_login_hint_editing", n.disableLoginHintEditing ? "true" : "false" ), o) ) for (let e = 0; e < o.length; e++) { const t = o[e]; L(t), r.set(t.name, t.value); } return `${s([e, t])}?${r.toString()}`; }, L = (e) => { if (!e.name || !e.value) throw new i( "Custom query parameters must have both name and value" ); if (e.name.length > 100 || e.value.length > 100) throw new i( "Custom query parameters' name and value must be under 100 characters" ); if ( !/^[\x20-\x7E]*$/.test(e.name) || !/^[\x20-\x7E]*$/.test(e.value) ) throw new i( "Custom query parameter contains invalid characters. Only printable ASCII characters are allowed" ); }, P = (e, t) => { const n = t.get(e); return n ? decodeURIComponent(n) : null; }, R = (e, t) => e === t || (!!(t.endsWith("/") && t.length > 1) && e === t.substring(0, t.length - 1)); class M { constructor(e, t, n, i) { (this.isRedirectingForAuth = !1), (this.openPassOptions = e), (this.popupAuth = n), (this.redirectAuth = t), (this.apiClient = i); } renderInlineSignInForm(e) { var t; if (!e.parentContainerElementId) throw new i( "inlineSignInOptions.parentContainerElementId is required for inline sign-in method." ); e.signinButtonTextOption = null !== (t = e.signinButtonTextOption) && void 0 !== t ? t : "continue"; const n = document.getElementById(e.parentContainerElementId), o = e.authenticationMode, r = e.signinButtonBorderRadiusInPixels; if (!n) throw new i( `Cannot locate parent container element "${e.parentContainerElementId}" for inline sign-in form.` ); if ("popup" != o && "redirect" != o) throw new i(`Invalid authentication mode: ${o}.`); if ("popup" == o && !e.popupSuccessCallback) throw new i( "Must provide popupSuccessCallback for inline sign-in form when authentication mode is popup." ); if (e.widthInPixels && e.widthInPixels < 250) throw new i( "Inline sign-in form width must be at least 250 pixels." ); if (e.heightInPixels && e.heightInPixels < 500) throw new i( "Inline sign-in form width must be at least 500 pixels." ); if ( !["boolean", "undefined"].includes(typeof e.darkModeEnabled) ) throw new i( "Invalid darkModeEnabled value. Must be true or false." ); if (void 0 !== r) { if (!/^[0-9]+$/.test(String(r))) throw new i( "Invalid signinButtonBorderRadiusInPixels value. Must be an integer number greater than or equal to 0." ); if (r > 2147483647) throw new i( "Invalid signinButtonBorderRadiusInPixels value. Must be less than or equal to 2147483647." ); } const a = e.popupSuccessCallback, s = e.popupFailureCallback; window.addEventListener("message", async (t) => { var n; const r = m(this.openPassOptions.baseUrl); if ( !R(t.origin, r) || !t.data || "inline-sign-in-message" != t.data.type ) return; const { data: d } = t, c = { clientState: e.clientState, disableLoginHintEditing: !1, loginHint: d.loginHint, consentJwt: d.consentJwt, customQueryParameters: e.customQueryParameters, }; switch (o) { case "popup": try { if ( this.currentLoginHint === d.loginHint && this.popupAuth.refocusIfPopupExists() ) break; this.currentLoginHint = d.loginHint; const t = await this.popupAuth.signInWithPopup({ ...c, redirectUrl: e.redirectUrl, source: "SignInWithOpenPassInlineForm", }); a && a(t); } catch (e) { e instanceof i ? s && s(e) : console.error(e); } break; case "redirect": if (this.isRedirectingForAuth) break; this.isRedirectingForAuth = !0; try { await this.redirectAuth.signIn({ ...c, redirectUrl: e.redirectUrl, source: "SignInWithOpenPassInlineForm", }); } catch (e) { null === (n = l.contentWindow) || void 0 === n || n.postMessage( { type: "openpass-redirect-sign-in-failure" }, r ), console.error(e); } finally { this.isRedirectingForAuth = !1; } break; default: console.log("Invalid authentication mode: " + o); } }); const l = this.createIframeElement( this.openPassOptions.clientId, e ); n.appendChild(l), this.apiClient.sendTelemetryEvent( "SignInWithOpenPassInlineFormShown" ); } createIframeElement(e, t) { var n, i, o, r, a, s; const l = document.createElement("iframe"), d = m(this.openPassOptions.baseUrl), c = new URL("/inline-sign-in", d); return ( c.searchParams.append("client_id", e), c.searchParams.append( "submit_button_text", null !== (i = null === (n = t.signinButtonTextOption) || void 0 === n ? void 0 : n.toString()) && void 0 !== i ? i : "continue" ), c.searchParams.append("auth_mode", t.authenticationMode), t.hideSignInFormApplicationLogo && c.searchParams.append( "hide_client_application_logo", t.hideSignInFormApplicationLogo.toString() ), t.hideSignInFormHeaderText && c.searchParams.append( "hide_header_text", t.hideSignInFormHeaderText.toString() ), t.signinButtonBackgroundColorHex && c.searchParams.append( "sign_in_button_background_hex_colour", t.signinButtonBackgroundColorHex ), void 0 !== t.signinButtonBorderRadiusInPixels && c.searchParams.append( "sign_in_button_border_radius_px", String(t.signinButtonBorderRadiusInPixels) ), t.darkModeEnabled && c.searchParams.append( "dark_mode_enabled", t.darkModeEnabled.toString() ), (l.src = c.toString()), (l.width = null !== (r = null === (o = t.widthInPixels) || void 0 === o ? void 0 : o.toString()) && void 0 !== r ? r : "100%"), (l.height = null !== (s = null === (a = t.heightInPixels) || void 0 === a ? void 0 : a.toString()) && void 0 !== s ? s : "100%"), l ); } } const D = "openPassQuickAuthDismissalData"; class j { constructor(e, t, n, o) { (this.quickAuthSignInOptions = null), (this.isInitialized = !1), (this.showInstantly = (e = !1) => { var t; if (!this.isInitialized) throw new i( "Quick Auth is not initialized. Call `render` first." ); (e || !0 !== this.isVisible) && ((this.isVisible = !0), (this.quickAuthDialogIFrame.style.display = "block"), (null === (t = this.quickAuthSignInOptions) || void 0 === t ? void 0 : t.visibilityChangedCallback) && this.quickAuthSignInOptions.visibilityChangedCallback( { visibility: "visible" } ), this.apiClient.sendTelemetryEvent( "SignInWithOpenPassQuickSignShown" )); }), (this.hideInstantly = () => { var e; if (!this.isInitialized) throw new i( "Quick Auth is not initialized. Call `render` first." ); !1 !== this.isVisible && ((this.isVisible = !1), (this.quickAuthDialogIFrame.style.display = "none"), (null === (e = this.quickAuthSignInOptions) || void 0 === e ? void 0 : e.visibilityChangedCallback) && this.quickAuthSignInOptions.visibilityChangedCallback( { visibility: "hidden" } )); }), (this.openPassOptions = e), (this.popupAuth = n), (this.redirectAuth = t), (this.apiClient = o); } render(e) { this.quickAuthSignInOptions = e; const { redirectUrl: t, show: n, visibility: o, parentContainerElementId: r, authenticationMode: a, popupSuccessCallback: s, } = e; if ( (void 0 === o && (this.quickAuthSignInOptions.visibility = void 0 === n || !0 === n ? "displayOnInit" : "hideOnInit"), !r) ) throw new i( "parentContainerElementId is required for quick-auth sign-in method." ); const l = document.getElementById(r); if (!l) throw new i( `Cannot locate parent container element "${r}" for quick-auth` ); if ( ((this.parentContainer = l), "popup" !== a && "redirect" !== a) ) throw new i(`Invalid authentication mode: ${a}.`); if ("popup" === a && !s) throw new i( "Must provide popupSuccessCallback for quick-auth when authentication mode is popup." ); if ("redirect" === a && !t) throw new i( "Must provide redirectUrl for quick-auth when authentication mode is redirect." ); (this.quickAuthDialogIFrame = this.createHiddenQuickAuthIframe( this.openPassOptions.clientId, this.parentContainer )), window.addEventListener("message", (t) => this.messageHandler(t, e, this.quickAuthDialogIFrame) ), this.parentContainer.appendChild( this.quickAuthDialogIFrame ); } showWithDelay() { var e, t; if (!this.isInitialized) throw new i( "Quick Auth is not initialized. Call `render` first." ); if (!0 === this.isVisible) return; this.isVisible = !0; const n = setTimeout( () => { this.showInstantly(!0), clearTimeout(n); }, null !== (t = null === (e = this.quickAuthSignInOptions) || void 0 === e ? void 0 : e.delayMs) && void 0 !== t ? t : 1e3 ); } messageHandler(e, t, n) { if ( R(e.origin, m(this.openPassOptions.baseUrl)) && e.data && e.data.type ) switch (e.data.type) { case "openpass-quick-auth-initialized-message": this.handleInitializedMessage(e, t); break; case "openpass-quick-auth-continue-button-message": this.handleContinueButtonMessage(e, t); break; case "openpass-quick-auth-close-button-message": this.handleCloseButtonMessage(n); } } handleInitializedMessage(e, t) { const { data: { hasSession: n, popupWidth: i, popupHeight: o }, } = e; switch ( (this.setupQuickAuthIframeHeight({ width: i, height: o }), (this.isInitialized = !0), t.visibility) ) { case "displayOnInit": this.showWithDelay(); break; case "displayOnInitIfSessionActive": n ? this.showWithDelay() : this.hideInstantly(); break; case "hideOnInit": this.hideInstantly(); } } async handleContinueButtonMessage(e, t) { const { data: n } = e, o = t.popupSuccessCallback, r = t.popupFailureCallback, a = t.authenticationMode; this.clearDismissalData(); const s = { clientState: t.clientState, disableLoginHintEditing: !1, loginHint: n.loginHint, consentJwt: n.consentJwt, customQueryParameters: t.customQueryParameters, }; switch (a) { case "popup": try { if (this.popupAuth.refocusIfPopupExists()) break; const e = await this.popupAuth.signInWithPopup({ ...s, redirectUrl: t.redirectUrl, source: "SignInWithOpenPassQuickAuth", }); o && (this.hideInstantly(), o(e)); } catch (e) { e instanceof i ? r && r(e) : console.error(e); } break; case "redirect": this.redirectAuth.signIn({ ...s, redirectUrl: t.redirectUrl, source: "SignInWithOpenPassQuickAuth", }); break; default: console.error("Invalid authentication mode: " + a); } } handleCloseButtonMessage(e) { this.incrementDismissalData(), this.hideInstantly(), this.apiClient.sendTelemetryEvent( "SignInWithOpenPassQuickSignDismissed" ); } createHiddenQuickAuthIframe(e, t) { const n = document.createElement("iframe"), i = m(this.openPassOptions.baseUrl), o = new URL("/quick-auth", i); o.searchParams.append("client_id", e); const r = this.getDismissalData(); return ( r && (o.searchParams.append( "last_dismissed_utc", r.lastDismissedUtc ), o.searchParams.append( "times_dismissed", r.timesDismissed.toString() )), (t.style.zIndex = "9999"), (n.src = o.toString()), (n.width = "100%"), (n.style.display = "none"), (n.style.border = "none"), (n.style.overflow = "hidden"), window.innerWidth > 640 ? ((t.style.position = "fixed"), (t.style.top = "120px"), (t.style.right = "20px")) : ((t.style.width = "100%"), (t.style.position = "fixed"), (t.style.bottom = "0px"), (t.style.left = "0px")), n ); } setupQuickAuthIframeHeight({ width: e, height: t }) { if (!this.quickAuthDialogIFrame || !this.parentContainer) throw new i( "Quick Auth is not rendered. Call `render` first." ); (this.quickAuthDialogIFrame.height = `${t}px`), (this.parentContainer.style.height = `${t}px`), (this.quickAuthDialogIFrame.style.minWidth = `${e}px`); } getDismissalData() { const e = localStorage.getItem(D); if (null == e) return null; try { const t = JSON.parse(e); if ( !Number.isFinite(t.timesDismissed) || t.timesDismissed < 0 ) throw new Error("Invalid quick auth dismissal data"); if (!Date.parse(t.lastDismissedUtc)) throw new Error("Invalid quick auth dismissal data"); return t; } catch (e) { return this.clearDismissalData(), null; } } clearDismissalData() { localStorage.removeItem(D); } incrementDismissalData() { const e = this.getDismissalData(), t = new Date().toISOString(), n = ((null == e ? void 0 : e.timesDismissed) || 0) + 1; localStorage.setItem( D, JSON.stringify({ timesDismissed: n, lastDismissedUtc: t }) ); } } const U = () => window.crypto || window.msCrypto, F = (e = 43) => { const t = new Uint32Array(e); return ( U().getRandomValues(t), Array.from(t, (e) => `0${e.toString(16)}`.slice(-2)).join( "" ) ); }, q = (e = 43) => F(e), B = async (e) => { const t = await (async (e) => { const t = new TextEncoder().encode(e); return await (() => { const e = U(); return e.subtle || e.webkitSubtle; })().digest("SHA-256", t); })(e); return ( (i = t), (n = String.fromCharCode.apply(null, new Uint8Array(i))), btoa(n) .replace(/\+/g, "-") .replace(/\//g, "_") .replace(/=+$/, "") ); var n, i; }, N = (e = 16) => F(e); class G { constructor(e, t, n) { (this.openPassOptions = e), (this.openPassApiClient = n), (this.signInStateRepository = t); } async signIn(e) { var t; if (!e.redirectUrl) throw new i( "Error redirectUrl is invalid. Please use a valid redirectUrl" ); const n = q(), o = { clientState: e.clientState, clientId: this.openPassOptions.clientId, redirectUrl: e.redirectUrl, codeVerifier: n, codeChallenge: await B(n), codeChallengeMethod: p, state: N(), loginHint: e.loginHint, consentJwt: e.consentJwt, disableLoginHintEditing: e.disableLoginHintEditing, originatingUri: null === (t = null === window || void 0 === window ? void 0 : window.location) || void 0 === t ? void 0 : t.href, }; this.signInStateRepository.add(o); const r = E( m(this.openPassOptions.baseUrl), g, o, e.source, e.customQueryParameters ); window.location.href = r; } isAuthenticationRedirect() { const e = this.signInStateRepository.get(); return e ? ((e, t, n) => { if (!e || !n) return !1; const i = -1 != e.toLowerCase().indexOf(n.toLowerCase()), o = null !== t.state && null !== t.code, r = null !== t.error || null !== t.errorDescription; return i && (o || r); })( window.location.href, C(window.location.search), e.redirectUrl ) : (console.warn( "Unable to authenticate, a login session may not have being started. Possibly a call to login is required" ), !1); } async handleAuthenticationRedirect() { const e = this.signInStateRepository.get(); if (!e) throw new o( "invalid_auth_session", "Unable to authenticate, a login session may not have being started. Possibly a call to login is required", "" ); try { if (!this.isAuthenticationRedirect()) throw new o( y, "Unable to validate the redirect response", "", e.clientState ); const t = C(window.location.search); if (!this.isRedirectUrlValid(e, t) || !t.code) throw new o( t.error ? t.error : y, t.errorDescription ? t.errorDescription : "Unable to validate the redirect response", t.errorUri ? t.errorUri : "", e.clientState ); const n = await this.openPassApiClient.exchangeAuthCodeForTokens( t.code, e ), { idToken: i, rawIdToken: r, accessToken: a, refreshToken: s, tokenType: l, expiresIn: d, } = n; return { clientState: e.clientState, originatingUri: e.originatingUri, idToken: i, rawIdToken: r, accessToken: a, rawAccessToken: a, refreshToken: s, tokenType: l, expiresIn: d, }; } finally { this.signInStateRepository.remove(); } } isRedirectUrlValid(e, t) { return !(!e || !t.code || !t.state || e.state !== t.state); } } class z extends Promise { constructor(e) { let t; super((n, i) => e(n, i, (e) => (t = e))), (this.onAbort = t); } abort() { this.onAbort && this.onAbort(); } } const H = "openpass:popup:login"; class W { constructor(e, t, n) { (this.openPassOptions = e), (this.openPassClient = n), (this.redirectApi = t); } refocusIfPopupExists() { return !( !this.popupWindow || this.popupWindow.window.closed || (this.popupWindow.window.focus(), 0) ); } async signInWithPopup(e) { let t; this.closePopupIfExists(this.popupWindow); let n = null; try { t = this.openPopup(); } catch (e) { (t = null), (n = null == e ? void 0 : e.message); } if (!t) { if (e.redirectUrl) throw ( (this.redirectApi.signIn({ ...e, redirectUrl: e.redirectUrl, }), new i( "Using redirect instead of popup. This error should not be thrown because the redirect happens first." )) ); let t = "Popup window did not open correctly."; throw (n && (t += ` Error: ${n}`), new i(t)); } const o = { window: t }; return (this.popupWindow = o), this.doLogin(o, e); } async doLogin(e, t) { var n; const i = () => { this.closePopupIfExists(e); }; window.addEventListener("beforeunload", i); try { const i = q(), o = { clientState: null == t ? void 0 : t.clientState, clientId: this.openPassOptions.clientId, redirectUrl: null == t ? void 0 : t.redirectUrl, codeVerifier: i, codeChallenge: await B(i), codeChallengeMethod: p, state: N(), responseMode: "post_message", loginHint: null == t ? void 0 : t.loginHint, consentJwt: null == t ? void 0 : t.consentJwt, disableLoginHintEditing: null == t ? void 0 : t.disableLoginHintEditing, originatingUri: null === (n = null === window || void 0 === window ? void 0 : window.location) || void 0 === n ? void 0 : n.href, }, r = t ? t.source : "Custom", a = E( m(this.openPassOptions.baseUrl), g, o, r, null == t ? void 0 : t.customQueryParameters ); return ( e.window.location.replace(a), await this.waitForPopupResponse(e, o) ); } catch (t) { throw (t instanceof r || this.closePopupIfExists(e), t); } finally { window.removeEventListener("beforeunload", i); } } async waitForPopupResponse(e, t) { const n = await this.listenForPopupResponse(e); if (!this.isAuthCodeValid(n, t) || !n.code) throw new o( n.error ? n.error : "invalid_redirect", n.errorDescription ? n.errorDescription : "Error, invalid authorization code response", n.errorUri ? n.errorUri : "", t.clientState ); const i = await this.openPassClient.exchangeAuthCodeForTokens( n.code, t ); return await this.completeAuthentication(e, i, t); } async completeAuthentication(e, t, n) { const { idToken: o, rawIdToken: r, rawAccessToken: a, refreshToken: s, expiresIn: l, tokenType: d, } = t; return new Promise((t, c) => { setTimeout(() => { c(new i("No Response received from popup")); }, 1e4), (async () => { try { this.closePopupIfExists(e), t({ clientState: n.clientState, originatingUri: n.originatingUri, idToken: o, rawIdToken: r, accessToken: a, rawAccessToken: a, refreshToken: s, expiresIn: l, tokenType: d, }); } catch (t) { this.closePopupIfExists(e), c(t); } })(); }); } async listenForPopupResponse(e) { let t, n, o; const a = new z((a, s, l) => { (t = setInterval(() => { e.window && e.window.closed && (clearInterval(t), window.removeEventListener("message", o), this.closePopupIfExists(e), s( new i( "Popup closed, authentication response not available" ) )); }, 100)), (o = (e) => { if ( !R(e.origin, m(this.openPassOptions.baseUrl)) || !e.data ) return; const { data: t } = e; t.source && "openpass-authorize-message" === t.source && a(t); }), window.addEventListener("message", o, !1), (n = setInterval(() => { clearInterval(n), s(new i("No Response received from popup")); }, 6e5)), l(() => { clearInterval(t), clearTimeout(n), window.removeEventListener("message", o), s(new r("Popup window was closed")); }); }); return ( (e.listener = a), a.finally(() => { clearInterval(t), clearTimeout(n), window.removeEventListener("message", o); }) ); } openPopup() { return "undefined" != typeof window && "undefined" != typeof document && void 0 !== typeof window.postMessage && null !== window.postMessage ? window.matchMedia("screen and (min-width:960px)").matches ? ((e, t, n, i) => { const o = (window.outerWidth - 428) / 2 + window.screenX, r = `scrollbars=yes,resizable=yes,toolbar=no,top=${ (window.outerHeight - 586) / 2 + window.screenY },left=${o},width=428,height=586`; return window.open("", t, r); })(0, H) : ((e, t, n) => { { const e = `scrollbars=yes,resizable=yes,toolbar=no,top=${window.screenY},left=${window.screenX},width=${window.outerWidth},height=${window.outerHeight}`; return window.open("", t, e); } })(0, H) : null; } isAuthCodeValid(e, t) { return !(!e.code || !e.state) && t.state === e.state; } closePopupIfExists(e) { if (e) { if (e.window && !e.window.closed) try { e.window.close(); } catch (e) { console.warn( "Error closing the openpass popup window", e ); } if (e.listener) try { e.listener.abort(), (e.listener = void 0); } catch (e) { console.warn( "Error aborting the openpass popup listener", e ); } e == this.popupWindow && (this.popupWindow = void 0); } } } const V = (e) => { switch (e) { case "x-large": return 22; case "large": return 18; case "medium": return 14; case "small": return 10; } }, Q = "openpass-sign-in-button-stylesheet"; class J { constructor(e, t, n) { (this.popupAuth = t), (this.redirectAuth = e), (this.apiClient = n); } renderSignInButton(e) { if (!e.parentContainerElementId) throw new i( "No parent container element id provided for OpenPass sign-in button" ); if ( e.authenticationMode && "redirect" !== e.authenticationMode && "popup" !== e.authenticationMode ) throw new i( "Invalid authentication mode provided for OpenPass sign-in button, please choose either 'redirect' or 'popup'" ); if ("redirect" == e.authenticationMode && !e.redirectUrl) throw new i( "No redirect url provided for OpenPass sign-in button" ); if ( "popup" == e.authenticationMode && !e.popupSuccessCallback ) throw new i( "No popup success callback provided for OpenPass sign-in button" ); if (e.shape && "standard" !== e.shape && "icon" !== e.shape) throw new i( "Invalid shape provided for OpenPass sign-in button, please choose either 'standard' or 'icon'" ); if ( e.shapeVariant && "pill" !== e.shapeVariant && "rectangle" !== e.shapeVariant && "circle" !== e.shapeVariant && "square" !== e.shapeVariant ) throw new i( "Invalid shape variant provided for OpenPass sign-in button, please choose either 'pill', 'rectangle', 'circle' or 'square'" ); if ( "standard" == e.shape && void 0 !== e.shapeVariant && "pill" !== e.shapeVariant && "rectangle" !== e.shapeVariant ) throw new i( "Invalid shape variant provided for OpenPass sign-in button, please choose either 'pill' or 'rectangle'" ); if ( "icon" == e.shape && void 0 !== e.shapeVariant && "circle" !== e.shapeVariant && "square" !== e.shapeVariant ) throw new i( "Invalid shape variant provided for OpenPass sign-in button, please choose either 'circle' or 'square'" ); if (e.additionalWidth && e.additionalWidth < 0) throw new i( "Invalid width override provided for OpenPass sign-in button, please provide a positive number" ); if ( e.size && "x-large" !== e.size && "large" !== e.size && "medium" !== e.size && "small" !== e.size ) throw new i( "Invalid size provided for OpenPass sign-in button, please choose either 'x-large', 'large', 'medium' or 'small'" ); if ( e.theme && "openpass" !== e.theme && "light" !== e.theme && "dark" !== e.theme ) throw new i( "Invalid theme provided for OpenPass sign-in button, please choose either 'openpass', 'light' or 'dark'" ); if ( e.text && "signin" !== e.text && "signin_with" !== e.text && "continue_with" !== e.text ) throw new i( "Invalid text type provided for OpenPass sign-in button, please choose either 'signin', 'signin_with' or 'continue_with'" ); const t = document.getElementById(e.parentContainerElementId); if (!t) throw new i( `No button container found with id '${e.parentContainerElementId}' for OpenPass sign-in button` ); var n; (n = Q), null === document.querySelector(`style[id=${n}]`) && ((e, t) => { const n = document.createElement("style"); (n.innerHTML = "\n .op-js-sdk-siwopb__root {\n border: none;\n cursor: pointer;\n display: flex;\n font-family: Poppins, sans-serif;\n text-align: center;\n align-items: center;\n justify-content: center;\n vertical-align: middle;\n }\n \n .op-js-sdk-siwopb__inner {\n display: flex;\n align-items: center;\n }\n \n .op-js-sdk-siwopb__inner > svg {\n flex-shrink: 0;\n }\n\n .op-js-sdk-siwopb__theme-openpass {\n background-color: #012359;\n color: #FFFFFF;\n }\n\n .op-js-sdk-siwopb__theme-light {\n background-color: #FFFFFF;\n color: #3C4043;\n\n border-style: solid;\n border-color: #DADCE0;\n border-width: 1px;\n }\n\n .op-js-sdk-siwopb__theme-dark {\n background-color: #202124;\n color: #FFFFFF;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-x-large {\n font-weight: 400;\n font-size: 16px;\n \n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 16px;\n padding-right: 16px;\n\n height: 48px;\n min-height: 48px;\n max-height: 48px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-pill-x-large {\n border-radius: 100px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-rectangle-x-large {\n border-radius: 4px;\n }\n \n .op-js-sdk-siwopb__size-shape-standard-large {\n font-weight: 400;\n font-size: 14px;\n \n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 12px;\n padding-right: 12px;\n\n height: 40px;\n min-height: 40px;\n max-height: 40px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-pill-large {\n border-radius: 20px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-rectangle-large {\n border-radius: 4px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-medium {\n font-weight: 400;\n font-size: 12px;\n\n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 12px;\n padding-right: 12px;\n \n height: 32px;\n min-height: 32px;\n max-height: 32px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-pill-medium {\n border-radius: 16px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-rectangle-medium {\n border-radius: 4px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-small {\n font-weight: 300;\n font-size: 11px;\n\n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 8px;\n padding-right: 8px;\n \n height: 20px;\n min-height: 20px;\n max-height: 20px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-pill-small {\n border-radius: 10px;\n }\n\n .op-js-sdk-siwopb__size-shape-standard-rectangle-small {\n border-radius: 4px;\n }\n\n\n .op-js-sdk-siwopb__size-shape-icon-x-large {\n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 12px;\n padding-right: 12px;\n\n height: 48px;\n min-height: 48px;\n max-height: 48px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-square-x-large {\n border-radius: 4px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-circle-x-large {\n border-radius: 4px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-large {\n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 10px;\n padding-right: 10px;\n\n height: 40px;\n min-height: 40px;\n max-height: 40px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-square-large {\n border-radius: 4px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-circle-large {\n border-radius: 20px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-medium {\n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 8px;\n padding-right: 8px;\n\n height: 32px;\n min-height: 32px;\n max-height: 32px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-square-medium {\n border-radius: 4px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-circle-medium {\n border-radius: 16px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-small {\n padding-top: 0px;\n padding-bottom: 0px;\n padding-left: 4px;\n padding-right: 4px;\n \n height: 20px;\n min-height: 20px;\n max-height: 20px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-square-small {\n border-radius: 4px;\n }\n\n .op-js-sdk-siwopb__size-shape-icon-circle-small {\n border-radius: 10px;\n }\n\n .op-js-sdk-siwopb__logo-x-large {\n height: 22px;\n width: 22px;\n }\n\n .op-js-sdk-siwopb__logo-large {\n height: 18px;\n width: 18px;\n }\n\n .op-js-sdk-siwopb__logo-medium {\n height: 14px;\n width: 14px;\n }\n\n .op-js-sdk-siwopb__logo-small {\n height: 10px;\n width: 10px;\n }\n\n .op-js-sdk-siwopb__logo-shape-standard-x-large {\n margin-right: 10px;\n }\n\n .op-js-sdk-siwopb__logo-shape-standard-large {\n margin-right: 10px;\n }\n\n .op-js-sdk-siwopb__logo-shape-standard-medium {\n margin-right: 10px;\n }\n\n .op-js-sdk-siwopb__logo-shape-standard-small {\n margin-right: 10px;\n }\n\n .op-js-sdk-siwopb__logo-shape-icon-x-large {\n margin-left: auto;\n margin-right: auto;\n vertical-align: middle;\n }\n\n .op-js-sdk-siwopb__logo-shape-icon-large {\n margin-left: auto;\n margin-right: auto;\n vertical-align: middle;\n }\n\n .op-js-sdk-siwopb__logo-shape-icon-medium {\n margin-left: auto;\n margin-right: auto;\n vertical-align: middle;\n }\n\n .op-js-sdk-siwopb__logo-shape-icon-small {\n margin-left: auto;\n margin-right: auto;\n vertical-align: middle;\n }\n "), (n.id = t), document .getElementsByTagName("head")[0] .appendChild(n); })(0, Q), ((e) => { const t = document .getElementsByTagName("head")[0] .getElementsByTagName("link"); for (let e = 0; e < t.length; e++) if (t[e].href.includes("Poppins")) return !0; return !1; })() || ((e) => { const t = document.createElement("link"); (t.href = "https://fonts.googleapis.com/css?family=Poppins"), (t.rel = "stylesheet"), document .getElementsByTagName("head")[0] .appendChild(t); })(); const o = ((e) => { var t, n, i, o, r; const a = null !== (t = e.text) && void 0 !== t ? t : "signin_with", s = null !== (n = e.size) && void 0 !== n ? n : "large", l = null !== (i = e.theme) && void 0 !== i ? i : "openpass", d = null !== (o = e.shape) && void 0 !== o ? o : "standard", c = null !== (r = e.shapeVariant) && void 0 !== r ? r : "pill", u = document.createElement("button"); u.setAttribute("type", "button"), u.setAttribute( "aria-label", "Sign in with OpenPass Button" ), u.classList.add("op-js-sdk-siwopb__root"), u.classList.add(`op-js-sdk-siwopb__size-shape-${d}-${s}`), u.classList.add( `op-js-sdk-siwopb__size-shape-${d}-${c}-${s}` ), u.classList.add(`op-js-sdk-siwopb__theme-${l}`); const p = document.createElement("div"); if ( (p.classList.add("op-js-sdk-siwopb__inner"), u.appendChild(p), e.additionalWidth && e.additionalWidth > 0) ) { const t = e.additionalWidth / 2; (p.style.marginLeft = `${t}px`), (p.style.marginRight = `${t}px`); } const h = "light" === l ? ((e) => { const t = V(e), n = document.createElementNS( "http://www.w3.org/2000/svg", "svg" ); return ( n.setAttribute("role", "img"), n.setAttribute("title", "OpenPass Logo"), n.setAttribute("fill", "none"), n.setAttribute("width", `${t}`), n.setAttribute("height", `${t}`), n.setAttribute("viewBox", "5 4 40 40"), n.setAttribute( "xmlns", "http://www.w3.org/2000/svg" ), (n.innerHTML = '\n\n\n'), n ); })(s) : ((e) => { const t = V(e), n = document.createElementNS( "http://www.w3.org/2000/svg", "svg" ); return ( n.setAttribute("role", "img"), n.setAttribute("title", "OpenPass Logo"), n.setAttribute("fill", "none"), n.setAttribute("width", `${t}`), n.setAttribute("height", `${t}`), n.setAttribute("viewBox", "5 4 40 40"), n.setAttribute( "xmlns", "http://www.w3.org/2000/svg" ), (n.innerHTML = '\n\n\n '), n ); })(s); if ( (h.classList.add(`op-js-sdk-siwopb__logo-${s}`), h.classList.add(`op-js-sdk-siwopb__logo-shape-${d}-${s}`), p.appendChild(h), "standard" === d) ) { const e = document.createElement("span"); (e.innerText = ((e) => { switch (e) { case "signin": return "Sign in"; case "continue_with": return "Continue with OpenPass"; default: return "Sign in with OpenPass"; } })(a)), p.appendChild(e); } return u; })(e); o.addEventListener("click", async (t) => { var n; if ( (t.preventDefault(), "redirect" == e.authenticationMode) ) await this.redirectAuth.signIn({ redirectUrl: e.redirectUrl, source: "SignInWithOpenPassButton", clientState: e.clientState, loginHint: e.loginHint, customQueryParameters: e.customQueryParameters, }); else if ("popup" == e.authenticationMode) try { const t = await this.popupAuth.signInWithPopup({ redirectUrl: e.redirectUrl, source: "SignInWithOpenPassButton", clientState: e.clientState, loginHint: e.loginHint, customQueryParameters: e.customQueryParameters, }); try { null === (n = e.popupSuccessCallback) || void 0 === n || n.call(e, t); } catch (e) { console.error( `Error executing popup success callback, error: ${e}` ); } } catch (t) { if (e.popupFailedCallback) try { e.popupFailedCallback(t); } catch (e) { console.error( `Error executing popup failed callback, error: ${e}` ); } } }), t.appendChild(o), this.apiClient.sendTelemetryEvent( "SignInWithOpenPassButtonShown" ); } } class K { constructor(e, t) { (this.openPassOptions = e), (this.openPassApiClient = t); } async authorizeDevice(e) { const t = await this.openPassApiClient.authorizeDevice( this.openPassOptions.clientId, e.loginHint, e.disableLoginHintEditing ); return { deviceCode: t.device_code, userCode: t.user_code, verificationUri: t.verification_uri, verificationUriComplete: t.verification_uri_complete, expiresIn: t.expires_in, interval: t.interval, }; } async deviceToken(e) { const t = await this.openPassApiClient.deviceToken( this.openPassOptions.clientId, e ), n = { status: t.status }; if (t.tokensResponse) { const e = _(t.tokensResponse.id_token); n.tokens = { idToken: e, rawIdToken: t.tokensResponse.id_token, accessToken: t.tokensResponse.access_token, rawAccessToken: t.tokensResponse.access_token, refreshToken: t.tokensResponse.refresh_token, tokenType: t.tokensResponse.token_type, expiresIn: t.tokensResponse.expires_in, }; } return n; } } class Y { constructor(e) { (this.showQuickAuthSignIn = () => this.quickAuth.showInstantly()), (this.hideQuickAuthSignIn = () => this.quickAuth.hideInstantly()), (this.openPassOptions = e), (this.openPassApiClient = new $(this.openPassOptions)), (this.redirect = new G( this.openPassOptions, new O(new T()), this.openPassApiClient )), (this.popup = new W( this.openPassOptions, this.redirect, this.openPassApiClient )), (this.inlineSigninform = new M( this.openPassOptions, this.redirect, this.popup, this.openPassApiClient )), (this.signInButton = new J( this.redirect, this.popup, this.openPassApiClient )), (this.quickAuth = new j( this.openPassOptions, this.redirect, this.popup, this.openPassApiClient )), (this.deviceAuthGrant = new K( this.openPassOptions, this.openPassApiClient )); } async signInWithRedirect(e) { return this.redirect.signIn({ ...e, source: "Custom" }); } isAuthenticationRedirect() { return this.redirect.isAuthenticationRedirect(); } async handleAuthenticationRedirect() { return this.redirect.handleAuthenticationRedirect(); } async signInWithPopup(e) { return this.popup.signInWithPopup({ ...e, source: "Custom" }); } renderInlineSignInForm(e) { this.inlineSigninform.renderInlineSignInForm(e); } renderQuickAuth(e) { this.quickAuth.render(e); } renderSignInButton(e) { this.signInButton.renderSignInButton(e); } async authorizeDevice(e) { return await this.deviceAuthGrant.authorizeDevice(e); } async deviceToken(e) { return await this.deviceAuthGrant.deviceToken(e.deviceCode); } } const X = (e) => (null === e || "" === e ? void 0 : e), Z = (e, t) => { console.error(t), ee(e, t); }, ee = (e, t) => { e.setAttribute("data-error", t), (e.style.display = "none"); }; document.addEventListener( "DOMContentLoaded", () => { void 0 !== window && ((() => { var e, t; const n = document.getElementById("openpass-quick-auth"); if (!n) return; const i = n.getAttribute("data-openpass-quick-auth-mode"), o = n.getAttribute( "data-openpass-quick-auth-client-id" ), r = n.getAttribute("data-openpass-quick-auth-show"), s = n.getAttribute( "data-openpass-quick-auth-visibility" ), l = X( n.getAttribute( "data-openpass-quick-auth-redirect-uri" ) ), d = X( n.getAttribute( "data-openpass-quick-auth-popup-success-callback" ) ), c = X( n.getAttribute( "data-openpass-quick-auth-popup-failed-callback" ) ), u = X( n.getAttribute( "data-openpass-quick-auth-sso-base-uri" ) ), p = X( n.getAttribute( "data-openpass-quick-auth-visibility-changed-callback" ) ); if (i && "redirect" !== i && "popup" !== i) return void Z( n, "Invalid mode provided for OpenPass quick-auth, please choose either 'redirect' or 'popup'" ); const h = null !== (e = i) && void 0 !== e ? e : "redirect"; if (!o) return void Z( n, "No client id provided for OpenPass quick-auth, please add a 'data-client-id' attribute to the quick-auth container" ); if (r && "false" !== r && "true" !== r) return void Z( n, "Show parameter must be either 'true' or 'false' in the data-openpass-quick-auth-show attribute" ); const g = void 0 === r ? void 0 : "true" === r; if ( s && "displayOnInit" !== s && "displayOnInitIfSessionActive" !== s && "hideOnInit" !== s ) return void Z( n, "Visibility parameter must be either 'displayOnInit', 'displayOnInitIfSessionActive', or 'hideOnInit' in the data-openpass-quick-auth-visibility attribute" ); const m = null !== (t = s) && void 0 !== t ? t : "displayOnInit"; if ("redirect" === h && !l) return void Z( n, "No redirect URI provided for OpenPass quick-auth, please add a 'data-redirect-uri' attribute to the quick-auth container" ); if ("popup" === h && !d) return void Z( n, "No popup success callback provided for OpenPass quick-auth, please add a 'data-popup-success-callback' attribute to the quick-auth container" ); if (u) try { new URL(u); } catch (e) { return void Z( n, "Invalid URI provided for 'data-sso-base-uri' attribute, please provide a valid OpenPass Auth API URI" ); } new MutationObserver((e) => { e.forEach((e) => { if ( "data-openpass-quick-auth-show" === e.attributeName ) { if (!n) return; const e = n.getAttribute( "data-openpass-quick-auth-show" ); "true" === e ? f.showQuickAuthSignIn() : "false" === e ? f.hideQuickAuthSignIn() : Z( n, `Unexpected value ${e} found in 'data-openpass-quick-auth-show' attribute, please report this to the OpenPass support. Expected value range: true, false.` ); } }); }).observe(n, { subtree: !1, childList: !1, attributeFilter: ["data-openpass-quick-auth-show"], }); const f = new Y({ clientId: o, baseUrl: u }), v = { parentContainerElementId: "openpass-quick-auth", authenticationMode: h, redirectUrl: l, popupSuccessCallback: (e) => { d && a(d, window, [e]); }, popupFailureCallback: (e) => { c && a(c, window, [e]); }, show: g, visibility: m, visibilityChangedCallback: (e) => { p && a(p, window, [e]); }, }; try { f.renderQuickAuth(v); } catch (e) { const t = e instanceof Error ? e.message : "Error rendering quick-auth"; Z(n, t); } })(), (() => { var e; const t = document.getElementById( "sign-in-with-openpass-button" ); if (!t) return; const n = t.getAttribute("data-mode"), i = t.getAttribute("data-client-id"), o = X(t.getAttribute("data-redirect-uri")), r = X(t.getAttribute("data-popup-success-callback")), s = X(t.getAttribute("data-popup-failed-callback")), l = t.getAttribute("data-shape"), d = t.getAttribute("data-shape-variant"), c = t.getAttribute("data-size"), u = t.getAttribute("data-text"), p = t.getAttribute("data-theme"), h = t.getAttribute("data-additional-width"), g = X(t.getAttribute("data-sso-base-uri")); if (n && "redirect" !== n && "popup" !== n) return void Z( t, "Invalid mode provided for OpenPass sign-in button, please choose either 'redirect' or 'popup'" ); const m = null !== (e = n) && void 0 !== e ? e : "redirect"; if (!i) return void Z( t, "No client id provided for OpenPass sign-in button, please add a 'data-client-id' attribute to the button container" ); if ( u && "signin" !== u && "signin_with" !== u && "continue_with" !== u ) return void Z( t, "Invalid text type provided for OpenPass sign-in button, please choose either 'signin', 'signin_with' or 'continue_with'" ); if ("redirect" == m && !o) return void Z( t, "No redirect URI provided for OpenPass sign-in button, please add a 'data-redirect-uri' attribute to the button container" ); if ("popup" == m && !r) return void Z( t, "No popup success callback provided for OpenPass sign-in button, please add a 'data-popup-success-callback' attribute to the button container" ); if (g) try { new URL(g); } catch (e) { return void Z( t, "Invalid URI provided for 'data-sso-base-uri' attribute, please provide a valid OpenPass Auth API URI" ); } if (l && "standard" !== l && "icon" !== l) return void Z( t, "Invalid shape provided for OpenPass sign-in button, please choose either 'standard' or 'icon'" ); if ( d && "pill" !== d && "rectangle" !== d && "circle" !== d && "square" !== d ) return void Z( t, "Invalid shape variant provided for OpenPass sign-in button, please choose either 'pill', 'rectangle', 'circle' or 'square'" ); if ( "standard" == l && void 0 !== d && "pill" !== d && "rectangle" !== d ) return void Z( t, "Invalid shape variant provided for OpenPass sign-in button, please choose either 'pill' or 'rectangle'" ); if ( "icon" == l && void 0 !== d && "circle" !== d && "square" !== d ) return void Z( t, "Invalid shape variant provided for OpenPass sign-in button, please choose either 'circle' or 'square'" ); if (h) { const e = Number.parseInt(h); if (Number.isNaN(e) || e < 0) return void Z( t, "Invalid additional width provided for OpenPass sign-in button, please provide a positive number" ); } if ( c && "x-large" !== c && "large" !== c && "medium" !== c && "small" !== c ) return void Z( t, "Invalid size provided for OpenPass sign-in button, please choose either 'x-large', 'large', 'medium' or 'small'" ); if ( p && "openpass" !== p && "light" !== p && "dark" !== p ) return void Z( t, "Invalid theme provided for OpenPass sign-in button, please choose either 'openpass', 'light' or 'dark'" ); const f = l || void 0, v = d || void 0, w = p || void 0, b = c || void 0, y = u || void 0, k = h ? Number.parseInt(h) : void 0, x = new Y({ clientId: i, baseUrl: g }), S = { parentContainerElementId: "sign-in-with-openpass-button", authenticationMode: m, redirectUrl: o, popupSuccessCallback: (e) => { a(r, window, [e]); }, popupFailedCallback: (e) => { s && a(s, window, [e]); }, text: y, shape: f, shapeVariant: v, size: b, theme: w, additionalWidth: k, }; try { x.renderSignInButton(S); } catch (e) { const n = e instanceof Error ? e.message : "Error renering OpenPass sign-in button"; Z(t, n); } })()); }, { once: !0 } ); const te = n; return t.default; })()), (e.exports = t()); }, 7967: function (e, t, n) { var i = /^\s+|\s+$/g, o = /^[-+]0x[0-9a-f]+$/i, r = /^0b[01]+$/i, a = /^0o[0-7]+$/i, s = parseInt, l = "object" == typeof n.g && n.g && n.g.Object === Object && n.g, d = "object" == typeof self && self && self.Object === Object && self, c = l || d || Function("return this")(), u = Object.prototype.toString, p = Math.max, h = Math.min, g = function () { return c.Date.now(); }; function m(e) { var t = typeof e; return !!e && ("object" == t || "function" == t); } function f(e) { if ("number" == typeof e) return e; if ( (function (e) { return ( "symbol" == typeof e || ((function (e) { return !!e && "object" == typeof e; })(e) && "[object Symbol]" == u.call(e)) ); })(e) ) return NaN; if (m(e)) { var t = "function" == typeof e.valueOf ? e.valueOf() : e; e = m(t) ? t + "" : t; } if ("string" != typeof e) return 0 === e ? e : +e; e = e.replace(i, ""); var n = r.test(e); return n || a.test(e) ? s(e.slice(2), n ? 2 : 8) : o.test(e) ? NaN : +e; } e.exports = function (e, t, n) { var i, o, r, a, s, l, d = 0, c = !1, u = !1, v = !0; if ("function" != typeof e) throw new TypeError("Expected a function"); function w(t) { var n = i, r = o; return (i = o = void 0), (d = t), (a = e.apply(r, n)); } function b(e) { var n = e - l; return void 0 === l || n >= t || n < 0 || (u && e - d >= r); } function y() { var e = g(); if (b(e)) return k(e); s = setTimeout( y, (function (e) { var n = t - (e - l); return u ? h(n, r - (e - d)) : n; })(e) ); } function k(e) { return (s = void 0), v && i ? w(e) : ((i = o = void 0), a); } function x() { var e = g(), n = b(e); if (((i = arguments), (o = this), (l = e), n)) { if (void 0 === s) return (function (e) { return (d = e), (s = setTimeout(y, t)), c ? w(e) : a; })(l); if (u) return (s = setTimeout(y, t)), w(l); } return void 0 === s && (s = setTimeout(y, t)), a; } return ( (t = f(t) || 0), m(n) && ((c = !!n.leading), (r = (u = "maxWait" in n) ? p(f(n.maxWait) || 0, t) : r), (v = "trailing" in n ? !!n.trailing : v)), (x.cancel = function () { void 0 !== s && clearTimeout(s), (d = 0), (i = l = o = s = void 0); }), (x.flush = function () { return void 0 === s ? a : k(g()); }), x ); }; }, 6429: function (e, t, n) { "use strict"; var i = (this && this.__importDefault) || function (e) { return e && e.__esModule ? e : { default: e }; }; Object.defineProperty(t, "__esModule", { value: !0 }), (t.hasValidStoredGame = function (e) { if (e.indexOf("replay=true") > -1) return !1; const t = l(); return !!(t && t.url === e && a.indexOf(nameSlug) > -1); }), (t.deleteStoredGameState = s), (t.restoreGameState = l), (t.serializeCard = d), (t.serializeGameState = c), (t.storeGameState = function (e, t) { if (o.default.gameWon) return void s(); const n = c(e, t); try { localStorage.setItem("gameState", JSON.stringify(n)); } catch (e) { console.log(e); } }); const o = i(n(867)), r = "gameState", a = [ "klondike-turn-1", "klondike-turn-3", "las-vegas-klondike", "las-vegas-klondike-turn-3", "spider-one-suit", "spider-two-suits", "spider-four-suits", "freecell", ]; function s() { try { localStorage.removeItem(r); } catch (e) { console.log(e); } } function l() { try { const e = localStorage.getItem(r); if (e) return JSON.parse(e); } catch (e) { console.log(e); } return null; } function d(e) { return { name: e.name, turnedup: e.turnedup }; } function c(e, t) { const n = e.reduce( (e, t) => { const n = t.piles.map((e) => e.map((e) => d(e))); return (e.cardAreas[t.name] = n), e; }, { cardAreas: {} } ); return Object.assign(Object.assign({}, n), t); } }, 6887: function (e, t) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), (t.cloneStat = r), (t.shouldSkipMoments = function () { return !(Date.now() - s().momentsSkipTimestamp > o); }), (t.setSkipMoments = function () { const e = Date.now(), t = s(); (t.momentsSkipTimestamp = e), a(t); }), (t.hasSeenBookmarkModal = function () { return s().hasSeenBookmarkModal; }), (t.setHasSeenBookmarkModal = function (e) { const t = s(); (t.hasSeenBookmarkModal = e), a(t); }), (t.getBookMarkGameCounter = function () { return s().bookMarkGameCounter; }), (t.incrementBookmarkGameCount = function () { const e = s(); (e.bookMarkGameCounter = e.bookMarkGameCounter + 1), a(e); }), (t.cleanUpLocalStorage = function () { const e = []; for (let t = 0; t < localStorage.length; t++) { const n = localStorage.key(t); n && l.some((e) => n.startsWith(e)) && e.push(n); } e.forEach((e) => localStorage.removeItem(e)); }); const n = "SOLITAIRED_GLOBAL_STATE", i = { hasSeenBookmarkModal: !1, bookMarkGameCounter: 0, momentsSkipTimestamp: 0, }, o = 864e5; function r() { return JSON.parse(JSON.stringify(i)); } function a(e) { localStorage.setItem(n, JSON.stringify(e)); } function s() { const e = localStorage.getItem(n); if (!e) return r(); try { const t = JSON.parse(e); return Object.assign(Object.assign({}, i), t); } catch (e) { return r(); } } var l = [ "moves-klondike-turn-1-", "moves-klondike-turn-3-", "moves-spider-one-suit-", "moves-spider-two-suits-", "moves-spider-four-suits-", "moves-freecell-", ]; }, 3325: function (e, t) { "use strict"; var n = (this && this.__awaiter) || function (e, t, n, i) { return new (n || (n = Promise))(function (o, r) { function a(e) { try { l(i.next(e)); } catch (e) { r(e); } } function s(e) { try { l(i.throw(e)); } catch (e) { r(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((i = i.apply(e, t || [])).next()); }); }; Object.defineProperty(t, "__esModule", { value: !0 }), (t.GotdCalendar = void 0); const i = { "klondike-turn-1": { title: "Solitaire (Turn 1)", path: "/" }, "klondike-turn-3": { title: "Solitaire (Turn 3)", path: "/solitaire-turn-3", }, freecell: { title: "Freecell", path: "/freecell" }, "spider-one-suit": { title: "Spider 1 Suit", path: "/spider-solitaire", }, "spider-two-suits": { title: "Spider 2 Suits", path: "/spider-solitaire-two-suits", }, "spider-four-suits": { title: "Spider 4 Suits", path: "/spider-solitaire-four-suits", }, pyramid: { title: "Pyramid", path: "/pyramid-solitaire" }, tripeaks: { title: "Tripeaks", path: "/tripeaks-solitaire" }, }; t.GotdCalendar = class { constructor(e, t, o, r, a) { (this.enableAllNav = () => { $( "#gotdcalendar-next, #gotdcalendar-prev, #gotdcalendar-next-year, #gotdcalendar-prev-year" ).removeClass("disabled"); }), (this.fetchDataNow = () => { const e = new Date(), t = e.getUTCFullYear(), n = e.getUTCMonth() + 1; return this.fetchData(t, n); }), (this.fetchData = (e, t) => ( this.hideWarning(), new Promise((i) => { $.ajax({ url: `/high-scores/gotd-calendar/${this.currentNameSlug}/${e}/${t}`, type: "GET", dataType: "json", success: (o) => { if (o.data.noGames) return ( this.showWarning("No more games of the day"), i(!1) ); (this.year = e), (this.month = t), (this.data = o.data), this.enableAllNav(), this.render(), $("#gotdcalendar-next").on("click", (e) => { $("#gotdcalendar-next").addClass("disabled"), $("#gotdcalendar-next-year").addClass("disabled"), e.preventDefault(), this.getNextMonth(); }), $("#gotdcalendar-prev").on("click", (e) => { $("#gotdcalendar-prev").addClass("disabled"), $("#gotdcalendar-prev-year").addClass("disabled"), e.preventDefault(), this.getPrevMonth(); }), $("#gotdcalendar-next-year").on("click", (e) => { $("#gotdcalendar-next-year").addClass("disabled"), e.preventDefault(), this.getNextYear(); }), $("#gotdcalendar-prev-year").on("click", (e) => { $("#gotdcalendar-prev-year").addClass("disabled"), e.preventDefault(), this.getPrevYear(); }), $(".modal-tab-item").on("click", (e) => n(this, void 0, void 0, function* () { e.preventDefault(), (this.currentNameSlug = $(e.target).data( "tab-name" )), (yield this.fetchData(this.year, this.month)) || this.fetchDataNow(); }) ), $(".modal-tabs-selector").on("change", (e) => n(this, void 0, void 0, function* () { e.preventDefault(), (this.currentNameSlug = $(e.target) .val() .toString()), (yield this.fetchData(this.year, this.month)) || this.fetchDataNow(); }) ), i(!0); }, error: (e) => ( window.recordError(new Error(e.responseText)), i(!1) ), }); }) )), (this.renderWeek = (e) => `\n \n ${e .map(this.renderDay) .join("")}\n \n `), (this.renderDay = (e) => e ? e.completed ? this.renderDayComplete(e) : this.renderDayIncomplete(e) : '\n \n \n '), (this.renderDayComplete = (e) => `\n \n ${ e.day }\n
\n ${ e.formattedTime }\n \n `), (this.renderDayIncomplete = (e) => { const t = e.currentGame ? "current-game" : "previous-game"; let n = "btn btn-link disabled", i = "#", o = `${e.day}`; return ( e.playable && ((n = "btn btn-link"), (i = this.getSeedUrl(e.seed, e.currentGame)), (o += '
Play')), `\n \n ${o}\n \n ` ); }), (this.renderSignupMessage = () => this.isLoggedIn ? "" : '\n
\n
\n \n
\n
'), (this.renderCalendarTabs = () => `\n
\n
\n ${Object.entries( this.gameTabs ) .map(([e, t]) => e === this.currentNameSlug ? `` : `` ) .join("")}\n
\n
\n `), (this.renderCalendarSelector = () => `\n
\n
\n \n \n
\n
\n `), (this.getSeedUrl = (e, t) => { var n; const i = null === (n = this.gameTabs[this.currentNameSlug]) || void 0 === n ? void 0 : n.path, o = i ? `${window.location.origin}${i}` : window.location.href, r = new URL(o); return t ? ((r.search = ""), r.searchParams.append("game-of-the-day", "true"), r.href) : ((r.search = ""), r.searchParams.append("seed", e), r.href); }), (this.year = e), (this.month = t), (this.isLoggedIn = o), (this.gameTabs = a || i), (this.currentNameSlug = r || nameSlug), this.fetchData(e, t); } hide() { $("#gotdcalendar-modal").modal("hide"); } show() { $("#gotdcalendar-modal").modal("show"); } getNextMonth() { let e = this.year, t = this.month; 12 === this.month ? ((t = 1), (e += 1)) : (t += 1), this.fetchData(e, t); } getPrevMonth() { let e = this.year, t = this.month; 1 === this.month ? ((t = 12), (e -= 1)) : (t -= 1), this.fetchData(e, t); } getNextYear() { const e = this.year + 1; this.fetchData(e, this.month); } getPrevYear() { const e = this.year - 1; this.fetchData(e, this.month); } showWarning(e) { $("#gotd-calendar-warning").text(e), $("#gotd-calendar-warning").show(); } hideWarning() { $("#gotd-calendar-warning").hide(); } render() { $("#gotdcalendar").empty(); let e = `\n
\n
\n ${this.renderCalendarTabs()}\n
\n
\n
\n ${this.renderCalendarSelector()}\n
\n
\n
\n
\n
\n
\n

${ this.data.month } ${ this.data.year }

\n
\n
\n
\n
\n
\n
\n ${this.renderSignupMessage()}\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n ${this.data.gotdCalendar .map(this.renderWeek) .join( "" )}\n \n
Sun Mon Tue Wed Thu Fri Sat
\n
\n
\n \n
\n
\n
\n `; $("#gotdcalendar").append(e), $("#gotdcalendar-modal").modal("show"); } }; }, 2905: function (e, t, n) { "use strict"; var i = (this && this.__awaiter) || function (e, t, n, i) { return new (n || (n = Promise))(function (o, r) { function a(e) { try { l(i.next(e)); } catch (e) { r(e); } } function s(e) { try { l(i.throw(e)); } catch (e) { r(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((i = i.apply(e, t || [])).next()); }); }; Object.defineProperty(t, "__esModule", { value: !0 }); const o = n(9824), r = "inventories", a = "personal-stats-solitaire-las-vegas-klondike"; t.default = class { constructor(e) { (this.loggedInMoney = null), (this.storageKey = r), (this.isLoggedIn = e), this.isLoggedIn || this.tryMigrateGuestVegasCoins(); } get() { return i(this, void 0, void 0, function* () { return this.isLoggedIn ? this.getAsLoggedIn() : this.getAsGuest(); }); } getAsGuest() { return new Promise((e) => { const t = localStorage.getItem(this.storageKey); if (!t) return e(0); e(parseInt(JSON.parse(t))); }); } getAsLoggedIn() { return null !== this.loggedInMoney ? Promise.resolve(this.loggedInMoney) : new Promise((e) => { $.ajax({ url: `/${this.storageKey}`, type: "GET", success: (t) => { var n; if ("ok" !== t.status) return ( (0, o.recordError)( new Error("failed to fetch from server") ), e(0) ); (this.loggedInMoney = (null === (n = t.data) || void 0 === n ? void 0 : n.coins) || 0), e(this.loggedInMoney); }, error: () => { e(0); }, timeout: 5e3, }); }); } update(e) { return i(this, void 0, void 0, function* () { return this.isLoggedIn ? this.updateAsLoggedIn(e) : this.updateAsGuest(e); }); } updateAsGuest(e) { return i(this, void 0, void 0, function* () { let t = 0; const n = localStorage.getItem(this.storageKey); return ( n && (t = parseInt(n)), (t += e), localStorage.setItem(this.storageKey, t.toString()), t ); }); } updateAsLoggedIn(e) { return i(this, void 0, void 0, function* () { return new Promise((t) => { $.ajax({ type: "POST", url: `/${this.storageKey}`, contentType: "application/json; charset=utf-8", data: JSON.stringify({ coinChange: e }), success: (e) => { var n; "ok" !== e.status && (0, o.recordError)( new Error("failed to update inventory") ), (this.loggedInMoney = (null === (n = e.data) || void 0 === n ? void 0 : n.coins) || 0), t(this.loggedInMoney); }, error: () => { t(0); }, }); }); }); } canUpdate(e) { return i(this, void 0, void 0, function* () { return (yield this.get()) + e >= 0; }); } tryMigrateGuestInventory() { return i(this, void 0, void 0, function* () { const e = yield this.getAsGuest(); (this.isLoggedIn = !0), e && (yield this.updateAsLoggedIn(e), localStorage.removeItem(this.storageKey)); }); } static clearLocalStorage() { localStorage.removeItem(r); } tryMigrateGuestVegasCoins() { const e = localStorage.getItem(a); if (!e) return; const t = JSON.parse(e); t.money && (localStorage.setItem(this.storageKey, t.money), delete t.money, delete t.curGameMoney, localStorage.setItem(a, JSON.stringify(t))); } }; }, 8206: function (e, t, n) { "use strict"; (t.ifMobileTryLngtdRetireAnchor = function () { (0, i.isMobile)() && window.lngtdRetireAnchor && window.lngtdRetireAnchor(); }), (t.ifMobileTryResetAndRunAuction = function () { var e; (0, i.isMobile)() && (null === (e = window.lngtd) || void 0 === e ? void 0 : e.resetAndRunAuction) && window.lngtd.resetAndRunAuction(); }); const i = n(9824); }, 2824: function (e, t, n) { "use strict"; const i = n(6887), o = 12e4, r = ["no-moments-user", "subscriber"]; let a = null, s = { initCalled: {}, label: "" }; const l = []; function d(e, t) { const n = { stepName: e, time: performance.now(), timeStep: null, extras: t, }, i = l.slice(-1)[0]; i && (n.timeStep = n.time - i.time), l.push(n); } const c = (e, t) => { "function" == typeof e ? e(t) : setTimeout(() => { window.location.assign(e); }, 200); }; (s.setLabel = (e) => { s.label = String(e); }), (s.doesRoleHaveMoments = () => !r.includes( null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL ? void 0 : SOLITAIRED_GLOBAL.role )), (s.tryInintMoments = (e, t = "interstitial_video") => { const n = Date.now(); e && n - e > o && s.doesRoleHaveMoments() && s.callLngtd(t); }); let u = !1; (s.tryShowMoments = (e, t, n) => { if ((0, i.shouldSkipMoments)()) return; if (u) return ( t.preventDefault(), (0, i.setSkipMoments)(), d("Moments failed to Show"), recordError(new Error("Moments failed to show"), { momentsSteps: l, }), void setTimeout(() => { window.location.href = t.currentTarget.href; }, 200) ); const r = Date.now(); if ((n || (e && r - e > o)) && s.doesRoleHaveMoments()) { (u = !0), t.preventDefault(); try { const e = $(t.currentTarget), n = t.currentTarget.href || e.data("link"); s.lngtdMoments(n, { html: e.html(), class: e.attr("class") }); } catch (t) { s.loadMoment(t.currentTarget.href); } } }), (s.callLngtd = (e = "default") => { var t, n; if ("reward" === e || !s.initCalled[e]) { s.initCalled[e] = !0; try { null === (n = null === (t = window.lngtd) || void 0 === t ? void 0 : t.initInterstitial) || void 0 === n || n.call(t, e); } catch (t) { recordError(t, { method: "callLngtd", adType: e }); } } }), (s.loadMoment = (e) => { if ( "undefined" == typeof adsbygoogle || !adsbygoogle.loaded || 0 == adsbygoogle.push.length ) return ( gtag("event", "h5-no-load", { event_category: "moments", event_label: s.label, value: 1, }), void c(e) ); gtag("event", "h5-load", { event_category: "moments", event_label: s.label, value: 1, }); try { let t = !1; adBreak({ type: "next", name: "nextGame", beforeAd: () => { d("loadMoment beforeAd", { linkOrCb: e }), gtag("event", "h5-fill", { event_category: "moments", event_label: s.label, value: 1, }), (t = !0); }, afterAd: () => { d("loadMoment afterAd", { linkOrCb: e }), gtag("event", "h5-fill-after", { event_category: "moments", event_label: s.label, value: 1, }); }, adBreakDone: () => { if ((d("loadMoment adBreakDone", { linkOrCb: e }), t)) return ( gtag("event", "h5-passthru", { event_category: "moments", event_label: s.label, value: 1, }), void c(e) ); gtag("event", "h5-no-fill", { event_category: "moments", event_label: s.label, value: 1, }), c(e); }, }); } catch (t) { recordError(t, { method: "loadMoment" }), c(e); } }), (s.loadRewarded = (e, t) => { if ( "undefined" == typeof adsbygoogle || !adsbygoogle.loaded || 0 == adsbygoogle.push.length ) return ( gtag("event", "h5-no-load", { event_category: "rewarded-video", event_label: s.label, value: 1, }), void c(e, !1) ); gtag("event", "h5-load", { event_category: "rewarded-video", event_label: s.label, value: 1, }); try { let n = !1, i = !1; adBreak({ type: "reward", name: "rewarded", beforeAd: () => { gtag("event", "h5-fill", { event_category: "rewarded-video", event_label: s.label, value: 1, }), (i = !0); }, beforeReward: (t) => { gtag("event", "beforeReward", { event_category: "rewarded-video", event_label: s.label, value: 1, }), c(e, t); }, adDismissed: () => { gtag("event", "ad-dismissed", { event_category: "rewarded-video", event_label: s.label, value: 1, }); }, adViewed: () => { gtag("event", "ad-viewed", { event_category: "rewarded-video", event_label: s.label, value: 1, }), (n = !0); }, afterAd: () => { gtag("event", "h5-fill-after", { event_category: "rewarded-video", event_label: s.label, value: 1, }); }, adBreakDone: (o) => i ? n ? (gtag("event", "h5-passthru", { event_category: "rewarded-video", event_label: o.breakStatus, value: 1, }), void c(t, !0)) : void c(t, !1) : (gtag("event", "h5-no-fill", { event_category: "rewarded-video", event_label: o.breakStatus, value: 1, }), void c(e, !1)), }); } catch (e) { console.log(e), c(t, !0); } }), (s.loadLngtdRewarded = (e, t) => { var n, i, o; if ( !(null === (n = window.lngtd) || void 0 === n ? void 0 : n.triggerInterstitial) ) return ( gtag("event", "lngtd-no-load", { event_category: "rewarded-video", event_label: "lngtd", value: 1, }), s.loadRewarded(e, t) ); gtag("event", "h5-load", { event_category: "rewarded-video", event_label: "lngtd", value: 1, }); try { let n = !1; null === (o = null === (i = window.lngtd) || void 0 === i ? void 0 : i.triggerInterstitial) || void 0 === o || o.call( i, { type: "reward", name: "rewarded", minViewTime: 5e3, maxAdBreak: 12e4, rewardText: "Hint in", rewardCloseWarningText: "You will not get your hint.", beforeAd: () => { gtag("event", "h5-fill", { event_category: "rewarded-video", event_label: "lngtd", value: 1, }), (n = !0); }, adDismissed: () => ( gtag("event", "ad-dismissed", { event_category: "rewarded-video", event_label: "lngtd", value: 1, }), c(t, !1) ), adBreakDone: () => n ? (gtag("event", "h5-passthru", { event_category: "rewarded-video", event_label: "lngtd", value: 1, }), c(t, !0)) : (gtag("event", "h5-no-fill", { event_category: "rewarded-video", event_label: "lngtd", value: 1, }), s.loadRewarded(e, t)), }, "reward" ); } catch (e) { console.log(e), c(t, !0); } }), (s.addLngtdRegisterLink = (e) => { if ( !( "function" == typeof e || ((null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL ? void 0 : SOLITAIRED_GLOBAL.role) && ["no-moments-user", "subscriber"].includes( SOLITAIRED_GLOBAL.role )) ) ) try { (document.getElementById("modal-content-close-alt").innerHTML = ''), $("#modal-content-close-alt").show(), $("#momentsRegisterLink").off(), $("#momentsRegisterLink").on("click", function () { var t, n; ( null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL ? void 0 : SOLITAIRED_GLOBAL.loggedInUser ) ? $.post("/user/no-moments-upgrade", {}, function () { c(e); }) : (null === (n = null === (t = window.lngtd) || void 0 === t ? void 0 : t.reset) || void 0 === n || n.call(t), showRegisterModal("role=no-moments-user", e)); }); } catch (t) { console.log(t), c(e); } }), (s.lngtdMoments = (e, t) => { var n, i, o; if ( (e || (d("link or callback undefined", { homeUrl: homeUrl, extraInfo: t, }), recordError(new Error("link or callback undefined"), { homeUrl: homeUrl || "undefined", extraInfo: t, })), s.doesRoleHaveMoments()) ) { if ( !(null === (n = window.lngtd) || void 0 === n ? void 0 : n.triggerInterstitial) ) return ( gtag("event", "lngtd-no-load", { event_category: "lngtd-moments", event_label: "lngtd", value: 1, }), d("triggerInterstitial not found", { homeUrl: homeUrl, extraInfo: t, }), void c(e) ); gtag("event", "lngtd-load", { event_category: "lngtd-moments", event_label: "lngtd", value: 1, }), 0 === $("#loadingModal").length && $("body").append( '\n \n ' ), $("#loadingModal").modal("show"), a && (clearTimeout(a), (a = null)), (a = window.setTimeout(() => { $("#loadingModal").modal("hide"); }, 3e3)); try { s.setUndertoneCloseHandler(e), null === (o = null === (i = window.lngtd) || void 0 === i ? void 0 : i.triggerInterstitial) || void 0 === o || o.call( i, { type: "interstitial", name: "interstitial", minViewTime: 16e3, maxAdBreak: 4e4, altCloseButton: function () { s.addLngtdRegisterLink(e); }, beforeAd: () => { d("lngtdMoments beforeAd", { homeUrl: homeUrl, extraInfo: t, }), gtag("event", "lngtd-fill", { event_category: "lngtd-moments", event_label: "lngtd", value: 1, }); }, adBreakDone: () => { d("lngtdMoments adbreak done", { homeUrl: homeUrl, extraInfo: t, }), gtag("event", "lngtd-passthru", { event_category: "lngtd-moments", event_label: "lngtd", value: 1, }), c(e); }, fallbackFunction: () => { $("#loadingModal").modal("hide"), d("lngtdMoments fallbackFunction", { homeUrl: homeUrl, extraInfo: t, }), s.loadMoment(e); }, }, "default" ); } catch (t) { return ( $("#loadingModal").modal("hide"), recordError(t, { method: "lngtdMoment" }), c(e) ); } } else c(e); }), (s.trackRequireRegistrationActivity = (e) => $.post("/forceRegister/track", e)), (s.setUndertoneCloseHandler = (e) => { window.undertoneCloseCB = () => { gtag("event", "undertone-close", { event_category: "lngtd-moments", event_label: "lngtd", value: 1, }), c(e); }; }), (s.testUndertone = (e) => { var t, n; s.setUndertoneCloseHandler(e), null === (n = null === (t = window.lngtd) || void 0 === t ? void 0 : t.initInterstitial) || void 0 === n || n.call(t, "default"), setTimeout(() => { var e, t; null === (t = null === (e = window.lngtd) || void 0 === e ? void 0 : e.triggerInterstitial) || void 0 === t || t.call( e, { beforeAd: function () { alert("before ad"), console.log("beforeAd"); }, afterAd: function () { console.log("afterAd"), alert("after ad"); }, fallbackFunction: function () { alert("h5 should show here"), console.log("h5 should show here"); }, adBreakDone: function () { alert("ad break done"), console.log("adBreakDone"); }, }, "default" ); }, 2e3); }), (window.testUndertone = s.testUndertone), (t.default = s); }, 6910: function (e, t, n) { "use strict"; var i = (this && this.__awaiter) || function (e, t, n, i) { return new (n || (n = Promise))(function (o, r) { function a(e) { try { l(i.next(e)); } catch (e) { r(e); } } function s(e) { try { l(i.throw(e)); } catch (e) { r(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((i = i.apply(e, t || [])).next()); }); }; Object.defineProperty(t, "__esModule", { value: !0 }), (t.PersonalStats = void 0); const o = n(9824); class r { constructor(e, t, n) { (this.initialFetchFailed = !1), (this.storageKey = t), (this.defaultState = n), (this.shouldSaveToServer = e), this.shouldSaveToServer ? (this.initialServerFetchPromise = this.fetchFromServer()) : (this.initialServerFetchPromise = Promise.resolve()); } cloneStat() { return JSON.parse(JSON.stringify(this.defaultState)); } getStats() { return i(this, void 0, void 0, function* () { return this.initialServerFetchPromise.then(() => { try { const e = localStorage.getItem(this.storageKey); if (!e) return this.cloneStat(); const t = JSON.parse(e); return Object.assign(Object.assign({}, this.defaultState), t); } catch (e) { return console.log(e), this.cloneStat(); } }); }); } saveStats(e, t) { return i(this, void 0, void 0, function* () { const n = this.setLocalState(e); if (this.shouldSaveToServer) return this.saveToServer(n, t); }); } setLocalState(e) { const t = Object.assign(Object.assign({}, this.defaultState), e); try { const e = JSON.stringify(t); return localStorage.setItem(this.storageKey, e), JSON.parse(e); } catch (e) { (0, o.recordError)(e); } return t; } saveToServer(e, t) { return new Promise((n) => { if (this.initialFetchFailed) return n(); const i = t ? "?reset=true" : ""; $.ajax({ type: "POST", url: `/personal-stats/${this.storageKey}${i}`, contentType: "application/json; charset=utf-8", data: JSON.stringify(e), complete: () => { n(); }, }); }); } fetchFromServer() { return i(this, void 0, void 0, function* () { return new Promise((e) => { $.ajax({ url: `/personal-stats/${this.storageKey}`, type: "GET", success: (t) => { if ( ("ok" !== t.status && ((this.initialFetchFailed = !0), (0, o.recordError)( new Error(`error saving ${this.storageKey}`) )), t.data) ) { const e = t.data; this.setLocalState(e); } else this.setLocalState(this.defaultState); e(); }, error: () => { (this.initialFetchFailed = !0), this.setLocalState(this.defaultState), e(); }, timeout: 5e3, }); }); }); } isEmpty() { try { return !localStorage.getItem(this.storageKey); } catch (e) { console.log(e); } return !1; } static getLocalStorageKeys() { const e = []; try { for (let t = 0; t < localStorage.length; t++) { const n = localStorage.key(t); (this.PERSONAL_STATS_KEYS.includes(n) || n.startsWith(this.PERSONAL_STATS_KEY_PREFIX)) && e.push(n); } } catch (e) { (0, o.recordError)(e); } return e; } static clearLocalStorage() { try { this.getLocalStorageKeys().forEach((e) => localStorage.removeItem(e) ); } catch (e) { (0, o.recordError)(e); } } static saveAllToServer() { try { const e = this.getLocalStorageKeys(); let t = [Promise.resolve()]; return ( e.forEach((e) => { const n = JSON.parse(localStorage.getItem(e)), i = new Promise((t) => { $.ajax({ type: "POST", url: `/personal-stats/${e}`, contentType: "application/json; charset=utf-8", data: JSON.stringify(n), complete: t, error: t, }); }); t.push(i); }), Promise.all(t) ); } catch (e) { (0, o.recordError)(e); } } } (t.PersonalStats = r), (r.PERSONAL_STATS_KEYS = ["yahtzee"]), (r.PERSONAL_STATS_KEY_PREFIX = "personal-stats-"); }, 6771: function (e, t, n) { "use strict"; var i = (this && this.__awaiter) || function (e, t, n, i) { return new (n || (n = Promise))(function (o, r) { function a(e) { try { l(i.next(e)); } catch (e) { r(e); } } function s(e) { try { l(i.throw(e)); } catch (e) { r(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((i = i.apply(e, t || [])).next()); }); }; Object.defineProperty(t, "__esModule", { value: !0 }); const o = n(9321), r = n(9824), a = (0, o.UAParser)().withFeatureCheck(), s = { show: () => { $("#research-study-modal").modal("show"); }, hide: () => { $("#research-study-modal").modal("hide"); }, prompt: () => { $("#research-study-modal").modal("show"), $("#research-study-modal") .find(".modal-title") .text("You're Invited!"), $("#research-study-modal") .find(".modal-body") .html( '\n

As a valued user, you\'re invited to join a study to see if playing Solitaire boosts mental sharpness, potentially influencing new features at www.solitaire.ltd.

\n

Click Yes to participate, No otherwise.

\n \n \n ' ), $("#research-study-prompt-accept").on("click", () => i(void 0, void 0, void 0, function* () { yield s.qualifyForQuestionnaire(); }) ), $("#research-study-prompt-decline").on("click", () => i(void 0, void 0, void 0, function* () { yield s.decline(); }) ); }, questionnaire: () => { $("#research-study-modal").modal("show"), $("#research-study-modal") .find(".modal-title") .text("Research Study Questionnaire"), $("#research-study-modal") .find(".modal-body") .html( '\n

Please answer the following questions to participate in the mental acuity test.

\n
\n \n \n \n \n \n \n
\n\n \n \n ' ), $("#research-study-questionnaire-accept").on("click", () => i(void 0, void 0, void 0, function* () { const e = $("#research-study-age-question").val(), t = $("#research-study-gender-question").val(), n = $( "#research-study-cognitive-impairment-question" ).val(); if (!(e && t && n)) return ( $("#research-study-question-instructions").text( "Please answer all questions to participate in the mental acuity test." ), $("#research-study-question-instructions").addClass( "text-danger" ), void setTimeout(() => { $( "#research-study-question-instructions" ).removeClass("text-danger"); }, 2e3) ); yield s.qualifyForTest({ age: e, gender: t, cognitiveImpairment: n, }); }) ), $("#research-study-questionnaire-decline").on("click", () => i(void 0, void 0, void 0, function* () { yield s.decline(); }) ); }, promptTest: (e) => { $("#research-study-modal").modal("show"), $("#research-study-modal") .find(".modal-title") .text("Mental Acuity Test"), $("#research-study-modal") .find(".modal-body") .html( `\n

You've qualified for the mental acuity test. Click the button below to start the test.

\n Start Test\n \n ` ), $("#research-study-test-accept").on("click", () => i(void 0, void 0, void 0, function* () { yield s.qualifyForCompletion(); }) ), $("#research-study-test-decline").on("click", () => i(void 0, void 0, void 0, function* () { yield s.decline(); }) ); }, promptEmail: () => { $("#research-study-modal").modal("show"), $("#research-study-modal") .find(".modal-title") .text("You're Invited!"), $("#research-study-modal") .find(".modal-body") .html( '\n

Because you won our Game of the Day, you\'re invited to join a study to see if playing Solitaire boosts mental sharpness, potentially influencing new features at www.solitaire.ltd.

\n

Please provide your email to participate in the study.

\n
\n \n \n \n
\n \n \n ' ), $("#research-study-email-accept").on("click", () => { const e = { email: $("#research-study-email").val(), newsletter: "", generatePassword: !0, }; $.post("/user/register", e, function (e) { return i(this, void 0, void 0, function* () { if ("error" == e.status) { let t = e.message; "duplicate email" == e.message && (t = 'An account with that email already exists. Please login.'), $("#emailHelp").html(t), $("#emailHelp > .registerToLogin").one( "click", () => { $("#research-study-modal").modal("hide"); } ); } else { yield window.finishRegistration(), gtag("event", "survey-sign-up", { event_category: "registration", event_label: "sign-up", value: 1, }); let e = yield s.fetchData(); (e.data.newRegistrationUser = !0), (SOLITAIRED_GLOBAL.loggedInUser = !0), yield s.updateData(e), yield s.qualifyForQuestionnaire(); } }); }); }), $("#research-study-email-decline").on("click", () => i(void 0, void 0, void 0, function* () { yield s.decline(); }) ); }, congrats: () => { $("#research-study-modal").modal("show"), $("#research-study-modal") .find(".modal-title") .text("Congratulations!"), $("#research-study-modal") .find(".modal-body") .html( "\n

Thank you for participating in the mental acuity test. You've completed the test and we appreciate your time and effort. We will be in touch with the results of the study.

\n

You will be redirected to the homepage shortly.

\n " ), setTimeout(() => { window.location.href = "/"; }, 7e3); }, qualifyForGeo: (e) => i(void 0, void 0, void 0, function* () { var t, n; let i = yield s.fetchData(); if (!(null == i ? void 0 : i.data)) { const o = { user: { country: SOLITAIRED_GLOBAL.country, postal: SOLITAIRED_GLOBAL.postal, deviceType: null === (n = null === (t = yield Promise.resolve(a)) || void 0 === t ? void 0 : t.device) || void 0 === n ? void 0 : n.type, width: $(window).width(), height: $(window).height(), maxTouchPoints: null === navigator || void 0 === navigator ? void 0 : navigator.maxTouchPoints, autoplay: $(".disable-autoplay").length > 0, hotkeys: $(".hotkeys-toggle-off").length > 0, }, }; i = yield s.updateData({ status: "geo", game_id: e, data: o, }); } }), qualifyForStudy: () => i(void 0, void 0, void 0, function* () { var e; let t = yield s.fetchData(); return (null == t ? void 0 : t.data) ? ("geo" === t.status || "qualified" === t.status || "started" === t.status || "questionnaire" === t.status) && ((t.status = "qualified"), (t = yield s.updateData(t)), null === (e = window.tsRecordEvent) || void 0 === e || e.call( window, "research-study", "qualify-for-study", 1 ), SOLITAIRED_GLOBAL.loggedInUser ? s.prompt() : s.promptEmail(), !0) : (recordError( new Error("failed to find research study data") ), !1); }), qualifyForQuestionnaire: () => i(void 0, void 0, void 0, function* () { let e = yield s.fetchData(); (null == e ? void 0 : e.data) ? ((e.status = "started"), (e = yield s.updateData(e)), s.questionnaire()) : recordError( new Error("failed to find research study data") ); }), qualifyForTest: (e) => i(void 0, void 0, void 0, function* () { var t, n; let i = yield s.fetchData(); if (!(null == i ? void 0 : i.data)) return void recordError( new Error("failed to find research study data") ); (i.status = "questionnaire"), (i.data.questionnaireData = e), (i = yield s.updateData(i)); const o = i.user_id.toString(16), l = "mobile" === (null === (n = null === (t = yield Promise.resolve(a)) || void 0 === t ? void 0 : t.device) || void 0 === n ? void 0 : n.type) ? 2 : 1, d = (0, r.isLocalEnv)() || (0, r.isStagingEnv)() ? `https://studies.testmybrain.org/solitairecog_staging/?study=solitairecog&id=${o}&group=${l}` : `https://studies.testmybrain.org/solitairecog/?study=solitairecog&id=${o}&group=${l}`; s.promptTest(d); }), qualifyForCompletion: () => i(void 0, void 0, void 0, function* () { let e = yield s.fetchData(); (null == e ? void 0 : e.data) ? ((e.status = "tmb_started"), (e = yield s.updateData(e)), s.hide()) : recordError( new Error("failed to find research study data") ); }), complete: (e) => i(void 0, void 0, void 0, function* () { let t; if (e) return (t = yield s.completeData(e)), void s.congrats(); (t = yield s.fetchData()), (null == t ? void 0 : t.data) ? ((t.status = "completed"), (t = yield s.updateData(t)), s.congrats()) : recordError( new Error("failed to find research study data") ); }), decline: () => i(void 0, void 0, void 0, function* () { let e = yield s.fetchData(); (null == e ? void 0 : e.data) ? ((e.status = "declined"), (e = yield s.updateData(e)), s.hide()) : recordError( new Error("failed to find research study data") ); }), fetchData: () => i(void 0, void 0, void 0, function* () { return yield new Promise((e) => { if (!SOLITAIRED_GLOBAL.loggedInUser) { let t; try { return ( (t = localStorage.getItem("researchStudyData")), (t = JSON.parse(t)), e(t) ); } catch (t) { return e(null); } } $.ajax({ type: "GET", url: "/research-study", contentType: "application/json; charset=utf-8", success: (t) => { "ok" !== t.status && recordError( new Error("failed to fetch research study data") ), e(null == t ? void 0 : t.data); }, error: () => { e(null); }, }); }); }), updateData: (e) => i(void 0, void 0, void 0, function* () { return yield new Promise((t) => { if (!SOLITAIRED_GLOBAL.loggedInUser) try { return ( localStorage.setItem( "researchStudyData", JSON.stringify(e) ), t(e) ); } catch (e) { return t(null); } $.ajax({ type: "POST", url: "/research-study/update", contentType: "application/json; charset=utf-8", data: JSON.stringify(e), success: (e) => { "ok" !== e.status && recordError( new Error("failed to update research study data") ), t(null == e ? void 0 : e.data); }, error: () => { t(null); }, }); }); }), completeData: (e) => i(void 0, void 0, void 0, function* () { return yield new Promise((t) => { $.ajax({ type: "POST", url: "/research-study/complete", contentType: "application/json; charset=utf-8", data: JSON.stringify({ userId: e }), success: (e) => { "ok" !== e.status && recordError( new Error("failed to complete research study") ), t(null == e ? void 0 : e.data); }, error: () => { t(null); }, }); }); }), listenTestRedirect: () => i(void 0, void 0, void 0, function* () { if ("/study-thanks" === window.location.pathname) { if (SOLITAIRED_GLOBAL.loggedInUser) return yield s.complete(); let e = new URLSearchParams(window.location.search).get("id"); e || (window.location.href = "/"); try { const t = parseInt(e, 16); yield s.complete(t); } catch (e) { window.location.href = "/"; } } }), }; t.default = s; }, 9824: function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), (t.isLocalEnv = function () { var e, t; return ( "localhost" === (null === (e = null === window || void 0 === window ? void 0 : window.location) || void 0 === e ? void 0 : e.hostname) || "local.solitaire.ltd" === (null === (t = null === window || void 0 === window ? void 0 : window.location) || void 0 === t ? void 0 : t.hostname) ); }), (t.isDebug = r), (t.isStagingEnv = function () { var e; return ( "dev.solitaire.ltd" === (null === (e = null === window || void 0 === window ? void 0 : window.location) || void 0 === e ? void 0 : e.hostname) ); }), (t.getDisplayUsername = function (e, t, n) { var i; if ( (null === (i = window.SOLITAIRED_GLOBAL) || void 0 === i ? void 0 : i.username) == e ) return e; if (n) { let e = `user-${t}`; return e.length > 15 && (e = e.substring(0, 12) + "..."), e; } return e; }), (t.tryGetValueFromLocalStorage = a), (t.tryClearValueFromLocalStorage = function (e) { try { return localStorage.removeItem(e); } catch (e) { console.log(e); } }), (t.trySetValueInLocalStorage = function (e, t) { try { localStorage.setItem(e, t); } catch (e) { console.log(e); } }), (t.timeUntilMidnightUTC = function () { const e = new Date(), t = new Date( e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate() + 1, 0, 0, 0 ).getTime() - e.getTime(); return new Date(t).toISOString().substr(11, 8); }), (t.onIdle = function (e, t) { let n; e = e || 3e4; const i = () => { clearTimeout(n), (n = setTimeout(() => { t(); }, e)); }, r = o(i, 1e3, { leading: !0, maxWait: 1e3, trailing: !1 }); $(() => { r(), $(document).on("mousemove", r), $(document).on("keypress", i), $(document).on("mousedown", i), $(document).on("touchstart", i), $(document).on("touchmove", r); }); }), (t.getCurrentDate = function () { const e = new Date(); return e.setHours(0, 0, 0, 0), e; }), (t.getDaysDiff = function (e, t) { return Math.floor((t.getTime() - e.getTime()) / 864e5); }), (t.convertCardToSymbolText = function (e) { let t = (e = "string" == typeof e ? e : e.name).split("_"); return `${ s[t[0]] }${l[t[1]]}`; }), (t.getQueryStringValue = function (e) { console.log(new URLSearchParams(window.location.search).get(e)); return new URLSearchParams(window.location.search).get(e); }), (t.postWithRetry = function (e, t, n, i) { let o = 0; return $.post({ url: e, data: t, success: function (n) { o > 0 && g(new Error("request succeeded on retry"), { url: e, data: t, attemptCount: o, }), i(n); }, error: function (i, r, a) { o++, o <= n ? setTimeout(() => { $.ajax(this); }, 2e3) : g(new Error(`POST to ${e} failed`), { textStatus: r, status: i.status, data: t, errorThrown: a, }); }, }); }), (t.getDisplayTime = function (e) { return `${`00${Math.floor(e / 60)}`.slice(-2)}:${( "00" + (e % 60) ).slice(-2)}`; }), (t.checkTestBucket = function (e, t) { return ( !!( "undefined" != typeof abTest && abTest.run && abTest.name && abTest.name.length > 0 ) && ("number" != typeof t ? e === abTest.name : e === abTest.name && t === abTest.bucket) ); }), (t.modalOnScreen = function () { return $(".modal, #congrats") .toArray() .some((e) => "none" != window.getComputedStyle(e).display); }), (t.bodyHasFocus = function () { return document.activeElement == document.body; }), (t.preventAccidentalNavigation = function (e) { c || a("disablePreventAccidentalNav") || ($("#canvas").length > 0 && $("#canvas")[0].addEventListener("touchstart", (e) => { if ( (e.preventDefault(), "undefined" != typeof shownAd1 && !1 === shownAd1 && "undefined" != typeof waitToShowAd) ) try { waitToShowAd(); } catch (e) { console.log("ad error occurred.", e); } }), $("#timerContainer").length > 0 && $("#timerContainer")[0].addEventListener("touchstart", (e) => { if (!e.target) return; let t = e.target; ["timerContainer", "gameMenuCol", "gameName"].includes( t.id ) && e.preventDefault(); }), $(document).on( "click", "#newGameDropdown a, .nav-item a, .skip-prevent-accidental-nav", function () { (0, i.deleteStoredGameState)(), (u = !0); } ), $(document).on("click", ".turn-btns a", function () { (0, i.deleteStoredGameState)(); }), window.addEventListener("beforeunload", function (t) { !e.gameStarted || e.gameWon || u || (t.preventDefault(), (t.returnValue = ""), (0, i.deleteStoredGameState)(), (window.unloadPrevented = !0)); }), (c = !0)); }), (t.isSubscriber = function () { var e; return ( "subscriber" == (null === (e = window.SOLITAIRED_GLOBAL) || void 0 === e ? void 0 : e.role) ); }), (t.sendDebugReport = function (e, t) { if (!p) try { const n = (function () { if (!window.consoleErrors) return []; try { return window.consoleErrors.filter((e) => e[0].includes("javascripts/dist") ); } catch (e) { return console.log(e), ["Error parsing errors"]; } })(); $.post("/debug", { game: e, payload: t, errors: n, abTest: abTest, }), (p = !0); } catch (e) { g(e); } }), (t.isMobile = function () { return window.innerWidth < 450; }), (t.recordError = g), (t.randomInRange = function (e, t) { return Math.random() * (t - e) + e; }), (t.enterFullScreen = function (e) { e.requestFullscreen ? e.requestFullscreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen() : e.msRequestFullscreen && e.msRequestFullscreen(), window.setTimeout(function () { $(window).resize(); }, 100); }), (t.exitFullScreen = function () { if (document.fullscreenElement) try { const e = document; e.exitFullscreen ? e.exitFullscreen() : e.webkitExitFullscreen ? e.webkitExitFullscreen() : e.msExitFullscreen && e.msExitFullscreen(), window.setTimeout(function () { $(window).resize(); }, 100); } catch (e) { window.recordError(e); } }), (t.createMobileCard = function (e, t) { return `/images/style-classic-mobile/${e}_${t}.png`; }), (t.getBackRedCard = function () { return "/images/style-classic-mobile/back_red.png"; }), (t.debugLog = function (...e) { r() && console.log(...e); }); const i = n(6429); var o = n(7967); function r() { return null === window || void 0 === window ? void 0 : window.location.href.includes("debug=true"); } function a(e) { try { return localStorage.getItem(e); } catch (e) { console.log(e); } return null; } const s = { heart: "♥", diamond: "♦", club: "♣", spade: "♠", }, l = { 1: "A", 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: "J", 12: "Q", 13: "K", }, d = { heart: "#ff0000", diamond: "#ff0000", club: "#000000", spade: "#000000", }; let c = !1, u = !1, p = !1, h = 0; function g(e, t = {}) { try { consoleErrors.push([e.message, e.stack]), h < 5 && !e.message.includes("ima is not a function") && ($.post("/stream/record-error", { eventMessage: e.message, errorMessage: e.message, stackStrace: e.stack, extras: t, }), h++); } catch (e) { console.log("recordError error", e); } } }, 867: function (e, t) { "use strict"; var n, i; Object.defineProperty(t, "__esModule", { value: !0 }), "undefined" != typeof gsap && (gsap.ticker.lagSmoothing(1 / 0), location.href.indexOf("showDeltaRatio=true") > -1 && gsap.ticker.add(function () { console.log("FPS delay ratio: " + gsap.ticker.deltaRatio()); })); let o = { dispatch: (e) => { setTimeout(() => { window.dispatchEvent(e); }, 0); }, finishGameEvent: new Event("gameVars.finishGameEvent"), images_canvas: {}, waterfallRunning: !1, globalWindow: {}, }; (o.imagesLoaded = new Event("gameVars.imagesLoaded")), (o.congratsNextCardEvent = new Event( "gameVars.congratsNextCardEvent" )), (o.animateDeal = new Event("gameVars.animateDeal")), (o.dealAnimationFinished = new Event( "gameVars.dealAnimationFinished" )), (o.dropCompleted = new Event("gameVars.dropCompleted")), (o.triggerNextUndo = new Event("gameVars.triggerNextUndo")), (o.gameWonEvent = new Event("gameVars.gameWonEvent")), (o.isNewGame = !0), o.clickStart, (o.clickType = ""), o.cardWidth, o.cardHeight, o.cardSpacing, o.cardStep, (o.cardXOffset = 0), o.moveCounter, o.cardsSprite, (o.flashMessage = ""), (o.gameStarted = !1), (o.isRestoredGame = !1), (o.previousMoves = []), (o.defaultCardFactors = { spacing: 0.03, width: 0.69, height: "undefined" == typeof factorHeight ? 1.45 : factorHeight, stepMax: 0.175, }), (o.cardFactors = Object.assign({}, o.defaultCardFactors)), (o.float = []), (o.flip = []), (o.fromSet = {}), (o.turns = 0), (o.passthroughs = 0), (o.stockCount = 0), (o.gameWon = !1), (o.lock = {}), (o.softLock = {}), (o.images = {}), (o.canvas = document.getElementById("canvas")), (o.contextOptions = {}), !0 === (null === (n = null === window || void 0 === window ? void 0 : window.SOLITAIRED_GLOBAL) || void 0 === n ? void 0 : n.willReadFrequently) && (o.contextOptions.willReadFrequently = !0), (o.ctx = null === (i = o.canvas) || void 0 === i ? void 0 : i.getContext("2d", o.contextOptions)), "string" == typeof seed && "string" == typeof nameSlug && (o.storageKey = `moves-${nameSlug}`), (o.getDeltaRatioDuration = (e) => gsap.ticker.deltaRatio() > 3 ? 0.01 : e), (o.getCleanCards = () => { let e = []; for (let t of o.allAreas) for (let n of t.piles) for (let t of n) { const n = `${t.name}_h:${+t.hide}`; e.push(n); } return e; }), (o.getCanvasInfo = () => Object.keys(o.images_canvas).reduce((e, t) => { const n = o.images_canvas[t], i = n.getContext("2d"); return i ? (i.getImageData(n.width / 3, n.height / 2, 1, 1).data[3] > 0 || e.push(`[${t}: canvas is blank] `), e) : (e.push(`[${t}: ctx is null] `), e); }, [])), (o.getAllCards = () => { let e = []; e.push(o.float); for (let t = 0; t < o.allAreas.length; t++) e.push(o.allAreas[t].piles); return e; }), (t.default = o), (window.getCleanCards = o.getCleanCards), (window.getCanvasInfo = o.getCanvasInfo), (window.getLocks = function () { return JSON.stringify(o.lock); }), (window.getClickType = function () { return o.clickType; }); }, 9321: function (e, t, n) { var i; !(function (o, r) { "use strict"; var a, s = "", l = "function", d = "undefined", c = "object", u = "string", p = "major", h = "model", g = "name", m = "type", f = "vendor", v = "version", w = "architecture", b = "console", y = "mobile", k = "tablet", x = "smarttv", S = "wearable", _ = "xr", I = "embedded", $ = "inapp", A = "user-agent", O = "brands", T = "formFactors", C = "fullVersionList", E = "platform", L = "platformVersion", P = "bitness", R = "sec-ch-ua", M = R + "-full-version-list", D = R + "-arch", j = R + "-" + P, U = R + "-form-factors", F = R + "-" + y, q = R + "-" + h, B = R + "-" + E, N = B + "-version", G = [O, C, y, h, E, L, w, T, P], z = "browser", H = "cpu", W = "device", V = "engine", Q = "os", J = "result", K = "Amazon", Y = "Apple", X = "ASUS", Z = "BlackBerry", ee = "Google", te = "Huawei", ne = "Lenovo", ie = "LG", oe = "Microsoft", re = "Motorola", ae = "Samsung", se = "Sharp", le = "Sony", de = "Xiaomi", ce = "Zebra", ue = "Mobile ", pe = " Browser", he = "Chrome", ge = "Chromecast", me = "Firefox", fe = "Opera", ve = "Facebook", we = "Sogou", be = "Windows", ye = typeof o !== d, ke = ye && o.navigator ? o.navigator : r, xe = ke && ke.userAgentData ? ke.userAgentData : r, Se = function (e) { for (var t = {}, n = 0; n < e.length; n++) t[e[n].toUpperCase()] = e[n]; return t; }, _e = function (e, t) { if (typeof e === c && e.length > 0) { for (var n in e) if (Oe(e[n]) == Oe(t)) return !0; return !1; } return !!$e(e) && -1 !== Oe(t).indexOf(Oe(e)); }, Ie = function (e, t) { for (var n in e) return ( /^(browser|cpu|device|engine|os)$/.test(n) || (!!t && Ie(e[n])) ); }, $e = function (e) { return typeof e === u; }, Ae = function (e) { if (!e) return r; for ( var t = [], n = Ee(/\\?\"/g, e).split(","), i = 0; i < n.length; i++ ) if (n[i].indexOf(";") > -1) { var o = Pe(n[i]).split(";v="); t[i] = { brand: o[0], version: o[1] }; } else t[i] = Pe(n[i]); return t; }, Oe = function (e) { return $e(e) ? e.toLowerCase() : e; }, Te = function (e) { return $e(e) ? Ee(/[^\d\.]/g, e).split(".")[0] : r; }, Ce = function (e) { for (var t in e) { var n = e[t]; typeof n == c && 2 == n.length ? (this[n[0]] = n[1]) : (this[n] = r); } return this; }, Ee = function (e, t) { return $e(t) ? t.replace(e, s) : t; }, Le = function (e) { return Ee(/\\?\"/g, e); }, Pe = function (e, t) { if ($e(e)) return ( (e = Ee(/^\s\s*/, e)), typeof t === d ? e : e.substring(0, 500) ); }, Re = function (e, t) { if (e && t) for (var n, i, o, a, s, d, u = 0; u < t.length && !s; ) { var p = t[u], h = t[u + 1]; for (n = i = 0; n < p.length && !s && p[n]; ) if ((s = p[n++].exec(e))) for (o = 0; o < h.length; o++) (d = s[++i]), typeof (a = h[o]) === c && a.length > 0 ? 2 === a.length ? typeof a[1] == l ? (this[a[0]] = a[1].call(this, d)) : (this[a[0]] = a[1]) : 3 === a.length ? typeof a[1] !== l || (a[1].exec && a[1].test) ? (this[a[0]] = d ? d.replace(a[1], a[2]) : r) : (this[a[0]] = d ? a[1].call(this, d, a[2]) : r) : 4 === a.length && (this[a[0]] = d ? a[3].call(this, d.replace(a[1], a[2])) : r) : (this[a] = d || r); u += 2; } }, Me = function (e, t) { for (var n in t) if (typeof t[n] === c && t[n].length > 0) { for (var i = 0; i < t[n].length; i++) if (_e(t[n][i], e)) return "?" === n ? r : n; } else if (_e(t[n], e)) return "?" === n ? r : n; return t.hasOwnProperty("*") ? t["*"] : e; }, De = { ME: "4.90", "NT 3.11": "NT3.51", "NT 4.0": "NT4.0", 2e3: "NT 5.0", XP: ["NT 5.1", "NT 5.2"], Vista: "NT 6.0", 7: "NT 6.1", 8: "NT 6.2", 8.1: "NT 6.3", 10: ["NT 6.4", "NT 10.0"], RT: "ARM", }, je = { embedded: "Automotive", mobile: "Mobile", tablet: ["Tablet", "EInk"], smarttv: "TV", wearable: "Watch", xr: ["VR", "XR"], "?": ["Desktop", "Unknown"], "*": r, }, Ue = { browser: [ [/\b(?:crmo|crios)\/([\w\.]+)/i], [v, [g, ue + "Chrome"]], [/edg(?:e|ios|a)?\/([\w\.]+)/i], [v, [g, "Edge"]], [ /(opera mini)\/([-\w\.]+)/i, /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i, ], [g, v], [/opios[\/ ]+([\w\.]+)/i], [v, [g, fe + " Mini"]], [/\bop(?:rg)?x\/([\w\.]+)/i], [v, [g, fe + " GX"]], [/\bopr\/([\w\.]+)/i], [v, [g, fe]], [/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i], [v, [g, "Baidu"]], [/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i], [v, [g, "Maxthon"]], [ /(kindle)\/([\w\.]+)/i, /(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i, /(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, /(?:ms|\()(ie) ([\w\.]+)/i, /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i, /(heytap|ovi|115)browser\/([\d\.]+)/i, /(weibo)__([\d\.]+)/i, ], [g, v], [/quark(?:pc)?\/([-\w\.]+)/i], [v, [g, "Quark"]], [/\bddg\/([\w\.]+)/i], [v, [g, "DuckDuckGo"]], [/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i], [v, [g, "UCBrowser"]], [ /microm.+\bqbcore\/([\w\.]+)/i, /\bqbcore\/([\w\.]+).+microm/i, /micromessenger\/([\w\.]+)/i, ], [v, [g, "WeChat"]], [/konqueror\/([\w\.]+)/i], [v, [g, "Konqueror"]], [/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i], [v, [g, "IE"]], [/ya(?:search)?browser\/([\w\.]+)/i], [v, [g, "Yandex"]], [/slbrowser\/([\w\.]+)/i], [v, [g, "Smart " + ne + pe]], [/(avast|avg)\/([\w\.]+)/i], [[g, /(.+)/, "$1 Secure" + pe], v], [/\bfocus\/([\w\.]+)/i], [v, [g, me + " Focus"]], [/\bopt\/([\w\.]+)/i], [v, [g, fe + " Touch"]], [/coc_coc\w+\/([\w\.]+)/i], [v, [g, "Coc Coc"]], [/dolfin\/([\w\.]+)/i], [v, [g, "Dolphin"]], [/coast\/([\w\.]+)/i], [v, [g, fe + " Coast"]], [/miuibrowser\/([\w\.]+)/i], [v, [g, "MIUI" + pe]], [/fxios\/([\w\.-]+)/i], [v, [g, ue + me]], [/\bqihoobrowser\/?([\w\.]*)/i], [v, [g, "360"]], [/\b(qq)\/([\w\.]+)/i], [[g, /(.+)/, "$1Browser"], v], [/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i], [[g, /(.+)/, "$1" + pe], v], [/samsungbrowser\/([\w\.]+)/i], [v, [g, ae + " Internet"]], [/metasr[\/ ]?([\d\.]+)/i], [v, [g, we + " Explorer"]], [/(sogou)mo\w+\/([\d\.]+)/i], [[g, we + " Mobile"], v], [ /(electron)\/([\w\.]+) safari/i, /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i, ], [g, v], [/(lbbrowser|rekonq)/i], [g], [ /ome\/([\w\.]+) \w* ?(iron) saf/i, /ome\/([\w\.]+).+qihu (360)[es]e/i, ], [v, g], [/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i], [[g, ve], v, [m, $]], [ /(Klarna)\/([\w\.]+)/i, /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, /safari (line)\/([\w\.]+)/i, /\b(line)\/([\w\.]+)\/iab/i, /(alipay)client\/([\w\.]+)/i, /(twitter)(?:and| f.+e\/([\w\.]+))/i, /(instagram|snapchat)[\/ ]([-\w\.]+)/i, ], [g, v, [m, $]], [/\bgsa\/([\w\.]+) .*safari\//i], [v, [g, "GSA"], [m, $]], [/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i], [v, [g, "TikTok"], [m, $]], [/\[(linkedin)app\]/i], [g, [m, $]], [/(chromium)[\/ ]([-\w\.]+)/i], [g, v], [/headlesschrome(?:\/([\w\.]+)| )/i], [v, [g, he + " Headless"]], [/ wv\).+(chrome)\/([\w\.]+)/i], [[g, he + " WebView"], v], [/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i], [v, [g, "Android" + pe]], [/chrome\/([\w\.]+) mobile/i], [v, [g, ue + "Chrome"]], [/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i], [g, v], [/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i], [v, [g, ue + "Safari"]], [/iphone .*mobile(?:\/\w+ | ?)safari/i], [[g, ue + "Safari"]], [/version\/([\w\.\,]+) .*(safari)/i], [v, g], [/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i], [g, [v, "1"]], [/(webkit|khtml)\/([\w\.]+)/i], [g, v], [/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i], [[g, ue + me], v], [/(navigator|netscape\d?)\/([-\w\.]+)/i], [[g, "Netscape"], v], [/(wolvic|librewolf)\/([\w\.]+)/i], [g, v], [/mobile vr; rv:([\w\.]+)\).+firefox/i], [v, [g, me + " Reality"]], [ /ekiohf.+(flow)\/([\w\.]+)/i, /(swiftfox)/i, /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i, /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i, /(firefox)\/([\w\.]+)/i, /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, /\b(links) \(([\w\.]+)/i, ], [g, [v, /_/g, "."]], [/(cobalt)\/([\w\.]+)/i], [g, [v, /[^\d\.]+./, s]], ], cpu: [ [/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i], [[w, "amd64"]], [/(ia32(?=;))/i, /((?:i[346]|x)86)[;\)]/i], [[w, "ia32"]], [/\b(aarch64|arm(v?8e?l?|_?64))\b/i], [[w, "arm64"]], [/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i], [[w, "armhf"]], [/windows (ce|mobile); ppc;/i], [[w, "arm"]], [/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i], [[w, /ower/, s, Oe]], [/(sun4\w)[;\)]/i], [[w, "sparc"]], [ /((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i, ], [[w, Oe]], ], device: [ [ /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i, ], [h, [f, ae], [m, k]], [ /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, /samsung[- ]((?!sm-[lr])[-\w]+)/i, /sec-(sgh\w+)/i, ], [h, [f, ae], [m, y]], [/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i], [h, [f, Y], [m, y]], [ /\((ipad);[-\w\),; ]+apple/i, /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i, ], [h, [f, Y], [m, k]], [/(macintosh);/i], [h, [f, Y]], [/\b(sh-?[altvz]?\d\d[a-ekm]?)/i], [h, [f, se], [m, y]], [/(?:honor)([-\w ]+)[;\)]/i], [h, [f, "Honor"], [m, y]], [/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i], [h, [f, te], [m, k]], [ /(?:huawei)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i, ], [h, [f, te], [m, y]], [ /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, /\b; (\w+) build\/hm\1/i, /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i, ], [ [h, /_/g, " "], [f, de], [m, y], ], [ /oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, /\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i, ], [ [h, /_/g, " "], [f, de], [m, k], ], [ /; (\w+) bui.+ oppo/i, /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i, ], [h, [f, "OPPO"], [m, y]], [/\b(opd2\d{3}a?) bui/i], [h, [f, "OPPO"], [m, k]], [/vivo (\w+)(?: bui|\))/i, /\b(v[12]\d{3}\w?[at])(?: bui|;)/i], [h, [f, "Vivo"], [m, y]], [/\b(rmx[1-3]\d{3})(?: bui|;|\))/i], [h, [f, "Realme"], [m, y]], [ /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i, /\bmot(?:orola)?[- ](\w*)/i, /((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i, ], [h, [f, re], [m, y]], [/\b(mz60\d|xoom[2 ]{0,2}) build\//i], [h, [f, re], [m, k]], [ /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i, ], [h, [f, ie], [m, k]], [ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, /\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i, /\blg-?([\d\w]+) bui/i, ], [h, [f, ie], [m, y]], [ /(ideatab[-\w ]+)/i, /lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i, ], [h, [f, ne], [m, k]], [ /(?:maemo|nokia).*(n900|lumia \d+)/i, /nokia[-_ ]?([-\w\.]*)/i, ], [ [h, /_/g, " "], [f, "Nokia"], [m, y], ], [/(pixel c)\b/i], [h, [f, ee], [m, k]], [/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i], [h, [f, ee], [m, y]], [ /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i, ], [h, [f, le], [m, y]], [/sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i], [ [h, "Xperia Tablet"], [f, le], [m, k], ], [ / (kb2005|in20[12]5|be20[12][59])\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i, ], [h, [f, "OnePlus"], [m, y]], [ /(alexa)webm/i, /(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, /(kf[a-z]+)( bui|\)).+silk\//i, ], [h, [f, K], [m, k]], [/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i], [ [h, /(.+)/g, "Fire Phone $1"], [f, K], [m, y], ], [/(playbook);[-\w\),; ]+(rim)/i], [h, f, [m, k]], [/\b((?:bb[a-f]|st[hv])100-\d)/i, /\(bb10; (\w+)/i], [h, [f, Z], [m, y]], [ /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i, ], [h, [f, X], [m, k]], [/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i], [h, [f, X], [m, y]], [/(nexus 9)/i], [h, [f, "HTC"], [m, k]], [ /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i, ], [f, [h, /_/g, " "], [m, y]], [ /tcl (xess p17aa)/i, /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i, ], [h, [f, "TCL"], [m, k]], [ /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i, ], [h, [f, "TCL"], [m, y]], [/(itel) ((\w+))/i], [ [f, Oe], h, [m, Me, { tablet: ["p10001l", "w7001"], "*": "mobile" }], ], [/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i], [h, [f, "Acer"], [m, k]], [/droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i], [h, [f, "Meizu"], [m, y]], [/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i], [h, [f, "Ulefone"], [m, y]], [ /; (energy ?\w+)(?: bui|\))/i, /; energizer ([\w ]+)(?: bui|\))/i, ], [h, [f, "Energizer"], [m, y]], [ /; cat (b35);/i, /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i, ], [h, [f, "Cat"], [m, y]], [/((?:new )?andromax[\w- ]+)(?: bui|\))/i], [h, [f, "Smartfren"], [m, y]], [/droid.+; (a(?:015|06[35]|142p?))/i], [h, [f, "Nothing"], [m, y]], [ /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i, /; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i, /(hp) ([\w ]+\w)/i, /(asus)-?(\w+)/i, /(microsoft); (lumia[\w ]+)/i, /(lenovo)[-_ ]?([-\w]+)/i, /(jolla)/i, /(oppo) ?([\w ]+) bui/i, ], [f, h, [m, y]], [ /(imo) (tab \w+)/i, /(kobo)\s(ereader|touch)/i, /(archos) (gamepad2?)/i, /(hp).+(touchpad(?!.+tablet)|tablet)/i, /(kindle)\/([\w\.]+)/i, ], [f, h, [m, k]], [/(surface duo)/i], [h, [f, oe], [m, k]], [/droid [\d\.]+; (fp\du?)(?: b|\))/i], [h, [f, "Fairphone"], [m, y]], [/(shield[\w ]+) b/i], [h, [f, "Nvidia"], [m, k]], [/(sprint) (\w+)/i], [f, h, [m, y]], [/(kin\.[onetw]{3})/i], [ [h, /\./g, " "], [f, oe], [m, y], ], [/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i], [h, [f, ce], [m, k]], [/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i], [h, [f, ce], [m, y]], [/smart-tv.+(samsung)/i], [f, [m, x]], [/hbbtv.+maple;(\d+)/i], [ [h, /^/, "SmartTV"], [f, ae], [m, x], ], [/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i], [ [f, ie], [m, x], ], [/(apple) ?tv/i], [f, [h, Y + " TV"], [m, x]], [/crkey.*devicetype\/chromecast/i], [ [h, ge + " Third Generation"], [f, ee], [m, x], ], [/crkey.*devicetype\/([^/]*)/i], [ [h, /^/, "Chromecast "], [f, ee], [m, x], ], [/fuchsia.*crkey/i], [ [h, ge + " Nest Hub"], [f, ee], [m, x], ], [/crkey/i], [ [h, ge], [f, ee], [m, x], ], [/droid.+aft(\w+)( bui|\))/i], [h, [f, K], [m, x]], [/\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i], [h, [f, se], [m, x]], [/(bravia[\w ]+)( bui|\))/i], [h, [f, le], [m, x]], [/(mitv-\w{5}) bui/i], [h, [f, de], [m, x]], [/Hbbtv.*(technisat) (.*);/i], [f, h, [m, x]], [ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i, ], [ [f, Pe], [h, Pe], [m, x], ], [/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i], [[m, x]], [/(ouya)/i, /(nintendo) (\w+)/i], [f, h, [m, b]], [/droid.+; (shield) bui/i], [h, [f, "Nvidia"], [m, b]], [/(playstation \w+)/i], [h, [f, le], [m, b]], [/\b(xbox(?: one)?(?!; xbox))[\); ]/i], [h, [f, oe], [m, b]], [/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i], [h, [f, ae], [m, S]], [/((pebble))app/i], [f, h, [m, S]], [/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i], [h, [f, Y], [m, S]], [/droid.+; (wt63?0{2,3})\)/i], [h, [f, ce], [m, S]], [/droid.+; (glass) \d/i], [h, [f, ee], [m, _]], [/(pico) (4|neo3(?: link|pro)?)/i], [f, h, [m, _]], [/; (quest( \d| pro)?)/i], [h, [f, ve], [m, _]], [/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i], [f, [m, I]], [/(aeobc)\b/i], [h, [f, K], [m, I]], [ /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i, ], [h, [m, y]], [/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i], [h, [m, k]], [/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i], [[m, k]], [ /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i, ], [[m, y]], [/(android[-\w\. ]{0,9});.+buil/i], [h, [f, "Generic"]], ], engine: [ [/windows.+ edge\/([\w\.]+)/i], [v, [g, "EdgeHTML"]], [/(arkweb)\/([\w\.]+)/i], [g, v], [/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i], [v, [g, "Blink"]], [ /(presto)\/([\w\.]+)/i, /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, /ekioh(flow)\/([\w\.]+)/i, /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, /(icab)[\/ ]([23]\.[\d\.]+)/i, /\b(libweb)/i, ], [g, v], [/rv\:([\w\.]{1,9})\b.+(gecko)/i], [v, g], ], os: [ [/microsoft (windows) (vista|xp)/i], [g, v], [/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i], [g, [v, Me, De]], [ /windows nt 6\.2; (arm)/i, /windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i, /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i, ], [ [v, Me, De], [g, be], ], [ /ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, /cfnetwork\/.+darwin/i, ], [ [v, /_/g, "."], [g, "iOS"], ], [ /(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+haiku)/i, ], [ [g, "macOS"], [v, /_/g, "."], ], [/android ([\d\.]+).*crkey/i], [v, [g, ge + " Android"]], [/fuchsia.*crkey\/([\d\.]+)/i], [v, [g, ge + " Fuchsia"]], [/crkey\/([\d\.]+).*devicetype\/smartspeaker/i], [v, [g, ge + " SmartSpeaker"]], [/linux.*crkey\/([\d\.]+)/i], [v, [g, ge + " Linux"]], [/crkey\/([\d\.]+)/i], [v, [g, ge]], [/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i], [v, g], [ /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i, /(blackberry)\w*\/([\w\.]*)/i, /(tizen|kaios)[\/ ]([\w\.]+)/i, /\((series40);/i, ], [g, v], [/\(bb(10);/i], [v, [g, Z]], [/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i], [v, [g, "Symbian"]], [ /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i, ], [v, [g, me + " OS"]], [/web0s;.+rt(tv)/i, /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i], [v, [g, "webOS"]], [/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i], [v, [g, "watchOS"]], [/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i], [[g, "Chrome OS"], v], [ /panasonic;(viera)/i, /(netrange)mmh/i, /(nettv)\/(\d+\.[\w\.]+)/i, /(nintendo|playstation) (\w+)/i, /(xbox); +xbox ([^\);]+)/i, /(pico) .+os([\w\.]+)/i, /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, /(mint)[\/\(\) ]?(\w*)/i, /(mageia|vectorlinux)[; ]/i, /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i, /(hurd|linux) ?([\w\.]*)/i, /(gnu) ?([\w\.]*)/i, /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, /(haiku) (\w+)/i, ], [g, v], [/(sunos) ?([\w\.\d]*)/i], [[g, "Solaris"], v], [ /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, /(unix) ?([\w\.]*)/i, ], [g, v], ], }, Fe = ((a = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} }), Ce.call(a.init, [ [z, [g, v, p, m]], [H, [w]], [W, [m, h, f]], [V, [g, v]], [Q, [g, v]], ]), Ce.call(a.isIgnore, [ [z, [v, p]], [V, [v]], [Q, [v]], ]), Ce.call(a.isIgnoreRgx, [ [z, / ?browser$/i], [Q, / ?os$/i], ]), Ce.call(a.toString, [ [z, [g, v]], [H, [w]], [W, [f, h]], [V, [g, v]], [Q, [g, v]], ]), a), qe = function (e, t) { var n = Fe.init[t], i = Fe.isIgnore[t] || 0, o = Fe.isIgnoreRgx[t] || 0, r = Fe.toString[t] || 0; function a() { Ce.call(this, n); } return ( (a.prototype.getItem = function () { return e; }), (a.prototype.withClientHints = function () { return xe ? xe.getHighEntropyValues(G).then(function (t) { return e.setCH(new Be(t, !1)).parseCH().get(); }) : e.parseCH().get(); }), (a.prototype.withFeatureCheck = function () { return e.detectFeature().get(); }), t != J && ((a.prototype.is = function (e) { var t = !1; for (var n in this) if ( this.hasOwnProperty(n) && !_e(i, n) && Oe(o ? Ee(o, this[n]) : this[n]) == Oe(o ? Ee(o, e) : e) ) { if (((t = !0), e != d)) break; } else if (e == d && t) { t = !t; break; } return t; }), (a.prototype.toString = function () { var e = s; for (var t in r) typeof this[r[t]] !== d && (e += (e ? " " : s) + this[r[t]]); return e || d; })), xe || (a.prototype.then = function (e) { var t = this, n = function () { for (var e in t) t.hasOwnProperty(e) && (this[e] = t[e]); }; n.prototype = { is: a.prototype.is, toString: a.prototype.toString, }; var i = new n(); return e(i), i; }), new a() ); }; function Be(e, t) { if (((e = e || {}), Ce.call(this, G), t)) Ce.call(this, [ [O, Ae(e[R])], [C, Ae(e[M])], [y, /\?1/.test(e[F])], [h, Le(e[q])], [E, Le(e[B])], [L, Le(e[N])], [w, Le(e[D])], [T, Ae(e[U])], [P, Le(e[j])], ]); else for (var n in e) this.hasOwnProperty(n) && typeof e[n] !== d && (this[n] = e[n]); } function Ne(e, t, n, i) { return ( (this.get = function (e) { return e ? this.data.hasOwnProperty(e) ? this.data[e] : r : this.data; }), (this.set = function (e, t) { return (this.data[e] = t), this; }), (this.setCH = function (e) { return (this.uaCH = e), this; }), (this.detectFeature = function () { if (ke && ke.userAgent == this.ua) switch (this.itemType) { case z: ke.brave && typeof ke.brave.isBrave == l && this.set(g, "Brave"); break; case W: !this.get(m) && xe && xe[y] && this.set(m, y), "Macintosh" == this.get(h) && ke && typeof ke.standalone !== d && ke.maxTouchPoints && ke.maxTouchPoints > 2 && this.set(h, "iPad").set(m, k); break; case Q: !this.get(g) && xe && xe[E] && this.set(g, xe[E]); break; case J: var e = this.data, t = function (t) { return e[t].getItem().detectFeature().get(); }; this.set(z, t(z)) .set(H, t(H)) .set(W, t(W)) .set(V, t(V)) .set(Q, t(Q)); } return this; }), (this.parseUA = function () { return ( this.itemType != J && Re.call(this.data, this.ua, this.rgxMap), this.itemType == z && this.set(p, Te(this.get(v))), this ); }), (this.parseCH = function () { var e = this.uaCH, t = this.rgxMap; switch (this.itemType) { case z: var n, i = e[C] || e[O]; if (i) for (var o in i) { var a = Ee(/(Google|Microsoft) /, i[o].brand || i[o]), s = i[o].version; /not.a.brand/i.test(a) || (n && (!/chrom/i.test(n) || /chromi/i.test(a))) || (this.set(g, a).set(v, s).set(p, Te(s)), (n = a)); } break; case H: var l = e[w]; l && (l && "64" == e[P] && (l += "64"), Re.call(this.data, l + ";", t)); break; case W: if ( (e[y] && this.set(m, y), e[h] && this.set(h, e[h]), "Xbox" == e[h] && this.set(m, b).set(f, oe), e[T]) ) { var d; if ("string" != typeof e[T]) for (var c = 0; !d && c < e[T].length; ) d = Me(e[T][c++], je); else d = Me(e[T], je); this.set(m, d); } break; case Q: var u = e[E]; if (u) { var k = e[L]; u == be && (k = parseInt(Te(k), 10) >= 13 ? "11" : "10"), this.set(g, u).set(v, k); } this.get(g) == be && "Xbox" == e[h] && this.set(g, "Xbox").set(v, r); break; case J: var x = this.data, S = function (t) { return x[t].getItem().setCH(e).parseCH().get(); }; this.set(z, S(z)) .set(H, S(H)) .set(W, S(W)) .set(V, S(V)) .set(Q, S(Q)); } return this; }), Ce.call(this, [ ["itemType", e], ["ua", t], ["uaCH", i], ["rgxMap", n], ["data", qe(this, e)], ]), this ); } function Ge(e, t, n) { if ( (typeof e === c ? (Ie(e, !0) ? (typeof t === c && (n = t), (t = e)) : ((n = e), (t = r)), (e = r)) : typeof e !== u || Ie(t, !0) || ((n = t), (t = r)), n && typeof n.append === l) ) { var i = {}; n.forEach(function (e, t) { i[t] = e; }), (n = i); } if (!(this instanceof Ge)) return new Ge(e, t, n).getResult(); var o = typeof e === u ? e : n && n[A] ? n[A] : ke && ke.userAgent ? ke.userAgent : s, a = new Be(n, !0), d = t ? (function (e, t) { var n = {}, i = t; if (!Ie(t)) for (var o in ((i = {}), t)) for (var r in t[o]) i[r] = t[o][r].concat(i[r] ? i[r] : []); for (var a in e) n[a] = i[a] && i[a].length % 2 == 0 ? i[a].concat(e[a]) : e[a]; return n; })(Ue, t) : Ue, p = function (e) { return e == J ? function () { return new Ne(e, o, d, a) .set("ua", o) .set(z, this.getBrowser()) .set(H, this.getCPU()) .set(W, this.getDevice()) .set(V, this.getEngine()) .set(Q, this.getOS()) .get(); } : function () { return new Ne(e, o, d[e], a).parseUA().get(); }; }; return ( Ce.call(this, [ ["getBrowser", p(z)], ["getCPU", p(H)], ["getDevice", p(W)], ["getEngine", p(V)], ["getOS", p(Q)], ["getResult", p(J)], [ "getUA", function () { return o; }, ], [ "setUA", function (e) { return $e(e) && (o = e.length > 500 ? Pe(e, 500) : e), this; }, ], ]).setUA(o), this ); } (Ge.VERSION = "2.0.0"), (Ge.BROWSER = Se([g, v, p, m])), (Ge.CPU = Se([w])), (Ge.DEVICE = Se([h, f, m, b, y, x, k, S, I])), (Ge.ENGINE = Ge.OS = Se([g, v])), typeof t !== d ? ("object" !== d && e.exports && (t = e.exports = Ge), (t.UAParser = Ge)) : "function" === l && n.amdO ? (i = function () { return Ge; }.call(t, n, t, e)) === r || (e.exports = i) : ye && (o.UAParser = Ge); var ze = ye && (o.jQuery || o.Zepto); if (ze && !ze.ua) { var He = new Ge(); (ze.ua = He.getResult()), (ze.ua.get = function () { return He.getUA(); }), (ze.ua.set = function (e) { He.setUA(e); var t = He.getResult(); for (var n in t) ze.ua[n] = t[n]; }); } })("object" == typeof window ? window : this); }, }, r = {}; function a(e) { var t = r[e]; if (void 0 !== t) return t.exports; var n = (r[e] = { exports: {} }); return o[e].call(n.exports, n, n.exports, a), n.exports; } (a.amdO = {}), (e = "function" == typeof Symbol ? Symbol("webpack queues") : "__webpack_queues__"), (t = "function" == typeof Symbol ? Symbol("webpack exports") : "__webpack_exports__"), (n = "function" == typeof Symbol ? Symbol("webpack error") : "__webpack_error__"), (i = function (e) { e && e.d < 1 && ((e.d = 1), e.forEach(function (e) { e.r--; }), e.forEach(function (e) { e.r-- ? e.r++ : e(); })); }), (a.a = function (o, r, a) { var s; a && ((s = []).d = -1); var l, d, c, u = new Set(), p = o.exports, h = new Promise(function (e, t) { (c = t), (d = e); }); (h[t] = p), (h[e] = function (e) { s && e(s), u.forEach(e), h.catch(function () {}); }), (o.exports = h), r( function (o) { var r; l = (function (o) { return o.map(function (o) { if (null !== o && "object" == typeof o) { if (o[e]) return o; if (o.then) { var r = []; (r.d = 0), o.then( function (e) { (a[t] = e), i(r); }, function (e) { (a[n] = e), i(r); } ); var a = {}; return ( (a[e] = function (e) { e(r); }), a ); } } var s = {}; return (s[e] = function () {}), (s[t] = o), s; }); })(o); var a = function () { return l.map(function (e) { if (e[n]) throw e[n]; return e[t]; }); }, d = new Promise(function (t) { (r = function () { t(a); }).r = 0; var n = function (e) { e !== s && !u.has(e) && (u.add(e), e && !e.d && (r.r++, e.push(r))); }; l.map(function (t) { t[e](n); }); }); return r.r ? d : a(); }, function (e) { e ? c((h[n] = e)) : d(p), i(s); } ), s && s.d < 0 && (s.d = 0); }), (a.n = function (e) { var t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return a.d(t, { a: t }), t; }), (a.d = function (e, t) { for (var n in t) a.o(t, n) && !a.o(e, n) && Object.defineProperty(e, n, { enumerable: !0, get: t[n] }); }), (a.g = (function () { if ("object" == typeof globalThis) return globalThis; try { return this || new Function("return this")(); } catch (e) { if ("object" == typeof window) return window; } })()), (a.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }), a(7025); })();