Skip to content

Instantly share code, notes, and snippets.

@adammw
Last active April 29, 2016 09:00
Show Gist options
  • Save adammw/c3ecd29fe44ace64bf21 to your computer and use it in GitHub Desktop.
Save adammw/c3ecd29fe44ace64bf21 to your computer and use it in GitHub Desktop.
require = function a(b, c, d) {
function e(g, h) {
if (!c[g]) {
if (!b[g]) {
var i = "function" == typeof require && require;
if (!h && i) return i(g, !0);
if (f) return f(g, !0);
var j = new Error("Cannot find module '" + g + "'");
throw j.code = "MODULE_NOT_FOUND", j
}
var k = c[g] = {
exports: {}
};
b[g][0].call(k.exports, function(a) {
var c = b[g][1][a];
return e(c ? c : a)
}, k, k.exports, a, b, c, d)
}
return c[g].exports
}
for (var f = "function" == typeof require && require, g = 0; d.length > g; g++) e(d[g]);
return e
}({
1: [function(a, b, c) {
function d() {
k = !1, h.length ? j = h.concat(j) : l = -1, j.length && e()
}
function e() {
if (!k) {
var a = setTimeout(d);
k = !0;
for (var b = j.length; b;) {
for (h = j, j = []; ++l < b;) h && h[l].run();
l = -1, b = j.length
}
h = null, k = !1, clearTimeout(a)
}
}
function f(a, b) {
this.fun = a, this.array = b
}
function g() {}
var h, i = b.exports = {},
j = [],
k = !1,
l = -1;
i.nextTick = function(a) {
var b = new Array(arguments.length - 1);
if (arguments.length > 1)
for (var c = 1; c < arguments.length; c++) b[c - 1] = arguments[c];
j.push(new f(a, b)), 1 !== j.length || k || setTimeout(e, 0)
}, f.prototype.run = function() {
this.fun.apply(null, this.array)
}, i.title = "browser", i.browser = !0, i.env = {}, i.argv = [], i.version = "", i.versions = {}, i.on = g, i.addListener = g, i.once = g, i.off = g, i.removeListener = g, i.removeAllListeners = g, i.emit = g, i.binding = function(a) {
throw new Error("process.binding is not supported")
}, i.cwd = function() {
return "/"
}, i.chdir = function(a) {
throw new Error("process.chdir is not supported")
}, i.umask = function() {
return 0
}
}, {}],
2: [function(a, b, c) {
! function(a, d) {
"use strict";
function e() {
return "undefined" == typeof document ? "" : document.location.href
}
function f(a, b) {
var c, d;
if (T) {
b = b || {}, a = "raven" + a.substr(0, 1).toUpperCase() + a.substr(1), document.createEvent ? (c = document.createEvent("HTMLEvents"), c.initEvent(a, !0, !0)) : (c = document.createEventObject(), c.eventType = a);
for (d in b) o(b, d) && (c[d] = b[d]);
if (document.createEvent) document.dispatchEvent(c);
else try {
document.fireEvent("on" + c.eventType.toLowerCase(), c)
} catch (e) {}
}
}
function g(a) {
this.name = "RavenConfigError", this.message = a
}
function h(a) {
var b = da.exec(a),
c = {},
d = 7;
try {
for (; d--;) c[ca[d]] = b[d] || ""
} catch (e) {
throw new g("Invalid DSN: " + a)
}
if (c.pass) throw new g("Do not specify your private key in the DSN!");
return c
}
function i(a) {
return void 0 === a
}
function j(a) {
return "function" == typeof a
}
function k(a) {
return "[object String]" === X.toString.call(a)
}
function l(a) {
return "object" == typeof a && null !== a
}
function m(a) {
for (var b in a) return !1;
return !0
}
function n(a) {
return l(a) && "[object Error]" === X.toString.call(a) || a instanceof Error
}
function o(a, b) {
return X.hasOwnProperty.call(a, b)
}
function p(a, b) {
var c, d;
if (i(a.length))
for (c in a) o(a, c) && b.call(null, c, a[c]);
else if (d = a.length)
for (c = 0; d > c; c++) b.call(null, c, a[c])
}
function q(a, b) {
var c = [];
a.stack && a.stack.length && p(a.stack, function(a, b) {
var d = r(b);
d && c.push(d)
}), f("handle", {
stackInfo: a,
options: b
}), t(a.name, a.message, a.url, a.lineno, c, b)
}
function r(a) {
if (a.url) {
var b, c = {
filename: a.url,
lineno: a.line,
colno: a.column,
"function": a.func || "?"
},
d = s(a);
if (d) {
var e = ["pre_context", "context_line", "post_context"];
for (b = 3; b--;) c[e[b]] = d[b]
}
return c.in_app = !(V.includePaths.test && !V.includePaths.test(c.filename) || /(Raven|TraceKit)\./.test(c["function"]) || /raven\.(min\.)?js$/.test(c.filename)), c
}
}
function s(a) {
if (a.context && V.fetchContext) {
for (var b = a.context, c = ~~(b.length / 2), d = b.length, e = !1; d--;)
if (b[d].length > 300) {
e = !0;
break
}
if (e) {
if (i(a.column)) return;
return [
[], b[c].substr(a.column, 50), []
]
}
return [b.slice(0, c), b[c], b.slice(c + 1)]
}
}
function t(a, b, c, d, e, f) {
var g, h;
V.ignoreErrors.test && V.ignoreErrors.test(b) || (b += "", h = a + ": " + b, e && e.length ? (c = e[0].filename || c, e.reverse(), g = {
frames: e
}) : c && (g = {
frames: [{
filename: c,
lineno: d,
in_app: !0
}]
}), V.ignoreUrls.test && V.ignoreUrls.test(c) || (!V.whitelistUrls.test || V.whitelistUrls.test(c)) && z(u({
exception: {
values: [{
type: a,
value: b,
stacktrace: g
}]
},
culprit: c,
message: h
}, f)))
}
function u(a, b) {
return b ? (p(b, function(b, c) {
a[b] = c
}), a) : a
}
function v(a, b) {
return b >= a.length ? a : a.substr(0, b) + "…"
}
function w(a) {
var b = V.maxMessageLength;
if (a.message = v(a.message, b), a.exception) {
var c = a.exception.values[0];
c.value = v(c.value, b)
}
return a
}
function x() {
return +new Date
}
function y() {
if (T && document.location && document.location.href) {
var a = {
headers: {
"User-Agent": navigator.userAgent
}
};
return a.url = document.location.href, document.referrer && (a.headers.Referer = document.referrer), a
}
}
function z(a) {
var b = {
project: Q,
logger: V.logger,
platform: "javascript"
},
c = y();
c && (b.request = c), a = u(b, a), a.tags = u(u({}, U.tags), a.tags), a.extra = u(u({}, U.extra), a.extra), a.extra["session:duration"] = x() - _, m(a.tags) && delete a.tags, U.user && (a.user = U.user), V.release && (a.release = V.release), V.serverName && (a.server_name = V.serverName), j(V.dataCallback) && (a = V.dataCallback(a) || a), a && !m(a) && (!j(V.shouldSendCallback) || V.shouldSendCallback(a)) && (N = a.event_id || (a.event_id = E()), a = w(a), F("debug", "Raven about to send:", a), C() && (V.transport || A)({
url: O,
auth: {
sentry_version: "7",
sentry_client: "raven-js/" + ba.VERSION,
sentry_key: P
},
data: a,
options: V,
onSuccess: function() {
f("success", {
data: a,
src: O
})
},
onError: function() {
f("failure", {
data: a,
src: O
})
}
}))
}
function A(a) {
a.auth.sentry_data = JSON.stringify(a.data);
var b = B(),
c = a.url + "?" + H(a.auth),
d = a.options.crossOrigin;
(d || "" === d) && (b.crossOrigin = d), b.onload = a.onSuccess, b.onerror = b.onabort = a.onError, b.src = c
}
function B() {
return document.createElement("img")
}
function C() {
return S ? O ? !0 : (ea || F("error", "Error: Raven has not been configured."), ea = !0, !1) : !1
}
function D(a) {
for (var b, c = [], d = 0, e = a.length; e > d; d++) b = a[d], k(b) ? c.push(b.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1")) : b && b.source && c.push(b.source);
return new RegExp(c.join("|"), "i")
}
function E() {
var b = a.crypto || a.msCrypto;
if (!i(b) && b.getRandomValues) {
var c = new Uint16Array(8);
b.getRandomValues(c), c[3] = 4095 & c[3] | 16384, c[4] = 16383 & c[4] | 32768;
var d = function(a) {
for (var b = a.toString(16); 4 > b.length;) b = "0" + b;
return b
};
return d(c[0]) + d(c[1]) + d(c[2]) + d(c[3]) + d(c[4]) + d(c[5]) + d(c[6]) + d(c[7])
}
return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function(a) {
var b = 16 * Math.random() | 0,
c = "x" == a ? b : 3 & b | 8;
return c.toString(16)
})
}
function F(a) {
Z[a] && ba.debug && Z[a].apply(Y, K.call(arguments, 1))
}
function G() {
var b = a.RavenConfig;
b && ba.config(b.dsn, b.config).install()
}
function H(a) {
var b = [];
return p(a, function(a, c) {
b.push(encodeURIComponent(a) + "=" + encodeURIComponent(c))
}), b.join("&")
}
function I(a, b) {
i(b) ? delete U[a] : U[a] = u(U[a] || {}, b)
}
var J = {
remoteFetching: !1,
collectWindowErrors: !0,
linesOfContext: 7,
debug: !1
},
K = [].slice,
L = "?";
J.report = function() {
function b(a) {
i(), p.push(a)
}
function c(a) {
for (var b = p.length - 1; b >= 0; --b) p[b] === a && p.splice(b, 1)
}
function f() {
j(), p = []
}
function g(a, b) {
var c = null;
if (!b || J.collectWindowErrors) {
for (var d in p)
if (o(p, d)) try {
p[d].apply(null, [a].concat(K.call(arguments, 2)))
} catch (e) {
c = e
}
if (c) throw c
}
}
function h(a, b, c, d, f) {
var h = null;
if (s) J.computeStackTrace.augmentStackTraceWithInitialElement(s, b, c, a), k();
else if (f) h = J.computeStackTrace(f), g(h, !0);
else {
var i = {
url: b,
line: c,
column: d
};
i.func = J.computeStackTrace.guessFunctionName(i.url, i.line), i.context = J.computeStackTrace.gatherContext(i.url, i.line), h = {
message: a,
url: e(),
stack: [i]
}, g(h, !0)
}
return m ? m.apply(this, arguments) : !1
}
function i() {
n || (m = a.onerror, a.onerror = h, n = !0)
}
function j() {
n && (a.onerror = m, n = !1, m = d)
}
function k() {
var a = s,
b = q;
q = null, s = null, r = null, g.apply(null, [a, !1].concat(b))
}
function l(b, c) {
var d = K.call(arguments, 1);
if (s) {
if (r === b) return;
k()
}
var e = J.computeStackTrace(b);
if (s = e, r = b, q = d, a.setTimeout(function() {
r === b && k()
}, e.incomplete ? 2e3 : 0), c !== !1) throw b
}
var m, n, p = [],
q = null,
r = null,
s = null;
return l.subscribe = b, l.unsubscribe = c, l.uninstall = f, l
}(), J.computeStackTrace = function() {
function b(b) {
if (!J.remoteFetching) return "";
try {
var c = function() {
try {
return new a.XMLHttpRequest
} catch (b) {
return new a.ActiveXObject("Microsoft.XMLHTTP")
}
},
d = c();
return d.open("GET", b, !1), d.send(""), d.responseText
} catch (e) {
return ""
}
}
function c(a) {
if (!k(a)) return [];
if (!o(u, a)) {
var c = "",
d = "";
try {
d = document.domain
} catch (e) {} - 1 !== a.indexOf(d) && (c = b(a)), u[a] = c ? c.split("\n") : []
}
return u[a]
}
function d(a, b) {
var d, e = /function ([^(]*)\(([^)]*)\)/,
f = /['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,
g = "",
h = 10,
j = c(a);
if (!j.length) return L;
for (var k = 0; h > k; ++k)
if (g = j[b - k] + g, !i(g)) {
if (d = f.exec(g)) return d[1];
if (d = e.exec(g)) return d[1]
}
return L
}
function f(a, b) {
var d = c(a);
if (!d.length) return null;
var e = [],
f = Math.floor(J.linesOfContext / 2),
g = f + J.linesOfContext % 2,
h = Math.max(0, b - f - 1),
j = Math.min(d.length, b + g - 1);
b -= 1;
for (var k = h; j > k; ++k) i(d[k]) || e.push(d[k]);
return e.length > 0 ? e : null
}
function g(a) {
return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g, "\\$&")
}
function h(a) {
return g(a).replace("<", "(?:<|&lt;)").replace(">", "(?:>|&gt;)").replace("&", "(?:&|&amp;)").replace('"', '(?:"|&quot;)').replace(/\s+/g, "\\s+")
}
function j(a, b) {
for (var d, e, f = 0, g = b.length; g > f; ++f)
if ((d = c(b[f])).length && (d = d.join("\n"), e = a.exec(d))) return {
url: b[f],
line: d.substring(0, e.index).split("\n").length,
column: e.index - d.lastIndexOf("\n", e.index) - 1
};
return null
}
function l(a, b, d) {
var e, f = c(b),
h = new RegExp("\\b" + g(a) + "\\b");
return d -= 1, f && f.length > d && (e = h.exec(f[d])) ? e.index : null
}
function m(b) {
if ("undefined" != typeof document) {
for (var c, d, e, f, i = [a.location.href], k = document.getElementsByTagName("script"), l = "" + b, m = /^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/, n = /^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/, o = 0; k.length > o; ++o) {
var p = k[o];
p.src && i.push(p.src)
}
if (e = m.exec(l)) {
var q = e[1] ? "\\s+" + e[1] : "",
r = e[2].split(",").join("\\s*,\\s*");
c = g(e[3]).replace(/;$/, ";?"), d = new RegExp("function" + q + "\\s*\\(\\s*" + r + "\\s*\\)\\s*{\\s*" + c + "\\s*}")
} else d = new RegExp(g(l).replace(/\s+/g, "\\s+"));
if (f = j(d, i)) return f;
if (e = n.exec(l)) {
var s = e[1];
if (c = h(e[2]), d = new RegExp("on" + s + "=[\\'\"]\\s*" + c + "\\s*[\\'\"]", "i"), f = j(d, i[0])) return f;
if (d = new RegExp(c), f = j(d, i)) return f
}
return null
}
}
function n(a) {
if (!i(a.stack) && a.stack) {
for (var b, c, g = /^\s*at (.*?) ?\(?((?:(?:file|https?|chrome-extension):.*?)|<anonymous>):(\d+)(?::(\d+))?\)?\s*$/i, h = /^\s*(.*?)(?:\((.*?)\))?@((?:file|https?|chrome).*?):(\d+)(?::(\d+))?\s*$/i, j = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|http|https):.*?):(\d+)(?::(\d+))?\)?\s*$/i, k = a.stack.split("\n"), m = [], n = /^(.*) is undefined$/.exec(a.message), o = 0, p = k.length; p > o; ++o) {
if (b = h.exec(k[o])) c = {
url: b[3],
func: b[1] || L,
args: b[2] ? b[2].split(",") : "",
line: +b[4],
column: b[5] ? +b[5] : null
};
else if (b = g.exec(k[o])) c = {
url: b[2],
func: b[1] || L,
line: +b[3],
column: b[4] ? +b[4] : null
};
else {
if (!(b = j.exec(k[o]))) continue;
c = {
url: b[2],
func: b[1] || L,
line: +b[3],
column: b[4] ? +b[4] : null
}
}!c.func && c.line && (c.func = d(c.url, c.line)), c.line && (c.context = f(c.url, c.line)), m.push(c)
}
return m.length ? (m[0].line && !m[0].column && n ? m[0].column = l(n[1], m[0].url, m[0].line) : m[0].column || i(a.columnNumber) || (m[0].column = a.columnNumber + 1), {
name: a.name,
message: a.message,
url: e(),
stack: m
}) : null
}
}
function p(a) {
var b = a.stacktrace;
if (!i(a.stacktrace) && a.stacktrace) {
for (var c, g = / line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i, h = b.split("\n"), j = [], k = 0, l = h.length; l > k; k += 2)
if (c = g.exec(h[k])) {
var m = {
line: +c[1],
column: +c[2],
func: c[3] || c[4],
args: c[5] ? c[5].split(",") : [],
url: c[6]
};
if (!m.func && m.line && (m.func = d(m.url, m.line)), m.line) try {
m.context = f(m.url, m.line)
} catch (n) {}
m.context || (m.context = [h[k + 1]]), j.push(m)
}
return j.length ? {
name: a.name,
message: a.message,
url: e(),
stack: j
} : null
}
}
function q(b) {
var g = b.message.split("\n");
if (4 > g.length) return null;
var i, k, l, m, n = /^\s*Line (\d+) of linked script ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i,
p = /^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i,
q = /^\s*Line (\d+) of function script\s*$/i,
r = [],
s = document.getElementsByTagName("script"),
t = [];
for (k in s) o(s, k) && !s[k].src && t.push(s[k]);
for (k = 2, l = g.length; l > k; k += 2) {
var u = null;
if (i = n.exec(g[k])) u = {
url: i[2],
func: i[3],
line: +i[1]
};
else if (i = p.exec(g[k])) {
u = {
url: i[3],
func: i[4]
};
var v = +i[1],
w = t[i[2] - 1];
if (w && (m = c(u.url))) {
m = m.join("\n");
var x = m.indexOf(w.innerText);
x >= 0 && (u.line = v + m.substring(0, x).split("\n").length)
}
} else if (i = q.exec(g[k])) {
var y = a.location.href.replace(/#.*$/, ""),
z = i[1],
A = new RegExp(h(g[k + 1]));
m = j(A, [y]), u = {
url: y,
line: m ? m.line : z,
func: ""
}
}
if (u) {
u.func || (u.func = d(u.url, u.line));
var B = f(u.url, u.line),
C = B ? B[Math.floor(B.length / 2)] : null;
u.context = B && C.replace(/^\s*/, "") === g[k + 1].replace(/^\s*/, "") ? B : [g[k + 1]], r.push(u)
}
}
return r.length ? {
name: b.name,
message: g[0],
url: e(),
stack: r
} : null
}
function r(a, b, c, e) {
var g = {
url: b,
line: c
};
if (g.url && g.line) {
a.incomplete = !1, g.func || (g.func = d(g.url, g.line)), g.context || (g.context = f(g.url, g.line));
var h = / '([^']+)' /.exec(e);
if (h && (g.column = l(h[1], g.url, g.line)), a.stack.length > 0 && a.stack[0].url === g.url) {
if (a.stack[0].line === g.line) return !1;
if (!a.stack[0].line && a.stack[0].func === g.func) return a.stack[0].line = g.line, a.stack[0].context = g.context, !1
}
return a.stack.unshift(g), a.partial = !0, !0
}
return a.incomplete = !0, !1
}
function s(a, b) {
for (var c, f, g, h = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i, i = [], j = {}, k = !1, n = s.caller; n && !k; n = n.caller)
if (n !== t && n !== J.report) {
if (f = {
url: null,
func: L,
line: null,
column: null
}, n.name ? f.func = n.name : (c = h.exec(n.toString())) && (f.func = c[1]), "undefined" == typeof f.func) try {
f.func = c.input.substring(0, c.input.indexOf("{"))
} catch (o) {}
if (g = m(n)) {
f.url = g.url, f.line = g.line, f.func === L && (f.func = d(f.url, f.line));
var p = / '([^']+)' /.exec(a.message || a.description);
p && (f.column = l(p[1], g.url, g.line))
}
j["" + n] ? k = !0 : j["" + n] = !0, i.push(f)
}
b && i.splice(0, b);
var q = {
name: a.name,
message: a.message,
url: e(),
stack: i
};
return r(q, a.sourceURL || a.fileName, a.line || a.lineNumber, a.message || a.description), q
}
function t(a, b) {
var c = null;
b = null == b ? 0 : +b;
try {
if (c = p(a)) return c
} catch (d) {
if (J.debug) throw d
}
try {
if (c = n(a)) return c
} catch (d) {
if (J.debug) throw d
}
try {
if (c = q(a)) return c
} catch (d) {
if (J.debug) throw d
}
try {
if (c = s(a, b + 1)) return c
} catch (d) {
if (J.debug) throw d
}
return {
name: a.name,
message: a.message,
url: e()
}
}
var u = {};
return t.augmentStackTraceWithInitialElement = r, t.computeStackTraceFromStackProp = n, t.guessFunctionName = d, t.gatherContext = f, t
}();
var M, N, O, P, Q, R = a.Raven,
S = !("object" != typeof JSON || !JSON.stringify),
T = "undefined" != typeof document,
U = {},
V = {
logger: "javascript",
ignoreErrors: [],
ignoreUrls: [],
whitelistUrls: [],
includePaths: [],
crossOrigin: "anonymous",
collectWindowErrors: !0,
maxMessageLength: 100
},
W = !1,
X = Object.prototype,
Y = a.console || {},
Z = {},
$ = [],
_ = x();
for (var aa in Y) Z[aa] = Y[aa];
var ba = {
VERSION: "1.3.0",
debug: !1,
noConflict: function() {
return a.Raven = R, ba
},
config: function(a, b) {
if (O) return F("error", "Error: Raven has already been configured"), ba;
if (!a) return ba;
var c = h(a),
d = c.path.lastIndexOf("/"),
e = c.path.substr(1, d);
return b && p(b, function(a, b) {
"tags" == a || "extra" == a ? U[a] = b : V[a] = b
}), V.ignoreErrors.push(/^Script error\.?$/), V.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/), V.ignoreErrors = D(V.ignoreErrors), V.ignoreUrls = V.ignoreUrls.length ? D(V.ignoreUrls) : !1, V.whitelistUrls = V.whitelistUrls.length ? D(V.whitelistUrls) : !1, V.includePaths = D(V.includePaths), P = c.user, Q = c.path.substr(d + 1), O = "//" + c.host + (c.port ? ":" + c.port : "") + "/" + e + "api/" + Q + "/store/", c.protocol && (O = c.protocol + ":" + O), V.fetchContext && (J.remoteFetching = !0), V.linesOfContext && (J.linesOfContext = V.linesOfContext), J.collectWindowErrors = !!V.collectWindowErrors, ba
},
install: function() {
return C() && !W && (J.report.subscribe(q), p($, function(a, b) {
b()
}), W = !0), ba
},
context: function(a, b, c) {
return j(a) && (c = b || [], b = a, a = d), ba.wrap(a, b).apply(this, c)
},
wrap: function(a, b) {
function c() {
for (var c = [], d = arguments.length, e = !a || a && a.deep !== !1; d--;) c[d] = e ? ba.wrap(a, arguments[d]) : arguments[d];
try {
return b.apply(this, c)
} catch (f) {
throw ba.captureException(f, a), f
}
}
if (i(b) && !j(a)) return a;
if (j(a) && (b = a, a = d), !j(b)) return b;
if (b.__raven__) return b;
for (var e in b) o(b, e) && (c[e] = b[e]);
return c.prototype = b.prototype, c.__raven__ = !0, c.__inner__ = b, c
},
uninstall: function() {
return J.report.uninstall(), W = !1, ba
},
captureException: function(a, b) {
if (!n(a)) return ba.captureMessage(a, b);
M = a;
try {
var c = J.computeStackTrace(a);
q(c, b)
} catch (d) {
if (a !== d) throw d
}
return ba
},
captureMessage: function(a, b) {
return V.ignoreErrors.test && V.ignoreErrors.test(a) ? void 0 : (z(u({
message: a + ""
}, b)), ba)
},
addPlugin: function(a) {
return $.push(a), W && a(), ba
},
setUserContext: function(a) {
return U.user = a, ba
},
setExtraContext: function(a) {
return I("extra", a), ba
},
setTagsContext: function(a) {
return I("tags", a), ba
},
clearContext: function() {
return U = {}, ba
},
getContext: function() {
return JSON.parse(JSON.stringify(U))
},
setRelease: function(a) {
return V.release = a, ba
},
setDataCallback: function(a) {
return V.dataCallback = a, ba
},
setShouldSendCallback: function(a) {
return V.shouldSendCallback = a, ba
},
setTransport: function(a) {
return V.transport = a, ba
},
lastException: function() {
return M
},
lastEventId: function() {
return N
},
isSetup: function() {
return C()
}
};
ba.setUser = ba.setUserContext, ba.setReleaseContext = ba.setRelease;
var ca = "source protocol user pass host port path".split(" "),
da = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;
g.prototype = new Error, g.prototype.constructor = g;
var ea;
G(), a.Raven = ba, "function" == typeof define && define.amd ? define("raven", [], function() {
return ba
}) : "object" == typeof b ? b.exports = ba : "object" == typeof c && (c = ba)
}("undefined" != typeof window ? window : this)
}, {}],
3: [function(a, b, c) {
var d = {};
d.EN = {
OFFLINE__OFFLINE_TITLE: "You’re offline",
OFFLINE__OFFLINE_1: "Spotify is not available when you’re offline. Please go online and try again.",
GENERIC__LOGIN: "Log in",
GENERIC__LOGIN_FAILED: "Log In Failed",
GENERIC__RETRY: "Please try again",
RECEIVER__LANDING_REMOTE_CONTROL: "Remote control",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Use your phone or tablet to control the music on your TV.",
RECEIVER__NOT_SUPPORTED: "Spotify is not supported on this device right now.",
RECEIVER__MORE_INFO: "For more info, please go to {0}",
RECEIVER__LANDING_HEADER: "Login to Spotify using Connect",
RECEIVER__LANDING_STEPS_1: "1. Join the same WiFi network as your TV.",
RECEIVER__LANDING_STEPS_2: "2. Open Spotify on your phone or tablet and play a song.",
RECEIVER__LANDING_STEPS_3: "3. Tap the bar at the bottom of the screen.",
RECEIVER__LANDING_STEPS_4: "4. Tap DEVICES AVAILABLE to see discovered devices.",
RECEIVER__LANDING_STEPS_5: "5. Choose your TV from the list."
}, d.ES = {
OFFLINE__OFFLINE_TITLE: "Estás sin conexión",
OFFLINE__OFFLINE_1: "Spotify no está disponible sin conexión. Conéctate a Internet y prueba de nuevo.",
GENERIC__LOGIN: "Iniciar sesión",
GENERIC__LOGIN_FAILED: "No se ha logrado iniciar sesión",
GENERIC__RETRY: "Por favor, inténtalo de nuevo",
RECEIVER__LANDING_REMOTE_CONTROL: "Control remoto",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Usa tu teléfono o tablet para controlar la música en tu televisor.",
RECEIVER__NOT_SUPPORTED: "Por el momento, Spotify no es compatible con este dispositivo.",
RECEIVER__MORE_INFO: "Si quieres más información, entra en {0}",
RECEIVER__LANDING_HEADER: "Iniciar sesión en Spotify usando Connect",
RECEIVER__LANDING_STEPS_1: "1. Conéctate a la misma red WiFi que tu televisor.",
RECEIVER__LANDING_STEPS_2: "2. Abre Spotify en tu teléfono o tablet y dale a reproducir una canción.",
RECEIVER__LANDING_STEPS_3: "3. Pulsa en la barra que hay en la parte de abajo de la pantalla.",
RECEIVER__LANDING_STEPS_4: "4. Pulsa en DISPOSITIVOS DISPONIBLES para ver los dispositivos identificados.",
RECEIVER__LANDING_STEPS_5: "5. Selecciona tu televisor en la lista."
}, d.ES_419 = {
OFFLINE__OFFLINE_TITLE: "Estás desconectado",
OFFLINE__OFFLINE_1: "Spotify no está disponible cuando no estás conectado a la red. Conéctate a Internet e inténtalo de nuevo.",
GENERIC__LOGIN: "Iniciar sesión",
GENERIC__LOGIN_FAILED: "Falló el inicio de sesión",
GENERIC__RETRY: "Inténtalo nuevamente",
RECEIVER__LANDING_REMOTE_CONTROL: "Control remoto",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Usa tu teléfono o tablet para controlar la música en tu televisor.",
RECEIVER__NOT_SUPPORTED: "Por el momento, Spotify no es compatible con este dispositivo.",
RECEIVER__MORE_INFO: "Para más información, visita {0}",
RECEIVER__LANDING_HEADER: "Inicia sesión en Spotify mediante Connect",
RECEIVER__LANDING_STEPS_1: "1. Conéctate a la misma red Wi-Fi a la que esté conectado tu televisor.",
RECEIVER__LANDING_STEPS_2: "2. Abre Spotify en tu teléfono o tablet y reproduce una canción.",
RECEIVER__LANDING_STEPS_3: "3. Pulsa la barra que aparece en la parte inferior de la pantalla.",
RECEIVER__LANDING_STEPS_4: "4. Pulsa DISPOSITIVOS DISPONIBLES para ver los dispositivos que aparecieron.",
RECEIVER__LANDING_STEPS_5: "5. Elige tu televisor de la lista."
}, d.DE = {
OFFLINE__OFFLINE_TITLE: "Du bist offline",
OFFLINE__OFFLINE_1: "Spotify ist im Offline-Modus nicht verfügbar. Geh online und versuche es erneut.",
GENERIC__LOGIN: "Anmelden",
GENERIC__LOGIN_FAILED: "Anmeldung fehlgeschlagen",
GENERIC__RETRY: "Versuche es bitte erneut",
RECEIVER__LANDING_REMOTE_CONTROL: "Fernbedienung",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Steuere die Musik auf Deinem Fernseher über Dein Smartphone oder Tablet.",
RECEIVER__NOT_SUPPORTED: "Spotify wird auf diesem Gerät zurzeit nicht unterstützt.",
RECEIVER__MORE_INFO: "Weitere Informationen findest Du unter {0}",
RECEIVER__LANDING_HEADER: "Melde Dich über Connect bei Spotify an.",
RECEIVER__LANDING_STEPS_1: "1. Stell eine Verbindung zu demselben WLAN her, an das auch Dein Fernseher angeschlossen ist.",
RECEIVER__LANDING_STEPS_2: "2. Öffne Spotify auf Deinem Smartphone oder Tablet und spiel einen Song ab.",
RECEIVER__LANDING_STEPS_3: "3. Tippe unten im Bildschirm auf die Leiste.",
RECEIVER__LANDING_STEPS_4: "4. Tippe auf 'VERFÜGBARE GERÄTE', um alle gefundenen Geräte anzuzeigen.",
RECEIVER__LANDING_STEPS_5: "5. Wähle Deinen Fernseher aus der Liste aus."
}, d.FI = {
OFFLINE__OFFLINE_TITLE: "Olet offline-tilassa",
OFFLINE__OFFLINE_1: "Spotifyta ei voi käyttää ilman verkkoyhteyttä. Muodosta yhteys ja yritä uudelleen.",
GENERIC__LOGIN: "Kirjaudu sisään",
GENERIC__LOGIN_FAILED: "Sisäänkirjautuminen epäonnistui",
GENERIC__RETRY: "Yritä uudelleen",
RECEIVER__LANDING_REMOTE_CONTROL: "Etäohjaus",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Ohjaa television kautta kuuntelemaasi musiikkia puhelimella tai tablet-laitteella.",
RECEIVER__NOT_SUPPORTED: "Spotifyta ei toistaiseksi tueta tässä laitteessa.",
RECEIVER__MORE_INFO: "Saat lisätietoja täältä: {0}.",
RECEIVER__LANDING_HEADER: "Kirjautuminen Spotifyhin Connect-ominaisuuden avulla",
RECEIVER__LANDING_STEPS_1: "1. Liity samaan Wi-Fi-verkkoon kuin mihin televisiosi on liitetty.",
RECEIVER__LANDING_STEPS_2: "2. Avaa Spotify puhelimessa tai tablet-laitteessa ja toista kappale.",
RECEIVER__LANDING_STEPS_3: "3. Napauta näytön alareunassa olevaa palkkia.",
RECEIVER__LANDING_STEPS_4: "4. Tuo käytettävissä olevat laitteet näyttöön valitsemalla KÄYTETTÄVISSÄ OLEVAT LAITTEET.",
RECEIVER__LANDING_STEPS_5: "5. Valitse televisiosi luettelosta."
}, d.FR = {
OFFLINE__OFFLINE_TITLE: "Vous n'êtes pas connecté.",
OFFLINE__OFFLINE_1: "Spotify n'est pas disponible si vous êtes hors connexion. Connectez-vous et réessayez.",
GENERIC__LOGIN: "Connexion",
GENERIC__LOGIN_FAILED: "Échec de la connexion",
GENERIC__RETRY: "Réessayez.",
RECEIVER__LANDING_REMOTE_CONTROL: "Contrôle à distance",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Utilisez votre téléphone ou votre tablette pour contrôler la musique sur votre TV.",
RECEIVER__NOT_SUPPORTED: "Cet appareil n'est pas compatible avec Spotify pour le moment.",
RECEIVER__MORE_INFO: "Pour plus d'infos, allez sur {0}",
RECEIVER__LANDING_HEADER: "Connectez-vous à Spotify à l'aide de Spotify Connect.",
RECEIVER__LANDING_STEPS_1: "1. Connectez-vous au même réseau wifi que celui de votre téléviseur.",
RECEIVER__LANDING_STEPS_2: "2. Ouvrez Spotify sur votre téléphone ou votre tablette et écoutez un titre.",
RECEIVER__LANDING_STEPS_3: "3. Appuyez sur la barre en bas de l'écran.",
RECEIVER__LANDING_STEPS_4: "4. Appuyez sur APPAREILS DISPONIBLES pour visualiser les appareils détectés.",
RECEIVER__LANDING_STEPS_5: "5. Choisissez votre téléviseur dans la liste."
}, d.FR_CA = {
OFFLINE__OFFLINE_TITLE: "Vous êtes hors connexion",
OFFLINE__OFFLINE_1: "Spotify n'est pas disponible hors connexion. Veuillez accéder à Internet et réessayer.",
GENERIC__LOGIN: "Se connecter",
GENERIC__LOGIN_FAILED: "Échec de connexion",
GENERIC__RETRY: "Veuillez réessayer",
RECEIVER__LANDING_REMOTE_CONTROL: "Commande à distance",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Contrôlez la musique sur votre téléviseur en utilisant votre téléphone ou votre tablette.",
RECEIVER__NOT_SUPPORTED: "Spotify n'est pas encore pris en charge par cet appareil.",
RECEIVER__MORE_INFO: "Pour en savoir plus, veuillez visiter le {0}",
RECEIVER__LANDING_HEADER: "Connectez-vous à Spotify au moyen de Connect",
RECEIVER__LANDING_STEPS_1: "1. Connectez-vous au même réseau Wi-Fi que votre téléviseur.",
RECEIVER__LANDING_STEPS_2: "2. Ouvrez Spotify sur votre téléphone ou votre tablette et lisez une chanson.",
RECEIVER__LANDING_STEPS_3: "3. Appuyez sur la barre située au bas de l'écran.",
RECEIVER__LANDING_STEPS_4: "4. Appuyez sur APPAREILS DISPONIBLES pour voir les appareils trouvés.",
RECEIVER__LANDING_STEPS_5: "5. Choisissez votre téléviseur dans la liste."
}, d.IT = {
OFFLINE__OFFLINE_TITLE: "Sei offline",
OFFLINE__OFFLINE_1: "Spotify non è disponibile quando sei offline. Passa online e prova di nuovo.",
GENERIC__LOGIN: "Accedi",
GENERIC__LOGIN_FAILED: "Accesso non riuscito",
GENERIC__RETRY: "Riprova",
RECEIVER__LANDING_REMOTE_CONTROL: "Controllo a distanza",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Usa il telefono o il tablet per controllare la musica sul tuo TV.",
RECEIVER__NOT_SUPPORTED: "Spotify non è ancora supportato su questo dispositivo.",
RECEIVER__MORE_INFO: "Per maggiori informazioni, visita {0}",
RECEIVER__LANDING_HEADER: "Accedi a Spotify usando Connect",
RECEIVER__LANDING_STEPS_1: "1. Usa la stessa rete WiFi del tuo televisore.",
RECEIVER__LANDING_STEPS_2: "2. Apri Spotify sul tuo smartphone o sul tablet e riproduci un brano.",
RECEIVER__LANDING_STEPS_3: "3. Seleziona la barra in basso nella schermata.",
RECEIVER__LANDING_STEPS_4: "4. Seleziona DISPOSITIVI DISPONIBILI per vedere i dispositivi disponibili.",
RECEIVER__LANDING_STEPS_5: "5. Seleziona il tuo televisore nell'elenco."
}, d.JA = {
OFFLINE__OFFLINE_TITLE: "オフラインです",
OFFLINE__OFFLINE_1: "Spotifyはオフラインでは利用できません。インターネットに接続して再試行してください。",
GENERIC__LOGIN: "ログイン",
GENERIC__LOGIN_FAILED: "ログインに失敗しました",
GENERIC__RETRY: "再試行してください",
RECEIVER__LANDING_REMOTE_CONTROL: "リモートコントロール",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "携帯電話またはタブレットを使用して、TVで再生する音楽をコントロールできます。",
RECEIVER__NOT_SUPPORTED: "現在、このデバイスではSpotifyはサポートされていません。",
RECEIVER__MORE_INFO: "詳細については、{0}にアクセスしてください",
RECEIVER__LANDING_HEADER: "Connectを使用してSpotifyにログインする",
RECEIVER__LANDING_STEPS_1: "1. テレビと同じWiFiに接続します。",
RECEIVER__LANDING_STEPS_2: "2. スマートフォンまたはタブレットでSpotifyを開き、曲を再生します。",
RECEIVER__LANDING_STEPS_3: "3. 画面下部のバーをタップします。",
RECEIVER__LANDING_STEPS_4: "4. [利用可能なデバイス]をタップし、検出されたデバイスを確認します。",
RECEIVER__LANDING_STEPS_5: "5. デバイスのリストからテレビを選択します。"
}, d.NL = {
OFFLINE__OFFLINE_TITLE: "Je bent offline",
OFFLINE__OFFLINE_1: "Spotify is niet beschikbaar wanneer je offline bent. Ga online en probeer het opnieuw.",
GENERIC__LOGIN: "Inloggen",
GENERIC__LOGIN_FAILED: "Inloggen mislukt",
GENERIC__RETRY: "Probeer het opnieuw",
RECEIVER__LANDING_REMOTE_CONTROL: "Extern beheer",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Gebruik je telefoon of tablet om de muziek op je tv te beheren.",
RECEIVER__NOT_SUPPORTED: "Spotify wordt momenteel niet ondersteund op dit apparaat.",
RECEIVER__MORE_INFO: "Ga voor meer informatie naar {0}",
RECEIVER__LANDING_HEADER: "Log in bij Spotify via Connect",
RECEIVER__LANDING_STEPS_1: "1. Maak verbinding met hetzelfde wifi-netwerk als je tv.",
RECEIVER__LANDING_STEPS_2: "2. Open Spotify op je telefoon of tablet en speel een nummer af.",
RECEIVER__LANDING_STEPS_3: "3. Tik op de balk onder aan het scherm.",
RECEIVER__LANDING_STEPS_4: "4. Tik op BESCHIKBARE APPARATEN om te zien welke apparaten er zijn gevonden.",
RECEIVER__LANDING_STEPS_5: "5. Kies je tv uit de lijst."
}, d.PL = {
OFFLINE__OFFLINE_TITLE: "Brak połączenia z Internetem",
OFFLINE__OFFLINE_1: "Korzystanie z usługi Spotify bez połączenia z Internetem jest niemożliwe. Połącz się z Internetem i spróbuj ponownie.",
GENERIC__LOGIN: "Zaloguj się",
GENERIC__LOGIN_FAILED: "Logowanie nie powiodło się",
GENERIC__RETRY: "Spróbuj ponownie",
RECEIVER__LANDING_REMOTE_CONTROL: "Zdalne sterowanie",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Steruj muzyką na telewizorze za pomocą smartfona lub tabletu.",
RECEIVER__NOT_SUPPORTED: "Aplikacja Spotify nie jest obecnie obsługiwana na tym urządzeniu.",
RECEIVER__MORE_INFO: "Aby uzyskać więcej informacji, przejdź do {0}",
RECEIVER__LANDING_HEADER: "Zaloguj się na koncie Spotify za pomocą funkcji Connect",
RECEIVER__LANDING_STEPS_1: "1. Podłącz urządzenie do tej samej sieci Wi-Fi, co telewizor.",
RECEIVER__LANDING_STEPS_2: "2. Otwórz aplikację Spotify na telefonie lub tablecie i włącz odtwarzanie utworu.",
RECEIVER__LANDING_STEPS_3: "3. Kliknij pasek na dole ekranu.",
RECEIVER__LANDING_STEPS_4: "4. Kliknij DOSTĘPNE URZĄDZENIA, aby zobaczyć wszystkie dostępne urządzenia.",
RECEIVER__LANDING_STEPS_5: "5. Wybierz telewizor z listy urządzeń."
}, d.PT_BR = {
OFFLINE__OFFLINE_TITLE: "Você está offline",
OFFLINE__OFFLINE_1: "O Spotify não está disponível quando você está offline. Fique online e tente de novo.",
GENERIC__LOGIN: "Entrar",
GENERIC__LOGIN_FAILED: "Falha ao entrar",
GENERIC__RETRY: "Tente de novo",
RECEIVER__LANDING_REMOTE_CONTROL: "Controle remotamente",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Use o seu telefone ou tablet para controlar a música na sua TV.",
RECEIVER__NOT_SUPPORTED: "Por enquanto, o Spotify não tem suporte neste dispositivo.",
RECEIVER__MORE_INFO: "Para saber mais, acesse {0}",
RECEIVER__LANDING_HEADER: "Entre no Spotify usando o recurso Connect",
RECEIVER__LANDING_STEPS_1: "1. Conecte-se à mesma rede Wi-Fi da TV.",
RECEIVER__LANDING_STEPS_2: "2. Abra o Spotify em seu telefone ou tablet e toque uma música.",
RECEIVER__LANDING_STEPS_3: "3. Toque na barra na parte inferior da tela.",
RECEIVER__LANDING_STEPS_4: "4. Toque em DISPOSITIVOS DISPONÍVEIS para ver os dispositivos encontrados.",
RECEIVER__LANDING_STEPS_5: "5. Selecione sua TV na lista."
}, d.SV = {
OFFLINE__OFFLINE_TITLE: "Du är offline",
OFFLINE__OFFLINE_1: "Spotify är inte tillgängligt när du är offline. Gå online och försök igen.",
GENERIC__LOGIN: "Logga in",
GENERIC__LOGIN_FAILED: "Det gick inte att logga in",
GENERIC__RETRY: "Försök igen",
RECEIVER__LANDING_REMOTE_CONTROL: "Fjärrstyr",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Använd telefonen eller surfplattan för att styra musiken på TV:n.",
RECEIVER__NOT_SUPPORTED: "Spotify stöds inte på den här enheten just nu.",
RECEIVER__MORE_INFO: "Gå till {0} om du vill ha mer information",
RECEIVER__LANDING_HEADER: "Logga in på Spotify med Connect",
RECEIVER__LANDING_STEPS_1: "1. Anslut till samma Wi-Fi-nätverk som tv:n.",
RECEIVER__LANDING_STEPS_2: "2. Öppna Spotify på telefonen eller surfplattan och spela upp en låt.",
RECEIVER__LANDING_STEPS_3: "3. Tryck på fältet längst ned på skärmen.",
RECEIVER__LANDING_STEPS_4: "4. Tryck på TILLGÄNGLIGA ENHETER för att visa enheter i närheten.",
RECEIVER__LANDING_STEPS_5: "5. Välj din tv i listan."
}, d.TR = {
OFFLINE__OFFLINE_TITLE: "Çevrimdışısın",
OFFLINE__OFFLINE_1: "Spotify çevrimdışı kullanılamaz. Lütfen çevrimiçi ol ve tekrar dene.",
GENERIC__LOGIN: "Oturum aç",
GENERIC__LOGIN_FAILED: "Oturum Açılamadı",
GENERIC__RETRY: "Lütfen tekrar dene",
RECEIVER__LANDING_REMOTE_CONTROL: "Uzaktan denetim",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "Televizyonundaki müzikleri kontrol etmek için telefonunu veya tabletini kullan.",
RECEIVER__NOT_SUPPORTED: "Spotify şu anda bu cihazda desteklenmiyor.",
RECEIVER__MORE_INFO: "Daha fazla bilgi için lütfen {0} adresine gidin",
RECEIVER__LANDING_HEADER: "Connect ile Spotify hesabında oturum aç",
RECEIVER__LANDING_STEPS_1: "1. Televizyonunla aynı WiFi ağına bağlan.",
RECEIVER__LANDING_STEPS_2: "2. Spotify'ı telefonunda veya tabletinde aç ve bir şarkı çal.",
RECEIVER__LANDING_STEPS_3: "3. Ekranın en altındaki çubuğa dokun.",
RECEIVER__LANDING_STEPS_4: "4. Bulunan cihazları görmek için KULLANILABİLİR CİHAZLAR'a dokun.",
RECEIVER__LANDING_STEPS_5: "5. Listeden televizyonunu seç."
}, d.ZH_HANT = {
OFFLINE__OFFLINE_TITLE: "你目前為離線狀態",
OFFLINE__OFFLINE_1: "離線時無法使用 Spotify ,請上線後再試一次。",
GENERIC__LOGIN: "登入",
GENERIC__LOGIN_FAILED: "登入失敗",
GENERIC__RETRY: "請再試一次",
RECEIVER__LANDING_REMOTE_CONTROL: "遠端控制",
RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE: "使用手機或平板,控制電視上的音樂。",
RECEIVER__NOT_SUPPORTED: "Spotify 目前不支援這部裝置。",
RECEIVER__MORE_INFO: "請前往「{0}」了解更多資訊",
RECEIVER__LANDING_HEADER: "使用 Connect 登入 Spotify",
RECEIVER__LANDING_STEPS_1: "1. 加入你的電視所使用之相同 WiFi 網路。",
RECEIVER__LANDING_STEPS_2: "2. 在你的手機或平板電腦上開啟 Spotify,然後播放一首歌曲。",
RECEIVER__LANDING_STEPS_3: "3. 點選畫面底部的播放列。",
RECEIVER__LANDING_STEPS_4: "4. 點選「可用的裝置」查看偵測到的裝置。",
RECEIVER__LANDING_STEPS_5: "5. 從清單中選擇你的電視。"
}, b.exports = d
}, {}],
4: [function(a, b, c) {
(function(c) {
"use strict";
function d(a) {
m = a, a ? n = setTimeout(function() {
m = !1, n = null
}, o) : n && (clearTimeout(n), n = null)
}
function e() {}
b.exports = e;
var f = a("./currentUser.js"),
g = a("./eventBus.js"),
h = a("./config.js"),
i = a("./utils/applyEventHandler.js"),
j = a("./router/index.js"),
k = a("./ui/index.js"),
l = a("./interfaces/web/index.js"),
m = !1,
n = null,
o = 6e4;
e.prototype.EVENTS = {
SESSION_READY: 1
}, e.prototype.currentUser = f, e.prototype.init = function(a) {
this._init(a)
}, e.prototype.destroy = function(a) {
this._platform.sdk.logout(), "function" == typeof a && a()
}, e.prototype._init = function(a) {
this._platform = a, this._allowLogout = !0, i(this), this._registerEventHandlers()
}, e.prototype.reInit = function() {}, e.prototype._registerEventHandlers = function() {
g.on(g.ESDK_EVENTS.EVENT_INACTIVE, this.onInactive.bind(this)), g.on(g.ESDK_EVENTS.EVENT_PLAYTOKENLOST, this.onPlaytokenLost.bind(this)), g.on(g.ESDK_EVENTS.EVENT_LOGGEDIN, this.onLoggedIn.bind(this)), g.on(g.ESDK_EVENTS.EVENT_LOGGEDOUT, this.onLoggedOut.bind(this)), g.on(g.ESDK_EVENTS.EVENT_ON_OAUTHTOKEN, this.onOAuthToken.bind(this)), l.on(l.EVENTS.EXPIRED_TOKEN, this.onTokenExpired.bind(this))
}, e.prototype.onInactive = function(a, b) {
var c = this;
f.guest === !0 && (k.showLoadingScreen(), g.on(g.ESDK_EVENTS.EVENT_LOGGEDOUT, function() {
c.reInit(!0)
}, !0), this._platform.sdk.logout())
}, e.prototype.onUpgrade = function(a) {
k.showAlert(k.translation.getText("COMMON__UPSELL_ERROR_TITLE"), k.translation.getText("COMMON__UPSELL_ERROR_MESSAGE_GENERIC"))
}, e.prototype.onPlaytokenLost = function(a, b) {}, e.prototype.onLoggedIn = function(a, b) {
this.checkLoggedIn()
}, e.prototype.checkLoggedIn = function(a) {
var b = this;
this.getEsdkUserState(function(d, e) {
d || c.nextTick(function() {
b.emit(b.EVENTS.SESSION_READY)
}), a && a(d, e)
})
}, e.prototype.onLoggedOut = function(a, b) {
this.clear(), k.closeOverlay(), h.supports.library && (k.views.yourMusicView.invalidatePlaylists(), k.views.yourMusicView.invalidateSavedSongs()), h.supports.browse && (k.views.browseView.invalidateGenresAndMood(), k.views.browseView.invalidateFeatured(), k.views.browseView.invalidateNewReleases()), h.supports.connectOnly || j.go("/")
}, e.prototype.onOAuthToken = function(a) {
var b = this;
return a.error ? void b.reInit() : void l.setAccessToken(a.accessToken)
}, e.prototype.onTokenExpired = function(a) {
var b = this;
d(!0), this._platform.sdk.requestAccessToken(function(a) {
d(!1), a && (b.destroy(), k.showAlert(k.translation.getText("GENERIC__LOGIN_FAILED"), k.translation.getText("GENERIC__RETRY")))
})
}, e.prototype.allowLogout = function() {
return this._allowLogout
}, e.prototype.manageSubscription = function() {}, e.prototype.getEsdkUserState = function(a) {
var b = function() {
l.getCurrentUserInformation(function(b, c) {
b ? a(b, null) : a(null, f)
})
};
l.on(l.EVENTS.HAVE_TOKEN, b, !0), this._platform.sdk.requestAccessToken(function(c) {
c && (l.ignore(l.EVENTS.HAVE_TOKEN, b), a(new Error("No access token"), null))
})
}, e.prototype.clear = function() {
f.country = void 0, f.username = void 0, f.displayName = void 0, f.displayImage = null, f.product = void 0, f.id = void 0
}
}).call(this, a("_process"))
}, {
"./config.js": 8,
"./currentUser.js": 10,
"./eventBus.js": 11,
"./interfaces/web/index.js": 13,
"./router/index.js": 22,
"./ui/index.js": 34,
"./utils/applyEventHandler.js": 55,
_process: 1
}],
5: [function(a, b, c) {
var d = a("../eventBus.js"),
e = function() {
d.on(d.ESDK_EVENTS.EVENT_ERROR, function(a) {})
};
b.exports = e
}, {
"../eventBus.js": 11
}],
6: [function(a, b, c) {
var d = a("../eventBus.js"),
e = function() {
"use strict";
d.on(d.ESDK_EVENTS.EVENT_ON_BECAMEPREMIUM, function() {
Spotify.session.reInit()
}), d.on(d.ESDK_EVENTS.EVENT_ON_LOSTPREMIUM, function() {
Spotify.session.reInit()
})
};
b.exports = e
}, {
"../eventBus.js": 11
}],
7: [function(a, b, c) {
"use strict";
var d = {};
b.exports = d;
var e = a("./utils/callbackHandler.js"),
f = a("./eventBus.js"),
g = a("./utils/applyEventHandler.js"),
h = [],
i = !1,
j = {
BRIDGE_LOADED: 1
},
k = {
LOADED: 1,
CREATED: 2,
DESTROYED: 3
};
g(j), g(d), d.handlesCallbacks = !1, d.available = !1, d.create = function(a) {
var b = this,
c = JSON.stringify(a);
this.available || i ? b._doCreate(c) : b.on(k.LOADED, function() {
b._doCreate(c)
})
}, d.execute = function(a, b) {
if (this.available) {
this.handlesCallbacks && (a.msgId = e.getMsgId(b));
var c = JSON.stringify(a);
this._doExecute(c, b)
} else h && h.push({
payload: a,
callback: b
})
}, d.release = function() {
this.available && this._doRelease()
}, d.handleMessage = function(a) {
var b, c = this;
if ("spotify_instance_init" === a) i = !0, c.emit(k.LOADED);
else if ("spotify_bridge_created" === a) {
c.available = !0;
var g = function(a) {
var b = [];
return a.forEach(function(a) {
"zc" === a.payload.ns ? b.unshift(a) : b.push(a)
}), b
},
j = function() {
var a = h.shift();
a ? (c.execute(a.payload, a.callback), setTimeout(j, 25)) : h = null
};
h = g(h), j(), d.emit(k.CREATED, {})
} else "spotify_bridge_released" === a ? (c.available = !1, d.emit(k.DESTROYED, {})) : "spotify_buffer_empty" === a ? f.emit(f.EVENTS.CHANGE_BUFFERING_STATE, {
buffering: !0
}) : "spotify_buffer_full" === a ? f.emit(f.EVENTS.CHANGE_BUFFERING_STATE, {
buffering: !1
}) : "string" == typeof a && 0 === a.indexOf("spotify_") || (b = "string" == typeof a ? JSON.parse(a) : a, b.error && Spotify.debug, void 0 !== b.msgId ? e.fireMsgCallback(b.msgId, b.error, b.payload) : f.emit(b.eventId, b.eventArgs))
}, d.EVENTS = k
}, {
"./eventBus.js": 11,
"./utils/applyEventHandler.js": 55,
"./utils/callbackHandler.js": 58
}],
8: [function(a, b, c) {
var d = {},
e = {},
f = a("manifest"),
g = a("./utils/object.js");
f.resolution = 1080 === f.resolution ? 1080 : 720, f.features.forEach(function(a) {
e[a] = !0
}), e.async = "async" === f.bridge, e.connectOnly = "connectOnly" === f.mode, d.merge = function(a, b) {
var c = d.get(b);
return g.deepMerge(a, c)
}, d.get = function(a, b) {
return void 0 !== f[a] ? f[a] : b
}, d.supports = e, b.exports = d
}, {
"./utils/object.js": 68,
manifest: "manifest"
}],
9: [function(a, b, c) {
"use strict";
var d = {};
b.exports = d;
var e = a("./utils/applyEventHandler.js");
e(d);
var f = {
OFFLINE: 0,
ONLINE: 1
};
d.EVENTS = f;
var g = !1,
h = null;
d.init = function(a) {
h = a, window.addEventListener("online", d.onReconnect), window.addEventListener("offline", d.onConnectionLost), navigator.onLine === !1 && d.onConnectionLost()
}, d.isOffline = function() {
return g
}, d.onConnectionLost = function() {
g = !0, d.emit(f.OFFLINE)
}, d.onReconnect = function() {
h.setConnectivity(h.CONNECTIVITY.WIRED), g = !1, d.emit(f.ONLINE)
}
}, {
"./utils/applyEventHandler.js": 55
}],
10: [function(a, b, c) {
b.exports = {
country: void 0,
username: void 0,
displayName: void 0,
displayImage: null,
product: void 0,
id: void 0
}
}, {}],
11: [function(a, b, c) {
var d = {};
b.exports = d;
var e = a("./sdk/esdk.js"),
f = a("./utils/applyEventHandler.js");
f(d), d.ESDK_EVENTS = e.EVENTS, d.EVENTS = {
CHANGE_BUFFERING_STATE: 1e3,
HACKING_TOO_MUCH_TIME: 2e3
}
}, {
"./sdk/esdk.js": 25,
"./utils/applyEventHandler.js": 55
}],
12: [function(a, b, c) {
var d = {};
b.exports = d, d.platform = a("platform"), d.router = a("./router"), d.localization = a("./localization"), d.trackManager = a("./trackManager"), d.ui = a("./ui"), d.utils = a("./utils"), d.KEY = {}, d.Session = a("./Session.js"), d.session = {}
}, {
"./Session.js": 4,
"./localization": 14,
"./router": 22,
"./trackManager": 29,
"./ui": 34,
"./utils": 66,
platform: "platform"
}],
13: [function(a, b, c) {
"use strict";
function d(a) {
aa = a, Q.emit(Q.EVENTS.HAVE_TOKEN, {
access_token: aa
})
}
function e(a) {
ba = a, Z.init(a.maxCachedTracks)
}
function f(a, b, c, d, e) {
if (!aa) throw new Error("[web] No token!");
V.requestWithRetry(3, 1e3, a, b, function(g, h) {
if (!g)
if (200 === h.statusCode) c(null, h.responseText);
else if (401 === h.statusCode) {
if (e) return W.filterHttpError(b, a, h.status), c(h);
Q.on(Q.EVENTS.HAVE_TOKEN, function() {
f(a, b, c, d, !0)
}, !0), Q.emit(Q.EVENTS.EXPIRED_TOKEN)
} else c(h, null)
}, d, [
["Authorization", "Bearer " + aa]
])
}
function g(a, b) {
var c, d = ca + "users/" + encodeURIComponent($.username) + "/playlists";
"function" == typeof b && (c = !0), a = H(a), d += X(a), f("get", d, function(a, d) {
return a ? void(c === !0 && b(a, null)) : (d = JSON.parse(d), c === !0 && b(null, d), void Q.emit(Q.EVENTS.HAVE_USER_PLAYLISTS, {
data: d
}))
})
}
function h(a) {
var b = ca + "me/tracks";
if (a = H(a), a.randomInt = Date.now(), "number" == typeof a.limit && a.limit > fa) throw new Error("[web] getCurrentUserTracks has max limit " + fa);
b += X(a), f("get", b, function(a, b) {
a || (b = JSON.parse(b), Q.emit(Q.EVENTS.HAVE_SAVED_TRACKS, {
data: b
}))
})
}
function i(a) {
var b, c = ca + "me";
"function" == typeof a && (b = !0), f("get", c, function(c, d) {
if (c) return void(b === !0 && a(c, null));
d = JSON.parse(d);
var e = d.images[0];
$.country = d.country, $.username = d.id, $.displayName = d.display_name || d.id, $.displayImage = e ? e.url : null, $.product = d.product, $.id = d.id, b === !0 && a(null, d), Q.emit(Q.EVENTS.HAVE_USER, {
user_data: d
})
})
}
function j(a) {
var b = ca + "browse/categories",
c = {
country: $.country
};
void 0 !== ba.locale && (c.locale = ba.locale), a && R.merge(c, a), b += X(c), f("get", b, function(a, b) {
a || (b = JSON.parse(b), Q.emit(Q.EVENTS.HAVE_CATEGORIES, {
data: b.categories
}))
})
}
function k(a, b) {
if (a && a.id) {
var c = ca + "browse/categories/" + encodeURIComponent(a.id),
d = {
country: $.country
};
void 0 !== ba.locale && (d.locale = ba.locale), a && R.merge(d, a), c += X(d), f("get", c, function(a, c) {
return a ? void("function" == typeof b && b(a)) : (c = JSON.parse(c), void("function" == typeof b && b(null, c)))
})
}
}
function l(a, b) {
if (a && a.id) {
var c = ca + U("browse/categories/{0}/playlists", encodeURIComponent(a.id)),
d = {
country: $.country
};
a && R.merge(d, a), c += X(d), f("get", c, function(a, c) {
return a ? void("function" == typeof b && b(a)) : (c = JSON.parse(c), void("function" == typeof b && b(null, c)))
})
}
}
function m(a) {
var b = ca + "browse/new-releases",
c = {
country: $.country
};
a && R.merge(c, a), b += X(c), f("get", b, function(a, b) {
if (!a) {
b = JSON.parse(b);
var c, d = b.albums.total;
b.albums.items.length > 0 ? (c = b.albums.items.map(function(a) {
return a.id
}), r(c, function(a, b) {
Q.emit(Q.EVENTS.HAVE_NEW_RELEASES, {
data: b.albums,
total: d
})
})) : Q.emit(Q.EVENTS.HAVE_NEW_RELEASES, {
data: [],
total: d
})
}
})
}
function n(a, b) {
var c, d = ca + "browse/featured-playlists";
"function" == typeof a && (c = !0);
var e = {
country: $.country,
platform: ba.platformFamily,
timestamp: Y()
};
void 0 !== ba.locale && (e.locale = ba.locale), b && R.merge(e, b), d += X(e), f("get", d, function(b, d) {
return b ? void(c === !0 && a(b)) : (d = JSON.parse(d), c === !0 && a(null, d), void Q.emit(Q.EVENTS.HAVE_FEATURED_PLAYLISTS, {
data: d.playlists,
title: d.message
}))
})
}
function o(a, b) {
if ("function" != typeof b) throw new Error("[web] callback must be a function");
var c = a.split(":");
if ("spotify" !== c[0]) throw new Error("[web] Unknown URI: " + a);
c.length > 3 && (c[3] += "s"), c[1] += "s";
var d = H(),
e = ca + c.slice(1).join("/") + X(d);
f("get", e, function(a, c) {
return a ? b(a) : (c = JSON.parse(c), void b(null, c))
})
}
function p(a, b, c) {
if ("function" != typeof c) throw new Error("[web] callback must be a function");
if (b = H(b), "number" == typeof b.limit && b.limit > da) throw new Error("[web] getPlaylistTracks has max limit " + da);
a += X(b), f("get", a, function(a, b) {
return a ? c(a) : (b = JSON.parse(b), void c(null, b))
})
}
function q(a, b) {
if (!Array.isArray(a) || a.length > ga) throw new Error("[web] bad trackIds argument");
if ("function" != typeof b) throw new Error("[web] callback must be a function");
var c = Z.getTracks(a),
d = a.filter(function(a) {
return !c[a]
});
if (d.length) {
var e = H();
e.ids = d.join();
var g = ca + "tracks" + X(e);
f("get", g, function(d, e) {
return d ? b(d) : (e = JSON.parse(e), I(e.tracks), void b(null, {
tracks: a.map(function(a) {
return c[a] ? c[a] : Z.getTrackFromCache(a)
})
}))
})
} else b(null, {
tracks: a.map(function(a) {
return c[a]
})
})
}
function r(a, b) {
if (!Array.isArray(a) || a.length > ha) throw new Error("[web] bad albumIds argument");
if ("function" != typeof b) throw new Error("[web] callback must be a function");
var c = {};
c.ids = a.join();
var d = ca + "albums" + X(c);
f("get", d, function(a, c) {
return a ? b(a) : (c = JSON.parse(c), void b(null, c))
})
}
function s(a, b) {
var c = H(),
d = ca + "albums/" + a + X(c);
f("get", d, function(a, c) {
return a ? b(a) : (c = JSON.parse(c), void b(null, c))
})
}
function t(a, b, c) {
var d = ca + "albums/" + a + "/tracks";
if ("function" != typeof b) throw new Error("[web] callback must be a function");
if (c = H(c), "number" == typeof c.limit && c.limit > ea) throw new Error("[web] getAlbumTracks has max limit " + ea);
d += X(c), f("get", d, function(a, c) {
return a ? b(a) : (c = JSON.parse(c), void b(null, c))
})
}
function u(a, b) {
if ("function" != typeof b) throw new Error("[web] callback must be a function");
var c = H();
a += X(c), f("get", a, function(a, c) {
return a ? b(a) : (c = JSON.parse(c), void b(null, c))
})
}
function v(a) {
if (0 !== a.indexOf(ca)) throw new Error("[web] Unexpected href format: " + a);
var b = a.split("/").slice(4);
if ("users" !== b[0] || "playlists" !== b[2]) throw new Error("[web] Unexpected href format: " + a);
return "spotify:user:" + b[1] + ":playlist:" + b[3]
}
function w(a, b) {
var c = ca + "me/tracks",
d = JSON.stringify([a]);
f("put", c, function(c, d) {
c || (Z.setFollowFlag(a, !0), Q.emit(Q.EVENTS.FOLLOWED_TRACK, a)), b(c, d)
}, d)
}
function x(a, b) {
var c = ca + "me/tracks/contains?ids=";
c += a.join(","), c += "&randomInt=" + Date.now(), f("get", c, function(a, c) {
return a ? void b(a, c) : (c && (c = JSON.parse(c)), void b(null, c))
})
}
function y(a, b) {
var c = ca + "me/tracks?ids=" + a;
f("delete", c, function(c, d) {
c || (Z.setFollowFlag(a, !1), Q.emit(Q.EVENTS.UNFOLLOWED_TRACK, a)), b(c, d)
})
}
function z(a, b) {
var c = a + "/followers";
f("put", c, function(c, d) {
d && (d = JSON.parse(d)), c || Q.emit(Q.EVENTS.FOLLOWED_PLAYLIST, a), b(c, d)
})
}
function A(a, b) {
var c = a + "/followers/contains?ids=" + encodeURIComponent($.id);
c += "&randomInt=" + Date.now(), f("get", c, function(a, c) {
c && (c = JSON.parse(c)), b(a, c)
})
}
function B(a, b) {
var c = a + "/followers";
f("delete", c, function(c, d) {
d && (d = JSON.parse(d)), c || Q.emit(Q.EVENTS.UNFOLLOWED_PLAYLIST, a), b(c, d)
})
}
function C(a, b) {
a = H(a);
var c = a.q;
c.length > 1 && /^[a-z0-9\s]+$/i.test(c) && c.lastIndexOf("*") !== c.length - 1 && (c += "*"), a.q = c;
var d = ca + "search";
d += X(a), f("get", d, function(a, c) {
return a ? b(a) : (c = JSON.parse(c), void b(null, c))
})
}
function D(a, b) {
var c = ca + "tos/eula?country=" + a;
V.requestWithRetry(3, 1e3, "get", c, function(a, c) {
a || 200 !== c.statusCode ? b(new Error("Could not fetch eula"), null) : b(null, JSON.parse(c.responseText))
})
}
function E(a, b) {
return a = H(a), a.type = "track", C(a, b)
}
function F(a, b) {
return a = H(a), a.type = "album", C(a, b)
}
function G(a, b) {
return a = H(a), a.type = "playlist", C(a, b)
}
function H(a) {
return a = a || {}, void 0 === a.market && (a.market = "from_token"), a
}
function I(a) {
if (a = a.filter(function(a) {
return !!a && !!a.id
}), a.length) {
Z.addTracksToCache(a);
var b = S(a, "id");
_.supports.connectOnly || x(b, function(a, c) {
if (!a) {
var d, e;
for (d = 0, e = c.length; e > d; d += 1) Z.setFollowFlag(b[d], c[d])
}
})
}
}
function J() {
if (void 0 === $.username) throw new Error("Cannot request saved songs since there is no user logged in");
return "spotify:user:" + encodeURIComponent($.username) + ":collection"
}
function K(a, b, c) {
var d = L(a),
e = d.trackExtractor,
f = d.fetchTracksFunction,
g = {
offset: b * ia,
limit: ia
};
f(g, function(a, b) {
if (a) return c(a);
var d = e(b);
I(d.tracks), c(null, d)
})
}
function L(a) {
var b, c, d, e = a.split(":");
if ("spotify" !== e[0]) throw new Error("[web] Unknown URI: " + a);
if ("album" === e[1]) e[1] += "s", b = M, c = function(a, b) {
a = a || {}, Q.getAlbumTracks(e[2], function(a, c) {
var d = [];
if (c && c.items) {
var e = c.items.length;
d = c.items.map(function(a) {
return a.id
}), Q.getTracks(d, function(a, c) {
c && (c.total = e), b(a, c)
})
}
}, a)
};
else if ("artist" === e[1]) e[1] += "s", b = O;
else if ("user" === e[1] && "playlist" === e[3]) e[1] += "s", e[3] += "s", b = N;
else if ("user" === e[1] && "collection" === e[3]) d = "me/tracks", b = N;
else {
if ("search" !== e[1]) throw new Error("[web] Unknown context type: " + a);
b = P, c = function(a, b) {
a = a || {}, a.q = decodeURIComponent(e[2]), Q.searchTracks(a, b)
}
}
return d || (d = e.slice(1).join("/") + "/tracks"), {
trackExtractor: b,
fetchTracksFunction: c || function(a, b) {
var c = Q.BASE_URL + d;
Q.getPlaylistTracks(c, a, b)
}
}
}
function M(a) {
return {
tracks: a.tracks,
total: a.total
}
}
function N(a) {
return {
tracks: S(a.items, "track"),
total: a.total
}
}
function O(a) {
return {
tracks: a.tracks,
total: a.tracks.length
}
}
function P(a) {
return {
tracks: a.tracks.items,
total: a.tracks.total
}
}
var Q = {};
b.exports = Q;
var R = a("../../utils/object.js"),
S = a("../../utils/pick.js"),
T = a("../../utils/applyEventHandler.js"),
U = a("../../utils/stringFormatter.js"),
V = a("../../utils/http.js"),
W = a("../../utils/ravenWrapper.js"),
X = a("../../utils/queryStringBuilder.js"),
Y = a("../../utils/getISODateString.js"),
Z = a("../../utils/cache.js"),
$ = a("../../currentUser.js"),
_ = a("../../config.js"),
Q = {},
aa = null,
ba = null,
ca = "https://api.spotify.com/v1/",
da = 100,
ea = 50,
fa = 50,
ga = 50,
ha = 50,
ia = Math.min(ga, fa, da, ha),
ja = {
CATEGORIES: 0,
PLAYLISTS: 1
};
Q.CONTENT_TYPES = ja, Object.freeze(Q.CONTENT_TYPES);
var ka = {
HAVE_TOKEN: 0,
EXPIRED_TOKEN: 1,
HAVE_USER: 2,
HAVE_USER_PLAYLISTS: 3,
HAVE_CATEGORIES: 4,
HAVE_SAVED_TRACKS: 5,
HAVE_NEW_RELEASES: 6,
HAVE_FEATURED_PLAYLISTS: 7,
FOLLOWED_TRACK: 8,
UNFOLLOWED_TRACK: 9,
FOLLOWED_PLAYLIST: 10,
UNFOLLOWED_PLAYLIST: 11
};
Q.EVENTS = ka, Object.freeze(Q.EVENTS), T(Q), Q.setAccessToken = d, Q.init = e, Q.getCurrentUserTracks = h, Q.getCurrentUserPlaylists = g, Q.getCurrentUserInformation = i, Q.getCategories = j, Q.getPlaylistsForCategory = l, Q.getNewReleases = m, Q.getContextTracks = K, Q.getFeaturedPlaylists = n, Q.getAlbum = s, Q.getAlbumTracks = t, Q.getTracks = q, Q.getAlbums = r, Q.getMetadataForURI = o, Q.getPlaylistTracks = p, Q.getFullPlaylistData = u, Q.playlistHrefToUri = v, Q.followTrack = w, Q.unFollowTrack = y, Q.followPlaylist = z, Q.unFollowPlaylist = B, Q.playlistContains = A, Q.search = C, Q.searchTracks = E, Q.searchAlbums = F, Q.searchPlaylists = G, Q.mySongsContain = x, Q.getCategoryInfo = k, Q.getEula = D, Q.getUserSavedTracksUri = J, Q.BASE_URL = ca, Q.API_MAX_LIMIT = ia, b.exports = Q
}, {
"../../config.js": 8,
"../../currentUser.js": 10,
"../../utils/applyEventHandler.js": 55,
"../../utils/cache.js": 57,
"../../utils/getISODateString.js": 62,
"../../utils/http.js": 65,
"../../utils/object.js": 68,
"../../utils/pick.js": 71,
"../../utils/queryStringBuilder.js": 72,
"../../utils/ravenWrapper.js": 73,
"../../utils/stringFormatter.js": 76
}],
14: [function(a, b, c) {
(function(c) {
"use strict";
var d = {};
b.exports = d;
var e = a("../utils/applyEventHandler");
e(d), d.languages = a("../../../output/locales.js");
var f, g = "EN",
h = function(a) {
switch (a) {
case "ZH":
a = "ZH_HANT";
break;
case "ES":
("MX" === d.client.region || "CL" === d.client.region || "PE" === d.client.region || "AR" === d.client.region || "CO" === d.client.region || "PA" === d.client.region || "EC" === d.client.region || "CR" === d.client.region || "GT" === d.client.region || "SV" === d.client.region || "PY" === d.client.region || "HN" === d.client.region) && (a = "ES_419");
break;
case "FR":
"CA" === d.client.region && (a = "FR_CA");
break;
case "PT":
"BR" === d.client.region && (a = "PT_BR")
}
return d.languages[a] ? a : g
};
d.init = function(a) {
c.navigator && c.navigator.language && (f = c.navigator.language.split("-"), a || (a = f[0].toUpperCase()), d.client = {
lang: a.toLowerCase(),
region: void 0 !== f[1] ? f[1].toUpperCase() : void 0
}), d.setLanguage(a)
}, d.current = void 0, d.currentLang = void 0, d.EVENTS = {
LANG_CHANGE: 0
}, d.client = {
language: "EN",
region: void 0
}, d.setLanguage = function(a) {
var b = d.current,
e = h(a);
if (void 0 !== e && b !== e) {
if (d.current = e, d.currentLang = d.languages[e], c.document) {
var f = c.document.documentElement;
f.setAttribute("lang", e)
}
d.emit(d.EVENTS.LANG_CHANGE, {
oldLang: b,
newLang: d.languages[e],
newLangCode: e
})
}
}, d.getLocale = function() {
if (d.client) {
var a, b = d.client.region || void 0;
switch (d.client.lang) {
case "nb":
a = "no";
break;
case "ru":
b = void 0;
break;
default:
a = d.client.lang
}
return void 0 === b ? void 0 : a + "_" + d.client.region
}
}
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"../../../output/locales.js": 3,
"../utils/applyEventHandler": 55
}],
15: [function(a, b, c) {
(function(b) {
"use strict";
var c = b.Spotify = a("./index.js"),
d = a("./eventBus.js"),
e = a("./ui"),
f = a("./connection.js"),
g = a("./localization"),
h = a("./router"),
i = a("./routes.js"),
j = a("generatedBehaviors"),
k = a("platform"),
l = a("./utils/parseQueryString.js"),
m = a("./utils/ravenWrapper.js"),
n = a("./interfaces/web"),
o = a("./currentUser.js"),
p = a("./config.js"),
q = a("./ui/input/keyHandler.js");
c.initArgs = function() {
return l(location.search)
}(), c.exit = function() {
var a = k.sdk.getPlaybackStatus(),
b = function() {
c.canExecuteOnBridge = !1, k.bridge.release()
};
a.isActiveDevice === !0 ? (d.on(d.ESDK_EVENTS.EVENT_LOGGEDOUT, b), k.sdk.logout()) : b()
}, (c.startApp = function() {
function a(a) {
if (0 === location.hash.indexOf("#access_token")) {
h.preventGoingBack();
var b = l(location.hash.slice(1)).access_token;
n.setAccessToken(b), n.getCurrentUserInformation()
}
}
function b() {
n.on(n.EVENTS.HAVE_USER, function() {
"function" != typeof c.onLogin || p.supports.psn ? e.navigateTo(p.get("entry")) : c.onLogin(), c.router.preventGoingBack()
})
}
m.init(k.SentryDsn), m.addTagsContext({
platform: k.name
}), f.init(k.sdk), k.setup(), q.init({
disableRepeatForKeys: [c.KEY.SELECT, c.KEY.BACK],
disableKeyUpSupport: !p.get("handlesKeyUp", !0)
}), e.animation.animationModule.init({
simulationTime: k.ANIMATION_SIMULATION_TIME
}), e.init(p.get("resolution")), g.init(c.initArgs.lang, k.name), n.init({
platformFamily: k.family,
locale: g.getLocale()
}), e.setupAppKeyBindings(), e.initViews(), e.overlayModule.show(), p.supports.connectOnly || (h.init(k.historyAdapter), i.init(), b()), e.translation.init(g.currentLang), k.init(), c.debug && c.debug.init(), p.supports.connectOnly || (a(), h.start()), d.on(d.ESDK_EVENTS.EVENT_LOGGEDIN, function() {
void 0 !== c.loginTimeout && clearTimeout(c.loginTimeout)
}), c.session.on(c.session.EVENTS.SESSION_READY, function() {
m.setUserContext({
country: o.country,
product: o.product,
locale: g.getLocale()
})
}), Object.keys(j).forEach(function(a) {
j[a]()
}), "function" == typeof k.setLoadingScreenBehavior ? k.setLoadingScreenBehavior() : setTimeout(e.hideLoadingScreen, 3e3)
})()
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"./config.js": 8,
"./connection.js": 9,
"./currentUser.js": 10,
"./eventBus.js": 11,
"./index.js": 12,
"./interfaces/web": 13,
"./localization": 14,
"./router": 22,
"./routes.js": 23,
"./ui": 34,
"./ui/input/keyHandler.js": 37,
"./utils/parseQueryString.js": 69,
"./utils/ravenWrapper.js": 73,
generatedBehaviors: "generatedBehaviors",
platform: "platform"
}],
16: [function(a, b, c) {
(function(c) {
function d(a, b) {
this._bus = null, this._receiverManager = null, this._platform = a, this._cast = b || c.cast, this._hasInitialVolume = !1, this._tearDownTimer = void 0, this._deviceId = "", this._actionTimer = void 0, this._idleLocked = !1, this._loginTimer = void 0, this._loginMessageTimer = void 0, g(this), this._init()
}
b.exports = d;
var e = a("../../utils/guid.js"),
f = a("../../currentUser.js"),
g = a("../../utils/applyEventHandler.js"),
h = a("../../eventBus.js"),
i = a("../../config.js"),
j = "urn:x-cast:com.spotify.chromecast.secure.v1",
k = 1e4,
l = 3e4,
m = 3e4,
n = {
GET_INFO: "getInfo",
GET_INFO_RESPONSE: "getInfoResponse",
GET_INFO_ERROR: "getInfoError",
ADD_USER: "addUser",
ADD_USER_RESPONSE: "addUserResponse",
ADD_USER_ERROR: "addUserError",
PLUGIN_ERROR: "pluginError"
},
o = {
LOGGED_IN_DISCONNECTED: 1,
DEVICE_NOT_VISIBLE: 2,
DESTROY: 3,
SENDER_CONNECTED: 4,
ADD_USER: 5
},
p = {
LOGIN_FAILED: 202,
INVALID_PLUGIN: 666
};
d.prototype.currentUser = f, d.prototype.setIdle = function(a, b, d) {
var e = this;
this._idleLocked || (this.cancelTimers(), a ? (b && d && (this._actionTimer = c.setTimeout(d, b)), this._tearDownTimer = c.setTimeout(e._destroy.bind(e), a)) : this._destroy())
}, d.prototype.setActive = function() {
this._idleLocked || this.cancelTimers()
}, d.prototype.disconnect = function(a, b) {
this.setIdle(k, a, b), this._idleLocked = !0
}, d.prototype.connect = function() {
this._idleLocked = !1, this.setActive()
}, d.prototype.setLoggingIn = function(a) {
var b = this;
this._loginTimer = c.setTimeout(function() {
a && a(), b._loginMessageTimer = c.setTimeout(function() {
b._bus.broadcast({
type: n.ADD_USER_ERROR,
payload: {
status: p.LOGIN_FAILED
}
}), b._destroy()
}, l)
}, m)
}, d.prototype.setLoggedIn = function(a) {
c.clearTimeout(this._loginMessageTimer), c.clearTimeout(this._loginTimer), h.ignore(h.ESDK_EVENTS.EVENT_ERROR, this._handleSdkError.bind(this)), a && a()
}, d.prototype.cancelTimers = function() {
c.clearTimeout(this._actionTimer), c.clearTimeout(this._tearDownTimer), this._tearDownTimer = void 0
}, d.prototype._destroy = function() {
this.emit(o.DESTROY)
}, d.prototype._init = function() {
var a = this,
b = this._cast.receiver.CastReceiverManager.getInstance();
this._receiverManager = b, this._bus = b.getCastMessageBus(j, this._cast.receiver.CastMessageBus.MessageType.JSON), b.onReady = function() {}, b.onShutdown = function() {
a._destroy()
}, b.addEventListener("senderconnected", this._handleSenderConnected.bind(this)), b.addEventListener("senderdisconnected", this._handleSenderDisconnected.bind(this)), b.addEventListener("visibilitychanged", this._handleVisibilityChanged.bind(this));
var c = {
maxInactivity: 600
};
b.start(c)
}, d.prototype._handleSenderConnected = function(a) {
var b = a.senderId;
this.emit(o.SENDER_CONNECTED, b);
var c = this._bus.getCastChannel(b);
c.onMessage = this._handleSenderMessage.bind(this, b, c), this._platform.session.on(this._platform.session.EVENTS.SESSION_READY, function() {
c.send({
type: n.ADD_USER_RESPONSE,
payload: {
user: f
}
})
}), h.on(h.ESDK_EVENTS.EVENT_ERROR, this._handleSdkError.bind(this))
}, d.prototype._handleSdkError = function(a) {
var b = this._platform.sdk.ERROR;
switch (a.error) {
case b.ERROR_LOGIN_BAD_CREDENTIALS:
case b.ERROR_NEEDS_PREMIUM:
case b.ERROR_TRAVEL_RESTRICTION:
case b.ERROR_APPLICATION_BANNED:
case b.ERROR_GENERAL_LOGIN_ERROR:
this._bus.broadcast({
type: n.ADD_USER_ERROR,
payload: {
status: p.LOGIN_FAILED,
spotifyError: a.error,
deviceID: this._deviceId
}
}), this._destroy()
}
}, d.prototype._handleSenderDisconnected = function(a) {
var b = a.senderId;
a.reason === this._cast.receiver.system.DisconnectReason.REQUESTED_BY_SENDER && this.emit(o.LOGGED_IN_DISCONNECTED, b)
}, d.prototype._handleVisibilityChanged = function() {
this._receiverManager.getVisibilityState() === this._cast.receiver.system.VisibilityState.NOT_VISIBLE && this.emit(o.DEVICE_NOT_VISIBLE)
}, d.prototype._handleSenderMessage = function(a, b, c) {
var d = c.message,
f = d.payload || {};
switch (d.type) {
case n.GET_INFO:
var g = f.brandDisplayName || i.get("brand"),
h = f.modelDisplayName || i.get("model"),
j = this._detectDeviceType();
this._deviceId = f.deviceID || e(), this._platform.bridge.valid() ? (this._platform.bridge.createBridge({
unique_id: this._deviceId,
display_name: f.remoteName || h,
model_name: h,
brand_name: j.analyticsString,
device_type: j.type,
volume_steps: -1
}), this._platform.sdk.zcGetReply(g, h, function(a, c) {
b.send(a ? {
type: n.GET_INFO_ERROR,
payload: a
} : {
type: n.GET_INFO_RESPONSE,
payload: c
})
})) : b.send({
type: n.PLUGIN_ERROR,
payload: {
status: p.INVALID_PLUGIN,
statusString: "no valid plugin available",
deviceID: this._deviceId
}
});
break;
case n.ADD_USER:
this.emit(o.ADD_USER), this._platform.sdk.zcLogin(f.userName, f.blob, f.clientKey, function(a, c) {
a && b.send({
type: n.ADD_USER_ERROR,
payload: a
})
})
}
}, d.prototype._detectDeviceType = function() {
var a, b, c = this._receiverManager.getDeviceCapabilities();
return c.display_supported ? (a = this._platform.sdk.DEVICE_TYPES.DEVICE_CASTVIDEO, b = "cast_tv") : (a = this._platform.sdk.DEVICE_TYPES.DEVICE_CASTAUDIO, b = "cast"), {
type: a,
analyticsString: b
}
}, d.CAST_EVENTS = o
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"../../config.js": 8,
"../../currentUser.js": 10,
"../../eventBus.js": 11,
"../../utils/applyEventHandler.js": 55,
"../../utils/guid.js": 64
}],
17: [function(a, b, c) {
(function(c) {
function d(a, b) {
function c() {
e._player.setState(e._tm.getState().playback.isPlaying ? i.PLAYING : i.PAUSED), e.broadcastStatus(!1)
}
function d() {
e._tm.awaitNowPlayingTracks(function(a) {
var b = a[2],
c = {
contentId: b.uri,
contentType: "application/x-spotify.track",
streamType: "BUFFERED",
duration: b.duration_ms / 1e3,
metadata: {
metadataType: 3,
title: b.name,
songName: b.name,
artist: b.artists[0].name,
albumName: b.album.name,
images: b.album.images
}
};
e.setMediaInformation(c, !0)
})
}
this._tm = a, this._player = b, g.receiver.MediaManager.call(this, this._player), this._tm.on(this._tm.EVENTS.CHANGE_TRACK, d), this._tm.on(this._tm.EVENTS.CHANGE_TO_AD, d), this._tm.on(this._tm.EVENTS.CHANGE_PLAYBACK_STATE, c);
var e = this
}
function e(a) {
var b = d.prototype[a];
Object.defineProperty(d.prototype, a, {
get: function() {
return b
},
set: function() {}
})
}
function f() {}
b.exports = d;
var g = c.cast,
h = a("../../utils/object.js"),
i = c.cast.receiver.media.PlayerState;
h.inherit(d, g.receiver.MediaManager), d.prototype.onSetVolume = function(a) {
var b = a.data;
this._player.setVolume(b.volume)
}, d.prototype.onLoad = function() {
this.sendLoadComplete()
}, d.prototype.onEditTracksInfo = f, d.prototype.onError = f, d.prototype.onLoadMetadataError = f, d.prototype.onMetadataLoaded = f;
for (var j in d.prototype) d.prototype.hasOwnProperty(j) && ("customizedStatusCallback" === j || /^on[A-Z].*$/.test(j)) && e(j)
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"../../utils/object.js": 68
}],
18: [function(a, b, c) {
(function(a) {
function c(a) {
if (!a.getState()) throw new Error("[CastPlayer] trackManagerInstance has no state. make sure it is initialized before you pass it.");
this._isActive = !1, this._tm = a, this.setState(this._tm.getState().playback.isPlaying ? e.PLAYING : e.PAUSED)
}
function d() {}
b.exports = c;
var e = a.cast.receiver.media.PlayerState,
f = a.cast.receiver.media.SeekResumeState;
c.prototype.setActiveState = function(a) {
this._isActive = a
}, c.prototype.getCurrentTimeSec = function() {
return this._tm.getState().playback.currentTrackProgress / 1e3
}, c.prototype.getDurationSec = function() {
return 1e3
}, c.prototype.getState = function() {
return this._playbackState
}, c.prototype.setState = function(a) {
this._playbackState = a
}, c.prototype.pause = function() {
this._isActive && (this._playbackState = e.PAUSED, this._tm.controller.pause())
}, c.prototype.play = function() {
this._isActive && (this._playbackState = e.PLAYING, this._tm.controller.play())
}, c.prototype.seek = function(a, b) {
this._isActive && (this._tm.controller.seek(1e3 * a), b === f.PLAYBACK_START ? this._tm.controller.play() : b === f.PLAYBACK_PAUSE && this._tm.controller.pause())
}, c.prototype.setVolume = function(a) {}, c.prototype.getVolume = function() {
var a = 1;
return {
level: a,
muted: !1
}
}, c.prototype.editTracksInfo = d, c.prototype.reset = d, c.prototype.registerLoadCallback = d, c.prototype.registerEndedCallback = d, c.prototype.registerErrorCallback = d, c.prototype.unregisterLoadCallback = d, c.prototype.unregisterEndedCallback = d, c.prototype.unregisterErrorCallback = d, c.prototype.load = d
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {}],
19: [function(a, b, c) {
"use strict";
var d = {};
b.exports = d;
var e = a("../../players/MSEPlayer.js"),
f = a("../../bridge.js"),
g = a("../../utils/object.js"),
h = a("../../utils/createElement.js"),
i = !1;
g.extend(d, f);
var j = null,
k = null,
l = function() {
i = !0, k = e.createPlayer(j)
},
m = function(a) {
var b, c = typeof a,
e = !1;
b = "string" === c && -1 === a.indexOf("spotify_") ? JSON.parse(a) : a, "object" == typeof b && "playback" === b.ns && (i === !1 && l(), e = !0), e === !0 ? k.handlePlaybackEvent(b) : d.handleMessage.call(d, b)
};
d.handlesCallbacks = !0, d.valid = function() {
return null !== j && "function" == typeof j.postMessage
}, d.init = function() {
j = h("embed", {
id: "plugin",
type: "application/x-spotify"
});
var a = h("div", {
className: "invisible"
}, [j]);
d._doCreate = function(a) {
j.postMessage({
msg: "create",
payload: a
})
}, d._doExecute = function(a) {
j.postMessage({
msg: "execute",
payload: a
})
}, d._doRelease = function() {
j.postMessage({
msg: "release",
payload: ""
})
}, document.body.appendChild(a), a.addEventListener("error", function(a) {
throw new Error("[bridge] pNaCl module failed to load")
}), a.addEventListener("abort", function(a) {
throw new Error("[bridge] pNaCl module load was aborted by user")
}), a.addEventListener("crash", function(a) {
throw d.available = !1, new Error("[bridge] pNaCl module has crashed.")
}), a.addEventListener("message", function(a) {
m.call(d, a.data)
}, !0)
}, d.createBridge = function(a) {
a.model_name = a.model_name.replace(/[^a-zA-Z0-9\-_\.]/g, "_"), d.create(a)
}, d.destroyBridge = function() {
d.release()
}
}, {
"../../bridge.js": 7,
"../../players/MSEPlayer.js": 21,
"../../utils/createElement.js": 59,
"../../utils/object.js": 68
}],
20: [function(a, b, c) {
"use strict";
var d = {};
b.exports = d;
var e = a("../../../ui/"),
f = a("../../../utils/createElement.js");
d.canRenderWithoutLogin = !0, d.init = function() {}, d.keySubscriptions = [], d.dom = f("div", {}, [f("section", {
className: "landing-connect js-main"
}, [f("div", {
className: "logo"
}), f("div", {
className: "leftSide"
}, [f("div", {
className: "remote-control-image"
})]), f("div", {
className: "rightSide"
}, [f("h1", {
className: "headline",
i18n: "RECEIVER__LANDING_REMOTE_CONTROL"
}), f("p", {
className: "message",
i18n: "RECEIVER__LANDING_REMOTE_CONTROL_MESSAGE"
})])])]), d.onDisplayed = function() {
e.setMenuVisibility(!1), e.setBackgroundImage("remote-welcome")
}, d.onClose = function() {
e.setMenuVisibility(!0)
}
}, {
"../../../ui/": 34,
"../../../utils/createElement.js": 59
}],
21: [function(a, b, c) {
(function(c) {
var d = a("../utils/createElement.js"),
e = a("../utils/ravenWrapper.js");
b.exports = {
createPlayer: function(a) {
function b(a) {
return {
id: a,
chunks: [],
ended: !1,
bytes: 0
}
}
function f() {
return q && !q.updating
}
function g(a) {
t.postMessage({
msg: "time_update",
payload: a
})
}
function h(a) {
t.postMessage({
msg: "buffer_level",
payload: a
})
}
function i() {
var a;
null !== v && f() && (y && (q.abort(), y = !1), v.chunks.length ? (0 === r.buffered.length && (x = !0), a = v.chunks.shift(), v.bytes -= a.byteLength, q.appendBuffer(a)) : v.ended && "ended" !== s.readyState && s.endOfStream())
}
function j() {
r.seeking && (r.currentTime += .5, setTimeout(j, 500), e.captureMessage("Cast: stream seems to be stalled, trying to resolve", {
debug: "I30952"
}, {
currentTime: r.currentTime,
bufferedBytes: m.bufferedBytes(),
bufferedDuration: m.bufferedDuration()
}))
}
function k() {
q && ("open" === s.readyState ? q.abort() : y = !0, r.seekable.length && q.remove(0, 1 / 0)), v = null, u = null
}
function l() {
document.body.appendChild(r), r.addEventListener("timeupdate", function(a) {
var b = Math.floor(1e3 * r.currentTime),
c = z,
d = m.bufferedBytes(),
e = m.bufferedDuration();
g(b), d >= 65536 || e >= 20 ? c = n.HIGH : 0 === d && 10 > e && (c = n.LOW), c !== z && (z = c, h(z))
}, !1), s.addEventListener("sourceopen", function(a) {
var b;
q || (q = s.addSourceBuffer('audio/webm;codecs="vorbis"'), q.addEventListener("updateend", function(a) {
b = r.buffered, b.length > 0 && x && (r.currentTime = b.start(0), setTimeout(j, 500), x = !1), i()
}, !1)), i()
}, !1), r.addEventListener("ended", function(a) {
var b = u;
g(p), k(), v = b, r.play()
}, !1), r.src = c.URL.createObjectURL(s)
}
var m, n = {
LOW: 0,
HIGH: 1
},
o = {
PLAY: 0,
PAUSE: 1,
FLUSH: 2,
APPEND_CHUNK: 3,
DELIVERY_CHANGED: 4
},
p = 2147483647,
q = null,
r = d("audio"),
s = new c.MediaSource,
t = a || document.getElementById("plugin0"),
u = null,
v = null,
w = 0,
x = !1,
y = !1,
z = n.LOW;
return l(), m = {
element: r,
flush: function() {
k()
},
play: function() {
r.paused && r.play()
},
pause: function() {
r.paused || r.pause()
},
appendBuffer: function(a, c) {
var d;
u ? d = u : v ? a === v.id ? d = v : (v.ended = !0, u = b(a), d = u) : (v = b(a), d = v), d.chunks.push(c), d.bytes += c.byteLength, i()
},
bufferedBytes: function() {
var a = 0;
return null !== v && (a = v.bytes), null !== u && (a += u.bytes), a
},
bufferedDuration: function() {
var a = 0,
b = r.buffered;
return b.length && (a = b.end(0) - r.currentTime), a
},
handlePlaybackEvent: function(a) {
switch (a.eventId) {
case o.PLAY:
this.play();
break;
case o.PAUSE:
this.pause();
break;
case o.FLUSH:
this.flush();
break;
case o.APPEND_CHUNK:
this.appendBuffer(w, a.payload);
break;
case o.DELIVERY_CHANGED:
w += 1
}
}
}
}
}
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"../utils/createElement.js": 59,
"../utils/ravenWrapper.js": 73
}],
22: [function(a, b, c) {
"use strict";
function d(a) {
var b = a.match(m);
return b ? b.map(function(a) {
return a.substr(1)
}) : []
}
function e(a) {
if (a.state) i.replaceState(a.state.path, a.state);
else {
var b = 0 === n.hash.indexOf("#!") ? n.hash.substr(2) : "/";
i.replaceState(b, null)
}
}
function f(a) {
var b, c, d, e, f, g, h = function(c) {
b.hasOwnProperty(c) || (b[c] = a.state.params[c])
};
for (c in i.routes)
if (e = a.path.match(new RegExp(c))) return f = i.routes[c], i._currentPath = a.state.path, d = f.callback, g = f.paramNames, b = k(g, e.slice(1)), Object.keys(a.state.params).forEach(h), a.state.params = b, void d(a);
i.on404(a)
}
function g(a, b) {
var c, d, e = {};
return d = a.indexOf("?"), d > -1 ? (c = a.substr(d), a = a.substr(0, d)) : c = "", e.path = a || "/", e.url = o + "#!" + e.path + c, e.title = document.title, e.state = b || {}, e.state.path = a, e.state.appendedQueryString = c, e.state.params = e.state.params || {}, e
}
function h() {
return window.document.location && window.document.location.href ? window.document.location : j.location && j.location.href ? j.location : window.location
}
var i = {};
b.exports = i;
var j, k = a("../utils/zipObject.js"),
l = a("../eventBus.js");
i.init = function(a) {
a ? (j = a, j.on(j.EVENTS.CHANGE_STATE, function(a) {
f(g(a.path, a))
})) : j = window.history
};
var m = /:\w+/g,
n = h(),
o = n.href.replace(/#.+$/, "");
i.routes = {}, i.on404 = function(a) {
throw new Error("[router] No route matches the current path: " + n.hash.substr(2))
}, i.onRoute = function(a, b) {
var c = d(a);
a = a.replace(m, "([^/]+)"), i.routes["^" + a + "$"] = {
paramNames: c,
callback: b
}
}, i.start = function() {
window.addEventListener("popstate", e, !1), e({}), i.preventGoingBack()
}, i.stop = function() {
window.removeEventListener("popstate", e, !1)
}, i.go = function(a, b) {
var c = g(a, {
params: b
});
j.pushState(c.state, c.title, c.url), f(c)
}, i.replaceState = function(a, b) {
var c = g(a, b);
f(c), j.replaceState(c.state, c.title, c.url)
}, i.preventGoingBack = function() {
var a = j.state || {};
a.preventGoingBack = !0, j.replaceState(a, window.document.title || "")
}, i.goBack = function() {
return j.state.preventGoingBack ? (l.emit(l.EVENTS.HACKING_TOO_MUCH_TIME), !1) : (j.back(), !0)
}, i.goUp = function() {
var a = i._currentPath.replace(/\/.+?$/, "");
return a === i._currentPath ? !1 : "" === a ? !1 : (i.go(a), !0)
}
}, {
"../eventBus.js": 11,
"../utils/zipObject.js": 80
}],
23: [function(a, b, c) {
"use strict";
function d(a) {
if (j.params = h(a.state.appendedQueryString), j.params.testBrowse && (g.onLogin = function() {
l.navigateTo("/browse")
}), j.params.uri) {
var b = j.params.uri;
g.onLogin = function() {
var a;
if (-1 !== b.indexOf("playlist")) a = "/playlist";
else {
if (-1 === b.indexOf("album")) return;
a = "/album"
}
l.navigateTo(a, {
uri: b
})
}
} else g.onLogin = j.params.categoryId ? function() {
l.navigateTo("/category/" + j.params.categoryId)
} : j.params.hasOwnProperty("productId") ? function() {
g.session.onUpgrade(j.params.productId), l.navigateTo(i.get("entry"))
} : function() {
l.navigateTo(i.get("entry"))
};
return void 0 === k.id ? l.changeView(l.views.landingView) : void g.onLogin()
}
function e(a) {
if (void 0 === a) throw new Error("[routes] View is not defined");
var b = function(b) {
void 0 !== k.id || a.canRenderWithoutLogin === !0 ? (l.nineLastKeys[l.nineLastKeys.length - 1] !== g.KEY.BACK && l.nineLastKeys[l.nineLastKeys.length - 1] !== g.KEY.BACKSPACE && l.interactionManager.selectTopNavpoint(), l.changeView(a, b.state.params)) : j.go("/")
};
return b
}
var f = {};
b.exports = f;
var g = a("./index.js"),
h = a("./utils/parseQueryString.js"),
i = a("./config.js"),
j = a("./router/index"),
k = a("./currentUser.js"),
l = a("./ui/index.js");
f.init = function() {
i.supports.connectOnly ? j.onRoute("/", function() {}) : (j.onRoute("/", d), j.onRoute("/upgrade/:id", d), l.views.routes && Object.keys(l.views.routes).forEach(function(a) {
l.views.routes[a].length && l.views.routes[a].forEach(function(b) {
j.onRoute(b, e(l.views[a]))
})
}))
}
}, {
"./config.js": 8,
"./currentUser.js": 10,
"./index.js": 12,
"./router/index": 22,
"./ui/index.js": 34,
"./utils/parseQueryString.js": 69
}],
24: [function(a, b, c) {
var d = {};
b.exports = d;
var e = {
NONE: 0,
WIRED: 1,
WIRELESS: 2,
MOBILE: 3
};
d.CONNECTIVITY = e, Object.freeze(d.CONNECTIVITY)
}, {}],
25: [function(a, b, c) {
(function(c, d) {
"use strict";
var e = {};
b.exports = e;
var f = a("../utils/object.js"),
g = a("./base.js");
f.merge(e, g);
var h = {
EVENT_ERROR: 0,
EVENT_LOGGEDIN: 1,
EVENT_LOGGEDOUT: 2,
EVENT_TRACKCHANGED: 3,
EVENT_CONNECTIONERROR: 4,
EVENT_MESSAGETOUSER: 5,
EVENT_PLAYTOKENLOST: 6,
EVENT_LOGMESSAGE: 7,
EVENT_PLAY: 8,
EVENT_PAUSE: 9,
EVENT_SKIPNEXT: 10,
EVENT_SKIPPREV: 11,
EVENT_SEEK: 12,
EVENT_VOLUME: 13,
EVENT_ACTIVE: 14,
EVENT_INACTIVE: 15,
EVENT_REMEMBERME: 16,
EVENT_DEBUG: 17,
EVENT_ON_OAUTHTOKEN: 18,
EVENT_ON_RECONNECTED: 19,
EVENT_REPEAT_CHANGED: 20,
EVENT_SHUFFLE_CHANGED: 21,
EVENT_ON_BECAMEPREMIUM: 22,
EVENT_ON_LOSTPREMIUM: 23,
EVENT_CONTEXT_URI_CHANGED: 24,
EVENT_CONTEXT_TRACKS_CHANGED: 25,
EVENT_AUTH_CODE: 26,
EVENT_PLAY_AD: 27,
EVENT_TRACKLIST_ENDED: 28,
EVENT_EXECUTION_RETURN: 29,
EVENT_BRIDGE_CREATED: 30,
EVENT_BRIDGE_DESTROYED: 31
},
i = {
TRACK_PREVIOUS: -1,
TRACK_CURRENT: 0,
TRACK_NEXT: 1
},
j = {
BITRATE_LOW: 0,
BITRATE_NORMAL: 1,
BITRATE_HIGH: 2
},
k = {
ERROR_OK: 0,
ERROR_FAILED: 1,
ERROR_INIT_FAILED: 2,
ERROR_WRONG_API_VERSION: 3,
ERROR_NULL_ARGUMENT: 4,
ERROR_INVALID_ARGUMENT: 5,
ERROR_UNINITIALIZED: 6,
ERROR_ALREADY_INITIALIZED: 7,
ERROR_LOGIN_BAD_CREDENTIALS: 8,
ERROR_NEEDS_PREMIUM: 9,
ERROR_TRAVEL_RESTRICTION: 10,
ERROR_APPLICATION_BANNED: 11,
ERROR_GENERAL_LOGIN_ERROR: 12,
ERROR_UNSUPPORTED: 13,
ERROR_NOT_ACTIVE_DEVICE: 14,
ERROR_PLAYBACKERRORSTART: 1e3,
ERROR_GENERAL_PLAYBACK_ERROR: 1001,
ERROR_PLAYBACK_RATE_LIMITED: 1002,
ERROR_PLAYBACK_CAPPING_LIMIT_REACHED: 1003
},
l = {
DEVICE_UNKNOWN: 0,
DEVICE_SPEAKER: 4,
DEVICE_TV: 5,
DEVICE_AVR: 6,
DEVICE_STB: 7,
DEVICE_AUDIO_DONGLE: 8,
DEVICE_CONSOLE: 9,
DEVICE_CASTVIDEO: 10,
DEVICE_CASTAUDIO: 11
},
m = {
SILENT: 0,
VERBOSE: 1
};
e.EVENTS = h, e.TRACK = i, e.BITRATE = j, e.ERROR = k, e.DEVICE_TYPES = l, e.LOG_LEVELS = m, Object.freeze(e.EVENTS), Object.freeze(e.TRACK), Object.freeze(e.BITRATE), Object.freeze(e.ERROR), Object.freeze(e.DEVICE_TYPES), Object.freeze(e.LOG_LEVELS);
var n, o, p = {
LOGIN_PWD: 0,
LOGIN_BLOB: 1,
LOGIN_OAUTH: 2,
LOGOUT: 3,
CONN_STATUS: 4,
SET_CONNECTIVITY: 5,
GET_METADATA: 6,
GET_METADATA_IMAGE_URL: 7,
PLAYBACK_PLAY: 8,
PLAYBACK_PAUSE: 9,
PLAYBACK_NEXT: 10,
PLAYBACK_PREV: 11,
PLAYBACK_SEEK: 12,
PLAYBACK_VOLUME: 13,
PLAYBACK_SHUFFLE: 14,
PLAYBACK_REPEAT: 15,
PLAYBACK_BITRATE: 16,
PLAYBACK_STATUS: 17,
SP_DISPLAY_NAME: 18,
GET_PRESET: 19,
PLAY_PRESET: 20,
GET_VERSION: 21,
REQUEST_OAUTH_TOKEN: 22,
PAIR_DEVICE: 23,
TRACKLIST_LOAD: 24,
TRACKLIST_REPLACE: 25,
TRACKLIST_GET_STATUS: 26,
TRACKLIST_GET_TRACKS: 27,
TRACKLIST_GET_INFO: 28,
TRACKLIST_PLAY: 29,
HMAC_STRING: 30,
REQUEST_AUTH_CODE: 31,
INCREASE_STREAM_TIME: 32,
SYSTEM_LOG_LEVEL: 33
},
q = {
ZC_GET_REPLY: 1,
ZC_LOGIN: 2
};
e.FUNCTION_CONSTANTS = p, e.ZC_FUNCTION_CONSTANTS = q;
var r;
e.createBridgePayload = function(a, b, c) {
var d = {
func: a,
args: b
};
return c && (d.ns = c), d
}, e.setBridge = function(a) {
r = a
}, e.passClientId = function(a, b) {
n = Object.freeze(a), b && (o = Object.freeze(b))
}, e._execute = function(a, b, c, d) {
var f = e.createBridgePayload(a, b, d);
r.handlesCallbacks || "function" != typeof c || (c = e.wrapCallback.bind(e, c)), r.execute(f, c)
}, e.loginPassword = function(a, b, c) {
e._execute(p.LOGIN_PWD, [a, b], c)
}, e.loginBlob = function(a, b, c) {
e._execute(p.LOGIN_BLOB, [a, b], c)
}, e.loginOauth = function(a, b) {
e._execute(p.LOGIN_OAUTH, [a], b)
}, e.logout = function(a) {
e._execute(p.LOGOUT, [], a)
}, e.requestAccessToken = function(a) {
e._execute(p.REQUEST_OAUTH_TOKEN, [n.CLIENT_ID, n.SCOPE], a)
}, e.setConnectivity = function(a, b) {
e._execute(p.SET_CONNECTIVITY, [a], b)
}, e.getMetadata = function(a, b) {
e._execute(p.GET_METADATA, void 0 === a ? [] : [a], b)
}, e.getMetadataImage = function(a, b) {
e._execute(p.GET_METADATA_IMAGE_URL, [a], b)
}, e.playTrack = function(a) {
e._execute(p.PLAYBACK_PLAY, [], a)
}, e.pauseTrack = function(a) {
e._execute(p.PLAYBACK_PAUSE, [], a)
}, e.previousTrack = function(a) {
e._execute(p.PLAYBACK_PREV, [], a)
}, e.nextTrack = function(a) {
e._execute(p.PLAYBACK_NEXT, [], a)
}, e.seekTrack = function(a, b) {
e._execute(p.PLAYBACK_SEEK, [a], b)
}, e.setVolume = function(a, b) {
var c = 65535,
d = a * (c / 100);
e._execute(p.PLAYBACK_VOLUME, [d], b)
}, e.setShuffle = function(a, b) {
e._execute(p.PLAYBACK_SHUFFLE, [a], b)
}, e.setRepeat = function(a, b) {
e._execute(p.PLAYBACK_REPEAT, [a], b)
}, e.getPlaybackStatus = function(a) {
e._execute(p.PLAYBACK_STATUS, [], a)
}, e.setDisplayName = function(a, b) {
e._execute(p.SP_DISPLAY_NAME, [a], b)
}, e.getVersion = function(a) {
e._execute(p.GET_VERSION, [], a)
}, e.tracklistLoad = function(a, b, c) {
e._execute(p.TRACKLIST_LOAD, [a, b], c)
}, e.tracklistReplace = function(a, b, c, d, f, g, h) {
var i, j;
for (i = 0, j = a.length; j > i; i += 1)
if (!a[i]) throw new Error("[api] Some track uri is null");
e._execute(p.TRACKLIST_REPLACE, [a, b, c, d, f, g], h)
}, e.tracklistGetStatus = function(a) {
e._execute(p.TRACKLIST_GET_STATUS, [], a)
}, e.tracklistGetTracks = function(a) {
e._execute(p.TRACKLIST_GET_TRACKS, [], function(b, c) {
b = b || c.error || null, a(b, c.tracks || [])
})
}, e.tracklistPlay = function(a, b) {
e._execute(p.TRACKLIST_PLAY, [a], b)
}, e.hmacString = function(a, b) {
e._execute(p.HMAC_STRING, [a], b)
}, e.requestAuthCode = function(a) {
e._execute(p.REQUEST_AUTH_CODE, [o.CLIENT_ID, o.SCOPE], a)
}, e.increaseStreamTime = function(a, b) {
e._execute(p.INCREASE_STREAM_TIME, [a], b)
}, e.systemLogLevel = function(a, b) {
e._execute(p.SYSTEM_LOG_LEVEL, [a], b)
}, e.zcGetReply = function(a, b, c) {
e._execute(q.ZC_GET_REPLY, [a, b], c, "zc")
}, e.zcLogin = function(a, b, c, d) {
e._execute(q.ZC_LOGIN, [a, b, c], d, "zc")
}, e.wrapCallback = function(a, b) {
var d = null;
switch (typeof b) {
case "string":
b = JSON.parse(b);
break;
case "boolean":
case "number":
case "undefined":
case "null":
break;
default:
d = e.ERROR.ERROR_FAILED
}
"number" == typeof b && (b === e.ERROR.ERROR_OK ? b = "" : (d = b, b = null)), c.nextTick(function() {
a(d, b)
})
}
}).call(this, a("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"../utils/object.js": 68,
"./base.js": 24,
_process: 1
}],
26: [function(a, b, c) {
"use strict";
var d = {};
b.exports = d;
var e;
d.tracks = [], d.uri = void 0, d.totalTracks = void 0, d.isConnect = !0, d.init = function(a) {
d.tracksPerPage = a, d.reset()
}, d.reset = function() {
d.tracks = [], d.totalTracks = 0, d.uri = "", d.isConnect = !0, e = void 0
}, d.getState = function() {
return {
tracks: d.tracks.slice(),
uri: d.uri,
totalTracks: d.totalTracks,
tracksPerPage: d.tracksPerPage,
sourceStart: d.getSourceStart(),
isConnect: d.isConnect
}
}, d.setState = function(a) {
d.setUri(a.uri), a.tracks && a.tracks.length && (d.tracks = a.tracks), void 0 !== a.totalTracks && (d.totalTracks = a.totalTracks), void 0 !== a.tracksPerPage && (d.tracksPerPage = a.tracksPerPage), d.isConnect = a.isConnect !== !1, d.setSourceStart(a.sourceStart)
}, d.hasTracks = function() {
return d.tracks.length > 0
}, d.setUri = function(a) {
a !== d.uri && (d.reset(), d.uri = a)
}, d.getTracks = function(a, b) {
if ("number" != typeof a || "number" != typeof b) throw new Error("[trackManager.context] Invalid arguments");
return d.tracks.slice(a, a + b)
}, d.hasContext = function() {
return !!d.uri && !d.isConnect
}, d.isContextLoaded = function(a, b) {
return d.uri === a && void 0 !== d.tracks[b * d.tracksPerPage]
}, d.setSourceStart = function(a) {
e = a
}, d.getSourceStart = function() {
return e || ""
}, d.destroy = function() {
d.reset()
}
}, {}],
27: [function(a, b, c) {
"use strict";
function d(a) {
if (1 !== a && -1 !== a) throw new Error("[trackManager] Invalid argument");
var b = m.getCurrentPage() + a,
c = m.getLastPage();
z[a] || (0 > b ? b = l.isRepeatEnabled() ? c : null : b > c && (b = l.isRepeatEnabled() ? 0 : null), null !== b && (z[b] = !0, i._loadTracksFromContext(n.uri, b, n.getSourceStart(), function(a, c, d) {
return a ? void d(new Error("[trackManager] Could not load tracks from context: " + n.uri)) : (delete z[b], m.loadPage(b), void f(void 0, d))
})))
}
function e(a, b, c, d, e) {
b = b ? b : 0;
var f = g(b);
e && m.clearQueue(), l.getPlaybackState().shuffle && (k = !0), i._loadTracksFromContext(a, f.page, c, function(c, e, f) {
if (c) throw new Error("[trackManager] Could not load context from " + a);
m.init(n, b, l.TRACKS_PER_PAGE, l.isTrackAvailable), i.esdkLoadTracks(n, void 0, function(a, b) {
i.prefetchTracksIfNecessary(t.RIGHT), "function" == typeof f && f(a, null), "function" == typeof d && d()
})
})
}
function f(a, b) {
var c, d = s && l.getPlaybackState().shuffle && !h();
if (!i.prepareFallbackList(a)) throw new Error("[trackManager] Could not prepare fallback list");
c = p(m.getFallbackList(), "uri"), j.tracklistReplace(c, m.getFallbackIndex(), m.getManuallyQueuedTracksStartAt(), m.getManuallyQueuedTracksLength(), d, l.getPlaybackState().repeat ? 1 : 0, b)
}
function g(a) {
var b = Math.floor(a / v),
c = b * v,
d = a - c;
return {
page: b,
pageOffset: d
}
}
function h() {
return !k
}
var i = {};
b.exports = i;
var j, k, l, m, n, o = (a("../config.js"), a("../interfaces/web")),
p = a("../utils/pick"),
q = a("../ui"),
r = 5e3,
s = !0,
t = Object.freeze({
LEFT: -1,
RIGHT: 1
}),
u = 100,
v = o.API_MAX_LIMIT,
w = Math.min(v, u),
x = 4,
y = !0,
z = {};
i.init = function(a, b, c, d) {
l = a, m = b, n = c, j = d
}, i.addTrackToQueue = function(a, b) {
l.isTrackAvailable(a) && (l.getPlaybackState().shuffle && (k = !0), m.addTrackToQueue(a), f(null, b))
}, i.addTrackUriToQueue = function(a, b) {
var c = a.substr(14);
o.getTracks([c], function(a, c) {
if (!a) {
var d = c.tracks.pop();
i.addTrackToQueue(d, b)
}
})
}, i.playFromContext = function(a, b, c, d) {
return l.getPlaybackState().isAdPlaying ? (i.play(), void q.displayNowPlayingOverlay()) : void e(a, b, c, d, !0)
}, i.setRepeat = function(a) {
if ("boolean" != typeof a) throw new Error("[trackManager] Invalid repeat state: " + a);
a !== l.getPlaybackState().repeat && (l.getPlaybackState().repeat = a, j.setRepeat(a))
}, i.toggleRepeat = function() {
i.setRepeat(!l.getPlaybackState().repeat)
}, i.toggleShuffle = function() {
i.setShuffle(!l.getPlaybackState().shuffle)
}, i.setShuffle = function(a) {
return s ? (a && (k = !0), l.getPlaybackState().shuffle = a, void f(a)) : void j.setShuffle(a)
}, i.unshuffleConnectContext = function() {
f(!1)
}, i.nextTrack = function() {
j.nextTrack()
}, i.previousTrack = function() {
var a = 0 === m.getFallbackIndex();
j.previousTrack(), a && !l.getPlaybackState().repeat && l.resetTrackProgress()
}, i.rewind = function(a) {
var b = a ? a : r;
i.seek(Math.max(l.getPlaybackState().currentTrackProgress - b, 0))
}, i.fastForward = function(a) {
var b = a ? a : r;
i.seek(l.getPlaybackState().currentTrackProgress + b)
}, i.seek = function(a) {
l.updateCurrentTrackProgress(a), j.seekTrack(a)
}, i.togglePlayback = function() {
l.getPlaybackState().isPlaying ? i.pause() : i.play()
}, i.play = function() {
l.getPlaybackState().isPlaying || j.playTrack()
}, i.pause = function() {
l.getPlaybackState().isPlaying && j.pauseTrack()
}, i.prefetchTracksIfNecessary = function(a) {
n.hasContext() && (l.getPlaybackState().shuffle || n.totalTracks <= m.getFallbackListLimit() || (void 0 === a && (a = m.getDirection()), (a === t.RIGHT && m.getTracksLeft() < x || a === t.LEFT && m.getFallbackIndex() < x) && d(a)))
}, i.prepareFallbackList = function(a) {
return l.setDirtyFlag(!0), m.prepareFallbackList(a) ? !0 : !1
}, i._loadTracksFromContext = function(a, b, c, d) {
d = d || function() {}, o.getContextTracks(a, b, function(e, f) {
if (e) return void d(e);
var g = n.getState(),
h = b * w;
y = !0, n.setState({
uri: a,
totalTracks: f.total,
sourceStart: c,
isConnect: !1
}), f.tracks.forEach(function(a, b) {
n.tracks[h + b] = a
}), d(null, f, function(a) {
a && (l.setDirtyFlag(!0), y = !1, n.setState(g))
})
})
}, i.esdkLoadTracks = function(a, b, c) {
var d, e, f = s && l.getPlaybackState().shuffle && !h(),
g = b === !1 ? 2 : 1;
c = c || function() {}, i.prepareFallbackList(f) ? (d = {
context_uri: a.uri,
source_start: a.getSourceStart(),
shuffled: f,
repeated: l.getPlaybackState().repeat ? 1 : 0,
play_hint: g,
play_from: m.getFallbackIndex(),
play_from_offset_ms: 0,
queued_index: m.getManuallyQueuedTracksStartAt(),
queued_count: m.getManuallyQueuedTracksLength()
}, e = p(m.getFallbackList(), "uri"), j.tracklistLoad(e, d, c)) : c(new Error("Could not prepare fallback list", null))
}
}, {
"../config.js": 8,
"../interfaces/web": 13,
"../ui": 34,
"../utils/pick": 71
}],
28: [function(a, b, c) {
"use strict";
function d() {
t = e(0, s)
}
function e(a, b) {
if (!p || !q || !q.length) return 0;
if ("undefined" == typeof b && (b = q.length), 0 > a || a > b) throw new Error("[trackManager.esdkAdapter] Invalid argument: from = " + a);
if (b > q.length) throw new Error("[trackManager.esdkAdapter] Invalid argument: to = " + b);
for (var c = 0, d = a; b > d; d += 1) p(q[d]) || (c += 1);
return c
}
function f(a) {
return Math.floor(a / o)
}
function g(a) {
var b, c, d;
for (b = a.length - 1; b > 0; b--) c = Math.floor(Math.random() * (b + 1)), d = a[b], a[b] = a[c], a[c] = d;
return a
}
function h(a, b) {
var c, d, e = o - v.length,
f = a * o,
g = Math.min((b + 1) * o, k.totalTracks),
h = k.getTracks(f, e);
d = k.getTracks(g - o, o), p && (d = d.filter(p)), d = d.slice(-y), h = d.concat(h), c = Math.max(0, y - j.getTracksLeft()), r = q = h, s = c + A, t = 0, z = d.length, A = 0
}
function i(a, b) {
var c, e = o - v.length,
f = a * o,
g = b * o,
h = k.getTracks(f, e);
c = k.getTracks(g, o), p && (c = c.filter(p)), c = c.slice(0, y), h = h.concat(c), r = q = h, s = s + q.length - c.length - z, z = 0, A = c.length, d()
}
var j = {};
b.exports = j;
var k, l, m, n, o, p, q = [],
r = [],
s = 0,
t = 0,
u = 0,
v = [],
w = 0,
x = 0,
y = 5,
z = 0,
A = 0,
B = 0;
j.init = function(a, b, c, e) {
if (k = a, e && (p = e), b > 0 && b >= k.totalTracks || 0 > b) throw new Error("[trackManager.esdkAdapter] Out of bounds");
n = c + y, o = n - y, s = b % o, B = f(b);
var g = o,
h = B * o;
r = q = k.getTracks(h, g), z = 0, A = 0, m = void 0, v = [], w = 0, d()
}, j.getFallbackListLimit = function() {
return o
}, j.getDirection = function() {
if (void 0 === m || m === s) return 0;
if (0 === m && s === q.length - 1) return -1;
if (m === q.length - 1 && 0 === s) return 1;
var a = m > s ? -1 : 1;
return a
}, j.prepareFallbackList = function(a) {
var b = q;
if (q = r, a === !0) {
l = q.slice();
var c = q.splice(s, 1);
q = c.concat(g(q)), s = 0
} else if (a === !1 && l) {
j.clearQueue();
for (var e = b[s], f = 0, h = 0; l.length > h; h++)
if (l[h] === e) {
f = h;
break
}
s = f, q = l, l = void 0
}
return d(), x = v.length, !w && x && (w = j.getFallbackIndex() + 1), 0 === q.length ? q = v.slice() : v.length && (q = q.slice(0, w).concat(v).concat(q.slice(w)).slice(0, n)), j.getFallbackList().length > 0
}, j.updateFallbackList = function(a) {
if (q = a, t = 0, x > 0) {
var b = w + x,
c = a.slice(0, w),
d = a.slice(b);
v = a.slice(w, b), k.hasTracks() || (k.tracks = c.concat(d), k.totalTracks = k.tracks.length), r = c.concat(d)
} else k.hasTracks() || (k.tracks = a, k.totalTracks = k.tracks.length), v = [], x = 0, r = a
}, j.addTrackToQueue = function(a) {
v.push(a)
}, j.getState = function() {
return {
fallbackList: q.slice(),
fallbackIndex: s,
manuallyQueuedTracks: v.slice()
}
}, j.clearQueue = function() {
v = [], x = 0
}, j.getFallbackList = function() {
return p ? q.filter(p) : q
}, j.getFallbackIndex = function() {
return s - t
}, j.loadPage = function(a) {
var b = B,
c = f(k.totalTracks - 1);
B = a;
var d = 0 === a && b === c && 1 === j.getDirection(),
e = a === c && 0 === b && -1 === j.getDirection();
(a > b || d) && !e ? h(a, b) : (b > a || e) && i(a, b)
}, j.getLastPage = function() {
return f(k.totalTracks - 1)
}, j.setEsdkStatus = function(a) {
m = s, u = a.track_count, w = a.queued_index, x = a.queued_count, s = a.play_index > a.track_count - 1 ? 0 : a.play_index, d()
}, j.getTracksLeft = function() {
var a = q.length - s,
b = e(s);
return a - b
}, j.getManuallyQueuedTracksStartAt = function() {
return w
}, j.getManuallyQueuedTracksLength = function() {
return x
}, j.getManuallyQueuedTracks = function() {
return v
}, j.getCurrentPage = function() {
return B
}, j.getTrackAt = function(a) {
return q[a + t]
}, j.destroy = function() {
q = [], r = [], l = void 0, v = []
}
}, {}],
29: [function(a, b, c) {
"use strict";
function d(a) {
var b;
b = a ? z.on.bind(z) : z.ignore.bind(z), b(z.ESDK_EVENTS.EVENT_ACTIVE, e), b(z.ESDK_EVENTS.EVENT_INACTIVE, f), b(z.ESDK_EVENTS.EVENT_CONTEXT_URI_CHANGED, g), b(z.ESDK_EVENTS.EVENT_CONTEXT_TRACKS_CHANGED, h), b(z.ESDK_EVENTS.EVENT_PAUSE, i), b(z.ESDK_EVENTS.EVENT_PLAY, j), b(z.ESDK_EVENTS.EVENT_REPEAT_CHANGED, k), b(z.ESDK_EVENTS.EVENT_SEEK, l), b(z.ESDK_EVENTS.EVENT_SHUFFLE_CHANGED, m), b(z.ESDK_EVENTS.EVENT_TRACKCHANGED, p), b(z.ESDK_EVENTS.EVENT_PLAY_AD, q), b(z.ESDK_EVENTS.EVENT_TRACKLIST_ENDED, r), b(z.EVENTS.CHANGE_BUFFERING_STATE, s), b(z.ESDK_EVENTS.EVENT_LOGGEDOUT, y.destroy)
}
function e() {
K = !0, g(), W.isPlaying && j(), y.emit(Q.CHANGE_ACTIVE_STATE, {
active: !0
})
}
function f() {
y.emit(Q.CHANGE_ACTIVE_STATE, {
active: !1
}), K = !1
}
function g() {
X = {}, y.setDirtyFlag(!0), h(), N = !1
}
function h() {
setTimeout(function() {
u(!0, function() {
y.setDirtyFlag(!1), y.emit(Q.CHANGE_TRACK, {
index: H.getFallbackIndex()
}), y.emit(Q.CHANGE_PLAY_QUEUE), y.emit(Q.HAS_ESDK_STATE)
})
}, U)
}
function i() {
W.isPlaying = !1, y.emit(Q.CHANGE_PLAYBACK_STATE, {
isPlaying: !1
})
}
function j() {
W.isPlaying = !0, M = Date.now(), setTimeout(w, T), y.emit(Q.CHANGE_PLAYBACK_STATE, {
isPlaying: !0
})
}
function k(a) {
W.repeat = a.repeat, y.emit(Q.CHANGE_REPEAT_SETTING, {
repeat: W.repeat
})
}
function l(a) {
M = Date.now(), W.currentTrackProgress = a.position_ms, y.emit(Q.UPDATE_TRACK_PROGRESS, {
progress: a.position_ms
})
}
function m(a) {
o();
var b = !!a.shuffle;
y.emit(Q.CHANGE_SHUFFLE_SETTING, {
shuffle: b
}), W.shuffle !== b && (W.shuffle = b, W.shuffle ? N = !1 : o() || I.unshuffleConnectContext())
}
function n(a) {
y.on(y.EVENTS.HAS_ESDK_STATE, a, !0)
}
function o() {
return !N
}
function p() {
W.currentTrackProgress = 0, setTimeout(function() {
u(!1, function() {
K && (y.emit(Q.CHANGE_TRACK, {
index: H.getFallbackIndex()
}), l({
position_ms: W.currentTrackProgress || 0
}), !E.supports.connectOnly && I && I.prefetchTracksIfNecessary())
})
}, U)
}
function q() {
y.emit(Q.CHANGE_TO_AD)
}
function r() {
G.hasContext() && (H.init(G, 0, S, y.isTrackAvailable), I.esdkLoadTracks(G, !1))
}
function s(a) {
a.buffering ? W.isBuffering = !0 : W.isBuffering && L.getPlaybackStatus(function(a, b) {
W.isBuffering = !1, l({
position_ms: b.position
}), w()
})
}
function t(a, b) {
var c = function(a, d) {
if (a.length > 0) {
var e = a.slice(0, R);
A.getTracks(e, function(e, f) {
e ? b(e, d) : c(a.slice(R), d.concat(f.tracks))
})
} else b(null, d)
};
c(a, [])
}
function u(a, b) {
var c, d, e, f = function(a, b) {
a || (c = b, i())
},
g = function(a, b) {
a || (d = b, i())
},
h = function(a, b) {
a || (e = b || [], i())
},
i = function() {
c && d && (!a || e) && (K = c.isActiveDevice, G.setUri(d.context_uri), H.setEsdkStatus(d), a && H.updateFallbackList(e), W = {
currentTrackProgress: c.position,
isAdPlaying: d.ad_is_playing,
isPlaying: c.isPlaying,
isBuffering: W.isBuffering || !1,
repeat: c.isRepeated,
shuffle: c.isShuffled
}, b())
};
F(L.getPlaybackStatus, f, J), F(L.tracklistGetStatus, g, J), a && F(v, h, J)
}
function v(a) {
L.tracklistGetTracks(function(b, c) {
return b ? void a(b) : void t(c, function(b, c) {
a(b, c)
})
})
}
function w() {
if (void 0 !== W && W.isPlaying && !W.isBuffering) {
var a = Date.now();
W.currentTrackProgress += a - M, M = a, setTimeout(w, T), y.emit(Q.UPDATE_TRACK_PROGRESS, {
progress: W.currentTrackProgress
})
}
}
function x(a, b) {
return -1 !== a.available_markets.indexOf(b)
}
var y = {};
b.exports = y;
var z = a("../eventBus.js"),
A = a("../interfaces/web"),
B = a("../utils/object"),
C = a("../utils/applyEventHandler"),
D = a("../currentUser.js"),
E = a("../config.js"),
F = a("../utils/retry.js"),
G = a("./context.js"),
H = a("./esdkAdapter.js"),
I = a("./controller.js"),
J = a("../validators/isObject.js");
C(y);
var K, L, M, N, O, P = 100,
Q = Object.freeze({
CHANGE_SHUFFLE_SETTING: 1,
CHANGE_REPEAT_SETTING: 2,
CHANGE_PLAY_QUEUE: 3,
CHANGE_TRACK: 4,
CHANGE_PLAYBACK_STATE: 5,
UPDATE_TRACK_PROGRESS: 6,
CHANGE_ACTIVE_STATE: 7,
CHANGE_TO_AD: 9,
HAS_ESDK_STATE: 10
}),
R = A.API_MAX_LIMIT,
S = Math.min(R, P),
T = 250,
U = E.supports.connectOnly ? 0 : 200,
V = !0,
W = {},
X = {},
Y = !1;
y.EVENTS = Q, y.TRACKS_PER_PAGE = S, y.esdkAdapter = H, y.context = G, y.controller = I, y.init = function(a) {
L = a, O || (O = !0, G.init(S), H.init(G, 0, S, y.isTrackAvailable), I.init(y, H, G, L), u(!0, function() {
d(!0), K ? e() : f(), y.isAdPlaying() && q(), Y = !0
}))
}, y.reInit = function() {
O = !1, d(!1), y.init(L)
}, y.getState = function() {
return {
esdkAdapter: H.getState(),
context: G.getState(),
playback: B.clone(W || {}),
isActiveDevice: K,
isInitialized: O,
isReady: Y
}
}, y.getContextUri = function() {
return G.uri
}, y.destroy = function() {
K = !1, O = !1, d(!1), G.destroy(), H.destroy()
}, y.isAdPlaying = function() {
return W.isAdPlaying
}, y.isActiveDevice = function() {
return K
}, y.isTrackAvailable = function(a) {
return a ? a.isAd ? !0 : a.id && null !== a.id ? void 0 !== a.is_playable ? a.is_playable : x(a, D.country) ? !0 : !1 : !1 : !1
}, y.getPlaybackState = function() {
return W
}, y.updateCurrentTrackProgress = function(a) {
W.currentTrackProgress = a
}, y.isPlaying = function() {
return W.isPlaying
}, y.isRepeatEnabled = function() {
return W.repeat
}, y.isShuffleEnabled = function() {
return W.shuffle
}, y.awaitNowPlayingTracks = function(a) {
if (V) n(y.awaitNowPlayingTracks.bind(y, a));
else if (y._getRelativeTrack(0)) {
var b, c = [-2, -1, 0, 1, 2].map(y._getRelativeTrack);
W.isAdPlaying ? (b = c.slice(2).filter(function(a) {
return a
}), y._getCurrentAdAsTrack(function(d) {
c = [void 0, void 0, d, void 0, void 0], a(c, b)
})) : (b = [3, 4, 5].map(y._getRelativeTrack).filter(function(a) {
return a
}), a(c, b))
} else;
}, y.awaitCurrentTrackMetadata = function(a) {
if (W.isAdPlaying) y._getCurrentAdAsTrack(function(b) {
a(b)
});
else if (V) n(y.awaitCurrentTrackMetadata.bind(y, a));
else {
var b = y._getRelativeTrack(0);
b && a(b)
}
}, y.setDirtyFlag = function(a) {
V = !!a
}, y.resetTrackProgress = function() {
l({
position_ms: 0
})
}, y._getRelativeTrack = function(a) {
return H.getTrackAt(H.getFallbackIndex() + a)
}, y._getCurrentAdAsTrack = function(a) {
var b, c, d = function(a, c) {
a || (b = c, L.getMetadataImage(b.album_cover_uri, e))
},
e = function(d, e) {
d || (c = e.large, a({
isAd: !0,
name: b.track,
album: {
images: [{
url: c
}]
},
artists: [{
name: b.artist
}],
duration_ms: b.duration_ms
}))
};
L.getMetadata(0, d)
}
}, {
"../config.js": 8,
"../currentUser.js": 10,
"../eventBus.js": 11,
"../interfaces/web": 13,
"../utils/applyEventHandler": 55,
"../utils/object": 68,
"../utils/retry.js": 75,
"../validators/isObject.js": 81,
"./context.js": 26,
"./controller.js": 27,
"./esdkAdapter.js": 28
}],
30: [function(a, b, c) {
(function(a) {
"use strict";
function c(a) {
var b, c = (a || "0").toString().toLowerCase().replace(/[%A-z]+$/, function(a) {
return b = a, ""
});
return [c, b]
}
function d() {
h = {
linear: function(a) {
return a
},
swing: function(a) {
return .5 - Math.cos(a * Math.PI) / 2
}
}, e([{
name: k.EASE,
values: [.25, .1, .25, 1]
}, {
name: k.EASE_IN,
values: [.42, 0, 1, 1]
}, {
name: k.EASE_OUT,
values: [0, 0, .58, 1]
}, {
name: k.EASE_IN_OUT,
values: [.42, 0, .58, 1]
}])
}
function e(a) {
a.forEach(function(a) {
h[a.name] = f.apply(null, a.values)
})
}
function f(b, c, d, e) {
function f(a, b) {
return 1 - 3 * b + 3 * a
}
function g(a, b) {
return 3 * b - 6 * a
}
function h(a) {
return 3 * a
}
function i(a, b, c) {
return ((f(b, c) * a + g(b, c)) * a + h(b)) * a
}
function j(a, b, c) {
return 3 * f(b, c) * a * a + 2 * g(b, c) * a + h(b)
}
function k(a, c) {
for (var e = 0; p > e; ++e) {
var f = j(c, b, d);
if (0 === f) return c;
var g = i(c, b, d) - a;
c -= g / f
}
return c
}
function l() {
for (var a = 0; t > a; ++a) x[a] = i(a * u, b, d)
}
function m(a, c, e) {
var f, g, h = 0;
do g = c + (e - c) / 2, f = i(g, b, d) - a, f > 0 ? e = g : c = g; while (Math.abs(f) > r && ++h < s);
return g
}
function n(a) {
for (var c = 0, e = 1, f = t - 1; e !== f && a >= x[e]; ++e) c += u;
--e;
var g = (a - x[e]) / (x[e + 1] - x[e]),
h = c + g * u,
i = j(h, b, d);
return i >= q ? k(a, h) : 0 === i ? h : m(a, c, c + u)
}
function o() {
y = !0, (b !== c || d !== e) && l()
}
var p = 4,
q = .001,
r = 1e-7,
s = 10,
t = 11,
u = 1 / (t - 1),
v = "Float32Array" in a;
if (4 !== arguments.length) throw new Error("[tween] Must give four control points as arguments");
for (var w = 0; 4 > w; ++w)
if ("number" != typeof arguments[w] || isNaN(arguments[w]) || !isFinite(arguments[w])) throw new Error("[tween] Arguments must be numbers");
b = Math.min(b, 1), d = Math.min(d, 1), b = Math.max(b, 0), d = Math.max(d, 0);
var x = v ? new Float32Array(t) : new Array(t),
y = !1;
return function(a) {
return y || o(), b === c && d === e ? a : 0 === a ? 0 : 1 === a ? 1 : i(n(a), c, e)
}
}
function g(a, b, c) {
c = c || {}, this.isRunning = !1, this.element = a, this.properties = b || {}, this.duration = c.duration, "number" != typeof this.duration && (this.duration = i), c.easing && (this.easing = "function" == typeof c.easing ? c.easing : h[c.easing]), this.easing || (this.easing = h.linear)
}
b.exports = g;
var h, i = 450,
j = {
TRANSLATE_X: "translateX",
TRANSLATE_Y: "translateY"
},
k = {
LINAR: "linear",
SWING: "swing",
EASE: "ease",
EASE_IN: "ease-in",
EASE_OUT: "ease-out",
EASE_IN_OUT: "ease-in-out"
},
l = function() {
return a.document && document.body.style.hasOwnProperty("webkitTransform") ? "webkitTransform" : "transform"
}();
g.EASINGS = k, g.TRANSFORMS = j, g.TRANSFORM_PROPERTY = l, g.prototype.start = function() {
this.properties = this._parseProperties(), this.isRunning = !0
}, g.prototype.update = function(a) {
for (var b in this.properties) {
var c, d = this.properties[b];
if (1 === a) c = d.endValue;
else {
var e = d.endValue - d.startValue;
c = d.startValue + e * this.easing(a)
}
d.currentValue !== c && (d.currentValue = c, this._setPropertyValue(b), 1 === a && (this.done = !0))
}
}, g.prototype._parseProperties = function() {
var a = {};
for (var b in this.properties) {
var c = this._getPropertyValue(b),
d = {
startValue: c || 0,
currentValue: c || 0,
endValue: this.properties[b],
unit: "px"
};
a[b] = d
}
return a
}, g.prototype._getPropertyValue = function(a) {
var b = 0;
switch (a) {
case "x":
b = this.element.dataset[j.TRANSLATE_X] || 0;
break;
case "y":
b = this.element.dataset[j.TRANSLATE_Y] || 0;
break;
default:
b = c(this.element.style[a])[0]
}
return parseFloat(b)
}, g.prototype._setPropertyValue = function(a) {
var b = this.properties[a],
c = b.unit || "";
switch (a) {
case "x":
this.element.dataset[j.TRANSLATE_X] = b.currentValue;
var d = this.element.dataset[j.TRANSLATE_Y] || 0;
this.element.style[l] = "translate3d(" + b.currentValue + c + "," + d + c + ",0)";
break;
case "y":
this.element.dataset[j.TRANSLATE_Y] = b.currentValue;
var e = this.element.dataset[j.TRANSLATE_X] || 0;
this.element.style[l] = "translate3d(" + e + c + "," + b.currentValue + c + ",0)";
break;
default:
this.element.style[a] = b.currentValue + c
}
}, d()
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {}],
31: [function(a, b, c) {
(function(c) {
"use strict";
var d = {};
b.exports = d;
var e, f, g, h = a("./Tween.js"),
i = 16,
j = i,
k = function(a) {
var b = Date.now();
f.forEach(function(a) {
var c = a.timeStart;
c || (c = a.timeStart = b - j);
var d = Math.min((b - c) / a.duration, 1);
a.update(d), 1 === d && l(a)
}), g && e(k)
},
l = function(a) {
for (var b = 0; f.length > b; b++)
if (f[b] === a) {
f.splice(b, 1);
break
}
0 === f.length && (g = !1)
},
m = function(a) {
for (var b = 0; f.length > b; b++)
if (f[b].element === a) return void f.splice(b, 1)
};
d.init = function(a) {
f = [], g = !1, a && "number" == typeof a.simulationTime && (j = a.simulationTime), e = function() {
var a = 0;
return c.requestAnimationFrame || c.webkitRequestAnimationFrame || c.mozRequestAnimationFrame || function(b) {
var c, d = Date.now();
return c = Math.max(0, 16 - (d - a)), a = d + c, setTimeout(function() {
b(d + c)
}, c)
}
}()
}, d.addTween = function(a, b, c) {
var d = new h(a, b, c);
return m(a), f.push(d), d.start(), g || (g = !0, k()), d
}, d.resetElement = function(a) {
a.style[h.TRANSFORM_PROPERTY] = "", a.dataset[h.TRANSFORMS.TRANSLATE_X] && delete a.dataset[h.TRANSFORMS.TRANSLATE_X], a.dataset[h.TRANSFORMS.TRANSLATE_Y] && delete a.dataset[h.TRANSFORMS.TRANSLATE_Y], m(a)
}, d.isRunning = function() {
return g
}
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"./Tween.js": 30
}],
32: [function(a, b, c) {
b.exports = {
animationModule: a("./animationModule.js"),
Tween: a("./Tween.js")
}
}, {
"./Tween.js": 30,
"./animationModule.js": 31
}],
33: [function(a, b, c) {
"use strict";
var d, e, f = "js-cursor",
g = "js-main",
h = "cursor-hidden",
i = "cursor-template",
j = "no-cursor",
k = 180,
l = !0,
m = function() {
if (!d) {
d = Spotify.utils.createElement("div", {
id: f,
className: h
});
var a = document.getElementById(g);
a.appendChild(d)
}
},
n = function(a) {
d && d.style && Object.keys(a).forEach(function(b) {
d.style[b] = a[b]
})
},
o = function(a) {
var b = a.getBoundingClientRect();
return 0 === b.width || 0 === b.height ? void p() : (e && e !== a ? (n({
left: a.offsetLeft + "px",
top: a.offsetTop + "px"
}), Spotify.ui.animation.animationModule.addTween(d, {
width: b.width,
height: b.height
}, {
duration: k,
easing: Spotify.ui.animation.Tween.EASINGS.EASE_IN_OUT
})) : n({
left: a.offsetLeft + "px",
top: a.offsetTop + "px",
width: b.width + "px",
height: b.height + "px"
}), void(e = a))
},
p = function() {
l || (l = !0, d.classList.add(h))
},
q = function() {
l && (l = !1, d.classList.remove(h))
},
r = function(a) {
for (var b = 0; a.childNodes.length > b; b++)
if (a.childNodes[b].classList && a.childNodes[b].classList.contains(i)) return a.childNodes[b];
return a
},
s = function(a) {
return "BUTTON" === a.tagName ? !1 : a.classList && a.classList.contains(j) ? !1 : !0
},
t = function(a) {
var b = r(a);
s(b) ? (l && (d.classList.remove(h), l = !1), o(b)) : p()
};
b.exports = {
NO_CURSOR_CLASS: j,
CURSOR_TEMPLATE_CLASS: i,
init: m,
setCursor: t,
hide: p,
show: q
}
}, {}],
34: [function(a, b, c) {
(function(c) {
"use strict";
function d() {
k.navigateTo("/yourMusic")
}
function e() {
k.navigateTo("/browse")
}
function f() {
var a = D.value,
b = {
query: a ? a.trim() : a
};
C.classList.contains("search-typing") ? (k.currentView === k.views.searchView ? (k.currentView.updateFromStateParams(b), Spotify.router.replaceState("/search", {
params: b
})) : k.navigateTo("/search", b), D.blur()) : (k.currentView !== k.views.searchView && k.currentView !== k.views.searchSongsView && k.currentView !== k.views.searchAlbumsView && k.currentView !== k.views.searchPlaylistsView && k.navigateTo("/search", b), C.classList.add("search-typing"), D.focus()), k.interactionManager.goToElement(D)
}
function g() {
k.interactionManager.moveDown()
}
function h() {
k.showOverlay(k.views.overlays.profileOverlay)
}
function i(a) {
for (; a.firstChild;) a.removeChild(a.firstChild)
}
function j(a) {
for (var b in k.views)
if (k.views[b] === a) return b;
return null
}
var k = {};
b.exports = k;
var l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I = a("../config.js"),
J = a("../currentUser.js"),
K = a("../eventBus.js"),
L = a("../utils/path.js"),
M = a("../utils/createElement.js"),
N = a("../utils/ImageBackground.js"),
O = a("../connection.js"),
P = a("../utils/device.js"),
Q = a("../utils/stringTruncator.js"),
R = a("../utils/object.js"),
S = "button-pressed",
T = "is-offline",
U = {
TOP_ID: "js-top",
TOP_CLASS: "top",
BOTTOM_ID: "js-bottom",
BOTTOM_CLASS: "bottom",
CONTENT_ID: "js-main",
CONTENT_CLASS: "content",
CONTAINER_CLASS: "container",
NAVCONTAINER: "js-nav-ct",
NAVPOINT: "js-nav-pt",
HIDDEN: "hidden"
},
V = "placeholder-profile",
W = M("div", {
className: "modal loader"
}, [M("div", {
className: "centre"
}, [M("div", {
className: "dot"
}), M("div", {
className: "dot"
}), M("div", {
className: "dot"
})])]);
k.translation = a("./translation"), k.input = a("./input"), k.animation = a("./animation"), k.overlayModule = a("./overlayModule.js"), k.interactionManager = a("./interactionManager.js"), k.cursor = a("./cursor"), k.models = a("./models"), k.views = a("generatedViews"), k.keySubscriptions = [], k.currentView = void 0, k.previousView = void 0, k.blockViewChange = !1, k.secrets = [], k.nineLastKeys = [], k.splashScreen = document.getElementById("loadingScreen"), k.currentOverlay = void 0, k._openOverlays = [], k.init = function(a) {
K.on(K.ESDK_EVENTS.EVENT_LOGGEDOUT, k.resetViews), k.setupEventListeners(), G = a, l = M("section", {
id: U.TOP_ID,
className: U.TOP_CLASS
}), m = M("section", {
id: U.BOTTOM_ID,
className: U.BOTTOM_CLASS + " " + U.HIDDEN
}), n = M("section", {
id: U.CONTENT_ID,
className: U.CONTENT_CLASS
}), o = M("div", {
className: U.CONTAINER_CLASS
}), o.appendChild(l), o.appendChild(n), o.appendChild(m), document.body.appendChild(o);
var b = P.detect(c.navigator.userAgent);
b && document.body.classList.add(b), k.setupPlayBar(), k.generateTopMenu()
}, k.setupEventListeners = function() {
O.on(O.EVENTS.OFFLINE, k.showOfflineScreen), O.on(O.EVENTS.ONLINE, k.hideOfflineScreen)
}, k.showOfflineScreen = function() {
document.documentElement.classList.add(T), k.enableKeyInput(!1), k.currentOverlay !== k.views.overlays.offlineOverlay && (k.overlayModule.isOpen() && (H = k.currentOverlay), k.showOverlay(k.views.overlays.offlineOverlay))
}, k.enableKeyInput = function(a) {
a = a !== !1, k.input.keyHandler.enableKeys(a)
}, k.hideOfflineScreen = function() {
document.documentElement.classList.remove(T), k.enableKeyInput(!0), H && k.currentOverlay === k.views.overlays.offlineOverlay ? (k.showOverlay(H), H = void 0) : k.currentOverlay !== k.views.overlays.offlineOverlay || H || k.closeOverlay()
}, k.initViews = function() {
k.overlayModule.init(), Object.keys(k.views).forEach(function(a) {
var b = k.views[a];
"function" == typeof b.init && b.init()
})
}, k.resetViews = function() {
Object.keys(k.views).forEach(function(a) {
var b = k.views[a];
"function" == typeof b.onReset && b.onReset()
}), Object.keys(k.views.overlays).forEach(function(a) {
var b = k.views.overlays[a];
"function" == typeof b.onReset && b.onReset()
})
}, k.setupPlayBar = function() {
i(m), q = M("div", {
className: "now-playing " + U.NAVCONTAINER
}), r = M("dl", {
className: "metadata"
}), s = M("dt", {
className: "track"
}), t = M("dd", {
className: "artist"
}), u = M("button", {
className: "button-round-medium spoticon spoticon-play"
}), r.appendChild(s), r.appendChild(t), q.appendChild(u), q.appendChild(r), m.appendChild(q)
}, k.setPlayBarMetadata = function(a, b) {
(void 0 !== s || void 0 !== t) && (s.textContent = Q(a, {
chars: 50
}), t.textContent = b)
}, k.setPlayBarIsPlaying = function(a) {
u.classList.toggle("spoticon-pause", a), u.classList.toggle("spoticon-play", !a)
}, k.showAlert = function(a, b, c) {
c = c ? c : "warning", p && document.body.contains(p) && document.body.removeChild(p);
var d = [];
"string" == typeof a && d.push(M("div", {
className: "header",
textContent: a
})), "string" == typeof b && d.push(M("div", {
className: "text",
textContent: b
}));
var e = [M("div", {
className: "leftSide"
}, [M("div", {
className: "icon spoticon spoticon-" + c
})])];
d.length > 0 && e.push(M("div", {
className: "rightSide"
}, [M("div", {
className: "text"
}, d)])), p = M("div", {
className: "alertContainer invisible"
}, [M("div", {
className: "alert"
}, e)]), document.body.appendChild(p), setTimeout(function() {
p && p.classList.remove("invisible")
}, 50), setTimeout(function() {
p && p.classList.add("invisible")
}, 3e3), setTimeout(function() {
document.body.contains(p) && document.body.removeChild(p), p = void 0
}, 4e3)
}, k.showLoader = function() {
document.body.contains(W) || document.body.appendChild(W), k.enableKeyInput(!1)
}, k.hideLoader = function() {
document.body.contains(W) && document.body.removeChild(W), k.enableKeyInput(!0)
}, k.generateTopMenu = function() {
if (v = M("nav", {
className: "top-nav " + U.NAVCONTAINER
}), x = M("li", {
className: "logo"
}), y = M("li", {
className: "aux"
}), w = M("ul", {
className: "menu-list"
}), z = M("ul", {}), E = M("li", {
className: U.NAVPOINT + " button-oval-small",
i18n: "COMMON__UPSELL_LABEL"
}), i(l), w.appendChild(x), void 0 !== J.id) {
var a = M("li", {
className: U.NAVPOINT,
i18n: "COMMON__LIBRARY_TITLE"
}),
b = M("li", {
className: U.NAVPOINT,
i18n: "COMMON__BROWSE_TITLE"
}),
c = M("span", {
className: "profile-name"
}),
j = M("div", {
className: "profile-image"
});
F = M("li", {
className: U.NAVPOINT + " profile-link"
}, [c, j]), C = M("li", {
className: "search-bar spoticon spoticon-search"
}), D = M("input", {
type: "text",
className: "js-nav-pt"
}), C.appendChild(D), I.supports.search && z.appendChild(C), z.appendChild(F), y.appendChild(z),
function() {
new N(j, {
placeholderClass: V
}).load(J.displayImage), "premium" === J.product ? (c.textContent = J.displayName || "", z.contains(E) && z.removeChild(E)) : (c.textContent = Q(J.displayName, {
chars: 12
}) || "", z.contains(E) || z.insertBefore(E, F)), E.activate = k.upgradeActivation, E.onclick = k.upgradeActivation, k.interactionManager.update()
}(), I.supports.browse && w.appendChild(b), I.supports.library && w.appendChild(a), w.appendChild(y), a.activate = d, b.activate = e, F.activate = h, a.onclick = d, b.onclick = e, F.onclick = h, D.activate = f, D.onchange = f, D.onblur = function() {
C.classList.remove("search-typing"), C.classList.remove("search-focus")
}, D.onfocus = function() {
C.classList.add("search-focus")
}, D.onkeydown = function(a) {
a.keyCode === Spotify.KEY.MEDIA_PLAY_PAUSE && a.stopPropagation()
}
} else {
var m = M("li", {
className: U.NAVPOINT,
i18n: "GENERIC__LOGIN"
});
w.appendChild(m), m.activate = g, m.onclick = g
}
window.setTimeout(function() {
k.interactionManager.selectFirstItemInTop()
}, 250), v.appendChild(w), l.appendChild(v)
}, k.hideUpgradeButton = function() {
Spotify.session.allowLogout() || z.contains(E) && (z.removeChild(E), k.interactionManager.update())
}, k.setMenuVisibility = function(a) {
a === !0 ? l.classList.remove(U.HIDDEN) : a === !1 && l.classList.add(U.HIDDEN)
}, k.upgradeActivation = function() {
Spotify.session.onUpgrade()
}, k.setPlaybarVisibility = function(a) {
m.classList.toggle(U.HIDDEN, !a)
}, k.navigateToSearchInput = function() {
k.interactionManager.goToElement(D)
}, k.resetSearchInput = function() {
var a = "search-bar-keep-open";
C.classList.remove(a), C.classList.remove("search-typing"), D.value = "", D.blur()
}, k.setSearchInputText = function(a) {
var b = "search-bar-keep-open";
C.classList.add(b), C.classList.remove("search-typing"), D.value = a || "", D.blur()
}, k.indicateKeyDownOnElement = function(a) {
a.classList.add(S)
}, k.indicateKeyUpOnElement = function(a) {
a.classList.remove(S)
}, k.setBackgroundImage = function(a) {
720 >= G && (a += "@720"), document.body.style.backgroundImage = "url('" + L.getRevisionPath("images/" + a + ".jpg") + "')"
}, k.setBackgroundGradient = function(a) {
B && document.body.classList.remove(B), a && (B = a, document.body.classList.add(a))
}, k.showOverlay = function(a, b) {
if (!a) throw new Error("[ui] No overlay provided");
if (void 0 !== b && "function" != typeof b) throw new Error("[ui] Callback is not a function.");
k.currentOverlay !== a ? (void 0 !== k.currentOverlay && k._openOverlays.push(k.currentOverlay), void 0 !== k.currentOverlay && k.overlayModule.close(), k.currentOverlay = a, k.overlayModule.populate(a, function() {
k.overlayModule.open(b)
})) : k.overlayModule.open(b)
}, k.updateKeyBindings = function() {
k._activeKeyBindings = k.getActiveKeyBindings()
}, k.closeOverlay = function(a) {
if (k.overlayModule.close() && ("function" == typeof k.currentOverlay.onClose && k.currentOverlay.onClose(), "function" == typeof k.currentView.onOverlayClose && k.currentView.onOverlayClose(), k.interactionManager.returnFromOverlay()), k.currentOverlay = void 0, k.updateKeyBindings(), k._openOverlays.length) {
var b = k._openOverlays.pop();
k.showOverlay(b, a)
} else "function" == typeof a && a()
}, k.setBodyViewClass = function(a) {
A && document.body.classList.remove(A), A = a, document.body.classList.add(A)
}, k.displayNowPlayingOverlay = function() {
return Spotify.trackManager.isActiveDevice() ? k.currentOverlay === k.views.overlays.nowPlayingOverlay ? !1 : (k.showOverlay(k.views.overlays.nowPlayingOverlay), !0) : !1
}, k.changeView = function(a, b) {
if (k.currentView !== a && k.blockViewChange !== !0 && void 0 !== a) {
k._activeKeyBindings = {};
j(a);
k.currentView && (k.previousView = k.currentView, "function" == typeof k.currentView.onClose && k.currentView.onClose(), n.removeChild(k.currentView.dom)), b && a.updateFromStateParams && a.updateFromStateParams(b), "function" == typeof a.onDisplayed && a.onDisplayed(), k.interactionManager.resetStream(), n.appendChild(k.translation.translate(a.dom)), k.interactionManager.init(), k.currentView = a, k.interactionManager.focusFirstItemInStream(), k.updateKeyBindings(), "function" == typeof a.onViewReady && a.onViewReady()
}
}, k.getContentElement = function() {
return n
}, k.navigateTo = function(a, b) {
k.blockViewChange !== !0 && Spotify.router.go(a, b)
}, k.goBack = function() {
Spotify.router.goBack() || Spotify.router.goUp()
}, k.onKey = function(a) {
var b = a.keyCode,
c = Spotify.ui;
if (!k.input.keyHandler.isEnabled()) return void("function" == typeof a.preventDefault && (a.preventDefault(), a.stopPropagation()));
if (k.input.keyHandler.onKey(a, k._activeKeyBindings), c.nineLastKeys.push(b), c.nineLastKeys.length > 9 && c.nineLastKeys.shift(), 9 === c.nineLastKeys.length && c.secrets.forEach(function(a) {
a.combination.toString() === c.nineLastKeys.toString() && a.action()
}), "function" == typeof a.preventDefault) switch (b) {
case Spotify.KEY.UP:
case Spotify.KEY.DOWN:
case Spotify.KEY.LEFT:
case Spotify.KEY.RIGHT:
case Spotify.KEY.SELECT:
a.preventDefault()
}
}, k.onKeyUp = function(a) {
k.input.keyHandler.onKeyUp(a)
}, k.hideLoadingScreen = function() {
k.setLoadingScreenText(), k.input.keyHandler.enableKeys(!0), k.hideLoadingScreenLoader(), K.ignore(K.ESDK_EVENTS.EVENT_ON_RECONNECTED, X), setTimeout(function() {
k.splashScreen.classList.add("fadeOut")
}, 200), setTimeout(function() {
null !== k.splashScreen.parentElement && k.splashScreen.parentElement.removeChild(k.splashScreen)
}, 1e3)
}, k.showLoadingScreen = function(a) {
k.splashScreen.classList.remove("fadeOut"), a ? k.hideLoadingScreenLoader() : k.showLoadingScreenLoader(), document.body.insertBefore(k.splashScreen, document.body.firstChild), k.input.keyHandler.enableKeys(!1), K.on(K.ESDK_EVENTS.EVENT_ON_RECONNECTED, X, !0), setTimeout(function() {
var a = document.querySelector("input:focus");
a && a.blur()
})
}, k.showLoadingScreenLoader = function() {
document.documentElement.classList.add("is-loading")
}, k.hideLoadingScreenLoader = function() {
document.documentElement.classList.remove("is-loading")
}, k.showLoadingScreenText = function(a, b, c) {
k.showLoadingScreen(c), k.setLoadingScreenText(a, b)
}, k.setLoadingScreenText = function(a, b) {
k.splashScreen.children[0].children[0].textContent = a || "", k.splashScreen.children[0].children[2].textContent = b || ""
}, k.getActiveKeyBindings = function() {
var a = k.currentOverlay ? k.currentOverlay : k.currentView;
return R.extend({}, k.keySubscriptions, a.keySubscriptions || {})
}, k.setupAppKeyBindings = function() {
k.keySubscriptions[Spotify.KEY.MEDIA_PLAY_PAUSE] = Spotify.trackManager.controller.togglePlayback, k.keySubscriptions[Spotify.KEY.BACK] = k.goBack, k.keySubscriptions[Spotify.KEY.MEDIA_NEXT] = Spotify.trackManager.controller.nextTrack, k.keySubscriptions[Spotify.KEY.MEDIA_PREVIOUS] = Spotify.trackManager.controller.previousTrack, k.keySubscriptions[Spotify.KEY.MEDIA_FAST_FORWARD] = function() {
Spotify.trackManager.controller.fastForward()
}, k.keySubscriptions[Spotify.KEY.MEDIA_REWIND] = function() {
Spotify.trackManager.controller.rewind()
}, k.keySubscriptions[Spotify.KEY.MEDIA_PAUSE] = Spotify.trackManager.controller.pause, k.keySubscriptions[Spotify.KEY.MEDIA_PLAY] = Spotify.trackManager.controller.play
};
var X = function() {
Spotify.session.reInit()
}
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"../config.js": 8,
"../connection.js": 9,
"../currentUser.js": 10,
"../eventBus.js": 11,
"../utils/ImageBackground.js": 52,
"../utils/createElement.js": 59,
"../utils/device.js": 61,
"../utils/object.js": 68,
"../utils/path.js": 70,
"../utils/stringTruncator.js": 77,
"./animation": 32,
"./cursor": 33,
"./input": 36,
"./interactionManager.js": 38,
"./models": 47,
"./overlayModule.js": 48,
"./translation": 49,
generatedViews: "generatedViews"
}],
35: [function(a, b, c) {
"use strict";
function d(a, b) {
this._keyEvent = a, this._firstPressTime = Date.now(), this._nextKeyRepeatTreshold = 0, this._lastKeyPress = null, this._keySubscriptions = b || {}, this._keyRepeatLimit = d.getCurrentKeyRepeatLimit(), this.press()
}
b.exports = d;
var e, f = [
[3e3, 60],
[500, 420],
[-1, 480]
],
g = [],
h = function(a) {
return -1 !== g.indexOf(a)
},
i = !0;
d.getCurrentKeyRepeatLimit = function() {
return e || f[f.length - 1][1]
}, d.disableRepeatForKeys = function(a) {
g = a
}, d.configureKeyUpSupport = function(a) {
i = a
}, d.prototype.press = function(a) {
var b = this._keySubscriptions[this._keyEvent.keyCode];
e = void 0, this._keyEvent._keyRepeatLimit = d.getCurrentKeyRepeatLimit(), this._handleKeyDown(b, a), this._lastKeyPress = Date.now()
}, d.prototype.repeat = function() {
var a = Date.now(),
b = a - this._firstPressTime;
b > this._nextKeyRepeatTreshold && this._calculateInputTimeLimit(b), this._isKeyPressWithinInputTimeLimit(a) && this.press(!0)
}, d.prototype.keyUp = function() {
var a = this._keySubscriptions[this._keyEvent.keyCode];
"function" == typeof a && this._shouldBeHandledOnKeyUp() ? a(this._keyEvent) : "object" == typeof a && a.onKeyUp && a.onKeyUp(this._keyEvent)
}, d.prototype._handleKeyDown = function(a, b) {
if (a)
if ("function" == typeof a) {
if (this._shouldBeHandledOnKeyUp()) return;
a(this._keyEvent)
} else if ("object" == typeof a) {
if (b && !a.allowRepeat) return;
if (a.onKeyDown && a.onKeyDown(this._keyEvent), !i && a.onKeyUp && a.onKeyUp(this._keyEvent), !a.onKeyDown && !a.onKeyUp) throw new Error("[KeyPress] No valid keyhandler provided.")
}
}, d.prototype._shouldBeHandledOnKeyUp = function() {
return i && h(this._keyEvent.keyCode)
}, d.prototype._calculateInputTimeLimit = function(a) {
for (var b = 0; f.length > b; b++) {
var c = f[b],
d = f[b - 1];
if (a > c[0]) return this._keyRepeatLimit = c[1], e = this._keyRepeatLimit, void(this._nextKeyRepeatTreshold = d ? d[0] : 1 / 0)
}
}, d.prototype._isKeyPressWithinInputTimeLimit = function(a) {
return a - this._lastKeyPress > this._keyRepeatLimit
}
}, {}],
36: [function(a, b, c) {
b.exports = {
KeyPress: a("./KeyPress"),
keyHandler: a("./keyHandler")
}
}, {
"./KeyPress": 35,
"./keyHandler": 37
}],
37: [function(a, b, c) {
"use strict";
var d = a("./KeyPress.js"),
e = {};
b.exports = e;
var f, g, h = !0;
e.init = function(a) {
a = a || {}, f = {}, g = !0, h = !a.disableKeyUpSupport, d.disableRepeatForKeys(a.disableRepeatForKeys || []), d.configureKeyUpSupport(h)
}, e.enableKeys = function(a) {
g = a
}, e.isEnabled = function() {
return !!g
}, e.onKey = function(a, b) {
g && (f[a.keyCode] ? f[a.keyCode].repeat() : (f[a.keyCode] = new d(a, b), h || e.onKeyUp(a)))
}, e.onKeyUp = function(a) {
f[a.keyCode] && (g && f[a.keyCode].keyUp(a), delete f[a.keyCode])
}
}, {
"./KeyPress.js": 35
}],
38: [function(a, b, c) {
"use strict";
function d() {
var a = [],
b = function(b) {
var c, d = a.length,
e = 0,
f = b.length;
for (a.push([]); f > e; e++) c = b[e], a[d].push(c), c.dataset[w.GRIDPOSITION] = e + "," + d
},
c = function(b, c) {
var d = a.length;
b >= d && a.push([]), c.dataset[w.GRIDPOSITION] = a[b].length + "," + b, a[b].push(c)
},
d = function(b, c, d) {
var e = a.length;
c >= e && a.push([]), d.dataset[w.GRIDPOSITION] = b + "," + c, a[c][b] = d
},
e = function(b) {
if (b = !!b)
for (var c, d = 0, e = a.length - 1, f = a[e].length; f > d; d++) c = a[e][d], delete c.dataset[w.GRIDPOSITION], delete c.dataset[w.NAVCONTAINER_PARENT], delete c.dataset[w.NAVPOINT_INDEX], delete c.dataset[w.SUBCONTAINERX], delete c.dataset[w.SUBCONTAINER_PARENT_NAVPOINT];
a.pop()
};
return {
matrix: a,
registerRow: b,
addItem: c,
updateItem: d,
popMatrix: e
}
}
var e, f, g, h, i, j, k, l, m, n, o, p, q = a("./input/KeyPress.js"),
r = {
TOP: "js-top",
STREAM: "js-main",
BOTTOM: "js-bottom",
OVERLAY: "js-overlay",
NAVCONTAINER: ".js-nav-ct",
NAVPOINT: ".js-nav-pt",
STREAMUNIT: ".js-group",
FOCUSCLASS: "focus",
SUBFOCUSCLASS: "sub-focus",
CONTEXT_BUTTON: ".js-nav-btn",
SELECTEDCLASS: "selected",
HORIZONTAL_ROW: "js-pt-row",
HIDDEN: "hidden"
},
s = {
UP: 0,
RIGHT: 1,
DOWN: 2,
LEFT: 3
},
t = -2,
u = {
MOVE_COMPLETED: 0
},
v = {
GRID: "grid",
SIMPLE_GRID: "grid-simple",
SONGS: "songs",
VERTICAL: "vertical"
},
w = {
GRIDPOSITION: "gridposition",
NAVCONTAINER: "navcontainer",
NAVCONTAINER_PARENT: "navcontainerparent",
NAVPOINT_INDEX: "navpointindex",
STREAM_INDEX: "streamindex",
NAVCONTAINER_ID: "navcontainerid",
ITEM_TYPE: "itemType",
CLUSTER_TYPE: "clusterType",
SUBCONTAINERX: "subcontainer",
SUBCONTAINER_PARENT_NAVPOINT: "subparent"
},
x = {},
y = function() {
var a = document.body.getBoundingClientRect().width;
f = a > 1440 ? 20 : 20 * .672, g = a > 1440 ? 64 : 43.008, l = void 0, Spotify.ui.cursor.init(), A()
},
z = function() {
if (h && void 0 !== h.dataset[w.NAVPOINT_INDEX] && document.body.contains(h) && (!U(h) || Spotify.ui.overlayModule.isOpen())) return h.dataset[w.NAVPOINT_INDEX];
if (S()) {
var a = _();
if (void 0 === a && (a = aa()), void 0 !== a) return a
}
return 0
},
A = function(a, b) {
var c, d, f = !1;
h instanceof HTMLInputElement && h.blur(), (Spotify.ui.overlayModule.isOpen() !== !0 || b === !0) && (D() && (B(), f = !0), c = void 0 !== a && a > -1 ? a : z(), (f || !h || h.dataset[w.NAVPOINT_INDEX] !== c) && (d = T(e.NAVPOINTS[c]), E(c, d, !0)))
},
B = function() {
var a, b, c, d, f = document.querySelectorAll(r.NAVCONTAINER),
g = 0,
h = f.length,
i = 0;
for (e = {
CONTAINERS: [],
NAVPOINTS: []
}; h > g; g++) {
b = f[g], e.CONTAINERS.push(b), b.dataset[w.NAVCONTAINER] = g, b.dataset[w.NAVCONTAINER_ID] || (b.dataset[w.NAVCONTAINER_ID] = "container" + g), a = b.querySelectorAll(r.NAVPOINT), c = b.dataset[w.CLUSTER_TYPE] === v.SONGS;
for (var j = a.length, k = 0; j > k; k++) d = a[k], d.classList.contains(r.HIDDEN) || (e.NAVPOINTS.push(d), d.dataset[w.NAVCONTAINER_PARENT] = g, d.dataset[w.NAVPOINT_INDEX] = i, c && (d.dataset[w.ITEM_TYPE] = v.SONGS), i++)
}
o = H()
},
C = function() {
var a = Spotify.utils.format("{0} {1}:not({2})", [r.NAVCONTAINER, r.NAVPOINT, r.HIDDEN]),
b = document.querySelectorAll(a);
return Array.prototype.slice.call(b)
},
D = function() {
var a, b = C(),
c = b.length;
if (!e || !e.NAVPOINTS || !b || e.NAVPOINTS.length !== b.length) return !0;
for (a = 0; c > a; a++)
if (e.NAVPOINTS[a] !== b[a]) return !0;
return !1
},
E = function(a, b, c) {
var f, g, l = !!c,
m = Spotify.ui.currentView === Spotify.ui.views.landingView;
if (!(a > e.NAVPOINTS.length - 1 || 0 > a || void 0 === a)) {
if (i = h, e.NAVPOINTS[a]) {
var o = e.NAVPOINTS[a],
p = e.CONTAINERS[o.dataset[w.NAVCONTAINER_PARENT]];
if (o.classList.contains(r.HIDDEN) || p.classList.contains(r.HIDDEN)) return;
h = o
}
if (l || j !== h.dataset[w.NAVCONTAINER_PARENT]) {
k = new d, j = h.dataset[w.NAVCONTAINER_PARENT];
var q = e.CONTAINERS[j],
s = Array.prototype.slice.call(q.querySelectorAll(r.NAVPOINT)),
t = q.getBoundingClientRect().width,
u = s[0].getBoundingClientRect().width,
x = Math.floor(t / u),
y = Math.ceil(s.length / x),
z = 0;
if (q.dataset[w.CLUSTER_TYPE] === v.GRID || q.dataset[w.CLUSTER_TYPE] === v.SIMPLE_GRID)
for (f = 0, g = s.length; g > f; f++) k.addItem(f % 2, s[f]);
else if (q.dataset[w.CLUSTER_TYPE] === v.VERTICAL) {
var A = 0;
for (f = 0, g = s.length; g > f; f++) s[f].classList.contains(r.HORIZONTAL_ROW) ? (A = -1 === A ? f : A, k.addItem(A, s[f])) : (A = -1, k.addItem(f, s[f]))
} else
for (f = 0, g = y; g > f; f++) k.registerRow(s.slice(z, z + x || s.length)), z += x
}
if (h.dataset[w.ITEM_TYPE] === v.SONGS) {
void 0 === h.dataset[w.SUBCONTAINERX] && (n = h), k.matrix.length > 1 && k.popMatrix();
var B = Array.prototype.slice.call(h.querySelectorAll(r.CONTEXT_BUTTON)),
C = parseInt(h.dataset[w.GRIDPOSITION].split(",")[0]);
for (f = 0, g = B.length; g > f; f++) B[f].dataset[w.NAVCONTAINER_PARENT] = h.dataset[w.NAVCONTAINER_PARENT], B[f].dataset[w.NAVPOINT_INDEX] = e.NAVPOINTS.length, B[f].dataset[w.SUBCONTAINERX] = C, B[f].dataset[w.SUBCONTAINER_PARENT_NAVPOINT] = h.dataset[w.NAVPOINT_INDEX], e.NAVPOINTS.push(B[f]);
k.registerRow(B)
}
J(), F(), m || b !== !0 || O(h)
}
},
F = function() {
h && T() ? Spotify.ui.cursor.setCursor(h) : Spotify.ui.cursor.hide()
},
G = function(a) {
var b, c = document.getElementById(r.STREAM).querySelectorAll(r.NAVCONTAINER),
d = 0,
h = 0;
if (0 === c.length) return 0;
var i = a.dataset[w.NAVCONTAINER_PARENT],
j = e.CONTAINERS[i];
for (b = j && T(j) ? j : c[0]; c.length > d && (0 !== d && (h += c[d - 1].getBoundingClientRect().width + g), c[d].dataset[w.NAVCONTAINER] !== b.dataset[w.NAVCONTAINER]);) d++;
var k = parseInt(a.dataset[w.GRIDPOSITION].split(",")[0]),
l = b.querySelectorAll(r.NAVPOINT)[0].getBoundingClientRect().width;
return (l + f) * k + h
},
H = function() {
var a = document.getElementById(r.STREAM);
return a ? a.querySelectorAll(r.NAVPOINT).length : 0
},
I = function() {
L(h, r.FOCUSCLASS) && h.classList.remove(r.SUBFOCUSCLASS), n && (h = n), k.popMatrix(!0)
},
J = function() {
L(h, r.FOCUSCLASS) ? (i && i !== h && i.classList.remove(r.SUBFOCUSCLASS), h.classList.add(r.SUBFOCUSCLASS)) : (i && i !== h && (i.classList.remove(r.FOCUSCLASS), i.classList.remove(r.SUBFOCUSCLASS)), h.classList.add(r.FOCUSCLASS)), h instanceof HTMLInputElement && h.focus(), i instanceof HTMLInputElement && i.blur(), T() && x[u.MOVE_COMPLETED] && "function" == typeof x[u.MOVE_COMPLETED] && x[u.MOVE_COMPLETED](h)
},
K = function(a, b) {
return a ? void 0 === b ? !1 : a.parentElement ? a.parentElement.id === b ? !0 : K(a.parentElement, b) : !1 : !1
},
L = function(a, b) {
return a && a.parentElement ? a.parentElement.classList.contains(b) ? !0 : L(a.parentElement, b) : !1
},
M = function() {
var a = document.getElementById(r.STREAM),
b = a.querySelectorAll(r.NAVPOINT);
return b.length ? void 0 !== l && l.dataset[w.NAVPOINT_INDEX] ? l.dataset[w.NAVPOINT_INDEX] : b[0].dataset[w.NAVPOINT_INDEX] : void 0
},
N = function() {
var a = document.getElementById(r.OVERLAY);
if (a) {
var b = a.querySelectorAll(r.NAVPOINT)[0];
b && E(b.dataset[w.NAVPOINT_INDEX], !1, !1)
}
},
O = function(a) {
var b = document.getElementById(r.STREAM);
Spotify.ui.animation.animationModule.addTween(b, {
x: -G(a)
}, {
easing: Spotify.ui.animation.Tween.EASINGS.EASE,
duration: q.getCurrentKeyRepeatLimit()
})
},
P = function(a) {
var b = parseInt(h.dataset[w.GRIDPOSITION].split(",")[0]),
c = parseInt(h.dataset[w.GRIDPOSITION].split(",")[1]),
d = h.dataset[w.SUBCONTAINERX],
e = h.dataset[w.ITEM_TYPE] === v.SONGS,
f = null;
switch (a) {
case s.UP:
void 0 !== d && (b = parseInt(d)), 0 !== c && (f = [b, c - 1]);
break;
case s.DOWN:
e ? b = 0 : !e && void 0 !== d && Spotify.trackManager.isActiveDevice() && I(), k.matrix.length - 1 > c && (f = [b, c + 1]);
break;
case s.LEFT:
0 !== b && (f = [b - 1, c]);
break;
case s.RIGHT:
if (k.matrix[c].length - 1 > b && (f = [b + 1, c]), T() && o < H() && void 0 === d) {
var g = f || [b, c];
void 0 === k.matrix[g[1]][g[0] + 1] && A(k.matrix[g[1]][g[0]].dataset[w.NAVPOINT_INDEX])
}
}
if (f) {
var i = k.matrix[f[1]][f[0]];
if (a !== s.UP || i || (i = Q(f)), i) {
var j = T() && (a === s.LEFT || a === s.RIGHT) && !L(h, r.FOCUSCLASS);
E(i.dataset[w.NAVPOINT_INDEX], j, !1)
}
} else(e || void 0 === d || a !== s.LEFT && a !== s.RIGHT) && R(a)
},
Q = function(a) {
for (var b, c = a[0]; c > -1; c--) b = k.matrix[a[1]][c], void 0 !== b && (c = -1);
return b
},
R = function(a) {
var b, c, d, f, g = !1,
i = a === s.LEFT ? -1 : 1;
switch (a) {
case s.UP:
if (T()) {
var j = aa();
b = j || 0
}
K(h, r.BOTTOM) && (b = M());
break;
case s.DOWN:
T() && (b = t), S() && (c = document.getElementById(r.STREAM), c && (b = M(), g = !0), void 0 === b && (b = t));
break;
case s.LEFT:
case s.RIGHT:
T() && (d = parseInt(h.dataset[w.NAVCONTAINER_PARENT]) + i, c = e.CONTAINERS[d], d > -1 && c && K(c, r.STREAM) && (i > 0 ? b = c.querySelectorAll(r.NAVPOINT)[0].dataset[w.NAVPOINT_INDEX] : (f = c.querySelectorAll(r.NAVPOINT), b = f[f.length - 1].dataset[w.NAVPOINT_INDEX]), g = !0))
}
void 0 !== b && b > -1 ? (T() && (l = void 0 === h.dataset[w.NAVPOINT_INDEX] ? n : h), E(b, g, !1)) : b === t && Spotify.ui.displayNowPlayingOverlay()
},
S = function(a) {
return !!K(a || h, r.TOP)
},
T = function(a) {
return !!K(a || h, r.STREAM)
},
U = function(a) {
return !!K(a || h, r.OVERLAY)
},
V = function() {
if (Spotify.ui.overlayModule.isOpen() !== !0) {
var a = document.getElementById(r.STREAM),
b = a.querySelectorAll(r.NAVPOINT);
return b.length ? (E(b[0].dataset[w.NAVPOINT_INDEX], !0, !1), b[0]) : null
}
},
W = function(a) {
var b = "number" == typeof a ? parseInt(a) : 0,
c = document.getElementById(r.TOP),
d = c.querySelectorAll(r.NAVPOINT);
return Array.prototype.forEach.call(d, function(a) {
a.classList.remove(r.SELECTEDCLASS)
}), d.length && d.length > b ? (d[b].classList.add(r.SELECTEDCLASS), d[b]) : null
},
X = function() {
S() && (Array.prototype.forEach.call(document.getElementById(r.TOP).querySelectorAll(r.NAVPOINT), function(a) {
a.classList.remove(r.SELECTEDCLASS)
}), h.classList.add(r.SELECTEDCLASS))
},
Y = function() {
var a = document.getElementById(r.STREAM);
Spotify.ui.animation.animationModule.resetElement(a)
},
Z = function() {
h && h.dataset && (m = void 0 !== h.dataset[w.SUBCONTAINER_PARENT_NAVPOINT] ? h.dataset[w.SUBCONTAINER_PARENT_NAVPOINT] : h.dataset[w.NAVPOINT_INDEX])
},
$ = function() {
var a, b, c = document.getElementById(r.STREAM),
d = c.querySelectorAll(r.NAVPOINT),
e = 0;
for (a = 0, b = d.length; b > a; a++)
if (d[a].dataset[w.NAVPOINT_INDEX] === m) {
e = m;
break
}
if (0 === e) {
var f = _();
void 0 === f && (f = aa()), void 0 !== f && (e = f)
}
return e
},
_ = function() {
var a = document.getElementById(r.TOP).querySelector("." + r.FOCUSCLASS);
return a ? parseInt(a.dataset[w.NAVPOINT_INDEX]) : void 0
},
aa = function() {
var a = document.getElementById(r.TOP).querySelector("." + r.SELECTEDCLASS);
return a ? parseInt(a.dataset[w.NAVPOINT_INDEX]) : void 0
},
ba = {
init: y,
moveUp: function() {
return p = h.dataset[w.NAVPOINT_INDEX], P(s.UP), p
},
moveRight: function() {
return p = h.dataset[w.NAVPOINT_INDEX], P(s.RIGHT), p
},
moveDown: function() {
return p = h.dataset[w.NAVPOINT_INDEX], P(s.DOWN), p
},
moveLeft: function() {
return p = h.dataset[w.NAVPOINT_INDEX], P(s.LEFT), p
},
jumpRight: function() {
return p = h.dataset[w.NAVPOINT_INDEX], R(s.RIGHT), p
},
jumpLeft: function() {
return p = h.dataset[w.NAVPOINT_INDEX], R(s.LEFT), p
},
jumpIntoOverlay: function() {
return Z(), h = void 0, F(), N(), m
},
returnFromOverlay: function() {
var a = $(),
b = e.NAVPOINTS[a];
return E(a, T(b), !1), a
},
onMoveCompleted: function(a) {
x[u.MOVE_COMPLETED] = a
},
update: A,
getCurrentNavpoint: function() {
return h
},
getNavPointCount: function() {
return e.NAVPOINTS.length - 1
},
getCurrentParent: function() {
return n
},
inTopGrid: S,
inStream: T,
inOverlay: U,
focusFirstItemInStream: V,
selectTopNavpoint: X,
selectFirstItemInTop: W,
inSubNode: function() {
return !(!h.dataset[w.SUBCONTAINERX] && 0 !== parseInt(h.dataset[w.SUBCONTAINERX]))
},
resetStream: Y,
goToElement: function(a, b) {
if ("string" != typeof a.dataset.navpointindex) throw new Error("[interactionModule.goToElement] This element is not a navpoint");
a !== h && (h && (p = h.dataset[w.NAVPOINT_INDEX]), void 0 === b && (b = T(a)), E(a.dataset[w.NAVPOINT_INDEX], b, !1))
}
};
ba.getGrid = function() {
return e
}, ba.getCurrentGrid = function() {
return k
}, ba.goToNavpoint = function(a) {
E(a, !1, !1)
}, b.exports = ba
}, {
"./input/KeyPress.js": 35
}],
39: [function(a, b, c) {
function d(a, b) {
var c = document.createElement("div"),
d = a.contextUri,
f = a.contextIndex,
g = a.sourceStart,
h = function(a) {
var b = e.getContextUri();
b === d ? e.controller.togglePlayback() : e.controller.playFromContext(d, f, g)
},
i = function() {
if (c) {
var a = e.getContextUri();
if (a === d) {
var b = e.isPlaying(),
f = !b && c.classList.contains("spoticon-pause");
c.classList.toggle("spoticon-play", f), c.classList.toggle("spoticon-pause", !f)
}
}
},
j = function() {
e.on(e.EVENTS.CHANGE_PLAYBACK_STATE, i), e.on(e.EVENTS.CHANGE_TRACK, i)
},
k = function() {
e.ignore(e.EVENTS.CHANGE_PLAYBACK_STATE, i), e.ignore(e.EVENTS.CHANGE_TRACK, i)
};
return c.classList.add("spoticon"), c.classList.add("spoticon-play"), b.appendChild(c), b.classList.add("entity-playable"), b.classList.add("js-nav-pt"), b.activate = h, b.onclick = h, b.dataset.contextUri = d, b.dataset.contextIndex = f, b.dataset.sourceStart = g, j(), i(), {
unbindEvents: k
}
}
b.exports = d;
var e = a("../../trackManager")
}, {
"../../trackManager": 29
}],
40: [function(a, b, c) {
function d(a) {
this._tm = a, this._snapshot = [], this._playIndicator = f("div", {
className: "spoticon spoticon-play"
}), this._images = [];
var b, c;
for (b = 0; j > b; b += 1) c = f("li", {
className: "npv-queue-img"
}), this._images.push(new h(c, {
placeholderClass: i
}));
this.updatePlayButton(this._tm.isPlaying());
var d = this.getCurrentTrackElement();
d.appendChild(this._playIndicator), d.classList.add("in-focus");
var e = this._images.map(function(a) {
return a.getElement()
});
this._dom = f("ul", {}, e)
}
b.exports = d;
var e = a("../../utils/arrayRotation.js"),
f = a("../../utils/createElement.js"),
g = a("../../utils/ImageLoader.js"),
h = a("../../utils/ImageBackground.js"),
i = "placeholder-song-large",
j = 5,
k = 1,
l = Math.floor(j / 2);
d.prototype.getElement = function() {
return this._dom
}, d.prototype._getRotationOffset = function(a) {
var b = e(this._snapshot, a, function(a, b) {
return (a || {}).id === (b || {}).id
});
return b
}, d.prototype.updateCovers = function(a) {
var b = this;
if (JSON.stringify(this._snapshot) !== JSON.stringify(a)) {
this._hasCurrentTrack = !!a[2];
this._getRotationOffset(a);
this._images.forEach(function(c, d) {
var e, f = a[d];
if (f) {
f.album.images.length ? e = f.album.images[0].url : c.setBackground("");
var g = Math.abs(2 - d);
c.load(e, g), c.getElement().classList.toggle("is-unavailable-song", !b._tm.isTrackAvailable(f))
} else c.setBackground("")
}), g.getInstance().processQueue(), this._snapshot = a
}
}, d.prototype.setUpcomingSongs = function(a) {
a.slice(0, k).forEach(function(a) {
a.album.images.length && g.getInstance().load(a.album.images[0].url, function() {}, 3)
})
}, d.prototype.hasCurrentTrack = function() {
return !!this._hasCurrentTrack
}, d.prototype.getCurrentTrackElement = function() {
return this._images[l].getElement()
}, d.prototype.updatePlayButton = function(a) {
this._playIndicator && (a && this._playIndicator.classList.contains("spoticon-play") ? (this._playIndicator.classList.remove("spoticon-play"), this._playIndicator.classList.add("spoticon-pause")) : !a && this._playIndicator.classList.contains("spoticon-pause") && (this._playIndicator.classList.remove("spoticon-pause"), this._playIndicator.classList.add("spoticon-play")))
}, d.prototype.reset = function() {
this._snapshot = [], this._images.forEach(function(a) {
a.setBackground("")
})
}
}, {
"../../utils/ImageBackground.js": 52,
"../../utils/ImageLoader.js": 53,
"../../utils/arrayRotation.js": 56,
"../../utils/createElement.js": 59
}],
41: [function(a, b, c) {
function d(a) {
var b, c, d = e.createElement,
i = d("dd", {
className: "entity-actions"
}),
j = e.truncate(a.name, {
chars: 19,
lines: 2
}),
k = e.truncate(a.artists[0].name, {
chars: 22
}),
l = d("dt", {
className: "entity-title",
textContent: j
}, [i]),
m = d("dd", {
className: "entity-secondary",
i18n: "COMMON__ALBUM_BY",
i18nArgs: [k]
}),
n = d("dl", {}, [l, m, i]),
o = d("div", {
className: "entity-metadata"
}, [n]),
p = d("div", {
className: "entity-image"
}),
q = d("div", {
className: "entity"
}, [p, o]),
r = d("article", {
className: "group js-nav-ct js-group"
}, [q]),
s = a.images;
return s.length > 0 && (c = s[s.length > 1 ? 1 : 0].url), c && new f(p, {
placeholderClass: h
}).load(c), b = g({
contextUri: "spotify:album:" + a.id,
contextIndex: 0,
sourceStart: "album"
}, p), {
container: r,
onClose: function() {
void 0 !== b && b.unbindEvents()
}
}
}
b.exports = d;
var e = a("../../utils"),
f = a("../../utils/ImageBackground.js"),
g = a("./addPlayableMixin.js"),
h = "placeholder-song"
}, {
"../../utils": 66,
"../../utils/ImageBackground.js": 52,
"./addPlayableMixin.js": 39
}],
42: [function(a, b, c) {
"use strict";
function d(a, b, c) {
function d(a) {
var b, c = r % 2 === 0,
d = k(a);
c === !0 ? (b = i("ul", {
className: "column"
}, [d]), n.appendChild(b), u.push(b)) : (b = u[u.length - 1], b.appendChild(d))
}
function j(a) {
a.forEach(function(a) {
q.addElement(a)
})
}
function k(a) {
var d = document.createElement("li"),
e = document.createElement("div"),
j = document.createElement("div"),
k = document.createElement("dl"),
l = document.createElement("dt"),
m = document.createElement("dd");
if ("string" == typeof a.subtitle ? m.textContent = f.truncate(a.subtitle, {
chars: 19,
lines: 2
}) : "object" == typeof a.subtitle && h.translation.bindTextContent(m, a.subtitle.translationKey, [a.subtitle.nbrOfSongs]),
l.textContent = f.truncate(a.title || a.name, {
chars: 13,
lines: 2
}), e.classList.add("image"), j.classList.add("metadata"), l.classList.add("title"), m.classList.add("subtitle"), d.classList.add("js-nav-pt"), k.appendChild(l), k.appendChild(m), j.appendChild(k), d.appendChild(e), b !== h.models.CONTENT_CLUSTER_TYPES.GENRES_MOODS) d.appendChild(j);
else {
var n = i("h3", {
className: "title",
textContent: f.truncate(a.title, {
chars: 13
})
});
d.appendChild(n)
}
d.data = a, new g(e, {
placeholder: c.placeholder,
placeholderClass: c.placeholderClass
}).load(a.img), d.data.img = a.img, d.activate = s.bind(null, d), d.onclick = s.bind(null, d), r += 1;
var o = h.getContentElement(),
p = q.clientWidth;
return 2 * p > o.clientWidth && (o.style.width = 2 * p + "px"), d
}
function l(a) {
for (var b, d, e = [], f = c.maxElements, g = Math.ceil(a.length / 2), h = Math.ceil(f / 2), i = g > h ? h : g, j = 0, l = 0, o = !1, p = n.getElementsByClassName("column"); p.length > j; j += 1) n.removeChild(p[j]);
for (r = 0, u = [], j = 0, void 0 !== f && a.length > f ? (b = a.slice(0, f - 1), o = !0) : b = a, b.forEach(function(a) {
e.push(k(a))
}), o === !0 && e.push(m()); i > j; j += 1) d = document.createElement("ul"), d.classList.add("column"), u.push(d);
j = 0, e.forEach(function(a) {
d = u[l], d.appendChild(a), j += 1, 2 === j && (j = 0, l += 1)
}), u.forEach(function(a) {
n.appendChild(a)
})
}
function m() {
var a = document.createElement("li"),
b = document.createElement("button");
return a.classList.add("more"), a.classList.add("js-nav-pt"), a.classList.add(h.cursor.NO_CURSOR_CLASS), b.classList.add("button-round-large"), h.translation.bindTextContent(b, "COMMON__MORE"), a.appendChild(b), a.activate = t, a.onclick = t, a
}
c = c || {};
var n = i("article", {
className: "cluster " + e(b)
}),
o = i("h1"),
p = i("header", {
className: "group-header"
}, [o]),
q = i("div", {
className: "group js-nav-ct js-group"
}, [p, n]),
r = 0,
s = c.onElementActivation || function() {},
t = c.onMoreActivation || function() {},
u = [];
return null !== a ? h.translation.bindTextContent(o, a) : q.setTitleText = function(a) {
o.textContent = f.truncate(a, {
chars: 50
})
}, q.dataset.clusterType = e(b), q.addElement = d, q.addElements = j, q.setElements = l, Array.isArray(c.dataForElements) && q.setElements(c.dataForElements), q
}
function e(a) {
switch (a) {
case h.models.CONTENT_CLUSTER_TYPES.PLAYLISTS:
a = "grid";
break;
case h.models.CONTENT_CLUSTER_TYPES.CATEGORIES:
a = "grid";
break;
case h.models.CONTENT_CLUSTER_TYPES.ALBUMS:
a = "grid";
break;
case h.models.CONTENT_CLUSTER_TYPES.FEATURED:
a = "grid";
break;
case h.models.CONTENT_CLUSTER_TYPES.GENRES_MOODS:
a = "grid-simple"
}
return a
}
b.exports = d;
var f = a("../../utils"),
g = a("../../utils/ImageBackground.js"),
h = a(".."),
i = f.createElement
}, {
"..": 34,
"../../utils": 66,
"../../utils/ImageBackground.js": 52
}],
43: [function(a, b, c) {
function d(a, b, c) {
if (!Array.isArray(b)) throw new Error("[ui.createEmptyStateModel] Arguments to this function needs to be arrays");
var d = e("article", {
className: "empty-state"
}),
f = e("h2", {
className: "empty-state-header",
i18n: b[0],
i18nArgs: b.slice(1, b.length) || void 0
}),
g = e("div", {
className: "empty-state-icon spoticon spoticon-" + a
});
return d.appendChild(g), d.appendChild(f), Array.isArray(c) && c.forEach(function(a) {
var b = e("p", {
className: "empty-state-text",
i18n: a
});
d.appendChild(b)
}), d
}
b.exports = d;
var e = a("../../utils/createElement.js")
}, {
"../../utils/createElement.js": 59
}],
44: [function(a, b, c) {
function d(a) {
var b, c, d = f.createElement,
k = d("div", {
className: "entity-image"
}),
l = f.truncate(a.name, {
chars: 19,
lines: 2
}),
m = d("dt", {
className: "entity-title",
textContent: l
}),
n = d("dd", {
className: "entity-secondary",
textContent: "-"
}),
o = d("dd", {
className: "entity-description",
textContent: ""
}),
p = d("button", {
className: "js-nav-pt button-oval-medium"
}),
q = d("dd", {
className: "entity-actions"
}),
r = d("dl", {}, [m, n, o, q]),
s = d("div", {
className: "entity-metadata"
}, [r]),
t = d("div", {
className: "entity"
}, [k, s]),
u = d("article", {
className: "group js-nav-ct js-group"
}, [t]),
v = 0,
w = !1,
x = function() {
w !== !0 && (w = !0, e.translation.bindTextContent(p, "COMMON__UNFOLLOW"), h.followPlaylist(a.href, function(a, b) {
w = !1, a ? e.translation.bindTextContent(p, "COMMON__FOLLOW") : (v += 1, B(), p.activate = y, p.onclick = y, e.showAlert(null, e.translation.getText("COMMON__PLAYLIST_SAVED"), "check"))
}))
},
y = function() {
w !== !0 && (w = !0, e.translation.bindTextContent(p, "COMMON__FOLLOW"), h.unFollowPlaylist(a.href, function(a, b) {
w = !1, a ? e.translation.bindTextContent(p, "COMMON__UNFOLLOW") : (v -= 1, B(), p.activate = x, p.onclick = x, e.showAlert(null, e.translation.getText("COMMON__PLAYLIST_UNSAVED"), "cross"))
}))
},
z = function(a) {
var b = document.createElement("span");
return b.innerHTML = a, b.textContent
},
A = function(a, b) {
var c, d;
a || (b[0] === !1 ? (d = "COMMON__FOLLOW", c = x) : b[0] === !0 && (d = "COMMON__UNFOLLOW", c = y), e.translation.bindTextContent(p, d), p.activate = c, p.onclick = c, q.appendChild(p), e.interactionManager.update())
},
B = function() {
e.translation.bindTextContent(n, "COMMON__PLAYLIST_FOLLOWERS", [f.delimitNumber(v)])
},
C = a.images;
return C.length > 0 && (c = C[C.length > 1 ? 1 : 0].url), new g(k, {
placeholderClass: j
}).load(c), a.owner.id === i.id || h.playlistContains(a.href, A), h.getFullPlaylistData(a.href, function(a, b) {
if (!a && (v = b.followers.total, B(), b.description)) {
var c = f.truncate(b.description, {
chars: 45,
lines: 3
});
o.textContent = z(c)
}
}), b = e.models.addPlayableMixin({
contextUri: h.playlistHrefToUri(a.href),
contextIndex: 0,
sourceStart: "others_playlist"
}, k), {
container: u,
onClose: function() {
void 0 !== b && b.unbindEvents()
}
}
}
b.exports = d;
var e = a(".."),
f = a("../../utils"),
g = a("../../utils/ImageBackground.js"),
h = a("../../interfaces/web"),
i = a("../../currentUser.js"),
j = "placeholder-playlist"
}, {
"..": 34,
"../../currentUser.js": 10,
"../../interfaces/web": 13,
"../../utils": 66,
"../../utils/ImageBackground.js": 52
}],
45: [function(a, b, c) {
function d() {
var a = document.createElement("div"),
b = document.createElement("div"),
c = 0,
d = 10,
e = function(b) {
0 > b.wheelDelta ? a.scrollUp(a.scrollStep) : a.scrollDown(a.scrollStep)
};
return a.addToScroll = function(a) {
b.appendChild(a)
}, a.scrollUp = function(d) {
var e = b.offsetHeight,
f = a.offsetHeight;
this.canScrollUp() === !0 && (c -= d, f > e + c && (c = -(e - f)), b.style.top = c + "px")
}, a.scrollDown = function(a) {
this.canScrollDown() === !0 && (c += a, c = c > 0 ? 0 : c, b.style.top = c + "px")
}, a.scrollToTop = function() {
c = 0, b.style.top = c + "px"
}, a.scrollToBottom = function() {
var d = b.offsetHeight,
e = a.offsetHeight;
c = -(d - e), b.style.top = c + "px"
}, a.canScrollUp = function() {
var d = b.offsetHeight,
e = a.offsetHeight;
return d + c > e && d > e ? !0 : !1
}, a.canScrollDown = function() {
return c >= 0 ? !1 : !0
}, a.scrollStep = d, a.addEventListener("mousewheel", e, !1), a.addEventListener("DOMMouseScroll", e, !1), a.className = "scrollBox", b.className = "innerContainer", a.appendChild(b), a
}
b.exports = d
}, {}],
46: [function(a, b, c) {
function d(a, b, c) {
c = c || {};
var d, l, m, n = document.createElement("article"),
o = document.createElement("header"),
p = document.createElement("h1"),
q = document.createElement("div"),
r = !1,
s = 0,
t = [],
u = [],
v = !1,
w = c.limit,
x = c.more,
y = c.subtitle,
z = function() {
var a = this.dataset.contextUri,
b = parseInt(this.dataset.contextIndex, 0),
c = this.dataset.sourceStart,
d = "false" !== this.dataset.isAvailable;
d ? e.controller.playFromContext(a, b, c) : f.showAlert(i.currentLang.COMMON__UNAVAILABLE)
},
A = function() {
var a = f.interactionManager.getCurrentParent(),
b = a.dataset.trackId,
c = this;
h.followTrack(b, function(a, b) {
a || (f.showAlert(null, f.translation.getText("COMMON__SONG_SAVED"), "check"), c.classList.remove("spoticon-plus"), c.classList.add("spoticon-check"), c.activate = B)
})
},
B = function() {
var a, b = f.interactionManager.getCurrentParent(),
c = b.dataset.trackId,
d = b.dataset.navpointindex,
e = !1,
g = this;
h.unFollowTrack(c, function(c, h) {
if (!c && (f.showAlert(null, f.translation.getText("COMMON__SONG_UNSAVED"), "cross"), g.classList.remove("spoticon-check"), g.classList.add("spoticon-plus"), g.activate = A, f.currentView === f.views.yourMusicView || f.currentView === f.views.savedSongsView))
if (g.remove(), s -= 1, f.currentView === f.views.yourMusicView) {
if (0 === s) return a = void 0, f.views.yourMusicView.setInteractionUpdateIndex(a), f.interactionManager.focusFirstItemInStream(), void f.views.yourMusicView.onDisplayed();
n.isLastItem(b) ? (a = v === !0 ? d : d - 1, e = !0) : a = d, f.views.yourMusicView.setInteractionUpdateIndex(a), f.views.yourMusicView.onDisplayed(), e === !0 && f.interactionManager.update(a)
} else f.currentView === f.views.savedSongsView && (s -= 1, n.isLastItem(b) ? (a = d - 1, e = !0) : a = d, f.interactionManager.update(a), e === !0 && (0 === s ? (m = void 0, f.views.yourMusicView.onDisplayed(), Spotify.router.goBack()) : m = f.interactionManager.getCurrentNavpoint()))
})
},
C = function(a) {
a && a.dataset.uri && e.controller.addTrackUriToQueue(a.dataset.uri, function() {
f.showAlert(f.translation.getText("COMMON__TRACK_QUEUED"), null, "check")
})
},
D = function(a) {
var b = document.createElement("ul"),
c = document.createElement("li"),
d = document.createElement("div"),
e = document.createElement("div"),
h = document.createElement("dl"),
i = document.createElement("dt"),
l = document.createElement("dd");
return i.textContent = j(a.title, {
chars: 22,
lines: 2
}), l.textContent = j(a.artist, {
chars: 25,
lines: 2
}), d.classList.add(f.cursor.CURSOR_TEMPLATE_CLASS), new g(d, {
placeholderClass: k
}).load(a.img), b.classList.add("column"), d.classList.add("image"), e.classList.add("metadata"), i.classList.add("title"), l.classList.add("subtitle"), c.classList.add("js-nav-pt"), a.activate ? (c.activate = a.activate, c.onclick = a.activate) : (c.activate = z, c.onclick = z), a.isAvailable === !1 && (c.classList.remove("js-nav-pt"), b.classList.add("hidden")), h.appendChild(i), h.appendChild(l), e.appendChild(h), c.appendChild(d), c.appendChild(e), b.appendChild(c), c.dataset.contextUri = a.contextUri, c.dataset.contextIndex = a.contextIndex, c.dataset.uri = a.uri, c.dataset.isAvailable = a.isAvailable, a.disableSubNodes !== !0 && (c.dataset.trackId = a.id), m = c, s += 1, b
},
E = function(a, b) {
var c, d = document.createElement("dd"),
f = document.createElement("button"),
g = document.createElement("button");
d.classList.add("actions"), f.classList.add("button-round-medium"), f.classList.add("spoticon"), b === !0 ? (f.classList.add("spoticon-check"), c = B) : (f.classList.add("spoticon-plus"), c = A), f.classList.add("js-nav-btn"), g.classList.add("js-queue-button"), g.classList.add("button-round-medium"), g.classList.add("spoticon"), g.classList.add("spoticon-queue"), g.classList.add(e.isActiveDevice() ? "js-nav-btn" : "hidden"), f.activate = c, f.onclick = c, g.activate = C.bind(null, a.querySelector("[data-uri]")), g.onclick = C.bind(null, a.querySelector("[data-uri]")), f.remove = function() {
q.removeChild(a)
}, d.appendChild(f), d.appendChild(g), a.getElementsByClassName("metadata")[0].appendChild(d)
},
F = function() {
var a = document.createElement("ul"),
b = document.createElement("li"),
c = document.createElement("button");
return a.classList.add("column"), b.classList.add("more"), b.classList.add("js-nav-pt"), b.classList.add(f.cursor.NO_CURSOR_CLASS), c.classList.add("button-round-large"), a.appendChild(b), b.appendChild(c), c.textContent = i.currentLang.COMMON__MORE, b.activate = G, v = !0, a
},
G = x || function() {},
H = function(a) {
var b = D(a);
return q.appendChild(b), b
};
if (void 0 !== w && b.length > w ? (d = b.slice(0, w - 1), r = !0) : d = b, d.forEach(function(a) {
var b = D(a);
a.disableSubNodes !== !0 && a.id && (t.push(a.id), u.push(b)), q.appendChild(b)
}), t.length > 0 && h.mySongsContain(t, function(a, b) {
for (var c, d = 0, e = b.length; e > d; d += 1) c = u[d], E(c, b[d]);
f.interactionManager.update(), u = []
}), t = [], r === !0 && (l = F(), q.appendChild(l)), n.classList.add("group"), n.classList.add("js-nav-ct"), n.classList.add("js-group"), o.classList.add("group-header"), q.classList.add("songs"), q.classList.add("cluster"), o.appendChild(p), n.appendChild(o), n.appendChild(q), n.dataset.clusterType = "songs", void 0 !== w ? f.translation.bindTextContent(p, a) : p.textContent = j(a, {
chars: 50
}), y) {
var I = document.createElement("h2");
I.textContent = y, o.appendChild(I)
}
return n.addElements = function(a) {
var b = [],
c = [];
a.forEach(function(a) {
var d = H(a);
a.disableSubNodes !== !0 && a.id && (b.push(a.id), c.push(d))
}), b.length > 0 && h.mySongsContain(b, function(a, b) {
var d, e, g = 0;
if (!a) {
for (d = b.length; d > g; g += 1) e = c[g], E(e, b[g]);
f.interactionManager.update()
}
});
var d = f.getContentElement(),
e = q.clientWidth;
2 * e > d.clientWidth && (d.style.width = 2 * e + "px")
}, n.isLastItem = function(a) {
return a !== m ? !1 : !0
}, n.getLoadedItems = function() {
return s
}, n.clear = function() {
m = void 0, v = !1, q.innerHTML = "", s = 0
}, n
}
b.exports = d;
var e = a("../../trackManager"),
f = a(".."),
g = a("../../utils/ImageBackground.js"),
h = a("../../interfaces/web"),
i = a("../../localization"),
j = a("../../utils/stringTruncator.js"),
k = "placeholder-song"
}, {
"..": 34,
"../../interfaces/web": 13,
"../../localization": 14,
"../../trackManager": 29,
"../../utils/ImageBackground.js": 52,
"../../utils/stringTruncator.js": 77
}],
47: [function(a, b, c) {
var d = {
PLAYLISTS: "playlists",
CATEGORIES: "categories",
ALBUMS: "albums",
SONGS: "songs",
VERTICAL: "vertical",
GENRES_MOODS: "genres",
FEATURED: "featured"
};
Object.freeze(d), b.exports = {
CONTENT_CLUSTER_TYPES: d,
addPlayableMixin: a("./addPlayableMixin.js"),
createAlbumInformation: a("./createAlbumInformation.js"),
createContentCluster: a("./createContentCluster.js"),
createEmptyStateModel: a("./createEmptyStateModel.js"),
createPlaylistInformation: a("./createPlaylistInformation.js"),
createScrollContainer: a("./createScrollContainer.js"),
createSingleItemsList: a("./createSingleItemsList.js"),
coverArtCarousel: a("./coverArtCarousel.js")
}
}, {
"./addPlayableMixin.js": 39,
"./coverArtCarousel.js": 40,
"./createAlbumInformation.js": 41,
"./createContentCluster.js": 42,
"./createEmptyStateModel.js": 43,
"./createPlaylistInformation.js": 44,
"./createScrollContainer.js": 45,
"./createSingleItemsList.js": 46
}],
48: [function(a, b, c) {
"use strict";
function d() {
for (; h.firstChild;) h.removeChild(h.firstChild)
}
function e(a, b, c) {
var e = Spotify.ui.translation.translate(b);
void 0 !== i && void 0 !== i.className && f.classList.remove(i.className), i = a, void 0 !== i && void 0 !== i.className && f.classList.add(i.className), d(), h.appendChild(e), c && "function" == typeof c && c()
}
var f, g, h, i, j = a("../connection.js"),
k = {},
l = {
OVERLAY: "overlay",
OVERLAY_ID: "js-overlay",
OVERLAY_INNER: "overlay-inner",
OVERLAY_BACKGROUND: "overlay-bg",
NAVCONTAINER: "js-nav-ct"
},
m = {
EXPANDED: "expanded"
},
n = {
GRID: "grid",
SONGS: "songs",
VERTICAL: "vertical"
},
o = !1,
p = !1,
q = 750;
k.init = function(a) {
f = Spotify.utils.createElement("section"), h = Spotify.utils.createElement("div", {
className: l.OVERLAY_INNER
}), g = Spotify.utils.createElement("div", {
className: l.OVERLAY_BACKGROUND
}), f.id = l.OVERLAY_ID, f.dataset.clusterType = n.VERTICAL, f.classList.add(l.OVERLAY), f.classList.add(l.NAVCONTAINER), f.appendChild(h), f.appendChild(g), a = a || document.body, a.appendChild(f)
}, k.populate = function(a, b) {
var c = a.getHtml();
"function" == typeof c ? c(function(c) {
e(a, c, b)
}) : e(a, c, b)
}, k.close = function() {
return p ? (p = !1, "function" == typeof i.close && i.close(), f.classList.remove(m.EXPANDED), !0) : !1
}, k.open = function(a) {
Spotify.ui.interactionManager.update(), p ? "function" == typeof a && a() : (p = !0, Spotify.ui.enableKeyInput(!1), "function" == typeof i.open && i.open(), f.classList.add(m.EXPANDED), window.setTimeout(function() {
Spotify.ui.interactionManager.jumpIntoOverlay(), "function" == typeof a && a(), j.isOffline() || (Spotify.ui.updateKeyBindings(), Spotify.ui.enableKeyInput(!0))
}, q), void 0 !== i.onDisplayed && i.onDisplayed())
}, k.hide = function() {
o && (o = !1, f.style.display = "none")
}, k.show = function() {
o || (o = !0, f.style.display = "block")
}, k.isVisible = function() {
return o
}, k.isOpen = function() {
return p
}, b.exports = k
}, {
"../connection.js": 9
}],
49: [function(a, b, c) {
"use strict";
function d(a, b) {
var c = e(a, b.dataset.i18nKey, b.dataset.i18nArgs);
b.textContent = k(c, f(b.dataset.truncate))
}
function e(a, b, c) {
var d = l(a, b);
return void 0 === d && Spotify && Spotify.debug ? "{{ " + b + " }}" : c ? j(d, c) : d
}
function f(a) {
var b = {};
if (a && a.length) {
var c = a.split(",");
b.chars = c[0], b.lines = c[1] || 1
}
return b
}
function g(a) {
return d.bind(null, a)
}
var h = {};
b.exports = h;
var i, j = a("../../utils/stringFormatter.js"),
k = a("../../utils/stringTruncator.js"),
l = a("../../utils/getObjectPath.js"),
m = a("../../localization");
h.init = function(a) {
if (!a) throw new Error("[translation] No language provided");
i = a, h.translate(document), m.on(m.EVENTS.LANG_CHANGE, function(a) {
i = a.newLang, h.translate(document)
})
}, h.translate = function(a) {
var b = a.querySelectorAll("[data-i18n-key]");
return [].forEach.call(b, g(i)), a
}, h.getText = function(a, b) {
return e(i, a, b)
}, h.bindTextContent = function(a, b, c) {
if (a.dataset.i18nKey = b, Array.isArray(c)) a.dataset.i18nArgs = c;
else if (void 0 !== c) throw new Error("[translation] Expecting an array or nothing at all. Got: " + c);
return i && d(i, a), a
}, h.unbindTextContent = function(a) {
return delete a.dataset.i18nKey, delete a.dataset.i18nArgs, a
}
}, {
"../../localization": 14,
"../../utils/getObjectPath.js": 63,
"../../utils/stringFormatter.js": 76,
"../../utils/stringTruncator.js": 77
}],
50: [function(a, b, c) {
"use strict";
function d(a) {
setTimeout(function() {
x.classList.toggle("js-nav-pt", a), w.classList.toggle("js-nav-pt", a), y.classList.toggle("js-nav-pt", a), x.classList.toggle("js-pt-row", a), w.classList.toggle("js-pt-row", a), y.classList.toggle("js-pt-row", a), n.classList.toggle("js-nav-pt", a), G.currentOverlay === i && (!a && A.hasCurrentTrack() && G.interactionManager.goToElement(B), G.interactionManager.update(void 0, !0))
})
}
function e(a) {
w.classList.toggle("active", a)
}
function f(a) {
x.classList.toggle("active", a)
}
function g() {
return J.supports.connectOnly
}
function h() {
return g() || E.guest
}
var i = {};
b.exports = i;
var j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D = a("platform"),
E = a("../../../currentUser.js"),
F = a("../../../eventBus.js"),
G = a("../../index.js"),
H = a("../../../utils/createElement.js"),
I = a("../../../utils/numberFormatter.js"),
J = a("../../../config.js"),
K = a("../../../trackManager"),
L = a("../../../interfaces/web"),
M = a("../../models/coverArtCarousel.js"),
N = [],
O = function() {
P(), j = H("div", {
className: "overlay-content background-dark"
}), k = H("div", {
className: "npv-back spoticon spoticon-up"
}), l = H("div", {
className: "logo"
}), m = H("div", {
className: "overlay-container"
}), n = H("div", {
className: "overlay-container npv-scrobber js-nav-pt"
}), o = H("span", {
className: "npv-scrobber-pos"
}), p = H("div", {
className: "npv-scrobber-outer"
}), q = H("div", {
className: "npv-scrobber-inner hidden"
}), r = H("span", {
className: "npv-scrobber-length"
}), s = H("div", {
className: "overlay-container npv-title"
}), t = H("p", {
className: "npv-song-title"
}), u = H("p", {
className: "npv-song-artist"
}), v = H("div", {
className: "overlay-container npv-controls"
}), w = H("button", {
className: "npv-repeat spoticon spoticon-repeat js-nav-pt js-pt-row"
}), x = H("button", {
className: "npv-shuffle spoticon spoticon-shuffle js-nav-pt js-pt-row"
}), y = H("button", {
className: "hidden"
}), A = new M(K), B = A.getElement(), B.classList.add("js-nav-pt"), B.classList.add("npv-artwork"), B.activate = K.controller.togglePlayback, f(K.isShuffleEnabled()), e(K.isRepeatEnabled()), v.appendChild(x), v.appendChild(w), v.appendChild(y), s.appendChild(t), s.appendChild(u), n.appendChild(o), p.appendChild(q), n.appendChild(p), n.appendChild(r), m.appendChild(B), j.appendChild(k), j.appendChild(l), j.appendChild(m), j.appendChild(n), j.appendChild(s), j.appendChild(v), w.activate = K.controller.toggleRepeat, x.activate = K.controller.toggleShuffle, R(), Q()
},
P = function() {
g() || (N[Spotify.KEY.SELECT] = {
onKeyUp: function() {
var a = G.interactionManager.getCurrentNavpoint();
G.indicateKeyUpOnElement(a)
},
onKeyDown: function() {
var a = G.interactionManager.getCurrentNavpoint();
a.activate(), G.indicateKeyDownOnElement(a)
}
}, N[Spotify.KEY.BACK] = function(a) {
E.guest !== !0 ? G.closeOverlay() : (G.showLoadingScreen(), F.on(F.ESDK_EVENTS.EVENT_LOGGEDOUT, function() {
Spotify.session.reInit(!0)
}, !0), D.sdk.logout())
}, N[Spotify.KEY.LEFT] = function(a) {
C = G.interactionManager.getCurrentNavpoint(), C === B ? K.controller.previousTrack() : C === n ? K.controller.rewind() : G.interactionManager.moveLeft()
}, N[Spotify.KEY.RIGHT] = function(a) {
C = G.interactionManager.getCurrentNavpoint(), C === B ? K.controller.nextTrack() : C === n ? K.controller.fastForward() : G.interactionManager.moveRight()
}, N[Spotify.KEY.UP] = function(a) {
E.guest !== !0 && (C = G.interactionManager.getCurrentNavpoint(), C === B ? G.closeOverlay() : G.interactionManager.moveUp())
}, N[Spotify.KEY.DOWN] = function(a) {
E.guest !== !0 && G.interactionManager.moveDown()
})
},
Q = function() {
K.on(K.EVENTS.CHANGE_PLAY_QUEUE, R), K.on(K.EVENTS.CHANGE_TRACK, function(a) {
q.classList.add("hidden"), z = void 0, R()
}), K.on(K.EVENTS.CHANGE_SHUFFLE_SETTING, function(a) {
f(a.shuffle)
}), K.on(K.EVENTS.CHANGE_REPEAT_SETTING, function(a) {
e(a.repeat)
}), K.on(K.EVENTS.CHANGE_PLAYBACK_STATE, function() {
A.updatePlayButton(K.isPlaying())
}), K.on(K.EVENTS.UPDATE_TRACK_PROGRESS, function(a) {
S(a.progress)
})
},
R = function() {
K.awaitNowPlayingTracks(function(a, b) {
A.updateCovers(a), A.setUpcomingSongs(b);
var c;
z = a[2], z && (c = z.isAd, j.classList.toggle("is-showing-ad", c), d(!c), c || (y.className = "npv-plus spoticon spoticon-plus js-nav-pt js-pt-row", y.classList.toggle("hidden", h()), y.activation = function() {}, T(z.isFollowed)), o.textContent = I(0), r.textContent = I(z.duration_ms), t.textContent = z.name, u.textContent = z.artists[0].name, S(K.getState().playback.currentTrackProgress), q.classList.remove("hidden"))
})
},
S = function(a) {
a = a || 0;
var b = z ? z.duration_ms : 0;
a = a > b ? b : a, o.textContent = I(a), q.style.width = Math.min(a / b * 100, 100) + "%"
},
T = function(a) {
var b, c = z.id,
d = function() {
var a = this;
L.followTrack(c, function(b, c) {
b || (G.showAlert(null, Spotify.ui.translation.getText("COMMON__SONG_SAVED"), "check"), a.classList.remove("spoticon-plus"), a.classList.add("spoticon-check"), a.activate = e)
})
},
e = function() {
var a = this;
L.unFollowTrack(c, function(b, c) {
b || (G.showAlert(null, G.translation.getText("COMMON__SONG_UNSAVED"), "cross"), a.classList.remove("spoticon-check"), a.classList.add("spoticon-plus"), a.activate = d)
})
};
b = a === !0 ? "spoticon-check" : "spoticon-plus", y.className = "npv-plus spoticon " + b + " js-nav-pt js-pt-row", y.classList.toggle("hidden", h()), y.activate = a === !0 ? e : d, G.currentOverlay === i && G.interactionManager.update(void 0, !0)
};
i.getHtml = function() {
return void 0 === j && O(), j
}, i.keySubscriptions = N, i.className = "now-playing-view", i.onDisplayed = R, i.onReset = function() {
A && (A.reset(), t.textContent = "", u.textContent = "", r.textContent = "", o.textContent = I(0), q.style.width = 0)
}, i.open = function() {
j.classList.toggle("is-connect-only", g()), j.classList.toggle("is-guest-mode", E.guest), h() ? (y.classList.add("hidden"), k.classList.add("hidden"), k.classList.remove("npv-back")) : (y.classList.remove("hidden"), k.classList.remove("hidden"), k.classList.add("npv-back"))
}
}, {
"../../../config.js": 8,
"../../../currentUser.js": 10,
"../../../eventBus.js": 11,
"../../../interfaces/web": 13,
"../../../trackManager": 29,
"../../../utils/createElement.js": 59,
"../../../utils/numberFormatter.js": 67,
"../../index.js": 34,
"../../models/coverArtCarousel.js": 40,
platform: "platform"
}],
51: [function(a, b, c) {
"use strict";
function d() {
var a, b, c;
a = f("div", {
className: "overlay-large-icon spoticon spoticon-offline"
}), b = f("h1", {
className: "overlay-heading",
i18n: "OFFLINE__OFFLINE_TITLE"
}), c = f("p", {
className: "overlay-muted-paragraph",
i18n: "OFFLINE__OFFLINE_1"
}), e = f("div", {
className: "overlay-content"
}, [a, b, c])
}
var e, f = a("../../../utils/createElement.js"),
g = {};
g.className = "no-connection", g.keySubscriptions = [], g.getHtml = function() {
return void 0 === e && d(), e
}, b.exports = g
}, {
"../../../utils/createElement.js": 59
}],
52: [function(a, b, c) {
function d(a, b) {
b = b || {}, this._url = void 0, this._element = a, this._imageLoader = b.imageLoader || e.getInstance(), this._placeholder = b.placeholder, this._placeholderClass = b.placeholderClass, this._transition = b.transition !== !1, this._onLoad = this._onLoad.bind(this)
}
var e = a("./ImageLoader.js"),
f = "background-image-transition";
b.exports = d, d.prototype.load = function(a, b) {
this.abort(), this._url = a, a && this._imageLoader.isLoaded(a) || this._setupElement(), a && this._imageLoader.load(a, this._onLoad, b)
}, d.prototype.abort = function() {
this._url && this._imageLoader.cancel(this._url, this._onLoad), this._url = void 0
}, d.prototype.getElement = function() {
return this._element
}, d.prototype.setBackground = function(a) {
var b = "string" == typeof a ? a : a.src;
this._element.style.backgroundImage = a ? "url('" + b + "')" : ""
}, d.prototype._setupElement = function() {
this._transition && this._element.classList.add(f), this._placeholderClass && (this._element.style.backgroundImage = "", this._element.classList.add(this._placeholderClass)), this._placeholder && this.setBackground(this._placeholder)
}, d.prototype._onLoad = function(a, b, c) {
a || this._url === c && (this._placeholderClass && this._element.classList.remove(this._placeholderClass), this.setBackground(b))
}
}, {
"./ImageLoader.js": 53
}],
53: [function(a, b, c) {
"use strict";
function d() {
this._loadingCount = 0, this._queue = [], this._items = {}
}
b.exports = d;
var e = a("./ImageLoaderItem.js"),
f = 10,
g = null,
h = f;
d.getInstance = function(a, b) {
return void 0 !== b && (h = b), (!g || a) && (g = new d), g
}, d.prototype.load = function(a, b, c) {
c = c || 0;
var d = this._items[a];
return d ? d.register(b, c) : (d = new e(a, b, c, this._onImageLoad.bind(this)), this._enqueue(d)), 1 > c && this.processQueue(), d
}, d.prototype.isLoaded = function(a) {
return this._items[a] && this._items[a].isLoaded()
}, d.prototype._enqueue = function(a) {
this._queue.push(a), this._items[a.url] = a
}, d.prototype._removeQueueItem = function(a) {
var b;
for (b = 0; this._queue.length > b; b++)
if (this._queue[b].url === a) {
this._queue.splice(b, 1);
break
}
}, d.prototype.cancel = function(a, b) {
var c = this,
d = this._items[a];
d && (d.unregister(b), c._loadingCount--, setTimeout(function() {
d.cancelled() && (delete c._items[a], c._removeQueueItem(a), c.processQueue())
}))
}, d.prototype.processQueue = function() {
for (this._sortQueueByPriority(); h > this._loadingCount && this._queue.length;) {
var a = this._queue.shift();
this._loadingCount++, a.load()
}
}, d.prototype._onImageLoad = function(a, b, c) {
a && delete this._items[c], this._loadingCount--, this.processQueue()
}, d.prototype._sortQueueByPriority = function() {
this._queue.sort(function(a, b) {
return a.priority - b.priority
})
}
}, {
"./ImageLoaderItem.js": 54
}],
54: [function(a, b, c) {
(function(a) {
"use strict";
function c(a, b, c, e) {
this.url = a, this.callbacks = [b], this.priority = c || 0, this.img = new d, this.loadState = f.QUEUED, this._onLoaded = e
}
var d = a.Image,
e = !1,
f = Object.freeze({
CANCELLED: -1,
QUEUED: 1,
LOADING: 2,
LOADED: 3
}),
g = a.URL || a.webkitURL || a.mozURL;
b.exports = c, c.prototype.register = function(a, b) {
this.inProgress() ? (this.callbacks.push(a), this.priority = Math.min(this.priority, b)) : a(null, this.img, this.url)
}, c.prototype.unregister = function(a) {
var b = this.callbacks.indexOf(a);
b > -1 && this.callbacks.splice(b, 1), this.isLoaded() || this.callbacks.length || (this.loadState = f.CANCELLED, this._deferedDestroy())
}, c.prototype.setLoaded = function() {
this.loadState = f.LOADED
}, c.prototype.isLoaded = function() {
return this.loadState === f.LOADED
}, c.prototype.destroy = function() {
this.xhr && (this.xhr.abort(), this.xhr = null);
var a = this.img;
a && (a.onerror = function() {}, a.onload = function() {}, a.src = "", this.img = null), this.callbacks = [], this.loadState = f.CANCELLED
}, c.prototype.inProgress = function() {
return this.loadState === f.QUEUED || this.loadState === f.LOADING
}, c.prototype.cancelled = function() {
return this.loadState === f.CANCELLED
}, c.prototype.load = function() {
var a = this,
b = this.url;
return this.isLoaded() || (this.loadState = f.LOADING), e ? this._loadWithXhr() : (this.img.addEventListener("error", function(c) {
a.cancelled() || (a._callCallbacks(new Error("Could not load image: " + b), null), a.destroy())
}), this.img.addEventListener("load", function() {
a.loadState = f.LOADED, a.cancelled() || a._callCallbacks(null, a.img)
}), void(this.img.src = b))
}, c.prototype._loadWithXhr = function() {
var a, b = this,
c = this.url,
d = function(a) {
return "png" === a.substr(-3) ? "image/png" : "image/jpg"
};
a = new XMLHttpRequest, a.open("GET", c, !0), a.responseType = "blob", a.onerror = function() {
b._callCallbacks(new Error("Could not load image: " + c), null), b.destroy()
}, a.onload = function() {
var a = b.img;
200 !== this.status ? (b._callCallbacks(new Error("Could not load image: " + c), null), b.destroy()) : (a.src = b._xhrResponseToDataUri(this.response, d(c)), b.loadState = f.LOADED, b._callCallbacks(null, a))
}, this.xhr = a, a.send()
}, c.prototype._callCallbacks = function(a, b) {
var c = this.url;
this.callbacks.forEach(function(d) {
d(a, b, c)
}), this._onLoaded && this._onLoaded(a, b, c)
}, c.prototype._xhrResponseToDataUri = function(a, b) {
return g.createObjectURL(new Blob([a], {
type: b
}))
}, c.prototype._deferedDestroy = function() {
var a = this;
setTimeout(function() {
a.cancelled() && a.destroy()
}, 10)
}, c.setImageConstructor = function(a) {
d = a
}, c.enableXhrLoad = function() {
e = !0
}, c.disableXhrLoad = function() {
e = !1
}, c.LOAD_STATE = f
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {}],
55: [function(a, b, c) {
var d = function(a) {
var b = [],
c = !0,
d = NaN;
a.on = function(a, c, d) {
var e = b[a];
void 0 === e && (b[a] = [], e = b[a]), e.push({
callback: c,
once: d === !0 ? !0 : !1
})
}, a.onAll = function(a) {
var c = b[d] || [];
c.push({
callback: a,
once: !1
}), b[d] = c
}, a.emit = function(a, e) {
var f, g = b[a],
h = b[d],
i = function(b) {
var c = b.callback,
d = b.once;
return c(e, a), !d
};
c && (h && h.forEach(i), g && (f = g.filter(i), 1 > f.length ? delete b[a] : b[a] = f))
}, a.ignore = function(a, c) {
var d, e = b[a],
f = function(a) {
return a.callback === c ? !1 : !0
};
void 0 !== e && (d = e.filter(f), 1 > d.length ? delete b[a] : b[a] = d)
}, a.ignoreAll = function() {
b = []
}, a.disable = function() {
c = !1
}, a.enable = function() {
c = !0
}
};
b.exports = d
}, {}],
56: [function(a, b, c) {
function d(a, b, c) {
c = c || e;
var d = Math.floor(b.length / 2),
g = f(b[d], a, c);
if (g > -1) {
var h, i;
for (g -= d, g > 0 ? (h = 0, i = a.length - g) : (h = -g, i = a.length); i > h; h += 1)
if (!c(b[h], a[h + g])) return;
return g
}
}
function e(a, b) {
return a === b
}
function f(a, b, c) {
var d = 0,
e = b.length;
for (d = 0; e > d; d += 1)
if (c(a, b[d])) return d;
return -1
}
b.exports = d
}, {}],
57: [function(a, b, c) {
"use strict";
function d(a) {
if (g[a]) {
for (var b in f)
if (f[b].track.id === a) {
f.splice(b, 1);
break
}
delete g[a]
}
}
var e = {};
b.exports = e;
var f, g, h, i = a("../eventBus"),
j = 1e3,
k = 36e5,
l = {
is_playable: !1
};
e.init = function(a) {
h = a || j, e.reset(), i.on(i.ESDK_EVENTS.EVENT_LOGGEDOUT, e.reset)
}, e.reset = function() {
g = {}, f = []
}, e.getTrackFromCache = function(a) {
if (!a) return l;
var b = g[a];
if (b) {
if (Date.now() - b.timestamp < k) return b.track;
d(a)
}
return null
}, e.getTracks = function(a) {
var b, c, d, f = {};
for (b = 0, c = a.length; c > b; b++) d = a[b], f[d] = e.getTrackFromCache(d);
return f
}, e.setFollowFlag = function(a, b) {
var c = e.getTrackFromCache(a);
c && (c.isFollowed = b)
}, e.addTracksToCache = function(a, b) {
var c, d, h, i, j, k = b || Date.now();
for (c = 0, d = a.length; d > c; c += 1) h = a[c], h && h.id && (j = h.linked_from, i = g[h.id], i ? j && j.id && !g[j.id] && (i.linkedTrackId = j.id, g[j.id] = i) : (i = {
timestamp: k,
trackId: h.id,
linkedTrackId: h.linked_from ? h.linked_from.id : null,
track: h
}, g[h.id] = i, f.unshift(i), i.linkedTrackId && (g[i.linkedTrackId] = i)));
e.trim()
}, e.trim = function() {
var a, b, c, d = f.splice(h);
for (b = 0, c = d.length; c > b; b += 1) a = d[b].track, delete g[a.id], d[b].linkedTrackId && g[d[b].linkedTrackId].track === a && delete g[d[b].linkedTrackId]
}
}, {
"../eventBus": 11
}],
58: [function(a, b, c) {
var d = {};
b.exports = d;
var e = [];
d.getMsgId = function(a) {
for (var b, c = 0; e.length > c; c += 1)
if (void 0 === e[c]) {
e[c] = a, b = c;
break
}
return void 0 === b && (b = e.push(a) - 1), b
}, d.fireMsgCallback = function(a, b, c) {
var d = e[a];
b = void 0 === b ? null : b, c = void 0 === c ? null : c, "number" == typeof c && (0 === c ? b = null : (b = c, c = null)), "function" == typeof d && (delete e[a], d(b, c))
}
}, {}],
59: [function(a, b, c) {
var d = a("../ui/translation"),
e = function(a, b, c) {
b = b ? b : {};
var e, f, g, h = document.createElement(a);
for (g in b) b.hasOwnProperty(g) && (h[g] = b[g]);
if ("i18n" in b && d.bindTextContent(h, b.i18n, b.i18nArgs), void 0 !== c)
for (e = 0, f = c.length; f > e; e++) h.appendChild(c[e]);
return h
};
b.exports = e
}, {
"../ui/translation": 49
}],
60: [function(a, b, c) {
var d = function(a) {
var b = a + "";
return b.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
};
b.exports = d
}, {}],
61: [function(a, b, c) {
var d = {};
b.exports = d;
var e = {
firetv: /AFTB|AFTS|AFTM/i,
nexus: /Nexus Player/i
};
d.detect = function(a) {
for (var b = 0, c = Object.keys(e), d = c.length; d > b; b++)
if (a.match(e[c[b]])) return c[b];
return null
}
}, {}],
62: [function(a, b, c) {
var d = function(a) {
var b = a || new Date,
c = function(a) {
var b = Math.abs(Math.floor(a));
return (10 > b ? "0" : "") + b
};
return b.getFullYear() + "-" + c(b.getMonth() + 1) + "-" + c(b.getDate()) + "T" + c(b.getHours()) + ":" + c(b.getMinutes()) + ":" + c(b.getSeconds())
};
b.exports = d
}, {}],
63: [function(a, b, c) {
var d = function(a, b) {
return b.match(/[^\.\[\]]+/g).reduce(function(a, b) {
return (a || {})[b]
}, a)
};
b.exports = d
}, {}],
64: [function(a, b, c) {
var d = function() {
function a() {
return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1)
}
return a() + a() + "-" + a() + "-" + a() + "-" + a() + "-" + a() + a() + a()
};
b.exports = d
}, {}],
65: [function(a, b, c) {
var d = {};
b.exports = d;
var e = a("./ravenWrapper.js");
d.request = function(a, b, c, d, f, g) {
var h = new XMLHttpRequest;
if (h.onload = function() {
var d;
g || e.filterHttpError(b, a, this.status), d = this.status >= 500 && 504 >= this.status ? this : null, c(d, {
statusCode: this.status,
responseText: this.responseText
})
}, h.onerror = c, h.onabort = c, h.ontimeout = c, h.open(a, b, !0), f)
for (var i, j = 0, k = f.length; k > j; j++) i = f[j], h.setRequestHeader(i[0], i[1]);
h.send(d)
}, d.requestWithRetry = function(a, b, c, f, g, h, i) {
if (0 > a) throw new Error("[httpRequestWithRetry] Invalid value for numRetries: " + a);
d.request(c, f, function(j, k) {
j ? (e.filterHttpError(f, c, j.status, a), a > 0 && j.status >= 500 && 504 >= j.status ? setTimeout(function() {
d.requestWithRetry(a - 1, 2 * b, c, f, g, h, i)
}, b) : g(j, k)) : g(null, k)
}, h, i, !0)
}
}, {
"./ravenWrapper.js": 73
}],
66: [function(a, b, c) {
b.exports = {
applyEventHandler: a("./applyEventHandler.js"),
cache: a("./cache.js"),
createElement: a("./createElement.js"),
delimitNumber: a("./delimitNumber.js"),
getISODateString: a("./getISODateString.js"),
getObjectPath: a("./getObjectPath.js"),
guid: a("./guid.js"),
http: a("./http.js"),
numberFormatter: a("./numberFormatter.js"),
object: a("./object.js"),
parseQueryString: a("./parseQueryString.js"),
pick: a("./pick.js"),
queryStringBuilder: a("./queryStringBuilder.js"),
Raven: a("./ravenWrapper.js"),
removeCSSClass: a("./removeCSSClass.js"),
format: a("./stringFormatter.js"),
truncate: a("./stringTruncator.js"),
zipObject: a("./zipObject.js")
}
}, {
"./applyEventHandler.js": 55,
"./cache.js": 57,
"./createElement.js": 59,
"./delimitNumber.js": 60,
"./getISODateString.js": 62,
"./getObjectPath.js": 63,
"./guid.js": 64,
"./http.js": 65,
"./numberFormatter.js": 67,
"./object.js": 68,
"./parseQueryString.js": 69,
"./pick.js": 71,
"./queryStringBuilder.js": 72,
"./ravenWrapper.js": 73,
"./removeCSSClass.js": 74,
"./stringFormatter.js": 76,
"./stringTruncator.js": 77,
"./zipObject.js": 80
}],
67: [function(a, b, c) {
var d = function(a) {
"use strict";
var b = Math.round(a / 1e3),
c = Math.floor(b / 60) + "",
d = b - 60 * c + "";
return 2 > c.length && (c = "0" + c), 2 > d.length && (d = "0" + d), c + ":" + d
};
b.exports = d
}, {}],
68: [function(a, b, c) {
var d = {
inherit: function(a, b) {
var c = function() {};
c.prototype = b.prototype, a.prototype = new c, a.prototype.constructor = a
},
merge: function(a, b) {
for (var c, d = Object.keys(b), e = 0, f = d.length; f > e; e++) c = d[e], a[c] = b[c]
},
deepMerge: function(a, b) {
for (var c in b) void 0 !== a[c] && b[c] instanceof Object ? a[c] = this.deepMerge(a[c], b[c]) : void 0 !== b[c] && (a[c] = b[c]);
return a
},
extend: function(a, b) {
var c = arguments.length;
if (2 > c) return a;
for (var d = 1; c > d; d++)
for (var e = arguments[d], f = Object.keys(e), g = f.length, h = 0; g > h; h++) {
var i = f[h];
a[i] = e[i]
}
return a
},
mixin: function(a, b) {
return this.extend({}, a, b)
},
clone: function(a) {
var b = {};
return this.merge(b, a), b
}
};
b.exports = d
}, {}],
69: [function(a, b, c) {
var d = function(a) {
return "" === a ? {} : a.replace(/\??([^\/]+)\/?/, "$1").split("&").reduce(function(a, b) {
var c = b.split("="),
d = c[0],
e = decodeURIComponent(c[1]),
f = a[d];
return f && e ? Array.isArray(f) ? f.push(e) : a[d] = [f, e] : a[d] = e, a
}, {})
};
b.exports = d
}, {}],
70: [function(a, b, c) {
function d(a) {
return a.replace("#!/", "")
}
var e = {};
b.exports = e;
var f = a("./window.js"),
g = f.__revision || "";
g && (g += "/");
var h = d(f.location.href).split("/");
h.pop();
var i = h.join("/");
e.getBasePath = function(a) {
return i + "/" + a
}, e.getRevisionPath = function(a) {
return i + "/" + g + a
}
}, {
"./window.js": 79
}],
71: [function(a, b, c) {
function d(a, b) {
return a.map(function(a) {
return e(a, b)
})
}
b.exports = d;
var e = a("./getObjectPath.js")
}, {
"./getObjectPath.js": 63
}],
72: [function(a, b, c) {
var d = function(a) {
var b = Object.keys(a).map(function(b) {
return encodeURIComponent(b) + "=" + encodeURIComponent(a[b])
}).join("&");
return b.length ? "?" + b : ""
};
b.exports = d
}, {}],
73: [function(a, b, c) {
"use strict";
function d(a) {
g.sdk.getVersion(function(b, c) {
var d = null === b ? c : "";
a(d)
})
}
var e = {};
b.exports = e;
var f = a("raven-js"),
g = a("platform"),
h = a("./version.js"),
i = a("./object.js"),
j = {};
e.init = function(a) {
if (Spotify.debug) a = "https://c9202c040b5c470b86b67c840c8cbc6f@app.getsentry.com/40629";
else if (!a) throw new Error("No proper platform sentry DSN set");
f.config(a, {
release: h,
shouldSendCallback: function(a) {
var b = 10;
return 100 * Math.random() <= b
}
}).install(), e.addTagsContext({
appVersion: h
})
}, e.addTagsContext = function(a) {
i.merge(j, a), f.setTagsContext(j)
}, e.setUserContext = function(a) {
f.setUserContext(a)
}, e.capture = function(a, b) {
d(function(c) {
var d = {
url: window.location.href,
esdkVersion: c
};
b && i.merge(d, b), f.captureException(a, {
tags: d
})
})
}, e.captureMessage = function(a, b, c) {
d(function(d) {
var e = {
url: window.location.href,
esdkVersion: d
};
b && i.merge(e, b), f.captureMessage(a, {
tags: e,
extra: c
})
})
};
var k = function(a, b, c, d) {
e.captureMessage("HTTP Request failed with status " + c, {
requestUrl: a,
requestMethod: b,
statusCode: c,
numRetriesLeft: d
})
};
e.filterHttpError = function(a, b, c, d) {
switch (c) {
case 400:
case 401:
case 500:
case 501:
case 502:
case 503:
case 504:
k(a, b, c, d)
}
}
}, {
"./object.js": 68,
"./version.js": 78,
platform: "platform",
"raven-js": 2
}],
74: [function(a, b, c) {
var d = function(a, b) {
var c = new RegExp("\\b" + b + "\\b");
a.className = a.className.replace(c, "")
};
b.exports = d
}, {}],
75: [function(a, b, c) {
function d(a, b, c, d, e) {
function f(g, h) {
g || c && !c(h) ? d > 0 ? setTimeout(function() {
d--, a(f)
}, e) : (g = g || new Error("Out of retries"), b(g, null)) : b(null, h)
}
d = void 0 !== d ? d : 2, e = void 0 !== e ? e : 100, a(f)
}
b.exports = d
}, {}],
76: [function(a, b, c) {
var d = function(a, b) {
"use strict";
var c, d, e = [],
f = [];
if ("string" != typeof a) throw new Error("The first argument must a be string.");
if (!new RegExp("{.}").test(a)) return a;
if ("string" == typeof b) e.push(b);
else if ("number" == typeof b) e.push(b.toString());
else {
if (!Array.isArray(b)) throw new Error("Argument was not in the correct format.");
e = b
}
if (a.split("{").length !== a.split("}").length) throw new Error("Syntax error.");
for (c = 0, d = a.split("{").length - 1; d > c; c++) f.indexOf("{" + c + "}") < 0 && a.indexOf("{" + c + "}") > -1 && f.push("\\{" + c + "\\}");
if (f.length > e.length) throw new Error("Insufficient number of arguments supplied. Expected " + f.length + ".");
for (c = 0, d = f.length; d > c; c++) {
if ("string" != typeof e[c] && "number" != typeof e[c]) throw new Error("The arguments to this function must be strings or numbers.");
a = a.replace(new RegExp(f[c], "g"), e[c])
}
return a
};
b.exports = d
}, {}],
77: [function(a, b, c) {
var d = function(a, b) {
if (b && b.chars) {
var c = a.length,
d = b.chars * (b.lines || 1);
return c > d ? a.slice(0, d - 1) + "…" : a
}
return a
};
b.exports = d
}, {}],
78: [function(a, b, c) {
"use strict";
var d = a("./window.js");
b.exports = d.__version || ""
}, {
"./window.js": 79
}],
79: [function(a, b, c) {
(function(a) {
b.exports = a
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {}],
80: [function(a, b, c) {
var d = function(a, b) {
if (a.length !== b.length) throw new Error("[utils.zipObject] Expecting two arrays of the same length");
return b = b.slice(), a.reduce(function(a, c) {
return a[c] = b.shift(), a
}, {})
};
b.exports = d
}, {}],
81: [function(a, b, c) {
function d(a) {
return null !== a && "object" == typeof a
}
b.exports = d
}, {}],
generatedBehaviors: [function(a, b, c) {
var d = [];
b.exports = d, d.EsdkError = a("../src/js/behaviors/setEsdkErrorBehavior.js"), d.Subscription = a("../src/js/behaviors/setSubscriptionBehavior.js")
}, {
"../src/js/behaviors/setEsdkErrorBehavior.js": 5,
"../src/js/behaviors/setSubscriptionBehavior.js": 6
}],
generatedViews: [function(a, b, c) {
var d = {
overlays: {},
routes: {}
};
b.exports = d, d.connectOnlyLandingView = a("../src/js/platforms/chromecast/views/connectOnlyLandingView.js"), d.routes.connectOnlyLandingView = ["/landing"], d.overlays.offlineOverlay = a("../src/js/ui/views/overlays/offlineOverlay.js"), d.overlays.nowPlayingOverlay = a("../src/js/ui/views/overlays/nowPlayingOverlay.js")
}, {
"../src/js/platforms/chromecast/views/connectOnlyLandingView.js": 20,
"../src/js/ui/views/overlays/nowPlayingOverlay.js": 50,
"../src/js/ui/views/overlays/offlineOverlay.js": 51
}],
manifest: [function(a, b, c) {
b.exports = {
splashLogo: "src/images/spotify_logo_watermark_large.png",
entry: "/connectOnlyLanding",
input: "desktop",
name: "chromecast",
family: "cast",
bridge: "async",
model: "unknown",
brand: "cast_tv",
mode: "connectOnly",
resolution: 720,
features: [],
preload: ["images/placeholder_song.png", "images/placeholder_song_large.png", "images/spotify_logo_text.png", "images/spotify_logo_watermark.png", "images/spotify_logo_watermark_large.png"],
overrides: {
views: ["connectOnlyLanding"]
},
beforeScript: '<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>'
}
}, {}],
platform: [function(a, b, c) {
(function(c) {
function d(a) {
a.isPlaying ? e.lifecycle.setActive() : (document.documentElement.classList.remove("is-buffering"), e.lifecycle.setIdle(t))
}
var e = {};
b.exports = e;
var f, g = a("../../sdk/esdk.js"),
h = a("./bridge.js"),
i = a("./CastPlayer.js"),
j = a("./CastMediaManager.js"),
k = a("./CastLifecycle.js"),
l = a("../../Session.js"),
m = a("../../index.js"),
n = a("../../trackManager"),
o = a("../../ui"),
p = a("../../eventBus.js"),
q = a("../../config.js"),
r = c.cast,
s = 1e3,
t = 12e5,
u = 3e4,
v = "http://spoti.fi/cast-support";
e.session = null;
var w = {
CLIENT_ID: "d7df0887fb71494ea994202cb473eae7",
SCOPE: "user-read-private,user-read-email,user-library-read,playlist-read-private,playlist-modify-public,playlist-modify-private,user-library-modify"
};
m.debug && r.receiver.logger.setLevelValue(r.receiver.LoggerLevel.DEBUG), e.name = q.get("name"), e.family = q.get("family"), e.SentryDsn = "https://6b7eea4bbbd84f1a8ffd8e2b43d9fbbb@app.getsentry.com/52199", e.sdk = g, e.bridge = h, e.setup = function() {
m.KEY.UP = 38, m.KEY.DOWN = 40, m.KEY.LEFT = 37, m.KEY.RIGHT = 39, m.KEY.SELECT = 13, m.KEY.BACK = 27, m.KEY.BACKSPACE = 8, m.KEY.MEDIA_PLAY_PAUSE = 32, m.KEY.MEDIA_NEXT = 102, m.KEY.MEDIA_FAST_FORWARD = 105, m.KEY.MEDIA_PREVIOUS = 100, m.KEY.MEDIA_REWIND = 103, document.onkeydown = o.onKey, document.onkeyup = o.onKeyUp, h.init(), g.setBridge(h), g.passClientId(w), e.session = new l, f = new i(n);
var a = new j(n, f);
e.lifecycle = new k(e), e.lifecycle.on(k.CAST_EVENTS.DESTROY, e.destroy), e.lifecycle.on(k.CAST_EVENTS.DEVICE_NOT_VISIBLE, function() {
g.pauseTrack()
}), e.lifecycle.on(k.CAST_EVENTS.SENDER_CONNECTED, function(a) {
o.displayNowPlayingOverlay()
}), c.castMediaManager = a, c.castPlayer = f
}, e.destroy = function() {
e.session.destroy(), h.destroyBridge(), r.receiver.CastReceiverManager.getInstance().stop()
}, e.init = function() {
function a(a) {
document.documentElement.classList.toggle("is-buffering", a)
}
function b(b) {
f.setActiveState(b.active), b.active ? (e.lifecycle.connect(), o.displayNowPlayingOverlay(), o.hideLoadingScreen()) : h.valid() ? e.lifecycle.disconnect(s, function() {
a(!1), o.closeOverlay()
}) : e.destroy()
}
var c = e.session;
m.session = c, c.init(e), p.on(p.EVENTS.CHANGE_BUFFERING_STATE, function(b) {
a(b.buffering)
}), c.on(c.EVENTS.SESSION_READY, function() {
n.init(g), n.on(n.EVENTS.CHANGE_ACTIVE_STATE, b), n.on(n.EVENTS.CHANGE_PLAYBACK_STATE, d)
}), o.changeView(o.views.connectOnlyLandingView)
}, e.setLoadingScreenBehavior = function() {
var a = e.session;
a.on(a.EVENTS.SESSION_READY, function() {
e.lifecycle.setLoggedIn(function() {
o.setLoadingScreenText()
})
}), h.valid() ? (e.lifecycle.setLoggingIn(function() {
o.showLoadingScreenText(o.translation.getText("GENERIC__LOGIN_FAILED"), o.translation.getText("GENERIC__RETRY"), !0)
}), o.showLoadingScreen()) : (o.showLoadingScreenText(o.translation.getText("RECEIVER__NOT_SUPPORTED"), o.translation.getText("RECEIVER__MORE_INFO", v), !0), e.lifecycle.setIdle(u)), o.showLoader()
}
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {
"../../Session.js": 4,
"../../config.js": 8,
"../../eventBus.js": 11,
"../../index.js": 12,
"../../sdk/esdk.js": 25,
"../../trackManager": 29,
"../../ui": 34,
"./CastLifecycle.js": 16,
"./CastMediaManager.js": 17,
"./CastPlayer.js": 18,
"./bridge.js": 19
}]
}, {}, [15]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment