/*! For license information please see pyramid.js.LICENSE.txt */
!(function () {
var e = {
768: function (e, t, a) {
"use strict";
a.r(t);
var o = a(9824),
i = a(867),
n = {
originalCount: 0,
originalCollection: {},
originalCardCounts: {},
emailSent: !1,
snapshot: !1,
previousSnapshot: !1,
getCardCounts: function (e) {
return e.flat(1 / 0).reduce(function (e, t) {
return void 0 === e[t.name] && (e[t.name] = 0), e[t.name]++, e;
}, {});
},
compareCardCounts: function (e, t) {
var a = n.getCardCounts(t);
return Object.keys(e).reduce(function (t, o) {
return e[o] != a[o] && (t[o] = e[o] - (a[o] || 0)), t;
}, {});
},
setOriginalCollection: function (e) {
(n.originalCardCounts = n.getCardCounts(e)),
(n.originalCollection = e),
(n.originalCount = n.countCollection(n.originalCollection));
},
setSnapshot: function () {
n.snapshot = { float: i.default.float };
for (var e = 0; e < i.default.allAreas.length; e++)
n.snapshot[i.default.allAreas[e].name] =
i.default.allAreas[e].piles;
},
addPayload: function (e) {
for (var t in e) n.snapshot[t] = e[t];
},
stringifyCardArray: function (e) {
return e.map(function (e) {
return e.name;
});
},
moves: [],
logMove: function (e) {
if (
!i.default.isReplay &&
(n.moves.push(e), i.default.storageKey)
)
try {
var t = { moves: n.moves };
localStorage.setItem(i.default.storageKey, JSON.stringify(t));
} catch (e) {}
},
getMovesData: function () {
return { moves: n.moves };
},
countCollection: function (e) {
return e.flat(1 / 0).length;
},
verifyAction: function (e, t) {
t = t || "";
for (var a = 0, o = 0; o < i.default.allAreas.length; o++)
a += n.countCollection(i.default.allAreas[o].piles);
n.originalCount > 0 &&
(a != n.originalCount || i.default.float.length > 0)
? n.emailSent ||
((n.snapshot.count = a),
(n.snapshot.type = e),
(n.snapshot.failingMove = t),
(n.snapshot.originalCount = n.originalCount),
(n.snapshot.windowWidth = window.innerWidth),
(n.snapshot.windowHeight = window.innerHeight),
(n.snapshot.userAgent = window.navigator.userAgent),
(n.snapshot.float = n.stringifyCardArray(i.default.float)),
(n.snapshot.seed = seed),
(n.snapshot.missingCards = n.compareCardCounts(
n.originalCardCounts,
i.default.getAllCards()
)),
(n.snapshot.zzpreviousSnapshot = n.previousSnapshot),
n.sendEmail(n.snapshot),
(n.emailSent = !0))
: (n.previousSnapshot = n.snapshot);
},
sendEmail: function (e) {
(0, o.sendDebugReport)("solitaire", {
missingCards: n.snapshot.missingCards,
FailingMove: n.snapshot.failingMove,
count: e.count,
seed: e.seed,
float: n.snapshot.float,
moveCount: n.moves.length,
moveType: n.snapshot.type,
}),
(n.emailSent = !0);
},
};
Array.prototype.flat ||
(Array.prototype.flat = function (e) {
void 0 === e && (e = 1);
var t = function (e, a) {
return a < 1
? e.slice()
: e.reduce(function (e, o) {
return e.concat(Array.isArray(o) ? t(o, a - 1) : o);
}, []);
};
return t(this, e);
}),
(t.default = n);
},
9980: function (e, t, a) {
"use strict";
a.r(t);
var o = a(2646),
i = a.n(o),
n = {};
(n.customizeCardBack = i().replaceCardBack),
(n.updateCardFactors = i().updateCardFactors),
(n.redrawImages = i().redrawImages),
(n.drawGame = i().drawGame),
(n.changeBackgroundImage = function (e) {
var t = "cover";
e.indexOf("default") > -1 && (t = "initial"),
$("#gameContainer").css({
"background-image": "url(".concat(e, ")"),
"background-size": "".concat(t),
});
}),
(n.sizeToFit = function () {
i().sizeToFit(), i().redrawImages();
}),
(t.default = n);
},
265: function (e, t, a) {
"use strict";
a.r(t);
var o = a(867),
i = a(5705),
n = a.n(i),
r = a(2646),
l = a.n(r),
s = a(2094),
d = a.n(s),
u = a(9824),
f = !1,
c =
[
"spider-one-suit",
"spider-two-suits",
"spider-four-suits",
].indexOf(nameSlug) >= 0,
p = {
hintsGiven: 0,
priorities: {},
flashMessage: "",
setPriorities: function (e) {
p.priorities = e;
},
setFlashMessage: function (e) {
p.flashMessage = e;
},
getFlashMessage: function () {
return p.flashMessage;
},
clearHighlightMoves: function () {
p.highlightMoves = [];
},
highlightMoves: [],
isHighlightMove: function (e) {
return !!p.highlightMoves.includes(e);
},
wasAlreadyMoved: function (e) {
for (var t = 0; t < o.default.previousMoves.length; t++)
if (o.default.previousMoves[t].card.name == e.card.name)
return 1;
return -1;
},
getPriority: function (e, t) {
var a = e + "_" + t;
return void 0 === p.priorities[a] ? -1 : p.priorities[a];
},
hasSameParent: function (e, t) {
var a = e.card;
if (0 == t.position) return !1;
var o = t.area.piles[t.pile][t.position - 1];
return (
t.area.name === e.area.name &&
a.number == o.number &&
1 == o.turnedup
);
},
getExplanation: function (e, t) {
var a = "",
o = "";
if (void 0 === e || e.priority < 0)
(a =
"There are no available moves so the only move is to turn over a new card."),
(o =
"The turned up card from the stockpile can be used to help build sequences. If you have flipped through all of the cards in the stockpile, click to refill it.");
else {
(a += "Move: "
.concat(
(0, u.convertCardToSymbolText)(e.card.name),
" from the "
)
.concat(e.area.name)),
e.target.card
? (a += " on top of "
.concat(
(0, u.convertCardToSymbolText)(e.target.card.name),
" on the "
)
.concat(e.target.area.name, "."))
: (a += " to the ".concat(e.target.area.name, ".")),
t.length > 1
? (a += "\n This is the best move from among ".concat(
t.length,
" available moves."
))
: (a += "\n This is the best and only move available.");
var i = e.canDrag.concat(e.canDrop);
o += i = (i = (i = i.reduce(function (e, t) {
return (
e.find(function (e) {
return e.rule == t.rule;
}) || e.push(t),
e
);
}, [])).reduce(function (t, a) {
return a.explain && t.push(a.explain(e)), t;
}, []))
.map(function (e) {
return '
'.concat(
e,
"
"
);
})
.join("");
}
return { text: a, rules: o };
},
flashExplanation: function (e) {
var t = {};
try {
t =
JSON.parse(localStorage.getItem("solitaire:settings")) || {};
} catch (e) {
t = {};
}
t.skipExplanation ||
($("#hint-explanation-modal-text").html(e.text),
$("#hint-explanation-modal-rules").html(e.rules),
$("#hint-explanation-modal").show());
},
initExplanations: function (e) {
(p.shouldShowExplanation = !0),
(p.dealFn = e),
$(function () {
var e = {};
try {
e =
JSON.parse(localStorage.getItem("solitaire:settings")) ||
{};
} catch (t) {
e = {};
}
e.skipExplanation
? $("#hint-explanations-enable").show()
: $("#hint-explanations-enable").hide(),
$("#hint-explanation-modal-accept").on(
"click",
function () {
$("#hint-explanation-modal").hide();
}
),
$("#hint-explanation-modal-decline").on(
"click",
function () {
(e.skipExplanation = !0),
localStorage.setItem(
"solitaire:settings",
JSON.stringify(e)
),
$("#hint-explanation-modal").hide(),
$("#hint-explanations-enable").show();
}
),
$("#hint-explanations-enable").on("click", function () {
(e.skipExplanation = !1),
localStorage.setItem(
"solitaire:settings",
JSON.stringify(e)
),
$("#hint-explanations-enable").hide();
}),
$(document).on("click", function (e) {
var t = $(e.target).attr("id");
if (
"hintBtn" === t ||
"hint-explanation-modal-expand" === t
)
return !0;
$("#hint-explanation-modal").hide();
});
});
},
findMoves: function (e) {
for (
var t =
"klondike-turn-1" == nameSlug ||
"klondike-turn-3" == nameSlug ||
"yukon" == nameSlug ||
"las-vegas-klondike" == nameSlug ||
"las-vegas-klondike-turn-3" == nameSlug ||
c,
a = [],
i = 0;
i < o.default.allAreas.length;
i++
)
for (var r = 0; r < o.default.allAreas[i].piles.length; r++)
for (
var l = 0;
l < o.default.allAreas[i].piles[r].length;
l++
) {
var s = o.default.allAreas[i].piles[r][l];
if (void 0 !== s) {
var d = {
area: o.default.allAreas[i],
card: s,
pile: r,
position: l,
};
o.default.fromSet = d;
var u = n().can("drag", o.default.fromSet, d);
if (u)
for (var f = 0; f < o.default.allAreas.length; f++)
for (
var m = 0;
m < o.default.allAreas[f].piles.length;
m++
)
if (0 == o.default.allAreas[f].piles[m].length) {
var g = {
area: o.default.allAreas[f],
card: !1,
pile: m,
position: -1,
},
h = n().can("drop", o.default.fromSet, g);
if (h) {
if (
t &&
0 == o.default.fromSet.position &&
o.default.fromSet.area.name == g.area.name
)
continue;
var v = {
card: o.default.fromSet.card,
priority: p.getPriority(
o.default.allAreas[i].name,
o.default.allAreas[f].name
),
pile: o.default.fromSet.pile,
position: o.default.fromSet.position,
area: o.default.fromSet.area,
target: g,
canDrag: u,
canDrop: h,
isUnavailable: e,
};
(v.previous = p.wasAlreadyMoved(v)), a.push(v);
}
} else
for (
var w = 0;
w < o.default.allAreas[f].piles[m].length;
w++
) {
var y = o.default.allAreas[f].piles[m][w],
b = {
area: o.default.allAreas[f],
card: y,
pile: m,
position: w,
},
S = n().can("drop", o.default.fromSet, b);
if (S) {
var x = {
card: o.default.fromSet.card,
priority: p.getPriority(
o.default.allAreas[i].name,
o.default.allAreas[f].name
),
pile: o.default.fromSet.pile,
position: o.default.fromSet.position,
area: o.default.fromSet.area,
target: b,
canDrag: u,
canDrop: S,
isUnavailable: e,
};
(p.hasSameParent(b, o.default.fromSet) &&
t) ||
((x.previous = p.wasAlreadyMoved(x)),
a.push(x));
}
}
}
}
return a;
},
findAllMoves: function () {
if (
"klondike-turn-1" != nameSlug &&
"klondike-turn-3" != nameSlug
)
return p.findMoves();
d().lock("hint");
for (
var e = [],
t = o.default.allAreas.find(function (e) {
return "stock" === e.name;
}),
a = o.default.allAreas.find(function (e) {
return "waste" === e.name;
}),
i = t.piles[0].slice(0),
n = a.piles[0].slice(0),
r = [],
l = [t.piles[0].length, a.piles[0].length].join("_"),
s = l,
u = 0;
r.indexOf(s) < 0 && u < 100;
) {
u++;
var f = l !== s,
c = p.findMoves(f);
if (((e = e.concat(c)), r.push(s), 0 === t.piles[0].length))
(t.piles[0] = t.piles[0].concat(
a.piles[0].splice(0).reverse()
)),
t.piles[0].forEach(function (e) {
e.turnedup = !1;
});
else {
var m = t.piles[0].splice(-numTurns).reverse();
m.forEach(function (e) {
e.turnedup = 1;
}),
(a.piles[0] = a.piles[0].concat(m));
}
s = [t.piles[0].length, a.piles[0].length].join("_");
}
return (
(t.piles[0] = i),
t.piles[0].forEach(function (e) {
e.turnedup = !1;
}),
(a.piles[0] = n),
a.piles[0].forEach(function (e) {
e.turnedup = 1;
}),
d().unlock("hint"),
e
);
},
showHint: function (e, t) {
if (
!d().isLocked() &&
((t = t || p.findAllMoves()), !p.checkNoHints(t))
) {
(t = t.reduce(function (e, t) {
return (
t.isUnavailable ||
e.find(function (e) {
return (
t.card.name == e.card.name &&
"foundations" === t.target.area.name &&
"foundations" === e.target.area.name
);
}) ||
e.push(t),
e
);
}, [])).sort(function (e, t) {
return t.priority - e.priority;
});
var a,
i = t[0];
if (p.shouldShowExplanation) {
var r = p.getExplanation(i, t);
p.flashExplanation(r);
}
if (void 0 === i || i.priority < 0) {
p.shouldShowExplanation ||
((o.default.flashMessage = p.getFlashMessage()),
n().showFlashMessage("find good move"));
try {
var s = o.default.allAreas.find(function (e) {
return "stock" === e.name;
}),
u = o.default.allAreas.find(function (e) {
return "waste" === e.name;
}),
f = (null == s ? void 0 : s.piles[0].length) - 1,
c = null == s ? void 0 : s.piles[0].slice(f)[0],
m = null == u ? void 0 : u.piles[0].slice(-1)[0];
c
? p.shouldShowExplanation && p.dealFn
? p.dealFn()
: ((a = [s.name, c.name, 0, f].join(",")),
audio.cardTouch(),
d().animateStockCard({
area: s,
card: c,
pile: 0,
position: 0,
}))
: m &&
(audio.cardTouch(),
d().animateStockCard({
area: u,
card: m,
pile: 0,
position: 0,
reverseDirection: !0,
}));
} catch (e) {
recordError(e);
}
} else
(a = [i.area.name, i.card.name, i.pile, i.position].join(
","
)),
o.default.previousMoves.push(i),
audio.cardTouch(),
e
? (d().hkMoveCount++, d().setFromSet(i), d().click(i))
: d().animateClick(i);
a &&
!p.highlightMoves.includes(a) &&
(e || p.hintsGiven++, p.highlightMoves.push(a)),
l().drawGame();
}
},
checkNoHints: function (e) {
if (!d().isLocked() && !f) {
var t =
"klondike-turn-1" == nameSlug ||
"klondike-turn-3" == nameSlug,
a =
[
"spider-one-suit",
"spider-two-suits",
"spider-four-suits",
].indexOf(nameSlug) >= 0,
i = "freecell" === nameSlug,
n = o.default.allAreas.find(function (e) {
return "stock" === e.name;
}),
r = (e = e || p.findAllMoves()).filter(function (e) {
return "foundations" !== e.area.name;
}),
l = (t || i) && 0 === r.length,
s = a && n && 0 === n.piles[0].length && 0 === r.length;
return (
(l || s) &&
(gtag("event", "no-hints-found", {
event_category: "hints",
event_label: nameSlug,
value: 1,
}),
$("#new-game-modal").modal("show"),
(f = !0)),
l || s
);
}
},
initIdleHint: function (e) {
(0, u.onIdle)(e, p.showHint);
},
};
t.default = p;
},
5454: function (e, t, a) {
"use strict";
a.r(t),
a.d(t, {
findNextTrophy: function () {
return r;
},
getTrophyData: function () {
return i;
},
getTrophyProgress: function () {
return d;
},
});
var o = [
{
image: "/images/trophies/wincounttrophies/Bronze/5.png",
name: "Beginner",
winCount: 1,
color: "Bronze",
text: "1 win",
},
{
image: "/images/trophies/wincounttrophies/Silver/5.png",
name: "Beginner",
winCount: 2,
color: "Silver",
text: "2 wins",
},
{
image: "/images/trophies/wincounttrophies/Gold/5.png",
name: "Beginner",
winCount: 5,
color: "Gold",
text: "5 wins",
},
{
image: "/images/trophies/wincounttrophies/ruby/5.png",
name: "Beginner",
winCount: 10,
color: "Ruby",
text: "10 wins",
},
{
image: "/images/trophies/wincounttrophies/emerald/5.png",
name: "Beginner",
winCount: 20,
color: "Emerald",
text: "20 wins",
},
{
image: "/images/trophies/wincounttrophies/diamond/5.png",
name: "Beginner",
winCount: 30,
color: "Diamond",
text: "30 wins",
},
{
image: "/images/trophies/wincounttrophies/Bronze/4.png",
name: "Pro",
winCount: 50,
color: "Bronze",
text: "50 wins",
},
{
image: "/images/trophies/wincounttrophies/Silver/4.png",
name: "Pro",
winCount: 75,
color: "Silver",
text: "75 wins",
},
{
image: "/images/trophies/wincounttrophies/Gold/4.png",
name: "Pro",
winCount: 100,
color: "Gold",
text: "100 wins",
},
{
image: "/images/trophies/wincounttrophies/ruby/4.png",
name: "Pro",
winCount: 200,
color: "Ruby",
text: "200 wins",
},
{
image: "/images/trophies/wincounttrophies/emerald/4.png",
name: "Pro",
winCount: 300,
color: "Emerald",
text: "300 wins",
},
{
image: "/images/trophies/wincounttrophies/diamond/4.png",
name: "Pro",
winCount: 500,
color: "Diamond",
text: "500 wins",
},
{
image: "/images/trophies/wincounttrophies/Bronze/7.png",
name: "Legend",
winCount: 750,
color: "Bronze",
text: "750 wins",
},
{
image: "/images/trophies/wincounttrophies/Silver/7.png",
name: "Legend",
winCount: 1e3,
color: "Silver",
text: "1000 wins",
},
{
image: "/images/trophies/wincounttrophies/Gold/7.png",
name: "Legend",
winCount: 1500,
color: "Gold",
text: "1500 wins",
},
{
image: "/images/trophies/wincounttrophies/ruby/7.png",
name: "Legend",
winCount: 2e3,
color: "Ruby",
text: "2000 wins",
},
{
image: "/images/trophies/wincounttrophies/emerald/7.png",
name: "Legend",
winCount: 2500,
color: "Emerald",
text: "2500 wins",
},
{
image: "/images/trophies/wincounttrophies/diamond/7.png",
name: "Legend",
winCount: 3e3,
color: "Diamond",
text: "3000 wins",
},
{
image: "/images/trophies/wincounttrophies/Bronze/8.png",
name: "Master",
winCount: 3500,
color: "Bronze",
text: "3500 wins",
},
{
image: "/images/trophies/wincounttrophies/Silver/8.png",
name: "Master",
winCount: 4e3,
color: "Silver",
text: "4000 wins",
},
{
image: "/images/trophies/wincounttrophies/Gold/8.png",
name: "Master",
winCount: 4500,
color: "Gold",
text: "4500 wins",
},
{
image: "/images/trophies/wincounttrophies/ruby/8.png",
name: "Master",
winCount: 5e3,
color: "Ruby",
text: "5000 wins",
},
{
image: "/images/trophies/wincounttrophies/emerald/8.png",
name: "Master",
winCount: 5500,
color: "Emerald",
text: "5500 wins",
},
{
image: "/images/trophies/wincounttrophies/diamond/8.png",
name: "Master",
winCount: 6e3,
color: "Diamond",
text: "6000 wins",
},
];
function i(e) {
return o.reduce(function (t, a) {
return e >= a.winCount && t.push(a), t;
}, []);
}
function n(e) {
return o.reduce(function (t, a, o) {
return e > a.winCount ? o : t;
}, -1);
}
function r(e) {
return o.find(function (t) {
return t.winCount > e;
});
}
function l(e) {
var t = n(e),
a = o[t + 1];
return a ? a.winCount - e : -1;
}
function s(e) {
var t = l(e);
if (t < 0) return "You are a solitaire master";
if (0 === t) {
var a = i(e).pop();
return "".concat(a.color, " ").concat(a.name, " earned!");
}
return 1 === t
? "1 win to next trophy!"
: "".concat(t, " wins to next trophy!");
}
function d(e) {
var t,
a = n(e),
i = (function (e, t, a, o) {
return e <= t.winCount
? (33 * e) / t.winCount
: e <= a.winCount
? 33 + (33 * (e - t.winCount)) / (a.winCount - t.winCount)
: e < o.winCount
? 66 + (33 * (e - a.winCount)) / (o.winCount - a.winCount)
: 100;
})(
e,
(t =
-1 === a
? o.slice(0, 3)
: a > o.length - 3
? o.slice(-3)
: o.slice(a, a + 3))[0],
t[1],
t[2]
);
return {
trophies: t,
progressPercentage: i,
gamesToNextTrophy: l(e),
gamesToNextTrophyText: s(e),
};
}
},
166: function (e, t, a) {
"use strict";
a.r(t),
a.d(t, {
undoCount: function () {
return u;
},
});
var o = a(867),
i = a(2646),
n = a.n(i),
r = a(2094),
l = a.n(r),
s = a(3668),
d = a.n(s),
u = 0,
f = {
undos: [],
redos: [],
undo: function () {
if (((u += 1), l().isLocked())) return !1;
if (0 == f.undos.length) return !1;
var e,
t = f.undos.pop();
if (void 0 !== t.type && "deal" == t.type)
return d().redeal(!0, !1, t), void f.addRedo(t);
if (void 0 !== t.type && "refillStock" == t.type)
return d().refillStock(!0, !1, t), void f.addRedo(t);
if (void 0 !== t.type && "moveToFoundation" == t.type)
return (
f.addRedo(t), void l().moveToFoundation(t.to, t.from, !0)
);
if (void 0 !== t.type && "flipUp" == t.type)
return l().lock("turnCardsUp"), void l().flipUp(t, !0);
for (var a = 0; a < o.default.allAreas.length; a++)
o.default.allAreas[a].name == t.from.name &&
(e = {
area: o.default.allAreas[a],
card: !1,
pile: t.from.pile,
position: t.from.position - 1,
}),
o.default.allAreas[a].name == t.to.name &&
(o.default.fromSet = {
area: o.default.allAreas[a],
card: !1,
pile: t.to.pile,
position: t.to.position + 1,
});
void 0 !== t.from.flipPosition &&
((o.default.fromSet.flipPosition = t.to.flipPosition),
(o.default.fromSet.rotation = t.to.flipTurnUpFrom),
(o.default.fromSet.rotationMax = t.to.flipTurnUpTo),
(o.default.fromSet.flipTurnUpFrom = t.to.flipTurnUpFrom),
(o.default.fromSet.flipTurnUpTo = t.to.flipTurnUpTo),
(e.flipPosition = t.from.flipPosition),
(e.rotation = t.from.flipTurnUpFrom),
(e.rotationMax = t.from.flipTurnUpTo),
(e.flipTurnUpFrom = t.from.flipTurnUpFrom),
(e.flipTurnUpTo = t.from.flipTurnUpTo)),
(o.default.float = o.default.fromSet.area.piles[
o.default.fromSet.pile
].slice(o.default.fromSet.position));
for (var i = 0; i < o.default.float.length; i++)
(o.default.float[i].position.x = n().getXOffset(
o.default.fromSet.area,
o.default.fromSet.pile
)),
(o.default.float[i].position.y = n().getYOffset(
o.default.fromSet.area,
o.default.fromSet.position
)),
o.default.fromSet.area.collapse ||
(o.default.float[i].position.y +=
(o.default.fromSet.position + i) *
o.default.fromSet.area.cardYOffset[
o.default.fromSet.pile
]);
t.triggerNextUndo && (e.triggerNextUndo = !0),
audio.cardTouch(),
l().completeDrop({}, e, !0, !1),
f.addRedo(t);
},
redo: function () {
if (l().isLocked()) return !1;
if (0 == f.redos.length) return !1;
var e,
t = f.redos.pop();
if (void 0 !== t.type && "deal" == t.type)
return d().redeal(!1, !0, t), void f.addUndo(t);
if (void 0 !== t.type && "refillStock" == t.type)
return d().refillStock(!1, !0, t), void f.addUndo(t);
if (void 0 !== t.type && "moveToFoundation" == t.type)
return (
f.addUndo(t), void l().moveToFoundation(t.from, t.to, !1, !0)
);
for (var a = 0; a < o.default.allAreas.length; a++)
o.default.allAreas[a].name == t.to.name &&
(e = {
area: o.default.allAreas[a],
card: !1,
pile: t.to.pile,
position: t.to.position,
}),
o.default.allAreas[a].name == t.from.name &&
(o.default.fromSet = {
area: o.default.allAreas[a],
card: !1,
pile: t.from.pile,
position: t.from.position,
});
o.default.float = o.default.fromSet.area.piles[
o.default.fromSet.pile
].slice(o.default.fromSet.position);
for (var i = 0; i < o.default.float.length; i++)
(o.default.float[i].position.x = n().getXOffset(
o.default.fromSet.area,
o.default.fromSet.pile
)),
(o.default.float[i].position.y =
n().getYOffset(
o.default.fromSet.area,
o.default.fromSet.position + i
) +
(o.default.fromSet.position + i) *
o.default.fromSet.area.cardYOffset[
o.default.fromSet.pile
]);
audio.cardTouch(), l().completeDrop({}, e, !1, !0), f.addUndo(t);
},
addUndo: function (e) {
f.undos.push(e);
},
addRedo: function (e) {
f.redos.push(e);
},
clearUndo: function () {
f.undos = [];
},
clearRedo: function () {
f.redos = [];
},
};
t.default = f;
},
7967: function (e, t, a) {
var o = /^\s+|\s+$/g,
i = /^[-+]0x[0-9a-f]+$/i,
n = /^0b[01]+$/i,
r = /^0o[0-7]+$/i,
l = parseInt,
s = "object" == typeof a.g && a.g && a.g.Object === Object && a.g,
d = "object" == typeof self && self && self.Object === Object && self,
u = s || d || Function("return this")(),
f = Object.prototype.toString,
c = Math.max,
p = Math.min,
m = function () {
return u.Date.now();
};
function g(e) {
var t = typeof e;
return !!e && ("object" == t || "function" == t);
}
function h(e) {
if ("number" == typeof e) return e;
if (
(function (e) {
return (
"symbol" == typeof e ||
((function (e) {
return !!e && "object" == typeof e;
})(e) &&
"[object Symbol]" == f.call(e))
);
})(e)
)
return NaN;
if (g(e)) {
var t = "function" == typeof e.valueOf ? e.valueOf() : e;
e = g(t) ? t + "" : t;
}
if ("string" != typeof e) return 0 === e ? e : +e;
e = e.replace(o, "");
var a = n.test(e);
return a || r.test(e)
? l(e.slice(2), a ? 2 : 8)
: i.test(e)
? NaN
: +e;
}
e.exports = function (e, t, a) {
var o,
i,
n,
r,
l,
s,
d = 0,
u = !1,
f = !1,
v = !0;
if ("function" != typeof e)
throw new TypeError("Expected a function");
function w(t) {
var a = o,
n = i;
return (o = i = void 0), (d = t), (r = e.apply(n, a));
}
function y(e) {
var a = e - s;
return void 0 === s || a >= t || a < 0 || (f && e - d >= n);
}
function b() {
var e = m();
if (y(e)) return S(e);
l = setTimeout(
b,
(function (e) {
var a = t - (e - s);
return f ? p(a, n - (e - d)) : a;
})(e)
);
}
function S(e) {
return (l = void 0), v && o ? w(e) : ((o = i = void 0), r);
}
function x() {
var e = m(),
a = y(e);
if (((o = arguments), (i = this), (s = e), a)) {
if (void 0 === l)
return (function (e) {
return (d = e), (l = setTimeout(b, t)), u ? w(e) : r;
})(s);
if (f) return (l = setTimeout(b, t)), w(s);
}
return void 0 === l && (l = setTimeout(b, t)), r;
}
return (
(t = h(t) || 0),
g(a) &&
((u = !!a.leading),
(n = (f = "maxWait" in a) ? c(h(a.maxWait) || 0, t) : n),
(v = "trailing" in a ? !!a.trailing : v)),
(x.cancel = function () {
void 0 !== l && clearTimeout(l),
(d = 0),
(o = s = i = l = void 0);
}),
(x.flush = function () {
return void 0 === l ? r : S(m());
}),
x
);
};
},
2094: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
},
i =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const n = i(a(867)),
r = i(a(2646)),
l = i(a(3415)),
s = i(a(140)),
d = i(a(166)),
u = i(a(5705)),
f = i(a(7583)),
c = i(a(768)),
p = i(a(265)),
m = a(9824),
g = a(6429),
h = i(a(8958)),
v = ["spade-icon", "heart-icon", "club-icon", "diamond-icon"];
let w = {};
function y(e) {
return void 0 !== e.changedTouches;
}
((0, m.isLocalEnv)() || (0, m.isStagingEnv)()) && (window.actions = w),
(w.checkPrimaryButton = !0),
(w.primaryMouseButtonDown = !1),
(w.misclickCounter = 0),
(w.upMoveCount = 0),
(w.hkMoveCount = 0),
(w.autoMoveCount = 0),
(w.lock = (e) => {
n.default.lock[e] = !0;
}),
(w.unlock = (e) => {
n.default.lock[e] = !1;
}),
(w.isLocked = () => {
let e = !1;
for (let t in n.default.lock) n.default.lock[t] && (e = !0);
return e;
}),
(w.softLock = (e) => {
n.default.softLock[e] = !0;
}),
(w.softUnlock = (e) => {
n.default.softLock[e] = !1;
}),
(w.isSoftLocked = () => {
let e = !1;
for (let t in n.default.softLock) n.default.softLock[t] && (e = !0);
return e;
}),
(w.getXPos = (e) =>
y(e) ? 2 * e.changedTouches[0].pageX : 2 * e.offsetX),
(w.getYPos = (e) =>
y(e)
? 2 *
(e.changedTouches[0].pageY -
e.changedTouches[0].target.offsetTop)
: 2 * e.offsetY),
(w.getPossibleTargetFromFromSetCard = (e) => {
if ("canvas" != e.target.id) return !1;
const t = n.default.fromSet.card;
if (!t) return !1;
const a = t.position.x,
o = t.position.y,
i = n.default.cardWidth,
l = n.default.cardHeight,
s = [
{ x: a, y: o },
{ x: a + i, y: o },
{ x: a + i, y: o + l },
{ x: a, y: o + l },
];
for (let e = 0; e < s.length; e++) {
const t = s[e];
let a = r.default.getTarget(t.x, t.y);
if (
u.default.can("drop", n.default.fromSet, a) &&
!w.isTargetSameAsFrom(a)
)
return a;
}
return null;
}),
(w.getTargetFromEvent = (e) => {
if ("canvas" != e.target.id) return !1;
let t = w.getXPos(e),
a = w.getYPos(e);
return r.default.getTarget(t, a);
}),
(w.isTargetSameAsFrom = (e) =>
e.area == n.default.fromSet.area &&
e.pile == n.default.fromSet.pile);
let b = [];
(w.drag = (e) => {
var t, a, o;
if ("canvas" !== e.target.id) return !1;
if (w.isLocked()) return;
let i = w.getTargetFromEvent(e);
(null ===
(o =
null ===
(a =
null === (t = null == i ? void 0 : i.area) || void 0 === t
? void 0
: t.piles) || void 0 === a
? void 0
: a[i.pile]) || void 0 === o
? void 0
: o[i.position]) &&
(p.default.clearHighlightMoves(),
(n.default.fromSet = i),
u.default.can("drag", n.default.fromSet, i)
? (e.preventDefault(),
l.default.start(),
f.default.cardTouch(),
(n.default.clickStart = performance.now()),
(i.area.piles[i.pile][i.position].hide = !0),
(n.default.float = i.area.piles[i.pile].slice(i.position)),
(n.default.fromSet.offset = {}),
(n.default.fromSet.offset.x = i.offsets.x),
(n.default.fromSet.offset.y = i.offsets.y),
w.setCardPosition(e),
(b = n.default.float.slice().map((e) => e.position)),
window.addEventListener("mousemove", w.setCardPosition),
window.addEventListener("touchmove", w.setCardPosition))
: ((n.default.fromSet = {}), u.default.showFlashMessage("drag")));
}),
(w.drop = (e) => {
if ((p.default.clearHighlightMoves(), w.isLocked())) return;
if (0 == n.default.float.length) return !1;
let t = w.getTargetFromEvent(e),
a = w.getPossibleTargetFromFromSetCard(e);
e.preventDefault(),
window.removeEventListener("mousemove", w.setCardPosition),
window.removeEventListener("touchmove", w.setCardPosition),
performance.now() - n.default.clickStart < 250 &&
w.isTargetSameAsFrom(t) &&
!$(".enable-autoplay").length
? w.click(e, t)
: u.default.can("drop", n.default.fromSet, t)
? (0 == t.area.piles[t.pile].length && (t.position = -1),
w.completeDrop(e, t))
: a
? (0 == a.area.piles[a.pile].length && (a.position = -1),
w.completeDrop(e, a))
: (w.upMoveCount++,
w.releaseDrag(e),
w.isTargetSameAsFrom(t) ||
u.default.showFlashMessage("drop"));
}),
(w.releaseDrag = () => {
w.lock("releaseDrag");
let e = gsap.timeline({
onComplete: () => {
(b = []),
(n.default.float = []),
f.default.cardDrop(),
r.default.resetCards(),
r.default.drawGame(),
w.unlock("releaseDrag");
},
});
n.default.float.forEach((t, a) => {
e.to(
t.position,
{ x: b[a].x, y: b[a].y, duration: 0.15, ease: "power1.inOut" },
0
);
});
}),
(w.completeDrop = (e, t, a = !1, o = !1, i = !1) =>
new Promise((e) => {
w.lock("drop"), c.default.setSnapshot();
let p = { name: t.area.name, pile: t.pile, position: t.position },
m = {
name: n.default.fromSet.area.name,
pile: n.default.fromSet.pile,
position: n.default.fromSet.position,
};
const v = n.default.fromSet.area.piles[m.pile][m.position],
y = null == v ? void 0 : v.name;
let b = {
start: Date.now(),
undo: a,
redo: o,
card: y,
from: null == m ? void 0 : m.name,
fromPile: null == m ? void 0 : m.pile,
fromPosition: null == m ? void 0 : m.position,
to: null == p ? void 0 : p.name,
toPile: null == p ? void 0 : p.pile,
toPosition: null == p ? void 0 : p.position,
};
if (
(c.default.logMove(b),
c.default.addPayload({ to: p, from: m, undo: a, redo: o }),
l.default.start(),
void 0 !==
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position - 1
] &&
0 ==
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position - 1
].turnedup
? ((m.flipPosition = n.default.fromSet.position - 1),
(m.rotation = m.flipTurnUpFrom = 0),
(m.rotationMax = m.flipTurnUpTo = 1),
(p.flipPosition = n.default.fromSet.position - 1),
(p.rotation = p.flipTurnUpFrom = 1),
(p.rotationMax = p.flipTurnUpTo = 0))
: void 0 !== n.default.fromSet.flipPosition &&
((m.flipPosition = n.default.fromSet.flipPosition),
(m.rotation = m.flipTurnUpFrom =
n.default.fromSet.flipTurnUpFrom),
(m.rotationMax = m.flipTurnUpTo =
n.default.fromSet.flipTurnUpTo),
(p.flipPosition = t.flipPosition),
(p.rotation = p.flipTurnUpFrom = t.flipTurnUpFrom),
(p.rotationMax = p.flipTurnUpTo = t.flipTurnUpTo)),
!a)
) {
let e = { to: p, from: m };
o || (d.default.addUndo(e), d.default.clearRedo());
}
if (
(n.default.fromSet.area.piles[n.default.fromSet.pile].splice(
n.default.fromSet.position
),
void 0 !== m.flipPosition)
) {
let e;
(e = a
? t.area.piles[t.pile].splice(t.flipPosition).pop()
: n.default.fromSet.area.piles[n.default.fromSet.pile]
.splice(m.flipPosition)
.pop()),
(e.position.rotation = m.rotation),
(e.position.rotationMax = m.rotationMax),
(e.position.flipTurnUpFrom = m.flipTurnUpFrom),
(e.position.flipTurnUpTo = m.flipTurnUpTo),
n.default.float.unshift(e);
}
let S = gsap.timeline({
onStart: () => {
w.lock("drop");
},
onComplete: () => {
(n.default.float = []),
r.default.resetCards(),
t.triggerNextUndo || r.default.sizeToFit(),
"foundations" == t.area.name &&
(1 == (null == v ? void 0 : v.number)
? f.default.cardSuccessBig()
: f.default.cardSuccess()),
(b.end = Date.now()),
r.default.drawGame(),
s.default.updateTurn(1),
w.unlock("drop"),
c.default.verifyAction("drop", b),
i ||
(u.default.hasGameBeenWon() &&
((n.default.gameWon = !0),
n.default.dispatch(n.default.finishGameEvent)),
t.triggerNextUndo
? window.dispatchEvent(n.default.triggerNextUndo)
: window.dispatchEvent(n.default.dropCompleted)),
n.default.onMoveComplete &&
n.default.onMoveComplete(b, a),
(0, g.storeGameState)(n.default.allAreas, {
moves: n.default.turns,
time: h.default.get(),
gameName: nameSlug,
url: window.location.href,
passthroughs: n.default.passthroughs,
gameStartTime: n.default.gameStartTime,
seed: seed,
gameId: gameId,
}),
e();
},
}),
x = 0,
k = 0,
T = n.default.getDeltaRatioDuration(0.25);
for (
n.default.gameWon && (T = n.default.getDeltaRatioDuration(0.1));
x < n.default.float.length;
) {
let e = n.default.float[x];
if (void 0 !== e.position.rotationMax) {
let o = n.default.fromSet.area,
i = n.default.fromSet.pile,
l = n.default.fromSet.position - 1,
s = n.default.fromSet.area.collapse;
if (
(a &&
((o = t.area),
(i = t.pile),
(l = t.position),
(s = t.area.collapse)),
(e.position.x = e.position.xMax =
r.default.getXOffset(o, i)),
(e.position.y = e.position.yMax =
r.default.getYOffset(o, i)),
!s)
) {
const t = l * o.cardYOffset[i];
(e.position.y += t), (e.position.yMax += t);
}
k = -1;
} else {
let a = t.area.piles[t.pile].length - 1;
"undefined" != typeof numTurns &&
t.area.piles[t.pile].length <= numTurns &&
(a = t.area.piles[t.pile].length),
(e.position.xMax =
r.default.getXOffset(t.area, t.pile) +
r.default.getExtraXOffset(t.area, t.pile, a)),
(e.position.yMax = r.default.getYOffset(
t.area,
t.position
)),
t.area.collapse ||
(e.position.yMax +=
(t.position + x + 1 + k) * t.area.cardYOffset[t.pile]);
}
(e.hide = !1),
S.to(
e.position,
{
duration: T,
ease: "power2.out",
x: e.position.xMax,
y: e.position.yMax,
rotation: e.position.rotationMax,
onStart: () => {
void 0 !== m.flipTurnUpTo &&
e.turnedup !== m.flipTurnUpTo &&
f.default.cardFlip();
},
onUpdate: () => {
r.default.drawGame();
},
onComplete: () => {
let o = n.default.fromSet,
i = t;
a && ((o = t), (i = t)),
f.default.cardDrop(),
void 0 !== e.position.rotationMax
? ((e.turnedup = m.flipTurnUpTo),
o.area.piles[o.pile].push(e))
: i.area.piles[i.pile].push(e),
r.default.drawGame();
},
},
x / 20
),
x++;
}
})),
(w.completeMoves = (e, t) =>
o(void 0, void 0, void 0, function* () {
for (let a = 0; a < e.length; a++) {
const o = e[a],
i = e[a + 1];
let r =
(null == o ? void 0 : o.start) &&
(null == i ? void 0 : i.start)
? i.start - o.start
: 400;
r = Math.min(r, 2e3);
const l = new Promise((e) => {
setTimeout(e, r);
});
if ("deal" === o.action) {
yield t(o.undo, o.redo, { from: { loopEnd: o.loopTurns } }),
w.lock("deal"),
yield l,
w.unlock("deal");
continue;
}
const s = n.default.allAreas.find((e) => e.name === o.from);
if (!s) continue;
const d = s.piles[o.fromPile][o.fromPosition],
u = {
area: n.default.allAreas.find((e) => e.name === o.to),
pile: o.toPile,
position: o.toPosition,
};
w.setFromSet({
area: s,
card: d,
pile: o.fromPile,
position: o.fromPosition,
target: u,
}),
yield w.completeDrop(null, u, o.undo, o.redo, !0),
w.lock("deal"),
yield l,
w.unlock("deal");
}
})),
(w.animateCompleteDrop = (e) => {
w.lock("drop");
let t = { name: e.area.name, pile: e.pile, position: e.position },
a = {
name: n.default.fromSet.area.name,
pile: n.default.fromSet.pile,
position: n.default.fromSet.position,
};
if (
(void 0 !==
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position - 1
] &&
0 ==
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position - 1
].turnedup
? ((a.flipPosition = n.default.fromSet.position - 1),
(a.rotation = a.flipTurnUpFrom = 0),
(a.rotationMax = a.flipTurnUpTo = 1),
(t.flipPosition = n.default.fromSet.position - 1),
(t.rotation = t.flipTurnUpFrom = 1),
(t.rotationMax = t.flipTurnUpTo = 0))
: void 0 !== n.default.fromSet.flipPosition &&
((a.flipPosition = n.default.fromSet.flipPosition),
(a.rotation = a.flipTurnUpFrom =
n.default.fromSet.flipTurnUpFrom),
(a.rotationMax = a.flipTurnUpTo =
n.default.fromSet.flipTurnUpTo),
(t.flipPosition = e.flipPosition),
(t.rotation = t.flipTurnUpFrom = e.flipTurnUpFrom),
(t.rotationMax = t.flipTurnUpTo = e.flipTurnUpTo)),
n.default.fromSet.area.piles[n.default.fromSet.pile]
.slice(n.default.fromSet.position)
.forEach((e) => {
e.hide = !0;
}),
void 0 !== a.flipPosition)
) {
let e = n.default.fromSet.area.piles[n.default.fromSet.pile]
.slice(a.flipPosition)
.slice(0)[0];
(e.position.rotation = a.rotation),
(e.position.rotationMax = a.rotationMax),
(e.position.flipTurnUpFrom = a.flipTurnUpFrom),
(e.position.flipTurnUpTo = a.flipTurnUpTo),
n.default.float.unshift(e);
}
let o = gsap.timeline({
repeat: 1,
yoyo: !0,
onStart: () => {
w.lock("drop");
},
onComplete: () => {
(n.default.float = []),
r.default.resetCards(),
r.default.sizeToFit(),
r.default.drawGame(),
w.unlock("drop");
},
}),
i = 0,
l = 0;
for (; i < n.default.float.length; ) {
let t = n.default.float[i];
if (void 0 !== t.position.rotationMax) {
let e = n.default.fromSet.area,
o = n.default.fromSet.pile;
(t.position.x = t.position.xMax = r.default.getXOffset(e, o)),
(t.position.y = t.position.yMax = r.default.getYOffset(e, o)),
n.default.fromSet.area.collapse ||
((t.position.y +=
a.flipPosition * n.default.fromSet.area.cardYOffset[o]),
(t.position.yMax +=
a.flipPosition * n.default.fromSet.area.cardYOffset[o])),
(l = -1);
} else {
let a = e.area.piles[e.pile].length - 1;
"undefined" != typeof numTurns &&
e.area.piles[e.pile].length <= numTurns &&
(a = e.area.piles[e.pile].length),
(t.position.xMax =
r.default.getXOffset(e.area, e.pile) +
r.default.getExtraXOffset(e.area, e.pile, a)),
(t.position.yMax = r.default.getYOffset(e.area, e.position)),
e.area.collapse ||
(t.position.yMax +=
(e.position + i + 1 + l) * e.area.cardYOffset[e.pile]);
}
let s = n.default.getDeltaRatioDuration(0.25);
o.to(
t.position,
{
duration: 3 * s,
ease: "power2.out",
x: t.position.xMax,
y: t.position.yMax,
rotation: t.position.rotationMax,
onStart: () => {
void 0 !== a.flipTurnUpTo &&
t.turnedup !== a.flipTurnUpTo &&
f.default.cardFlip();
},
onUpdate: () => {
r.default.drawGame();
},
onComplete: () => {
r.default.drawGame(), f.default.cardDrop();
},
},
i / 20
),
i++;
}
}),
(w.animateStockCard = ({
area: e,
card: t,
pile: a,
position: o,
reverseDirection: i = !1,
}) => {
w.lock("drop");
let l = 100;
i && (l *= -1),
"left" == handMode && (l *= -1),
(0, m.isMobile)() && (l *= -1),
(n.default.float = [t]),
(n.default.fromSet = { area: e, card: t, pile: a, position: o }),
(t.position.x = r.default.getXOffset(e, 0)),
(t.position.y = r.default.getYOffset(e, 0));
let s = n.default.getDeltaRatioDuration(0.25);
gsap
.timeline({
onStart: () => {
t.hide = !0;
},
onComplete: () => {
(t.hide = !1),
(n.default.float = []),
r.default.resetCards(),
r.default.sizeToFit(),
r.default.drawGame(),
w.unlock("drop");
},
})
.to(t.position, {
repeat: 1,
yoyo: !0,
duration: s,
ease: "power2.out",
x: t.position.x + l,
y: t.position.y,
onStart: () => {
1 == t.turnedup && f.default.cardFlip();
},
onUpdate: () => {
r.default.drawGame();
},
onComplete: () => {
r.default.drawGame();
},
});
}),
(w.animateCard = ({ area: e, pile: t, position: a }) => (
w.lock("drop"),
new Promise((o) => {
const i = e.piles[t].slice(a);
let l = n.default.getDeltaRatioDuration(0.025),
s = gsap.timeline({
onStart: () => {
(n.default.float = i), f.default.failSound();
},
onComplete: () => {
(n.default.float = []),
r.default.resetCards(),
r.default.sizeToFit(),
r.default.drawGame(),
w.unlock("drop"),
o();
},
});
i.forEach((o, i) => {
const n = a + i;
(o.position.x =
r.default.getXOffset(e, t) +
r.default.getExtraXOffset(e, t, a)),
(o.position.y =
r.default.getYOffset(e, n) + n * e.cardYOffset[t]),
s.to(
o.position,
{
repeat: 1,
yoyo: !0,
duration: l,
ease: "power2.out",
x: o.position.x + 5,
y: o.position.y,
onUpdate: () => {
r.default.drawGame();
},
onComplete: () => {
r.default.drawGame();
},
},
0
),
s.to(
o.position,
{
repeat: 1,
yoyo: !0,
duration: l,
ease: "power2.out",
x: o.position.x - 5,
y: o.position.y,
onUpdate: () => {
r.default.drawGame();
},
onComplete: () => {
r.default.drawGame();
},
},
">"
);
});
})
)),
(w.animateCardConfetti = (e, t, a, o, i) => {
if ($("#animations-toggle").hasClass("animations-toggle-on"))
return;
const n = Math.floor(r.default.getXOffset(t, a)),
l = Math.floor(r.default.getYOffset(t, a)),
s = Math.floor(r.default.setYOffset(t, o * t.cardYOffset[a])),
d = r.default.getExtraXOffset(t, a, o),
u = Math.floor(n + d + e.cardWidth / 2),
f = Math.floor(l + s + e.cardHeight / 2),
c = u / e.canvas.width,
p = f / e.canvas.height,
m = e.canvas.getBoundingClientRect().left,
g = e.canvas.getBoundingClientRect().top,
h = c * e.canvas.getBoundingClientRect().width + m,
w = p * e.canvas.getBoundingClientRect().height + g,
y = document.createElement("div");
(y.style.position = "absolute"),
(y.style.left = `${h}px`),
(y.style.top = `${w}px`),
document.body.appendChild(y);
const b = gsap.timeline({
onComplete: () => {
document.body.removeChild(y);
},
}),
S = Math.floor(10 * Math.random()) + 10;
for (let t = 0; t < S; t++) {
const t = document.createElement("div");
if (i) {
const e = i.split("_")[0];
t.classList.add(`${e}-icon`);
} else t.classList.add(v[Math.floor(Math.random() * v.length)]);
(t.style.position = "absolute"),
(t.style.left = "0px"),
(t.style.top = "0px"),
(t.style.width = e.cardWidth / 10 + "px"),
(t.style.height = e.cardWidth / 10 + "px"),
y.appendChild(t),
b.to(
t,
{
duration: 1,
ease: "power2.out",
x:
Math.floor((Math.random() * e.cardWidth) / 2) -
e.cardWidth / 4,
y:
Math.floor((Math.random() * e.cardWidth) / 2) -
e.cardWidth / 4,
rotation: Math.floor(360 * Math.random()),
opacity: 0,
},
0
);
}
}),
(w.getWeight = (e) => e.area.toWeight),
(w.setWeightFn = (e) => {
w.getWeight = e;
}),
(w.setMoveToFoundationFn = (e) => {
w.moveToFoundation = e;
}),
(w.setFlipUpFn = (e) => {
w.flipUp = e;
}),
(w.findTargetFor = (e) => {
for (let t = 0; t < n.default.allAreas.length; t++)
for (let a = 0; a < n.default.allAreas[t].piles.length; a++)
for (
let o = 0;
0 == o || o < n.default.allAreas[t].piles[a].length;
o++
) {
const i = {
area: n.default.allAreas[t],
card: n.default.allAreas[t].piles[a][o],
pile: a,
position: o,
};
if (u.default.can("drop", e, i)) return i;
}
}),
(w.findTarget = () => {
let e = -1,
t = null;
for (let a = 0; a < n.default.allAreas.length; a++)
for (let o = 0; o < n.default.allAreas[a].piles.length; o++)
if (n.default.allAreas[a].piles[o].length > 0)
for (
let i = 0;
i < n.default.allAreas[a].piles[o].length;
i++
) {
let r = {
area: n.default.allAreas[a],
card: n.default.allAreas[a].piles[o][i],
pile: o,
position: i,
};
if (
u.default.can("drop", n.default.fromSet, r) &&
!w.isTargetSameAsFrom(r)
) {
let a = w.getWeight(r);
a > e && ((e = a), (t = r));
}
}
else {
let i = {
area: n.default.allAreas[a],
card: null,
pile: o,
position: -1,
};
if (
u.default.can("drop", n.default.fromSet, i) &&
!w.isTargetSameAsFrom(i)
) {
let a = w.getWeight(i);
a > e && ((e = a), (t = i));
}
}
return t;
}),
(w.findTargets = () => {
let e = [];
for (let t = 0; t < n.default.allAreas.length; t++)
for (let a = 0; a < n.default.allAreas[t].piles.length; a++)
if (n.default.allAreas[t].piles[a].length > 0)
for (
let o = 0;
o < n.default.allAreas[t].piles[a].length;
o++
) {
let i = {
area: n.default.allAreas[t],
card: n.default.allAreas[t].piles[a][o],
pile: a,
position: o,
};
u.default.can("drop", n.default.fromSet, i) &&
!w.isTargetSameAsFrom(i) &&
e.push(i);
}
else {
let o = {
area: n.default.allAreas[t],
card: null,
pile: a,
position: -1,
};
u.default.can("drop", n.default.fromSet, o) &&
!w.isTargetSameAsFrom(o) &&
e.push(o);
}
return e;
}),
(w.click = (e) => {
if ((p.default.clearHighlightMoves(), w.isLocked())) return;
const t = w.findTarget();
if (null !== t)
return (
w.autoMoveCount++,
w.completeDrop(e, t),
void (w.misclickCounter = 0)
);
w.misclickCounter++,
w.upMoveCount++,
r.default.resetCards(),
(n.default.float = []),
r.default.drawGame(),
w.misclickCounter > 0 && w.animateCard(n.default.fromSet);
}),
(w.setFromSet = ({
area: e,
card: t,
pile: a,
position: o,
target: i,
}) => {
(n.default.float = e.piles[a].slice(o)),
(n.default.fromSet = { area: e, card: t, pile: a, position: o });
for (let t = 0; t < n.default.float.length; t++)
try {
n.default.float[t].position = {
x:
r.default.getXOffset(e, a) +
r.default.getExtraXOffset(e, a, o),
xMax:
r.default.getXOffset(i.area, i.pile) +
r.default.getExtraXOffset(i.area, i.pile, i.position),
y: r.default.getYOffset(e, a) + (o + t) * e.cardYOffset[a],
yMax:
r.default.getYOffset(i.area, i.pile) +
(i.position + t) * i.area.cardYOffset[i.pile],
rotation: 1,
};
} catch (e) {
recordError(e);
}
}),
(w.animateClick = ({
area: e,
card: t,
pile: a,
position: o,
target: i,
}) => {
w.setFromSet({ area: e, card: t, pile: a, position: o, target: i });
const l = w.findTarget();
null === l
? (r.default.resetCards(),
(n.default.float = []),
r.default.drawGame())
: w.animateCompleteDrop(l);
}),
(w.reset = () => {
(n.default.float = []),
r.default.resetCards(),
r.default.drawGame();
}),
(w.setCardPosition = (e) => {
var t, a, o, i;
if (!w.isLocked()) {
if ("canvas" != e.target.id)
return (
n.default.float.length > 0 && w.upMoveCount++, void w.reset()
);
for (let r = 0; r < n.default.float.length; r++)
try {
n.default.float[r].position = {};
const o =
(null ===
(a =
null === (t = n.default.fromSet) || void 0 === t
? void 0
: t.offset) || void 0 === a
? void 0
: a.x) || 0;
(n.default.float[r].position.x = w.getXPos(e) - o),
(n.default.float[r].position.y =
w.getYPos(e) +
r *
n.default.fromSet.area.cardYOffset[
n.default.fromSet.pile
] -
n.default.fromSet.offset.y);
} catch (e) {
recordError(e, {
fromSetName: n.default.fromSet.name,
fromSetPile: n.default.fromSet.pile,
fromSetPosition: n.default.fromSet.position,
area:
null ===
(i =
null === (o = n.default.fromSet) || void 0 === o
? void 0
: o.area) || void 0 === i
? void 0
: i.name,
});
}
r.default.drawGame();
}
}),
(w.setPrimaryButtonState = (e) => {
if (!w.checkPrimaryButton) return !1;
if (["touchstart", "touchmove", "touchend"].includes(e.type))
return void (w.checkPrimaryButton = !1);
let t = y(e) ? e.which : e.buttons;
w.primaryMouseButtonDown = 1 == (1 & t);
}),
window.addEventListener("touchmove", w.setPrimaryButtonState),
window.addEventListener("mousemove", w.setPrimaryButtonState),
window.addEventListener("touchstart", w.setPrimaryButtonState),
window.addEventListener("mousedown", w.setPrimaryButtonState),
window.addEventListener("touchend", w.setPrimaryButtonState),
window.addEventListener("mouseup", w.setPrimaryButtonState),
(t.default = w);
},
4728: function (e, t, a) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
const o = a(9824),
i = $(".plus-5-coin-container"),
n = {
animateChangingMoney: function (e) {
let t = $(
` ${
e > 0 ? `+${e}` : `${e}`
} `
);
i.append(t),
gsap
.timeline({
onComplete: () => {
t.remove();
},
})
.to(t, {
duration: 0.5,
top: -200,
opacity: 0.75,
ease: "power1",
})
.to(t, { duration: 0.5, opacity: 0, ease: "power1.out" });
},
};
(t.default = n),
((0, o.isLocalEnv)() || (0, o.isStagingEnv)()) &&
(window.animator = n);
},
7583: function (e, t) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
let a = {
test: !0,
play: (e) => {
try {
if (
((window.AudioContext =
window.AudioContext || window.webkitAudioContext),
window.AudioContext)
) {
if ("suspended" == new window.AudioContext().state) return;
return e.play();
}
} catch (e) {
recordError(e);
}
},
checkToggle: () => {
let e;
return (
$(".audio-toggle").hasClass("audio-toggle-off") && (e = "off"),
$(".audio-toggle").hasClass("audio-toggle-on") && (e = "on"),
"on" == e
);
},
cardFlip: () => {
if (a.checkToggle()) {
const e = new Audio("/audio/card-flip-4.mp3");
return a.play(e);
}
},
cardDrop: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/card-drop.mp3");
return a.play(e);
}
},
cardMove: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/card-move.mp3");
return a.play(e);
}
},
cardTouch: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/card-touch.mp3");
return a.play(e);
}
},
failSound: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/bonk-sound-effect.mp3");
return (e.volume = 0.1), a.play(e);
}
},
moveToFoundation: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/move-to-foundation.mp3");
return a.play(e);
}
},
congrats: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/congrats.mp3");
return a.play(e);
}
},
cardSuccess: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/card-success.mp3");
return a.play(e);
}
},
cardSuccessBig: () => {
if (a.checkToggle()) {
let e = new Audio("/audio/card-success-big.mp3");
return a.play(e);
}
},
};
(t.default = a), (window.audio = a);
},
3668: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = o(a(867)),
n = o(a(2646)),
r = o(a(2094)),
l = a(9824),
s = {};
let d = {
shuffleFromSavedDeck: (e) =>
Object.keys(e).reduce(
(t, a) => (
(t[a] = e[a].map((e) =>
e.map((e) => {
const t = stock.findIndex((t) => t.name === e.name),
a = stock.splice(t, 1)[0];
return (a.turnedup = e.turnedup), a;
})
)),
t
),
{}
),
shuffle: (e) => {
if (e) {
const t = s[e];
if (t) return d.shuffleFromSavedDeck(t);
}
let t =
Math.floor(stock.length / 52) * Math.floor(stock.length / 52);
for (let e = 0; e < t; e++)
SeededShuffle.shuffle(stock, seed),
SeededShuffle.shuffle(
stock,
seed.split("").reverse().join("").toLowerCase()
),
SeededShuffle.shuffle(
stock,
seed.split("").reverse().join("").substr(0, 10).toUpperCase()
);
return (
"undefined" != typeof cardCount &&
(cardCount += " then " + stock.length),
{}
);
},
deal: (e, t) => {
if (void 0 !== t) {
for (let a = 0; a < t.length; a++)
for (let o = 0; o < t[a].length; o++)
0 != t[a][o] &&
(t[a][o].position = {
frame: 0,
maxFrames: 1,
x: 1e3,
y: 3e3,
xMin: 1e3,
xMax: n.default.getXOffset(e, a),
yMin: 3e3,
yMax:
n.default.getYOffset(e, o) +
n.default.setYOffset(e, o * e.cardYOffset[a]),
});
return d.animateDeal(e, t, () => {});
}
if (void 0 !== e.legacyDistribution) {
for (let t = 0; t < e.legacyDistribution.length; t++)
for (let a = 0; a < e.legacyDistribution[t].length; a++) {
if (0 == e.legacyDistribution[t][a]) continue;
let o = stock.pop();
(o.position = {
frame: 0,
maxFrames: 1,
x: 1e3,
y: 3e3,
xMin: 1e3,
xMax: n.default.getXOffset(e, t),
yMin: 3e3,
yMax:
n.default.getYOffset(e, a) +
n.default.setYOffset(e, a * e.cardYOffset[t]),
}),
2 == e.legacyDistribution[t][a] &&
((o.position.rotation = 0), (o.position.rotationMax = 1)),
i.default.float.push(o);
}
return new Promise((a) => d.animateDeal(e, t, a));
}
for (let t = 0; t < e.piles.length; t++)
for (let a = 0; a < e.distribution[t]; a++) {
let o = stock.pop();
(o.position = {
frame: 0,
maxFrames: 1,
x: 1e3,
y: 3e3,
xMin: 1e3,
xMax: n.default.getXOffset(e, t),
yMin: 3e3,
yMax:
n.default.getYOffset(e, a) +
n.default.setYOffset(e, a * e.cardYOffset[t]),
}),
i.default.float.push(o);
}
return new Promise((a) => d.animateDeal(e, t, a));
},
};
d.redeal,
(d.setRedealFn = (e) => {
d.redeal = e;
}),
d.refillStock,
(d.setRefillStockFn = (e) => {
d.refillStock = e;
}),
(d.animateDeal = (e, t, a) => {
if ((r.default.lock("animateDeal"), t))
return new Promise((a) => {
if (
(r.default.lock(`animateDeal ${e.name}`), (0, l.isMobile)())
) {
for (let a = 0; a < t.length; a++)
for (let o = 0; o < t[a].length; o++)
e.piles[a][o] = t[a][o];
return (
n.default.drawGame(),
r.default.unlock("animateDeal"),
r.default.unlock(`animateDeal ${e.name}`),
void a()
);
}
let o = gsap.timeline({
onComplete: () => {
n.default.drawGame(),
r.default.unlock("animateDeal"),
r.default.unlock(`animateDeal ${e.name}`),
a();
},
});
for (let a = 0; a < t.length; a++)
for (let r = 0; r < t[a].length; r++) {
const s = t[a][r];
if (!s) continue;
let d = 0.2,
u = 0;
(0, l.isMobile)() && ((d = 0), (u = 0)),
o.to(
s.position,
{
duration: i.default.getDeltaRatioDuration(d),
ease: "sine.inOut",
rotation: s.position.rotationMax,
onStart: () => {
audio.cardFlip();
},
onUpdate: () => {
n.default.drawGame();
},
onComplete: () => {
e.piles[a][r] = s;
},
},
u
);
}
});
let o = 0 == i.default.float.length;
for (let e = 0; e < i.default.float.length; e++)
i.default.float[e].position.frame !=
i.default.float[e].position.maxFrames - 1
? ((o = !1),
(i.default.float[e].position.x =
i.default.float[e].position.x +
(i.default.float[e].position.xMax -
i.default.float[e].position.xMin) /
i.default.float[e].position.maxFrames),
(i.default.float[e].position.y =
i.default.float[e].position.y +
(i.default.float[e].position.yMax -
i.default.float[e].position.yMin) /
i.default.float[e].position.maxFrames),
(i.default.float[e].position.frame =
i.default.float[e].position.frame + 1))
: (o = !0);
if ((n.default.drawGame(), o || (0, l.isMobile)())) {
if (void 0 !== e.legacyDistribution) {
for (let t = 0; t < e.legacyDistribution.length; t++)
for (let a = 0; a < e.legacyDistribution[t].length; a++)
e.legacyDistribution[t][a] &&
e.piles[a].push(i.default.float.shift());
return r.default.unlock("animateDeal"), void a();
}
for (let t = 0; t < e.piles.length; t++)
for (let a = 0; a < e.distribution[t]; a++) {
const a = i.default.float.shift();
e.piles[t].push(a);
}
r.default.unlock("animateDeal"), a();
} else
window.requestAnimationFrame(
d.animateDeal.bind(null, e, null, a)
);
}),
(t.default = d);
},
3105: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = o(a(867)),
n = a(9824);
t.default = {
getCard: function (e) {
let t = (function (e) {
return "back_red" == e
? "#f69fa3"
: "card_base" == e
? "#ffffff11"
: "#ffffff";
})(e),
a = (function (e) {
return "card_base" == e ? "#00000000" : "#00000033";
})(e),
o = Math.floor(0.25 * i.default.cardWidth),
r = Math.floor(0.1 * i.default.cardWidth),
l = 0.02 * i.default.cardWidth,
s = 0.05 * i.default.cardWidth,
d = document.createElement("canvas");
(d.width = i.default.cardWidth), (d.height = i.default.cardHeight);
const u = d.getContext("2d", i.default.contextOptions);
if (!u) throw new Error("Could not get canvas context");
if (
((u.strokeStyle = a),
(u.lineWidth = l),
u.beginPath(),
(u.fillStyle = t),
(function (e, t) {
e.beginPath(),
e.moveTo(t / 2 + 6, t / 2),
e.lineTo(i.default.cardWidth - t - 6, t / 2),
e.arc(
i.default.cardWidth - t - 6,
t / 2 + 6,
6,
1.5 * Math.PI,
0
),
e.lineTo(
i.default.cardWidth - t,
i.default.cardHeight - t - 6
),
e.arc(
i.default.cardWidth - t - 6,
i.default.cardHeight - t - 6,
6,
0,
Math.PI / 2
),
e.lineTo(t / 2 + 6, i.default.cardHeight - t),
e.arc(
t / 2 + 6,
i.default.cardHeight - t - 6,
6,
Math.PI / 2,
Math.PI
),
e.lineTo(t / 2, t / 2 + 6),
e.arc(t / 2 + 6, t / 2 + 6, 6, Math.PI / 2, 1.5 * Math.PI),
e.fill(),
e.stroke();
})(u, l),
"back_red" == e || "card_base" == e || "logo" == e)
)
return d;
let f = e.split("_"),
c = (function (e) {
let t = "â™ ";
return (
"heart" == e
? (t = "♥")
: "diamond" == e
? (t = "♦")
: "club" == e && (t = "♣"),
t
);
})(f[0]),
p =
((m = f[0]),
["heart", "diamond"].includes(m) ? "red" : "black");
var m;
let g = (function (e) {
return (
"1" == e
? (e = "A")
: "11" == e
? (e = "J")
: "12" == e
? (e = "Q")
: "13" == e && (e = "K"),
e
);
})(f[1]),
h = document.createElement("canvas");
(h.width = 1.1 * o), (h.height = 1.3 * o);
const v = h.getContext("2d", i.default.contextOptions);
return (
(v.fillStyle = p),
(u.fillStyle = p),
(0, n.isMobile)()
? ((v.font = o + "px Times New Roman"),
v.fillText(g, 0, 1.1 * o),
u.drawImage(h, s, -1.7 * s, 9 * s, 11 * s),
(u.font = 2 * o + "px Times New Roman"),
u.fillText(c, 13 * s, 7.5 * s),
(u.font = 4.5 * o + "px Times New Roman"),
u.fillText(c, 4 * s, 25 * s),
d)
: ((v.font = "Bold " + o + "px Times New Roman"),
v.fillText(g, 0, 1.1 * o),
u.drawImage(h, s, -1 * s, 4.5 * s, 6.5 * s),
(u.font = 0.75 * o + "px Times New Roman"),
u.fillText(c, s * (3 + f[1].length), 3.2 * s),
(u.font = 2.5 * o + "px Times New Roman"),
u.fillText(c, 6 * s, 15 * s),
(u.font = r + "px Times New Roman"),
u.fillText("There was a", 3 * s, 19 * s),
u.fillText("problem loading", 3 * s, 21 * s),
u.fillText("this image.", 3 * s, 23 * s),
u.translate(
i.default.cardWidth / 2,
i.default.cardHeight / 2
),
u.rotate((180 * Math.PI) / 180),
(u.font = "Bold " + o + "px Times New Roman"),
u.drawImage(h, -8.5 * s, -15 * s, 4.5 * s, 6.5 * s),
(u.font = 0.75 * o + "px Times New Roman"),
u.fillText(c, s * (-2.5 - f[1].length), -10.5 * s),
u.setTransform(1, 0, 0, 1, 0, 0),
d)
);
},
};
},
6429: function (e, t, a) {
"use strict";
var o =
(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 = s();
return !!(t && t.url === e && r.indexOf(nameSlug) > -1);
}),
(t.deleteStoredGameState = l),
(t.restoreGameState = s),
(t.serializeCard = d),
(t.serializeGameState = u),
(t.storeGameState = function (e, t) {
if (i.default.gameWon) return void l();
const a = u(e, t);
try {
localStorage.setItem("gameState", JSON.stringify(a));
} catch (e) {
console.log(e);
}
});
const i = o(a(867)),
n = "gameState",
r = [
"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 l() {
try {
localStorage.removeItem(n);
} catch (e) {
console.log(e);
}
}
function s() {
try {
const e = localStorage.getItem(n);
if (e) return JSON.parse(e);
} catch (e) {
console.log(e);
}
return null;
}
function d(e) {
return { name: e.name, turnedup: e.turnedup };
}
function u(e, t) {
const a = e.reduce(
(e, t) => {
const a = t.piles.map((e) => e.map((e) => d(e)));
return (e.cardAreas[t.name] = a), e;
},
{ cardAreas: {} }
);
return Object.assign(Object.assign({}, a), t);
}
},
6887: function (e, t) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.cloneStat = n),
(t.shouldSkipMoments = function () {
return !(Date.now() - l().momentsSkipTimestamp > i);
}),
(t.setSkipMoments = function () {
const e = Date.now(),
t = l();
(t.momentsSkipTimestamp = e), r(t);
}),
(t.hasSeenBookmarkModal = function () {
return l().hasSeenBookmarkModal;
}),
(t.setHasSeenBookmarkModal = function (e) {
const t = l();
(t.hasSeenBookmarkModal = e), r(t);
}),
(t.getBookMarkGameCounter = function () {
return l().bookMarkGameCounter;
}),
(t.incrementBookmarkGameCount = function () {
const e = l();
(e.bookMarkGameCounter = e.bookMarkGameCounter + 1), r(e);
}),
(t.cleanUpLocalStorage = function () {
const e = [];
for (let t = 0; t < localStorage.length; t++) {
const a = localStorage.key(t);
a && s.some((e) => a.startsWith(e)) && e.push(a);
}
e.forEach((e) => localStorage.removeItem(e));
});
const a = "SOLITAIRED_GLOBAL_STATE",
o = {
hasSeenBookmarkModal: !1,
bookMarkGameCounter: 0,
momentsSkipTimestamp: 0,
},
i = 864e5;
function n() {
return JSON.parse(JSON.stringify(o));
}
function r(e) {
localStorage.setItem(a, JSON.stringify(e));
}
function l() {
const e = localStorage.getItem(a);
if (!e) return n();
try {
const t = JSON.parse(e);
return Object.assign(Object.assign({}, o), t);
} catch (e) {
return n();
}
}
var s = [
"moves-klondike-turn-1-",
"moves-klondike-turn-3-",
"moves-spider-one-suit-",
"moves-spider-two-suits-",
"moves-spider-four-suits-",
"moves-freecell-",
];
},
7728: function (e, t) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.phrazlePlayedInSession = function () {
if (!a) {
a = !0;
try {
gtag("set", "dimension3", !0),
gtag("event", "game-started", {
event_category: "phrazle",
value: 1,
});
} catch (e) {
console.log(e);
}
}
}),
(t.wordHurdlePlayedInSession = function () {
if (!o) {
o = !0;
try {
gtag("set", "dimension4", !0),
gtag("event", "game-started", {
event_category: "wordHurdle",
value: 1,
});
} catch (e) {
console.log(e);
}
}
}),
(t.playedInSession = function (e) {
if (!i[e]) {
i[e] = !0;
try {
gtag("set", "dimension4", !0),
gtag("event", "game-started", {
event_category: e || "wordHurdle",
value: 1,
});
} catch (e) {
console.log(e);
}
}
}),
(t.hotKeyUsedInGame = function (e) {
if (!n[e]) {
n[e] = !0;
try {
gtag("event", `'${e}' used`, {
event_category: "hotkeys",
value: 1,
});
} catch (e) {
console.log(e);
}
}
}),
(t.seedStatsInteraction = function (e) {
if (!r[e]) {
r[e] = !0;
try {
gtag("event", `seed stats interaction: ${e}`, {
event_category: "klondike",
value: 1,
});
} catch (e) {
console.log(e);
}
}
});
let a = !1,
o = !1;
const i = {};
var n = {};
const r = {};
},
8462: function (e, t, a) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
const o = a(9824),
i = a(7728);
t.default = {
create: (e, t, a) =>
function (n) {
$("#hotkeys-toggle").hasClass("hotkeys-toggle-on") ||
((0, o.bodyHasFocus)() &&
((0, o.modalOnScreen)() ||
(t.isLocked()
? n.preventDefault()
: 0 === a.float.length
? ("r" === n.key &&
(n.metaKey || n.altKey || n.shiftKey || n.ctrlKey)) ||
("?" == n.key &&
(n.preventDefault(),
$("#hotkeys-modal").modal("show")),
"h" == n.key &&
(n.preventDefault(),
$("#hotkeys-modal").modal("show")),
Object.keys(e).forEach((t) => {
n.key === t &&
((0, i.hotKeyUsedInGame)(t),
n.preventDefault(),
e[t](n));
}))
: n.preventDefault())));
},
};
},
2905: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = a(9824),
n = "inventories",
r = "personal-stats-solitaire-las-vegas-klondike";
t.default = class {
constructor(e) {
(this.loggedInMoney = null),
(this.storageKey = n),
(this.isLoggedIn = e),
this.isLoggedIn || this.tryMigrateGuestVegasCoins();
}
get() {
return o(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 a;
if ("ok" !== t.status)
return (
(0, i.recordError)(
new Error("failed to fetch from server")
),
e(0)
);
(this.loggedInMoney =
(null === (a = t.data) || void 0 === a
? void 0
: a.coins) || 0),
e(this.loggedInMoney);
},
error: () => {
e(0);
},
timeout: 5e3,
});
});
}
update(e) {
return o(this, void 0, void 0, function* () {
return this.isLoggedIn
? this.updateAsLoggedIn(e)
: this.updateAsGuest(e);
});
}
updateAsGuest(e) {
return o(this, void 0, void 0, function* () {
let t = 0;
const a = localStorage.getItem(this.storageKey);
return (
a && (t = parseInt(a)),
(t += e),
localStorage.setItem(this.storageKey, t.toString()),
t
);
});
}
updateAsLoggedIn(e) {
return o(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 a;
"ok" !== e.status &&
(0, i.recordError)(
new Error("failed to update inventory")
),
(this.loggedInMoney =
(null === (a = e.data) || void 0 === a
? void 0
: a.coins) || 0),
t(this.loggedInMoney);
},
error: () => {
t(0);
},
});
});
});
}
canUpdate(e) {
return o(this, void 0, void 0, function* () {
return (yield this.get()) + e >= 0;
});
}
tryMigrateGuestInventory() {
return o(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(n);
}
tryMigrateGuestVegasCoins() {
const e = localStorage.getItem(r);
if (!e) return;
const t = JSON.parse(e);
t.money &&
(localStorage.setItem(this.storageKey, t.money),
delete t.money,
delete t.curGameMoney,
localStorage.setItem(r, JSON.stringify(t)));
}
};
},
8164: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.LasVegasSolitairePersonalStats = void 0);
const i = a(6910),
n = { day: null, dailyWon: 0, dailyStarted: 0 };
class r extends i.PersonalStats {
constructor(e, t) {
let a = "personal-stats-solitaire-las-vegas-klondike";
3 === t && (a = "personal-stats-solitaire-las-vegas-turn-3"),
super(e, a, n);
}
resetStats() {
return o(this, void 0, void 0, function* () {
const e = JSON.parse(JSON.stringify(n));
return this.saveStats(e);
});
}
getStatsAndUpdate() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStats(),
t = new Date(),
a = `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
return (
e.day !== a &&
((e.dailyWon = 0),
(e.dailyStarted = 0),
(e.day = a),
yield this.saveStats(e)),
e
);
});
}
shouldReceiveDailyBonus() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStatsAndUpdate(),
t = new Date(),
a = `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
return e.lastRewardDay !== a;
});
}
receivedDailyBonus() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStatsAndUpdate(),
t = new Date(),
a = `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
return (e.lastRewardDay = a), yield this.saveStats(e), e;
});
}
startGame() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStatsAndUpdate();
return e.dailyStarted++, yield this.saveStats(e), e;
});
}
winGame() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStatsAndUpdate();
return e.dailyWon++, yield this.saveStats(e), e;
});
}
}
(t.LasVegasSolitairePersonalStats = r),
(r.PER_GAME_BET = 52),
(r.DAILY_BONUS = 200),
(r.GAIN_PER_CARD = 5),
(r.REGISTER_BONUS = 200);
},
2646: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
},
i =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const n = i(a(867)),
r = i(a(166)),
l = i(a(2094)),
s = i(a(265)),
d = i(a(5705)),
u = i(a(8623)),
f = i(a(3105)),
c = i(a(7583)),
p = a(9824),
m = a(9824),
g = i(a(3415));
let h = {};
function v(e) {
const t = new URL(e, window.location.origin);
return (
(n.default.imageWidth = n.default.cardWidth),
t.searchParams.set("resize.width", `${n.default.cardWidth}`),
t.toString()
);
}
(h.zoomFactor = 1),
(h.onResize = () => {
if (
window.innerWidth == n.default.globalWindow.width &&
window.innerHeight == n.default.globalWindow.height
)
return;
let e = window.innerWidth / n.default.globalWindow.width,
t = window.innerHeight / n.default.globalWindow.height;
(e > 0.95 && e < 1.05 && t > 0.8 && t < 1.1) ||
(h.sizeToFit(),
(n.default.globalWindow.width = window.innerWidth),
(n.default.globalWindow.height = window.innerHeight));
}),
(h.setZoomFactor = (e) => {
h.zoomFactor = e;
}),
(h.setDrawFn = (e) => {
h.drawFn = e;
}),
(h.drawGame = () => {
h.drawFn();
}),
(h.mapImages = (e, t) => {
var a, o, i;
void 0 === n.default.images_canvas[e]
? (n.default.images_canvas[e] = document.createElement("canvas"))
: t &&
(delete n.default.images_canvas[e],
(n.default.images_canvas[e] =
document.createElement("canvas"))),
(n.default.images_canvas[e].width = n.default.cardWidth),
(n.default.images_canvas[e].height = n.default.cardHeight);
let r =
null === (a = n.default.images_canvas[e]) || void 0 === a
? void 0
: a.getContext("2d", n.default.contextOptions);
if (!r)
try {
h.drawFallbackCard(e),
(r = n.default.images_canvas[e].getContext(
"2d",
n.default.contextOptions
));
} catch (t) {
(0, m.recordError)(t, {
cardName: e,
src:
null === (o = n.default.images[e]) || void 0 === o
? void 0
: o.src,
cardWidth: n.default.cardWidth,
cardHeight: n.default.cardHeight,
windowWidth: window.innerWidth,
windowHeight: window.innerHeight,
isIpad: !!(
(null === navigator || void 0 === navigator
? void 0
: navigator.standalone) &&
(null === navigator || void 0 === navigator
? void 0
: navigator.maxTouchPoints) > 0
),
});
}
if (r) {
(r.fillStyle = "#123456"),
r.clearRect(0, 0, n.default.cardWidth, n.default.cardHeight);
try {
r.drawImage(
n.default.images[e],
0,
0,
n.default.cardWidth,
n.default.cardHeight
);
} catch (t) {
(0, m.recordError)(t, {
imageName: e,
src:
null === (i = n.default.images[e]) || void 0 === i
? void 0
: i.src,
width: n.default.cardWidth,
height: n.default.cardHeight,
});
}
} else
(0, m.recordError)(new Error("image_ctx is null"), {
seed: seed,
});
});
let w = 0;
(h.drawLegacy = (e) =>
new Promise((t) => {
(n.default.images[e] = document.createElement("img")),
(n.default.images[e].crossOrigin = "anonymous");
let a = "";
if (
(w > 0 && (a = `?v=${w}`),
"back_red" === e &&
window.cardBack &&
window.cardBack.indexOf("http") > -1)
)
n.default.images[e].src = window.cardBack;
else if (
imageFolder.indexOf("style-classic-") > -1 &&
(0, p.isMobile)()
)
if ("card_base" == e)
n.default.images[e].src =
"/images/style-classic-mobile/card_base.png";
else if ("logo" == e)
n.default.images[e].src = gameOfTheDay
? "/images/favicons/logo-gotd.png"
: "/images/favicons/logo-black.png";
else if ("back_red" == e)
n.default.images[e].src = (0, p.getBackRedCard)();
else {
const [t, a] = e.split("_");
n.default.images[e].src = (0, p.createMobileCard)(
t,
parseInt(a)
);
}
else
n.default.images[e].src =
"card_base" == e
? v("/images/style-classic-2/card_base-2.png")
: "logo" == e
? gameOfTheDay
? "/images/favicons/logo-gotd.png"
: "/images/favicons/logo-black.png"
: v(`${imageFolder}/${e}.png${a}`);
n.default.images[e].addEventListener("load", () => {
n.default.images[e].naturalWidth == n.default.imageWidth &&
"logo" !== e &&
"card_base" !== e &&
(n.default.imageHeight = n.default.images[e].naturalHeight),
h.areImagesLoaded(),
t();
}),
n.default.images[e].addEventListener("error", () => {
(0, m.recordError)(new Error("image failed to load"), {
imageName: e,
}),
t();
});
})),
(h.areImagesLoaded = () => {
let e = !0;
for (let t = 0; t < image_names.length; t++) {
let a = image_names[t];
n.default.images[a].complete || (e = !1);
}
return e && window.dispatchEvent(n.default.imagesLoaded), e;
}),
(h.drawFallbackCard = (e) => {
(n.default.images_canvas[e] = document.createElement("canvas")),
(n.default.images_canvas[e].width = n.default.cardWidth),
(n.default.images_canvas[e].height = n.default.cardHeight);
const t = n.default.images_canvas[e].getContext(
"2d",
n.default.contextOptions
);
let a = f.default.getCard(e);
t.drawImage(a, 0, 0),
(t.fillStyle = "#123456"),
h.areImagesLoaded();
}),
(h.remapImages = (e, t) => {
e || (e = image_names),
e.forEach((e) => {
h.mapImages(e, t);
});
}),
(h.redrawImages = (e) =>
o(void 0, void 0, void 0, function* () {
e || (e = image_names),
w++,
yield Promise.all(e.map(h.drawLegacy));
})),
(h.replaceCardBack = (e, t) => {
(cardBack = e),
(n.default.images.back_red = new Image()),
(n.default.images.back_red.src = e),
(n.default.images.back_red.crossOrigin = "anonymous"),
n.default.images.back_red.addEventListener("load", () => {
t && h.drawGame();
});
}),
(h.getXOffset = (e, t) => {
let a = e.offset.x;
return (
(0, p.isMobile)() && (a = e.mobileOffset.x),
a * (n.default.cardWidth + n.default.cardSpacing) +
e.orientation.x *
t *
(n.default.cardWidth + n.default.cardSpacing) +
n.default.cardSpacing
);
}),
(h.getYOffset = (e, t) => {
let a = e.offset.y;
return (
(0, p.isMobile)() && (a = e.mobileOffset.y),
a * (n.default.cardHeight + n.default.cardSpacing) +
e.orientation.y *
t *
(n.default.cardHeight + n.default.cardSpacing) +
n.default.cardSpacing
);
}),
(h.getXCoords = (e) => {
let t = h.getXOffset(e, 0),
a = h.getXOffset(e, e.piles.length);
return (
(a += h.getExtraXOffset(e, 0, e.piles[0].length - 1)),
{ from: t, to: a, width: a - t }
);
}),
(h.getYCoords = (e) => {
let t = 0;
for (let a = 0; a < e.piles.length; a++)
for (let o = 0; o < e.piles[a].length; o++) o >= t && (t = o);
e.collapse && (t = 0);
let a = h.getYOffset(e, 0),
o = a + t * n.default.cardStep + n.default.cardHeight;
return { from: a, to: o, height: o - a };
}),
(h.updateCardFactors = (e, t) => {
void 0 !== n.default.cardFactors[e] &&
((n.default.cardFactors[e] = t), h.sizeToFit());
}),
(h.getTotalColumns = () => {
let e = {};
for (let t = 0; t < n.default.allAreas.length; t++) {
let a;
if (n.default.allAreas[t].getColumns)
a = n.default.allAreas[t].getColumns();
else {
let e = n.default.allAreas[t].offset.x;
(0, p.isMobile)() && (e = n.default.allAreas[t].mobileOffset.x),
(a =
(e + n.default.allAreas[t].piles.length) *
n.default.allAreas[t].orientation.x);
}
(void 0 === e[n.default.allAreas[t].offset.y] ||
e[n.default.allAreas[t].offset.y] < a) &&
(e[n.default.allAreas[t].offset.y] = a);
}
let t = 0;
for (let a in e) e[a] > t && (t = e[a]);
return t;
}),
(h.isTabletPortrait = () => window.innerWidth < window.innerHeight),
(h.sizeToFit = () => {
var e;
let t = 0;
$("#adSidebarContainer").is(":visible") &&
(t = $("#adSidebarContainer").width()),
imageFolder.indexOf("style-classic-") > -1 && (0, p.isMobile)()
? ((n.default.cardFactors.stepMax = 0.3),
(n.default.cardFactors.height = 1.305))
: ((n.default.cardFactors.stepMax =
n.default.defaultCardFactors.stepMax),
(n.default.cardFactors.height =
n.default.defaultCardFactors.height));
let a =
document.getElementById("timerContainer").clientHeight /
document.getElementById("timerContainer").clientWidth,
o =
document.getElementById("timerContainer").clientHeight +
document.getElementById("timerContainerBottom").clientHeight,
i = document.body.clientWidth - t;
i >= 8192 && (i = 8192),
(n.default.canvas.style.width = i + "px"),
(n.default.canvas.width = 2 * i),
0 == n.default.canvas.width && (n.default.canvas.width = 100);
let r =
(null === (e = document.getElementById("aboveNav")) ||
void 0 === e
? void 0
: e.clientHeight) || 0;
a > 1 &&
((n.default.canvas.style.width =
i -
document.getElementById("timerContainer").clientWidth +
"px"),
(n.default.canvas.width =
2 *
(i - document.getElementById("timerContainer").clientWidth)),
(o = document.getElementById(
"timerContainerBottom"
).clientHeight));
let s =
window.innerHeight -
document.getElementById("site-header").clientHeight -
r -
o;
if (
(s >= 8192 && (s = 8192),
(n.default.canvas.style.height = s - 15 + "px"),
(n.default.canvas.height = 2 * s - 30),
(0, p.isMobile)() && s > 320)
) {
const e = s - 15 - 115;
(n.default.canvas.style.height = e + "px"),
(n.default.canvas.height = 2 * e);
}
(n.default.cardWidth = Math.round(
n.default.canvas.width /
(h.getTotalColumns() +
h.getTotalColumns() * n.default.cardFactors.spacing)
)),
(n.default.cardSpacing = Math.round(
n.default.cardWidth * (n.default.cardFactors.spacing / 2)
)),
(n.default.cardXOffset = n.default.cardWidth / 4),
(n.default.cardHeight = Math.round(
n.default.cardWidth * n.default.cardFactors.height
)),
(n.default.cardStep = Math.round(
n.default.cardHeight * n.default.cardFactors.stepMax
));
const d =
n.default.maxCardRows || 7 * n.default.cardFactors.stepMax + 2;
let u = n.default.canvas.height / d;
n.default.cardHeight > u &&
((n.default.cardHeight = Math.round(u)),
(n.default.cardWidth = Math.round(
n.default.cardHeight / n.default.cardFactors.height
)),
(n.default.cardSpacing = Math.round(
n.default.cardWidth * (n.default.cardFactors.spacing / 2)
)),
(n.default.cardStep = Math.round(
n.default.cardHeight * n.default.cardFactors.stepMax
))),
h.zoomFactor &&
((n.default.cardWidth = n.default.cardWidth * h.zoomFactor),
(n.default.cardSpacing = Math.round(
n.default.cardWidth * (n.default.cardFactors.spacing / 2)
)),
(n.default.cardXOffset = n.default.cardWidth / 4),
(n.default.cardHeight = Math.round(
n.default.cardWidth * n.default.cardFactors.height
)),
(n.default.cardStep = Math.round(
n.default.cardHeight * n.default.cardFactors.stepMax
)));
let f = !1;
for (let e = 0; e < n.default.allAreas.length; e++)
if (!n.default.allAreas[e].collapse) {
f = n.default.allAreas[e];
break;
}
for (let e = 0; e < n.default.allAreas.length; e++)
void 0 !== n.default.allAreas[e].cardXOffset &&
n.default.allAreas[e].cardXOffset > 0 &&
(n.default.allAreas[e].cardXOffset[0] =
n.default.cardWidth / 5);
let c = !1,
m = JSON.parse(JSON.stringify(f.cardYOffset));
for (let e = 0; e < f.piles.length; e++) {
(!f || (void 0 !== f.cardYOffset && 0 == f.cardYOffset[e])) &&
(f.cardYOffset[e] =
(n.default.canvas.height -
n.default.cardHeight * (1 + f.offset.y)) /
f.piles.length);
let t = f.piles[e].length;
0 == f.piles[e].length && (t = f.distribution[e]),
(m[e] =
(n.default.canvas.height -
n.default.cardHeight * (1 + f.offset.y)) /
t),
m[e] > n.default.cardStep && (m[e] = n.default.cardStep),
f.cardYOffset[e] != m[e] && (c = !0),
n.default.isNewGame && (f.cardYOffset[e] = m[e]);
}
if (
($("#info-box").css(
"width",
(h.getTotalColumns() * n.default.cardWidth) / h.zoomFactor / 2 +
"px"
),
!c)
)
return;
if (n.default.isNewGame) return;
let g = gsap.timeline({
onStart: () => {
l.default.softLock("sizeToFit");
},
onComplete: () => {
h.drawGame(), l.default.softUnlock("sizeToFit");
},
});
for (let e = 0; e < f.cardYOffset.length; e++) {
let t = { x: f.cardYOffset[e] };
g.to(
t,
{
duration: n.default.getDeltaRatioDuration(0.25),
ease: "sine.out",
x: m[e],
onUpdate: () => {
(f.cardYOffset[e] = t.x), h.drawGame();
},
},
"0"
);
}
}),
(h.setYOffset = (e, t) => (e.collapse ? 0 : t)),
(h.getTarget = (e, t) => {
let a = !1,
o = !1,
i = { area: a, card: !1, pile: o, position: !1 };
for (let r = 0; r < n.default.allAreas.length; r++) {
const l = n.default.allAreas[r];
if (l.getTarget) {
const a = l.getTarget(e, t);
if (a) return a;
continue;
}
let s = h.getXCoords(n.default.allAreas[r]),
d = h.getYCoords(n.default.allAreas[r]),
u = { xFrom: s.from, xTo: s.to, yFrom: d.from, yTo: d.to };
if (!(e < u.xFrom || e > u.xTo || t < u.yFrom || t > u.yTo)) {
if (i.card || i.pile || i.position) return i;
if (((i.area = a = n.default.allAreas[r]), h.depth(a) < 1))
return i;
for (let r = 0; r < a.piles.length; r++) {
let l,
s = h.getXOffset(a, r),
d = h.getExtraXOffset(a, r, a.piles[r].length - 1);
if (
e >= s + d &&
e <= s + (n.default.cardWidth + n.default.cardSpacing) + d
) {
i.pile = o = r;
for (let o = 0; o < a.piles[r].length; o++) {
l =
h.getYOffset(a, r) +
h.setYOffset(a, o * a.cardYOffset[r]);
let d = h.getExtraXOffset(a, r, o);
t >= l &&
t <= l + n.default.cardHeight + n.default.cardSpacing &&
null !== a.piles[r][o] &&
((i.card = a.piles[r][o]),
(i.position = o),
(i.offsets = { x: e - s - d, y: t - l }));
}
}
}
}
}
return (
"number" == typeof o &&
0 == i.area.piles[o].length &&
(i.position = 0),
i
);
}),
(h.depth = (e) => {
let t = 1;
return Array.isArray(e.piles) && (t += h.depth(e.piles[0])), t;
}),
(h.resetCards = () => {
for (let e = 0; e < n.default.allAreas.length; e++)
for (let t = 0; t < n.default.allAreas[e].piles.length; t++)
for (let a = 0; a < n.default.allAreas[e].piles[t].length; a++)
(n.default.allAreas[e].piles[t][a].hide = !1),
(n.default.allAreas[e].piles[t][a].position = {});
});
const y = (e, t, a, o, i) => {
try {
const r = n.default.images[e];
o == n.default.imageWidth &&
n.default.imageHeight &&
(i = n.default.imageHeight),
o || i
? n.default.ctx.drawImage(r, t, a, o, i)
: n.default.ctx.drawImage(r, t, a);
} catch (r) {
const l = !!n.default.images_canvas[e],
s = n.default.images[e];
(0, m.recordError)(r, {
cardName: e,
xOffset: t,
yOffset: a,
width: o,
height: i,
imageCanvasExists: l,
src: null == s ? void 0 : s.src,
});
}
};
(h.tryDrawImage = y),
(h.draw = (e) => {
if (e.draw) return e.draw();
for (let t = 0; t < e.piles.length; t++) {
let a,
o = Math.floor(h.getXOffset(e, t)),
i = Math.floor(h.getYOffset(e, t));
if (
((a = "card_base"),
y(
a,
o,
i,
Math.floor(n.default.cardWidth),
Math.floor(n.default.cardHeight)
),
"foundations" === e.name || e.drawLogo)
)
if (gameOfTheDay)
y("logo", o, i, n.default.cardWidth, n.default.cardHeight);
else {
let e = 0.75 * n.default.cardWidth;
y(
"logo",
o + (n.default.cardWidth - e) / 2,
i + (n.default.cardHeight - e) / 2,
Math.floor(e),
Math.floor(e)
);
}
for (
let r = 0;
r < e.piles[t].length && !e.piles[t][r].hide;
r++
) {
let l = Math.floor(h.setYOffset(e, r * e.cardYOffset[t]));
(a = e.piles[t][r].name),
0 == e.piles[t][r].turnedup && (a = "back_red");
const d = [e.name, e.piles[t][r].name, t, r].join(",");
if (s.default.isHighlightMove(d) || e.piles[t][r].highlight) {
let s = h.getExtraXOffset(e, t, r);
n.default.ctx.save();
let d = 0;
for (; d < 4; )
(n.default.ctx.shadowColor = "#52FF52"),
(n.default.ctx.shadowBlur = 20),
y(
a,
o + s,
i + l,
Math.floor(n.default.cardWidth),
Math.floor(n.default.cardHeight)
),
d++;
n.default.ctx.restore();
} else {
let s = n.default.cardWidth,
d = o;
e.piles[t][r].position.rotation &&
e.piles[t][r].position.rotation < 0.5
? ((s =
n.default.cardWidth -
n.default.cardWidth *
(2 * e.piles[t][r].position.rotation)),
(d =
o +
n.default.cardWidth * e.piles[t][r].position.rotation))
: e.piles[t][r].position.rotation &&
e.piles[t][r].position.rotation >= 0.5 &&
((s =
n.default.cardWidth *
(2 * (e.piles[t][r].position.rotation - 0.5))),
(a = e.piles[t][r].name),
(d =
o +
n.default.cardWidth *
(1 - e.piles[t][r].position.rotation)));
let u = h.getExtraXOffset(e, t, r);
y(
a,
Math.floor(d + u),
Math.floor(i + l),
Math.floor(s),
Math.floor(n.default.cardHeight)
);
}
}
}
}),
(h.getExtraXOffset = (e, t, a, o) => {
var i;
let n,
r = 0,
l = e.piles[t].length;
return (
void 0 !== o && (l = o),
(n = l <= 3 ? a : a < l - 3 ? 0 : a - (l - 3)),
n < 0 && (n = 0),
(null === (i = e.cardXOffset) || void 0 === i ? void 0 : i[t]) &&
(r = n * e.cardXOffset[t]),
r
);
}),
(h.drawFloat = () => {
for (let e = 0; e < n.default.float.length; e++) {
let t = n.default.float[e].name;
0 == n.default.float[e].turnedup && (t = "back_red");
let a = n.default.cardWidth,
o = n.default.float[e].position.x;
void 0 !== n.default.float[e].position.rotation &&
n.default.float[e].position.rotation < 0.5
? ((a =
n.default.cardWidth -
n.default.cardWidth *
(2 * n.default.float[e].position.rotation)),
(o =
n.default.float[e].position.x +
n.default.cardWidth * n.default.float[e].position.rotation),
(t = "back_red"))
: void 0 !== n.default.float[e].position.rotation &&
n.default.float[e].position.rotation >= 0.5 &&
((a =
n.default.cardWidth *
(2 * (n.default.float[e].position.rotation - 0.5))),
(t = n.default.float[e].name),
(o =
n.default.float[e].position.x +
n.default.cardWidth *
(1 - n.default.float[e].position.rotation)));
const i = n.default.float[e];
if (i.position.spin) {
const a = o,
r = n.default.float[e].position.y,
l = n.default.cardWidth,
s = n.default.cardHeight,
d = a + l / 2,
u = r + s / 2;
n.default.ctx.translate(d, u),
n.default.ctx.rotate(i.position.spin),
y(t, a - d, r - u, l, s),
n.default.ctx.rotate(-i.position.spin),
n.default.ctx.translate(-d, -u);
} else
y(
t,
Math.floor(o),
Math.floor(n.default.float[e].position.y),
Math.floor(a),
Math.floor(n.default.cardHeight)
);
}
}),
(h.drawFlip = () => {
for (let e = 0; e < n.default.flip.length; e++) {
let t = n.default.flip[e].name;
0 == n.default.flip[e].turnedup && (t = "back_red");
let a = n.default.cardWidth,
o = n.default.flip[e].position.x;
void 0 !== n.default.flip[e].position.rotation &&
n.default.flip[e].position.rotation < 0.5
? ((a =
n.default.cardWidth -
n.default.cardWidth *
(2 * n.default.flip[e].position.rotation)),
(t = "back_red"),
(o =
n.default.flip[e].position.x +
n.default.cardWidth * n.default.flip[e].position.rotation))
: void 0 !== n.default.flip[e].position.rotation &&
n.default.flip[e].position.rotation >= 0.5 &&
((a =
n.default.cardWidth *
(2 * (n.default.flip[e].position.rotation - 0.5))),
(t = n.default.flip[e].name),
(o =
n.default.flip[e].position.x +
n.default.cardWidth *
(1 - n.default.flip[e].position.rotation))),
y(
t,
Math.floor(o),
Math.floor(n.default.flip[e].position.y),
Math.floor(a),
Math.floor(n.default.cardHeight)
);
}
}),
(h.drawHints = () => {
s.default.highlightMoves.forEach((e) => {
const [t, a, o, i] = e.split(",");
if (a) return;
const r = n.default.allAreas.find((e) => e.name === t);
let l = Math.floor(h.getXOffset(r, o)),
s = Math.floor(h.getYOffset(r, o)),
d = Math.floor(h.setYOffset(r, i * r.cardYOffset[o])),
u = h.getExtraXOffset(r, o, i);
n.default.ctx.save();
let f = 0;
for (; f < 4; )
(n.default.ctx.shadowColor = "#52FF52"),
(n.default.ctx.shadowBlur = 20),
y(
"card_base",
Math.floor(l + u),
Math.floor(s + d),
Math.floor(n.default.cardWidth),
Math.floor(n.default.cardHeight)
),
f++;
n.default.ctx.restore();
});
}),
(h.randomNumber = (e, t) => Math.random() * (t - e) + e),
(h.getPileWithLowestCard = (e) => {
let t,
a = !1;
for (let o = 0; o < e.piles.length; o++) {
if (void 0 === e.piles[o][e.piles[o].length - 1]) continue;
let i = e.piles[o][e.piles[o].length - 1].number;
(void 0 === t || t >= i) && ((t = i), (a = o));
}
return a;
}),
(h.finishGame = () => {
$(".enable-autocomplete").length || g.default.stop();
for (let e = 0; e < n.default.allAreas.length; e++) {
if (n.default.allAreas[e].gameWon) continue;
let t = h.getPileWithLowestCard(n.default.allAreas[e]);
if (!1 !== t && n.default.allAreas[e].piles[t].length > 0) {
if ($(".enable-autocomplete").length) return;
n.default.float = n.default.allAreas[e].piles[t].slice(-1);
let a = h.getXOffset(n.default.allAreas[e], t),
o = h.getYOffset(n.default.allAreas[e], t);
(n.default.float[0].position = { x: a, y: o }),
(n.default.fromSet = {
area: n.default.allAreas[e],
pile: t,
position: n.default.allAreas[e].piles[t].length - 1,
card: n.default.float,
offset: { x: a, y: o },
});
let i = { x: a, y: o };
return l.default.click(i, n.default.fromSet);
}
}
h.waterfall();
}),
addEventListener("gameVars.finishGameEvent", h.finishGame),
(h.waterfall = () => {
n.default.isReplay ||
(n.default.onGameWon
? n.default.onGameWon()
: u.default.saveSeed());
let e = gsap.timeline({
onStart: () => {
l.default.lock("waterfall");
},
onComplete: () => {
l.default.unlock("waterfall");
},
});
n.default.waterfallRunning = e;
let t,
a,
o,
i = !1;
for (let e = 0; e < n.default.allAreas.length; e++)
if (
n.default.allAreas[e].gameWon ||
n.default.allAreas[e].showWaterfall
)
for (let r = 0; r < n.default.allAreas[e].piles.length; r++)
for (
let l = n.default.allAreas[e].piles[r].length - 1;
l >= 0;
l--
) {
(i = n.default.allAreas[e].piles[r].slice(-1).pop()),
(t = e),
(a = r),
(o = l);
break;
}
if (!i) return !0;
(i.position = {
x: h.getXOffset(n.default.allAreas[t], a),
xMax: 0,
y: h.getYOffset(n.default.allAreas[t], o),
yMax: n.default.canvas.height - n.default.cardHeight,
}),
e.to(i.position, {
duration: 1,
ease: "power1.in",
x: i.position.xMax,
y: i.position.yMax,
onStart: () => {
n.default.allAreas[t].piles[a].pop();
},
onUpdate: () => {
y(
i.name,
i.position.x,
i.position.y,
n.default.cardWidth,
n.default.cardHeight
);
},
onComplete: () => {
let e = {
card: i,
periods: h.randomNumber(1, 4),
amplitude: h.randomNumber(300, 1200),
xPos: 0,
yPos: n.default.canvas.height,
rot: 0,
};
h.animateCardBounce(e);
},
});
}),
(h.turnCardsUp = (e) => {
let t = [];
l.default.lock("turnCardsUp");
for (let a = 0; a < n.default.allAreas.length; a++) {
let o = n.default.allAreas[a];
for (let a = 0; a < o.piles.length; a++)
for (let i = 0; i < o.piles[a].length; i++) {
let s = {
area: o,
pile: a,
position: i,
card: o.piles[a][i],
};
if (
((n.default.fromSet = s),
void 0 !== o.piles[a][i] &&
0 === o.piles[a][i].turnedup &&
(d.default.can("flipUp", n.default.fromSet, s) ||
1 === o.piles[a][i].position.rotationMax))
) {
(o.piles[a][i].position.rotation = 0),
(o.piles[a][i].position.rotationMax = 1),
t.push(o.piles[a][i]);
let n = { name: o.name, pile: a, position: i + 1 },
s = { name: o.name, pile: a, position: i - 1 };
(s.flipPosition = i),
(s.flipTurnUpFrom = 0),
(s.flipTurnUpTo = 1),
(n.flipPosition = i),
(n.flipTurnUpFrom = 1),
(n.flipTurnUpTo = 0);
let d = { to: n, from: s, triggerNextUndo: !0 };
"deal" === e || l.default.flipUp || r.default.addUndo(d);
}
}
}
if ((h.drawGame(!0), "deal" !== e && l.default.flipUp)) {
const e = {
type: "flipUp",
cardsToFlipUp: t,
triggerNextUndo: !0,
};
return r.default.addUndo(e), void l.default.flipUp(e);
}
let a = gsap.timeline({
onComplete: () => {
h.drawGame(!0),
l.default.unlock("turnCardsUp"),
"deal" == e &&
window.dispatchEvent(n.default.dealAnimationFinished);
},
});
for (let e = 0; e < t.length; e++) {
let o = 0.2,
i = e / 10;
t.length > 15 && (i = 0),
(o = 0),
(i = 0),
a.to(
t[e].position,
{
duration: o,
ease: "sine.inOut",
rotation: t[e].position.rotationMax,
onStart: () => {
c.default.cardFlip();
},
onUpdate: () => {
h.drawGame();
},
onComplete: () => {
void 0 !== t[e] && (t[e].turnedup = 1);
},
},
i
);
}
}),
(h.animateCardBounce = (e) => {
let t = 2 * Math.PI,
a = n.default.canvas.width / e.periods / t,
o = e.xPos,
i =
n.default.canvas.height -
Math.abs(e.amplitude * Math.sin(e.xPos / a));
n.default.ctx.save(),
n.default.ctx.translate(o, i - n.default.cardHeight / 2),
n.default.ctx.rotate(e.rot),
y(
e.card.name,
-n.default.cardWidth / 2,
-n.default.cardHeight / 2,
n.default.cardWidth,
n.default.cardHeight
),
n.default.ctx.restore(),
(e.xPos = o + 8),
(e.rot = e.xPos / a),
o <= n.default.canvas.width + n.default.cardHeight
? (n.default.animationFrameRunning =
window.requestAnimationFrame(
h.animateCardBounce.bind(null, e)
))
: window.dispatchEvent(n.default.congratsNextCardEvent);
}),
(h.getZoomFactor = () => h.zoomFactor),
(t.default = h),
(window.getZoomFactor = h.getZoomFactor),
(window.remapImages = h.remapImages),
(window.redrawImages = h.redrawImages);
},
8206: function (e, t, a) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.tryLngtdRetireAnchor = i),
(t.ifMobileTryLngtdRetireAnchor = function () {
(0, o.isMobile)() && i();
}),
(t.tryResetAndRunAuction = n),
(t.ifMobileTryResetAndRunAuction = function () {
(0, o.isMobile)() && n();
});
const o = a(9824);
function i() {
window.lngtdRetireAnchor && window.lngtdRetireAnchor();
}
function n() {
var e;
(null === (e = window.lngtd) || void 0 === e
? void 0
: e.resetAndRunAuction) && window.lngtd.resetAndRunAuction();
}
},
2824: function (e, t, a) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
const o = a(6887),
i = 12e4,
n = ["no-moments-user", "subscriber"];
let r = null,
l = { initCalled: {}, label: "" };
const s = [];
function d(e, t) {
const a = {
stepName: e,
time: performance.now(),
timeStep: null,
extras: t,
},
o = s.slice(-1)[0];
o && (a.timeStep = a.time - o.time), s.push(a);
}
const u = (e, t) => {
"function" == typeof e
? e(t)
: setTimeout(() => {
window.location.assign(e);
}, 200);
};
(l.setLabel = (e) => {
l.label = String(e);
}),
(l.doesRoleHaveMoments = () =>
!n.includes(
null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL
? void 0
: SOLITAIRED_GLOBAL.role
)),
(l.tryInintMoments = (e, t = "interstitial_video") => {
const a = Date.now();
e && a - e > i && l.doesRoleHaveMoments() && l.callLngtd(t);
});
let f = !1;
(l.tryShowMoments = (e, t, a) => {
if ((0, o.shouldSkipMoments)()) return;
if (f)
return (
t.preventDefault(),
(0, o.setSkipMoments)(),
d("Moments failed to Show"),
recordError(new Error("Moments failed to show"), {
momentsSteps: s,
}),
void setTimeout(() => {
window.location.href = t.currentTarget.href;
}, 200)
);
const n = Date.now();
if ((a || (e && n - e > i)) && l.doesRoleHaveMoments()) {
(f = !0), t.preventDefault();
try {
const e = $(t.currentTarget),
a = t.currentTarget.href || e.data("link");
l.lngtdMoments(a, { html: e.html(), class: e.attr("class") });
} catch (t) {
l.loadMoment(t.currentTarget.href);
}
}
}),
(l.callLngtd = (e = "default") => {
var t, a;
if ("reward" === e || !l.initCalled[e]) {
l.initCalled[e] = !0;
try {
null ===
(a =
null === (t = window.lngtd) || void 0 === t
? void 0
: t.initInterstitial) ||
void 0 === a ||
a.call(t, e);
} catch (t) {
recordError(t, { method: "callLngtd", adType: e });
}
}
}),
(l.loadMoment = (e) => {
if (
"undefined" == typeof adsbygoogle ||
!adsbygoogle.loaded ||
0 == adsbygoogle.push.length
)
return (
gtag("event", "h5-no-load", {
event_category: "moments",
event_label: l.label,
value: 1,
}),
void u(e)
);
gtag("event", "h5-load", {
event_category: "moments",
event_label: l.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: l.label,
value: 1,
}),
(t = !0);
},
afterAd: () => {
d("loadMoment afterAd", { linkOrCb: e }),
gtag("event", "h5-fill-after", {
event_category: "moments",
event_label: l.label,
value: 1,
});
},
adBreakDone: () => {
if ((d("loadMoment adBreakDone", { linkOrCb: e }), t))
return (
gtag("event", "h5-passthru", {
event_category: "moments",
event_label: l.label,
value: 1,
}),
void u(e)
);
gtag("event", "h5-no-fill", {
event_category: "moments",
event_label: l.label,
value: 1,
}),
u(e);
},
});
} catch (t) {
recordError(t, { method: "loadMoment" }), u(e);
}
}),
(l.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: l.label,
value: 1,
}),
void u(e, !1)
);
gtag("event", "h5-load", {
event_category: "rewarded-video",
event_label: l.label,
value: 1,
});
try {
let a = !1,
o = !1;
adBreak({
type: "reward",
name: "rewarded",
beforeAd: () => {
gtag("event", "h5-fill", {
event_category: "rewarded-video",
event_label: l.label,
value: 1,
}),
(o = !0);
},
beforeReward: (t) => {
gtag("event", "beforeReward", {
event_category: "rewarded-video",
event_label: l.label,
value: 1,
}),
u(e, t);
},
adDismissed: () => {
gtag("event", "ad-dismissed", {
event_category: "rewarded-video",
event_label: l.label,
value: 1,
});
},
adViewed: () => {
gtag("event", "ad-viewed", {
event_category: "rewarded-video",
event_label: l.label,
value: 1,
}),
(a = !0);
},
afterAd: () => {
gtag("event", "h5-fill-after", {
event_category: "rewarded-video",
event_label: l.label,
value: 1,
});
},
adBreakDone: (i) =>
o
? a
? (gtag("event", "h5-passthru", {
event_category: "rewarded-video",
event_label: i.breakStatus,
value: 1,
}),
void u(t, !0))
: void u(t, !1)
: (gtag("event", "h5-no-fill", {
event_category: "rewarded-video",
event_label: i.breakStatus,
value: 1,
}),
void u(e, !1)),
});
} catch (e) {
console.log(e), u(t, !0);
}
}),
(l.loadLngtdRewarded = (e, t) => {
var a, o, i;
if (
!(null === (a = window.lngtd) || void 0 === a
? void 0
: a.triggerInterstitial)
)
return (
gtag("event", "lngtd-no-load", {
event_category: "rewarded-video",
event_label: "lngtd",
value: 1,
}),
l.loadRewarded(e, t)
);
gtag("event", "h5-load", {
event_category: "rewarded-video",
event_label: "lngtd",
value: 1,
});
try {
let a = !1;
null ===
(i =
null === (o = window.lngtd) || void 0 === o
? void 0
: o.triggerInterstitial) ||
void 0 === i ||
i.call(
o,
{
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,
}),
(a = !0);
},
adDismissed: () => (
gtag("event", "ad-dismissed", {
event_category: "rewarded-video",
event_label: "lngtd",
value: 1,
}),
u(t, !1)
),
adBreakDone: () =>
a
? (gtag("event", "h5-passthru", {
event_category: "rewarded-video",
event_label: "lngtd",
value: 1,
}),
u(t, !0))
: (gtag("event", "h5-no-fill", {
event_category: "rewarded-video",
event_label: "lngtd",
value: 1,
}),
l.loadRewarded(e, t)),
},
"reward"
);
} catch (e) {
console.log(e), u(t, !0);
}
}),
(l.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, a;
(
null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL
? void 0
: SOLITAIRED_GLOBAL.loggedInUser
)
? $.post("/user/no-moments-upgrade", {}, function () {
u(e);
})
: (null ===
(a =
null === (t = window.lngtd) || void 0 === t
? void 0
: t.reset) ||
void 0 === a ||
a.call(t),
showRegisterModal("role=no-moments-user", e));
});
} catch (t) {
console.log(t), u(e);
}
}),
(l.lngtdMoments = (e, t) => {
var a, o, i;
if (
(e ||
(d("link or callback undefined", {
homeUrl: homeUrl,
extraInfo: t,
}),
recordError(new Error("link or callback undefined"), {
homeUrl: homeUrl || "undefined",
extraInfo: t,
})),
l.doesRoleHaveMoments())
) {
if (
!(null === (a = window.lngtd) || void 0 === a
? void 0
: a.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 u(e)
);
gtag("event", "lngtd-load", {
event_category: "lngtd-moments",
event_label: "lngtd",
value: 1,
}),
0 === $("#loadingModal").length &&
$("body").append(
'\n
\n
\n \n
\n
\n '
),
$("#loadingModal").modal("show"),
r && (clearTimeout(r), (r = null)),
(r = window.setTimeout(() => {
$("#loadingModal").modal("hide");
}, 3e3));
try {
l.setUndertoneCloseHandler(e),
null ===
(i =
null === (o = window.lngtd) || void 0 === o
? void 0
: o.triggerInterstitial) ||
void 0 === i ||
i.call(
o,
{
type: "interstitial",
name: "interstitial",
minViewTime: 16e3,
maxAdBreak: 4e4,
altCloseButton: function () {
l.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,
}),
u(e);
},
fallbackFunction: () => {
$("#loadingModal").modal("hide"),
d("lngtdMoments fallbackFunction", {
homeUrl: homeUrl,
extraInfo: t,
}),
l.loadMoment(e);
},
},
"default"
);
} catch (t) {
return (
$("#loadingModal").modal("hide"),
recordError(t, { method: "lngtdMoment" }),
u(e)
);
}
} else u(e);
}),
(l.trackRequireRegistrationActivity = (e) =>
$.post("/forceRegister/track", e)),
(l.setUndertoneCloseHandler = (e) => {
window.undertoneCloseCB = () => {
gtag("event", "undertone-close", {
event_category: "lngtd-moments",
event_label: "lngtd",
value: 1,
}),
u(e);
};
}),
(l.testUndertone = (e) => {
var t, a;
l.setUndertoneCloseHandler(e),
null ===
(a =
null === (t = window.lngtd) || void 0 === t
? void 0
: t.initInterstitial) ||
void 0 === a ||
a.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 = l.testUndertone),
(t.default = l);
},
6910: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.PersonalStats = void 0);
const i = a(9824);
class n {
constructor(e, t, a) {
(this.initialFetchFailed = !1),
(this.storageKey = t),
(this.defaultState = a),
(this.shouldSaveToServer = e),
this.shouldSaveToServer
? (this.initialServerFetchPromise = this.fetchFromServer())
: (this.initialServerFetchPromise = Promise.resolve());
}
cloneStat() {
return JSON.parse(JSON.stringify(this.defaultState));
}
getStats() {
return o(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 o(this, void 0, void 0, function* () {
const a = this.setLocalState(e);
if (this.shouldSaveToServer) return this.saveToServer(a, 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, i.recordError)(e);
}
return t;
}
saveToServer(e, t) {
return new Promise((a) => {
if (this.initialFetchFailed) return a();
const o = t ? "?reset=true" : "";
$.ajax({
type: "POST",
url: `/personal-stats/${this.storageKey}${o}`,
contentType: "application/json; charset=utf-8",
data: JSON.stringify(e),
complete: () => {
a();
},
});
});
}
fetchFromServer() {
return o(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, i.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 a = localStorage.key(t);
(this.PERSONAL_STATS_KEYS.includes(a) ||
a.startsWith(this.PERSONAL_STATS_KEY_PREFIX)) &&
e.push(a);
}
} catch (e) {
(0, i.recordError)(e);
}
return e;
}
static clearLocalStorage() {
try {
this.getLocalStorageKeys().forEach((e) =>
localStorage.removeItem(e)
);
} catch (e) {
(0, i.recordError)(e);
}
}
static saveAllToServer() {
try {
const e = this.getLocalStorageKeys();
let t = [Promise.resolve()];
return (
e.forEach((e) => {
const a = JSON.parse(localStorage.getItem(e)),
o = new Promise((t) => {
$.ajax({
type: "POST",
url: `/personal-stats/${e}`,
contentType: "application/json; charset=utf-8",
data: JSON.stringify(a),
complete: t,
error: t,
});
});
t.push(o);
}),
Promise.all(t)
);
} catch (e) {
(0, i.recordError)(e);
}
}
}
(t.PersonalStats = n),
(n.PERSONAL_STATS_KEYS = ["yahtzee"]),
(n.PERSONAL_STATS_KEY_PREFIX = "personal-stats-");
},
5778: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.PyramidCardArea = void 0);
const i = o(a(2646)),
n = o(a(867)),
r = [
[0, 3],
[0.5, 2.5],
[0.5, 3.5],
[1, 2],
[1, 3],
[1, 4],
[1.5, 1.5],
[1.5, 2.5],
[1.5, 3.5],
[1.5, 4.5],
[2, 1],
[2, 2],
[2, 3],
[2, 4],
[2, 5],
[2.5, 0.5],
[2.5, 1.5],
[2.5, 2.5],
[2.5, 3.5],
[2.5, 4.5],
[2.5, 5.5],
[3, 0],
[3, 1],
[3, 2],
[3, 3],
[3, 4],
[3, 5],
[3, 6],
],
l = {};
t.PyramidCardArea = class {
constructor(e, t) {
(this.rowColMap = r),
(this.cardFactor = 5),
(this.gameVars = e),
Object.assign(this, t);
}
getColumns() {
return (
1.05 *
this.rowColMap.reduce((e, t) => {
const [a, o] = t;
return o >= e ? o + 1 : e;
}, 0) +
this.cardFactor -
7
);
}
getTarget(e, t) {
for (let a = this.piles[0].length - 1; a > -1; a--) {
const o = this.piles[0][a];
if (!o) continue;
const {
xCoord: i,
yCoord: n,
cardWidth: r,
cardHeight: l,
} = this.getCardDimensionValues(0, a, o);
if (i < e && e < i + r && n < t && t < n + l)
return (
(o.position.x = i),
(o.position.y = n),
{
area: this,
card: o,
pile: 0,
position: a,
offsets: { x: e - i, y: t - n },
}
);
}
}
getRowCol(e, t, a) {
return (
l[a.name] || (l[a.name] = this.rowColMap[t]),
{ row: l[a.name][0], col: l[a.name][1] }
);
}
getCardDimensionValues(e, t, a) {
let o = 0,
i = 0;
const r =
a && a.position.rotation < 1
? 2 * (0.5 - a.position.rotation) * n.default.cardWidth
: n.default.cardWidth,
l = n.default.cardHeight,
s = (n.default.cardWidth - r) / 2,
{ row: d, col: u } = this.getRowCol(e, t, a);
return (
(o =
u * (n.default.cardWidth + n.default.cardSpacing) +
s +
n.default.cardSpacing),
(i = d * n.default.cardHeight + n.default.cardSpacing),
{ xCoord: o, yCoord: i, cardWidth: r, cardHeight: l }
);
}
draw() {
var e;
for (let t = 0; t < this.piles.length; t++) {
const a = this.piles[t];
for (let o = 0; o < a.length; o++) {
const a = this.piles[t][o];
if (!a || a.hide) continue;
const {
xCoord: r,
yCoord: l,
cardWidth: s,
cardHeight: d,
} = this.getCardDimensionValues(t, o, a);
let u = "back_red";
if (
((a.turnedup ||
(null === (e = null == a ? void 0 : a.position) ||
void 0 === e
? void 0
: e.rotation) > 0.5) &&
(u = a.name),
(a.position.x = r),
(a.position.y = l),
a.highlight)
) {
n.default.ctx.save();
let e = 0;
for (; e < 4; )
(n.default.ctx.shadowColor = "#52FF52"),
(n.default.ctx.shadowBlur = 20),
n.default.ctx.drawImage(
n.default.images[u],
r,
l,
Math.floor(s),
Math.floor(d)
),
e++;
n.default.ctx.restore();
} else
i.default.tryDrawImage(u, r, l, Math.floor(s), Math.floor(d));
}
}
}
};
},
6771: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = a(9321),
n = a(9824),
r = (0, i.UAParser)().withFeatureCheck(),
l = {
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 Solitaired.com.
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 Solitaired.com.
\n
Please provide your email to participate in the study.
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) =>
o(void 0, void 0, void 0, function* () {
var t, a;
let o = yield l.fetchData();
if (!(null == o ? void 0 : o.data)) {
const i = {
user: {
country: SOLITAIRED_GLOBAL.country,
postal: SOLITAIRED_GLOBAL.postal,
deviceType:
null ===
(a =
null === (t = yield Promise.resolve(r)) ||
void 0 === t
? void 0
: t.device) || void 0 === a
? void 0
: a.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,
},
};
o = yield l.updateData({
status: "geo",
game_id: e,
data: i,
});
}
}),
qualifyForStudy: () =>
o(void 0, void 0, void 0, function* () {
var e;
let t = yield l.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 l.updateData(t)),
null === (e = window.tsRecordEvent) ||
void 0 === e ||
e.call(
window,
"research-study",
"qualify-for-study",
1
),
SOLITAIRED_GLOBAL.loggedInUser
? l.prompt()
: l.promptEmail(),
!0)
: (recordError(
new Error("failed to find research study data")
),
!1);
}),
qualifyForQuestionnaire: () =>
o(void 0, void 0, void 0, function* () {
let e = yield l.fetchData();
(null == e ? void 0 : e.data)
? ((e.status = "started"),
(e = yield l.updateData(e)),
l.questionnaire())
: recordError(
new Error("failed to find research study data")
);
}),
qualifyForTest: (e) =>
o(void 0, void 0, void 0, function* () {
var t, a;
let o = yield l.fetchData();
if (!(null == o ? void 0 : o.data))
return void recordError(
new Error("failed to find research study data")
);
(o.status = "questionnaire"),
(o.data.questionnaireData = e),
(o = yield l.updateData(o));
const i = o.user_id.toString(16),
s =
"mobile" ===
(null ===
(a =
null === (t = yield Promise.resolve(r)) || void 0 === t
? void 0
: t.device) || void 0 === a
? void 0
: a.type)
? 2
: 1,
d =
(0, n.isLocalEnv)() || (0, n.isStagingEnv)()
? `https://studies.testmybrain.org/solitairecog_staging/?study=solitairecog&id=${i}&group=${s}`
: `https://studies.testmybrain.org/solitairecog/?study=solitairecog&id=${i}&group=${s}`;
l.promptTest(d);
}),
qualifyForCompletion: () =>
o(void 0, void 0, void 0, function* () {
let e = yield l.fetchData();
(null == e ? void 0 : e.data)
? ((e.status = "tmb_started"),
(e = yield l.updateData(e)),
l.hide())
: recordError(
new Error("failed to find research study data")
);
}),
complete: (e) =>
o(void 0, void 0, void 0, function* () {
let t;
if (e) return (t = yield l.completeData(e)), void l.congrats();
(t = yield l.fetchData()),
(null == t ? void 0 : t.data)
? ((t.status = "completed"),
(t = yield l.updateData(t)),
l.congrats())
: recordError(
new Error("failed to find research study data")
);
}),
decline: () =>
o(void 0, void 0, void 0, function* () {
let e = yield l.fetchData();
(null == e ? void 0 : e.data)
? ((e.status = "declined"),
(e = yield l.updateData(e)),
l.hide())
: recordError(
new Error("failed to find research study data")
);
}),
fetchData: () =>
o(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) =>
o(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) =>
o(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: () =>
o(void 0, void 0, void 0, function* () {
if ("/study-thanks" === window.location.pathname) {
if (SOLITAIRED_GLOBAL.loggedInUser) return yield l.complete();
let e = new URLSearchParams(window.location.search).get("id");
e || (window.location.href = "/");
try {
const t = parseInt(e, 16);
yield l.complete(t);
} catch (e) {
window.location.href = "/";
}
}
}),
};
t.default = l;
},
8170: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = a(9824),
n = o(a(867));
let r = {
setSpecificGameVars: (e) => {
r.specificGameVars = e;
},
};
(r.isTurnedUp = {
rule: (e) =>
!(
!r.isNotEmpty.rule(e) ||
(1 !== e.card.turnedup &&
((n.default.flashMessage = "Card needs to be face up."), 1))
),
explain: (e) => {
let t = "Cards are face up and playable: ";
return (
(t += `${e.area.piles[e.pile]
.slice(e.position)
.map(i.convertCardToSymbolText)}`),
e.target.card &&
(t += `,${(0, i.convertCardToSymbolText)(e.target.card)}`),
t
);
},
}),
(r.isTopCard = {
rule: (e) =>
!(
!r.isNotEmpty.rule(e) ||
(e.area.piles[e.pile].length - 1 != e.position &&
((n.default.flashMessage = "Card needs to be on top."), 1))
),
}),
(r.targetIsOppositeColor = {
rule: (e) => {
if (!r.isNotEmpty.rule(e)) return !1;
let t =
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position
].suit,
a = e.area.piles[e.pile][e.position].suit,
o = {
diamond: "red",
heart: "red",
club: "black",
spade: "black",
};
return (
o[t] != o[a] ||
((n.default.flashMessage =
"Your card needs to be of the opposite suit color."),
!1)
);
},
explain: (e) =>
`${(0, i.convertCardToSymbolText)(e.card)} and ${(0,
i.convertCardToSymbolText)(
e.target.card
)} suits alternate color.`,
}),
(r.targetIsSameSuit = {
rule: (e) =>
!!r.isNotEmpty.rule(e) &&
(n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position
].suit == e.area.piles[e.pile][e.position].suit ||
((n.default.flashMessage =
"Your card needs to be of the same suit."),
!1)),
explain: (e) =>
`${(0, i.convertCardToSymbolText)(e.card)} and ${(0,
i.convertCardToSymbolText)(e.target.card)} are the same suit.`,
}),
(r.targetIsOneRankUp = {
rule: (e) =>
!!r.isNotEmpty.rule(e) &&
(n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position
].number ===
e.area.piles[e.pile][e.position].number - 1 ||
((n.default.flashMessage =
"Your card needs to be one rank down."),
!1)),
explain: (e) =>
`${(0, i.convertCardToSymbolText)(
e.target.card
)} is one rank above ${(0, i.convertCardToSymbolText)(e.card)}.`,
}),
(r.targetIsOneRankUpWithWrapping = {
rule: (e) => {
if (!r.isNotEmpty.rule(e)) return !1;
let t =
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position
].number,
a = e.area.piles[e.pile][e.position].number;
return (
t === a - 1 ||
(1 == t && 13 == a) ||
((n.default.flashMessage =
"Your card needs to be one rank down."),
!1)
);
},
explain: (e) =>
`${(0, i.convertCardToSymbolText)(
e.target.card
)} is one rank above ${(0, i.convertCardToSymbolText)(e.card)}.`,
}),
(r.targetIsInDifferentPile = {
rule: (e) =>
n.default.fromSet.area.name !== e.area.name ||
n.default.fromSet.pile !== e.pile ||
((n.default.flashMessage =
"Cannot move stack onto itself (same pile)."),
!1),
explain: (e) =>
`${(0, i.convertCardToSymbolText)(
e.target.card
)} is in a different pile than ${(0, i.convertCardToSymbolText)(
e.card
)}.`,
}),
(r.targetIsOneRankDown = {
rule: (e) =>
!!r.isNotEmpty.rule(e) &&
(n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position
].number ===
e.area.piles[e.pile][e.position].number + 1 ||
((n.default.flashMessage =
"Your card needs to be one rank up."),
!1)),
explain: (e) =>
`${(0, i.convertCardToSymbolText)(
e.target.card
)} is one rank below ${(0, i.convertCardToSymbolText)(e.card)}.`,
}),
(r.targetIsOneRankDownWithWrapping = {
rule: (e) => {
if (!r.isNotEmpty.rule(e)) return !1;
let t =
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position
].number,
a = e.area.piles[e.pile][e.position].number;
return (
t === a + 1 ||
(13 == t && 1 == a) ||
((n.default.flashMessage =
"Your card needs to be one rank up."),
!1)
);
},
explain: (e) =>
`${(0, i.convertCardToSymbolText)(
e.target.card
)} is one rank below ${(0, i.convertCardToSymbolText)(e.card)}.`,
}),
(r.ifEmptyAndAce = {
rule: (e) =>
e.area.piles[e.pile].length > 0
? ((n.default.flashMessage = "Pile needs to be empty."), !1)
: !(
r.isEmpty.rule(n.default.fromSet) ||
(1 !==
n.default.fromSet.area.piles[n.default.fromSet.pile][
n.default.fromSet.position
].number &&
((n.default.flashMessage =
"Your card needs to be an Ace."),
1))
),
}),
(r.isEmpty = {
rule: (e) =>
0 == e.area.piles[e.pile].length ||
((n.default.flashMessage = "Pile needs to be empty."), !1),
}),
(r.noCardsRemaining = {
rule: (e) =>
0 == e.area.piles[e.pile].length ||
!e.area.piles[e.pile].find((e) => !!e) ||
((n.default.flashMessage = "Pile needs to be empty."), !1),
}),
(r.isNotEmpty = {
rule: (e) =>
!!(
e.area &&
e.card &&
e.area.piles[e.pile] &&
e.area.piles[e.pile][e.position]
) || ((n.default.flashMessage = "Pile cannot be empty."), !1),
}),
(r.remainingSuitsAlternate = {
rule: () => {
let e = {
diamond: "red",
heart: "red",
club: "black",
spade: "black",
},
t = n.default.fromSet.area.piles[n.default.fromSet.pile].slice(
n.default.fromSet.position
),
a = null;
for (let o = 0; o < t.length; o++)
if (null != a) {
if (a == e[t[o].suit])
return (
(n.default.flashMessage =
"All suit colors must alternate."),
!1
);
a = e[t[o].suit];
} else a = e[t[o].suit];
return !0;
},
}),
(r.targetSuitsAlternate = {
rule: (e) => {
let t = {
diamond: "red",
heart: "red",
club: "black",
spade: "black",
},
a = e.area.piles[e.pile],
o = null;
for (let e = 0; e < a.length; e++)
if (null != o) {
if (o == t[a[e].suit])
return (
(n.default.flashMessage =
"All suit colors must alternate."),
!1
);
o = t[a[e].suit];
} else o = t[a[e].suit];
return !0;
},
}),
(r.remainingCardsTurnedUp = {
rule: () => {
for (let e = 0; e < n.default.fromSet.area.piles.length; e++)
for (let t = 0; t < n.default.fromSet.area.piles[e].length; t++)
if (0 == n.default.fromSet.area.piles[e][t].turnedup)
return !1;
return !0;
},
}),
(r.remainingCardsTurnedUpOnTarget = {
rule: (e) => {
for (let t = 0; t < e.area.piles.length; t++)
for (let a = 0; a < e.area.piles[t].length; a++)
if (0 == e.area.piles[t][a].turnedup) return !1;
return !0;
},
}),
(r.remainingSuitsSame = {
rule: () => {
let e = n.default.fromSet.area.piles[
n.default.fromSet.pile
].slice(n.default.fromSet.position),
t = null;
for (let a = 0; a < e.length; a++)
if (null != t) {
if (t !== e[a].suit)
return (
(n.default.flashMessage = "All suits must be the same."),
!1
);
t = e[a].suit;
} else t = e[a].suit;
return !0;
},
}),
(r.targetRemainingSuitsSame = {
rule: (e) => {
let t = {
diamond: "red",
heart: "red",
club: "black",
spade: "black",
},
a = e.area.piles[e.pile],
o = null;
for (let e = 0; e < a.length; e++)
if (null != o) {
if (o != t[a[e].suit])
return (
(n.default.flashMessage = "All suits must be the same."),
!1
);
} else o = t[a[e].suit];
return !0;
},
}),
(r.startsWithKingOrEmpty = {
rule: (e) =>
0 == e.area.piles[e.pile].length ||
13 == e.area.piles[e.pile][0].number,
}),
(r.targetRanksDecrement = {
rule: (e) => {
let t = e.area.piles[e.pile],
a = null;
for (let e = 0; e < t.length; e++)
if (null != a) {
if (t[e].number >= a)
return (
(n.default.flashMessage =
"Your cards must be sequenced from high to low one by one."),
!1
);
a = t[e].number;
} else a = t[e].number;
return !0;
},
}),
(r.remainingRanksDecrement = {
rule: () => {
let e = n.default.fromSet.area.piles[
n.default.fromSet.pile
].slice(n.default.fromSet.position),
t = null;
for (let a = 0; a < e.length; a++)
if (null != t) {
if (t !== e[a].number + 1)
return (
(n.default.flashMessage =
"Your cards must be sequenced from high to low one by one."),
!1
);
t = e[a].number;
} else t = e[a].number;
return !0;
},
}),
(r.forceFalse = { rule: () => !1 }),
(r.forceTrue = { rule: () => !0 }),
(r.targetIsLastCard = {
rule: (e) =>
e.area.piles[e.pile].length - 1 == e.position ||
((n.default.flashMessage =
"Card can only be dropped on top card of a pile."),
!1),
}),
(r.targetIsUncovered = {
rule: (e) => {
if (!e.card) return !1;
const t = e.area.getCardDimensionValues(
e.pile,
e.position,
e.card
);
for (
let u = e.position + 1;
u < e.area.piles[e.pile].length;
u++
) {
const f = e.area.piles[e.pile][u];
if (!f) continue;
const c = e.area.getCardDimensionValues(e.pile, u, f);
if (
((a = t.xCoord),
(o = t.yCoord),
(i = t.cardWidth),
(n = t.cardHeight),
(r = c.xCoord),
(l = c.yCoord),
(s = c.cardWidth),
(d = c.cardHeight),
a < r + s && a + i > r && o < l + d && o + n > l)
)
return !1;
}
var a, o, i, n, r, l, s, d;
return !0;
},
}),
(r.sumOfFromAndTargetIs13 = {
rule: (e) =>
!(!n.default.fromSet.card || !e.card) &&
(n.default.fromSet.card.name == e.card.name
? 13 == n.default.fromSet.card.number
: n.default.fromSet.card.number + e.card.number == 13),
}),
(r.targetIsNotLastCard = {
rule: (e) => e.area.piles[e.pile].length - 1 != e.position,
}),
(r.freecellIsCorrectCount = {
rule: (e) => {
let t = n.default.fromSet.area.piles[
n.default.fromSet.pile
].slice(n.default.fromSet.position);
if (1 == t.length) return !0;
let a = 0;
for (
let e = 0;
e < r.specificGameVars.cellsArea.piles.length;
e++
)
0 == r.specificGameVars.cellsArea.piles[e].length && a++;
if (t.length <= a + 1) return !0;
let o = 0;
for (
let t = 0;
t < r.specificGameVars.tableauArea.piles.length;
t++
)
0 == r.specificGameVars.tableauArea.piles[t].length &&
e.pile !== t &&
o++;
const i = Math.pow(2, o) * (a + 1);
return (
t.length <= i ||
((n.default.flashMessage =
"Not enough empty cells or columns to drag cards. Can drag " +
i +
" at most."),
!1)
);
},
}),
(r.fromIsLastCard = {
rule: () =>
n.default.fromSet.area.piles[n.default.fromSet.pile].length - 1 ==
n.default.fromSet.position ||
((n.default.flashMessage = "Only the last card can be dragged."),
!1),
}),
(r.fromIsKing = {
rule: () =>
13 == n.default.fromSet.card.number ||
((n.default.flashMessage = "Only the last card can be dragged."),
!1),
}),
(r.targetMaxOneCard = {
rule: (e) =>
!(
e.area.piles[e.pile].length > 0 &&
((n.default.flashMessage = "Pile can only hold one card."), 1)
),
}),
(t.default = r);
},
8623: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
},
i =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const n = i(a(867)),
r = i(a(7583)),
l = i(a(8958)),
s = i(a(2824)),
d = i(a(768)),
u = a(4274),
f = a(8164),
c = a(9824),
p = a(5454),
m = a(8206),
g = a(166),
h = i(a(265)),
v = i(a(6771)),
w = i(a(2094)),
y = i(a(3415));
let b,
S = "score";
$(document).on(
"click",
"#moves-leaderboard-header, #time-leaderboard-header, #score-leaderboard-header",
function (e) {
const t = e.target.dataset.metric;
e.preventDefault();
try {
gtag("event", "sort-leaderboard", {
event_category: "leaderboard",
event_label: t,
value: 1,
});
} catch (e) {
console.error(e);
}
t != S &&
((S = t),
T.fetchAndShowLeaderboard(T.finalTime, T.finalMoves),
$(".leaderboard-column-sort").addClass("d-none"),
$(
`#${t}-leaderboard-header .leaderboard-column-sort`
).removeClass("d-none"));
}
);
let x,
k = !1,
T = {};
((0, c.isLocalEnv)() || (0, c.isStagingEnv)()) && (window.score = T),
(T.getStatsStore = () =>
b ||
((b =
"las-vegas-klondike" == nameSlug
? new f.LasVegasSolitairePersonalStats(
null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL
? void 0
: SOLITAIRED_GLOBAL.loggedInUser,
1
)
: "las-vegas-klondike-turn-3" == nameSlug
? new f.LasVegasSolitairePersonalStats(
null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL
? void 0
: SOLITAIRED_GLOBAL.loggedInUser,
3
)
: new u.SolitairePersonalStats(
null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL
? void 0
: SOLITAIRED_GLOBAL.loggedInUser,
nameSlug
)),
b)),
(T.setStatsStore = (e) => {
b = e;
}),
(T.startGame = () => {
T.getStatsStore().startGame();
}),
(T.seedSaved = !1),
(T.finalMoves = null),
(T.finalTime = null),
(T.copyText = () => {
navigator.clipboard.writeText(
"I won in " +
T.finalTime[0] +
" minutes and " +
T.finalTime[1] +
" seconds, in " +
T.finalMoves +
" moves. Can you beat me? Play here: https://www.solitaire.plus" +
homeUrl +
"?seed=" +
seed
);
}),
(T.refreshPersonalStats = () => {
T.getStatsStore()
.getDisplayStats()
.then((e) => {
$(".stats-win-rate").text(`${e.winPercentage}`),
$(".stats-win-rate-container").attr(
"title",
`${e.won} won / ${e.started} total`
),
$(".stats-fastest-time").text(e.formattedFastestTime),
$(".stats-lowest-moves").text(e.formattedleastMoves),
$(".stats-best-score").text(e.formattedBestScore),
$(".stats-gotd").text(`${e.formattedGotdStreak}`),
$(".stats-gotd-date").text(`${e.formattedStreakDate}`);
const t = new Date(),
a = new Date(e.gotdStreakLastTimestamp),
o = t.toDateString() === a.toDateString();
if (gameOfTheDay || o)
gameOfTheDay && !o
? $(".gotd-streak-flex").tooltip({
html: !0,
title:
'\n
');
return r;
}),
(T.updateEndOfGamePersonalStats = () => {
T.getStatsStore()
.getDisplayStats()
.then((e) => {
$("#congrats #personal-stats-win-percentage").text(
e.dailyWinPercentage
),
$("#congrats #personal-stats-win-percentage").attr(
"title",
`${e.dailyWon} won / ${e.dailyStarted} total`
),
$("#congrats #personal-stats-monthly-win-percentage").text(
e.monthlyWinPercentage
),
$("#congrats #personal-stats-monthly-win-percentage").attr(
"title",
`${e.monthlyWon} won / ${e.monthlyStarted} total`
),
$("#congrats #personal-stats-lifetime-win-percentage").text(
e.winPercentage
),
$("#congrats #personal-stats-lifetime-win-percentage").attr(
"title",
`${e.won} won / ${e.started} total`
),
$("#congrats #personal-stats-best-score").text(
e.formattedDailyBestScore
),
$("#congrats #personal-stats-monthly-best-score").text(
e.formattedMonthlyBestScore
),
$("#congrats #personal-stats-lifetime-best-score").text(
e.formattedBestScore
),
T.showPrTrophy(
e.dailyBestScorePR,
"#personal-stats-best-score-pr"
),
T.showPrTrophy(
e.monthlyBestScorePR,
"#personal-stats-monthly-best-score-pr"
),
T.showPrTrophy(
e.bestScorePR,
"#personal-stats-lifetime-best-score-pr"
),
$("#congrats #personal-stats-fastest-time").text(
e.formattedDailyFastestTime
),
$("#congrats #personal-stats-monthly-fastest-time").text(
e.formattedMonthlyFastestTime
),
$("#congrats #personal-stats-lifetime-fastest-time").text(
e.formattedFastestTime
),
T.showPrTrophy(
e.dailyFastestTimePR,
"#personal-stats-fastest-time-pr"
),
T.showPrTrophy(
e.monthlyFastestTimePR,
"#personal-stats-monthly-fastest-time-pr"
),
T.showPrTrophy(
e.fastestTimePR,
"#personal-stats-lifetime-fastest-time-pr"
),
$("#congrats #personal-stats-least-moves").text(
e.formattedDailyLeastMoves
),
$("#congrats #personal-stats-monthly-least-moves").text(
e.formattedMonthlyLeastMoves
),
$("#congrats #personal-stats-lifetime-least-moves").text(
e.formattedleastMoves
),
T.showPrTrophy(
e.dailyLeastMovesPR,
"#personal-stats-least-moves-pr"
),
T.showPrTrophy(
e.monthlyLeastMovesPR,
"#personal-stats-monthly-least-moves-pr"
),
T.showPrTrophy(
e.leastMovesPR,
"#personal-stats-lifetime-least-moves-pr"
);
});
}),
(T.saveSeed = () => {
if (((0, c.exitFullScreen)(), T.seedSaved)) return;
(T.seedSaved = !0),
(n.default.gameWon = !0),
s.default.callLngtd("default"),
y.default.stop();
let e = l.default.get(),
t = n.default.turns;
const a = l.default.getSeconds(),
i = l.default.getPause();
let r = {
gameId: window.gameId,
seed: seed,
game: nameSlug,
turns: t,
time: e,
pauseTime: i,
innerWidth: window.innerWidth,
innerHeight: window.innerHeight,
undoCount: g.undoCount,
hintCount: h.default.hintsGiven,
upMoveCount: w.default.upMoveCount,
hkMoveCount: w.default.hkMoveCount,
autoMoveCount: w.default.autoMoveCount,
};
T.getStatsStore().winGame(a, t, t + a),
$.post("/seed/save", r),
$.post("/high-scores/update", r, function (e) {
return o(this, void 0, void 0, function* () {
(x = e.gameData),
e.gameId && (window.gameId = e.gameId),
T.triggerHighScores(),
T.refreshPersonalStats(),
"klondike-turn-1" == nameSlug &&
gameOfTheDay &&
!n.default.isReplay &&
(0, c.checkTestBucket)("RESEARCH_STUDY_3", 1) &&
(yield v.default.qualifyForGeo(window.gameId),
(null === SOLITAIRED_GLOBAL ||
void 0 === SOLITAIRED_GLOBAL
? void 0
: SOLITAIRED_GLOBAL.researchStudyCount) < 150 &&
(k = !0));
});
}).fail(function () {
T.triggerHighScores(), T.refreshPersonalStats();
}),
window.dispatchEvent(n.default.gameWonEvent);
}),
(T.fetchAndShowLeaderboard = (e, t) => {
(0, c.postWithRetry)(
"/high-scores/highscore2",
{
seed: seed,
time: e,
moves: t,
game: nameSlug,
gameId: window.gameId,
gotd: gameOfTheDay,
isReplay: n.default.isReplay,
rankingMethod: S,
},
3,
function (t) {
T.updateCongratsModal(
t,
e,
n.default.turns,
congratsMessage,
homeUrl,
seed
);
}
).catch(() => {
recordError(new Error("highscore2 failed to post"));
});
}),
(T.triggerHighScores = () => {
var e;
if (
!n.default.gameWon &&
!(0, c.isLocalEnv)() &&
!(0, c.isStagingEnv)()
)
return;
let t = l.default.get(),
a = n.default.turns;
(T.finalMoves = a),
(T.finalTime = t),
T.fetchAndShowLeaderboard(t, a);
const o = T.getResetWarningMessage();
o &&
(SOLITAIRED_GLOBAL.loggedInUser ||
$(".congrats-message").html(o)),
$.post(
`/high-scores/stats-personal?extended=false&useDailyStats=true&game=${nameSlug}`,
{ gameData: x },
(e) => {
$("#congrats .congrats-stats").html(""),
$("#congrats .congrats-stats").append(e),
T.updateEndOfGamePersonalStats();
}
).catch(() => {
recordError(new Error("request failed to post"));
}),
!window.gameOfTheDay ||
n.default.isReplay ||
n.default.isRestoredGame ||
((null === (e = SOLITAIRED_GLOBAL.seedStats) || void 0 === e
? void 0
: e.moves) &&
SOLITAIRED_GLOBAL.seedStats.moves < a) ||
$.post("/high-scores/moves-data", {
seed: seed,
game: nameSlug,
moves: a,
movesData: JSON.stringify(d.default.getMovesData()),
}).fail(() => {
recordError(new Error("moves-data failed to post"), {
method: "POST /high-scores/moves-data",
});
});
});
const M = {
tripeaks: {
link: "/fourpeaks-solitaire",
text: "Play Fourpeaks",
self: "Tripeaks",
},
fourpeaks: {
link: "/diamond-solitaire",
text: "Play Diamond",
self: "Fourpeaks",
},
diamond: {
link: "/five-bridges-solitaire",
text: "Play Five Bridges",
self: "Diamond",
},
fivebridges: {
link: "/hole-in-one-solitaire",
text: "Play Hole in One",
self: "Five Bridges",
},
holeinone: {
link: "/tripeaks",
text: "Play Tripeaks",
self: "Hole in One",
},
},
C = [
'Fourpeaks Solitaire',
'Diamond Solitaire',
'Las Vegas Solitaire',
'Five Bridges Solitaire',
'Hole in One Solitaire',
];
(T.updateCongratsModal = (e, t, a, o, i, n) => {
var l, s, d, u;
r.default.congrats(),
$("#congrats .congrats-title").html(
o.replace("%%TIME%%", t).replace(/%%TURNS%%/g, a.toString())
),
$("#congrats").show(),
$("#congrats").trigger("shown"),
$(
".highscore-body .table tbody, div.congrats-inner, div.congrats-bottom"
).html("");
let f = "Save";
(0, c.isMobile)() &&
((0, m.tryLngtdRetireAnchor)(), (f = "Add name"));
let g = ``,
h = !1;
const v = e.data[e.data.length - 1];
let w = (null == v ? void 0 : v.score) || 0,
y = { score: "userScore", time: "userSeconds", moves: "userMoves" }[
S
];
0 == w.length && ((w = v.completion_time), (y = "userSeconds"));
let b = "",
x = !1;
e.showScore || $("#congrats .score-column").hide();
const k = $("#congrats .table tbody");
for (let t = 0; t < e.data.length; t++) {
let a,
o = e.data[t];
if ("split" == o) {
k.append(
'
\n
\n \n
\n
\n '
);
continue;
}
if (o.trophies) {
const e = (0, p.getTrophyData)(parseInt(o.trophies));
let t;
e.length > 0 && (t = e[e.length - 1]),
(a = `\n `);
}
(b = ""),
o.user_id == e.userId &&
o.score == e.userScore &&
((b = "light-yellow font-weight-bold"), (x = !0)),
e.userId == o.user_id &&
e.userId.toString().length < 11 &&
o.score < e.userScore &&
0 == b.length &&
(h = !0);
let i = o.username.split("@")[0],
n = (0, c.getDisplayUsername)(i, o.user_id, o.shadow_ban);
i.length > 25 && (i = i.substring(0, 22) + "...");
let r = "";
if (
!o.private &&
(null === (l = o.country) || void 0 === l ? void 0 : l.length) > 0
) {
let e = o.country.toUpperCase();
r += ``;
}
a && (r += `${a}`),
(r += `${n}`),
e.userId &&
e.userId.toString().length > 11 &&
o.user_id == e.userId &&
(r = g);
let d = "";
e.showScore && (d = '
' + o.score + "
"),
k.append(
`\n
\n
${
o.rank + 1
}.
\n
${r}
\n
${
o.moves
}
\n
${
o.time
}
\n ${d}\n
\n `
),
a && $(".score-username-trophy").tooltip({ boundary: "window" }),
(null === (s = o.country) || void 0 === s ? void 0 : s.length) >
0 && $(".score-flag").tooltip({ boundary: "window" });
}
x &&
window.setTimeout(function () {
var e, t;
null ===
(t =
null ===
(e = $(".highscore-body").find(
"tr.light-yellow.font-weight-bold"
)) || void 0 === e
? void 0
: e.get(0)) ||
void 0 === t ||
t.scrollIntoView({ block: "nearest" });
}, 50),
$(".highscore-body .table").show(),
(e[y] <= w || e.data.length < 20) &&
x &&
$(".congrats-inner").append(
`
You placed #${e.rank} of ${e.rankTotal}!`
),
h &&
$("#congrats .congrats-bottom").prepend(
`
We only show your best score above. On this game, you scored ${e.userScore} (${e.userTime} time and ${e.userMoves} moves).
`
);
const T = SOLITAIRED_GLOBAL.hideWinnable,
A = SOLITAIRED_GLOBAL.hideGameOfDay,
O = new URLSearchParams(window.location.search).get("difficulty");
let _ = Math.random(),
E = i;
E = O
? i + "?difficulty=" + O
: !T && _ < 0.5
? i + "?deal=winnable"
: i + "?deal=random";
const L = "undefined" != typeof gameOfTheDay && gameOfTheDay,
D = L ? `${i}?game-of-the-day=true` : `${i}?seed=${n}`;
let P, I;
if (
null === (d = SOLITAIRED_GLOBAL.trendingGames) || void 0 === d
? void 0
: d.length
) {
P = !!(null === (u = SOLITAIRED_GLOBAL.trendingGames) ||
void 0 === u
? void 0
: u.find((e) => e.seed === n));
const e = SOLITAIRED_GLOBAL.trendingGames.findIndex(
(e) => e.seed === n
);
I = SOLITAIRED_GLOBAL.trendingGames
.slice(e + 1)
.concat(SOLITAIRED_GLOBAL.trendingGames.slice(0, e + 1))
.find((e) => e.seed !== n && !e.highscore);
}
let F = '
',
R = '
';
nameSlug in M
? (M[nameSlug].link.indexOf("tripeaks") < 0 &&
(F +=
'
Next Tripeaks variation:
'),
(F +=
'
`),
(R += `
`))
: n && P && (null == I ? void 0 : I.seed)
? (F += ``)
: (F += ``),
$("#congrats .congrats-bottom").append(F),
T ||
(R +=
''),
(R += ``),
nameSlug in M ||
(R += P
? ''
: C[Math.floor(Math.random() * C.length)]),
L && (null == I ? void 0 : I.seed)
? ((R += ``),
(R += ""))
: A ||
((R +=
''),
(R += "")),
$("#congrats .congrats-bottom").append(R),
"undefined" != typeof klondikeMultiplayer &&
klondikeMultiplayer &&
$("#congrats .congrats-bottom").html(
"
You beat " +
playerTwoUsername +
'!
'
);
}),
$("body").on("click", "#shareScore", function () {
T.copyText(),
$(this).tooltip("show"),
window.setTimeout(function () {
$("#shareScore").tooltip("hide");
}, 2e3),
gtag("event", "click", {
event_category: "share",
event_label: "copy",
value: 1,
});
}),
$("body").on("click", "#closeCongrats", function () {
$("#congrats").hasClass("minimizeCongrats")
? $("#congrats").fadeOut(500, function () {
$(
".congrats-title, .congrats-stats, .stats-jumbotron, .congrats-inner, .highscore-body"
).show(),
$("#congrats").addClass("maximizeCongrats").fadeIn(),
$("#congrats").removeClass("minimizeCongrats"),
$("#closeCongrats").html("×");
})
: $("#congrats").fadeOut(500, function () {
$(
".congrats-title, .congrats-stats, .stats-jumbotron, .congrats-inner, .highscore-body"
).hide(),
$("#congrats").addClass("minimizeCongrats").fadeIn(),
$("#congrats").removeClass("maximizeCongrats"),
$("#closeCongrats").text("+");
});
});
let A = !1;
$("body").on("click", "[data-link]", function (e) {
return o(this, void 0, void 0, function* () {
if (k && ((k = !1), yield v.default.qualifyForStudy())) return;
let t = $(this).data("link");
if (
"no-moments-user" ==
(null === SOLITAIRED_GLOBAL || void 0 === SOLITAIRED_GLOBAL
? void 0
: SOLITAIRED_GLOBAL.role)
)
return (window.location.href = t);
A && (window.location.href = t),
setTimeout(() => {
A = !0;
}, 1e3),
s.default.tryShowMoments(
n.default.gameStartTime,
e,
n.default.gameWon
);
});
}),
$("#stats-dropdown").on("click", () => {
T.refreshPersonalStats();
}),
$(".stats-win-rate").length > 0 && T.refreshPersonalStats(),
$("body").on("click", ".reset-stats", () => {
window.confirm(
"All of your personal stats will be deleted. They cannot be recovered afterwards. Are you sure you want to reset?"
) &&
T.getStatsStore()
.resetStats()
.then(() => {
T.refreshPersonalStats(), T.updateEndOfGamePersonalStats();
});
}),
(t.default = T);
},
4274: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.SolitairePersonalStats = void 0);
const i = a(6910),
n = a(9824),
r = {
fastestTime: null,
leastMoves: null,
bestScore: null,
month: null,
monthlyStarted: 0,
monthlyWon: 0,
monthlyFastestTime: null,
monthlyLeastMoves: null,
monthlyBestScore: null,
day: null,
dailyStarted: 0,
dailyWon: 0,
dailyFastestTime: null,
dailyLeastMoves: null,
dailyBestScore: null,
gotdStreakCount: 0,
gotdStreakLastTimestamp: 0,
started: 0,
won: 0,
lastRewardDay: null,
};
class l extends i.PersonalStats {
constructor(e, t) {
super(e, `personal-stats-solitaire-${t}`, r),
(this.curWinTime = 0),
(this.curWinMoves = 0),
(this.curWinScore = 0),
!e &&
this.isEmpty() &&
(0, n.checkTestBucket)("GUEST_USER_STATS", 1) &&
(this.initialServerFetchPromise = this.fetchFromServer());
}
resetStats() {
return o(this, void 0, void 0, function* () {
const e = JSON.parse(JSON.stringify(r));
yield this.saveStats(e, !0);
});
}
getAndResetDailyAndMonthlyStatsIfNeeded() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStats(),
t = new Date(),
a = `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`,
o = `${t.getFullYear()}-${t.getMonth()}`;
return (
e.day !== a &&
((e.dailyStarted = 0),
(e.dailyWon = 0),
(e.dailyFastestTime = null),
(e.dailyLeastMoves = null),
(e.dailyBestScore = null),
(e.day = a)),
e.month !== o &&
((e.monthlyStarted = 0),
(e.monthlyWon = 0),
(e.monthlyBestScore = null),
(e.monthlyFastestTime = null),
(e.monthlyLeastMoves = null),
(e.month = o)),
e
);
});
}
startGame() {
return o(this, void 0, void 0, function* () {
const e = yield this.getAndResetDailyAndMonthlyStatsIfNeeded();
e.started++,
e.dailyStarted++,
e.monthlyStarted++,
yield this.saveStats(e);
});
}
updateGameOfTheDayStreak(e) {
const t = (0, n.getCurrentDate)(),
a = new Date(e.gotdStreakLastTimestamp),
o = (0, n.getDaysDiff)(a, t);
1 === o ? e.gotdStreakCount++ : o > 1 && (e.gotdStreakCount = 1),
(e.gotdStreakLastTimestamp = t.getTime());
}
editGameOfTheDayStreak(e) {
return o(this, void 0, void 0, function* () {
const t = yield this.getStats(),
a = (0, n.getCurrentDate)();
(t.gotdStreakCount = Math.max(e, 0)),
t.gotdStreakCount > 0
? (t.gotdStreakLastTimestamp = a.getTime())
: (t.gotdStreakLastTimestamp = null),
yield this.saveStats(t);
});
}
winGame(e, t, a) {
return o(this, void 0, void 0, function* () {
const o = yield this.getAndResetDailyAndMonthlyStatsIfNeeded();
o.won++,
o.dailyWon++,
o.monthlyWon++,
(this.curWinTime = e),
(this.curWinMoves = t),
(this.curWinScore = a),
"undefined" != typeof gameOfTheDay &&
gameOfTheDay &&
this.updateGameOfTheDayStreak(o),
(null == o.fastestTime || o.fastestTime > e) &&
(o.fastestTime = e),
(null == o.leastMoves || o.leastMoves > t) &&
(o.leastMoves = t),
(null == o.bestScore || o.bestScore > a) && (o.bestScore = a),
(null == o.monthlyBestScore || o.monthlyBestScore > a) &&
(o.monthlyBestScore = a),
(null == o.monthlyFastestTime || o.monthlyFastestTime > e) &&
(o.monthlyFastestTime = e),
(null == o.monthlyLeastMoves || o.monthlyLeastMoves > t) &&
(o.monthlyLeastMoves = t),
(null == o.dailyBestScore || o.dailyBestScore > a) &&
(o.dailyBestScore = a),
(null == o.dailyFastestTime || o.dailyFastestTime > e) &&
(o.dailyFastestTime = e),
(null == o.dailyLeastMoves || o.dailyLeastMoves > t) &&
(o.dailyLeastMoves = t),
yield this.saveStats(o);
});
}
addWin() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStats();
(e.won = Math.min(e.won + 1, e.started)),
(e.dailyWon = Math.min(e.dailyWon + 1, e.dailyStarted)),
(e.monthlyWon = Math.min(e.monthlyWon + 1, e.monthlyStarted)),
yield this.saveStats(e);
});
}
NAifNull(e) {
return null != e ? e.toString() : "-";
}
formatTime(e) {
if (null == e) return "-";
let t = Math.floor(e / 60);
return `${t ? t.toString() : "0"}:${`00${Math.floor(
(e - 60 * t) % 60
)}`.slice(-2)}`;
}
formatWinPercentage(e) {
return e ? e.toFixed(2) : "-";
}
getDisplayStats() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStats();
let t = (e.won / (e.started || 1)) * 100;
t = Math.min(t, 100);
let a = (e.dailyWon / (e.dailyStarted || 1)) * 100;
a = Math.min(a, 100);
let o = (e.monthlyWon / (e.monthlyStarted || 1)) * 100;
o = Math.min(o, 100);
const i = this.formatTime(e.fastestTime),
r = this.formatTime(e.monthlyFastestTime),
l = this.formatTime(e.dailyFastestTime),
s = this.NAifNull(e.bestScore),
d = this.NAifNull(e.monthlyBestScore),
u = this.NAifNull(e.dailyBestScore),
f = this.NAifNull(e.leastMoves),
c = this.NAifNull(e.monthlyLeastMoves),
p = this.NAifNull(e.dailyLeastMoves);
let m = new Date(e.gotdStreakLastTimestamp);
const g = (0, n.getCurrentDate)(),
h = (0, n.getDaysDiff)(m, g);
let v = 0 === h;
h > 1 && (e.gotdStreakCount = 0);
let w = `${e.gotdStreakCount}`,
y = "N/A";
return (
e.gotdStreakCount > 0 &&
(y = `${m.getMonth() + 1}/${m.getDate()}`),
Object.assign(
{
winPercentage: this.formatWinPercentage(t),
dailyWinPercentage: this.formatWinPercentage(a),
monthlyWinPercentage: this.formatWinPercentage(o),
formattedBestScore: s,
formattedMonthlyBestScore: d,
formattedDailyBestScore: u,
formattedStreakDate: y,
streakCompletedToday: v,
formattedleastMoves: f,
formattedMonthlyLeastMoves: c,
formattedDailyLeastMoves: p,
formattedFastestTime: i,
formattedMonthlyFastestTime: r,
formattedDailyFastestTime: l,
formattedGotdStreak: w,
fastestTimePR: this.curWinTime <= e.fastestTime,
leastMovesPR: this.curWinMoves <= e.leastMoves,
bestScorePR: this.curWinScore <= e.bestScore,
monthlyFastestTimePR:
this.curWinTime <= e.monthlyFastestTime,
monthlyLeastMovesPR:
this.curWinMoves <= e.monthlyLeastMoves,
monthlyBestScorePR: this.curWinScore <= e.monthlyBestScore,
dailyFastestTimePR: this.curWinTime <= e.dailyFastestTime,
dailyLeastMovesPR: this.curWinMoves <= e.dailyLeastMoves,
dailyBestScorePR: this.curWinScore <= e.dailyBestScore,
},
e
)
);
});
}
shouldReceiveDailyBonus() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStats(),
t = new Date(),
a = `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
return e.lastRewardDay !== a;
});
}
receivedDailyBonus() {
return o(this, void 0, void 0, function* () {
const e = yield this.getStats(),
t = new Date(),
a = `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
return (e.lastRewardDay = a), yield this.saveStats(e), e;
});
}
}
t.SolitairePersonalStats = l;
},
8958: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = o(a(867)),
n = {
running: !1,
paused: !1,
display: null,
results: null,
laps: [],
times: [0, 0, 0],
pauseTimes: [0, 0, 0],
set: (e, t) => {
(n.display = e), (n.results = t), n.reset(), n.print();
},
reset: () => {
(n.times = [0, 0, 0]), (n.pauseTimes = [0, 0, 0]);
},
start: () => {
n.time || (n.time = performance.now()),
(n.paused = !1),
n.running ||
((n.running = !0), requestAnimationFrame(n.step.bind(n)));
},
lap: () => {
const e = n.times,
t = document.createElement("li");
(t.innerText = n.format(e)), n.results.appendChild(t);
},
pause: () => {
n.paused = !0;
},
stop: () => {
if (n.running) return (n.running = !1), void (n.time = null);
},
restart: () => {
n.time || (n.time = performance.now()),
n.running ||
((n.running = !0),
(n.paused = !1),
requestAnimationFrame(n.step.bind(n))),
n.reset();
},
clear: () => {
n.clearChildren(n.results);
},
get: () => n.times,
getPause: () => n.pauseTimes,
getSeconds: () => {
const e = n.times,
t = 60 * e[0] + e[1] + e[2] / 1e3;
return Math.round(t);
},
update: (e, t, a) => {
(n.times[0] = parseInt(e)),
(n.times[1] = parseInt(t)),
(n.times[2] = parseInt(a));
},
};
let r = null;
(n.step = (e) => {
n.running &&
(n.calculate(e),
(n.time = e),
n.print(),
r ||
(r = setInterval(() => {
n.step(performance.now());
}, 500)));
}),
(n.addTime = (e) => {
n.time || n.start(), (n.time = n.time - e);
}),
(n.calculate = (e) => {
const t = e - n.time;
let a = n.paused ? n.pauseTimes : n.times;
(a[2] += t / 10),
a[2] >= 100 &&
((a[1] += Math.floor(a[2] / 100)), (a[2] = a[2] % 100)),
a[1] >= 60 &&
((a[0] += Math.floor(a[1] / 60)), (a[1] = a[1] % 60));
}),
(n.print = () => {
n.display.innerText = n.format(n.times);
}),
(n.format = (e) =>
` ${n.pad0(e[0], 2)}: ${n.pad0(e[1], 2)}`),
(n.pad0 = (e, t) => {
let a = e.toString();
for (; a.length < t; --t) a = "0" + a;
return a;
}),
(n.clearChildren = (e) => {
for (; e.lastChild; ) e.removeChild(e.lastChild);
}),
$(".timer-button").on("click", function () {
const e = $("#pause-modal");
if ($(this).hasClass("playing")) {
$(".timer-icon").html("►"), $(this).removeClass("playing");
try {
gtag("event", "click", {
event_category: nameSlug,
event_label: "pause-game",
value: 1,
});
} catch (e) {
console.log(e);
}
n.pause();
} else {
$(".timer-icon").html("❙❙"),
$(this).addClass("playing");
try {
gtag("event", "click", {
event_category: nameSlug,
event_label: "resume-game",
value: 1,
});
} catch (e) {
console.log(e);
}
e.hide(), n.start();
try {
window.lngtdRestartGame();
} catch (e) {
console.log(e);
}
}
}),
(window.idleDetectedCB = () => {
const e = $(".timer-button");
e.hasClass("playing") &&
(e.removeClass("playing"),
$(".timer-icon").html("►"),
n.pause()),
(function () {
const e = $("#pause-modal");
if (
e.is(":visible") ||
"block" === $("#congrats").css("display") ||
$(".modal").hasClass("show")
)
return;
const t = $("#canvas"),
a = t.offset(),
o = t.width(),
r = t.height();
a && o && r
? e.css({ width: o, height: r, top: a.top, left: a.left })
: e.css({
width: "80%",
height: "80%",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
});
const l = n.get(),
s = i.default.turns,
d = s + n.getSeconds();
$("#pause-modal-stats").html(
`\n
\n
${
l[0]
}:${n.pad0(
l[1],
2
)}
\n
Time
\n
\n
\n
${s}
\n
Moves
\n
\n
\n
${d}
\n
Score
\n
\n `
);
const u = $(".timer-button");
$("#resume-game-button").one("click", function () {
e.hide(),
u.addClass("playing"),
$(".timer-icon").html("❙❙"),
n.start();
try {
window.lngtdRestartGame();
} catch (e) {
console.log(e);
}
});
try {
window.lngtdPauseGame();
} catch (e) {
console.log(e);
}
e.show();
})();
}),
(t.default = n);
},
3415: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = o(a(867)),
n = o(a(8958)),
r = o(a(8623)),
l = a(9824);
let s = {
start: (e = !0) => {
n.default.start(),
$(".timer-icon").html("❙❙"),
$(".timer-button").addClass("playing");
},
};
(s.restart = () => {
$(".timer-icon").html("►"),
$(this).removeClass("playing"),
n.default.restart();
}),
(s.stop = () => {
$(".timer-icon").html("►"),
$(this).removeClass("playing"),
n.default.stop();
}),
(s.hide = () => {
$(".timer-icon").hide(), $(".timer-button").hide();
}),
(t.default = s);
},
140: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = o(a(867));
let n = {
updateTurn: (e) => {
null == e && (e = 1),
(i.default.turns = i.default.turns + e),
$("#turnCount").text(i.default.turns);
},
updateStockCount: (e) => {
(i.default.stockCount = e),
$("#stockCount").text(i.default.stockCount);
},
setPassthroughs: (e) => {
(i.default.passthroughs = e),
$("#passthroughCount").text(i.default.passthroughs);
},
updatePassthroughs: (e) => {
null == e && (e = 1),
(i.default.passthroughs = i.default.passthroughs + e),
$("#passthroughCount").text(i.default.passthroughs);
},
resetTurns: () => {
(i.default.turns = 0), $("#turnCount").text(0);
},
};
t.default = n;
},
5705: function (e, t, a) {
"use strict";
var o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const i = o(a(867)),
n = a(9824),
r = {
ruleBook: {},
setRuleBook: (e) => {
r.ruleBook = e;
},
can: (e, t, a) => {
r.clearFlashMessage();
let o = [];
if (!a.area || "number" != typeof a.pile) return !1;
if (!t.card) return !1;
if (void 0 === r.ruleBook[e]) return !1;
for (let t = 0; t < r.ruleBook[e][a.area.name].length; t++) {
let i = !0;
for (let n = 0; n < r.ruleBook[e][a.area.name][t].length; n++)
r.ruleBook[e][a.area.name][t][n].rule(a)
? o.push(r.ruleBook[e][a.area.name][t][n])
: (i = !1);
if (i) return o;
}
return !1;
},
ruleExists: (e) => void 0 !== r.ruleBook[e],
areCardsPrepared: () => {
let e = !0;
for (let t = 0; t < i.default.allAreas.length; t++)
if (!i.default.allAreas[t].gameWon)
for (let a = 0; a < i.default.allAreas[t].piles.length; a++) {
let o = !1;
i.default.allAreas[t].piles[a].length > 0 &&
(o = i.default.allAreas[t].piles[a][0]);
let n = {
area: i.default.allAreas[t],
card: o,
pile: a,
position: 0,
};
r.can("win", i.default.fromSet, n) || (e = !1);
}
return !!e;
},
hasGameBeenWon: () => {
if (r.areCardsPrepared()) return !0;
for (let e = 0; e < i.default.allAreas.length; e++)
if (i.default.allAreas[e].gameWon) {
for (let t = 0; t < i.default.allAreas[e].piles.length; t++)
if (13 != i.default.allAreas[e].piles[t].length) return !1;
return !0;
}
},
clearFlashMessage: () => {
i.default.flashMessage = "";
},
showFlashMessage: (e) => {
!(0, n.isMobile)() &&
i.default.flashMessage.length > 0 &&
($("#gameStatusMessage .alert").html(
"Cannot " + e + ": " + i.default.flashMessage
),
$("#gameStatusMessage").show().delay(2e3).fadeOut(),
r.clearFlashMessage());
},
};
t.default = r;
},
9824: function (e, t, a) {
"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.www.solitaire.plus" ===
(null ===
(t =
null === window || void 0 === window
? void 0
: window.location) || void 0 === t
? void 0
: t.hostname)
);
}),
(t.isDebug = n),
(t.isStagingEnv = function () {
var e;
return (
"dev.www.solitaire.plus" ===
(null ===
(e =
null === window || void 0 === window
? void 0
: window.location) || void 0 === e
? void 0
: e.hostname)
);
}),
(t.getDisplayUsername = function (e, t, a) {
var o;
if (
(null === (o = window.SOLITAIRED_GLOBAL) || void 0 === o
? void 0
: o.username) == e
)
return e;
if (a) {
let e = `user-${t}`;
return e.length > 15 && (e = e.substring(0, 12) + "..."), e;
}
return e;
}),
(t.tryGetValueFromLocalStorage = r),
(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 a;
e = e || 3e4;
const o = () => {
clearTimeout(a),
(a = setTimeout(() => {
t();
}, e));
},
n = i(o, 1e3, { leading: !0, maxWait: 1e3, trailing: !1 });
$(() => {
n(),
$(document).on("mousemove", n),
$(document).on("keypress", o),
$(document).on("mousedown", o),
$(document).on("touchstart", o),
$(document).on("touchmove", n);
});
}),
(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 `${
l[t[0]]
}${s[t[1]]}`;
}),
(t.getQueryStringValue = function (e) {
return new URLSearchParams(window.location.search).get(e);
}),
(t.postWithRetry = function (e, t, a, o) {
let i = 0;
return $.post({
url: e,
data: t,
success: function (a) {
i > 0 &&
m(new Error("request succeeded on retry"), {
url: e,
data: t,
attemptCount: i,
}),
o(a);
},
error: function (o, n, r) {
i++,
i <= a
? setTimeout(() => {
$.ajax(this);
}, 2e3)
: m(new Error(`POST to ${e} failed`), {
textStatus: n,
status: o.status,
data: t,
errorThrown: r,
});
},
});
}),
(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) {
u ||
r("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, o.deleteStoredGameState)(), (f = !0);
}
),
$(document).on("click", ".turn-btns a", function () {
(0, o.deleteStoredGameState)();
}),
window.addEventListener("beforeunload", function (t) {
!e.gameStarted ||
e.gameWon ||
f ||
(t.preventDefault(),
(t.returnValue = ""),
(0, o.deleteStoredGameState)(),
(window.unloadPrevented = !0));
}),
(u = !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 (!c)
try {
const a = (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: a,
abTest: abTest,
}),
(c = !0);
} catch (e) {
m(e);
}
}),
(t.isMobile = function () {
return window.innerWidth < 450;
}),
(t.recordError = m),
(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) {
n() && console.log(...e);
});
const o = a(6429);
var i = a(7967);
function n() {
return null === window || void 0 === window
? void 0
: window.location.href.includes("debug=true");
}
function r(e) {
try {
return localStorage.getItem(e);
} catch (e) {
console.log(e);
}
return null;
}
const l = {
heart: "♥",
diamond: "♦",
club: "♣",
spade: "♠",
},
s = {
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 u = !1,
f = !1,
c = !1,
p = 0;
function m(e, t = {}) {
try {
consoleErrors.push([e.message, e.stack]),
p < 5 &&
!e.message.includes("ima is not a function") &&
($.post("/stream/record-error", {
eventMessage: e.message,
errorMessage: e.message,
stackStrace: e.stack,
extras: t,
}),
p++);
} catch (e) {
console.log("recordError error", e);
}
}
},
867: function (e, t) {
"use strict";
var a, o;
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 i = {
dispatch: (e) => {
setTimeout(() => {
window.dispatchEvent(e);
}, 0);
},
finishGameEvent: new Event("gameVars.finishGameEvent"),
images_canvas: {},
waterfallRunning: !1,
globalWindow: {},
};
(i.imagesLoaded = new Event("gameVars.imagesLoaded")),
(i.congratsNextCardEvent = new Event(
"gameVars.congratsNextCardEvent"
)),
(i.animateDeal = new Event("gameVars.animateDeal")),
(i.dealAnimationFinished = new Event(
"gameVars.dealAnimationFinished"
)),
(i.dropCompleted = new Event("gameVars.dropCompleted")),
(i.triggerNextUndo = new Event("gameVars.triggerNextUndo")),
(i.gameWonEvent = new Event("gameVars.gameWonEvent")),
(i.isNewGame = !0),
i.clickStart,
(i.clickType = ""),
i.cardWidth,
i.cardHeight,
i.cardSpacing,
i.cardStep,
(i.cardXOffset = 0),
i.moveCounter,
i.cardsSprite,
(i.flashMessage = ""),
(i.gameStarted = !1),
(i.isRestoredGame = !1),
(i.previousMoves = []),
(i.defaultCardFactors = {
spacing: 0.03,
width: 0.69,
height: "undefined" == typeof factorHeight ? 1.45 : factorHeight,
stepMax: 0.175,
}),
(i.cardFactors = Object.assign({}, i.defaultCardFactors)),
(i.float = []),
(i.flip = []),
(i.fromSet = {}),
(i.turns = 0),
(i.passthroughs = 0),
(i.stockCount = 0),
(i.gameWon = !1),
(i.lock = {}),
(i.softLock = {}),
(i.images = {}),
(i.canvas = document.getElementById("canvas")),
(i.contextOptions = {}),
!0 ===
(null ===
(a =
null === window || void 0 === window
? void 0
: window.SOLITAIRED_GLOBAL) || void 0 === a
? void 0
: a.willReadFrequently) &&
(i.contextOptions.willReadFrequently = !0),
(i.ctx =
null === (o = i.canvas) || void 0 === o
? void 0
: o.getContext("2d", i.contextOptions)),
"string" == typeof seed &&
"string" == typeof nameSlug &&
(i.storageKey = `moves-${nameSlug}`),
(i.getDeltaRatioDuration = (e) =>
gsap.ticker.deltaRatio() > 3 ? 0.01 : e),
(i.getCleanCards = () => {
let e = [];
for (let t of i.allAreas)
for (let a of t.piles)
for (let t of a) {
const a = `${t.name}_h:${+t.hide}`;
e.push(a);
}
return e;
}),
(i.getCanvasInfo = () =>
Object.keys(i.images_canvas).reduce((e, t) => {
const a = i.images_canvas[t],
o = a.getContext("2d");
return o
? (o.getImageData(a.width / 3, a.height / 2, 1, 1).data[3] >
0 || e.push(`[${t}: canvas is blank] `),
e)
: (e.push(`[${t}: ctx is null] `), e);
}, [])),
(i.getAllCards = () => {
let e = [];
e.push(i.float);
for (let t = 0; t < i.allAreas.length; t++)
e.push(i.allAreas[t].piles);
return e;
}),
(t.default = i),
(window.getCleanCards = i.getCleanCards),
(window.getCanvasInfo = i.getCanvasInfo),
(window.getLocks = function () {
return JSON.stringify(i.lock);
}),
(window.getClickType = function () {
return i.clickType;
});
},
7570: function (e, t, a) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
const o = a(9824),
i = "zoom-slider",
n = 100;
t.default = {
init: (e) => {
$(() => {
if ((0, o.isMobile)() || e.isTabletPortrait()) return;
const t = (e) => 1 + 0.005 * (e - n);
let a, r;
try {
(a = parseInt(localStorage.getItem(i))), isNaN(a) && (a = n);
} catch (e) {
a = n;
}
(r = t(a)),
e.setZoomFactor(r),
e.sizeToFit(),
e.drawGame(!0),
$("#card-resize-value").text(`${a}%`),
$("#card-resize-container").show(),
$("#card-resize-smaller").on("click", (o) => {
o.stopPropagation();
try {
(a = Math.max(a - 5, 0)), localStorage.setItem(i, a);
} catch (o) {
a = n;
}
(r = t(a)),
$("#card-resize-value").text(`${a}%`),
e.setZoomFactor(r),
e.sizeToFit(),
e.drawGame(!0);
}),
$("#card-resize-larger").on("click", (o) => {
o.stopPropagation();
try {
(a = Math.min(a + 5, n)), localStorage.setItem(i, a);
} catch (o) {
a = n;
}
(r = t(a)),
$("#card-resize-value").text(`${a}%`),
e.setZoomFactor(r),
e.sizeToFit(),
e.drawGame(!0);
});
});
},
};
},
6864: function (e, t, a) {
"use strict";
var o =
(this && this.__awaiter) ||
function (e, t, a, o) {
return new (a || (a = Promise))(function (i, n) {
function r(e) {
try {
s(o.next(e));
} catch (e) {
n(e);
}
}
function l(e) {
try {
s(o.throw(e));
} catch (e) {
n(e);
}
}
function s(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof a
? t
: new a(function (e) {
e(t);
})).then(r, l);
}
s((o = o.apply(e, t || [])).next());
});
},
i =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const n = i(a(8958)),
r = i(a(867)),
l = i(a(2646)),
s = i(a(3415)),
d = i(a(3668)),
u = i(a(166)),
f = i(a(2094)),
c = i(a(265)),
p = i(a(8170)),
m = i(a(5705)),
g = i(a(8623)),
h = i(a(9980)),
v = i(a(140)),
w = i(a(768)),
y = a(9824),
b = a(9824),
S = a(7728),
x = a(5778),
k = i(a(7583)),
T = i(a(8462)),
M = i(a(4728)),
C = i(a(2905)),
A = i(a(7570));
let O = new C.default(SOLITAIRED_GLOBAL.loggedInUser),
_ = g.default.getStatsStore();
!window.SOLITAIRED_GLOBAL.loggedInUser &&
SOLITAIRED_GLOBAL.isLasVegasMode &&
(window.onRegisterCallbacks || (window.onRegisterCallbacks = []),
window.onRegisterCallbacks.push(() =>
o(void 0, void 0, void 0, function* () {
try {
gtag("event", "registerForCoins", {
event_category: "registerForCoins",
event_label: "registerForCoins",
value: 1,
});
} catch (e) {
console.log(e);
}
(O = new C.default(!0)), yield O.update(200);
})
));
const E = () => {
SOLITAIRED_GLOBAL.loggedInUser
? $("#out-of-money-modal-buy").modal({
backdrop: "static",
keyboard: !1,
})
: $("#out-of-money-modal-register").modal({
backdrop: "static",
keyboard: !1,
});
};
$(() =>
o(void 0, void 0, void 0, function* () {
if (!SOLITAIRED_GLOBAL.isLasVegasMode)
return void (
(() => {
try {
const e = localStorage.getItem("lastSeenLVModalPyramid");
if (!e) return !1;
const t = new Date(e),
a = new Date();
return t.getDate() === a.getDate();
} catch (e) {
return console.log(e), !1;
}
})() ||
($("#las-vegas-mode-modal").modal({
backdrop: "static",
keyboard: !1,
}),
(() => {
try {
localStorage.setItem(
"lastSeenLVModalPyramid",
new Date().toISOString()
);
} catch (e) {
console.log(e);
}
})())
);
$(".cur-game-money-container").show();
const e = $(".totalMoney");
let t;
if (
($("#register-for-coins").on("click", () => {
window.showRegisterModal(
"hideYahoo=true",
null,
"Register and receive 200 coins",
() => {
$("#registerModal").on("hidden.bs.modal", function () {
E();
});
}
);
}),
(yield _.shouldReceiveDailyBonus())
? ((t = yield O.update(30)),
M.default.animateChangingMoney(30),
yield _.receivedDailyBonus(),
e.text(t))
: ((t = yield O.get()), e.text(t)),
t < 5)
)
E();
else {
const a = $("#pyramidNewGameModal");
a.modal({ backdrop: "static", keyboard: !1 }),
a.on("hidden.bs.modal", () =>
o(void 0, void 0, void 0, function* () {
(t = yield O.update(-5)),
M.default.animateChangingMoney(-5),
e.text(t);
})
);
}
})
);
let L = {
drag: {
tableau: [[p.default.targetIsUncovered]],
foundations: [],
stock: [],
waste: [[p.default.isTurnedUp, p.default.fromIsLastCard]],
},
drop: {
tableau: [
[p.default.targetIsUncovered, p.default.sumOfFromAndTargetIs13],
],
foundations: [],
stock: [],
waste: [
[
p.default.isTurnedUp,
p.default.targetIsLastCard,
p.default.sumOfFromAndTargetIs13,
],
],
},
win: {
tableau: [[p.default.noCardsRemaining]],
foundations: [],
stock: [[p.default.forceTrue]],
waste: [[p.default.forceTrue]],
},
flipUp: {
tableau: [[p.default.forceTrue]],
foundations: [[p.default.forceTrue]],
stock: [],
waste: [],
},
},
D = {
stock: [[]],
waste: [[]],
foundations: [[]],
piles: [[], [], [], [], [], [], [], [], [], [], [], [], []],
};
(D.stockArea = {
name: "stock",
piles: D.stock,
offset: { x: 1, y: 4 },
mobileOffset: { x: 5, y: 4 },
orientation: { x: 1, y: 0 },
collapse: !0,
fromWeight: -1e4,
toWeight: -1e4,
cardYOffset: [0],
distribution: [24],
}),
(D.wasteArea = {
name: "waste",
piles: D.waste,
offset: { x: 2, y: 4 },
mobileOffset: { x: 4, y: 4 },
orientation: { x: 1, y: 0 },
collapse: !0,
fromWeight: -1e4,
toWeight: -1e4,
cardYOffset: [0],
cardXOffset: [0],
distribution: [0],
}),
(D.foundationsArea = {
name: "foundations",
piles: D.foundations,
offset: { x: 5, y: 4 },
mobileOffset: { x: 1, y: 4 },
orientation: { x: 1, y: 0 },
collapse: !0,
gameWon: !0,
fromWeight: 100,
toWeight: 100,
cardYOffset: [0, 0, 0, 0],
distribution: [0, 0, 0, 0],
}),
(D.tableauArea = new x.PyramidCardArea(r.default, {
name: "tableau",
piles: D.piles,
offset: { x: 0, y: 1 },
mobileOffset: { x: 0, y: 1 },
orientation: { x: 1, y: 0 },
collapse: !1,
fromWeight: 60,
toWeight: 60,
distribution: [28],
cardYOffset: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
cardXOffset: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
legacyDistribution: new Array(28).fill([2]),
cardFactor: 7,
})),
"left" == handMode &&
((D.wasteArea.mobileOffset.x = 2),
(D.stockArea.mobileOffset.x = 1),
(D.foundationsArea.mobileOffset.x = 5),
(D.wasteArea.offset.x = 4),
(D.stockArea.offset.x = 5),
(D.foundationsArea.offset.x = 1)),
(r.default.maxCardRows = 5.5),
(r.default.allAreas = [
D.tableauArea,
D.foundationsArea,
D.stockArea,
D.wasteArea,
]);
let P = (e) => {
e &&
((stock = []),
["club", "diamond", "heart", "spade"].forEach(function (e) {
for (let t = 1; t <= 13; t++)
stock.push({
name: e + "_" + t,
suit: e,
number: t,
turnedup: 0,
hide: 0,
});
}),
(D.stock = [[]]),
(D.waste = [[]]),
(D.foundations = [[]]),
(D.piles = [[], [], [], [], [], [], [], [], [], [], [], [], []]),
(D.stockArea.piles = D.stock),
(D.wasteArea.piles = D.waste),
(D.foundationsArea.piles = D.foundations),
(D.tableauArea.piles = D.piles),
(G = !1));
const t = d.default.shuffle(),
a = [
d.default.deal(D.foundationsArea, t.foundations),
d.default.deal(D.wasteArea, t.waste),
d.default.deal(D.tableauArea, t.tableau),
d.default.deal(D.stockArea, t.stock),
];
Promise.all(a).then(() => {
l.default.turnCardsUp("deal");
}),
l.default.drawGame();
};
(l.default.drawGame = (e) => {
if (e) {
if (!r.default.waterfallRunning) {
if (r.default.isNewGame)
return (r.default.isNewGame = !1), void P();
(r.default.needsRedraw = !1),
r.default.ctx.clearRect(
0,
0,
r.default.canvas.width,
r.default.canvas.height
),
(r.default.ctx.globalAlpha = 1),
l.default.draw(D.stockArea),
l.default.draw(D.wasteArea),
l.default.draw(D.foundationsArea),
l.default.draw(D.tableauArea),
l.default.drawFlip(),
l.default.drawFloat();
}
} else r.default.needsRedraw = !0;
}),
l.default.setDrawFn(l.default.drawGame),
m.default.setRuleBook(L),
p.default.setSpecificGameVars(D),
c.default.setPriorities({
tableau_foundations: 6,
waste_foundations: 5,
tableau_tableau: 4,
waste_tableau: 3,
foundations_tableau: -1,
foundations_foundations: -1,
}),
c.default.setFlashMessage(
`You may need to undo, or restart this game.`
);
let I = {
loopDeal: (e, t, a) => ("lt" == a && e < t) || ("gt" == a && e > t),
outOfPassthroughs: () => r.default.passthroughs > 1,
refillStock: (e, t) =>
f.default.isLocked()
? Promise.resolve()
: (I.clearHint(),
e || t || !I.outOfPassthroughs()
? (f.default.lock("deal"),
new Promise((a) => {
let o,
i = gsap.timeline({
onComplete: () => {
l.default.sizeToFit(),
l.default.drawGame(),
f.default.unlock("deal"),
(r.default.float = []),
v.default.updateTurn(),
v.default.updateStockCount(
D.stockArea.piles[0].length
),
e
? v.default.updatePassthroughs(-1)
: v.default.updatePassthroughs(),
a();
},
}),
n = {
loopStart: 0,
loopEnd: JSON.parse(
JSON.stringify(D.wasteArea.piles[0].length)
),
loopCondition: "lt",
from: D.wasteArea,
fromPile: 0,
to: D.stockArea,
toPile: 0,
rotationStart: 1,
rotationEnd: 0,
turnedUpStart: 1,
turnedUpEnd: 0,
direction: 1,
},
s = {
loopStart: 0,
loopEnd: JSON.parse(
JSON.stringify(D.stockArea.piles[0].length)
),
loopCondition: "lt",
from: D.stockArea,
fromPile: 0,
to: D.wasteArea,
toPile: 0,
rotationStart: 0,
rotationEnd: 1,
turnedUpStart: 0,
turnedUpEnd: 1,
direction: 1,
};
if (!e) {
let e = { to: s, from: n, type: "refillStock" };
t || (u.default.addUndo(e), u.default.clearRedo());
}
o = e ? s : n;
let d = o.loopStart;
for (; I.loopDeal(d, o.loopEnd, o.loopCondition); ) {
let t = d,
a = o.fromPile,
n = o.toPile;
"loop" == o.fromPile && (a = t),
"loop" == o.toPile && (n = t);
let s = o.from.piles[a].pop(),
u = 0;
void 0 !== o.to.cardXOffset &&
(u = l.default.getExtraXOffset(
o.to,
a,
t,
o.loopEnd
));
let f = 0;
void 0 !== o.from.cardXOffset &&
(f = l.default.getExtraXOffset(
o.from,
a,
t,
o.loopEnd
)),
(s.position = {
x: l.default.getXOffset(o.from, a) + f,
xMax: l.default.getXOffset(o.to, n) + u,
y:
l.default.getYOffset(o.from, a) +
l.default.setYOffset(
o.from,
o.from.piles[a].length * o.from.cardYOffset[a]
),
yMax:
l.default.getYOffset(o.to, n) +
l.default.setYOffset(
o.to,
o.to.piles[n].length * o.to.cardYOffset[n]
),
rotation: o.rotationStart,
}),
e
? r.default.float.push(s)
: r.default.float.unshift(s),
i.to(
s.position,
{
duration: 0.15,
ease: "power1.out",
x: s.position.xMax,
y: s.position.yMax,
rotation: o.rotationEnd,
onStart: () => {
(s.turnedup = o.turnedUpStart),
k.default.cardFlip();
},
onUpdate: () => {
l.default.drawGame();
},
onComplete: () => {
(s.turnedup = o.turnedUpEnd),
o.to.piles[n].push(s),
l.default.drawGame();
},
},
".1"
),
(d += o.direction);
}
}))
: ((r.default.flashMessage = "No more deals left."),
m.default.showFlashMessage("refill stock"),
Promise.resolve())),
dealCards: (e, t, a) => {
if (!f.default.isLocked())
return (
I.clearHint(),
new Promise((o) => {
s.default.start();
const i = {
start: Date.now(),
undo: e,
redo: t,
action: "deal",
loopTurns: null,
};
if (!e && 0 == D.stockArea.piles[0].length)
return (
w.default.logMove(i), void I.refillStock(e, t).then(o)
);
f.default.lock("deal");
let n = gsap.timeline({
onComplete: () => {
(r.default.float = []),
l.default.sizeToFit(),
l.default.drawGame(),
f.default.unlock("deal"),
v.default.updateTurn(),
r.default.onMoveComplete(i, e),
o();
},
}),
d = numTurns,
c = D.stockArea.piles[0].length;
c < numTurns && (d = c),
e && (d = a.from.loopEnd),
(i.loopTurns = d),
w.default.logMove(i);
let p,
m = {
loopStart: 0,
loopEnd: d,
loopCondition: "lt",
from: D.stockArea,
fromPile: 0,
to: D.wasteArea,
toPile: 0,
rotationStart: 0,
rotationEnd: 1,
turnedUpStart: 0,
turnedUpEnd: 1,
direction: 1,
},
g = {
loopStart: 0,
loopEnd: d,
loopCondition: "lt",
from: D.wasteArea,
fromPile: 0,
to: D.stockArea,
toPile: 0,
rotationStart: 1,
rotationEnd: 0,
turnedUpStart: 1,
turnedUpEnd: 0,
direction: 1,
};
if (!e) {
let e = { to: g, from: m, type: "deal" };
t || (u.default.addUndo(e), u.default.clearRedo());
}
p = e ? g : m;
let h = p.loopStart;
for (; I.loopDeal(h, p.loopEnd, p.loopCondition); ) {
let t = h,
a = p.fromPile,
o = p.toPile;
"loop" == p.fromPile && (a = t),
"loop" == p.toPile && (o = t);
let i = p.from.piles[a].pop();
if (void 0 === i) break;
let s = 0;
void 0 !== p.to.cardXOffset && (s = p.to.cardXOffset[a]);
let d = 0;
void 0 !== p.from.cardXOffset &&
(d = p.from.cardXOffset[a]);
let u = t;
e || (2 == c ? (u = t + 1) : 1 == c && (u = t + 2)),
(i.position = {
x: l.default.getXOffset(p.from, a) + u * d,
xMax: l.default.getXOffset(p.to, o) + u * s,
y:
l.default.getYOffset(p.from, a) +
l.default.setYOffset(
p.from,
p.from.piles[a].length * p.from.cardYOffset[a]
),
yMax:
l.default.getYOffset(p.to, o) +
l.default.setYOffset(
p.to,
p.to.piles[o].length * p.to.cardYOffset[o]
),
rotation: p.rotationStart,
}),
r.default.float.push(i),
n.to(
i.position,
{
duration: r.default.getDeltaRatioDuration(0.15),
ease: "power1.out",
x: i.position.xMax,
y: i.position.yMax,
rotation: p.rotationEnd,
onStart: () => {
(i.turnedup = p.turnedUpStart),
k.default.cardFlip();
},
onUpdate: () => {
l.default.drawGame();
},
onComplete: () => {
(i.turnedup = p.turnedUpEnd),
p.to.piles[o].push(i),
l.default.drawGame(),
v.default.updateStockCount(
D.stockArea.piles[0].length
);
},
},
0.02 * h
),
(h += p.direction);
}
})
);
},
};
d.default.setRedealFn(I.dealCards),
d.default.setRefillStockFn(I.refillStock),
(I.checkClick = (e) => {
if (
("touchstart" == e.type
? window.removeEventListener("mousedown", I.checkClick)
: "mousedown" == e.type &&
window.removeEventListener("touchstart", I.checkClick),
f.default.isLocked())
)
return;
if ("canvas" !== e.target.id) return;
s.default.start();
let t = f.default.getTargetFromEvent(e);
if (t)
if (
((r.default.fromSet = t),
m.default.can("drag", r.default.fromSet, t))
) {
const a = t.area.piles[t.pile][t.position];
(a.hide = !0),
(r.default.float = [a]),
I.setCardPosition(e),
window.addEventListener("mousemove", I.setCardPosition),
window.addEventListener("touchmove", I.setCardPosition);
} else r.default.fromSet = null;
}),
(I.checkDrop = (e) => {
if (
("touchend" == e.type
? window.removeEventListener("mouseup", I.checkDrop)
: "mouseup" == e.type &&
window.removeEventListener("touchend", I.checkDrop),
f.default.isLocked())
)
return;
window.removeEventListener("mousemove", I.setCardPosition),
window.removeEventListener("touchmove", I.setCardPosition),
I.clearHint();
let t = f.default.getTargetFromEvent(e);
if (t && "stock" == t.area.name) I.dealCards();
else {
if (t && r.default.fromSet) {
if (r.default.fromSet.card == t.card) {
const e = f.default.findTargetFor(t);
if (e) return I.moveToFoundation(r.default.fromSet, e);
}
if (m.default.can("drop", r.default.fromSet, t))
return I.moveToFoundation(r.default.fromSet, t);
}
r.default.float.forEach((e) => (e.hide = !1)),
(r.default.float = []);
}
}),
(I.setCardPosition = (e) => {
const t = f.default.getXPos(e),
a = f.default.getYPos(e);
for (let o = 0; o < r.default.float.length; o++)
try {
const e = r.default.float[o];
(e.position.x = t - r.default.fromSet.offsets.x),
(e.position.y = a - r.default.fromSet.offsets.y);
} catch (e) {
recordError(e);
}
}),
(I.moveToFoundation = (e, t, a, o) => {
if ((f.default.lock("moveToFoundation"), !a && !o)) {
let a = { to: t, from: e, type: "moveToFoundation" };
u.default.addUndo(a), u.default.clearRedo();
}
let i;
e.card == t.card
? ((i = [t]), (r.default.float = [t.card]))
: ((i = [e, t]), (r.default.float = [e.card, t.card])),
r.default.float.forEach((e) => (e.hide = !0));
let n = gsap.timeline({
onComplete: () => {
a
? D.foundationsArea.piles[0].splice(-r.default.float.length)
: (D.foundationsArea.piles[0] =
D.foundationsArea.piles[0].concat(r.default.float)),
i.forEach((e) => {
"tableau" === e.area.name
? (e.area.piles[e.pile][e.position] = a ? e.card : void 0)
: a
? e.area.piles[e.pile].splice(e.position, 0, e.card)
: e.area.piles[e.pile].splice(e.position, 1);
}),
r.default.float.forEach((e) => (e.hide = !1)),
(r.default.float = []),
v.default.updateTurn(),
f.default.unlock("moveToFoundation"),
r.default.onMoveComplete({ from: e, to: t }, a),
!r.default.gameWon &&
m.default.areCardsPrepared() &&
((r.default.gameWon = !0),
l.default.waterfall(),
SOLITAIRED_GLOBAL.isLasVegasMode &&
O.update(30).then((e) => {
$(".totalMoney").text(e),
M.default.animateChangingMoney(30);
}));
},
});
i.forEach((e) => {
const t = e.card;
let o, i;
if (a)
if (e.area.getCardDimensionValues) {
const t = e.area.getCardDimensionValues(
e.pile,
e.position,
e.card
);
(o = t.xCoord), (i = t.yCoord);
} else
(o =
l.default.getXOffset(e.area, e.pile) +
l.default.getExtraXOffset(
e.area,
e.pile,
e.area.piles[e.pile].length
)),
(i = l.default.getYOffset(
e.area,
e.area.piles[e.pile].length
));
else
(o =
l.default.getXOffset(D.foundationsArea, 0) +
l.default.getExtraXOffset(
D.foundationsArea,
0,
D.foundationsArea.piles[0].length
)),
(i = l.default.getYOffset(
D.foundationsArea,
D.foundationsArea.piles[0].length
));
n.to(
t.position,
{ duration: 0.25, ease: "power1.in", x: o, y: i },
0
);
});
}),
(D.actionWeight = (e) => e.area.toWeight),
f.default.setWeightFn(D.actionWeight),
f.default.setMoveToFoundationFn(I.moveToFoundation),
(I.showHint = () =>
o(void 0, void 0, void 0, function* () {
const e = [];
for (let t = 0; t < r.default.allAreas.length; t++)
for (let a = 0; a < r.default.allAreas[t].piles.length; a++)
for (
let o = 0;
o < r.default.allAreas[t].piles[a].length;
o++
) {
let i = {
area: r.default.allAreas[t],
card: r.default.allAreas[t].piles[a][o],
pile: a,
position: o,
};
if (
((r.default.fromSet = i),
m.default.can("drag", r.default.fromSet, i))
)
for (let t = 0; t < r.default.allAreas.length; t++)
for (
let a = 0;
a < r.default.allAreas[t].piles.length;
a++
)
for (
let o = 0;
o < r.default.allAreas[t].piles[a].length;
o++
) {
let i = {
area: r.default.allAreas[t],
card: r.default.allAreas[t].piles[a][o],
pile: a,
position: o,
};
m.default.can("drop", r.default.fromSet, i) &&
e.push({ from: r.default.fromSet, to: i });
}
}
if (e.length > 0)
if (SOLITAIRED_GLOBAL.isLasVegasMode) {
if (yield O.canUpdate(-1)) {
const t = yield O.update(-1);
$(".totalMoney").text(t),
M.default.animateChangingMoney(-1),
e.forEach((e) => {
(e.from.card.highlight = !0),
(e.to.card.highlight = !0);
});
}
} else
e.forEach((e) => {
(e.from.card.highlight = !0), (e.to.card.highlight = !0);
});
})),
(I.clearHint = () => {
for (let e = 0; e < r.default.allAreas.length; e++)
for (let t = 0; t < r.default.allAreas[e].piles.length; t++)
for (let a = 0; a < r.default.allAreas[e].piles[t].length; a++)
r.default.allAreas[e].piles[t][a] &&
(r.default.allAreas[e].piles[t][a].highlight = !1);
});
const F = () =>
o(void 0, void 0, void 0, function* () {
if (0 !== u.default.undos.length) {
if (!SOLITAIRED_GLOBAL.isLasVegasMode) return u.default.undo();
if (yield O.canUpdate(-1)) {
const e = yield O.update(-1);
$(".totalMoney").text(e),
M.default.animateChangingMoney(-1),
u.default.undo();
} else
(r.default.flashMessage = "Not enough coins!"),
m.default.showFlashMessage("undo");
}
});
let R = !1;
r.default.onMoveComplete = (e, t) => {
if (
("deal" === (null == e ? void 0 : e.action) ||
t ||
f.default.animateCardConfetti(
r.default,
D.foundationsArea,
0,
D.foundationsArea.piles[0].length - 1
),
0 === D.stockArea.piles[0].length)
) {
if (R) return;
0 === c.default.findAllMoves().length &&
I.outOfPassthroughs() &&
!m.default.areCardsPrepared() &&
((R = !0), $("#pyramid-end-game-modal").modal("show"));
}
};
let W = !1;
window.addEventListener("gameVars.imagesLoaded", () => {
W ||
(gsap.ticker.add(() => {
l.default.drawGame(!0);
}),
l.default.drawGame(),
(W = !0));
}),
window.addEventListener("touchstart", I.checkClick),
window.addEventListener("mousedown", I.checkClick),
window.addEventListener("mouseup", I.checkDrop),
window.addEventListener("touchend", I.checkDrop),
window.addEventListener(
"gameVars.congratsNextCardEvent",
l.default.waterfall
),
window.addEventListener(
"gameVars.animateDeal",
d.default.animateDeal
),
window.addEventListener("gameVars.triggerNextUndo", u.default.undo),
window.addEventListener(
"registerModalCloseEvent",
g.default.triggerHighScores
),
window.addEventListener(
"loginModalCloseEvent",
g.default.triggerHighScores
),
n.default.set(
document.querySelector(".stopwatch"),
document.querySelector(".results")
),
l.default.sizeToFit(),
l.default.redrawImages(),
(r.default.globalWindow.width = window.innerWidth),
(r.default.globalWindow.height = window.innerHeight),
$("#undoBtn").on("click", () => {
F();
}),
$("#redoBtn").on("click", () => {
u.default.redo();
}),
$("#hintBtn").on("click", () => {
I.showHint();
}),
$("body").on("click", "#hintChooseFromStock", () => {
I.dealCards();
}),
$(window).on("resize", () => {
if (
window.innerWidth == r.default.globalWindow.width &&
window.innerHeight == r.default.globalWindow.height
)
return;
let e = window.innerWidth / r.default.globalWindow.width,
t = window.innerHeight / r.default.globalWindow.height;
(e > 0.95 && e < 1.05 && t > 0.8 && t < 1.1) ||
(l.default.sizeToFit(),
(r.default.globalWindow.width = window.innerWidth),
(r.default.globalWindow.height = window.innerHeight));
});
const U = T.default.create(
{
" ": () => {
I.dealCards();
},
s: () => {
I.showHint();
},
a: () => {
F();
},
u: () => {
F();
},
d: () => {
u.default.redo();
},
r: () => {
u.default.redo();
},
},
f.default,
r.default
);
let G = !1;
window.addEventListener("gameVars.dealAnimationFinished", () => {
var e;
if (!G) {
let t;
G = !0;
try {
(t = localStorage.getItem(r.default.storageKey)),
(t = JSON.parse(t));
} catch (e) {
t = null;
}
let a =
null === (e = SOLITAIRED_GLOBAL.seedStats) || void 0 === e
? void 0
: e.movesData;
try {
a = JSON.parse(a);
} catch (e) {
a = null;
}
(null == t ? void 0 : t.moves) && g.default.seedSaved
? (r.default.movesData = t)
: (null == a ? void 0 : a.moves) &&
location.search.indexOf("replay=") >= 0 &&
(r.default.movesData = a),
r.default.movesData &&
(f.default.lock("init"),
(r.default.isReplay = !0),
(r.default.replayRunning = !0),
g.default.seedSaved ||
($("#replay-modal").modal("show"),
$("#replay-modal .modal-title").text("Replay running..."),
$("#replay-modal #congrats-btn-replay").hide()),
setTimeout(
() =>
o(void 0, void 0, void 0, function* () {
f.default.unlock("init"),
s.default.restart(),
yield f.default.completeMoves(
r.default.movesData.moves,
I.dealCards
),
s.default.stop(),
(r.default.replayRunning = !1),
(r.default.gameWon = !0),
l.default.waterfall(),
g.default.seedSaved
? g.default.triggerHighScores()
: ($("#replay-modal .modal-title").text(
"Replay complete!"
),
$("#replay-modal #congrats-btn-replay").show());
}),
2e3
)),
document.addEventListener("keydown", U);
}
}),
$(() => {
$(document).on("click", "#congrats-btn-replay", () => {
r.default.replayRunning ||
(gtag("event", "click", {
event_category: nameSlug,
event_label: "replay",
value: 1,
}),
g.default.seedSaved &&
($("#congrats").hasClass("minimizeCongrats") ||
$("#closeCongrats").click()),
r.default.waterfallRunning &&
(r.default.waterfallRunning.kill(),
(r.default.waterfallRunning = !1),
window.cancelAnimationFrame(r.default.animationFrameRunning),
f.default.unlock("waterfall")),
P(!0));
});
});
let B = !1;
(0, y.onIdle)(4e4, () => {
B ||
(0, b.modalOnScreen)() ||
((B = !0),
r.default.gameWon ||
($("#hintBtn").tooltip({
title: "If you get stuck, try a hint!",
placement: "bottom",
trigger: "manual",
}),
setTimeout(() => {
$("#hintBtn").tooltip("show"),
setTimeout(() => {
$("#hintBtn").tooltip("hide");
}, 4e3);
}, 1e3)));
}),
(window.customize = h.default),
$(() => {
$("#seed-stats-win-perc").on("mouseover", () => {
(0, S.seedStatsInteraction)("mouseover");
}),
$("#seed-stats-win-perc").on("click", () => {
(0, S.seedStatsInteraction)("click"),
$("#seed-stats-win-perc").tooltip("show"),
setTimeout(() => {
$("#seed-stats-win-perc").tooltip("hide");
}, 2500);
});
}),
(0, y.preventAccidentalNavigation)(r.default),
A.default.init(l.default);
},
9321: function (e, t, a) {
var o;
!(function (i, n) {
"use strict";
var r,
l = "",
s = "function",
d = "undefined",
u = "object",
f = "string",
c = "major",
p = "model",
m = "name",
g = "type",
h = "vendor",
v = "version",
w = "architecture",
y = "console",
b = "mobile",
S = "tablet",
x = "smarttv",
k = "wearable",
T = "xr",
M = "embedded",
C = "user-agent",
A = "brands",
O = "formFactors",
$ = "fullVersionList",
_ = "platform",
E = "platformVersion",
L = "bitness",
D = "sec-ch-ua",
P = D + "-full-version-list",
I = D + "-arch",
F = D + "-" + L,
R = D + "-form-factors",
W = D + "-" + b,
U = D + "-" + p,
G = D + "-" + _,
B = G + "-version",
N = [A, $, b, p, _, E, w, O, L],
H = "browser",
Y = "cpu",
j = "device",
q = "engine",
z = "os",
X = "result",
V = "Amazon",
J = "Apple",
K = "ASUS",
Q = "BlackBerry",
Z = "Google",
ee = "Huawei",
te = "Lenovo",
ae = "LG",
oe = "Microsoft",
ie = "Motorola",
ne = "Samsung",
re = "Sharp",
le = "Sony",
se = "Xiaomi",
de = "Zebra",
ue = "Mobile ",
fe = " Browser",
ce = "Chrome",
pe = "Chromecast",
me = "Firefox",
ge = "Opera",
he = "Facebook",
ve = "Sogou",
we = "Windows",
ye = typeof i !== d,
be = ye && i.navigator ? i.navigator : n,
Se = be && be.userAgentData ? be.userAgentData : n,
xe = function (e) {
for (var t = {}, a = 0; a < e.length; a++)
t[e[a].toUpperCase()] = e[a];
return t;
},
ke = function (e, t) {
if (typeof e === u && e.length > 0) {
for (var a in e) if (Ae(e[a]) == Ae(t)) return !0;
return !1;
}
return !!Me(e) && -1 !== Ae(t).indexOf(Ae(e));
},
Te = function (e, t) {
for (var a in e)
return (
/^(browser|cpu|device|engine|os)$/.test(a) ||
(!!t && Te(e[a]))
);
},
Me = function (e) {
return typeof e === f;
},
Ce = function (e) {
if (!e) return n;
for (
var t = [], a = _e(/\\?\"/g, e).split(","), o = 0;
o < a.length;
o++
)
if (a[o].indexOf(";") > -1) {
var i = Le(a[o]).split(";v=");
t[o] = { brand: i[0], version: i[1] };
} else t[o] = Le(a[o]);
return t;
},
Ae = function (e) {
return Me(e) ? e.toLowerCase() : e;
},
Oe = function (e) {
return Me(e) ? _e(/[^\d\.]/g, e).split(".")[0] : n;
},
$e = function (e) {
for (var t in e) {
var a = e[t];
typeof a == u && 2 == a.length
? (this[a[0]] = a[1])
: (this[a] = n);
}
return this;
},
_e = function (e, t) {
return Me(t) ? t.replace(e, l) : t;
},
Ee = function (e) {
return _e(/\\?\"/g, e);
},
Le = function (e, t) {
if (Me(e))
return (
(e = _e(/^\s\s*/, e)),
typeof t === d ? e : e.substring(0, 500)
);
},
De = function (e, t) {
if (e && t)
for (var a, o, i, r, l, d, f = 0; f < t.length && !l; ) {
var c = t[f],
p = t[f + 1];
for (a = o = 0; a < c.length && !l && c[a]; )
if ((l = c[a++].exec(e)))
for (i = 0; i < p.length; i++)
(d = l[++o]),
typeof (r = p[i]) === u && r.length > 0
? 2 === r.length
? typeof r[1] == s
? (this[r[0]] = r[1].call(this, d))
: (this[r[0]] = r[1])
: 3 === r.length
? typeof r[1] !== s || (r[1].exec && r[1].test)
? (this[r[0]] = d ? d.replace(r[1], r[2]) : n)
: (this[r[0]] = d
? r[1].call(this, d, r[2])
: n)
: 4 === r.length &&
(this[r[0]] = d
? r[3].call(this, d.replace(r[1], r[2]))
: n)
: (this[r] = d || n);
f += 2;
}
},
Pe = function (e, t) {
for (var a in t)
if (typeof t[a] === u && t[a].length > 0) {
for (var o = 0; o < t[a].length; o++)
if (ke(t[a][o], e)) return "?" === a ? n : a;
} else if (ke(t[a], e)) return "?" === a ? n : a;
return t.hasOwnProperty("*") ? t["*"] : e;
},
Ie = {
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",
},
Fe = {
embedded: "Automotive",
mobile: "Mobile",
tablet: ["Tablet", "EInk"],
smarttv: "TV",
wearable: "Watch",
xr: ["VR", "XR"],
"?": ["Desktop", "Unknown"],
"*": n,
},
Re = {
browser: [
[/\b(?:crmo|crios)\/([\w\.]+)/i],
[v, [m, ue + "Chrome"]],
[/edg(?:e|ios|a)?\/([\w\.]+)/i],
[v, [m, "Edge"]],
[
/(opera mini)\/([-\w\.]+)/i,
/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,
/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i,
],
[m, v],
[/opios[\/ ]+([\w\.]+)/i],
[v, [m, ge + " Mini"]],
[/\bop(?:rg)?x\/([\w\.]+)/i],
[v, [m, ge + " GX"]],
[/\bopr\/([\w\.]+)/i],
[v, [m, ge]],
[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],
[v, [m, "Baidu"]],
[
/(kindle)\/([\w\.]+)/i,
/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/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)\/([-\w\.]+)/i,
/(heytap|ovi)browser\/([\d\.]+)/i,
/(weibo)__([\d\.]+)/i,
],
[m, v],
[/quark(?:pc)?\/([-\w\.]+)/i],
[v, [m, "Quark"]],
[/\bddg\/([\w\.]+)/i],
[v, [m, "DuckDuckGo"]],
[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],
[v, [m, "UCBrowser"]],
[
/microm.+\bqbcore\/([\w\.]+)/i,
/\bqbcore\/([\w\.]+).+microm/i,
/micromessenger\/([\w\.]+)/i,
],
[v, [m, "WeChat"]],
[/konqueror\/([\w\.]+)/i],
[v, [m, "Konqueror"]],
[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],
[v, [m, "IE"]],
[/ya(?:search)?browser\/([\w\.]+)/i],
[v, [m, "Yandex"]],
[/slbrowser\/([\w\.]+)/i],
[v, [m, "Smart " + te + fe]],
[/(avast|avg)\/([\w\.]+)/i],
[[m, /(.+)/, "$1 Secure" + fe], v],
[/\bfocus\/([\w\.]+)/i],
[v, [m, me + " Focus"]],
[/\bopt\/([\w\.]+)/i],
[v, [m, ge + " Touch"]],
[/coc_coc\w+\/([\w\.]+)/i],
[v, [m, "Coc Coc"]],
[/dolfin\/([\w\.]+)/i],
[v, [m, "Dolphin"]],
[/coast\/([\w\.]+)/i],
[v, [m, ge + " Coast"]],
[/miuibrowser\/([\w\.]+)/i],
[v, [m, "MIUI" + fe]],
[/fxios\/([\w\.-]+)/i],
[v, [m, ue + me]],
[/\bqihu|(qi?ho?o?|360)browser/i],
[[m, "360" + fe]],
[/\b(qq)\/([\w\.]+)/i],
[[m, /(.+)/, "$1Browser"], v],
[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],
[[m, /(.+)/, "$1" + fe], v],
[/samsungbrowser\/([\w\.]+)/i],
[v, [m, ne + " Internet"]],
[/(comodo_dragon)\/([\w\.]+)/i],
[[m, /_/g, " "], v],
[/metasr[\/ ]?([\d\.]+)/i],
[v, [m, ve + " Explorer"]],
[/(sogou)mo\w+\/([\d\.]+)/i],
[[m, ve + " Mobile"], v],
[
/(electron)\/([\w\.]+) safari/i,
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,
/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i,
],
[m, v],
[/(lbbrowser|rekonq)/i, /\[(linkedin)app\]/i],
[m],
[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],
[[m, he], v],
[
/(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,
/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i,
],
[m, v],
[/\bgsa\/([\w\.]+) .*safari\//i],
[v, [m, "GSA"]],
[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],
[v, [m, "TikTok"]],
[/headlesschrome(?:\/([\w\.]+)| )/i],
[v, [m, ce + " Headless"]],
[/ wv\).+(chrome)\/([\w\.]+)/i],
[[m, ce + " WebView"], v],
[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],
[v, [m, "Android" + fe]],
[/chrome\/([\w\.]+) mobile/i],
[v, [m, ue + "Chrome"]],
[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],
[m, v],
[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],
[v, [m, ue + "Safari"]],
[/iphone .*mobile(?:\/\w+ | ?)safari/i],
[[m, ue + "Safari"]],
[/version\/([\w\.\,]+) .*(safari)/i],
[v, m],
[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],
[m, [v, "1"]],
[/(webkit|khtml)\/([\w\.]+)/i],
[m, v],
[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],
[[m, ue + me], v],
[/(navigator|netscape\d?)\/([-\w\.]+)/i],
[[m, "Netscape"], v],
[/(wolvic)\/([\w\.]+)/i],
[m, v],
[/mobile vr; rv:([\w\.]+)\).+firefox/i],
[v, [m, 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,
/(links) \(([\w\.]+)/i,
],
[m, [v, /_/g, "."]],
[/(cobalt)\/([\w\.]+)/i],
[m, [v, /[^\d\.]+./, l]],
],
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/, l, Ae]],
[/(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, Ae]],
],
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,
],
[p, [h, ne], [g, S]],
[
/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
/samsung[- ]((?!sm-[lr])[-\w]+)/i,
/sec-(sgh\w+)/i,
],
[p, [h, ne], [g, b]],
[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],
[p, [h, J], [g, b]],
[
/\((ipad);[-\w\),; ]+apple/i,
/applecoremedia\/[\w\.]+ \((ipad)/i,
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i,
],
[p, [h, J], [g, S]],
[/(macintosh);/i],
[p, [h, J]],
[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],
[p, [h, re], [g, b]],
[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],
[p, [h, ee], [g, S]],
[
/(?:huawei|honor)([-\w ]+)[;\)]/i,
/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i,
],
[p, [h, ee], [g, b]],
[
/\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,
],
[
[p, /_/g, " "],
[h, se],
[g, b],
],
[
/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i,
],
[
[p, /_/g, " "],
[h, se],
[g, S],
],
[
/; (\w+) bui.+ oppo/i,
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i,
],
[p, [h, "OPPO"], [g, b]],
[/\b(opd2\d{3}a?) bui/i],
[p, [h, "OPPO"], [g, S]],
[/vivo (\w+)(?: bui|\))/i, /\b(v[12]\d{3}\w?[at])(?: bui|;)/i],
[p, [h, "Vivo"], [g, b]],
[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],
[p, [h, "Realme"], [g, b]],
[
/\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,
],
[p, [h, ie], [g, b]],
[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],
[p, [h, ie], [g, S]],
[
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i,
],
[p, [h, ae], [g, S]],
[
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
/\blg-?([\d\w]+) bui/i,
],
[p, [h, ae], [g, b]],
[
/(ideatab[-\w ]+)/i,
/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i,
],
[p, [h, te], [g, S]],
[
/(?:maemo|nokia).*(n900|lumia \d+)/i,
/nokia[-_ ]?([-\w\.]*)/i,
],
[
[p, /_/g, " "],
[h, "Nokia"],
[g, b],
],
[/(pixel c)\b/i],
[p, [h, Z], [g, S]],
[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],
[p, [h, Z], [g, b]],
[
/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,
],
[p, [h, le], [g, b]],
[/sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i],
[
[p, "Xperia Tablet"],
[h, le],
[g, S],
],
[
/ (kb2005|in20[12]5|be20[12][59])\b/i,
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i,
],
[p, [h, "OnePlus"], [g, b]],
[
/(alexa)webm/i,
/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,
/(kf[a-z]+)( bui|\)).+silk\//i,
],
[p, [h, V], [g, S]],
[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],
[
[p, /(.+)/g, "Fire Phone $1"],
[h, V],
[g, b],
],
[/(playbook);[-\w\),; ]+(rim)/i],
[p, h, [g, S]],
[/\b((?:bb[a-f]|st[hv])100-\d)/i, /\(bb10; (\w+)/i],
[p, [h, Q], [g, b]],
[
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i,
],
[p, [h, K], [g, S]],
[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],
[p, [h, K], [g, b]],
[/(nexus 9)/i],
[p, [h, "HTC"], [g, S]],
[
/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i,
],
[h, [p, /_/g, " "], [g, b]],
[
/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,
],
[p, [h, "TCL"], [g, S]],
[
/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,
],
[p, [h, "TCL"], [g, b]],
[/(itel) ((\w+))/i],
[
[h, Ae],
p,
[g, Pe, { tablet: ["p10001l", "w7001"], "*": "mobile" }],
],
[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],
[p, [h, "Acer"], [g, S]],
[/droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i],
[p, [h, "Meizu"], [g, b]],
[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],
[p, [h, "Ulefone"], [g, b]],
[/droid.+; (a(?:015|06[35]|142p?))/i],
[p, [h, "Nothing"], [g, b]],
[
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,
/(hp) ([\w ]+\w)/i,
/(asus)-?(\w+)/i,
/(microsoft); (lumia[\w ]+)/i,
/(lenovo)[-_ ]?([-\w]+)/i,
/(jolla)/i,
/(oppo) ?([\w ]+) bui/i,
],
[h, p, [g, b]],
[
/(kobo)\s(ereader|touch)/i,
/(archos) (gamepad2?)/i,
/(hp).+(touchpad(?!.+tablet)|tablet)/i,
/(kindle)\/([\w\.]+)/i,
],
[h, p, [g, S]],
[/(surface duo)/i],
[p, [h, oe], [g, S]],
[/droid [\d\.]+; (fp\du?)(?: b|\))/i],
[p, [h, "Fairphone"], [g, b]],
[/(shield[\w ]+) b/i],
[p, [h, "Nvidia"], [g, S]],
[/(sprint) (\w+)/i],
[h, p, [g, b]],
[/(kin\.[onetw]{3})/i],
[
[p, /\./g, " "],
[h, oe],
[g, b],
],
[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],
[p, [h, de], [g, S]],
[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],
[p, [h, de], [g, b]],
[/smart-tv.+(samsung)/i],
[h, [g, x]],
[/hbbtv.+maple;(\d+)/i],
[
[p, /^/, "SmartTV"],
[h, ne],
[g, x],
],
[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],
[
[h, ae],
[g, x],
],
[/(apple) ?tv/i],
[h, [p, J + " TV"], [g, x]],
[/crkey.*devicetype\/chromecast/i],
[
[p, pe + " Third Generation"],
[h, Z],
[g, x],
],
[/crkey.*devicetype\/([^/]*)/i],
[
[p, /^/, "Chromecast "],
[h, Z],
[g, x],
],
[/fuchsia.*crkey/i],
[
[p, pe + " Nest Hub"],
[h, Z],
[g, x],
],
[/crkey/i],
[
[p, pe],
[h, Z],
[g, x],
],
[/droid.+aft(\w+)( bui|\))/i],
[p, [h, V], [g, x]],
[/\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i],
[p, [h, re], [g, x]],
[/(bravia[\w ]+)( bui|\))/i],
[p, [h, le], [g, x]],
[/(mitv-\w{5}) bui/i],
[p, [h, se], [g, x]],
[/Hbbtv.*(technisat) (.*);/i],
[h, p, [g, x]],
[
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i,
],
[
[h, Le],
[p, Le],
[g, x],
],
[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],
[[g, x]],
[/(ouya)/i, /(nintendo) (\w+)/i],
[h, p, [g, y]],
[/droid.+; (shield) bui/i],
[p, [h, "Nvidia"], [g, y]],
[/(playstation \w+)/i],
[p, [h, le], [g, y]],
[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],
[p, [h, oe], [g, y]],
[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],
[p, [h, ne], [g, k]],
[/((pebble))app/i],
[h, p, [g, k]],
[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],
[p, [h, J], [g, k]],
[/droid.+; (wt63?0{2,3})\)/i],
[p, [h, de], [g, k]],
[/droid.+; (glass) \d/i],
[p, [h, Z], [g, T]],
[/(pico) (4|neo3(?: link|pro)?)/i],
[h, p, [g, T]],
[/; (quest( \d| pro)?)/i],
[p, [h, he], [g, T]],
[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],
[h, [g, M]],
[/(aeobc)\b/i],
[p, [h, V], [g, M]],
[
/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i,
],
[p, [g, b]],
[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],
[p, [g, S]],
[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],
[[g, S]],
[
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i,
],
[[g, b]],
[/(android[-\w\. ]{0,9});.+buil/i],
[p, [h, "Generic"]],
],
engine: [
[/windows.+ edge\/([\w\.]+)/i],
[v, [m, "EdgeHTML"]],
[/(arkweb)\/([\w\.]+)/i],
[m, v],
[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],
[v, [m, "Blink"]],
[
/(presto)\/([\w\.]+)/i,
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,
/ekioh(flow)\/([\w\.]+)/i,
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,
/(icab)[\/ ]([23]\.[\d\.]+)/i,
/\b(libweb)/i,
],
[m, v],
[/rv\:([\w\.]{1,9})\b.+(gecko)/i],
[v, m],
],
os: [
[/microsoft (windows) (vista|xp)/i],
[m, v],
[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],
[m, [v, Pe, Ie]],
[
/windows nt 6\.2; (arm)/i,
/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,
/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i,
],
[
[v, Pe, Ie],
[m, we],
],
[
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,
/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
/cfnetwork\/.+darwin/i,
],
[
[v, /_/g, "."],
[m, "iOS"],
],
[
/(mac os x) ?([\w\. ]*)/i,
/(macintosh|mac_powerpc\b)(?!.+haiku)/i,
],
[
[m, "macOS"],
[v, /_/g, "."],
],
[/android ([\d\.]+).*crkey/i],
[v, [m, pe + " Android"]],
[/fuchsia.*crkey\/([\d\.]+)/i],
[v, [m, pe + " Fuchsia"]],
[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],
[v, [m, pe + " SmartSpeaker"]],
[/linux.*crkey\/([\d\.]+)/i],
[v, [m, pe + " Linux"]],
[/crkey\/([\d\.]+)/i],
[v, [m, pe]],
[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],
[v, m],
[
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,
/(blackberry)\w*\/([\w\.]*)/i,
/(tizen|kaios)[\/ ]([\w\.]+)/i,
/\((series40);/i,
],
[m, v],
[/\(bb(10);/i],
[v, [m, Q]],
[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],
[v, [m, "Symbian"]],
[
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i,
],
[v, [m, me + " OS"]],
[/web0s;.+rt(tv)/i, /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],
[v, [m, "webOS"]],
[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],
[v, [m, "watchOS"]],
[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],
[[m, "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,
],
[m, v],
[/(sunos) ?([\w\.\d]*)/i],
[[m, "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,
],
[m, v],
],
},
We =
((r = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} }),
$e.call(r.init, [
[H, [m, v, c, g]],
[Y, [w]],
[j, [g, p, h]],
[q, [m, v]],
[z, [m, v]],
]),
$e.call(r.isIgnore, [
[H, [v, c]],
[q, [v]],
[z, [v]],
]),
$e.call(r.isIgnoreRgx, [
[H, / ?browser$/i],
[z, / ?os$/i],
]),
$e.call(r.toString, [
[H, [m, v]],
[Y, [w]],
[j, [h, p]],
[q, [m, v]],
[z, [m, v]],
]),
r),
Ue = function (e, t) {
var a = We.init[t],
o = We.isIgnore[t] || 0,
i = We.isIgnoreRgx[t] || 0,
n = We.toString[t] || 0;
function r() {
$e.call(this, a);
}
return (
(r.prototype.getItem = function () {
return e;
}),
(r.prototype.withClientHints = function () {
return Se
? Se.getHighEntropyValues(N).then(function (t) {
return e.setCH(new Ge(t, !1)).parseCH().get();
})
: e.parseCH().get();
}),
(r.prototype.withFeatureCheck = function () {
return e.detectFeature().get();
}),
t != X &&
((r.prototype.is = function (e) {
var t = !1;
for (var a in this)
if (
this.hasOwnProperty(a) &&
!ke(o, a) &&
Ae(i ? _e(i, this[a]) : this[a]) == Ae(i ? _e(i, e) : e)
) {
if (((t = !0), e != d)) break;
} else if (e == d && t) {
t = !t;
break;
}
return t;
}),
(r.prototype.toString = function () {
var e = l;
for (var t in n)
typeof this[n[t]] !== d &&
(e += (e ? " " : l) + this[n[t]]);
return e || d;
})),
Se ||
(r.prototype.then = function (e) {
var t = this,
a = function () {
for (var e in t)
t.hasOwnProperty(e) && (this[e] = t[e]);
};
a.prototype = {
is: r.prototype.is,
toString: r.prototype.toString,
};
var o = new a();
return e(o), o;
}),
new r()
);
};
function Ge(e, t) {
if (((e = e || {}), $e.call(this, N), t))
$e.call(this, [
[A, Ce(e[D])],
[$, Ce(e[P])],
[b, /\?1/.test(e[W])],
[p, Ee(e[U])],
[_, Ee(e[G])],
[E, Ee(e[B])],
[w, Ee(e[I])],
[O, Ce(e[R])],
[L, Ee(e[F])],
]);
else
for (var a in e)
this.hasOwnProperty(a) && typeof e[a] !== d && (this[a] = e[a]);
}
function Be(e, t, a, o) {
return (
(this.get = function (e) {
return e
? this.data.hasOwnProperty(e)
? this.data[e]
: n
: 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 (be && be.userAgent == this.ua)
switch (this.itemType) {
case H:
be.brave &&
typeof be.brave.isBrave == s &&
this.set(m, "Brave");
break;
case j:
!this.get(g) && Se && Se[b] && this.set(g, b),
"Macintosh" == this.get(p) &&
be &&
typeof be.standalone !== d &&
be.maxTouchPoints &&
be.maxTouchPoints > 2 &&
this.set(p, "iPad").set(g, S);
break;
case z:
!this.get(m) && Se && Se[_] && this.set(m, Se[_]);
break;
case X:
var e = this.data,
t = function (t) {
return e[t].getItem().detectFeature().get();
};
this.set(H, t(H))
.set(Y, t(Y))
.set(j, t(j))
.set(q, t(q))
.set(z, t(z));
}
return this;
}),
(this.parseUA = function () {
return (
this.itemType != X &&
De.call(this.data, this.ua, this.rgxMap),
this.itemType == H && this.set(c, Oe(this.get(v))),
this
);
}),
(this.parseCH = function () {
var e = this.uaCH,
t = this.rgxMap;
switch (this.itemType) {
case H:
var a,
o = e[$] || e[A];
if (o)
for (var i in o) {
var r = _e(/(Google|Microsoft) /, o[i].brand || o[i]),
l = o[i].version;
/not.a.brand/i.test(r) ||
(a && (!/chrom/i.test(a) || /chromi/i.test(r))) ||
(this.set(m, r).set(v, l).set(c, Oe(l)), (a = r));
}
break;
case Y:
var s = e[w];
s &&
(s && "64" == e[L] && (s += "64"),
De.call(this.data, s + ";", t));
break;
case j:
if (
(e[b] && this.set(g, b),
e[p] && this.set(p, e[p]),
"Xbox" == e[p] && this.set(g, y).set(h, oe),
e[O])
) {
var d;
if ("string" != typeof e[O])
for (var u = 0; !d && u < e[O].length; )
d = Pe(e[O][u++], Fe);
else d = Pe(e[O], Fe);
this.set(g, d);
}
break;
case z:
var f = e[_];
if (f) {
var S = e[E];
f == we && (S = parseInt(Oe(S), 10) >= 13 ? "11" : "10"),
this.set(m, f).set(v, S);
}
this.get(m) == we &&
"Xbox" == e[p] &&
this.set(m, "Xbox").set(v, n);
break;
case X:
var x = this.data,
k = function (t) {
return x[t].getItem().setCH(e).parseCH().get();
};
this.set(H, k(H))
.set(Y, k(Y))
.set(j, k(j))
.set(q, k(q))
.set(z, k(z));
}
return this;
}),
$e.call(this, [
["itemType", e],
["ua", t],
["uaCH", o],
["rgxMap", a],
["data", Ue(this, e)],
]),
this
);
}
function Ne(e, t, a) {
if (
(typeof e === u
? (Te(e, !0)
? (typeof t === u && (a = t), (t = e))
: ((a = e), (t = n)),
(e = n))
: typeof e !== f || Te(t, !0) || ((a = t), (t = n)),
!(this instanceof Ne))
)
return new Ne(e, t, a).getResult();
var o =
typeof e === f
? e
: be && be.userAgent
? be.userAgent
: a && a[C]
? a[C]
: l,
i = new Ge(a, !0),
r = t
? (function (e, t) {
var a = {},
o = t;
if (!Te(t))
for (var i in ((o = {}), t))
for (var n in t[i])
o[n] = t[i][n].concat(o[n] ? o[n] : []);
for (var r in e)
a[r] =
o[r] && o[r].length % 2 == 0 ? o[r].concat(e[r]) : e[r];
return a;
})(Re, t)
: Re,
s = function (e) {
return e == X
? function () {
return new Be(e, o, r, i)
.set("ua", o)
.set(H, this.getBrowser())
.set(Y, this.getCPU())
.set(j, this.getDevice())
.set(q, this.getEngine())
.set(z, this.getOS())
.get();
}
: function () {
return new Be(e, o, r[e], i).parseUA().get();
};
};
return (
$e
.call(this, [
["getBrowser", s(H)],
["getCPU", s(Y)],
["getDevice", s(j)],
["getEngine", s(q)],
["getOS", s(z)],
["getResult", s(X)],
[
"getUA",
function () {
return o;
},
],
[
"setUA",
function (e) {
return (
Me(e) && (o = e.length > 500 ? Le(e, 500) : e), this
);
},
],
])
.setUA(o),
this
);
}
(Ne.VERSION = "2.0.0-rc.1"),
(Ne.BROWSER = xe([m, v, c, g])),
(Ne.CPU = xe([w])),
(Ne.DEVICE = xe([p, h, g, y, b, x, S, k, M])),
(Ne.ENGINE = Ne.OS = xe([m, v])),
typeof t !== d
? ("object" !== d && e.exports && (t = e.exports = Ne),
(t.UAParser = Ne))
: "function" === s && a.amdO
? (o = function () {
return Ne;
}.call(t, a, t, e)) === n || (e.exports = o)
: ye && (i.UAParser = Ne);
var He = ye && (i.jQuery || i.Zepto);
if (He && !He.ua) {
var Ye = new Ne();
(He.ua = Ye.getResult()),
(He.ua.get = function () {
return Ye.getUA();
}),
(He.ua.set = function (e) {
Ye.setUA(e);
var t = Ye.getResult();
for (var a in t) He.ua[a] = t[a];
});
}
})("object" == typeof window ? window : this);
},
},
t = {};
function a(o) {
var i = t[o];
if (void 0 !== i) return i.exports;
var n = (t[o] = { exports: {} });
return e[o].call(n.exports, n, n.exports, a), n.exports;
}
(a.amdO = {}),
(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 o in t)
a.o(t, o) &&
!a.o(e, o) &&
Object.defineProperty(e, o, { enumerable: !0, get: t[o] });
}),
(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.r = function (e) {
"undefined" != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }),
Object.defineProperty(e, "__esModule", { value: !0 });
}),
a(6864);
})();