@tidal-music/player-web-components 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{basePlayer-BcooVl9P-WesO1_17.js → basePlayer-Rqi9yRuo-4eKn-Akv.js} +100 -161
- package/dist/{browserPlayer-B1V50MdI-D65N_aRN.js → browserPlayer-CXURpXdL-DjOb2ySS.js} +61 -65
- package/dist/{index-DbGwqQeZ.js → index-DHnVYeec.js} +1111 -1052
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -8
- package/dist/{nativePlayer-DdpXKE9r-B14o92dS.js → nativePlayer-b92CavhC-CABrQPGS.js} +65 -104
- package/dist/output-devices-CUurcKto-C_F_9nLk.js +224 -0
- package/dist/shakaPlayer-D0NCOzx8-Dd1YFBoR.js +24403 -0
- package/package.json +14 -13
- package/dist/output-devices-BhcWYG6e-l4DCXneM.js +0 -236
- package/dist/shakaPlayer-Brgd4rob-DJ5uJTjr.js +0 -26243
- package/dist/worker-DrRlSx4a-BTanKBsS.js +0 -89
|
@@ -1,38 +1,31 @@
|
|
|
1
|
-
let
|
|
1
|
+
let A = Object.freeze({
|
|
2
2
|
apiUrl: "https://api.tidal.com/v1",
|
|
3
|
-
appVersion: "TIDAL Player",
|
|
4
|
-
clientPlatform: "web",
|
|
5
3
|
desiredVolumeLevel: 1,
|
|
6
|
-
eventUrl: "https://et.tidal.com/api/events",
|
|
7
4
|
gatherEvents: !0,
|
|
8
5
|
loudnessNormalizationMode: "ALBUM",
|
|
9
6
|
outputDevicesEnabled: !1,
|
|
10
7
|
streamingWifiAudioQuality: "LOW"
|
|
11
8
|
});
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
17
|
-
...
|
|
18
|
-
...
|
|
19
|
-
}), Object.keys(
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
}),
|
|
23
|
-
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
31
|
-
e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
|
32
|
-
}, A = (t, e, r, s) => (Z(t, e, "write to private field"), e.set(t, r), r), P, _, N, D;
|
|
33
|
-
class be {
|
|
9
|
+
function C(r) {
|
|
10
|
+
return A[r];
|
|
11
|
+
}
|
|
12
|
+
function B(r) {
|
|
13
|
+
return A = Object.freeze({
|
|
14
|
+
...A,
|
|
15
|
+
...r
|
|
16
|
+
}), Object.keys(r).forEach((e) => {
|
|
17
|
+
const t = e;
|
|
18
|
+
oe.dispatchEvent(new CustomEvent(t, { detail: r[t] }));
|
|
19
|
+
}), A;
|
|
20
|
+
}
|
|
21
|
+
const oe = new EventTarget();
|
|
22
|
+
class ce {
|
|
23
|
+
#e;
|
|
24
|
+
#r = !1;
|
|
25
|
+
#s;
|
|
26
|
+
#t;
|
|
34
27
|
constructor(e) {
|
|
35
|
-
|
|
28
|
+
this.#t = new URL(e), this.synchronize();
|
|
36
29
|
}
|
|
37
30
|
/**
|
|
38
31
|
* Returns the current time adjusted to server-time.
|
|
@@ -42,7 +35,7 @@ class be {
|
|
|
42
35
|
*/
|
|
43
36
|
// eslint-disable-next-line no-restricted-syntax
|
|
44
37
|
now(e = Date.now()) {
|
|
45
|
-
return !
|
|
38
|
+
return !this.#s || !this.#e ? (console.warn("TrueTime is not yet synchronized"), e) : this.#s + (e - this.#e);
|
|
46
39
|
}
|
|
47
40
|
/**
|
|
48
41
|
* Synchronizes the client's time with the server's time.
|
|
@@ -51,16 +44,16 @@ class be {
|
|
|
51
44
|
* @returns {Promise<void>} A promise that resolves when the synchronization is complete.
|
|
52
45
|
*/
|
|
53
46
|
async synchronize() {
|
|
54
|
-
if (!(
|
|
55
|
-
Math.abs(Date.now() -
|
|
56
|
-
|
|
47
|
+
if (!(this.#e && // eslint-disable-next-line no-restricted-syntax
|
|
48
|
+
Math.abs(Date.now() - this.#e) < 36e5 || this.#r)) {
|
|
49
|
+
this.#r = !0;
|
|
57
50
|
try {
|
|
58
|
-
const e = await fetch(
|
|
59
|
-
e.ok && e.headers.has("date") && (
|
|
51
|
+
const e = await fetch(this.#t);
|
|
52
|
+
e.ok && e.headers.has("date") && (this.#s = new Date(e.headers.get("date")).getTime(), this.#e = Date.now());
|
|
60
53
|
} catch (e) {
|
|
61
54
|
console.error(e);
|
|
62
55
|
}
|
|
63
|
-
|
|
56
|
+
this.#r = !1;
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
59
|
/**
|
|
@@ -72,109 +65,116 @@ class be {
|
|
|
72
65
|
* @returns The timestamp of the performance mark, or undefined if not found.
|
|
73
66
|
* @throws ReferenceError if the performance mark is not found.
|
|
74
67
|
*/
|
|
75
|
-
timestamp(e,
|
|
68
|
+
timestamp(e, t) {
|
|
76
69
|
let s;
|
|
77
|
-
if (
|
|
78
|
-
if (s = performance.getEntriesByName(e).find((n) => "detail" in n && n.detail ===
|
|
70
|
+
if (t) {
|
|
71
|
+
if (s = performance.getEntriesByName(e).find((n) => "detail" in n && n.detail === t), !s)
|
|
79
72
|
throw new ReferenceError(
|
|
80
|
-
`There is no performance entry named "${e}" with detail "${
|
|
73
|
+
`There is no performance entry named "${e}" with detail "${t}"`
|
|
81
74
|
);
|
|
82
75
|
} else
|
|
83
76
|
s = performance.getEntriesByName(e).pop();
|
|
84
77
|
return s ? s.startTime : void 0;
|
|
85
78
|
}
|
|
86
79
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
for (const s of t) {
|
|
80
|
+
const y = new ce("https://api.tidal.com/v1/ping"), de = (r, e, t) => {
|
|
81
|
+
for (const s of r) {
|
|
90
82
|
const n = s.addedNodes[0];
|
|
91
|
-
s.type === "childList" && n.id === e &&
|
|
83
|
+
s.type === "childList" && n.id === e && t();
|
|
92
84
|
}
|
|
93
85
|
};
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
86
|
+
function le() {
|
|
87
|
+
const r = document.getElementById("tidal-player-root");
|
|
88
|
+
if (!r)
|
|
97
89
|
return Promise.reject("No player root");
|
|
98
|
-
if ("video-one" in
|
|
90
|
+
if ("video-one" in r.children)
|
|
99
91
|
return Promise.resolve();
|
|
100
92
|
const e = [];
|
|
101
|
-
return "video-one" in
|
|
102
|
-
new Promise((
|
|
103
|
-
new MutationObserver(
|
|
104
|
-
(s) => Q(s, "video-one", r)
|
|
105
|
-
).observe(t, { childList: !0 });
|
|
106
|
-
})
|
|
107
|
-
), "video-two" in t.children || e.push(
|
|
108
|
-
new Promise((r) => {
|
|
93
|
+
return "video-one" in r.children || e.push(
|
|
94
|
+
new Promise((t) => {
|
|
109
95
|
new MutationObserver(
|
|
110
|
-
(s) =>
|
|
111
|
-
).observe(
|
|
96
|
+
(s) => de(s, "video-one", t)
|
|
97
|
+
).observe(r, { childList: !0 });
|
|
112
98
|
})
|
|
113
99
|
), Promise.all(e);
|
|
114
100
|
}
|
|
115
|
-
const
|
|
116
|
-
|
|
101
|
+
const k = document.createElement("video"), ue = (r) => {
|
|
102
|
+
r.setAttribute("crossorigin", "anonymous"), r.setAttribute("playsinline", "playsinline");
|
|
117
103
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
let t = document.getElementById(W);
|
|
125
|
-
if (!t) {
|
|
104
|
+
ue(k);
|
|
105
|
+
k.id = "video-one";
|
|
106
|
+
const L = "tidal-player-root";
|
|
107
|
+
function he() {
|
|
108
|
+
let r = document.getElementById(L);
|
|
109
|
+
if (!r) {
|
|
126
110
|
const e = document.createElement("template");
|
|
127
|
-
e.id =
|
|
111
|
+
e.id = L, document.body.appendChild(e), r = document.getElementById(L);
|
|
128
112
|
}
|
|
129
|
-
return
|
|
113
|
+
return me();
|
|
130
114
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
|
|
115
|
+
function me() {
|
|
116
|
+
const r = document.getElementById(
|
|
117
|
+
L
|
|
134
118
|
);
|
|
135
|
-
return
|
|
119
|
+
return r && (k.id in r.children || r.appendChild(k)), le();
|
|
136
120
|
}
|
|
137
|
-
function
|
|
121
|
+
function pe() {
|
|
138
122
|
return new Promise(
|
|
139
|
-
(
|
|
123
|
+
(r) => document.addEventListener(
|
|
140
124
|
"click",
|
|
141
125
|
() => {
|
|
142
|
-
|
|
126
|
+
k.readyState === HTMLMediaElement.HAVE_NOTHING && !k.src && k.load(), r();
|
|
143
127
|
},
|
|
144
128
|
{ once: !0 }
|
|
145
129
|
)
|
|
146
130
|
);
|
|
147
131
|
}
|
|
148
|
-
function
|
|
149
|
-
return new Promise((e) => setTimeout(() => e(),
|
|
132
|
+
function fe(r) {
|
|
133
|
+
return new Promise((e) => setTimeout(() => e(), r));
|
|
150
134
|
}
|
|
151
|
-
function
|
|
152
|
-
return new Promise((
|
|
153
|
-
|
|
135
|
+
function ge(r, e) {
|
|
136
|
+
return new Promise((t) => {
|
|
137
|
+
r.addEventListener(e, (s) => t(s), !1);
|
|
154
138
|
});
|
|
155
139
|
}
|
|
156
|
-
class
|
|
140
|
+
class ye extends EventTarget {
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
142
|
+
// @ts-ignore - Setter
|
|
143
|
+
#e;
|
|
144
|
+
hasEventSender() {
|
|
145
|
+
return !!this.#e;
|
|
146
|
+
}
|
|
147
|
+
set eventSender(e) {
|
|
148
|
+
this.#e = e;
|
|
149
|
+
}
|
|
150
|
+
get eventSender() {
|
|
151
|
+
return this.#e;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
class we extends EventTarget {
|
|
157
155
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
158
156
|
// @ts-ignore - Setter
|
|
159
157
|
#e;
|
|
160
158
|
async dispatchAuthorized() {
|
|
161
159
|
const e = await this.#e.getCredentials();
|
|
162
|
-
e?.token
|
|
160
|
+
e?.token ? this.dispatchEvent(
|
|
163
161
|
new CustomEvent("authorized", {
|
|
164
162
|
detail: {
|
|
165
163
|
credentials: e
|
|
166
164
|
}
|
|
167
165
|
})
|
|
166
|
+
) : this.dispatchEvent(
|
|
167
|
+
new CustomEvent("unauthenticated", { detail: { credentials: e } })
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
set credentialsProvider(e) {
|
|
171
|
-
this.#e = e, this.dispatchAuthorized().catch(console.error), this.#e.bus((
|
|
172
|
-
switch (
|
|
173
|
-
case "
|
|
171
|
+
this.#e = e, this.dispatchAuthorized().catch(console.error), this.#e.bus((t) => {
|
|
172
|
+
switch (t.detail.type) {
|
|
173
|
+
case "CredentialsUpdatedMessage":
|
|
174
174
|
this.dispatchAuthorized().catch(console.error);
|
|
175
175
|
break;
|
|
176
176
|
default:
|
|
177
|
-
console.warn("Unhandled event from credentials provider: ",
|
|
177
|
+
console.warn("Unhandled event from credentials provider: ", t);
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
180
|
});
|
|
@@ -183,12 +183,12 @@ class Te extends EventTarget {
|
|
|
183
183
|
return this.#e;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
class
|
|
186
|
+
class O extends Error {
|
|
187
187
|
errorCode = null;
|
|
188
188
|
errorId = null;
|
|
189
189
|
referenceId;
|
|
190
|
-
constructor(e,
|
|
191
|
-
super(`${e}: ${
|
|
190
|
+
constructor(e, t, s) {
|
|
191
|
+
super(`${e}: ${t} (${s})`), this.errorId = e, this.errorCode = t, this.referenceId = s;
|
|
192
192
|
}
|
|
193
193
|
toJSON() {
|
|
194
194
|
return {
|
|
@@ -201,40 +201,48 @@ class V extends Error {
|
|
|
201
201
|
return JSON.stringify(this.toJSON());
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
async function
|
|
204
|
+
async function P() {
|
|
205
205
|
if (v.credentialsProvider) {
|
|
206
|
-
const
|
|
207
|
-
return !!(
|
|
208
|
-
}
|
|
209
|
-
return await
|
|
210
|
-
}
|
|
211
|
-
const v = new
|
|
212
|
-
async function
|
|
213
|
-
const
|
|
214
|
-
const { Pushkin:
|
|
215
|
-
return
|
|
216
|
-
}
|
|
217
|
-
if (
|
|
218
|
-
|
|
206
|
+
const r = await v.credentialsProvider.getCredentials();
|
|
207
|
+
return !!(r.token && r.userId);
|
|
208
|
+
}
|
|
209
|
+
return await ge(v, "authorized"), P();
|
|
210
|
+
}
|
|
211
|
+
const v = new we(), D = new ye();
|
|
212
|
+
async function be() {
|
|
213
|
+
const r = await P(), e = async () => {
|
|
214
|
+
const { Pushkin: t } = await Promise.resolve().then(() => ft);
|
|
215
|
+
return t.refresh();
|
|
216
|
+
};
|
|
217
|
+
if (r) {
|
|
218
|
+
B({
|
|
219
219
|
gatherEvents: !0
|
|
220
220
|
});
|
|
221
221
|
try {
|
|
222
|
-
await Promise.all([e()
|
|
223
|
-
} catch (
|
|
224
|
-
console.error(
|
|
222
|
+
await Promise.all([e()]);
|
|
223
|
+
} catch (t) {
|
|
224
|
+
console.error(t);
|
|
225
225
|
}
|
|
226
226
|
} else
|
|
227
|
-
|
|
227
|
+
B({
|
|
228
228
|
gatherEvents: !1
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
|
+
function ve() {
|
|
232
|
+
B({
|
|
233
|
+
gatherEvents: !0
|
|
234
|
+
});
|
|
235
|
+
}
|
|
231
236
|
v.addEventListener("authorized", () => {
|
|
232
|
-
|
|
237
|
+
be().then().catch(console.error);
|
|
233
238
|
});
|
|
234
|
-
|
|
239
|
+
v.addEventListener("unauthenticated", () => {
|
|
240
|
+
ve();
|
|
241
|
+
});
|
|
242
|
+
async function V() {
|
|
235
243
|
return v.credentialsProvider ? (await v.credentialsProvider.getCredentials()).token ?? null : null;
|
|
236
244
|
}
|
|
237
|
-
class
|
|
245
|
+
class Se extends EventTarget {
|
|
238
246
|
dispatchError(e) {
|
|
239
247
|
this.dispatchEvent(
|
|
240
248
|
new CustomEvent("error", {
|
|
@@ -243,35 +251,36 @@ class Le extends EventTarget {
|
|
|
243
251
|
);
|
|
244
252
|
}
|
|
245
253
|
}
|
|
246
|
-
const
|
|
247
|
-
class
|
|
254
|
+
const m = new Se();
|
|
255
|
+
class Me {
|
|
248
256
|
#e = /* @__PURE__ */ new Map();
|
|
249
|
-
#
|
|
257
|
+
#r = /* @__PURE__ */ new Map();
|
|
250
258
|
#s = /* @__PURE__ */ new Map();
|
|
259
|
+
#t = /* @__PURE__ */ new Map();
|
|
251
260
|
/**
|
|
252
261
|
* Clones a session to re-use the media product and playback content for a new session.
|
|
253
262
|
*
|
|
254
263
|
* @param from - streamingSessionId to clone
|
|
255
264
|
* @param to - target streamingSessionId
|
|
256
265
|
*/
|
|
257
|
-
clone(e,
|
|
266
|
+
clone(e, t) {
|
|
258
267
|
const s = this.getMediaProductTransition(e), n = this.getStreamInfo(e), o = this.getPlaybackInfo(e);
|
|
259
268
|
if (!s || !n || !o)
|
|
260
269
|
throw new Error(
|
|
261
270
|
`Cannot clone ${e}. Missing mediaProductTransition or streamInfo.`
|
|
262
271
|
);
|
|
263
|
-
this.saveMediaProductTransition(
|
|
272
|
+
this.saveMediaProductTransition(t, {
|
|
264
273
|
...s,
|
|
265
274
|
playbackContext: {
|
|
266
275
|
...s.playbackContext,
|
|
267
|
-
playbackSessionId:
|
|
276
|
+
playbackSessionId: t
|
|
268
277
|
}
|
|
269
|
-
}), this.saveStreamInfo(
|
|
278
|
+
}), this.saveStreamInfo(t, {
|
|
270
279
|
...n,
|
|
271
|
-
streamingSessionId:
|
|
272
|
-
}), this.savePlaybackInfo(
|
|
280
|
+
streamingSessionId: t
|
|
281
|
+
}), this.savePlaybackInfo(t, {
|
|
273
282
|
...o,
|
|
274
|
-
streamingSessionId:
|
|
283
|
+
streamingSessionId: t
|
|
275
284
|
});
|
|
276
285
|
}
|
|
277
286
|
deleteMediaProductTransition(e) {
|
|
@@ -284,55 +293,64 @@ class Oe {
|
|
|
284
293
|
* @see {@link StreamingSessionStore.clone}
|
|
285
294
|
*/
|
|
286
295
|
deleteSession(e) {
|
|
287
|
-
this.deleteMediaProductTransition(e), this.#
|
|
296
|
+
this.deleteMediaProductTransition(e), this.#r.delete(e), this.#s.delete(e), this.deleteStreamInfo(e);
|
|
288
297
|
}
|
|
289
|
-
|
|
298
|
+
deleteStartedStreamInfo(e) {
|
|
290
299
|
this.#s.delete(e);
|
|
291
300
|
}
|
|
301
|
+
deleteStreamInfo(e) {
|
|
302
|
+
this.#t.delete(e);
|
|
303
|
+
}
|
|
292
304
|
getMediaProductTransition(e) {
|
|
293
305
|
return e ? this.#e.get(e) : void 0;
|
|
294
306
|
}
|
|
295
307
|
getPlaybackInfo(e) {
|
|
296
|
-
return e ? this.#
|
|
308
|
+
return e ? this.#r.get(e) : void 0;
|
|
297
309
|
}
|
|
298
310
|
getStreamInfo(e) {
|
|
299
|
-
return e ? this.#
|
|
311
|
+
return e ? this.#t.get(e) : void 0;
|
|
300
312
|
}
|
|
301
313
|
hasMediaProductTransition(e) {
|
|
302
314
|
return this.#e.has(e);
|
|
303
315
|
}
|
|
304
316
|
hasPlaybackInfo(e) {
|
|
305
|
-
return this.#
|
|
317
|
+
return this.#r.has(e);
|
|
306
318
|
}
|
|
307
|
-
|
|
319
|
+
hasStartedStreamInfo(e) {
|
|
308
320
|
return this.#s.has(e);
|
|
309
321
|
}
|
|
310
|
-
|
|
322
|
+
hasStreamInfo(e) {
|
|
323
|
+
return this.#t.has(e);
|
|
324
|
+
}
|
|
325
|
+
overwriteDuration(e, t) {
|
|
311
326
|
const s = this.#e.get(e);
|
|
312
327
|
s && (s.playbackContext = {
|
|
313
328
|
...s.playbackContext,
|
|
314
|
-
actualDuration:
|
|
329
|
+
actualDuration: t
|
|
315
330
|
}, this.saveMediaProductTransition(e, s));
|
|
316
331
|
}
|
|
317
|
-
saveMediaProductTransition(e,
|
|
332
|
+
saveMediaProductTransition(e, t) {
|
|
318
333
|
this.#e.set(
|
|
319
334
|
e,
|
|
320
|
-
|
|
335
|
+
t
|
|
321
336
|
);
|
|
322
337
|
}
|
|
323
|
-
savePlaybackInfo(e,
|
|
324
|
-
this.#
|
|
338
|
+
savePlaybackInfo(e, t) {
|
|
339
|
+
this.#r.set(e, t);
|
|
340
|
+
}
|
|
341
|
+
saveStreamInfo(e, t) {
|
|
342
|
+
this.#t.set(e, t);
|
|
325
343
|
}
|
|
326
|
-
|
|
327
|
-
this.#s.set(e,
|
|
344
|
+
setStartedStreamInfo(e) {
|
|
345
|
+
return this.#s.set(e, !0);
|
|
328
346
|
}
|
|
329
347
|
}
|
|
330
|
-
const
|
|
331
|
-
class
|
|
348
|
+
const H = new Me();
|
|
349
|
+
class ke {
|
|
332
350
|
activePlayer;
|
|
333
351
|
preloadPlayer;
|
|
334
352
|
get preloadedMediaProduct() {
|
|
335
|
-
return
|
|
353
|
+
return H.getMediaProductTransition(
|
|
336
354
|
this.preloadedStreamingSessionId
|
|
337
355
|
)?.mediaProduct ?? void 0;
|
|
338
356
|
}
|
|
@@ -340,96 +358,96 @@ class Ae {
|
|
|
340
358
|
return this.preloadPlayer?.preloadedStreamingSessionId ?? void 0;
|
|
341
359
|
}
|
|
342
360
|
}
|
|
343
|
-
const p = new
|
|
344
|
-
let
|
|
345
|
-
const
|
|
361
|
+
const p = new ke();
|
|
362
|
+
let Ee;
|
|
363
|
+
const Pe = [
|
|
346
364
|
{
|
|
347
365
|
itemTypes: ["track", "video"],
|
|
348
366
|
player: "shaka",
|
|
349
367
|
qualities: ["HIGH", "LOSSLESS", "LOW", "HI_RES_LOSSLESS"]
|
|
350
368
|
}
|
|
351
369
|
];
|
|
352
|
-
let
|
|
370
|
+
let x = Pe;
|
|
353
371
|
const w = {
|
|
354
372
|
browser: void 0,
|
|
355
373
|
native: void 0,
|
|
356
374
|
shaka: void 0
|
|
357
375
|
};
|
|
358
|
-
async function
|
|
376
|
+
async function Te() {
|
|
359
377
|
await Promise.all(
|
|
360
|
-
|
|
361
|
-
const e = w[
|
|
378
|
+
x.map((r) => {
|
|
379
|
+
const e = w[r.player];
|
|
362
380
|
return e ? e.reset() : Promise.resolve();
|
|
363
381
|
})
|
|
364
382
|
), p.activePlayer = void 0, p.preloadPlayer = void 0;
|
|
365
383
|
}
|
|
366
|
-
function
|
|
367
|
-
|
|
384
|
+
function Ie(r) {
|
|
385
|
+
r.name !== "nativePlayer" && w.native && w.native.abandon(), p.activePlayer = r;
|
|
368
386
|
}
|
|
369
|
-
function
|
|
370
|
-
|
|
387
|
+
function Ae() {
|
|
388
|
+
m.removeEventListener("ended", Ee);
|
|
371
389
|
}
|
|
372
|
-
async function
|
|
373
|
-
const { default:
|
|
374
|
-
return w.native || (w.native = new
|
|
390
|
+
async function Le() {
|
|
391
|
+
const { default: r } = await import("./nativePlayer-b92CavhC-CABrQPGS.js");
|
|
392
|
+
return w.native || (w.native = new r()), w.native;
|
|
375
393
|
}
|
|
376
|
-
async function
|
|
377
|
-
const { default:
|
|
378
|
-
return w.browser || (w.browser = new
|
|
394
|
+
async function Oe() {
|
|
395
|
+
const { default: r } = await import("./browserPlayer-CXURpXdL-DjOb2ySS.js");
|
|
396
|
+
return w.browser || (w.browser = new r()), w.browser;
|
|
379
397
|
}
|
|
380
|
-
async function
|
|
381
|
-
const { default:
|
|
382
|
-
return w.shaka || (w.shaka = new
|
|
398
|
+
async function Ce() {
|
|
399
|
+
const { default: r } = await import("./shakaPlayer-D0NCOzx8-Dd1YFBoR.js");
|
|
400
|
+
return w.shaka || (w.shaka = new r()), w.shaka;
|
|
383
401
|
}
|
|
384
|
-
async function
|
|
385
|
-
const
|
|
386
|
-
(n) =>
|
|
402
|
+
async function _e(r, e) {
|
|
403
|
+
const t = x.filter((n) => n.itemTypes.includes(r)).filter(
|
|
404
|
+
(n) => r === "track" && n.qualities && e ? n.qualities.includes(e) : !0
|
|
387
405
|
);
|
|
388
|
-
|
|
406
|
+
t.length === 0 && console.error(
|
|
389
407
|
`No player found to handle audio quality "${String(
|
|
390
408
|
e
|
|
391
|
-
)}" for product type "${
|
|
392
|
-
|
|
409
|
+
)}" for product type "${r}" in player config: `,
|
|
410
|
+
x
|
|
393
411
|
);
|
|
394
|
-
const { player: s } =
|
|
412
|
+
const { player: s } = t[0];
|
|
395
413
|
switch (s) {
|
|
396
|
-
case "shaka":
|
|
397
|
-
return De();
|
|
398
414
|
case "browser":
|
|
399
|
-
return
|
|
415
|
+
return Oe();
|
|
400
416
|
case "native":
|
|
401
|
-
return
|
|
417
|
+
return Le();
|
|
418
|
+
case "shaka":
|
|
419
|
+
return Ce();
|
|
402
420
|
default:
|
|
403
421
|
throw new Error("No player found.");
|
|
404
422
|
}
|
|
405
423
|
}
|
|
406
|
-
function
|
|
424
|
+
function Fe() {
|
|
407
425
|
return p.activePlayer?.getPosition() ?? 0;
|
|
408
426
|
}
|
|
409
|
-
function
|
|
427
|
+
function Ne() {
|
|
410
428
|
return p.activePlayer?.currentMediaProduct ?? null;
|
|
411
429
|
}
|
|
412
|
-
function
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
const e =
|
|
416
|
-
|
|
430
|
+
function Be() {
|
|
431
|
+
const r = p.activePlayer;
|
|
432
|
+
if (r) {
|
|
433
|
+
const e = H.getMediaProductTransition(
|
|
434
|
+
r.currentStreamingSessionId
|
|
417
435
|
);
|
|
418
436
|
if (e)
|
|
419
437
|
return e.playbackContext;
|
|
420
438
|
}
|
|
421
439
|
}
|
|
422
|
-
function
|
|
440
|
+
function q() {
|
|
423
441
|
return p.activePlayer?.playbackState ?? "IDLE";
|
|
424
442
|
}
|
|
425
|
-
class
|
|
443
|
+
class xe {
|
|
426
444
|
#e;
|
|
427
445
|
constructor() {
|
|
428
446
|
this.#e = /* @__PURE__ */ new Map();
|
|
429
447
|
}
|
|
430
|
-
async #
|
|
448
|
+
async #r(e, t) {
|
|
431
449
|
const s = new TextEncoder().encode(
|
|
432
|
-
`${e}-${
|
|
450
|
+
`${e}-${t}`
|
|
433
451
|
), n = await crypto.subtle.digest("SHA-1", s);
|
|
434
452
|
return Array.from(new Uint8Array(n)).map((o) => o.toString(16).padStart(2, "0")).join("");
|
|
435
453
|
}
|
|
@@ -438,10 +456,10 @@ class He {
|
|
|
438
456
|
*/
|
|
439
457
|
async delete({
|
|
440
458
|
name: e,
|
|
441
|
-
streamingSessionId:
|
|
459
|
+
streamingSessionId: t
|
|
442
460
|
}) {
|
|
443
|
-
const s = await this.#
|
|
444
|
-
|
|
461
|
+
const s = await this.#r(
|
|
462
|
+
t,
|
|
445
463
|
e
|
|
446
464
|
);
|
|
447
465
|
this.#e.delete(s);
|
|
@@ -451,10 +469,10 @@ class He {
|
|
|
451
469
|
*/
|
|
452
470
|
async get({
|
|
453
471
|
name: e,
|
|
454
|
-
streamingSessionId:
|
|
472
|
+
streamingSessionId: t
|
|
455
473
|
}) {
|
|
456
|
-
const s = await this.#
|
|
457
|
-
|
|
474
|
+
const s = await this.#r(
|
|
475
|
+
t,
|
|
458
476
|
e
|
|
459
477
|
);
|
|
460
478
|
return this.#e.get(s);
|
|
@@ -463,99 +481,98 @@ class He {
|
|
|
463
481
|
* Adds or updates an event.
|
|
464
482
|
*/
|
|
465
483
|
async put(e) {
|
|
466
|
-
const
|
|
484
|
+
const t = await this.#r(
|
|
467
485
|
e.streamingSessionId,
|
|
468
486
|
e.name
|
|
469
487
|
);
|
|
470
|
-
this.#e.set(
|
|
488
|
+
this.#e.set(t, e);
|
|
471
489
|
}
|
|
472
490
|
}
|
|
473
|
-
const
|
|
474
|
-
async function
|
|
475
|
-
return
|
|
491
|
+
const R = new xe();
|
|
492
|
+
async function T(r, e) {
|
|
493
|
+
return C("gatherEvents") ? async (t) => {
|
|
476
494
|
try {
|
|
477
|
-
const s = await
|
|
478
|
-
name:
|
|
479
|
-
streamingSessionId:
|
|
495
|
+
const s = await R.get({
|
|
496
|
+
name: r,
|
|
497
|
+
streamingSessionId: t.streamingSessionId
|
|
480
498
|
}), n = Object.assign(
|
|
481
499
|
{},
|
|
482
500
|
e,
|
|
483
501
|
s ? s.payload : {},
|
|
484
|
-
|
|
502
|
+
t
|
|
485
503
|
);
|
|
486
|
-
for (const o of Object.keys(
|
|
504
|
+
for (const o of Object.keys(t)) {
|
|
487
505
|
const a = o;
|
|
488
|
-
Array.isArray(
|
|
506
|
+
Array.isArray(t[a]) && (n[a] = [
|
|
489
507
|
...e[a] || [],
|
|
490
508
|
...s && s.payload[a] || [],
|
|
491
|
-
...
|
|
509
|
+
...t[a] || []
|
|
492
510
|
]);
|
|
493
511
|
}
|
|
494
|
-
return await
|
|
495
|
-
name:
|
|
512
|
+
return await R.put({
|
|
513
|
+
name: r,
|
|
496
514
|
payload: n,
|
|
497
|
-
streamingSessionId:
|
|
515
|
+
streamingSessionId: t.streamingSessionId
|
|
498
516
|
}), {
|
|
499
|
-
name:
|
|
517
|
+
name: r,
|
|
500
518
|
payload: n,
|
|
501
|
-
streamingSessionId:
|
|
519
|
+
streamingSessionId: t.streamingSessionId
|
|
502
520
|
};
|
|
503
521
|
} catch (s) {
|
|
504
522
|
console.error(s);
|
|
505
523
|
}
|
|
506
|
-
} : (
|
|
524
|
+
} : (t) => Promise.resolve(void 0);
|
|
507
525
|
}
|
|
508
|
-
const
|
|
526
|
+
const Re = {
|
|
509
527
|
endReason: "COMPLETE",
|
|
510
528
|
endTimestamp: 0,
|
|
511
529
|
errorCode: null,
|
|
512
530
|
errorMessage: null,
|
|
513
531
|
startTimestamp: 0,
|
|
514
532
|
streamingSessionId: ""
|
|
515
|
-
},
|
|
533
|
+
}, De = await T(
|
|
516
534
|
"drm_license_fetch",
|
|
517
|
-
|
|
535
|
+
Re
|
|
518
536
|
);
|
|
519
|
-
function
|
|
520
|
-
return
|
|
537
|
+
function Rt(r) {
|
|
538
|
+
return De(r);
|
|
521
539
|
}
|
|
522
|
-
const
|
|
540
|
+
const He = {
|
|
523
541
|
endReason: "COMPLETE",
|
|
524
542
|
endTimestamp: 0,
|
|
525
543
|
errorCode: null,
|
|
526
544
|
errorMessage: null,
|
|
527
545
|
startTimestamp: 0,
|
|
528
546
|
streamingSessionId: ""
|
|
529
|
-
},
|
|
547
|
+
}, Ue = await T(
|
|
530
548
|
"playback_info_fetch",
|
|
531
|
-
|
|
549
|
+
He
|
|
532
550
|
);
|
|
533
|
-
function
|
|
534
|
-
return
|
|
551
|
+
function F(r) {
|
|
552
|
+
return Ue(r);
|
|
535
553
|
}
|
|
536
|
-
function
|
|
537
|
-
switch (
|
|
554
|
+
function Dt(r) {
|
|
555
|
+
switch (r) {
|
|
538
556
|
case "bluetooth":
|
|
539
557
|
return "BLUETOOTH";
|
|
540
|
-
case "displayPort":
|
|
541
|
-
return "DISPLAY_PORT";
|
|
542
|
-
case "mqa":
|
|
543
|
-
return "MQA";
|
|
544
558
|
case "builtIn":
|
|
545
559
|
return "BUILT_IN";
|
|
560
|
+
case "displayPort":
|
|
561
|
+
return "DISPLAY_PORT";
|
|
546
562
|
case "hdmi":
|
|
547
563
|
return "HDMI";
|
|
548
|
-
case "usb":
|
|
549
|
-
return "USB";
|
|
550
564
|
case "systemDefault":
|
|
551
565
|
return "SYSTEM_DEFAULT";
|
|
552
|
-
case "
|
|
566
|
+
case "usb":
|
|
567
|
+
return "USB";
|
|
568
|
+
// Never happens (cannot be chose by user)
|
|
553
569
|
case "airplay":
|
|
570
|
+
case "windowsCommunication":
|
|
554
571
|
default:
|
|
555
572
|
return;
|
|
556
573
|
}
|
|
557
574
|
}
|
|
558
|
-
const
|
|
575
|
+
const Ve = {
|
|
559
576
|
actualAssetPresentation: "FULL",
|
|
560
577
|
actualAudioMode: "STEREO",
|
|
561
578
|
actualProductId: null,
|
|
@@ -575,24 +592,24 @@ const Qe = {
|
|
|
575
592
|
productType: "TRACK",
|
|
576
593
|
stalls: [],
|
|
577
594
|
streamingSessionId: ""
|
|
578
|
-
},
|
|
595
|
+
}, ze = await T(
|
|
579
596
|
"playback_statistics",
|
|
580
|
-
|
|
597
|
+
Ve
|
|
581
598
|
);
|
|
582
|
-
function
|
|
583
|
-
return
|
|
599
|
+
function z(r) {
|
|
600
|
+
return ze(r);
|
|
584
601
|
}
|
|
585
|
-
const
|
|
602
|
+
const We = {
|
|
586
603
|
streamingSessionId: "",
|
|
587
604
|
timestamp: 0
|
|
588
|
-
},
|
|
605
|
+
}, $e = await T(
|
|
589
606
|
"streaming_session_end",
|
|
590
|
-
|
|
607
|
+
We
|
|
591
608
|
);
|
|
592
|
-
function
|
|
593
|
-
return
|
|
609
|
+
function qe(r) {
|
|
610
|
+
return $e(r);
|
|
594
611
|
}
|
|
595
|
-
const
|
|
612
|
+
const Qe = {
|
|
596
613
|
"Amazon Silk": "amazon_silk",
|
|
597
614
|
"Android Browser": "android",
|
|
598
615
|
Bada: "bada",
|
|
@@ -614,6 +631,7 @@ const Ze = {
|
|
|
614
631
|
"NAVER Whale Browser": "naver",
|
|
615
632
|
Opera: "opera",
|
|
616
633
|
"Opera Coast": "opera_coast",
|
|
634
|
+
"Pale Moon": "pale_moon",
|
|
617
635
|
PhantomJS: "phantomjs",
|
|
618
636
|
Puffin: "puffin",
|
|
619
637
|
QupZilla: "qupzilla",
|
|
@@ -632,7 +650,7 @@ const Ze = {
|
|
|
632
650
|
WeChat: "wechat",
|
|
633
651
|
"Yandex Browser": "yandex",
|
|
634
652
|
Roku: "roku"
|
|
635
|
-
},
|
|
653
|
+
}, Q = {
|
|
636
654
|
amazon_silk: "Amazon Silk",
|
|
637
655
|
android: "Android Browser",
|
|
638
656
|
bada: "Bada",
|
|
@@ -654,6 +672,7 @@ const Ze = {
|
|
|
654
672
|
naver: "NAVER Whale Browser",
|
|
655
673
|
opera: "Opera",
|
|
656
674
|
opera_coast: "Opera Coast",
|
|
675
|
+
pale_moon: "Pale Moon",
|
|
657
676
|
phantomjs: "PhantomJS",
|
|
658
677
|
puffin: "Puffin",
|
|
659
678
|
qupzilla: "QupZilla",
|
|
@@ -671,11 +690,12 @@ const Ze = {
|
|
|
671
690
|
webos: "WebOS Browser",
|
|
672
691
|
wechat: "WeChat",
|
|
673
692
|
yandex: "Yandex Browser"
|
|
674
|
-
},
|
|
693
|
+
}, h = {
|
|
675
694
|
tablet: "tablet",
|
|
676
695
|
mobile: "mobile",
|
|
677
696
|
desktop: "desktop",
|
|
678
|
-
tv: "tv"
|
|
697
|
+
tv: "tv",
|
|
698
|
+
bot: "bot"
|
|
679
699
|
}, g = {
|
|
680
700
|
WindowsPhone: "Windows Phone",
|
|
681
701
|
Windows: "Windows",
|
|
@@ -690,7 +710,7 @@ const Ze = {
|
|
|
690
710
|
ChromeOS: "Chrome OS",
|
|
691
711
|
PlayStation4: "PlayStation 4",
|
|
692
712
|
Roku: "Roku"
|
|
693
|
-
},
|
|
713
|
+
}, S = {
|
|
694
714
|
EdgeHTML: "EdgeHTML",
|
|
695
715
|
Blink: "Blink",
|
|
696
716
|
Trident: "Trident",
|
|
@@ -705,8 +725,8 @@ class i {
|
|
|
705
725
|
* @param {String} ua
|
|
706
726
|
* @return {Array|{index: number, input: string}|*|boolean|string}
|
|
707
727
|
*/
|
|
708
|
-
static getFirstMatch(e,
|
|
709
|
-
const s =
|
|
728
|
+
static getFirstMatch(e, t) {
|
|
729
|
+
const s = t.match(e);
|
|
710
730
|
return s && s.length > 0 && s[1] || "";
|
|
711
731
|
}
|
|
712
732
|
/**
|
|
@@ -715,8 +735,8 @@ class i {
|
|
|
715
735
|
* @param {String} ua
|
|
716
736
|
* @return {Array|{index: number, input: string}|*|boolean|string}
|
|
717
737
|
*/
|
|
718
|
-
static getSecondMatch(e,
|
|
719
|
-
const s =
|
|
738
|
+
static getSecondMatch(e, t) {
|
|
739
|
+
const s = t.match(e);
|
|
720
740
|
return s && s.length > 1 && s[2] || "";
|
|
721
741
|
}
|
|
722
742
|
/**
|
|
@@ -726,8 +746,8 @@ class i {
|
|
|
726
746
|
* @param {*} _const Any const that will be returned if regexp matches the string
|
|
727
747
|
* @return {*}
|
|
728
748
|
*/
|
|
729
|
-
static matchAndReturnConst(e,
|
|
730
|
-
if (e.test(
|
|
749
|
+
static matchAndReturnConst(e, t, s) {
|
|
750
|
+
if (e.test(t))
|
|
731
751
|
return s;
|
|
732
752
|
}
|
|
733
753
|
static getWindowsVersionName(e) {
|
|
@@ -777,9 +797,9 @@ class i {
|
|
|
777
797
|
* @return {string} versionName
|
|
778
798
|
*/
|
|
779
799
|
static getMacOSVersionName(e) {
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
782
|
-
switch (
|
|
800
|
+
const t = e.split(".").splice(0, 2).map((s) => parseInt(s, 10) || 0);
|
|
801
|
+
if (t.push(0), t[0] === 10)
|
|
802
|
+
switch (t[1]) {
|
|
783
803
|
case 5:
|
|
784
804
|
return "Leopard";
|
|
785
805
|
case 6:
|
|
@@ -831,36 +851,22 @@ class i {
|
|
|
831
851
|
* @return {string} versionName
|
|
832
852
|
*/
|
|
833
853
|
static getAndroidVersionName(e) {
|
|
834
|
-
const
|
|
835
|
-
if (
|
|
836
|
-
if (
|
|
837
|
-
|
|
838
|
-
if (
|
|
839
|
-
|
|
840
|
-
if (
|
|
841
|
-
|
|
842
|
-
if (
|
|
843
|
-
|
|
844
|
-
if (
|
|
845
|
-
|
|
846
|
-
if (
|
|
847
|
-
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
if (r[0] === 4 && r[1] < 4)
|
|
851
|
-
return "Jelly Bean";
|
|
852
|
-
if (r[0] === 4 && r[1] >= 4)
|
|
853
|
-
return "KitKat";
|
|
854
|
-
if (r[0] === 5)
|
|
855
|
-
return "Lollipop";
|
|
856
|
-
if (r[0] === 6)
|
|
857
|
-
return "Marshmallow";
|
|
858
|
-
if (r[0] === 7)
|
|
859
|
-
return "Nougat";
|
|
860
|
-
if (r[0] === 8)
|
|
861
|
-
return "Oreo";
|
|
862
|
-
if (r[0] === 9)
|
|
863
|
-
return "Pie";
|
|
854
|
+
const t = e.split(".").splice(0, 2).map((s) => parseInt(s, 10) || 0);
|
|
855
|
+
if (t.push(0), !(t[0] === 1 && t[1] < 5)) {
|
|
856
|
+
if (t[0] === 1 && t[1] < 6) return "Cupcake";
|
|
857
|
+
if (t[0] === 1 && t[1] >= 6) return "Donut";
|
|
858
|
+
if (t[0] === 2 && t[1] < 2) return "Eclair";
|
|
859
|
+
if (t[0] === 2 && t[1] === 2) return "Froyo";
|
|
860
|
+
if (t[0] === 2 && t[1] > 2) return "Gingerbread";
|
|
861
|
+
if (t[0] === 3) return "Honeycomb";
|
|
862
|
+
if (t[0] === 4 && t[1] < 1) return "Ice Cream Sandwich";
|
|
863
|
+
if (t[0] === 4 && t[1] < 4) return "Jelly Bean";
|
|
864
|
+
if (t[0] === 4 && t[1] >= 4) return "KitKat";
|
|
865
|
+
if (t[0] === 5) return "Lollipop";
|
|
866
|
+
if (t[0] === 6) return "Marshmallow";
|
|
867
|
+
if (t[0] === 7) return "Nougat";
|
|
868
|
+
if (t[0] === 8) return "Oreo";
|
|
869
|
+
if (t[0] === 9) return "Pie";
|
|
864
870
|
}
|
|
865
871
|
}
|
|
866
872
|
/**
|
|
@@ -892,21 +898,21 @@ class i {
|
|
|
892
898
|
* 1 when versionA is bigger, 0 when both equal
|
|
893
899
|
*/
|
|
894
900
|
/* eslint consistent-return: 1 */
|
|
895
|
-
static compareVersions(e,
|
|
896
|
-
const n = i.getVersionPrecision(e), o = i.getVersionPrecision(
|
|
901
|
+
static compareVersions(e, t, s = !1) {
|
|
902
|
+
const n = i.getVersionPrecision(e), o = i.getVersionPrecision(t);
|
|
897
903
|
let a = Math.max(n, o), c = 0;
|
|
898
|
-
const
|
|
899
|
-
const b = a - i.getVersionPrecision(d),
|
|
900
|
-
return i.map(
|
|
904
|
+
const u = i.map([e, t], (d) => {
|
|
905
|
+
const b = a - i.getVersionPrecision(d), M = d + new Array(b + 1).join(".0");
|
|
906
|
+
return i.map(M.split("."), (f) => new Array(20 - f.length).join("0") + f).reverse();
|
|
901
907
|
});
|
|
902
908
|
for (s && (c = a - Math.min(n, o)), a -= 1; a >= c; ) {
|
|
903
|
-
if (
|
|
909
|
+
if (u[0][a] > u[1][a])
|
|
904
910
|
return 1;
|
|
905
|
-
if (
|
|
911
|
+
if (u[0][a] === u[1][a]) {
|
|
906
912
|
if (a === c)
|
|
907
913
|
return 0;
|
|
908
914
|
a -= 1;
|
|
909
|
-
} else if (
|
|
915
|
+
} else if (u[0][a] < u[1][a])
|
|
910
916
|
return -1;
|
|
911
917
|
}
|
|
912
918
|
}
|
|
@@ -917,13 +923,13 @@ class i {
|
|
|
917
923
|
* @param {Function} iterator
|
|
918
924
|
* @return {Array}
|
|
919
925
|
*/
|
|
920
|
-
static map(e,
|
|
926
|
+
static map(e, t) {
|
|
921
927
|
const s = [];
|
|
922
928
|
let n;
|
|
923
929
|
if (Array.prototype.map)
|
|
924
|
-
return Array.prototype.map.call(e,
|
|
930
|
+
return Array.prototype.map.call(e, t);
|
|
925
931
|
for (n = 0; n < e.length; n += 1)
|
|
926
|
-
s.push(
|
|
932
|
+
s.push(t(e[n]));
|
|
927
933
|
return s;
|
|
928
934
|
}
|
|
929
935
|
/**
|
|
@@ -933,13 +939,13 @@ class i {
|
|
|
933
939
|
* @param {Function} predicate
|
|
934
940
|
* @return {Array}
|
|
935
941
|
*/
|
|
936
|
-
static find(e,
|
|
942
|
+
static find(e, t) {
|
|
937
943
|
let s, n;
|
|
938
944
|
if (Array.prototype.find)
|
|
939
|
-
return Array.prototype.find.call(e,
|
|
945
|
+
return Array.prototype.find.call(e, t);
|
|
940
946
|
for (s = 0, n = e.length; s < n; s += 1) {
|
|
941
947
|
const o = e[s];
|
|
942
|
-
if (
|
|
948
|
+
if (t(o, s))
|
|
943
949
|
return o;
|
|
944
950
|
}
|
|
945
951
|
}
|
|
@@ -950,13 +956,13 @@ class i {
|
|
|
950
956
|
* @param {Object} ...objs
|
|
951
957
|
* @return {Object}
|
|
952
958
|
*/
|
|
953
|
-
static assign(e, ...
|
|
959
|
+
static assign(e, ...t) {
|
|
954
960
|
const s = e;
|
|
955
961
|
let n, o;
|
|
956
962
|
if (Object.assign)
|
|
957
|
-
return Object.assign(e, ...
|
|
958
|
-
for (n = 0, o =
|
|
959
|
-
const a =
|
|
963
|
+
return Object.assign(e, ...t);
|
|
964
|
+
for (n = 0, o = t.length; n < o; n += 1) {
|
|
965
|
+
const a = t[n];
|
|
960
966
|
typeof a == "object" && a !== null && Object.keys(a).forEach((c) => {
|
|
961
967
|
s[c] = a[c];
|
|
962
968
|
});
|
|
@@ -973,426 +979,435 @@ class i {
|
|
|
973
979
|
* @return {string}
|
|
974
980
|
*/
|
|
975
981
|
static getBrowserAlias(e) {
|
|
976
|
-
return
|
|
982
|
+
return Qe[e];
|
|
977
983
|
}
|
|
978
984
|
/**
|
|
979
|
-
* Get
|
|
985
|
+
* Get browser name for a short version/alias
|
|
980
986
|
*
|
|
981
987
|
* @example
|
|
982
|
-
*
|
|
988
|
+
* getBrowserTypeByAlias('edge') // Microsoft Edge
|
|
983
989
|
*
|
|
984
990
|
* @param {string} browserAlias
|
|
985
991
|
* @return {string}
|
|
986
992
|
*/
|
|
987
993
|
static getBrowserTypeByAlias(e) {
|
|
988
|
-
return
|
|
994
|
+
return Q[e] || "";
|
|
989
995
|
}
|
|
990
996
|
}
|
|
991
|
-
const
|
|
997
|
+
const l = /version\/(\d+(\.?_?\d+)+)/i, Ge = [
|
|
992
998
|
/* Googlebot */
|
|
993
999
|
{
|
|
994
1000
|
test: [/googlebot/i],
|
|
995
|
-
describe(
|
|
1001
|
+
describe(r) {
|
|
996
1002
|
const e = {
|
|
997
1003
|
name: "Googlebot"
|
|
998
|
-
},
|
|
999
|
-
return
|
|
1004
|
+
}, t = i.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, r) || i.getFirstMatch(l, r);
|
|
1005
|
+
return t && (e.version = t), e;
|
|
1000
1006
|
}
|
|
1001
1007
|
},
|
|
1002
1008
|
/* Opera < 13.0 */
|
|
1003
1009
|
{
|
|
1004
1010
|
test: [/opera/i],
|
|
1005
|
-
describe(
|
|
1011
|
+
describe(r) {
|
|
1006
1012
|
const e = {
|
|
1007
1013
|
name: "Opera"
|
|
1008
|
-
},
|
|
1009
|
-
return
|
|
1014
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1015
|
+
return t && (e.version = t), e;
|
|
1010
1016
|
}
|
|
1011
1017
|
},
|
|
1012
1018
|
/* Opera > 13.0 */
|
|
1013
1019
|
{
|
|
1014
1020
|
test: [/opr\/|opios/i],
|
|
1015
|
-
describe(
|
|
1021
|
+
describe(r) {
|
|
1016
1022
|
const e = {
|
|
1017
1023
|
name: "Opera"
|
|
1018
|
-
},
|
|
1019
|
-
return
|
|
1024
|
+
}, t = i.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, r) || i.getFirstMatch(l, r);
|
|
1025
|
+
return t && (e.version = t), e;
|
|
1020
1026
|
}
|
|
1021
1027
|
},
|
|
1022
1028
|
{
|
|
1023
1029
|
test: [/SamsungBrowser/i],
|
|
1024
|
-
describe(
|
|
1030
|
+
describe(r) {
|
|
1025
1031
|
const e = {
|
|
1026
1032
|
name: "Samsung Internet for Android"
|
|
1027
|
-
},
|
|
1028
|
-
return
|
|
1033
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1034
|
+
return t && (e.version = t), e;
|
|
1029
1035
|
}
|
|
1030
1036
|
},
|
|
1031
1037
|
{
|
|
1032
1038
|
test: [/Whale/i],
|
|
1033
|
-
describe(
|
|
1039
|
+
describe(r) {
|
|
1034
1040
|
const e = {
|
|
1035
1041
|
name: "NAVER Whale Browser"
|
|
1036
|
-
},
|
|
1037
|
-
return
|
|
1042
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, r);
|
|
1043
|
+
return t && (e.version = t), e;
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
test: [/PaleMoon/i],
|
|
1048
|
+
describe(r) {
|
|
1049
|
+
const e = {
|
|
1050
|
+
name: "Pale Moon"
|
|
1051
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i, r);
|
|
1052
|
+
return t && (e.version = t), e;
|
|
1038
1053
|
}
|
|
1039
1054
|
},
|
|
1040
1055
|
{
|
|
1041
1056
|
test: [/MZBrowser/i],
|
|
1042
|
-
describe(
|
|
1057
|
+
describe(r) {
|
|
1043
1058
|
const e = {
|
|
1044
1059
|
name: "MZ Browser"
|
|
1045
|
-
},
|
|
1046
|
-
return
|
|
1060
|
+
}, t = i.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1061
|
+
return t && (e.version = t), e;
|
|
1047
1062
|
}
|
|
1048
1063
|
},
|
|
1049
1064
|
{
|
|
1050
1065
|
test: [/focus/i],
|
|
1051
|
-
describe(
|
|
1066
|
+
describe(r) {
|
|
1052
1067
|
const e = {
|
|
1053
1068
|
name: "Focus"
|
|
1054
|
-
},
|
|
1055
|
-
return
|
|
1069
|
+
}, t = i.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1070
|
+
return t && (e.version = t), e;
|
|
1056
1071
|
}
|
|
1057
1072
|
},
|
|
1058
1073
|
{
|
|
1059
1074
|
test: [/swing/i],
|
|
1060
|
-
describe(
|
|
1075
|
+
describe(r) {
|
|
1061
1076
|
const e = {
|
|
1062
1077
|
name: "Swing"
|
|
1063
|
-
},
|
|
1064
|
-
return
|
|
1078
|
+
}, t = i.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1079
|
+
return t && (e.version = t), e;
|
|
1065
1080
|
}
|
|
1066
1081
|
},
|
|
1067
1082
|
{
|
|
1068
1083
|
test: [/coast/i],
|
|
1069
|
-
describe(
|
|
1084
|
+
describe(r) {
|
|
1070
1085
|
const e = {
|
|
1071
1086
|
name: "Opera Coast"
|
|
1072
|
-
},
|
|
1073
|
-
return
|
|
1087
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1088
|
+
return t && (e.version = t), e;
|
|
1074
1089
|
}
|
|
1075
1090
|
},
|
|
1076
1091
|
{
|
|
1077
1092
|
test: [/opt\/\d+(?:.?_?\d+)+/i],
|
|
1078
|
-
describe(
|
|
1093
|
+
describe(r) {
|
|
1079
1094
|
const e = {
|
|
1080
1095
|
name: "Opera Touch"
|
|
1081
|
-
},
|
|
1082
|
-
return
|
|
1096
|
+
}, t = i.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1097
|
+
return t && (e.version = t), e;
|
|
1083
1098
|
}
|
|
1084
1099
|
},
|
|
1085
1100
|
{
|
|
1086
1101
|
test: [/yabrowser/i],
|
|
1087
|
-
describe(
|
|
1102
|
+
describe(r) {
|
|
1088
1103
|
const e = {
|
|
1089
1104
|
name: "Yandex Browser"
|
|
1090
|
-
},
|
|
1091
|
-
return
|
|
1105
|
+
}, t = i.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1106
|
+
return t && (e.version = t), e;
|
|
1092
1107
|
}
|
|
1093
1108
|
},
|
|
1094
1109
|
{
|
|
1095
1110
|
test: [/ucbrowser/i],
|
|
1096
|
-
describe(
|
|
1111
|
+
describe(r) {
|
|
1097
1112
|
const e = {
|
|
1098
1113
|
name: "UC Browser"
|
|
1099
|
-
},
|
|
1100
|
-
return
|
|
1114
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1115
|
+
return t && (e.version = t), e;
|
|
1101
1116
|
}
|
|
1102
1117
|
},
|
|
1103
1118
|
{
|
|
1104
1119
|
test: [/Maxthon|mxios/i],
|
|
1105
|
-
describe(
|
|
1120
|
+
describe(r) {
|
|
1106
1121
|
const e = {
|
|
1107
1122
|
name: "Maxthon"
|
|
1108
|
-
},
|
|
1109
|
-
return
|
|
1123
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1124
|
+
return t && (e.version = t), e;
|
|
1110
1125
|
}
|
|
1111
1126
|
},
|
|
1112
1127
|
{
|
|
1113
1128
|
test: [/epiphany/i],
|
|
1114
|
-
describe(
|
|
1129
|
+
describe(r) {
|
|
1115
1130
|
const e = {
|
|
1116
1131
|
name: "Epiphany"
|
|
1117
|
-
},
|
|
1118
|
-
return
|
|
1132
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1133
|
+
return t && (e.version = t), e;
|
|
1119
1134
|
}
|
|
1120
1135
|
},
|
|
1121
1136
|
{
|
|
1122
1137
|
test: [/puffin/i],
|
|
1123
|
-
describe(
|
|
1138
|
+
describe(r) {
|
|
1124
1139
|
const e = {
|
|
1125
1140
|
name: "Puffin"
|
|
1126
|
-
},
|
|
1127
|
-
return
|
|
1141
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1142
|
+
return t && (e.version = t), e;
|
|
1128
1143
|
}
|
|
1129
1144
|
},
|
|
1130
1145
|
{
|
|
1131
1146
|
test: [/sleipnir/i],
|
|
1132
|
-
describe(
|
|
1147
|
+
describe(r) {
|
|
1133
1148
|
const e = {
|
|
1134
1149
|
name: "Sleipnir"
|
|
1135
|
-
},
|
|
1136
|
-
return
|
|
1150
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1151
|
+
return t && (e.version = t), e;
|
|
1137
1152
|
}
|
|
1138
1153
|
},
|
|
1139
1154
|
{
|
|
1140
1155
|
test: [/k-meleon/i],
|
|
1141
|
-
describe(
|
|
1156
|
+
describe(r) {
|
|
1142
1157
|
const e = {
|
|
1143
1158
|
name: "K-Meleon"
|
|
1144
|
-
},
|
|
1145
|
-
return
|
|
1159
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1160
|
+
return t && (e.version = t), e;
|
|
1146
1161
|
}
|
|
1147
1162
|
},
|
|
1148
1163
|
{
|
|
1149
1164
|
test: [/micromessenger/i],
|
|
1150
|
-
describe(
|
|
1165
|
+
describe(r) {
|
|
1151
1166
|
const e = {
|
|
1152
1167
|
name: "WeChat"
|
|
1153
|
-
},
|
|
1154
|
-
return
|
|
1168
|
+
}, t = i.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1169
|
+
return t && (e.version = t), e;
|
|
1155
1170
|
}
|
|
1156
1171
|
},
|
|
1157
1172
|
{
|
|
1158
1173
|
test: [/qqbrowser/i],
|
|
1159
|
-
describe(
|
|
1174
|
+
describe(r) {
|
|
1160
1175
|
const e = {
|
|
1161
|
-
name: /qqbrowserlite/i.test(
|
|
1162
|
-
},
|
|
1163
|
-
return
|
|
1176
|
+
name: /qqbrowserlite/i.test(r) ? "QQ Browser Lite" : "QQ Browser"
|
|
1177
|
+
}, t = i.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1178
|
+
return t && (e.version = t), e;
|
|
1164
1179
|
}
|
|
1165
1180
|
},
|
|
1166
1181
|
{
|
|
1167
1182
|
test: [/msie|trident/i],
|
|
1168
|
-
describe(
|
|
1183
|
+
describe(r) {
|
|
1169
1184
|
const e = {
|
|
1170
1185
|
name: "Internet Explorer"
|
|
1171
|
-
},
|
|
1172
|
-
return
|
|
1186
|
+
}, t = i.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, r);
|
|
1187
|
+
return t && (e.version = t), e;
|
|
1173
1188
|
}
|
|
1174
1189
|
},
|
|
1175
1190
|
{
|
|
1176
1191
|
test: [/\sedg\//i],
|
|
1177
|
-
describe(
|
|
1192
|
+
describe(r) {
|
|
1178
1193
|
const e = {
|
|
1179
1194
|
name: "Microsoft Edge"
|
|
1180
|
-
},
|
|
1181
|
-
return
|
|
1195
|
+
}, t = i.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, r);
|
|
1196
|
+
return t && (e.version = t), e;
|
|
1182
1197
|
}
|
|
1183
1198
|
},
|
|
1184
1199
|
{
|
|
1185
1200
|
test: [/edg([ea]|ios)/i],
|
|
1186
|
-
describe(
|
|
1201
|
+
describe(r) {
|
|
1187
1202
|
const e = {
|
|
1188
1203
|
name: "Microsoft Edge"
|
|
1189
|
-
},
|
|
1190
|
-
return
|
|
1204
|
+
}, t = i.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1205
|
+
return t && (e.version = t), e;
|
|
1191
1206
|
}
|
|
1192
1207
|
},
|
|
1193
1208
|
{
|
|
1194
1209
|
test: [/vivaldi/i],
|
|
1195
|
-
describe(
|
|
1210
|
+
describe(r) {
|
|
1196
1211
|
const e = {
|
|
1197
1212
|
name: "Vivaldi"
|
|
1198
|
-
},
|
|
1199
|
-
return
|
|
1213
|
+
}, t = i.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, r);
|
|
1214
|
+
return t && (e.version = t), e;
|
|
1200
1215
|
}
|
|
1201
1216
|
},
|
|
1202
1217
|
{
|
|
1203
1218
|
test: [/seamonkey/i],
|
|
1204
|
-
describe(
|
|
1219
|
+
describe(r) {
|
|
1205
1220
|
const e = {
|
|
1206
1221
|
name: "SeaMonkey"
|
|
1207
|
-
},
|
|
1208
|
-
return
|
|
1222
|
+
}, t = i.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, r);
|
|
1223
|
+
return t && (e.version = t), e;
|
|
1209
1224
|
}
|
|
1210
1225
|
},
|
|
1211
1226
|
{
|
|
1212
1227
|
test: [/sailfish/i],
|
|
1213
|
-
describe(
|
|
1228
|
+
describe(r) {
|
|
1214
1229
|
const e = {
|
|
1215
1230
|
name: "Sailfish"
|
|
1216
|
-
},
|
|
1217
|
-
return
|
|
1231
|
+
}, t = i.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, r);
|
|
1232
|
+
return t && (e.version = t), e;
|
|
1218
1233
|
}
|
|
1219
1234
|
},
|
|
1220
1235
|
{
|
|
1221
1236
|
test: [/silk/i],
|
|
1222
|
-
describe(
|
|
1237
|
+
describe(r) {
|
|
1223
1238
|
const e = {
|
|
1224
1239
|
name: "Amazon Silk"
|
|
1225
|
-
},
|
|
1226
|
-
return
|
|
1240
|
+
}, t = i.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, r);
|
|
1241
|
+
return t && (e.version = t), e;
|
|
1227
1242
|
}
|
|
1228
1243
|
},
|
|
1229
1244
|
{
|
|
1230
1245
|
test: [/phantom/i],
|
|
1231
|
-
describe(
|
|
1246
|
+
describe(r) {
|
|
1232
1247
|
const e = {
|
|
1233
1248
|
name: "PhantomJS"
|
|
1234
|
-
},
|
|
1235
|
-
return
|
|
1249
|
+
}, t = i.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, r);
|
|
1250
|
+
return t && (e.version = t), e;
|
|
1236
1251
|
}
|
|
1237
1252
|
},
|
|
1238
1253
|
{
|
|
1239
1254
|
test: [/slimerjs/i],
|
|
1240
|
-
describe(
|
|
1255
|
+
describe(r) {
|
|
1241
1256
|
const e = {
|
|
1242
1257
|
name: "SlimerJS"
|
|
1243
|
-
},
|
|
1244
|
-
return
|
|
1258
|
+
}, t = i.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, r);
|
|
1259
|
+
return t && (e.version = t), e;
|
|
1245
1260
|
}
|
|
1246
1261
|
},
|
|
1247
1262
|
{
|
|
1248
1263
|
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
1249
|
-
describe(
|
|
1264
|
+
describe(r) {
|
|
1250
1265
|
const e = {
|
|
1251
1266
|
name: "BlackBerry"
|
|
1252
|
-
},
|
|
1253
|
-
return
|
|
1267
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, r);
|
|
1268
|
+
return t && (e.version = t), e;
|
|
1254
1269
|
}
|
|
1255
1270
|
},
|
|
1256
1271
|
{
|
|
1257
1272
|
test: [/(web|hpw)[o0]s/i],
|
|
1258
|
-
describe(
|
|
1273
|
+
describe(r) {
|
|
1259
1274
|
const e = {
|
|
1260
1275
|
name: "WebOS Browser"
|
|
1261
|
-
},
|
|
1262
|
-
return
|
|
1276
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, r);
|
|
1277
|
+
return t && (e.version = t), e;
|
|
1263
1278
|
}
|
|
1264
1279
|
},
|
|
1265
1280
|
{
|
|
1266
1281
|
test: [/bada/i],
|
|
1267
|
-
describe(
|
|
1282
|
+
describe(r) {
|
|
1268
1283
|
const e = {
|
|
1269
1284
|
name: "Bada"
|
|
1270
|
-
},
|
|
1271
|
-
return
|
|
1285
|
+
}, t = i.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, r);
|
|
1286
|
+
return t && (e.version = t), e;
|
|
1272
1287
|
}
|
|
1273
1288
|
},
|
|
1274
1289
|
{
|
|
1275
1290
|
test: [/tizen/i],
|
|
1276
|
-
describe(
|
|
1291
|
+
describe(r) {
|
|
1277
1292
|
const e = {
|
|
1278
1293
|
name: "Tizen"
|
|
1279
|
-
},
|
|
1280
|
-
return
|
|
1294
|
+
}, t = i.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1295
|
+
return t && (e.version = t), e;
|
|
1281
1296
|
}
|
|
1282
1297
|
},
|
|
1283
1298
|
{
|
|
1284
1299
|
test: [/qupzilla/i],
|
|
1285
|
-
describe(
|
|
1300
|
+
describe(r) {
|
|
1286
1301
|
const e = {
|
|
1287
1302
|
name: "QupZilla"
|
|
1288
|
-
},
|
|
1289
|
-
return
|
|
1303
|
+
}, t = i.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1304
|
+
return t && (e.version = t), e;
|
|
1290
1305
|
}
|
|
1291
1306
|
},
|
|
1292
1307
|
{
|
|
1293
1308
|
test: [/firefox|iceweasel|fxios/i],
|
|
1294
|
-
describe(
|
|
1309
|
+
describe(r) {
|
|
1295
1310
|
const e = {
|
|
1296
1311
|
name: "Firefox"
|
|
1297
|
-
},
|
|
1298
|
-
return
|
|
1312
|
+
}, t = i.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1313
|
+
return t && (e.version = t), e;
|
|
1299
1314
|
}
|
|
1300
1315
|
},
|
|
1301
1316
|
{
|
|
1302
1317
|
test: [/electron/i],
|
|
1303
|
-
describe(
|
|
1318
|
+
describe(r) {
|
|
1304
1319
|
const e = {
|
|
1305
1320
|
name: "Electron"
|
|
1306
|
-
},
|
|
1307
|
-
return
|
|
1321
|
+
}, t = i.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1322
|
+
return t && (e.version = t), e;
|
|
1308
1323
|
}
|
|
1309
1324
|
},
|
|
1310
1325
|
{
|
|
1311
1326
|
test: [/MiuiBrowser/i],
|
|
1312
|
-
describe(
|
|
1327
|
+
describe(r) {
|
|
1313
1328
|
const e = {
|
|
1314
1329
|
name: "Miui"
|
|
1315
|
-
},
|
|
1316
|
-
return
|
|
1330
|
+
}, t = i.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1331
|
+
return t && (e.version = t), e;
|
|
1317
1332
|
}
|
|
1318
1333
|
},
|
|
1319
1334
|
{
|
|
1320
1335
|
test: [/chromium/i],
|
|
1321
|
-
describe(
|
|
1336
|
+
describe(r) {
|
|
1322
1337
|
const e = {
|
|
1323
1338
|
name: "Chromium"
|
|
1324
|
-
},
|
|
1325
|
-
return
|
|
1339
|
+
}, t = i.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1340
|
+
return t && (e.version = t), e;
|
|
1326
1341
|
}
|
|
1327
1342
|
},
|
|
1328
1343
|
{
|
|
1329
1344
|
test: [/chrome|crios|crmo/i],
|
|
1330
|
-
describe(
|
|
1345
|
+
describe(r) {
|
|
1331
1346
|
const e = {
|
|
1332
1347
|
name: "Chrome"
|
|
1333
|
-
},
|
|
1334
|
-
return
|
|
1348
|
+
}, t = i.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1349
|
+
return t && (e.version = t), e;
|
|
1335
1350
|
}
|
|
1336
1351
|
},
|
|
1337
1352
|
{
|
|
1338
1353
|
test: [/GSA/i],
|
|
1339
|
-
describe(
|
|
1354
|
+
describe(r) {
|
|
1340
1355
|
const e = {
|
|
1341
1356
|
name: "Google Search"
|
|
1342
|
-
},
|
|
1343
|
-
return
|
|
1357
|
+
}, t = i.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1358
|
+
return t && (e.version = t), e;
|
|
1344
1359
|
}
|
|
1345
1360
|
},
|
|
1346
1361
|
/* Android Browser */
|
|
1347
1362
|
{
|
|
1348
|
-
test(
|
|
1349
|
-
const e = !
|
|
1350
|
-
return e &&
|
|
1363
|
+
test(r) {
|
|
1364
|
+
const e = !r.test(/like android/i), t = r.test(/android/i);
|
|
1365
|
+
return e && t;
|
|
1351
1366
|
},
|
|
1352
|
-
describe(
|
|
1367
|
+
describe(r) {
|
|
1353
1368
|
const e = {
|
|
1354
1369
|
name: "Android Browser"
|
|
1355
|
-
},
|
|
1356
|
-
return
|
|
1370
|
+
}, t = i.getFirstMatch(l, r);
|
|
1371
|
+
return t && (e.version = t), e;
|
|
1357
1372
|
}
|
|
1358
1373
|
},
|
|
1359
1374
|
/* PlayStation 4 */
|
|
1360
1375
|
{
|
|
1361
1376
|
test: [/playstation 4/i],
|
|
1362
|
-
describe(
|
|
1377
|
+
describe(r) {
|
|
1363
1378
|
const e = {
|
|
1364
1379
|
name: "PlayStation 4"
|
|
1365
|
-
},
|
|
1366
|
-
return
|
|
1380
|
+
}, t = i.getFirstMatch(l, r);
|
|
1381
|
+
return t && (e.version = t), e;
|
|
1367
1382
|
}
|
|
1368
1383
|
},
|
|
1369
1384
|
/* Safari */
|
|
1370
1385
|
{
|
|
1371
1386
|
test: [/safari|applewebkit/i],
|
|
1372
|
-
describe(
|
|
1387
|
+
describe(r) {
|
|
1373
1388
|
const e = {
|
|
1374
1389
|
name: "Safari"
|
|
1375
|
-
},
|
|
1376
|
-
return
|
|
1390
|
+
}, t = i.getFirstMatch(l, r);
|
|
1391
|
+
return t && (e.version = t), e;
|
|
1377
1392
|
}
|
|
1378
1393
|
},
|
|
1379
1394
|
/* Something else */
|
|
1380
1395
|
{
|
|
1381
1396
|
test: [/.*/i],
|
|
1382
|
-
describe(
|
|
1383
|
-
const e = /^(.*)\/(.*) /,
|
|
1397
|
+
describe(r) {
|
|
1398
|
+
const e = /^(.*)\/(.*) /, t = /^(.*)\/(.*)[ \t]\((.*)/, s = r.search("\\(") !== -1 ? t : e;
|
|
1384
1399
|
return {
|
|
1385
|
-
name: i.getFirstMatch(s,
|
|
1386
|
-
version: i.getSecondMatch(s,
|
|
1400
|
+
name: i.getFirstMatch(s, r),
|
|
1401
|
+
version: i.getSecondMatch(s, r)
|
|
1387
1402
|
};
|
|
1388
1403
|
}
|
|
1389
1404
|
}
|
|
1390
|
-
],
|
|
1405
|
+
], je = [
|
|
1391
1406
|
/* Roku */
|
|
1392
1407
|
{
|
|
1393
1408
|
test: [/Roku\/DVP/],
|
|
1394
|
-
describe(
|
|
1395
|
-
const e = i.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,
|
|
1409
|
+
describe(r) {
|
|
1410
|
+
const e = i.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, r);
|
|
1396
1411
|
return {
|
|
1397
1412
|
name: g.Roku,
|
|
1398
1413
|
version: e
|
|
@@ -1402,8 +1417,8 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1402
1417
|
/* Windows Phone */
|
|
1403
1418
|
{
|
|
1404
1419
|
test: [/windows phone/i],
|
|
1405
|
-
describe(
|
|
1406
|
-
const e = i.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,
|
|
1420
|
+
describe(r) {
|
|
1421
|
+
const e = i.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, r);
|
|
1407
1422
|
return {
|
|
1408
1423
|
name: g.WindowsPhone,
|
|
1409
1424
|
version: e
|
|
@@ -1413,41 +1428,41 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1413
1428
|
/* Windows */
|
|
1414
1429
|
{
|
|
1415
1430
|
test: [/windows /i],
|
|
1416
|
-
describe(
|
|
1417
|
-
const e = i.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,
|
|
1431
|
+
describe(r) {
|
|
1432
|
+
const e = i.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, r), t = i.getWindowsVersionName(e);
|
|
1418
1433
|
return {
|
|
1419
1434
|
name: g.Windows,
|
|
1420
1435
|
version: e,
|
|
1421
|
-
versionName:
|
|
1436
|
+
versionName: t
|
|
1422
1437
|
};
|
|
1423
1438
|
}
|
|
1424
1439
|
},
|
|
1425
1440
|
/* Firefox on iPad */
|
|
1426
1441
|
{
|
|
1427
1442
|
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
1428
|
-
describe(
|
|
1443
|
+
describe(r) {
|
|
1429
1444
|
const e = {
|
|
1430
1445
|
name: g.iOS
|
|
1431
|
-
},
|
|
1432
|
-
return
|
|
1446
|
+
}, t = i.getSecondMatch(/(Version\/)(\d[\d.]+)/, r);
|
|
1447
|
+
return t && (e.version = t), e;
|
|
1433
1448
|
}
|
|
1434
1449
|
},
|
|
1435
1450
|
/* macOS */
|
|
1436
1451
|
{
|
|
1437
1452
|
test: [/macintosh/i],
|
|
1438
|
-
describe(
|
|
1439
|
-
const e = i.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,
|
|
1453
|
+
describe(r) {
|
|
1454
|
+
const e = i.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, r).replace(/[_\s]/g, "."), t = i.getMacOSVersionName(e), s = {
|
|
1440
1455
|
name: g.MacOS,
|
|
1441
1456
|
version: e
|
|
1442
1457
|
};
|
|
1443
|
-
return
|
|
1458
|
+
return t && (s.versionName = t), s;
|
|
1444
1459
|
}
|
|
1445
1460
|
},
|
|
1446
1461
|
/* iOS */
|
|
1447
1462
|
{
|
|
1448
1463
|
test: [/(ipod|iphone|ipad)/i],
|
|
1449
|
-
describe(
|
|
1450
|
-
const e = i.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,
|
|
1464
|
+
describe(r) {
|
|
1465
|
+
const e = i.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, r).replace(/[_\s]/g, ".");
|
|
1451
1466
|
return {
|
|
1452
1467
|
name: g.iOS,
|
|
1453
1468
|
version: e
|
|
@@ -1456,33 +1471,33 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1456
1471
|
},
|
|
1457
1472
|
/* Android */
|
|
1458
1473
|
{
|
|
1459
|
-
test(
|
|
1460
|
-
const e = !
|
|
1461
|
-
return e &&
|
|
1474
|
+
test(r) {
|
|
1475
|
+
const e = !r.test(/like android/i), t = r.test(/android/i);
|
|
1476
|
+
return e && t;
|
|
1462
1477
|
},
|
|
1463
|
-
describe(
|
|
1464
|
-
const e = i.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,
|
|
1478
|
+
describe(r) {
|
|
1479
|
+
const e = i.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, r), t = i.getAndroidVersionName(e), s = {
|
|
1465
1480
|
name: g.Android,
|
|
1466
1481
|
version: e
|
|
1467
1482
|
};
|
|
1468
|
-
return
|
|
1483
|
+
return t && (s.versionName = t), s;
|
|
1469
1484
|
}
|
|
1470
1485
|
},
|
|
1471
1486
|
/* WebOS */
|
|
1472
1487
|
{
|
|
1473
1488
|
test: [/(web|hpw)[o0]s/i],
|
|
1474
|
-
describe(
|
|
1475
|
-
const e = i.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,
|
|
1489
|
+
describe(r) {
|
|
1490
|
+
const e = i.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, r), t = {
|
|
1476
1491
|
name: g.WebOS
|
|
1477
1492
|
};
|
|
1478
|
-
return e && e.length && (
|
|
1493
|
+
return e && e.length && (t.version = e), t;
|
|
1479
1494
|
}
|
|
1480
1495
|
},
|
|
1481
1496
|
/* BlackBerry */
|
|
1482
1497
|
{
|
|
1483
1498
|
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
1484
|
-
describe(
|
|
1485
|
-
const e = i.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,
|
|
1499
|
+
describe(r) {
|
|
1500
|
+
const e = i.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, r) || i.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, r) || i.getFirstMatch(/\bbb(\d+)/i, r);
|
|
1486
1501
|
return {
|
|
1487
1502
|
name: g.BlackBerry,
|
|
1488
1503
|
version: e
|
|
@@ -1492,8 +1507,8 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1492
1507
|
/* Bada */
|
|
1493
1508
|
{
|
|
1494
1509
|
test: [/bada/i],
|
|
1495
|
-
describe(
|
|
1496
|
-
const e = i.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,
|
|
1510
|
+
describe(r) {
|
|
1511
|
+
const e = i.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, r);
|
|
1497
1512
|
return {
|
|
1498
1513
|
name: g.Bada,
|
|
1499
1514
|
version: e
|
|
@@ -1503,8 +1518,8 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1503
1518
|
/* Tizen */
|
|
1504
1519
|
{
|
|
1505
1520
|
test: [/tizen/i],
|
|
1506
|
-
describe(
|
|
1507
|
-
const e = i.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,
|
|
1521
|
+
describe(r) {
|
|
1522
|
+
const e = i.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, r);
|
|
1508
1523
|
return {
|
|
1509
1524
|
name: g.Tizen,
|
|
1510
1525
|
version: e
|
|
@@ -1532,21 +1547,21 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1532
1547
|
/* Playstation 4 */
|
|
1533
1548
|
{
|
|
1534
1549
|
test: [/PlayStation 4/],
|
|
1535
|
-
describe(
|
|
1536
|
-
const e = i.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,
|
|
1550
|
+
describe(r) {
|
|
1551
|
+
const e = i.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, r);
|
|
1537
1552
|
return {
|
|
1538
1553
|
name: g.PlayStation4,
|
|
1539
1554
|
version: e
|
|
1540
1555
|
};
|
|
1541
1556
|
}
|
|
1542
1557
|
}
|
|
1543
|
-
],
|
|
1558
|
+
], Ke = [
|
|
1544
1559
|
/* Googlebot */
|
|
1545
1560
|
{
|
|
1546
1561
|
test: [/googlebot/i],
|
|
1547
1562
|
describe() {
|
|
1548
1563
|
return {
|
|
1549
|
-
type:
|
|
1564
|
+
type: h.bot,
|
|
1550
1565
|
vendor: "Google"
|
|
1551
1566
|
};
|
|
1552
1567
|
}
|
|
@@ -1554,12 +1569,12 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1554
1569
|
/* Huawei */
|
|
1555
1570
|
{
|
|
1556
1571
|
test: [/huawei/i],
|
|
1557
|
-
describe(
|
|
1558
|
-
const e = i.getFirstMatch(/(can-l01)/i,
|
|
1559
|
-
type:
|
|
1572
|
+
describe(r) {
|
|
1573
|
+
const e = i.getFirstMatch(/(can-l01)/i, r) && "Nova", t = {
|
|
1574
|
+
type: h.mobile,
|
|
1560
1575
|
vendor: "Huawei"
|
|
1561
1576
|
};
|
|
1562
|
-
return e && (
|
|
1577
|
+
return e && (t.model = e), t;
|
|
1563
1578
|
}
|
|
1564
1579
|
},
|
|
1565
1580
|
/* Nexus Tablet */
|
|
@@ -1567,7 +1582,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1567
1582
|
test: [/nexus\s*(?:7|8|9|10).*/i],
|
|
1568
1583
|
describe() {
|
|
1569
1584
|
return {
|
|
1570
|
-
type:
|
|
1585
|
+
type: h.tablet,
|
|
1571
1586
|
vendor: "Nexus"
|
|
1572
1587
|
};
|
|
1573
1588
|
}
|
|
@@ -1577,7 +1592,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1577
1592
|
test: [/ipad/i],
|
|
1578
1593
|
describe() {
|
|
1579
1594
|
return {
|
|
1580
|
-
type:
|
|
1595
|
+
type: h.tablet,
|
|
1581
1596
|
vendor: "Apple",
|
|
1582
1597
|
model: "iPad"
|
|
1583
1598
|
};
|
|
@@ -1588,7 +1603,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1588
1603
|
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
1589
1604
|
describe() {
|
|
1590
1605
|
return {
|
|
1591
|
-
type:
|
|
1606
|
+
type: h.tablet,
|
|
1592
1607
|
vendor: "Apple",
|
|
1593
1608
|
model: "iPad"
|
|
1594
1609
|
};
|
|
@@ -1599,7 +1614,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1599
1614
|
test: [/kftt build/i],
|
|
1600
1615
|
describe() {
|
|
1601
1616
|
return {
|
|
1602
|
-
type:
|
|
1617
|
+
type: h.tablet,
|
|
1603
1618
|
vendor: "Amazon",
|
|
1604
1619
|
model: "Kindle Fire HD 7"
|
|
1605
1620
|
};
|
|
@@ -1610,7 +1625,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1610
1625
|
test: [/silk/i],
|
|
1611
1626
|
describe() {
|
|
1612
1627
|
return {
|
|
1613
|
-
type:
|
|
1628
|
+
type: h.tablet,
|
|
1614
1629
|
vendor: "Amazon"
|
|
1615
1630
|
};
|
|
1616
1631
|
}
|
|
@@ -1620,20 +1635,20 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1620
1635
|
test: [/tablet(?! pc)/i],
|
|
1621
1636
|
describe() {
|
|
1622
1637
|
return {
|
|
1623
|
-
type:
|
|
1638
|
+
type: h.tablet
|
|
1624
1639
|
};
|
|
1625
1640
|
}
|
|
1626
1641
|
},
|
|
1627
1642
|
/* iPod/iPhone */
|
|
1628
1643
|
{
|
|
1629
|
-
test(
|
|
1630
|
-
const e =
|
|
1631
|
-
return e && !
|
|
1644
|
+
test(r) {
|
|
1645
|
+
const e = r.test(/ipod|iphone/i), t = r.test(/like (ipod|iphone)/i);
|
|
1646
|
+
return e && !t;
|
|
1632
1647
|
},
|
|
1633
|
-
describe(
|
|
1634
|
-
const e = i.getFirstMatch(/(ipod|iphone)/i,
|
|
1648
|
+
describe(r) {
|
|
1649
|
+
const e = i.getFirstMatch(/(ipod|iphone)/i, r);
|
|
1635
1650
|
return {
|
|
1636
|
-
type:
|
|
1651
|
+
type: h.mobile,
|
|
1637
1652
|
vendor: "Apple",
|
|
1638
1653
|
model: e
|
|
1639
1654
|
};
|
|
@@ -1644,148 +1659,159 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1644
1659
|
test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
|
|
1645
1660
|
describe() {
|
|
1646
1661
|
return {
|
|
1647
|
-
type:
|
|
1662
|
+
type: h.mobile,
|
|
1648
1663
|
vendor: "Nexus"
|
|
1649
1664
|
};
|
|
1650
1665
|
}
|
|
1651
1666
|
},
|
|
1667
|
+
/* Nokia */
|
|
1668
|
+
{
|
|
1669
|
+
test: [/Nokia/i],
|
|
1670
|
+
describe(r) {
|
|
1671
|
+
const e = i.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i, r), t = {
|
|
1672
|
+
type: h.mobile,
|
|
1673
|
+
vendor: "Nokia"
|
|
1674
|
+
};
|
|
1675
|
+
return e && (t.model = e), t;
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1652
1678
|
/* Mobile */
|
|
1653
1679
|
{
|
|
1654
1680
|
test: [/[^-]mobi/i],
|
|
1655
1681
|
describe() {
|
|
1656
1682
|
return {
|
|
1657
|
-
type:
|
|
1683
|
+
type: h.mobile
|
|
1658
1684
|
};
|
|
1659
1685
|
}
|
|
1660
1686
|
},
|
|
1661
1687
|
/* BlackBerry */
|
|
1662
1688
|
{
|
|
1663
|
-
test(
|
|
1664
|
-
return
|
|
1689
|
+
test(r) {
|
|
1690
|
+
return r.getBrowserName(!0) === "blackberry";
|
|
1665
1691
|
},
|
|
1666
1692
|
describe() {
|
|
1667
1693
|
return {
|
|
1668
|
-
type:
|
|
1694
|
+
type: h.mobile,
|
|
1669
1695
|
vendor: "BlackBerry"
|
|
1670
1696
|
};
|
|
1671
1697
|
}
|
|
1672
1698
|
},
|
|
1673
1699
|
/* Bada */
|
|
1674
1700
|
{
|
|
1675
|
-
test(
|
|
1676
|
-
return
|
|
1701
|
+
test(r) {
|
|
1702
|
+
return r.getBrowserName(!0) === "bada";
|
|
1677
1703
|
},
|
|
1678
1704
|
describe() {
|
|
1679
1705
|
return {
|
|
1680
|
-
type:
|
|
1706
|
+
type: h.mobile
|
|
1681
1707
|
};
|
|
1682
1708
|
}
|
|
1683
1709
|
},
|
|
1684
1710
|
/* Windows Phone */
|
|
1685
1711
|
{
|
|
1686
|
-
test(
|
|
1687
|
-
return
|
|
1712
|
+
test(r) {
|
|
1713
|
+
return r.getBrowserName() === "windows phone";
|
|
1688
1714
|
},
|
|
1689
1715
|
describe() {
|
|
1690
1716
|
return {
|
|
1691
|
-
type:
|
|
1717
|
+
type: h.mobile,
|
|
1692
1718
|
vendor: "Microsoft"
|
|
1693
1719
|
};
|
|
1694
1720
|
}
|
|
1695
1721
|
},
|
|
1696
1722
|
/* Android Tablet */
|
|
1697
1723
|
{
|
|
1698
|
-
test(
|
|
1699
|
-
const e = Number(String(
|
|
1700
|
-
return
|
|
1724
|
+
test(r) {
|
|
1725
|
+
const e = Number(String(r.getOSVersion()).split(".")[0]);
|
|
1726
|
+
return r.getOSName(!0) === "android" && e >= 3;
|
|
1701
1727
|
},
|
|
1702
1728
|
describe() {
|
|
1703
1729
|
return {
|
|
1704
|
-
type:
|
|
1730
|
+
type: h.tablet
|
|
1705
1731
|
};
|
|
1706
1732
|
}
|
|
1707
1733
|
},
|
|
1708
1734
|
/* Android Mobile */
|
|
1709
1735
|
{
|
|
1710
|
-
test(
|
|
1711
|
-
return
|
|
1736
|
+
test(r) {
|
|
1737
|
+
return r.getOSName(!0) === "android";
|
|
1712
1738
|
},
|
|
1713
1739
|
describe() {
|
|
1714
1740
|
return {
|
|
1715
|
-
type:
|
|
1741
|
+
type: h.mobile
|
|
1716
1742
|
};
|
|
1717
1743
|
}
|
|
1718
1744
|
},
|
|
1719
1745
|
/* desktop */
|
|
1720
1746
|
{
|
|
1721
|
-
test(
|
|
1722
|
-
return
|
|
1747
|
+
test(r) {
|
|
1748
|
+
return r.getOSName(!0) === "macos";
|
|
1723
1749
|
},
|
|
1724
1750
|
describe() {
|
|
1725
1751
|
return {
|
|
1726
|
-
type:
|
|
1752
|
+
type: h.desktop,
|
|
1727
1753
|
vendor: "Apple"
|
|
1728
1754
|
};
|
|
1729
1755
|
}
|
|
1730
1756
|
},
|
|
1731
1757
|
/* Windows */
|
|
1732
1758
|
{
|
|
1733
|
-
test(
|
|
1734
|
-
return
|
|
1759
|
+
test(r) {
|
|
1760
|
+
return r.getOSName(!0) === "windows";
|
|
1735
1761
|
},
|
|
1736
1762
|
describe() {
|
|
1737
1763
|
return {
|
|
1738
|
-
type:
|
|
1764
|
+
type: h.desktop
|
|
1739
1765
|
};
|
|
1740
1766
|
}
|
|
1741
1767
|
},
|
|
1742
1768
|
/* Linux */
|
|
1743
1769
|
{
|
|
1744
|
-
test(
|
|
1745
|
-
return
|
|
1770
|
+
test(r) {
|
|
1771
|
+
return r.getOSName(!0) === "linux";
|
|
1746
1772
|
},
|
|
1747
1773
|
describe() {
|
|
1748
1774
|
return {
|
|
1749
|
-
type:
|
|
1775
|
+
type: h.desktop
|
|
1750
1776
|
};
|
|
1751
1777
|
}
|
|
1752
1778
|
},
|
|
1753
1779
|
/* PlayStation 4 */
|
|
1754
1780
|
{
|
|
1755
|
-
test(
|
|
1756
|
-
return
|
|
1781
|
+
test(r) {
|
|
1782
|
+
return r.getOSName(!0) === "playstation 4";
|
|
1757
1783
|
},
|
|
1758
1784
|
describe() {
|
|
1759
1785
|
return {
|
|
1760
|
-
type:
|
|
1786
|
+
type: h.tv
|
|
1761
1787
|
};
|
|
1762
1788
|
}
|
|
1763
1789
|
},
|
|
1764
1790
|
/* Roku */
|
|
1765
1791
|
{
|
|
1766
|
-
test(
|
|
1767
|
-
return
|
|
1792
|
+
test(r) {
|
|
1793
|
+
return r.getOSName(!0) === "roku";
|
|
1768
1794
|
},
|
|
1769
1795
|
describe() {
|
|
1770
1796
|
return {
|
|
1771
|
-
type:
|
|
1797
|
+
type: h.tv
|
|
1772
1798
|
};
|
|
1773
1799
|
}
|
|
1774
1800
|
}
|
|
1775
|
-
],
|
|
1801
|
+
], Ye = [
|
|
1776
1802
|
/* EdgeHTML */
|
|
1777
1803
|
{
|
|
1778
|
-
test(
|
|
1779
|
-
return
|
|
1804
|
+
test(r) {
|
|
1805
|
+
return r.getBrowserName(!0) === "microsoft edge";
|
|
1780
1806
|
},
|
|
1781
|
-
describe(
|
|
1782
|
-
if (/\sedg\//i.test(
|
|
1807
|
+
describe(r) {
|
|
1808
|
+
if (/\sedg\//i.test(r))
|
|
1783
1809
|
return {
|
|
1784
|
-
name:
|
|
1810
|
+
name: S.Blink
|
|
1785
1811
|
};
|
|
1786
|
-
const e = i.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,
|
|
1812
|
+
const e = i.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, r);
|
|
1787
1813
|
return {
|
|
1788
|
-
name:
|
|
1814
|
+
name: S.EdgeHTML,
|
|
1789
1815
|
version: e
|
|
1790
1816
|
};
|
|
1791
1817
|
}
|
|
@@ -1793,36 +1819,36 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1793
1819
|
/* Trident */
|
|
1794
1820
|
{
|
|
1795
1821
|
test: [/trident/i],
|
|
1796
|
-
describe(
|
|
1822
|
+
describe(r) {
|
|
1797
1823
|
const e = {
|
|
1798
|
-
name:
|
|
1799
|
-
},
|
|
1800
|
-
return
|
|
1824
|
+
name: S.Trident
|
|
1825
|
+
}, t = i.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, r);
|
|
1826
|
+
return t && (e.version = t), e;
|
|
1801
1827
|
}
|
|
1802
1828
|
},
|
|
1803
1829
|
/* Presto */
|
|
1804
1830
|
{
|
|
1805
|
-
test(
|
|
1806
|
-
return
|
|
1831
|
+
test(r) {
|
|
1832
|
+
return r.test(/presto/i);
|
|
1807
1833
|
},
|
|
1808
|
-
describe(
|
|
1834
|
+
describe(r) {
|
|
1809
1835
|
const e = {
|
|
1810
|
-
name:
|
|
1811
|
-
},
|
|
1812
|
-
return
|
|
1836
|
+
name: S.Presto
|
|
1837
|
+
}, t = i.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, r);
|
|
1838
|
+
return t && (e.version = t), e;
|
|
1813
1839
|
}
|
|
1814
1840
|
},
|
|
1815
1841
|
/* Gecko */
|
|
1816
1842
|
{
|
|
1817
|
-
test(
|
|
1818
|
-
const e =
|
|
1819
|
-
return e && !
|
|
1843
|
+
test(r) {
|
|
1844
|
+
const e = r.test(/gecko/i), t = r.test(/like gecko/i);
|
|
1845
|
+
return e && !t;
|
|
1820
1846
|
},
|
|
1821
|
-
describe(
|
|
1847
|
+
describe(r) {
|
|
1822
1848
|
const e = {
|
|
1823
|
-
name:
|
|
1824
|
-
},
|
|
1825
|
-
return
|
|
1849
|
+
name: S.Gecko
|
|
1850
|
+
}, t = i.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, r);
|
|
1851
|
+
return t && (e.version = t), e;
|
|
1826
1852
|
}
|
|
1827
1853
|
},
|
|
1828
1854
|
/* Blink */
|
|
@@ -1830,22 +1856,22 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
|
1830
1856
|
test: [/(apple)?webkit\/537\.36/i],
|
|
1831
1857
|
describe() {
|
|
1832
1858
|
return {
|
|
1833
|
-
name:
|
|
1859
|
+
name: S.Blink
|
|
1834
1860
|
};
|
|
1835
1861
|
}
|
|
1836
1862
|
},
|
|
1837
1863
|
/* WebKit */
|
|
1838
1864
|
{
|
|
1839
1865
|
test: [/(apple)?webkit/i],
|
|
1840
|
-
describe(
|
|
1866
|
+
describe(r) {
|
|
1841
1867
|
const e = {
|
|
1842
|
-
name:
|
|
1843
|
-
},
|
|
1844
|
-
return
|
|
1868
|
+
name: S.WebKit
|
|
1869
|
+
}, t = i.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, r);
|
|
1870
|
+
return t && (e.version = t), e;
|
|
1845
1871
|
}
|
|
1846
1872
|
}
|
|
1847
1873
|
];
|
|
1848
|
-
class
|
|
1874
|
+
class W {
|
|
1849
1875
|
/**
|
|
1850
1876
|
* Create instance of Parser
|
|
1851
1877
|
*
|
|
@@ -1858,10 +1884,10 @@ class Y {
|
|
|
1858
1884
|
*
|
|
1859
1885
|
* @constructor
|
|
1860
1886
|
*/
|
|
1861
|
-
constructor(e,
|
|
1887
|
+
constructor(e, t = !1) {
|
|
1862
1888
|
if (e == null || e === "")
|
|
1863
1889
|
throw new Error("UserAgent parameter can't be empty");
|
|
1864
|
-
this._ua = e, this.parsedResult = {},
|
|
1890
|
+
this._ua = e, this.parsedResult = {}, t !== !0 && this.parse();
|
|
1865
1891
|
}
|
|
1866
1892
|
/**
|
|
1867
1893
|
* Get UserAgent string of current Parser instance
|
|
@@ -1886,11 +1912,11 @@ class Y {
|
|
|
1886
1912
|
*/
|
|
1887
1913
|
parseBrowser() {
|
|
1888
1914
|
this.parsedResult.browser = {};
|
|
1889
|
-
const e = i.find(
|
|
1890
|
-
if (typeof
|
|
1891
|
-
return
|
|
1892
|
-
if (
|
|
1893
|
-
return
|
|
1915
|
+
const e = i.find(Ge, (t) => {
|
|
1916
|
+
if (typeof t.test == "function")
|
|
1917
|
+
return t.test(this);
|
|
1918
|
+
if (Array.isArray(t.test))
|
|
1919
|
+
return t.test.some((s) => this.test(s));
|
|
1894
1920
|
throw new Error("Browser's test function is not valid");
|
|
1895
1921
|
});
|
|
1896
1922
|
return e && (this.parsedResult.browser = e.describe(this.getUA())), this.parsedResult.browser;
|
|
@@ -1942,11 +1968,11 @@ class Y {
|
|
|
1942
1968
|
*/
|
|
1943
1969
|
parseOS() {
|
|
1944
1970
|
this.parsedResult.os = {};
|
|
1945
|
-
const e = i.find(
|
|
1946
|
-
if (typeof
|
|
1947
|
-
return
|
|
1948
|
-
if (
|
|
1949
|
-
return
|
|
1971
|
+
const e = i.find(je, (t) => {
|
|
1972
|
+
if (typeof t.test == "function")
|
|
1973
|
+
return t.test(this);
|
|
1974
|
+
if (Array.isArray(t.test))
|
|
1975
|
+
return t.test.some((s) => this.test(s));
|
|
1950
1976
|
throw new Error("Browser's test function is not valid");
|
|
1951
1977
|
});
|
|
1952
1978
|
return e && (this.parsedResult.os = e.describe(this.getUA())), this.parsedResult.os;
|
|
@@ -1957,8 +1983,8 @@ class Y {
|
|
|
1957
1983
|
* @return {String} name of the OS — macOS, Windows, Linux, etc.
|
|
1958
1984
|
*/
|
|
1959
1985
|
getOSName(e) {
|
|
1960
|
-
const { name:
|
|
1961
|
-
return e ? String(
|
|
1986
|
+
const { name: t } = this.getOS();
|
|
1987
|
+
return e ? String(t).toLowerCase() || "" : t || "";
|
|
1962
1988
|
}
|
|
1963
1989
|
/**
|
|
1964
1990
|
* Get OS version
|
|
@@ -1980,8 +2006,8 @@ class Y {
|
|
|
1980
2006
|
* @return {*}
|
|
1981
2007
|
*/
|
|
1982
2008
|
getPlatformType(e = !1) {
|
|
1983
|
-
const { type:
|
|
1984
|
-
return e ? String(
|
|
2009
|
+
const { type: t } = this.getPlatform();
|
|
2010
|
+
return e ? String(t).toLowerCase() || "" : t || "";
|
|
1985
2011
|
}
|
|
1986
2012
|
/**
|
|
1987
2013
|
* Get parsed platform
|
|
@@ -1989,11 +2015,11 @@ class Y {
|
|
|
1989
2015
|
*/
|
|
1990
2016
|
parsePlatform() {
|
|
1991
2017
|
this.parsedResult.platform = {};
|
|
1992
|
-
const e = i.find(
|
|
1993
|
-
if (typeof
|
|
1994
|
-
return
|
|
1995
|
-
if (
|
|
1996
|
-
return
|
|
2018
|
+
const e = i.find(Ke, (t) => {
|
|
2019
|
+
if (typeof t.test == "function")
|
|
2020
|
+
return t.test(this);
|
|
2021
|
+
if (Array.isArray(t.test))
|
|
2022
|
+
return t.test.some((s) => this.test(s));
|
|
1997
2023
|
throw new Error("Browser's test function is not valid");
|
|
1998
2024
|
});
|
|
1999
2025
|
return e && (this.parsedResult.platform = e.describe(this.getUA())), this.parsedResult.platform;
|
|
@@ -2020,11 +2046,11 @@ class Y {
|
|
|
2020
2046
|
*/
|
|
2021
2047
|
parseEngine() {
|
|
2022
2048
|
this.parsedResult.engine = {};
|
|
2023
|
-
const e = i.find(
|
|
2024
|
-
if (typeof
|
|
2025
|
-
return
|
|
2026
|
-
if (
|
|
2027
|
-
return
|
|
2049
|
+
const e = i.find(Ye, (t) => {
|
|
2050
|
+
if (typeof t.test == "function")
|
|
2051
|
+
return t.test(this);
|
|
2052
|
+
if (Array.isArray(t.test))
|
|
2053
|
+
return t.test.some((s) => this.test(s));
|
|
2028
2054
|
throw new Error("Browser's test function is not valid");
|
|
2029
2055
|
});
|
|
2030
2056
|
return e && (this.parsedResult.engine = e.describe(this.getUA())), this.parsedResult.engine;
|
|
@@ -2062,62 +2088,77 @@ class Y {
|
|
|
2062
2088
|
* if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
|
|
2063
2089
|
*/
|
|
2064
2090
|
satisfies(e) {
|
|
2065
|
-
const
|
|
2091
|
+
const t = {};
|
|
2066
2092
|
let s = 0;
|
|
2067
2093
|
const n = {};
|
|
2068
2094
|
let o = 0;
|
|
2069
2095
|
if (Object.keys(e).forEach((a) => {
|
|
2070
2096
|
const c = e[a];
|
|
2071
|
-
typeof c == "string" ? (n[a] = c, o += 1) : typeof c == "object" && (
|
|
2097
|
+
typeof c == "string" ? (n[a] = c, o += 1) : typeof c == "object" && (t[a] = c, s += 1);
|
|
2072
2098
|
}), s > 0) {
|
|
2073
|
-
const a = Object.keys(
|
|
2099
|
+
const a = Object.keys(t), c = i.find(a, (d) => this.isOS(d));
|
|
2074
2100
|
if (c) {
|
|
2075
|
-
const d = this.satisfies(
|
|
2101
|
+
const d = this.satisfies(t[c]);
|
|
2076
2102
|
if (d !== void 0)
|
|
2077
2103
|
return d;
|
|
2078
2104
|
}
|
|
2079
|
-
const
|
|
2105
|
+
const u = i.find(
|
|
2080
2106
|
a,
|
|
2081
2107
|
(d) => this.isPlatform(d)
|
|
2082
2108
|
);
|
|
2083
|
-
if (
|
|
2084
|
-
const d = this.satisfies(
|
|
2109
|
+
if (u) {
|
|
2110
|
+
const d = this.satisfies(t[u]);
|
|
2085
2111
|
if (d !== void 0)
|
|
2086
2112
|
return d;
|
|
2087
2113
|
}
|
|
2088
2114
|
}
|
|
2089
2115
|
if (o > 0) {
|
|
2090
|
-
const a = Object.keys(n), c = i.find(a, (
|
|
2116
|
+
const a = Object.keys(n), c = i.find(a, (u) => this.isBrowser(u, !0));
|
|
2091
2117
|
if (c !== void 0)
|
|
2092
2118
|
return this.compareVersion(n[c]);
|
|
2093
2119
|
}
|
|
2094
2120
|
}
|
|
2095
2121
|
/**
|
|
2096
2122
|
* Check if the browser name equals the passed string
|
|
2097
|
-
* @param browserName The string to compare with the browser name
|
|
2123
|
+
* @param {string} browserName The string to compare with the browser name
|
|
2098
2124
|
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
|
2099
2125
|
* @returns {boolean}
|
|
2100
2126
|
*/
|
|
2101
|
-
isBrowser(e,
|
|
2127
|
+
isBrowser(e, t = !1) {
|
|
2102
2128
|
const s = this.getBrowserName().toLowerCase();
|
|
2103
2129
|
let n = e.toLowerCase();
|
|
2104
2130
|
const o = i.getBrowserTypeByAlias(n);
|
|
2105
|
-
return
|
|
2131
|
+
return t && o && (n = o.toLowerCase()), n === s;
|
|
2106
2132
|
}
|
|
2107
2133
|
compareVersion(e) {
|
|
2108
|
-
let
|
|
2134
|
+
let t = [0], s = e, n = !1;
|
|
2109
2135
|
const o = this.getBrowserVersion();
|
|
2110
2136
|
if (typeof o == "string")
|
|
2111
|
-
return e[0] === ">" || e[0] === "<" ? (s = e.substr(1), e[1] === "=" ? (n = !0, s = e.substr(2)) :
|
|
2137
|
+
return e[0] === ">" || e[0] === "<" ? (s = e.substr(1), e[1] === "=" ? (n = !0, s = e.substr(2)) : t = [], e[0] === ">" ? t.push(1) : t.push(-1)) : e[0] === "=" ? s = e.substr(1) : e[0] === "~" && (n = !0, s = e.substr(1)), t.indexOf(
|
|
2112
2138
|
i.compareVersions(o, s, n)
|
|
2113
2139
|
) > -1;
|
|
2114
2140
|
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Check if the OS name equals the passed string
|
|
2143
|
+
* @param {string} osName The string to compare with the OS name
|
|
2144
|
+
* @returns {boolean}
|
|
2145
|
+
*/
|
|
2115
2146
|
isOS(e) {
|
|
2116
2147
|
return this.getOSName(!0) === String(e).toLowerCase();
|
|
2117
2148
|
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Check if the platform type equals the passed string
|
|
2151
|
+
* @param {string} platformType The string to compare with the platform type
|
|
2152
|
+
* @returns {boolean}
|
|
2153
|
+
*/
|
|
2118
2154
|
isPlatform(e) {
|
|
2119
2155
|
return this.getPlatformType(!0) === String(e).toLowerCase();
|
|
2120
2156
|
}
|
|
2157
|
+
/**
|
|
2158
|
+
* Check if the engine name equals the passed string
|
|
2159
|
+
* @param {string} engineName The string to compare with the engine name
|
|
2160
|
+
* @returns {boolean}
|
|
2161
|
+
*/
|
|
2121
2162
|
isEngine(e) {
|
|
2122
2163
|
return this.getEngineName(!0) === String(e).toLowerCase();
|
|
2123
2164
|
}
|
|
@@ -2128,8 +2169,8 @@ class Y {
|
|
|
2128
2169
|
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
|
2129
2170
|
* @returns {Boolean}
|
|
2130
2171
|
*/
|
|
2131
|
-
is(e,
|
|
2132
|
-
return this.isBrowser(e,
|
|
2172
|
+
is(e, t = !1) {
|
|
2173
|
+
return this.isBrowser(e, t) || this.isOS(e) || this.isPlatform(e);
|
|
2133
2174
|
}
|
|
2134
2175
|
/**
|
|
2135
2176
|
* Check if any of the given values satisfies this.is(anything)
|
|
@@ -2137,7 +2178,7 @@ class Y {
|
|
|
2137
2178
|
* @returns {Boolean}
|
|
2138
2179
|
*/
|
|
2139
2180
|
some(e = []) {
|
|
2140
|
-
return e.some((
|
|
2181
|
+
return e.some((t) => this.is(t));
|
|
2141
2182
|
}
|
|
2142
2183
|
}
|
|
2143
2184
|
/*!
|
|
@@ -2146,7 +2187,7 @@ class Y {
|
|
|
2146
2187
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
2147
2188
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
2148
2189
|
*/
|
|
2149
|
-
class
|
|
2190
|
+
class Je {
|
|
2150
2191
|
/**
|
|
2151
2192
|
* Creates a {@link Parser} instance
|
|
2152
2193
|
*
|
|
@@ -2160,10 +2201,10 @@ class it {
|
|
|
2160
2201
|
* const parser = Bowser.getParser(window.navigator.userAgent);
|
|
2161
2202
|
* const result = parser.getResult();
|
|
2162
2203
|
*/
|
|
2163
|
-
static getParser(e,
|
|
2204
|
+
static getParser(e, t = !1) {
|
|
2164
2205
|
if (typeof e != "string")
|
|
2165
2206
|
throw new Error("UserAgent should be a string");
|
|
2166
|
-
return new
|
|
2207
|
+
return new W(e, t);
|
|
2167
2208
|
}
|
|
2168
2209
|
/**
|
|
2169
2210
|
* Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately
|
|
@@ -2175,32 +2216,32 @@ class it {
|
|
|
2175
2216
|
* const result = Bowser.parse(window.navigator.userAgent);
|
|
2176
2217
|
*/
|
|
2177
2218
|
static parse(e) {
|
|
2178
|
-
return new
|
|
2219
|
+
return new W(e).getResult();
|
|
2179
2220
|
}
|
|
2180
2221
|
static get BROWSER_MAP() {
|
|
2181
|
-
return
|
|
2222
|
+
return Q;
|
|
2182
2223
|
}
|
|
2183
2224
|
static get ENGINE_MAP() {
|
|
2184
|
-
return
|
|
2225
|
+
return S;
|
|
2185
2226
|
}
|
|
2186
2227
|
static get OS_MAP() {
|
|
2187
2228
|
return g;
|
|
2188
2229
|
}
|
|
2189
2230
|
static get PLATFORMS_MAP() {
|
|
2190
|
-
return
|
|
2231
|
+
return h;
|
|
2191
2232
|
}
|
|
2192
2233
|
}
|
|
2193
|
-
const
|
|
2234
|
+
const I = Je.parse(navigator.userAgent), Xe = {
|
|
2194
2235
|
abTestGroup: null,
|
|
2195
2236
|
abTestName: null,
|
|
2196
|
-
browser:
|
|
2197
|
-
browserVersion:
|
|
2198
|
-
hardwarePlatform:
|
|
2237
|
+
browser: I.browser.name ?? null,
|
|
2238
|
+
browserVersion: I.browser.version ?? null,
|
|
2239
|
+
hardwarePlatform: I.browser.name === "Electron" ? "DESKTOP" : "WEB",
|
|
2199
2240
|
isOfflineModeStart: !1,
|
|
2200
2241
|
mobileNetworkType: null,
|
|
2201
2242
|
networkType: "WIFI",
|
|
2202
|
-
operatingSystem:
|
|
2203
|
-
operatingSystemVersion:
|
|
2243
|
+
operatingSystem: I.os.name ?? null,
|
|
2244
|
+
operatingSystemVersion: I.os.version ?? null,
|
|
2204
2245
|
screenHeight: window.screen.height,
|
|
2205
2246
|
screenWidth: window.screen.width,
|
|
2206
2247
|
sessionProductId: "",
|
|
@@ -2210,251 +2251,237 @@ const C = it.parse(navigator.userAgent), nt = {
|
|
|
2210
2251
|
startReason: "IMPLICIT",
|
|
2211
2252
|
streamingSessionId: "",
|
|
2212
2253
|
timestamp: 0
|
|
2213
|
-
},
|
|
2254
|
+
}, Ze = await T(
|
|
2214
2255
|
"streaming_session_start",
|
|
2215
|
-
|
|
2256
|
+
Xe
|
|
2216
2257
|
);
|
|
2217
|
-
function
|
|
2218
|
-
return
|
|
2219
|
-
}
|
|
2220
|
-
function
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2258
|
+
function et(r) {
|
|
2259
|
+
return Ze(r);
|
|
2260
|
+
}
|
|
2261
|
+
async function tt(r) {
|
|
2262
|
+
if (await P())
|
|
2263
|
+
return r();
|
|
2264
|
+
}
|
|
2265
|
+
async function G(r) {
|
|
2266
|
+
const e = {
|
|
2267
|
+
consentCategory: "NECESSARY",
|
|
2268
|
+
..."extras" in r && { extras: r.extras },
|
|
2269
|
+
group: r.group,
|
|
2270
|
+
name: r.name,
|
|
2271
|
+
payload: r.payload,
|
|
2272
|
+
version: r.version
|
|
2273
|
+
}, t = e.payload.streamingSessionId;
|
|
2274
|
+
e.name === "progress" && "streamingSessionId" in e.payload && delete e.payload.streamingSessionId, D.eventSender.sendEvent(e), t && await R.delete({
|
|
2275
|
+
name: e.name,
|
|
2276
|
+
streamingSessionId: t
|
|
2229
2277
|
});
|
|
2230
2278
|
}
|
|
2231
|
-
async function
|
|
2232
|
-
|
|
2233
|
-
const
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
const r = (await Promise.all(e.events)).filter(lt);
|
|
2245
|
-
e.events = r;
|
|
2246
|
-
const { clientId: s, token: n } = await v.credentialsProvider.getCredentials();
|
|
2247
|
-
if (!n)
|
|
2248
|
-
throw new Error("No accessToken");
|
|
2249
|
-
const o = {
|
|
2250
|
-
...e,
|
|
2251
|
-
accessToken: n,
|
|
2252
|
-
apiUrl: M("apiUrl"),
|
|
2253
|
-
appVersion: M("appVersion"),
|
|
2254
|
-
clientId: s,
|
|
2255
|
-
clientPlatform: M("clientPlatform"),
|
|
2256
|
-
eventUrl: M("eventUrl"),
|
|
2257
|
-
ts: y.now()
|
|
2258
|
-
};
|
|
2259
|
-
return t.postMessage(JSON.stringify(o)), o;
|
|
2260
|
-
} else
|
|
2261
|
-
console.warn("Event beacon is not running.");
|
|
2262
|
-
}
|
|
2263
|
-
const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2264
|
-
__proto__: null,
|
|
2265
|
-
commit: ie,
|
|
2266
|
-
start: dt,
|
|
2267
|
-
get worker() {
|
|
2268
|
-
return F;
|
|
2269
|
-
},
|
|
2270
|
-
workerize: se
|
|
2271
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2272
|
-
async function ht(t) {
|
|
2273
|
-
if (await B())
|
|
2274
|
-
return t();
|
|
2275
|
-
}
|
|
2276
|
-
function ne(t) {
|
|
2277
|
-
return ht(
|
|
2278
|
-
() => ie(F, {
|
|
2279
|
-
type: "streaming_metrics",
|
|
2280
|
-
...t
|
|
2281
|
-
})
|
|
2282
|
-
);
|
|
2279
|
+
async function j(r) {
|
|
2280
|
+
return tt(async () => {
|
|
2281
|
+
for (const e of r)
|
|
2282
|
+
if (e) {
|
|
2283
|
+
const t = await e;
|
|
2284
|
+
t && await G({
|
|
2285
|
+
group: "streaming_metrics",
|
|
2286
|
+
name: t.name,
|
|
2287
|
+
payload: t.payload,
|
|
2288
|
+
version: 2
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
});
|
|
2283
2292
|
}
|
|
2284
|
-
function
|
|
2285
|
-
const e =
|
|
2286
|
-
return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (
|
|
2293
|
+
function rt(r = !0) {
|
|
2294
|
+
const e = r && "crypto" in window && "getRandomValues" in crypto;
|
|
2295
|
+
return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (t) => {
|
|
2287
2296
|
const s = e ? crypto.getRandomValues(new Uint8Array(1))[0] : Math.floor(256 * Math.random());
|
|
2288
|
-
return (
|
|
2297
|
+
return (t ^ (s ?? 0) & 15 >> t / 4).toString(16);
|
|
2289
2298
|
});
|
|
2290
2299
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2300
|
+
const N = {
|
|
2301
|
+
BTS: "application/vnd.tidal.bts",
|
|
2302
|
+
DASH: "application/dash+xml",
|
|
2303
|
+
EMU: "application/vnd.tidal.emu"
|
|
2304
|
+
};
|
|
2305
|
+
function st(r) {
|
|
2306
|
+
return JSON.parse(atob(r));
|
|
2293
2307
|
}
|
|
2294
|
-
function
|
|
2295
|
-
if ("codecs" in
|
|
2296
|
-
switch (
|
|
2308
|
+
function it(r, e) {
|
|
2309
|
+
if ("codecs" in r)
|
|
2310
|
+
switch (r.codecs) {
|
|
2297
2311
|
case "aac":
|
|
2298
2312
|
return "aac";
|
|
2299
|
-
case "mp4a.40.2":
|
|
2300
|
-
return "mp4a.40.2";
|
|
2301
2313
|
case "aac+":
|
|
2302
2314
|
return "aac+";
|
|
2303
|
-
case "mp4a.40.5":
|
|
2304
|
-
return "mp4a.40.5";
|
|
2305
2315
|
case "flac":
|
|
2306
2316
|
return "flac";
|
|
2307
|
-
case "mqa":
|
|
2308
|
-
return "mqa";
|
|
2309
2317
|
case "mp3":
|
|
2310
2318
|
return "mp3";
|
|
2319
|
+
case "mp4a.40.2":
|
|
2320
|
+
return "mp4a.40.2";
|
|
2321
|
+
case "mp4a.40.5":
|
|
2322
|
+
return "mp4a.40.5";
|
|
2311
2323
|
}
|
|
2312
2324
|
else if (e)
|
|
2313
2325
|
switch (e) {
|
|
2314
|
-
case "LOW":
|
|
2315
|
-
return "mp4a.40.5";
|
|
2316
|
-
case "HIGH":
|
|
2317
|
-
return "mp4a.40.2";
|
|
2318
|
-
case "LOSSLESS":
|
|
2319
2326
|
case "HI_RES":
|
|
2320
2327
|
case "HI_RES_LOSSLESS":
|
|
2328
|
+
case "LOSSLESS":
|
|
2321
2329
|
return "flac";
|
|
2330
|
+
case "HIGH":
|
|
2331
|
+
return "mp4a.40.2";
|
|
2332
|
+
case "LOW":
|
|
2333
|
+
return "mp4a.40.5";
|
|
2322
2334
|
}
|
|
2323
2335
|
return "none";
|
|
2324
2336
|
}
|
|
2325
|
-
function
|
|
2326
|
-
switch (
|
|
2327
|
-
case "mp3":
|
|
2328
|
-
return "mp3";
|
|
2337
|
+
function nt(r) {
|
|
2338
|
+
switch (r) {
|
|
2329
2339
|
case "aac":
|
|
2330
2340
|
case "aac+":
|
|
2331
2341
|
case "mp4a.40.2":
|
|
2332
2342
|
case "mp4a.40.5":
|
|
2333
2343
|
return "aac";
|
|
2334
2344
|
case "flac":
|
|
2335
|
-
|
|
2336
|
-
|
|
2345
|
+
return r;
|
|
2346
|
+
case "mp3":
|
|
2347
|
+
return "mp3";
|
|
2337
2348
|
default:
|
|
2338
2349
|
return;
|
|
2339
2350
|
}
|
|
2340
2351
|
}
|
|
2341
|
-
function
|
|
2342
|
-
const e = /codecs=(["'])?((?:.(?!\1|>))*.?)\1?/.exec(
|
|
2352
|
+
function at(r) {
|
|
2353
|
+
const e = /codecs=(["'])?((?:.(?!\1|>))*.?)\1?/.exec(r);
|
|
2343
2354
|
if (e === null)
|
|
2344
2355
|
return;
|
|
2345
|
-
const
|
|
2346
|
-
if (
|
|
2356
|
+
const t = e[2] ?? "";
|
|
2357
|
+
if (t.includes("mp4a") || t.includes("aac"))
|
|
2347
2358
|
return "aac";
|
|
2348
|
-
if (
|
|
2349
|
-
return
|
|
2350
|
-
}
|
|
2351
|
-
function
|
|
2352
|
-
const
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2359
|
+
if (t === "flac")
|
|
2360
|
+
return t;
|
|
2361
|
+
}
|
|
2362
|
+
function ot(r) {
|
|
2363
|
+
const e = /PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?/.exec(r);
|
|
2364
|
+
if (!e)
|
|
2365
|
+
throw new Error("Invalid duration format");
|
|
2366
|
+
const t = parseFloat(e[1] || "0"), s = parseFloat(e[2] || "0"), n = parseFloat(e[3] || "0");
|
|
2367
|
+
return t * 3600 + s * 60 + n;
|
|
2368
|
+
}
|
|
2369
|
+
function ct(r) {
|
|
2370
|
+
const e = /mediaPresentationDuration="([^"]+)"/.exec(r);
|
|
2371
|
+
if (e) {
|
|
2372
|
+
const t = e[1];
|
|
2373
|
+
if (t)
|
|
2374
|
+
return ot(t);
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
function dt(r) {
|
|
2378
|
+
const { prefetched: e, streamingSessionId: t } = r, s = "albumReplayGain" in r ? {
|
|
2379
|
+
albumPeakAmplitude: r.albumPeakAmplitude,
|
|
2380
|
+
albumReplayGain: r.albumReplayGain,
|
|
2381
|
+
trackPeakAmplitude: r.trackPeakAmplitude,
|
|
2382
|
+
trackReplayGain: r.trackReplayGain
|
|
2383
|
+
} : {}, n = "audioQuality" in r ? r.audioQuality : r.videoQuality, o = {
|
|
2358
2384
|
id: String(
|
|
2359
|
-
"videoId" in
|
|
2385
|
+
"videoId" in r ? r.videoId : r.trackId
|
|
2360
2386
|
),
|
|
2361
|
-
type: "trackId" in
|
|
2387
|
+
type: "trackId" in r ? "track" : "video"
|
|
2362
2388
|
};
|
|
2363
|
-
if (
|
|
2364
|
-
const a =
|
|
2389
|
+
if (r.manifestMimeType === N.BTS || r.manifestMimeType === N.EMU) {
|
|
2390
|
+
const a = st(r.manifest), c = a.urls[0], u = it(
|
|
2365
2391
|
a,
|
|
2366
|
-
"audioQuality" in
|
|
2392
|
+
"audioQuality" in r ? r.audioQuality : null
|
|
2367
2393
|
);
|
|
2368
2394
|
let d;
|
|
2369
|
-
return "keyId" in a && (d = a.keyId), "licenseSecurityToken" in
|
|
2395
|
+
return "keyId" in a && (d = a.keyId), "licenseSecurityToken" in r && (d = r.licenseSecurityToken), {
|
|
2370
2396
|
...s,
|
|
2371
|
-
bitDepth: "bitDepth" in
|
|
2372
|
-
codec:
|
|
2397
|
+
bitDepth: "bitDepth" in r ? r.bitDepth ?? void 0 : void 0,
|
|
2398
|
+
codec: nt(u),
|
|
2373
2399
|
prefetched: e,
|
|
2374
2400
|
quality: n,
|
|
2375
|
-
sampleRate: "sampleRate" in
|
|
2401
|
+
sampleRate: "sampleRate" in r ? r.sampleRate ?? void 0 : void 0,
|
|
2376
2402
|
securityToken: d,
|
|
2377
|
-
streamFormat:
|
|
2403
|
+
streamFormat: u,
|
|
2378
2404
|
streamUrl: c,
|
|
2379
|
-
streamingSessionId:
|
|
2405
|
+
streamingSessionId: t,
|
|
2380
2406
|
...o,
|
|
2381
|
-
expires:
|
|
2407
|
+
expires: r.expires
|
|
2382
2408
|
};
|
|
2383
2409
|
}
|
|
2384
|
-
if (
|
|
2385
|
-
const a = `data:${
|
|
2410
|
+
if (r.manifestMimeType === N.DASH) {
|
|
2411
|
+
const a = `data:${r.manifestMimeType};base64,${r.manifest}`, c = atob(r.manifest);
|
|
2386
2412
|
return {
|
|
2387
2413
|
...s,
|
|
2388
|
-
bitDepth: "bitDepth" in
|
|
2389
|
-
codec:
|
|
2414
|
+
bitDepth: "bitDepth" in r ? r.bitDepth ?? void 0 : void 0,
|
|
2415
|
+
codec: at(c),
|
|
2416
|
+
duration: ct(c),
|
|
2390
2417
|
prefetched: e,
|
|
2391
2418
|
quality: n,
|
|
2392
|
-
sampleRate: "sampleRate" in
|
|
2393
|
-
securityToken:
|
|
2419
|
+
sampleRate: "sampleRate" in r ? r.sampleRate ?? void 0 : void 0,
|
|
2420
|
+
securityToken: r.licenseSecurityToken,
|
|
2394
2421
|
streamUrl: a,
|
|
2395
|
-
streamingSessionId:
|
|
2422
|
+
streamingSessionId: t,
|
|
2396
2423
|
...o,
|
|
2397
|
-
expires:
|
|
2424
|
+
expires: r.expires
|
|
2398
2425
|
};
|
|
2399
2426
|
}
|
|
2400
2427
|
throw new TypeError(
|
|
2401
|
-
`${
|
|
2428
|
+
`${r.manifestMimeType} not supported as playback info manifest mime type.`
|
|
2402
2429
|
);
|
|
2403
2430
|
}
|
|
2404
|
-
const
|
|
2431
|
+
const K = async (r, e = {}, t = 3) => {
|
|
2405
2432
|
let s, n;
|
|
2406
2433
|
try {
|
|
2407
|
-
s = await fetch(
|
|
2434
|
+
s = await fetch(r, e);
|
|
2408
2435
|
} catch (c) {
|
|
2409
|
-
if (
|
|
2436
|
+
if (t === 0)
|
|
2410
2437
|
throw c;
|
|
2411
2438
|
n = null;
|
|
2412
2439
|
}
|
|
2413
2440
|
if (s?.ok)
|
|
2414
2441
|
return s;
|
|
2415
2442
|
const o = s && s.status >= 500 && s.status <= 599, a = n === null || o || s?.status === 429;
|
|
2416
|
-
if (
|
|
2417
|
-
const c = 500 * Math.abs(4 -
|
|
2443
|
+
if (t > 0 && a) {
|
|
2444
|
+
const c = 500 * Math.abs(4 - t);
|
|
2418
2445
|
return console.debug(
|
|
2419
2446
|
`Retrying request for ${Math.abs(
|
|
2420
|
-
4 -
|
|
2447
|
+
4 - t
|
|
2421
2448
|
)}th time in ${c}ms`
|
|
2422
|
-
), await
|
|
2449
|
+
), await fe(c), K(r, e, t - 1);
|
|
2423
2450
|
}
|
|
2424
2451
|
if (!s)
|
|
2425
2452
|
throw new Error("Retries exchaused. Cannot fetch playbackinfo.");
|
|
2426
2453
|
return s;
|
|
2427
2454
|
};
|
|
2428
|
-
function
|
|
2455
|
+
function lt(r, e) {
|
|
2429
2456
|
switch (e) {
|
|
2457
|
+
case 4010:
|
|
2458
|
+
return "PEMonthlyStreamQuotaExceeded";
|
|
2430
2459
|
case 4032:
|
|
2431
2460
|
case 4035:
|
|
2432
2461
|
return "PEContentNotAvailableInLocation";
|
|
2433
2462
|
case 4033:
|
|
2434
2463
|
return "PEContentNotAvailableForSubscription";
|
|
2435
|
-
case 4010:
|
|
2436
|
-
return "PEMonthlyStreamQuotaExceeded";
|
|
2437
2464
|
}
|
|
2438
|
-
return
|
|
2465
|
+
return r >= 500 && r < 600 || r === 429 ? "PERetryable" : r >= 400 && r < 500 ? "PENotAllowed" : "EUnexpected";
|
|
2439
2466
|
}
|
|
2440
|
-
async function
|
|
2467
|
+
async function ut(r) {
|
|
2441
2468
|
const {
|
|
2442
2469
|
accessToken: e,
|
|
2443
|
-
audioQuality:
|
|
2470
|
+
audioQuality: t,
|
|
2444
2471
|
clientId: s,
|
|
2445
2472
|
mediaProduct: n,
|
|
2446
2473
|
prefetch: o,
|
|
2447
2474
|
streamingSessionId: a
|
|
2448
|
-
} =
|
|
2475
|
+
} = r, c = C("apiUrl"), u = new URL(
|
|
2449
2476
|
`${c}/${n.productType}s/${n.productId}/playbackinfo`
|
|
2450
|
-
), d =
|
|
2451
|
-
n.productType === "video" ? d.set("videoquality", "HIGH") : d.set("audioquality",
|
|
2477
|
+
), d = u.searchParams;
|
|
2478
|
+
n.productType === "video" ? d.set("videoquality", "HIGH") : d.set("audioquality", t), d.set("playbackmode", "STREAM"), d.set("assetpresentation", "FULL");
|
|
2452
2479
|
const b = new Headers();
|
|
2453
2480
|
o && b.set("x-tidal-prefetch", "true"), s && b.set("x-tidal-token", s), e && b.set("authorization", "Bearer " + e), a && b.set("x-tidal-streamingsessionid", a);
|
|
2454
|
-
let
|
|
2481
|
+
let M;
|
|
2455
2482
|
try {
|
|
2456
|
-
|
|
2457
|
-
|
|
2483
|
+
M = await K(
|
|
2484
|
+
u.toString(),
|
|
2458
2485
|
{
|
|
2459
2486
|
headers: b,
|
|
2460
2487
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2464,37 +2491,39 @@ async function vt(t) {
|
|
|
2464
2491
|
3
|
|
2465
2492
|
);
|
|
2466
2493
|
} catch {
|
|
2467
|
-
throw new
|
|
2494
|
+
throw new O("PENetwork", "NPBI0");
|
|
2468
2495
|
}
|
|
2469
|
-
const f = await
|
|
2496
|
+
const f = await M.json();
|
|
2470
2497
|
if ("status" in f) {
|
|
2471
|
-
const
|
|
2472
|
-
throw new
|
|
2498
|
+
const ae = `A${f.subStatus}`;
|
|
2499
|
+
throw new O(lt(f.status, f.subStatus), ae);
|
|
2473
2500
|
}
|
|
2474
|
-
const
|
|
2475
|
-
if (!
|
|
2476
|
-
throw new
|
|
2501
|
+
const ie = "trackId" in f, ne = "videoId" in f;
|
|
2502
|
+
if (!ie && !ne)
|
|
2503
|
+
throw new O("EUnexpected", "B9999");
|
|
2477
2504
|
return {
|
|
2478
2505
|
...f,
|
|
2506
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
2507
|
+
expires: Date.now() + 36e5,
|
|
2479
2508
|
prefetched: o
|
|
2480
2509
|
};
|
|
2481
2510
|
}
|
|
2482
|
-
async function
|
|
2483
|
-
const { streamingSessionId: e } =
|
|
2511
|
+
async function ht(r) {
|
|
2512
|
+
const { streamingSessionId: e } = r, t = [];
|
|
2484
2513
|
performance.mark("streaming_metrics:playback_info_fetch:startTimestamp", {
|
|
2485
2514
|
detail: e,
|
|
2486
2515
|
startTime: y.now()
|
|
2487
2516
|
});
|
|
2488
2517
|
try {
|
|
2489
|
-
|
|
2490
|
-
if (s === void 0)
|
|
2518
|
+
let s;
|
|
2519
|
+
if (s = await ut(r), s === void 0)
|
|
2491
2520
|
throw new Error("Playback info was fetched, but undefined.");
|
|
2492
|
-
|
|
2521
|
+
F({
|
|
2493
2522
|
endReason: "COMPLETE",
|
|
2494
2523
|
streamingSessionId: e
|
|
2495
|
-
}).catch(console.error)
|
|
2524
|
+
}).catch(console.error);
|
|
2496
2525
|
const n = "adInfo" in s;
|
|
2497
|
-
return "trackId" in s ?
|
|
2526
|
+
return "trackId" in s ? z({
|
|
2498
2527
|
actualAssetPresentation: s.assetPresentation,
|
|
2499
2528
|
actualAudioMode: s.audioMode,
|
|
2500
2529
|
actualProductId: String(s.trackId),
|
|
@@ -2503,7 +2532,7 @@ async function St(t) {
|
|
|
2503
2532
|
hasAds: n,
|
|
2504
2533
|
productType: "TRACK",
|
|
2505
2534
|
streamingSessionId: e
|
|
2506
|
-
}).catch(console.error) :
|
|
2535
|
+
}).catch(console.error) : z({
|
|
2507
2536
|
actualAssetPresentation: s.assetPresentation,
|
|
2508
2537
|
actualAudioMode: void 0,
|
|
2509
2538
|
actualProductId: String(s.videoId),
|
|
@@ -2520,13 +2549,13 @@ async function St(t) {
|
|
|
2520
2549
|
throw performance.mark("streaming_metrics:playback_info_fetch:endTimestamp", {
|
|
2521
2550
|
detail: e,
|
|
2522
2551
|
startTime: y.now()
|
|
2523
|
-
}),
|
|
2552
|
+
}), F({
|
|
2524
2553
|
endReason: "ERROR",
|
|
2525
2554
|
errorCode: s.message,
|
|
2526
2555
|
errorMessage: s.stack,
|
|
2527
2556
|
streamingSessionId: e
|
|
2528
|
-
}).catch(console.error),
|
|
2529
|
-
|
|
2557
|
+
}).catch(console.error), t.push(
|
|
2558
|
+
qe({
|
|
2530
2559
|
streamingSessionId: e,
|
|
2531
2560
|
timestamp: y.timestamp(
|
|
2532
2561
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
@@ -2534,8 +2563,8 @@ async function St(t) {
|
|
|
2534
2563
|
})
|
|
2535
2564
|
), s;
|
|
2536
2565
|
} finally {
|
|
2537
|
-
|
|
2538
|
-
|
|
2566
|
+
t.push(
|
|
2567
|
+
F({
|
|
2539
2568
|
endTimestamp: y.timestamp(
|
|
2540
2569
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
2541
2570
|
),
|
|
@@ -2544,51 +2573,43 @@ async function St(t) {
|
|
|
2544
2573
|
),
|
|
2545
2574
|
streamingSessionId: e
|
|
2546
2575
|
})
|
|
2547
|
-
),
|
|
2548
|
-
events: r
|
|
2549
|
-
}).catch(console.error), performance.clearMarks(
|
|
2576
|
+
), j(t).catch(console.error), performance.clearMarks(
|
|
2550
2577
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
2551
2578
|
), performance.clearMarks(
|
|
2552
2579
|
"streaming_metrics:playback_info_fetch:startTimestamp"
|
|
2553
2580
|
);
|
|
2554
2581
|
}
|
|
2555
2582
|
}
|
|
2556
|
-
class
|
|
2583
|
+
class Y {
|
|
2557
2584
|
/**
|
|
2558
2585
|
* The current time position to restore playback from when connection is back online.
|
|
2559
2586
|
*/
|
|
2560
2587
|
static #e = 0;
|
|
2561
|
-
static #
|
|
2588
|
+
static #r = !1;
|
|
2562
2589
|
/**
|
|
2563
2590
|
* The media product to restore when connection is back online.
|
|
2564
2591
|
*/
|
|
2565
2592
|
static #s = null;
|
|
2566
|
-
static #
|
|
2593
|
+
static #t;
|
|
2567
2594
|
static #i;
|
|
2568
2595
|
static #n;
|
|
2569
|
-
static disable() {
|
|
2570
|
-
this.#t && (this.#r && window.removeEventListener("offline", this.#r, !1), this.#i && window.removeEventListener("online", this.#i, !1), this.#i = void 0, this.#r = void 0, this.#t = !1);
|
|
2571
|
-
}
|
|
2572
|
-
static enable() {
|
|
2573
|
-
this.#t || (this.#i = () => this.#o(), this.#r = () => this.#a(), window.addEventListener("offline", this.#r, !1), window.addEventListener("online", this.#i, !1), this.#t = !0);
|
|
2574
|
-
}
|
|
2575
2596
|
static #a() {
|
|
2576
2597
|
const { activePlayer: e } = p;
|
|
2577
|
-
|
|
2598
|
+
e?.hasStarted() && (this.#s = e.currentMediaProduct, this.#n = this.#d.bind(this), m.addEventListener(
|
|
2578
2599
|
"playback-state-change",
|
|
2579
2600
|
this.#n
|
|
2580
2601
|
));
|
|
2581
2602
|
}
|
|
2582
2603
|
static #o() {
|
|
2583
2604
|
const { activePlayer: e } = p;
|
|
2584
|
-
|
|
2605
|
+
e?.hasStarted() && (e.playbackState !== "PLAYING" && this.#s && (m.dispatchEvent(
|
|
2585
2606
|
new CustomEvent("load", {
|
|
2586
2607
|
detail: {
|
|
2587
2608
|
currentTime: this.#e,
|
|
2588
2609
|
mediaProduct: this.#s
|
|
2589
2610
|
}
|
|
2590
2611
|
})
|
|
2591
|
-
), this.#c()),
|
|
2612
|
+
), this.#c()), m.removeEventListener(
|
|
2592
2613
|
"playback-state-change",
|
|
2593
2614
|
this.#n
|
|
2594
2615
|
));
|
|
@@ -2600,36 +2621,42 @@ class oe {
|
|
|
2600
2621
|
const { activePlayer: e } = p;
|
|
2601
2622
|
e && (this.#e = e.currentTime);
|
|
2602
2623
|
}
|
|
2624
|
+
static disable() {
|
|
2625
|
+
this.#r && (this.#t && window.removeEventListener("offline", this.#t, !1), this.#i && window.removeEventListener("online", this.#i, !1), this.#i = void 0, this.#t = void 0, this.#r = !1);
|
|
2626
|
+
}
|
|
2627
|
+
static enable() {
|
|
2628
|
+
this.#r || (this.#i = () => this.#o(), this.#t = () => this.#a(), window.addEventListener("offline", this.#t, !1), window.addEventListener("online", this.#i, !1), this.#r = !0);
|
|
2629
|
+
}
|
|
2603
2630
|
}
|
|
2604
|
-
const
|
|
2605
|
-
function
|
|
2606
|
-
return new CustomEvent(
|
|
2607
|
-
detail:
|
|
2631
|
+
const mt = "streaming-privileges-revoked";
|
|
2632
|
+
function pt(r) {
|
|
2633
|
+
return new CustomEvent(mt, {
|
|
2634
|
+
detail: r
|
|
2608
2635
|
});
|
|
2609
2636
|
}
|
|
2610
|
-
let
|
|
2611
|
-
async function
|
|
2612
|
-
const e =
|
|
2637
|
+
let E;
|
|
2638
|
+
async function J(r) {
|
|
2639
|
+
const e = C("apiUrl"), t = await fetch(e + "/rt/connect", {
|
|
2613
2640
|
headers: new Headers({
|
|
2614
|
-
Authorization: "Bearer " +
|
|
2641
|
+
Authorization: "Bearer " + r,
|
|
2615
2642
|
"Content-Type": "application/json"
|
|
2616
2643
|
}),
|
|
2617
2644
|
method: "POST"
|
|
2618
|
-
}), { url: s } = await
|
|
2645
|
+
}), { url: s } = await t.json();
|
|
2619
2646
|
return s;
|
|
2620
2647
|
}
|
|
2621
|
-
function
|
|
2648
|
+
function X(r) {
|
|
2622
2649
|
return new Promise((e) => {
|
|
2623
|
-
|
|
2650
|
+
r.addEventListener("open", () => e(), { once: !0 });
|
|
2624
2651
|
});
|
|
2625
2652
|
}
|
|
2626
|
-
class
|
|
2653
|
+
class _ {
|
|
2627
2654
|
#e;
|
|
2628
|
-
#t;
|
|
2629
|
-
#s;
|
|
2630
2655
|
#r;
|
|
2656
|
+
#s;
|
|
2657
|
+
#t;
|
|
2631
2658
|
constructor() {
|
|
2632
|
-
this.#
|
|
2659
|
+
this.#t = void 0, this.#r = this.#i(), m.addEventListener("user-action", () => {
|
|
2633
2660
|
this.connected && this.userAction().then().catch(console.error);
|
|
2634
2661
|
});
|
|
2635
2662
|
}
|
|
@@ -2637,43 +2664,43 @@ class z {
|
|
|
2637
2664
|
* Call this method to ensure pushkin is running.
|
|
2638
2665
|
*/
|
|
2639
2666
|
static async ensure() {
|
|
2640
|
-
await
|
|
2667
|
+
await P() && (E ? E.connected || await E.reconnect() : E = new _());
|
|
2641
2668
|
}
|
|
2642
2669
|
/**
|
|
2643
2670
|
* Call this method when credentials changes to re-setup pushkin with the new credentials
|
|
2644
2671
|
*/
|
|
2645
2672
|
static async refresh() {
|
|
2646
|
-
if (!await
|
|
2673
|
+
if (!await P())
|
|
2647
2674
|
return;
|
|
2648
|
-
const e = await
|
|
2649
|
-
|
|
2675
|
+
const e = await V();
|
|
2676
|
+
E && e && E.reconnect().catch(console.error);
|
|
2650
2677
|
}
|
|
2651
2678
|
async #i() {
|
|
2652
|
-
const e = await
|
|
2679
|
+
const e = await V();
|
|
2653
2680
|
if (!e)
|
|
2654
2681
|
throw new Error("No access token to connect to Pushkin.");
|
|
2655
|
-
const
|
|
2656
|
-
|
|
2682
|
+
const t = await J(e);
|
|
2683
|
+
t && (this.#t = new WebSocket(t), await X(this.#t), this.#s = (s) => this.#o(s.data), this.#e = () => this.#a(), this.#t.addEventListener("message", this.#s, !1), this.#t.addEventListener("closed", this.#e, !1), window.addEventListener("online", () => this.#a(), {
|
|
2657
2684
|
once: !0
|
|
2658
2685
|
}));
|
|
2659
2686
|
}
|
|
2660
2687
|
async #n(e) {
|
|
2661
|
-
if (!this.#
|
|
2688
|
+
if (!this.#t)
|
|
2662
2689
|
throw new Error(
|
|
2663
2690
|
"No socket connected. Did you forget to call connect method in Pushkin service first?"
|
|
2664
2691
|
);
|
|
2665
|
-
this.#
|
|
2692
|
+
this.#t.readyState !== WebSocket.OPEN && await this.#r, this.#t.send(JSON.stringify(e));
|
|
2666
2693
|
}
|
|
2667
2694
|
#a() {
|
|
2668
|
-
this.#
|
|
2695
|
+
this.#r = this.#i();
|
|
2669
2696
|
}
|
|
2670
2697
|
#o(e) {
|
|
2671
|
-
const
|
|
2672
|
-
switch (
|
|
2698
|
+
const t = JSON.parse(e);
|
|
2699
|
+
switch (t.type) {
|
|
2673
2700
|
case "PRIVILEGED_SESSION_NOTIFICATION": {
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
String(
|
|
2701
|
+
m.dispatchEvent(
|
|
2702
|
+
pt(
|
|
2703
|
+
String(t.payload.clientDisplayName)
|
|
2677
2704
|
)
|
|
2678
2705
|
), p.activePlayer?.pause();
|
|
2679
2706
|
break;
|
|
@@ -2682,12 +2709,12 @@ class z {
|
|
|
2682
2709
|
this.reconnect().catch(console.error);
|
|
2683
2710
|
break;
|
|
2684
2711
|
default:
|
|
2685
|
-
console.warn("Unhandled event from Pushkin: ",
|
|
2712
|
+
console.warn("Unhandled event from Pushkin: ", t);
|
|
2686
2713
|
break;
|
|
2687
2714
|
}
|
|
2688
2715
|
}
|
|
2689
2716
|
reconnect() {
|
|
2690
|
-
return this.#
|
|
2717
|
+
return this.#t ? (this.#s && this.#t.removeEventListener("message", this.#s), this.#e && this.#t.removeEventListener("closed", this.#e), this.#t.close(), this.#r = this.#i(), this.#r) : Promise.resolve();
|
|
2691
2718
|
}
|
|
2692
2719
|
/**
|
|
2693
2720
|
* Call this method to tell Pushkin a user action happened, so it can
|
|
@@ -2707,19 +2734,22 @@ class z {
|
|
|
2707
2734
|
}
|
|
2708
2735
|
}
|
|
2709
2736
|
get connected() {
|
|
2710
|
-
return this.#
|
|
2737
|
+
return this.#t && this.#t.readyState === WebSocket.OPEN;
|
|
2711
2738
|
}
|
|
2712
2739
|
}
|
|
2713
|
-
const
|
|
2740
|
+
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2714
2741
|
__proto__: null,
|
|
2715
|
-
Pushkin:
|
|
2716
|
-
fetchWebSocketURL:
|
|
2717
|
-
socketOpen:
|
|
2742
|
+
Pushkin: _,
|
|
2743
|
+
fetchWebSocketURL: J,
|
|
2744
|
+
socketOpen: X
|
|
2718
2745
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2719
|
-
async function
|
|
2720
|
-
|
|
2746
|
+
async function gt() {
|
|
2747
|
+
Ae(), Y.disable(), await Te();
|
|
2721
2748
|
}
|
|
2722
|
-
|
|
2749
|
+
function Ht(r, e) {
|
|
2750
|
+
return r === "FULL" && e.sourceType !== "PRIVATE_LINK_SHARING";
|
|
2751
|
+
}
|
|
2752
|
+
const yt = {
|
|
2723
2753
|
actions: [],
|
|
2724
2754
|
actualAssetPresentation: "PREVIEW",
|
|
2725
2755
|
actualAudioMode: "STEREO",
|
|
@@ -2735,21 +2765,57 @@ const Tt = {
|
|
|
2735
2765
|
sourceType: "",
|
|
2736
2766
|
startAssetPosition: -1,
|
|
2737
2767
|
startTimestamp: -1
|
|
2738
|
-
},
|
|
2768
|
+
}, Z = await T(
|
|
2739
2769
|
"playback_session",
|
|
2740
|
-
|
|
2770
|
+
yt
|
|
2741
2771
|
);
|
|
2742
|
-
function
|
|
2743
|
-
|
|
2772
|
+
async function Ut(r) {
|
|
2773
|
+
const e = await Z(r);
|
|
2774
|
+
if (!e) {
|
|
2775
|
+
console.error("reducedData is undefined");
|
|
2776
|
+
return;
|
|
2777
|
+
}
|
|
2778
|
+
const { name: t, streamingSessionId: s } = e, { extras: n, ...o } = e.payload;
|
|
2779
|
+
return {
|
|
2780
|
+
extras: n,
|
|
2781
|
+
name: t,
|
|
2782
|
+
payload: o,
|
|
2783
|
+
streamingSessionId: s
|
|
2784
|
+
};
|
|
2744
2785
|
}
|
|
2745
|
-
function
|
|
2746
|
-
return
|
|
2786
|
+
function Vt(r, e) {
|
|
2787
|
+
return Z({
|
|
2747
2788
|
actions: [e],
|
|
2748
|
-
streamingSessionId:
|
|
2789
|
+
streamingSessionId: r
|
|
2749
2790
|
});
|
|
2750
2791
|
}
|
|
2751
|
-
|
|
2752
|
-
|
|
2792
|
+
function zt(r) {
|
|
2793
|
+
switch (r) {
|
|
2794
|
+
case "video":
|
|
2795
|
+
return "VIDEO";
|
|
2796
|
+
case "track":
|
|
2797
|
+
default:
|
|
2798
|
+
return "TRACK";
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
async function Wt(r) {
|
|
2802
|
+
const e = await P();
|
|
2803
|
+
for (const t of r)
|
|
2804
|
+
if (t) {
|
|
2805
|
+
const s = await t;
|
|
2806
|
+
s && await G({
|
|
2807
|
+
..."extras" in s && { extras: s.extras },
|
|
2808
|
+
group: e ? "play_log" : "play_log_open",
|
|
2809
|
+
name: s.name,
|
|
2810
|
+
payload: s.payload,
|
|
2811
|
+
version: 2
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
async function ee(r, e = 0, t = !1) {
|
|
2816
|
+
if (!D.hasEventSender())
|
|
2817
|
+
throw new Error("Playback not allowed without an event sender.");
|
|
2818
|
+
if (await y.synchronize(), _.ensure().catch(console.error), p.activePlayer?.nextItem && p.activePlayer.nextItem.mediaProduct.productId === r.productId) {
|
|
2753
2819
|
const f = p.activePlayer;
|
|
2754
2820
|
return performance.mark(
|
|
2755
2821
|
"streaming_metrics:playback_statistics:idealStartTimestamp",
|
|
@@ -2757,148 +2823,143 @@ async function ue(t, e = 0, r = !1) {
|
|
|
2757
2823
|
detail: p.preloadedStreamingSessionId,
|
|
2758
2824
|
startTime: y.now()
|
|
2759
2825
|
}
|
|
2760
|
-
), await f.reset({ keepPreload: !0 }),
|
|
2826
|
+
), await f.reset({ keepPreload: !0 }), r.referenceId && p.preloadedStreamingSessionId && f.overwriteMediaProduct(
|
|
2761
2827
|
p.preloadedStreamingSessionId,
|
|
2762
|
-
|
|
2828
|
+
r
|
|
2763
2829
|
), f.skipToPreloadedMediaProduct();
|
|
2764
2830
|
}
|
|
2765
|
-
const s =
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
]
|
|
2777
|
-
}).catch(console.error), performance.mark(
|
|
2831
|
+
const s = gt(), n = rt();
|
|
2832
|
+
j([
|
|
2833
|
+
et({
|
|
2834
|
+
sessionProductId: r.productId,
|
|
2835
|
+
sessionProductType: r.productType === "track" ? "TRACK" : "VIDEO",
|
|
2836
|
+
sessionType: "PLAYBACK",
|
|
2837
|
+
startReason: "EXPLICIT",
|
|
2838
|
+
streamingSessionId: n,
|
|
2839
|
+
timestamp: y.now()
|
|
2840
|
+
})
|
|
2841
|
+
]).catch(console.error), performance.mark(
|
|
2778
2842
|
"streaming_metrics:playback_statistics:idealStartTimestamp",
|
|
2779
2843
|
{
|
|
2780
2844
|
detail: n,
|
|
2781
2845
|
startTime: y.now()
|
|
2782
2846
|
}
|
|
2783
2847
|
);
|
|
2784
|
-
const { clientId: o, token: a } = await v.credentialsProvider.getCredentials(), c =
|
|
2785
|
-
let
|
|
2848
|
+
const { clientId: o, token: a } = await v.credentialsProvider.getCredentials(), c = C("streamingWifiAudioQuality");
|
|
2849
|
+
let u = null;
|
|
2786
2850
|
try {
|
|
2787
|
-
|
|
2851
|
+
u = await ht({
|
|
2788
2852
|
accessToken: a,
|
|
2789
2853
|
audioQuality: c,
|
|
2790
2854
|
clientId: o,
|
|
2791
|
-
mediaProduct:
|
|
2792
|
-
prefetch:
|
|
2855
|
+
mediaProduct: r,
|
|
2856
|
+
prefetch: t,
|
|
2793
2857
|
streamingSessionId: n
|
|
2794
2858
|
});
|
|
2795
2859
|
} catch (f) {
|
|
2796
|
-
f instanceof
|
|
2860
|
+
f instanceof O && m.dispatchError(f), document.location.href.includes("localhost") && console.error(f);
|
|
2797
2861
|
}
|
|
2798
|
-
if (!
|
|
2862
|
+
if (!u)
|
|
2799
2863
|
return;
|
|
2800
|
-
const d =
|
|
2801
|
-
|
|
2864
|
+
const d = dt(u);
|
|
2865
|
+
H.saveStreamInfo(
|
|
2802
2866
|
d.streamingSessionId,
|
|
2803
2867
|
d
|
|
2804
|
-
), await s,
|
|
2805
|
-
const b = "trackId" in
|
|
2806
|
-
|
|
2868
|
+
), await s, Y.enable();
|
|
2869
|
+
const b = "trackId" in u ? u.audioQuality : void 0, M = await _e(
|
|
2870
|
+
r.productType,
|
|
2807
2871
|
b
|
|
2808
2872
|
);
|
|
2809
|
-
return
|
|
2873
|
+
return Ie(M), M.load(
|
|
2810
2874
|
{
|
|
2811
2875
|
assetPosition: e,
|
|
2812
|
-
mediaProduct:
|
|
2813
|
-
playbackInfo:
|
|
2876
|
+
mediaProduct: r,
|
|
2877
|
+
playbackInfo: u,
|
|
2814
2878
|
streamInfo: d
|
|
2815
2879
|
},
|
|
2816
2880
|
"explicit"
|
|
2817
2881
|
);
|
|
2818
2882
|
}
|
|
2819
|
-
|
|
2820
|
-
if (
|
|
2821
|
-
const { currentTime: e, mediaProduct:
|
|
2822
|
-
|
|
2883
|
+
m.addEventListener("load", (r) => {
|
|
2884
|
+
if (r instanceof CustomEvent) {
|
|
2885
|
+
const { currentTime: e, mediaProduct: t } = r.detail;
|
|
2886
|
+
ee(t, e).then().catch(console.error);
|
|
2823
2887
|
}
|
|
2824
2888
|
});
|
|
2825
|
-
function
|
|
2889
|
+
function wt() {
|
|
2826
2890
|
return p.activePlayer?.pause();
|
|
2827
2891
|
}
|
|
2828
|
-
async function
|
|
2892
|
+
async function bt() {
|
|
2829
2893
|
await y.synchronize();
|
|
2830
|
-
const { activePlayer:
|
|
2831
|
-
return
|
|
2894
|
+
const { activePlayer: r } = p;
|
|
2895
|
+
return r ? (m.dispatchEvent(new CustomEvent("user-action")), r.play()) : Promise.reject(new Error("No active player"));
|
|
2832
2896
|
}
|
|
2833
|
-
async function
|
|
2897
|
+
async function vt(r) {
|
|
2834
2898
|
const { activePlayer: e } = p;
|
|
2835
|
-
return e?.seek(
|
|
2899
|
+
return e?.seek(r);
|
|
2836
2900
|
}
|
|
2837
|
-
function
|
|
2838
|
-
v.credentialsProvider =
|
|
2901
|
+
function $t(r) {
|
|
2902
|
+
v.credentialsProvider = r;
|
|
2839
2903
|
}
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
return new CustomEvent(At, {
|
|
2843
|
-
detail: t
|
|
2844
|
-
});
|
|
2904
|
+
function qt(r) {
|
|
2905
|
+
D.eventSender = r;
|
|
2845
2906
|
}
|
|
2846
|
-
const
|
|
2847
|
-
function
|
|
2848
|
-
return new CustomEvent(
|
|
2849
|
-
detail:
|
|
2907
|
+
const St = "active-device-changed";
|
|
2908
|
+
function Qt(r) {
|
|
2909
|
+
return new CustomEvent(St, {
|
|
2910
|
+
detail: r
|
|
2850
2911
|
});
|
|
2851
2912
|
}
|
|
2852
|
-
const
|
|
2853
|
-
function
|
|
2854
|
-
return new CustomEvent(
|
|
2855
|
-
detail:
|
|
2913
|
+
const Mt = "active-device-mode-changed";
|
|
2914
|
+
function Gt(r) {
|
|
2915
|
+
return new CustomEvent(Mt, {
|
|
2916
|
+
detail: r
|
|
2856
2917
|
});
|
|
2857
2918
|
}
|
|
2858
2919
|
y.synchronize().then().catch(console.error);
|
|
2859
|
-
function
|
|
2860
|
-
const { activePlayer:
|
|
2861
|
-
if (!
|
|
2920
|
+
function te() {
|
|
2921
|
+
const { activePlayer: r } = p;
|
|
2922
|
+
if (!r)
|
|
2862
2923
|
return null;
|
|
2863
|
-
switch (
|
|
2864
|
-
case "shakaPlayer":
|
|
2865
|
-
return t.mediaElement;
|
|
2924
|
+
switch (r.name) {
|
|
2866
2925
|
case "browserPlayer":
|
|
2867
|
-
return
|
|
2926
|
+
return r.mediaElement;
|
|
2927
|
+
case "shakaPlayer":
|
|
2928
|
+
return r.mediaElement;
|
|
2868
2929
|
default:
|
|
2869
2930
|
return null;
|
|
2870
2931
|
}
|
|
2871
2932
|
}
|
|
2872
|
-
function
|
|
2873
|
-
const
|
|
2933
|
+
function kt() {
|
|
2934
|
+
const r = localStorage.getItem("ssuid");
|
|
2874
2935
|
try {
|
|
2875
|
-
|
|
2936
|
+
r && indexedDB.deleteDatabase("streaming-sessions-" + r);
|
|
2876
2937
|
} catch (e) {
|
|
2877
|
-
console.warn(`DB streaming-sessions-${
|
|
2938
|
+
console.warn(`DB streaming-sessions-${r} could not be deleted`), console.error(e);
|
|
2878
2939
|
}
|
|
2879
2940
|
}
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
const
|
|
2884
|
-
function
|
|
2885
|
-
if (
|
|
2941
|
+
he().then().catch(console.error);
|
|
2942
|
+
pe().then().catch(console.error);
|
|
2943
|
+
kt();
|
|
2944
|
+
const U = String.raw, Et = String.raw;
|
|
2945
|
+
function re(r) {
|
|
2946
|
+
if (r === void 0)
|
|
2886
2947
|
return "0:00";
|
|
2887
|
-
const e = parseInt(String(
|
|
2948
|
+
const e = parseInt(String(r), 10), t = Math.floor(e / 3600), s = Math.floor((e - t * 3600) / 60), n = e - t * 3600 - s * 60;
|
|
2888
2949
|
let o = "";
|
|
2889
|
-
if (
|
|
2950
|
+
if (t !== 0) {
|
|
2890
2951
|
const a = s < 10 ? `0${s}` : String(s);
|
|
2891
|
-
o = `${
|
|
2952
|
+
o = `${t}:${a}:`;
|
|
2892
2953
|
} else
|
|
2893
2954
|
o = `${s}:`;
|
|
2894
2955
|
return o += n < 10 ? `0${n}` : String(n), o;
|
|
2895
2956
|
}
|
|
2896
|
-
function
|
|
2897
|
-
const e = typeof
|
|
2898
|
-
if (c === 0 &&
|
|
2957
|
+
function se(r = 0) {
|
|
2958
|
+
const e = typeof r == "number" ? r : parseInt(r, 10), t = Math.floor(e / 3600) % 24, s = Math.floor(e / 60) % 60, n = e % 60, o = (c, u) => {
|
|
2959
|
+
if (c === 0 && u !== 1)
|
|
2899
2960
|
return "";
|
|
2900
2961
|
let d;
|
|
2901
|
-
switch (
|
|
2962
|
+
switch (u) {
|
|
2902
2963
|
case 0:
|
|
2903
2964
|
d = "H";
|
|
2904
2965
|
break;
|
|
@@ -2911,123 +2972,120 @@ function pe(t = 0) {
|
|
|
2911
2972
|
}
|
|
2912
2973
|
return `${d}${c}`;
|
|
2913
2974
|
};
|
|
2914
|
-
return `P${[
|
|
2975
|
+
return `P${[t, s, n].map(o).join("")}`;
|
|
2915
2976
|
}
|
|
2916
|
-
const
|
|
2917
|
-
class
|
|
2977
|
+
const Pt = "tidal-current-time";
|
|
2978
|
+
class Tt extends HTMLElement {
|
|
2918
2979
|
#e = void 0;
|
|
2919
|
-
#
|
|
2980
|
+
#r = /* @__PURE__ */ new Set();
|
|
2920
2981
|
#s;
|
|
2921
|
-
#
|
|
2982
|
+
#t;
|
|
2922
2983
|
#i;
|
|
2923
2984
|
constructor() {
|
|
2924
|
-
super(), this.#i = (e) => this.renderTime(e.target.currentTime), this.#
|
|
2985
|
+
super(), this.#i = (e) => this.renderTime(e.target.currentTime), this.#t = () => this.renderTime(0), this.#s = this.#n.bind(this);
|
|
2925
2986
|
}
|
|
2926
2987
|
#n() {
|
|
2927
|
-
const e =
|
|
2928
|
-
e && this.#e && !this.#
|
|
2988
|
+
const e = te();
|
|
2989
|
+
e && this.#e && !this.#r.has(e) && (e.addEventListener("timeupdate", this.#i, !1), this.#r.add(e));
|
|
2929
2990
|
}
|
|
2930
2991
|
connectedCallback() {
|
|
2931
2992
|
const e = this.attachShadow({ mode: "open" });
|
|
2932
2993
|
e.innerHTML = "<time></time>";
|
|
2933
|
-
const
|
|
2934
|
-
this.#e === void 0 &&
|
|
2994
|
+
const t = e.querySelector("time");
|
|
2995
|
+
this.#e === void 0 && t !== null && (this.#e = t), this.renderTime(Fe()), m.addEventListener(
|
|
2935
2996
|
"media-product-transition",
|
|
2936
2997
|
this.#s,
|
|
2937
2998
|
!1
|
|
2938
|
-
),
|
|
2999
|
+
), m.addEventListener("ended", this.#t, !1);
|
|
2939
3000
|
}
|
|
2940
3001
|
disconnectedCallback() {
|
|
2941
|
-
for (let e of this.#
|
|
3002
|
+
for (let e of this.#r)
|
|
2942
3003
|
e.removeEventListener(
|
|
2943
3004
|
"timeupdate",
|
|
2944
3005
|
this.#i,
|
|
2945
3006
|
!1
|
|
2946
3007
|
);
|
|
2947
|
-
|
|
3008
|
+
m.removeEventListener(
|
|
2948
3009
|
"media-product-transition",
|
|
2949
3010
|
this.#s,
|
|
2950
3011
|
!1
|
|
2951
|
-
),
|
|
3012
|
+
), m.removeEventListener("ended", this.#t, !1);
|
|
2952
3013
|
}
|
|
2953
3014
|
renderTime(e) {
|
|
2954
|
-
const
|
|
2955
|
-
this.#e && (this.#e.textContent =
|
|
3015
|
+
const t = Math.floor(e);
|
|
3016
|
+
this.#e && (this.#e.textContent = re(t), this.#e.setAttribute("datetime", se(t)));
|
|
2956
3017
|
}
|
|
2957
3018
|
}
|
|
2958
|
-
customElements.define(
|
|
2959
|
-
const
|
|
2960
|
-
class
|
|
3019
|
+
customElements.define(Pt, Tt);
|
|
3020
|
+
const It = "tidal-duration-time";
|
|
3021
|
+
class At extends HTMLElement {
|
|
2961
3022
|
#e;
|
|
2962
|
-
#
|
|
3023
|
+
#r = !1;
|
|
2963
3024
|
#s;
|
|
2964
3025
|
constructor() {
|
|
2965
3026
|
super(), this.#s = (e) => {
|
|
2966
|
-
const
|
|
2967
|
-
this.renderTime(
|
|
2968
|
-
}, this.#
|
|
3027
|
+
const t = e;
|
|
3028
|
+
this.renderTime(t.detail.playbackContext.actualDuration);
|
|
3029
|
+
}, this.#t();
|
|
2969
3030
|
}
|
|
2970
|
-
#
|
|
2971
|
-
this.#
|
|
3031
|
+
#t() {
|
|
3032
|
+
this.#r || (m.addEventListener(
|
|
2972
3033
|
"media-product-transition",
|
|
2973
3034
|
this.#s,
|
|
2974
3035
|
!1
|
|
2975
|
-
), this.#
|
|
3036
|
+
), this.#r = !0);
|
|
2976
3037
|
}
|
|
2977
3038
|
#i() {
|
|
2978
3039
|
const e = this.attachShadow({ mode: "open" });
|
|
2979
3040
|
this.#e = document.createElement("time"), e.appendChild(this.#e);
|
|
2980
3041
|
}
|
|
2981
3042
|
connectedCallback() {
|
|
2982
|
-
this.#
|
|
2983
|
-
const e = parseInt(String(this.textContent), 10),
|
|
2984
|
-
this.renderTime(
|
|
3043
|
+
this.#t(), this.#i();
|
|
3044
|
+
const e = parseInt(String(this.textContent), 10), t = Number.isNaN(e) ? 0 : e;
|
|
3045
|
+
this.renderTime(Be()?.actualDuration ?? t);
|
|
2985
3046
|
}
|
|
2986
3047
|
disconnectedCallback() {
|
|
2987
|
-
|
|
3048
|
+
m.removeEventListener(
|
|
2988
3049
|
"media-product-transition",
|
|
2989
3050
|
this.#s,
|
|
2990
3051
|
!1
|
|
2991
|
-
), this.#
|
|
3052
|
+
), this.#r = !1;
|
|
2992
3053
|
}
|
|
2993
3054
|
renderTime(e) {
|
|
2994
|
-
const
|
|
2995
|
-
this.#e && (this.#e.textContent =
|
|
3055
|
+
const t = parseInt(e.toFixed(0), 10);
|
|
3056
|
+
this.#e && (this.#e.textContent = re(t), this.#e.setAttribute("datetime", se(t)));
|
|
2996
3057
|
}
|
|
2997
3058
|
}
|
|
2998
|
-
customElements.define(
|
|
2999
|
-
const
|
|
3000
|
-
class
|
|
3059
|
+
customElements.define(It, At);
|
|
3060
|
+
const Lt = "tidal-play-trigger";
|
|
3061
|
+
class Ot extends HTMLElement {
|
|
3001
3062
|
#e;
|
|
3002
|
-
#
|
|
3063
|
+
#r = !1;
|
|
3003
3064
|
constructor() {
|
|
3004
|
-
super(), this.#e = (
|
|
3005
|
-
|
|
3065
|
+
super(), this.#e = () => {
|
|
3066
|
+
this.#s().catch(console.error);
|
|
3006
3067
|
}, this.#i();
|
|
3007
3068
|
}
|
|
3008
|
-
static get observedAttributes() {
|
|
3009
|
-
return ["product-id", "product-type"];
|
|
3010
|
-
}
|
|
3011
3069
|
async #s() {
|
|
3012
|
-
await this.#
|
|
3070
|
+
await this.#t(), q() === "PLAYING" ? wt() : await bt();
|
|
3013
3071
|
}
|
|
3014
|
-
#
|
|
3015
|
-
const e =
|
|
3072
|
+
#t() {
|
|
3073
|
+
const e = Ne()?.productId ?? void 0;
|
|
3016
3074
|
if (this.mediaProduct && this.mediaProduct.productId !== e)
|
|
3017
|
-
return
|
|
3075
|
+
return ee(this.mediaProduct, 0);
|
|
3018
3076
|
}
|
|
3019
3077
|
#i() {
|
|
3020
|
-
this.#
|
|
3078
|
+
this.#r || this.addEventListener("click", this.#e, { passive: !0 });
|
|
3021
3079
|
}
|
|
3022
3080
|
#n() {
|
|
3023
|
-
const e = this.attachShadow({ mode: "closed" }),
|
|
3024
|
-
|
|
3081
|
+
const e = this.attachShadow({ mode: "closed" }), t = document.createElement("style");
|
|
3082
|
+
t.textContent = U`
|
|
3025
3083
|
:host {
|
|
3026
3084
|
display: contents;
|
|
3027
3085
|
}
|
|
3028
3086
|
`;
|
|
3029
3087
|
const s = document.createElement("slot");
|
|
3030
|
-
e.appendChild(
|
|
3088
|
+
e.appendChild(t), e.appendChild(s);
|
|
3031
3089
|
}
|
|
3032
3090
|
connectedCallback() {
|
|
3033
3091
|
this.#i(), this.#n();
|
|
@@ -3035,23 +3093,26 @@ class Vt extends HTMLElement {
|
|
|
3035
3093
|
disconnectedCallback() {
|
|
3036
3094
|
this.removeEventListener("click", this.#e, {
|
|
3037
3095
|
passive: !0
|
|
3038
|
-
}), this.#
|
|
3096
|
+
}), this.#r = !1;
|
|
3039
3097
|
}
|
|
3040
3098
|
get mediaProduct() {
|
|
3041
3099
|
const e = this.getAttribute("product-id");
|
|
3042
3100
|
if (!e)
|
|
3043
3101
|
return;
|
|
3044
|
-
const
|
|
3102
|
+
const t = this.getAttribute("product-type") === "video" ? "video" : "track";
|
|
3045
3103
|
return {
|
|
3046
3104
|
productId: e,
|
|
3047
|
-
productType:
|
|
3105
|
+
productType: t,
|
|
3048
3106
|
sourceId: "",
|
|
3049
3107
|
sourceType: ""
|
|
3050
3108
|
};
|
|
3051
3109
|
}
|
|
3110
|
+
static get observedAttributes() {
|
|
3111
|
+
return ["product-id", "product-type"];
|
|
3112
|
+
}
|
|
3052
3113
|
}
|
|
3053
|
-
customElements.define(
|
|
3054
|
-
const
|
|
3114
|
+
customElements.define(Lt, Ot);
|
|
3115
|
+
const Ct = U`
|
|
3055
3116
|
:host {
|
|
3056
3117
|
display: inline-block;
|
|
3057
3118
|
}
|
|
@@ -3072,31 +3133,31 @@ const zt = j`
|
|
|
3072
3133
|
background-color: currentColor;
|
|
3073
3134
|
pointer-events: none;
|
|
3074
3135
|
}
|
|
3075
|
-
`,
|
|
3136
|
+
`, $ = {
|
|
3076
3137
|
NO_DURATION: "You need to set duration before you can start/stop the progress bar."
|
|
3077
3138
|
};
|
|
3078
|
-
class
|
|
3139
|
+
class _t extends HTMLElement {
|
|
3079
3140
|
#e;
|
|
3080
|
-
#
|
|
3141
|
+
#r = 1;
|
|
3081
3142
|
#s = null;
|
|
3082
|
-
#
|
|
3143
|
+
#t;
|
|
3083
3144
|
#i;
|
|
3084
3145
|
#n = /* @__PURE__ */ new Set();
|
|
3085
3146
|
#a = null;
|
|
3086
3147
|
#o;
|
|
3087
3148
|
constructor() {
|
|
3088
|
-
super(), this.#
|
|
3089
|
-
const
|
|
3090
|
-
if (this.duration =
|
|
3149
|
+
super(), this.#t = (e) => {
|
|
3150
|
+
const t = e;
|
|
3151
|
+
if (this.duration = t.detail.playbackContext.actualDuration, q() === "PLAYING")
|
|
3091
3152
|
try {
|
|
3092
3153
|
this.start();
|
|
3093
3154
|
} catch (s) {
|
|
3094
3155
|
console.warn(s);
|
|
3095
3156
|
}
|
|
3096
3157
|
}, this.#i = (e) => {
|
|
3097
|
-
const
|
|
3158
|
+
const t = e;
|
|
3098
3159
|
try {
|
|
3099
|
-
|
|
3160
|
+
t.detail.state === "PLAYING" ? this.start() : this.stop();
|
|
3100
3161
|
} catch (s) {
|
|
3101
3162
|
console.warn(s);
|
|
3102
3163
|
}
|
|
@@ -3105,20 +3166,20 @@ class Ut extends HTMLElement {
|
|
|
3105
3166
|
}, this.#c();
|
|
3106
3167
|
}
|
|
3107
3168
|
#c() {
|
|
3108
|
-
this.#n.has("media-product-transition") || (
|
|
3169
|
+
this.#n.has("media-product-transition") || (m.addEventListener(
|
|
3109
3170
|
"media-product-transition",
|
|
3110
|
-
this.#
|
|
3171
|
+
this.#t,
|
|
3111
3172
|
!1
|
|
3112
|
-
), this.#n.add("media-product-transition")), this.#n.has("playback-state-change") || (
|
|
3173
|
+
), this.#n.add("media-product-transition")), this.#n.has("playback-state-change") || (m.addEventListener(
|
|
3113
3174
|
"playback-state-change",
|
|
3114
3175
|
this.#i
|
|
3115
3176
|
), this.#n.add("playback-state-change")), this.#a && !this.#n.has("wrapper-click") && (this.#a.addEventListener("click", this.#o, !1), this.#n.add("wrapper-click"));
|
|
3116
3177
|
}
|
|
3117
3178
|
#d() {
|
|
3118
3179
|
const e = this.attachShadow({ mode: "closed" });
|
|
3119
|
-
e.innerHTML =
|
|
3180
|
+
e.innerHTML = Et`
|
|
3120
3181
|
<style>
|
|
3121
|
-
${
|
|
3182
|
+
${Ct}
|
|
3122
3183
|
</style>
|
|
3123
3184
|
<div id="wrapper">
|
|
3124
3185
|
<div id="indicator"></div>
|
|
@@ -3134,11 +3195,11 @@ class Ut extends HTMLElement {
|
|
|
3134
3195
|
this.#d(), this.#c();
|
|
3135
3196
|
}
|
|
3136
3197
|
disconnectedCallback() {
|
|
3137
|
-
|
|
3198
|
+
m.removeEventListener(
|
|
3138
3199
|
"media-product-transition",
|
|
3139
|
-
this.#
|
|
3200
|
+
this.#t,
|
|
3140
3201
|
!1
|
|
3141
|
-
),
|
|
3202
|
+
), m.removeEventListener(
|
|
3142
3203
|
"playback-state-change",
|
|
3143
3204
|
this.#i
|
|
3144
3205
|
), this.#a?.addEventListener("click", this.#o, !1), this.#n.clear();
|
|
@@ -3151,9 +3212,9 @@ class Ut extends HTMLElement {
|
|
|
3151
3212
|
*/
|
|
3152
3213
|
getMousePositionAsPercent(e) {
|
|
3153
3214
|
if (this.#a) {
|
|
3154
|
-
const
|
|
3155
|
-
left: Math.abs(
|
|
3156
|
-
width: Math.round(
|
|
3215
|
+
const t = this.#a.getBoundingClientRect(), s = {
|
|
3216
|
+
left: Math.abs(t.left + window.pageXOffset - e.pageX),
|
|
3217
|
+
width: Math.round(t.width)
|
|
3157
3218
|
};
|
|
3158
3219
|
return s.left / s.width;
|
|
3159
3220
|
}
|
|
@@ -3167,8 +3228,8 @@ class Ut extends HTMLElement {
|
|
|
3167
3228
|
* @param {MouseEvent | PointerEvent} event
|
|
3168
3229
|
*/
|
|
3169
3230
|
handleClick(e) {
|
|
3170
|
-
const
|
|
3171
|
-
this.currentTime = s,
|
|
3231
|
+
const t = this.getMousePositionAsPercent(e), s = this.#r * t;
|
|
3232
|
+
this.currentTime = s, vt(s / 1e3);
|
|
3172
3233
|
}
|
|
3173
3234
|
/**
|
|
3174
3235
|
* Starts the animation if duration is defined.
|
|
@@ -3177,7 +3238,7 @@ class Ut extends HTMLElement {
|
|
|
3177
3238
|
*/
|
|
3178
3239
|
start() {
|
|
3179
3240
|
if (!this.#e)
|
|
3180
|
-
throw new Error(
|
|
3241
|
+
throw new Error($.NO_DURATION);
|
|
3181
3242
|
this.#e.play();
|
|
3182
3243
|
}
|
|
3183
3244
|
/**
|
|
@@ -3187,7 +3248,7 @@ class Ut extends HTMLElement {
|
|
|
3187
3248
|
*/
|
|
3188
3249
|
stop() {
|
|
3189
3250
|
if (!this.#e)
|
|
3190
|
-
throw new Error(
|
|
3251
|
+
throw new Error($.NO_DURATION);
|
|
3191
3252
|
this.#e.pause();
|
|
3192
3253
|
}
|
|
3193
3254
|
/**
|
|
@@ -3202,8 +3263,8 @@ class Ut extends HTMLElement {
|
|
|
3202
3263
|
* Setting this recrates the animation with the new duraton and pauses the animation.
|
|
3203
3264
|
*/
|
|
3204
3265
|
set duration(e) {
|
|
3205
|
-
this.#
|
|
3206
|
-
const
|
|
3266
|
+
this.#r = e * 1e3;
|
|
3267
|
+
const t = [
|
|
3207
3268
|
{
|
|
3208
3269
|
transform: "translateX(-100%)"
|
|
3209
3270
|
},
|
|
@@ -3211,8 +3272,8 @@ class Ut extends HTMLElement {
|
|
|
3211
3272
|
transform: "translateX(0%)"
|
|
3212
3273
|
}
|
|
3213
3274
|
];
|
|
3214
|
-
this.#e = this.#s?.animate(
|
|
3215
|
-
duration: this.#
|
|
3275
|
+
this.#e = this.#s?.animate(t, {
|
|
3276
|
+
duration: this.#r,
|
|
3216
3277
|
iterations: 1
|
|
3217
3278
|
}), this.#e?.pause();
|
|
3218
3279
|
}
|
|
@@ -3223,9 +3284,9 @@ class Ut extends HTMLElement {
|
|
|
3223
3284
|
this.stop(), this.#e && (this.#e.playbackRate = e), this.start();
|
|
3224
3285
|
}
|
|
3225
3286
|
}
|
|
3226
|
-
const
|
|
3227
|
-
customElements.define(
|
|
3228
|
-
const
|
|
3287
|
+
const Ft = "tidal-progress-bar";
|
|
3288
|
+
customElements.define(Ft, _t);
|
|
3289
|
+
const Nt = U`
|
|
3229
3290
|
:host {
|
|
3230
3291
|
position: relative;
|
|
3231
3292
|
display: block;
|
|
@@ -3242,91 +3303,89 @@ const $t = j`
|
|
|
3242
3303
|
position: relative;
|
|
3243
3304
|
background-color: black;
|
|
3244
3305
|
}
|
|
3245
|
-
`,
|
|
3246
|
-
class
|
|
3306
|
+
`, Bt = "tidal-video-view";
|
|
3307
|
+
class xt extends HTMLElement {
|
|
3247
3308
|
#e = !1;
|
|
3248
|
-
#
|
|
3309
|
+
#r;
|
|
3249
3310
|
#s;
|
|
3250
3311
|
constructor() {
|
|
3251
|
-
super(), this.#
|
|
3312
|
+
super(), this.#r = (e) => {
|
|
3252
3313
|
e.detail.mediaProduct.productType === "video" && this.mountPlayer();
|
|
3253
3314
|
}, this.#s = (e) => {
|
|
3254
|
-
const
|
|
3315
|
+
const t = e;
|
|
3255
3316
|
this.setAttribute(
|
|
3256
3317
|
"playback-state",
|
|
3257
|
-
|
|
3318
|
+
t.detail.state.toLocaleLowerCase()
|
|
3258
3319
|
);
|
|
3259
|
-
}, this.#
|
|
3320
|
+
}, this.#t();
|
|
3260
3321
|
}
|
|
3261
|
-
#
|
|
3262
|
-
this.#e || (
|
|
3322
|
+
#t() {
|
|
3323
|
+
this.#e || (m.addEventListener(
|
|
3263
3324
|
"media-product-transition",
|
|
3264
|
-
this.#
|
|
3325
|
+
this.#r,
|
|
3265
3326
|
!1
|
|
3266
|
-
),
|
|
3327
|
+
), m.addEventListener(
|
|
3267
3328
|
"playback-state-change",
|
|
3268
3329
|
this.#s,
|
|
3269
3330
|
!1
|
|
3270
3331
|
));
|
|
3271
3332
|
}
|
|
3272
3333
|
connectedCallback() {
|
|
3273
|
-
this.#
|
|
3274
|
-
const e = this.attachShadow({ mode: "closed" }),
|
|
3275
|
-
|
|
3334
|
+
this.#t();
|
|
3335
|
+
const e = this.attachShadow({ mode: "closed" }), t = document.createElement("style");
|
|
3336
|
+
t.textContent = Nt;
|
|
3276
3337
|
const s = document.createElement("slot");
|
|
3277
|
-
e.appendChild(
|
|
3338
|
+
e.appendChild(t), e.appendChild(s);
|
|
3278
3339
|
}
|
|
3279
3340
|
disconnectedCallback() {
|
|
3280
|
-
|
|
3341
|
+
m.removeEventListener(
|
|
3281
3342
|
"media-product-transition",
|
|
3282
|
-
this.#
|
|
3343
|
+
this.#r,
|
|
3283
3344
|
!1
|
|
3284
|
-
),
|
|
3345
|
+
), m.removeEventListener(
|
|
3285
3346
|
"playback-state-change",
|
|
3286
3347
|
this.#s,
|
|
3287
3348
|
!1
|
|
3288
3349
|
), this.#e = !0;
|
|
3289
3350
|
}
|
|
3290
3351
|
mountPlayer() {
|
|
3291
|
-
const e =
|
|
3352
|
+
const e = te();
|
|
3292
3353
|
e && (this.innerHTML = "", this.appendChild(e));
|
|
3293
3354
|
}
|
|
3294
3355
|
}
|
|
3295
|
-
customElements.define(
|
|
3356
|
+
customElements.define(Bt, xt);
|
|
3296
3357
|
export {
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
ie as h,
|
|
3320
|
-
it as i,
|
|
3321
|
-
Bt as j,
|
|
3322
|
-
xt as k,
|
|
3358
|
+
Qt as $,
|
|
3359
|
+
k as A,
|
|
3360
|
+
Rt as B,
|
|
3361
|
+
Dt as C,
|
|
3362
|
+
j as D,
|
|
3363
|
+
Vt as L,
|
|
3364
|
+
H as P,
|
|
3365
|
+
qt as Q,
|
|
3366
|
+
O as R,
|
|
3367
|
+
v as S,
|
|
3368
|
+
$t as U,
|
|
3369
|
+
Gt as a,
|
|
3370
|
+
m as b,
|
|
3371
|
+
me as c,
|
|
3372
|
+
fe as d,
|
|
3373
|
+
Wt as e,
|
|
3374
|
+
oe as f,
|
|
3375
|
+
Ht as g,
|
|
3376
|
+
ee as h,
|
|
3377
|
+
Je as i,
|
|
3378
|
+
qe as j,
|
|
3379
|
+
C as k,
|
|
3323
3380
|
p as l,
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3381
|
+
rt as m,
|
|
3382
|
+
Pt as n,
|
|
3383
|
+
It as o,
|
|
3384
|
+
Lt as p,
|
|
3385
|
+
z as q,
|
|
3386
|
+
Ft as r,
|
|
3387
|
+
Bt as s,
|
|
3388
|
+
Ut as v,
|
|
3389
|
+
zt as w,
|
|
3390
|
+
y
|
|
3332
3391
|
};
|