vendor
7 years ago
admin.js
1 year ago
ads.js
1 year ago
carousel.js
1 year ago
carousel.min.js
2 years ago
documents-viewer-script.js
3 years ago
embed-ui.min.js
1 year ago
front.js
1 year ago
gallery-justify.js
1 year ago
glider.js
1 year ago
glider.min.js
2 years ago
gutneberg-script.js
1 year ago
index.html
7 years ago
initCarousel.js
2 years ago
initplyr.js
2 years ago
instafeed.js
2 years ago
license.js
2 years ago
pdfobject.js
1 year ago
plyr.js
1 year ago
plyr.polyfilled.js
3 years ago
preview.js
3 years ago
settings.js
6 years ago
vimeo-player.js
2 years ago
ytiframeapi.js
2 years ago
plyr.js
4234 lines
| 1 | "object" == typeof navigator && |
| 2 | (function (e, t) { |
| 3 | "object" == typeof exports && "undefined" != typeof module ? (module.exports = t()) : "function" == typeof define && define.amd ? define("Plyr", t) : ((e = "undefined" != typeof globalThis ? globalThis : e || self).Plyr = t()); |
| 4 | })(this, function () { |
| 5 | "use strict"; |
| 6 | !(function () { |
| 7 | if ("undefined" != typeof window) |
| 8 | try { |
| 9 | var e = new window.CustomEvent("test", { cancelable: !0 }); |
| 10 | if ((e.preventDefault(), !0 !== e.defaultPrevented)) throw new Error("Could not prevent default"); |
| 11 | } catch (e) { |
| 12 | var t = function (e, t) { |
| 13 | var i, s; |
| 14 | return ( |
| 15 | ((t = t || {}).bubbles = !!t.bubbles), |
| 16 | (t.cancelable = !!t.cancelable), |
| 17 | (i = document.createEvent("CustomEvent")).initCustomEvent(e, t.bubbles, t.cancelable, t.detail), |
| 18 | (s = i.preventDefault), |
| 19 | (i.preventDefault = function () { |
| 20 | s.call(this); |
| 21 | try { |
| 22 | Object.defineProperty(this, "defaultPrevented", { |
| 23 | get: function () { |
| 24 | return !0; |
| 25 | }, |
| 26 | }); |
| 27 | } catch (e) { |
| 28 | this.defaultPrevented = !0; |
| 29 | } |
| 30 | }), |
| 31 | i |
| 32 | ); |
| 33 | }; |
| 34 | (t.prototype = window.Event.prototype), (window.CustomEvent = t); |
| 35 | } |
| 36 | })(); |
| 37 | var e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; |
| 38 | function t(e, t, i) { |
| 39 | return ( |
| 40 | (t = (function (e) { |
| 41 | var t = (function (e, t) { |
| 42 | if ("object" != typeof e || null === e) return e; |
| 43 | var i = e[Symbol.toPrimitive]; |
| 44 | if (void 0 !== i) { |
| 45 | var s = i.call(e, t || "default"); |
| 46 | if ("object" != typeof s) return s; |
| 47 | throw new TypeError("@@toPrimitive must return a primitive value."); |
| 48 | } |
| 49 | return ("string" === t ? String : Number)(e); |
| 50 | })(e, "string"); |
| 51 | return "symbol" == typeof t ? t : String(t); |
| 52 | })(t)) in e |
| 53 | ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) |
| 54 | : (e[t] = i), |
| 55 | e |
| 56 | ); |
| 57 | } |
| 58 | function i(e, t) { |
| 59 | for (var i = 0; i < t.length; i++) { |
| 60 | var s = t[i]; |
| 61 | (s.enumerable = s.enumerable || !1), (s.configurable = !0), "value" in s && (s.writable = !0), Object.defineProperty(e, s.key, s); |
| 62 | } |
| 63 | } |
| 64 | function s(e, t, i) { |
| 65 | return t in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : (e[t] = i), e; |
| 66 | } |
| 67 | function n(e, t) { |
| 68 | var i = Object.keys(e); |
| 69 | if (Object.getOwnPropertySymbols) { |
| 70 | var s = Object.getOwnPropertySymbols(e); |
| 71 | t && |
| 72 | (s = s.filter(function (t) { |
| 73 | return Object.getOwnPropertyDescriptor(e, t).enumerable; |
| 74 | })), |
| 75 | i.push.apply(i, s); |
| 76 | } |
| 77 | return i; |
| 78 | } |
| 79 | function a(e) { |
| 80 | for (var t = 1; t < arguments.length; t++) { |
| 81 | var i = null != arguments[t] ? arguments[t] : {}; |
| 82 | t % 2 |
| 83 | ? n(Object(i), !0).forEach(function (t) { |
| 84 | s(e, t, i[t]); |
| 85 | }) |
| 86 | : Object.getOwnPropertyDescriptors |
| 87 | ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(i)) |
| 88 | : n(Object(i)).forEach(function (t) { |
| 89 | Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t)); |
| 90 | }); |
| 91 | } |
| 92 | return e; |
| 93 | } |
| 94 | !(function (e) { |
| 95 | var t = (function () { |
| 96 | try { |
| 97 | return !!Symbol.iterator; |
| 98 | } catch (e) { |
| 99 | return !1; |
| 100 | } |
| 101 | })(), |
| 102 | i = function (e) { |
| 103 | var i = { |
| 104 | next: function () { |
| 105 | var t = e.shift(); |
| 106 | return { done: void 0 === t, value: t }; |
| 107 | }, |
| 108 | }; |
| 109 | return ( |
| 110 | t && |
| 111 | (i[Symbol.iterator] = function () { |
| 112 | return i; |
| 113 | }), |
| 114 | i |
| 115 | ); |
| 116 | }, |
| 117 | s = function (e) { |
| 118 | return encodeURIComponent(e).replace(/%20/g, "+"); |
| 119 | }, |
| 120 | n = function (e) { |
| 121 | return decodeURIComponent(String(e).replace(/\+/g, " ")); |
| 122 | }; |
| 123 | (function () { |
| 124 | try { |
| 125 | var t = e.URLSearchParams; |
| 126 | return "a=1" === new t("?a=1").toString() && "function" == typeof t.prototype.set && "function" == typeof t.prototype.entries; |
| 127 | } catch (e) { |
| 128 | return !1; |
| 129 | } |
| 130 | })() || |
| 131 | (function () { |
| 132 | var n = function (e) { |
| 133 | Object.defineProperty(this, "_entries", { writable: !0, value: {} }); |
| 134 | var t = typeof e; |
| 135 | if ("undefined" === t); |
| 136 | else if ("string" === t) "" !== e && this._fromString(e); |
| 137 | else if (e instanceof n) { |
| 138 | var i = this; |
| 139 | e.forEach(function (e, t) { |
| 140 | i.append(t, e); |
| 141 | }); |
| 142 | } else { |
| 143 | if (null === e || "object" !== t) throw new TypeError("Unsupported input's type for URLSearchParams"); |
| 144 | if ("[object Array]" === Object.prototype.toString.call(e)) |
| 145 | for (var s = 0; s < e.length; s++) { |
| 146 | var a = e[s]; |
| 147 | if ("[object Array]" !== Object.prototype.toString.call(a) && 2 === a.length) throw new TypeError("Expected [string, any] as entry at index " + s + " of URLSearchParams's input"); |
| 148 | this.append(a[0], a[1]); |
| 149 | } |
| 150 | else for (var r in e) e.hasOwnProperty(r) && this.append(r, e[r]); |
| 151 | } |
| 152 | }, |
| 153 | a = n.prototype; |
| 154 | (a.append = function (e, t) { |
| 155 | e in this._entries ? this._entries[e].push(String(t)) : (this._entries[e] = [String(t)]); |
| 156 | }), |
| 157 | (a.delete = function (e) { |
| 158 | delete this._entries[e]; |
| 159 | }), |
| 160 | (a.get = function (e) { |
| 161 | return e in this._entries ? this._entries[e][0] : null; |
| 162 | }), |
| 163 | (a.getAll = function (e) { |
| 164 | return e in this._entries ? this._entries[e].slice(0) : []; |
| 165 | }), |
| 166 | (a.has = function (e) { |
| 167 | return e in this._entries; |
| 168 | }), |
| 169 | (a.set = function (e, t) { |
| 170 | this._entries[e] = [String(t)]; |
| 171 | }), |
| 172 | (a.forEach = function (e, t) { |
| 173 | var i; |
| 174 | for (var s in this._entries) |
| 175 | if (this._entries.hasOwnProperty(s)) { |
| 176 | i = this._entries[s]; |
| 177 | for (var n = 0; n < i.length; n++) e.call(t, i[n], s, this); |
| 178 | } |
| 179 | }), |
| 180 | (a.keys = function () { |
| 181 | var e = []; |
| 182 | return ( |
| 183 | this.forEach(function (t, i) { |
| 184 | e.push(i); |
| 185 | }), |
| 186 | i(e) |
| 187 | ); |
| 188 | }), |
| 189 | (a.values = function () { |
| 190 | var e = []; |
| 191 | return ( |
| 192 | this.forEach(function (t) { |
| 193 | e.push(t); |
| 194 | }), |
| 195 | i(e) |
| 196 | ); |
| 197 | }), |
| 198 | (a.entries = function () { |
| 199 | var e = []; |
| 200 | return ( |
| 201 | this.forEach(function (t, i) { |
| 202 | e.push([i, t]); |
| 203 | }), |
| 204 | i(e) |
| 205 | ); |
| 206 | }), |
| 207 | t && (a[Symbol.iterator] = a.entries), |
| 208 | (a.toString = function () { |
| 209 | var e = []; |
| 210 | return ( |
| 211 | this.forEach(function (t, i) { |
| 212 | e.push(s(i) + "=" + s(t)); |
| 213 | }), |
| 214 | e.join("&") |
| 215 | ); |
| 216 | }), |
| 217 | (e.URLSearchParams = n); |
| 218 | })(); |
| 219 | var a = e.URLSearchParams.prototype; |
| 220 | "function" != typeof a.sort && |
| 221 | (a.sort = function () { |
| 222 | var e = this, |
| 223 | t = []; |
| 224 | this.forEach(function (i, s) { |
| 225 | t.push([s, i]), e._entries || e.delete(s); |
| 226 | }), |
| 227 | t.sort(function (e, t) { |
| 228 | return e[0] < t[0] ? -1 : e[0] > t[0] ? 1 : 0; |
| 229 | }), |
| 230 | e._entries && (e._entries = {}); |
| 231 | for (var i = 0; i < t.length; i++) this.append(t[i][0], t[i][1]); |
| 232 | }), |
| 233 | "function" != typeof a._fromString && |
| 234 | Object.defineProperty(a, "_fromString", { |
| 235 | enumerable: !1, |
| 236 | configurable: !1, |
| 237 | writable: !1, |
| 238 | value: function (e) { |
| 239 | if (this._entries) this._entries = {}; |
| 240 | else { |
| 241 | var t = []; |
| 242 | this.forEach(function (e, i) { |
| 243 | t.push(i); |
| 244 | }); |
| 245 | for (var i = 0; i < t.length; i++) this.delete(t[i]); |
| 246 | } |
| 247 | var s, |
| 248 | a = (e = e.replace(/^\?/, "")).split("&"); |
| 249 | for (i = 0; i < a.length; i++) (s = a[i].split("=")), this.append(n(s[0]), s.length > 1 ? n(s[1]) : ""); |
| 250 | }, |
| 251 | }); |
| 252 | })(void 0 !== e ? e : "undefined" != typeof window ? window : "undefined" != typeof self ? self : e), |
| 253 | (function (e) { |
| 254 | if ( |
| 255 | ((function () { |
| 256 | try { |
| 257 | var t = new e.URL("b", "http://a"); |
| 258 | return (t.pathname = "c d"), "http://a/c%20d" === t.href && t.searchParams; |
| 259 | } catch (e) { |
| 260 | return !1; |
| 261 | } |
| 262 | })() || |
| 263 | (function () { |
| 264 | var t = e.URL, |
| 265 | i = function (t, i) { |
| 266 | "string" != typeof t && (t = String(t)), i && "string" != typeof i && (i = String(i)); |
| 267 | var s, |
| 268 | n = document; |
| 269 | if (i && (void 0 === e.location || i !== e.location.href)) { |
| 270 | (i = i.toLowerCase()), ((s = (n = document.implementation.createHTMLDocument("")).createElement("base")).href = i), n.head.appendChild(s); |
| 271 | try { |
| 272 | if (0 !== s.href.indexOf(i)) throw new Error(s.href); |
| 273 | } catch (e) { |
| 274 | throw new Error("URL unable to set base " + i + " due to " + e); |
| 275 | } |
| 276 | } |
| 277 | var a = n.createElement("a"); |
| 278 | (a.href = t), s && (n.body.appendChild(a), (a.href = a.href)); |
| 279 | var r = n.createElement("input"); |
| 280 | if (((r.type = "url"), (r.value = t), ":" === a.protocol || !/:/.test(a.href) || (!r.checkValidity() && !i))) throw new TypeError("Invalid URL"); |
| 281 | Object.defineProperty(this, "_anchorElement", { value: a }); |
| 282 | var o = new e.URLSearchParams(this.search), |
| 283 | l = !0, |
| 284 | c = !0, |
| 285 | u = this; |
| 286 | ["append", "delete", "set"].forEach(function (e) { |
| 287 | var t = o[e]; |
| 288 | o[e] = function () { |
| 289 | t.apply(o, arguments), l && ((c = !1), (u.search = o.toString()), (c = !0)); |
| 290 | }; |
| 291 | }), |
| 292 | Object.defineProperty(this, "searchParams", { value: o, enumerable: !0 }); |
| 293 | var h = void 0; |
| 294 | Object.defineProperty(this, "_updateSearchParams", { |
| 295 | enumerable: !1, |
| 296 | configurable: !1, |
| 297 | writable: !1, |
| 298 | value: function () { |
| 299 | this.search !== h && ((h = this.search), c && ((l = !1), this.searchParams._fromString(this.search), (l = !0))); |
| 300 | }, |
| 301 | }); |
| 302 | }, |
| 303 | s = i.prototype; |
| 304 | ["hash", "host", "hostname", "port", "protocol"].forEach(function (e) { |
| 305 | !(function (e) { |
| 306 | Object.defineProperty(s, e, { |
| 307 | get: function () { |
| 308 | return this._anchorElement[e]; |
| 309 | }, |
| 310 | set: function (t) { |
| 311 | this._anchorElement[e] = t; |
| 312 | }, |
| 313 | enumerable: !0, |
| 314 | }); |
| 315 | })(e); |
| 316 | }), |
| 317 | Object.defineProperty(s, "search", { |
| 318 | get: function () { |
| 319 | return this._anchorElement.search; |
| 320 | }, |
| 321 | set: function (e) { |
| 322 | (this._anchorElement.search = e), this._updateSearchParams(); |
| 323 | }, |
| 324 | enumerable: !0, |
| 325 | }), |
| 326 | Object.defineProperties(s, { |
| 327 | toString: { |
| 328 | get: function () { |
| 329 | var e = this; |
| 330 | return function () { |
| 331 | return e.href; |
| 332 | }; |
| 333 | }, |
| 334 | }, |
| 335 | href: { |
| 336 | get: function () { |
| 337 | return this._anchorElement.href.replace(/\?$/, ""); |
| 338 | }, |
| 339 | set: function (e) { |
| 340 | (this._anchorElement.href = e), this._updateSearchParams(); |
| 341 | }, |
| 342 | enumerable: !0, |
| 343 | }, |
| 344 | pathname: { |
| 345 | get: function () { |
| 346 | return this._anchorElement.pathname.replace(/(^\/?)/, "/"); |
| 347 | }, |
| 348 | set: function (e) { |
| 349 | this._anchorElement.pathname = e; |
| 350 | }, |
| 351 | enumerable: !0, |
| 352 | }, |
| 353 | origin: { |
| 354 | get: function () { |
| 355 | var e = { "http:": 80, "https:": 443, "ftp:": 21 }[this._anchorElement.protocol], |
| 356 | t = this._anchorElement.port != e && "" !== this._anchorElement.port; |
| 357 | return this._anchorElement.protocol + "//" + this._anchorElement.hostname + (t ? ":" + this._anchorElement.port : ""); |
| 358 | }, |
| 359 | enumerable: !0, |
| 360 | }, |
| 361 | password: { |
| 362 | get: function () { |
| 363 | return ""; |
| 364 | }, |
| 365 | set: function (e) { }, |
| 366 | enumerable: !0, |
| 367 | }, |
| 368 | username: { |
| 369 | get: function () { |
| 370 | return ""; |
| 371 | }, |
| 372 | set: function (e) { }, |
| 373 | enumerable: !0, |
| 374 | }, |
| 375 | }), |
| 376 | (i.createObjectURL = function (e) { |
| 377 | return t.createObjectURL.apply(t, arguments); |
| 378 | }), |
| 379 | (i.revokeObjectURL = function (e) { |
| 380 | return t.revokeObjectURL.apply(t, arguments); |
| 381 | }), |
| 382 | (e.URL = i); |
| 383 | })(), |
| 384 | void 0 !== e.location && !("origin" in e.location)) |
| 385 | ) { |
| 386 | var t = function () { |
| 387 | return e.location.protocol + "//" + e.location.hostname + (e.location.port ? ":" + e.location.port : ""); |
| 388 | }; |
| 389 | try { |
| 390 | Object.defineProperty(e.location, "origin", { get: t, enumerable: !0 }); |
| 391 | } catch (i) { |
| 392 | setInterval(function () { |
| 393 | e.location.origin = t(); |
| 394 | }, 100); |
| 395 | } |
| 396 | } |
| 397 | })(void 0 !== e ? e : "undefined" != typeof window ? window : "undefined" != typeof self ? self : e); |
| 398 | var r = { addCSS: !0, thumbWidth: 15, watch: !0 }; |
| 399 | var o = function (e) { |
| 400 | return null != e ? e.constructor : null; |
| 401 | }, |
| 402 | l = function (e, t) { |
| 403 | return !!(e && t && e instanceof t); |
| 404 | }, |
| 405 | c = function (e) { |
| 406 | return null == e; |
| 407 | }, |
| 408 | u = function (e) { |
| 409 | return o(e) === Object; |
| 410 | }, |
| 411 | h = function (e) { |
| 412 | return o(e) === String; |
| 413 | }, |
| 414 | d = function (e) { |
| 415 | return Array.isArray(e); |
| 416 | }, |
| 417 | m = function (e) { |
| 418 | return l(e, NodeList); |
| 419 | }, |
| 420 | p = { |
| 421 | nullOrUndefined: c, |
| 422 | object: u, |
| 423 | number: function (e) { |
| 424 | return o(e) === Number && !Number.isNaN(e); |
| 425 | }, |
| 426 | string: h, |
| 427 | boolean: function (e) { |
| 428 | return o(e) === Boolean; |
| 429 | }, |
| 430 | function: function (e) { |
| 431 | return o(e) === Function; |
| 432 | }, |
| 433 | array: d, |
| 434 | nodeList: m, |
| 435 | element: function (e) { |
| 436 | return l(e, Element); |
| 437 | }, |
| 438 | event: function (e) { |
| 439 | return l(e, Event); |
| 440 | }, |
| 441 | empty: function (e) { |
| 442 | return c(e) || ((h(e) || d(e) || m(e)) && !e.length) || (u(e) && !Object.keys(e).length); |
| 443 | }, |
| 444 | }; |
| 445 | function g(e, t) { |
| 446 | if (1 > t) { |
| 447 | var i = (function (e) { |
| 448 | var t = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); |
| 449 | return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0; |
| 450 | })(t); |
| 451 | return parseFloat(e.toFixed(i)); |
| 452 | } |
| 453 | return Math.round(e / t) * t; |
| 454 | } |
| 455 | var f = (function () { |
| 456 | function e(t, i) { |
| 457 | (function (e, t) { |
| 458 | if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); |
| 459 | })(this, e), |
| 460 | p.element(t) ? (this.element = t) : p.string(t) && (this.element = document.querySelector(t)), |
| 461 | p.element(this.element) && p.empty(this.element.rangeTouch) && ((this.config = a({}, r, {}, i)), this.init()); |
| 462 | } |
| 463 | return ( |
| 464 | (function (e, t, s) { |
| 465 | t && i(e.prototype, t), s && i(e, s); |
| 466 | })( |
| 467 | e, |
| 468 | [ |
| 469 | { |
| 470 | key: "init", |
| 471 | value: function () { |
| 472 | e.enabled && |
| 473 | (this.config.addCSS && ((this.element.style.userSelect = "none"), (this.element.style.webKitUserSelect = "none"), (this.element.style.touchAction = "manipulation")), |
| 474 | this.listeners(!0), |
| 475 | (this.element.rangeTouch = this)); |
| 476 | }, |
| 477 | }, |
| 478 | { |
| 479 | key: "destroy", |
| 480 | value: function () { |
| 481 | e.enabled && |
| 482 | (this.config.addCSS && ((this.element.style.userSelect = ""), (this.element.style.webKitUserSelect = ""), (this.element.style.touchAction = "")), this.listeners(!1), (this.element.rangeTouch = null)); |
| 483 | }, |
| 484 | }, |
| 485 | { |
| 486 | key: "listeners", |
| 487 | value: function (e) { |
| 488 | var t = this, |
| 489 | i = e ? "addEventListener" : "removeEventListener"; |
| 490 | ["touchstart", "touchmove", "touchend"].forEach(function (e) { |
| 491 | t.element[i]( |
| 492 | e, |
| 493 | function (e) { |
| 494 | return t.set(e); |
| 495 | }, |
| 496 | !1 |
| 497 | ); |
| 498 | }); |
| 499 | }, |
| 500 | }, |
| 501 | { |
| 502 | key: "get", |
| 503 | value: function (t) { |
| 504 | if (!e.enabled || !p.event(t)) return null; |
| 505 | var i, |
| 506 | s = t.target, |
| 507 | n = t.changedTouches[0], |
| 508 | a = parseFloat(s.getAttribute("min")) || 0, |
| 509 | r = parseFloat(s.getAttribute("max")) || 100, |
| 510 | o = parseFloat(s.getAttribute("step")) || 1, |
| 511 | l = s.getBoundingClientRect(), |
| 512 | c = ((100 / l.width) * (this.config.thumbWidth / 2)) / 100; |
| 513 | return 0 > (i = (100 / l.width) * (n.clientX - l.left)) ? (i = 0) : 100 < i && (i = 100), 50 > i ? (i -= (100 - 2 * i) * c) : 50 < i && (i += 2 * (i - 50) * c), a + g((i / 100) * (r - a), o); |
| 514 | }, |
| 515 | }, |
| 516 | { |
| 517 | key: "set", |
| 518 | value: function (t) { |
| 519 | e.enabled && |
| 520 | p.event(t) && |
| 521 | !t.target.disabled && |
| 522 | (t.preventDefault(), |
| 523 | (t.target.value = this.get(t)), |
| 524 | (function (e, t) { |
| 525 | if (e && t) { |
| 526 | var i = new Event(t, { bubbles: !0 }); |
| 527 | e.dispatchEvent(i); |
| 528 | } |
| 529 | })(t.target, "touchend" === t.type ? "change" : "input")); |
| 530 | }, |
| 531 | }, |
| 532 | ], |
| 533 | [ |
| 534 | { |
| 535 | key: "setup", |
| 536 | value: function (t) { |
| 537 | var i = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, |
| 538 | s = null; |
| 539 | if ( |
| 540 | (p.empty(t) || p.string(t) |
| 541 | ? (s = Array.from(document.querySelectorAll(p.string(t) ? t : 'input[type="range"]'))) |
| 542 | : p.element(t) |
| 543 | ? (s = [t]) |
| 544 | : p.nodeList(t) |
| 545 | ? (s = Array.from(t)) |
| 546 | : p.array(t) && (s = t.filter(p.element)), |
| 547 | p.empty(s)) |
| 548 | ) |
| 549 | return null; |
| 550 | var n = a({}, r, {}, i); |
| 551 | if (p.string(t) && n.watch) { |
| 552 | var o = new MutationObserver(function (i) { |
| 553 | Array.from(i).forEach(function (i) { |
| 554 | Array.from(i.addedNodes).forEach(function (i) { |
| 555 | p.element(i) && |
| 556 | (function (e, t) { |
| 557 | return function () { |
| 558 | return Array.from(document.querySelectorAll(t)).includes(this); |
| 559 | }.call(e, t); |
| 560 | })(i, t) && |
| 561 | new e(i, n); |
| 562 | }); |
| 563 | }); |
| 564 | }); |
| 565 | o.observe(document.body, { childList: !0, subtree: !0 }); |
| 566 | } |
| 567 | return s.map(function (t) { |
| 568 | return new e(t, i); |
| 569 | }); |
| 570 | }, |
| 571 | }, |
| 572 | { |
| 573 | key: "enabled", |
| 574 | get: function () { |
| 575 | return "ontouchstart" in document.documentElement; |
| 576 | }, |
| 577 | }, |
| 578 | ] |
| 579 | ), |
| 580 | e |
| 581 | ); |
| 582 | })(); |
| 583 | const y = (e) => (null != e ? e.constructor : null), |
| 584 | b = (e, t) => Boolean(e && t && e instanceof t), |
| 585 | v = (e) => null == e, |
| 586 | w = (e) => y(e) === Object, |
| 587 | T = (e) => y(e) === String, |
| 588 | k = (e) => "function" == typeof e, |
| 589 | E = (e) => Array.isArray(e), |
| 590 | C = (e) => b(e, NodeList), |
| 591 | S = (e) => v(e) || ((T(e) || E(e) || C(e)) && !e.length) || (w(e) && !Object.keys(e).length); |
| 592 | var A = { |
| 593 | nullOrUndefined: v, |
| 594 | object: w, |
| 595 | number: (e) => y(e) === Number && !Number.isNaN(e), |
| 596 | string: T, |
| 597 | boolean: (e) => y(e) === Boolean, |
| 598 | function: k, |
| 599 | array: E, |
| 600 | weakMap: (e) => b(e, WeakMap), |
| 601 | nodeList: C, |
| 602 | element: (e) => null !== e && "object" == typeof e && 1 === e.nodeType && "object" == typeof e.style && "object" == typeof e.ownerDocument, |
| 603 | textNode: (e) => y(e) === Text, |
| 604 | event: (e) => b(e, Event), |
| 605 | keyboardEvent: (e) => b(e, KeyboardEvent), |
| 606 | cue: (e) => b(e, window.TextTrackCue) || b(e, window.VTTCue), |
| 607 | track: (e) => b(e, TextTrack) || (!v(e) && T(e.kind)), |
| 608 | promise: (e) => b(e, Promise) && k(e.then), |
| 609 | url: (e) => { |
| 610 | if (b(e, window.URL)) return !0; |
| 611 | if (!T(e)) return !1; |
| 612 | let t = e; |
| 613 | (e.startsWith("http://") && e.startsWith("https://")) || (t = `http://${e}`); |
| 614 | try { |
| 615 | return !S(new URL(t).hostname); |
| 616 | } catch (e) { |
| 617 | return !1; |
| 618 | } |
| 619 | }, |
| 620 | empty: S, |
| 621 | }; |
| 622 | const P = (() => { |
| 623 | const e = document.createElement("span"), |
| 624 | t = { WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend", transition: "transitionend" }, |
| 625 | i = Object.keys(t).find((t) => void 0 !== e.style[t]); |
| 626 | return !!A.string(i) && t[i]; |
| 627 | })(); |
| 628 | function M(e, t) { |
| 629 | setTimeout(() => { |
| 630 | try { |
| 631 | (e.hidden = !0), e.offsetHeight, (e.hidden = !1); |
| 632 | } catch (e) { } |
| 633 | }, t); |
| 634 | } |
| 635 | var x = { |
| 636 | isIE: Boolean(window.document.documentMode), |
| 637 | isEdge: /Edge/g.test(navigator.userAgent), |
| 638 | isWebKit: "WebkitAppearance" in document.documentElement.style && !/Edge/g.test(navigator.userAgent), |
| 639 | isIPhone: /iPhone|iPod/gi.test(navigator.userAgent) && navigator.maxTouchPoints > 1, |
| 640 | isIPadOS: "MacIntel" === navigator.platform && navigator.maxTouchPoints > 1, |
| 641 | isIos: /iPad|iPhone|iPod/gi.test(navigator.userAgent) && navigator.maxTouchPoints > 1, |
| 642 | }; |
| 643 | function L(e, t) { |
| 644 | return t.split(".").reduce((e, t) => e && e[t], e); |
| 645 | } |
| 646 | function N(e = {}, ...t) { |
| 647 | if (!t.length) return e; |
| 648 | const i = t.shift(); |
| 649 | return A.object(i) |
| 650 | ? (Object.keys(i).forEach((t) => { |
| 651 | A.object(i[t]) ? (Object.keys(e).includes(t) || Object.assign(e, { [t]: {} }), N(e[t], i[t])) : Object.assign(e, { [t]: i[t] }); |
| 652 | }), |
| 653 | N(e, ...t)) |
| 654 | : e; |
| 655 | } |
| 656 | function _(e, t) { |
| 657 | const i = e.length ? e : [e]; |
| 658 | Array.from(i) |
| 659 | .reverse() |
| 660 | .forEach((e, i) => { |
| 661 | const s = i > 0 ? t.cloneNode(!0) : t, |
| 662 | n = e.parentNode, |
| 663 | a = e.nextSibling; |
| 664 | s.appendChild(e), a ? n.insertBefore(s, a) : n.appendChild(s); |
| 665 | }); |
| 666 | } |
| 667 | function I(e, t) { |
| 668 | A.element(e) && |
| 669 | !A.empty(t) && |
| 670 | Object.entries(t) |
| 671 | .filter(([, e]) => !A.nullOrUndefined(e)) |
| 672 | .forEach(([t, i]) => e.setAttribute(t, i)); |
| 673 | } |
| 674 | function O(e, t, i) { |
| 675 | const s = document.createElement(e); |
| 676 | return A.object(t) && I(s, t), A.string(i) && (s.innerText = i), s; |
| 677 | } |
| 678 | function $(e, t, i, s) { |
| 679 | A.element(t) && t.appendChild(O(e, i, s)); |
| 680 | } |
| 681 | function j(e) { |
| 682 | A.nodeList(e) || A.array(e) ? Array.from(e).forEach(j) : A.element(e) && A.element(e.parentNode) && e.parentNode.removeChild(e); |
| 683 | } |
| 684 | function R(e) { |
| 685 | if (!A.element(e)) return; |
| 686 | let { length: t } = e.childNodes; |
| 687 | for (; t > 0;) e.removeChild(e.lastChild), (t -= 1); |
| 688 | } |
| 689 | function D(e, t) { |
| 690 | return A.element(t) && A.element(t.parentNode) && A.element(e) ? (t.parentNode.replaceChild(e, t), e) : null; |
| 691 | } |
| 692 | function q(e, t) { |
| 693 | if (!A.string(e) || A.empty(e)) return {}; |
| 694 | const i = {}, |
| 695 | s = N({}, t); |
| 696 | return ( |
| 697 | e.split(",").forEach((e) => { |
| 698 | const t = e.trim(), |
| 699 | n = t.replace(".", ""), |
| 700 | a = t.replace(/[[\]]/g, "").split("="), |
| 701 | [r] = a, |
| 702 | o = a.length > 1 ? a[1].replace(/["']/g, "") : ""; |
| 703 | switch (t.charAt(0)) { |
| 704 | case ".": |
| 705 | A.string(s.class) ? (i.class = `${s.class} ${n}`) : (i.class = n); |
| 706 | break; |
| 707 | case "#": |
| 708 | i.id = t.replace("#", ""); |
| 709 | break; |
| 710 | case "[": |
| 711 | i[r] = o; |
| 712 | } |
| 713 | }), |
| 714 | N(s, i) |
| 715 | ); |
| 716 | } |
| 717 | function H(e, t) { |
| 718 | if (!A.element(e)) return; |
| 719 | let i = t; |
| 720 | A.boolean(i) || (i = !e.hidden), (e.hidden = i); |
| 721 | } |
| 722 | function F(e, t, i) { |
| 723 | if (A.nodeList(e)) return Array.from(e).map((e) => F(e, t, i)); |
| 724 | if (A.element(e)) { |
| 725 | let s = "toggle"; |
| 726 | return void 0 !== i && (s = i ? "add" : "remove"), e.classList[s](t), e.classList.contains(t); |
| 727 | } |
| 728 | return !1; |
| 729 | } |
| 730 | function U(e, t) { |
| 731 | return A.element(e) && e.classList.contains(t); |
| 732 | } |
| 733 | function V(e, t) { |
| 734 | const { prototype: i } = Element; |
| 735 | return ( |
| 736 | i.matches || |
| 737 | i.webkitMatchesSelector || |
| 738 | i.mozMatchesSelector || |
| 739 | i.msMatchesSelector || |
| 740 | function () { |
| 741 | return Array.from(document.querySelectorAll(t)).includes(this); |
| 742 | } |
| 743 | ).call(e, t); |
| 744 | } |
| 745 | function B(e) { |
| 746 | return this.elements.container.querySelectorAll(e); |
| 747 | } |
| 748 | function W(e) { |
| 749 | return this.elements.container.querySelector(e); |
| 750 | } |
| 751 | function z(e = null, t = !1) { |
| 752 | A.element(e) && e.focus({ preventScroll: !0, focusVisible: t }); |
| 753 | } |
| 754 | const K = { "audio/ogg": "vorbis", "audio/wav": "1", "video/webm": "vp8, vorbis", "video/mp4": "avc1.42E01E, mp4a.40.2", "video/ogg": "theora" }, |
| 755 | Y = { |
| 756 | audio: "canPlayType" in document.createElement("audio"), |
| 757 | video: "canPlayType" in document.createElement("video"), |
| 758 | check(e, t) { |
| 759 | const i = Y[e] || "html5" !== t; |
| 760 | return { api: i, ui: i && Y.rangeInput }; |
| 761 | }, |
| 762 | pip: !(x.isIPhone || (!A.function(O("video").webkitSetPresentationMode) && (!document.pictureInPictureEnabled || O("video").disablePictureInPicture))), |
| 763 | airplay: A.function(window.WebKitPlaybackTargetAvailabilityEvent), |
| 764 | playsinline: "playsInline" in document.createElement("video"), |
| 765 | mime(e) { |
| 766 | if (A.empty(e)) return !1; |
| 767 | const [t] = e.split("/"); |
| 768 | let i = e; |
| 769 | if (!this.isHTML5 || t !== this.type) return !1; |
| 770 | Object.keys(K).includes(i) && (i += `; codecs="${K[e]}"`); |
| 771 | try { |
| 772 | return Boolean(i && this.media.canPlayType(i).replace(/no/, "")); |
| 773 | } catch (e) { |
| 774 | return !1; |
| 775 | } |
| 776 | }, |
| 777 | textTracks: "textTracks" in document.createElement("video"), |
| 778 | rangeInput: (() => { |
| 779 | const e = document.createElement("input"); |
| 780 | return (e.type = "range"), "range" === e.type; |
| 781 | })(), |
| 782 | touch: "ontouchstart" in document.documentElement, |
| 783 | transitions: !1 !== P, |
| 784 | reducedMotion: "matchMedia" in window && window.matchMedia("(prefers-reduced-motion)").matches, |
| 785 | }, |
| 786 | Q = (() => { |
| 787 | let e = !1; |
| 788 | try { |
| 789 | const t = Object.defineProperty({}, "passive", { get: () => ((e = !0), null) }); |
| 790 | window.addEventListener("test", null, t), window.removeEventListener("test", null, t); |
| 791 | } catch (e) { } |
| 792 | return e; |
| 793 | })(); |
| 794 | function X(e, t, i, s = !1, n = !0, a = !1) { |
| 795 | if (!e || !("addEventListener" in e) || A.empty(t) || !A.function(i)) return; |
| 796 | const r = t.split(" "); |
| 797 | let o = a; |
| 798 | Q && (o = { passive: n, capture: a }), |
| 799 | r.forEach((t) => { |
| 800 | this && this.eventListeners && s && this.eventListeners.push({ element: e, type: t, callback: i, options: o }), e[s ? "addEventListener" : "removeEventListener"](t, i, o); |
| 801 | }); |
| 802 | } |
| 803 | function J(e, t = "", i, s = !0, n = !1) { |
| 804 | X.call(this, e, t, i, !0, s, n); |
| 805 | } |
| 806 | function G(e, t = "", i, s = !0, n = !1) { |
| 807 | X.call(this, e, t, i, !1, s, n); |
| 808 | } |
| 809 | function Z(e, t = "", i, s = !0, n = !1) { |
| 810 | const a = (...r) => { |
| 811 | G(e, t, a, s, n), i.apply(this, r); |
| 812 | }; |
| 813 | X.call(this, e, t, a, !0, s, n); |
| 814 | } |
| 815 | function ee(e, t = "", i = !1, s = {}) { |
| 816 | if (!A.element(e) || A.empty(t)) return; |
| 817 | const n = new CustomEvent(t, { bubbles: i, detail: { ...s, plyr: this } }); |
| 818 | e.dispatchEvent(n); |
| 819 | } |
| 820 | function te() { |
| 821 | this && |
| 822 | this.eventListeners && |
| 823 | (this.eventListeners.forEach((e) => { |
| 824 | const { element: t, type: i, callback: s, options: n } = e; |
| 825 | t.removeEventListener(i, s, n); |
| 826 | }), |
| 827 | (this.eventListeners = [])); |
| 828 | } |
| 829 | function ie() { |
| 830 | return new Promise((e) => (this.ready ? setTimeout(e, 0) : J.call(this, this.elements.container, "ready", e))).then(() => { }); |
| 831 | } |
| 832 | function se(e) { |
| 833 | A.promise(e) && e.then(null, () => { }); |
| 834 | } |
| 835 | function ne(e) { |
| 836 | return A.array(e) ? e.filter((t, i) => e.indexOf(t) === i) : e; |
| 837 | } |
| 838 | function ae(e, t) { |
| 839 | return A.array(e) && e.length ? e.reduce((e, i) => (Math.abs(i - t) < Math.abs(e - t) ? i : e)) : null; |
| 840 | } |
| 841 | function re(e) { |
| 842 | return !(!window || !window.CSS) && window.CSS.supports(e); |
| 843 | } |
| 844 | const oe = [ |
| 845 | [1, 1], |
| 846 | [4, 3], |
| 847 | [3, 4], |
| 848 | [5, 4], |
| 849 | [4, 5], |
| 850 | [3, 2], |
| 851 | [2, 3], |
| 852 | [16, 10], |
| 853 | [10, 16], |
| 854 | [16, 9], |
| 855 | [9, 16], |
| 856 | [21, 9], |
| 857 | [9, 21], |
| 858 | [32, 9], |
| 859 | [9, 32], |
| 860 | ].reduce((e, [t, i]) => ({ ...e, [t / i]: [t, i] }), {}); |
| 861 | function le(e) { |
| 862 | if (!(A.array(e) || (A.string(e) && e.includes(":")))) return !1; |
| 863 | return (A.array(e) ? e : e.split(":")).map(Number).every(A.number); |
| 864 | } |
| 865 | function ce(e) { |
| 866 | if (!A.array(e) || !e.every(A.number)) return null; |
| 867 | const [t, i] = e, |
| 868 | s = (e, t) => (0 === t ? e : s(t, e % t)), |
| 869 | n = s(t, i); |
| 870 | return [t / n, i / n]; |
| 871 | } |
| 872 | function ue(e) { |
| 873 | const t = (e) => (le(e) ? e.split(":").map(Number) : null); |
| 874 | let i = t(e); |
| 875 | if ((null === i && (i = t(this.config.ratio)), null === i && !A.empty(this.embed) && A.array(this.embed.ratio) && ({ ratio: i } = this.embed), null === i && this.isHTML5)) { |
| 876 | const { videoWidth: e, videoHeight: t } = this.media; |
| 877 | i = [e, t]; |
| 878 | } |
| 879 | return ce(i); |
| 880 | } |
| 881 | function he(e) { |
| 882 | if (!this.isVideo) return {}; |
| 883 | const { wrapper: t } = this.elements, |
| 884 | i = ue.call(this, e); |
| 885 | if (!A.array(i)) return {}; |
| 886 | const [s, n] = ce(i), |
| 887 | a = (100 / s) * n; |
| 888 | if ((re(`aspect-ratio: ${s}/${n}`) ? (t.style.aspectRatio = `${s}/${n}`) : (t.style.paddingBottom = `${a}%`), this.isVimeo && !this.config.vimeo.premium && this.supported.ui)) { |
| 889 | const e = (100 / this.media.offsetWidth) * parseInt(window.getComputedStyle(this.media).paddingBottom, 10), |
| 890 | i = (e - a) / (e / 50); |
| 891 | this.fullscreen.active ? (t.style.paddingBottom = null) : (this.media.style.transform = `translateY(-${i}%)`); |
| 892 | } else this.isHTML5 && t.classList.add(this.config.classNames.videoFixedRatio); |
| 893 | return { padding: a, ratio: i }; |
| 894 | } |
| 895 | function de(e, t, i = 0.05) { |
| 896 | const s = e / t, |
| 897 | n = ae(Object.keys(oe), s); |
| 898 | return Math.abs(n - s) <= i ? oe[n] : [e, t]; |
| 899 | } |
| 900 | const me = { |
| 901 | getSources() { |
| 902 | if (!this.isHTML5) return []; |
| 903 | return Array.from(this.media.querySelectorAll("source")).filter((e) => { |
| 904 | const t = e.getAttribute("type"); |
| 905 | return !!A.empty(t) || Y.mime.call(this, t); |
| 906 | }); |
| 907 | }, |
| 908 | getQualityOptions() { |
| 909 | return this.config.quality.forced |
| 910 | ? this.config.quality.options |
| 911 | : me.getSources |
| 912 | .call(this) |
| 913 | .map((e) => Number(e.getAttribute("size"))) |
| 914 | .filter(Boolean); |
| 915 | }, |
| 916 | setup() { |
| 917 | if (!this.isHTML5) return; |
| 918 | const e = this; |
| 919 | (e.options.speed = e.config.speed.options), |
| 920 | A.empty(this.config.ratio) || he.call(e), |
| 921 | Object.defineProperty(e.media, "quality", { |
| 922 | get() { |
| 923 | const t = me.getSources.call(e).find((t) => t.getAttribute("src") === e.source); |
| 924 | return t && Number(t.getAttribute("size")); |
| 925 | }, |
| 926 | set(t) { |
| 927 | if (e.quality !== t) { |
| 928 | if (e.config.quality.forced && A.function(e.config.quality.onChange)) e.config.quality.onChange(t); |
| 929 | else { |
| 930 | const i = me.getSources.call(e).find((e) => Number(e.getAttribute("size")) === t); |
| 931 | if (!i) return; |
| 932 | const { currentTime: s, paused: n, preload: a, readyState: r, playbackRate: o } = e.media; |
| 933 | (e.media.src = i.getAttribute("src")), |
| 934 | ("none" !== a || r) && |
| 935 | (e.once("loadedmetadata", () => { |
| 936 | (e.speed = o), (e.currentTime = s), n || se(e.play()); |
| 937 | }), |
| 938 | e.media.load()); |
| 939 | } |
| 940 | ee.call(e, e.media, "qualitychange", !1, { quality: t }); |
| 941 | } |
| 942 | }, |
| 943 | }); |
| 944 | }, |
| 945 | cancelRequests() { |
| 946 | this.isHTML5 && (j(me.getSources.call(this)), this.media.setAttribute("src", this.config.blankVideo), this.media.load(), this.debug.log("Cancelled network requests")); |
| 947 | }, |
| 948 | }; |
| 949 | function pe(e, ...t) { |
| 950 | return A.empty(e) ? e : e.toString().replace(/{(\d+)}/g, (e, i) => t[i].toString()); |
| 951 | } |
| 952 | const ge = (e = "", t = "", i = "") => e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1"), "g"), i.toString()), |
| 953 | fe = (e = "") => e.toString().replace(/\w\S*/g, (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()); |
| 954 | function ye(e = "") { |
| 955 | let t = e.toString(); |
| 956 | return ( |
| 957 | (t = (function (e = "") { |
| 958 | let t = e.toString(); |
| 959 | return (t = ge(t, "-", " ")), (t = ge(t, "_", " ")), (t = fe(t)), ge(t, " ", ""); |
| 960 | })(t)), |
| 961 | t.charAt(0).toLowerCase() + t.slice(1) |
| 962 | ); |
| 963 | } |
| 964 | function be(e) { |
| 965 | const t = document.createElement("div"); |
| 966 | return t.appendChild(e), t.innerHTML; |
| 967 | } |
| 968 | const ve = { pip: "PIP", airplay: "AirPlay", html5: "HTML5", vimeo: "Vimeo", youtube: "YouTube" }, |
| 969 | we = { |
| 970 | get(e = "", t = {}) { |
| 971 | if (A.empty(e) || A.empty(t)) return ""; |
| 972 | let i = L(t.i18n, e); |
| 973 | if (A.empty(i)) return Object.keys(ve).includes(e) ? ve[e] : ""; |
| 974 | const s = { "{seektime}": t.seekTime, "{title}": t.title }; |
| 975 | return ( |
| 976 | Object.entries(s).forEach(([e, t]) => { |
| 977 | i = ge(i, e, t); |
| 978 | }), |
| 979 | i |
| 980 | ); |
| 981 | }, |
| 982 | }; |
| 983 | class Te { |
| 984 | constructor(e) { |
| 985 | t(this, "get", (e) => { |
| 986 | if (!Te.supported || !this.enabled) return null; |
| 987 | const t = window.localStorage.getItem(this.key); |
| 988 | if (A.empty(t)) return null; |
| 989 | const i = JSON.parse(t); |
| 990 | return A.string(e) && e.length ? i[e] : i; |
| 991 | }), |
| 992 | t(this, "set", (e) => { |
| 993 | if (!Te.supported || !this.enabled) return; |
| 994 | if (!A.object(e)) return; |
| 995 | let t = this.get(); |
| 996 | A.empty(t) && (t = {}), N(t, e); |
| 997 | try { |
| 998 | window.localStorage.setItem(this.key, JSON.stringify(t)); |
| 999 | } catch (e) { } |
| 1000 | }), |
| 1001 | (this.enabled = e.config.storage.enabled), |
| 1002 | (this.key = e.config.storage.key); |
| 1003 | } |
| 1004 | static get supported() { |
| 1005 | try { |
| 1006 | if (!("localStorage" in window)) return !1; |
| 1007 | const e = "___test"; |
| 1008 | return window.localStorage.setItem(e, e), window.localStorage.removeItem(e), !0; |
| 1009 | } catch (e) { |
| 1010 | return !1; |
| 1011 | } |
| 1012 | } |
| 1013 | } |
| 1014 | function ke(e, t = "text") { |
| 1015 | return new Promise((i, s) => { |
| 1016 | try { |
| 1017 | const s = new XMLHttpRequest(); |
| 1018 | if (!("withCredentials" in s)) return; |
| 1019 | s.addEventListener("load", () => { |
| 1020 | if ("text" === t) |
| 1021 | try { |
| 1022 | i(JSON.parse(s.responseText)); |
| 1023 | } catch (e) { |
| 1024 | i(s.responseText); |
| 1025 | } |
| 1026 | else i(s.response); |
| 1027 | }), |
| 1028 | s.addEventListener("error", () => { |
| 1029 | throw new Error(s.status); |
| 1030 | }), |
| 1031 | s.open("GET", e, !0), |
| 1032 | (s.responseType = t), |
| 1033 | s.send(); |
| 1034 | } catch (e) { |
| 1035 | s(e); |
| 1036 | } |
| 1037 | }); |
| 1038 | } |
| 1039 | function Ee(e, t) { |
| 1040 | if (!A.string(e)) return; |
| 1041 | const i = "cache", |
| 1042 | s = A.string(t); |
| 1043 | let n = !1; |
| 1044 | const a = () => null !== document.getElementById(t), |
| 1045 | r = (e, t) => { |
| 1046 | (e.innerHTML = t), (s && a()) || document.body.insertAdjacentElement("afterbegin", e); |
| 1047 | }; |
| 1048 | if (!s || !a()) { |
| 1049 | const a = Te.supported, |
| 1050 | o = document.createElement("div"); |
| 1051 | if ((o.setAttribute("hidden", ""), s && o.setAttribute("id", t), a)) { |
| 1052 | const e = window.localStorage.getItem(`${i}-${t}`); |
| 1053 | if (((n = null !== e), n)) { |
| 1054 | const t = JSON.parse(e); |
| 1055 | r(o, t.content); |
| 1056 | } |
| 1057 | } |
| 1058 | ke(e) |
| 1059 | .then((e) => { |
| 1060 | if (!A.empty(e)) { |
| 1061 | if (a) |
| 1062 | try { |
| 1063 | window.localStorage.setItem(`${i}-${t}`, JSON.stringify({ content: e })); |
| 1064 | } catch (e) { } |
| 1065 | r(o, e); |
| 1066 | } |
| 1067 | }) |
| 1068 | .catch(() => { }); |
| 1069 | } |
| 1070 | } |
| 1071 | const Ce = (e) => Math.trunc((e / 60 / 60) % 60, 10), |
| 1072 | Se = (e) => Math.trunc((e / 60) % 60, 10), |
| 1073 | Ae = (e) => Math.trunc(e % 60, 10); |
| 1074 | function Pe(e = 0, t = !1, i = !1) { |
| 1075 | if (!A.number(e)) return Pe(void 0, t, i); |
| 1076 | const s = (e) => `0${e}`.slice(-2); |
| 1077 | let n = Ce(e); |
| 1078 | const a = Se(e), |
| 1079 | r = Ae(e); |
| 1080 | return (n = t || n > 0 ? `${n}:` : ""), `${i && e > 0 ? "-" : ""}${n}${s(a)}:${s(r)}`; |
| 1081 | } |
| 1082 | const Me = { |
| 1083 | getIconUrl() { |
| 1084 | const e = new URL(this.config.iconUrl, window.location), |
| 1085 | t = window.location.host ? window.location.host : window.top.location.host, |
| 1086 | i = e.host !== t || (x.isIE && !window.svg4everybody); |
| 1087 | return { url: this.config.iconUrl, cors: i }; |
| 1088 | }, |
| 1089 | findElements() { |
| 1090 | try { |
| 1091 | return ( |
| 1092 | (this.elements.controls = W.call(this, this.config.selectors.controls.wrapper)), |
| 1093 | (this.elements.buttons = { |
| 1094 | play: B.call(this, this.config.selectors.buttons.play), |
| 1095 | pause: W.call(this, this.config.selectors.buttons.pause), |
| 1096 | restart: W.call(this, this.config.selectors.buttons.restart), |
| 1097 | rewind: W.call(this, this.config.selectors.buttons.rewind), |
| 1098 | fastForward: W.call(this, this.config.selectors.buttons.fastForward), |
| 1099 | mute: W.call(this, this.config.selectors.buttons.mute), |
| 1100 | pip: W.call(this, this.config.selectors.buttons.pip), |
| 1101 | airplay: W.call(this, this.config.selectors.buttons.airplay), |
| 1102 | settings: W.call(this, this.config.selectors.buttons.settings), |
| 1103 | captions: W.call(this, this.config.selectors.buttons.captions), |
| 1104 | fullscreen: W.call(this, this.config.selectors.buttons.fullscreen), |
| 1105 | }), |
| 1106 | (this.elements.progress = W.call(this, this.config.selectors.progress)), |
| 1107 | (this.elements.inputs = { seek: W.call(this, this.config.selectors.inputs.seek), volume: W.call(this, this.config.selectors.inputs.volume) }), |
| 1108 | (this.elements.display = { |
| 1109 | buffer: W.call(this, this.config.selectors.display.buffer), |
| 1110 | currentTime: W.call(this, this.config.selectors.display.currentTime), |
| 1111 | duration: W.call(this, this.config.selectors.display.duration), |
| 1112 | }), |
| 1113 | A.element(this.elements.progress) && (this.elements.display.seekTooltip = this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)), |
| 1114 | !0 |
| 1115 | ); |
| 1116 | } catch (e) { |
| 1117 | return this.debug.warn("It looks like there is a problem with your custom controls HTML", e), this.toggleNativeControls(!0), !1; |
| 1118 | } |
| 1119 | }, |
| 1120 | createIcon(e, t) { |
| 1121 | const i = "http://www.w3.org/2000/svg", |
| 1122 | s = Me.getIconUrl.call(this), |
| 1123 | n = `${s.cors ? "" : s.url}#${this.config.iconPrefix}`, |
| 1124 | a = document.createElementNS(i, "svg"); |
| 1125 | I(a, N(t, { "aria-hidden": "true", focusable: "false" })); |
| 1126 | const r = document.createElementNS(i, "use"), |
| 1127 | o = `${n}-${e}`; |
| 1128 | return "href" in r && r.setAttributeNS("http://www.w3.org/1999/xlink", "href", o), r.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", o), a.appendChild(r), a; |
| 1129 | }, |
| 1130 | createLabel(e, t = {}) { |
| 1131 | const i = we.get(e, this.config); |
| 1132 | return O("span", { ...t, class: [t.class, this.config.classNames.hidden].filter(Boolean).join(" ") }, i); |
| 1133 | }, |
| 1134 | createBadge(e) { |
| 1135 | if (A.empty(e)) return null; |
| 1136 | const t = O("span", { class: this.config.classNames.menu.value }); |
| 1137 | return t.appendChild(O("span", { class: this.config.classNames.menu.badge }, e)), t; |
| 1138 | }, |
| 1139 | createButton(e, t) { |
| 1140 | const i = N({}, t); |
| 1141 | let s = ye(e); |
| 1142 | const n = { element: "button", toggle: !1, label: null, icon: null, labelPressed: null, iconPressed: null }; |
| 1143 | switch ( |
| 1144 | (["element", "icon", "label"].forEach((e) => { |
| 1145 | Object.keys(i).includes(e) && ((n[e] = i[e]), delete i[e]); |
| 1146 | }), |
| 1147 | "button" !== n.element || Object.keys(i).includes("type") || (i.type = "button"), |
| 1148 | Object.keys(i).includes("class") ? i.class.split(" ").some((e) => e === this.config.classNames.control) || N(i, { class: `${i.class} ${this.config.classNames.control}` }) : (i.class = this.config.classNames.control), |
| 1149 | e) |
| 1150 | ) { |
| 1151 | case "play": |
| 1152 | (n.toggle = !0), (n.label = "play"), (n.labelPressed = "pause"), (n.icon = "play"), (n.iconPressed = "pause"); |
| 1153 | break; |
| 1154 | case "mute": |
| 1155 | (n.toggle = !0), (n.label = "mute"), (n.labelPressed = "unmute"), (n.icon = "volume"), (n.iconPressed = "muted"); |
| 1156 | break; |
| 1157 | case "captions": |
| 1158 | (n.toggle = !0), (n.label = "enableCaptions"), (n.labelPressed = "disableCaptions"), (n.icon = "captions-off"), (n.iconPressed = "captions-on"); |
| 1159 | break; |
| 1160 | case "fullscreen": |
| 1161 | (n.toggle = !0), (n.label = "enterFullscreen"), (n.labelPressed = "exitFullscreen"), (n.icon = "enter-fullscreen"), (n.iconPressed = "exit-fullscreen"); |
| 1162 | break; |
| 1163 | case "play-large": |
| 1164 | (i.class += ` ${this.config.classNames.control}--overlaid`), (s = "play"), (n.label = "play"), (n.icon = "play"); |
| 1165 | break; |
| 1166 | default: |
| 1167 | A.empty(n.label) && (n.label = s), A.empty(n.icon) && (n.icon = e); |
| 1168 | } |
| 1169 | const a = O(n.element); |
| 1170 | return ( |
| 1171 | n.toggle |
| 1172 | ? (a.appendChild(Me.createIcon.call(this, n.iconPressed, { class: "icon--pressed" })), |
| 1173 | a.appendChild(Me.createIcon.call(this, n.icon, { class: "icon--not-pressed" })), |
| 1174 | a.appendChild(Me.createLabel.call(this, n.labelPressed, { class: "label--pressed" })), |
| 1175 | a.appendChild(Me.createLabel.call(this, n.label, { class: "label--not-pressed" }))) |
| 1176 | : (a.appendChild(Me.createIcon.call(this, n.icon)), a.appendChild(Me.createLabel.call(this, n.label))), |
| 1177 | N(i, q(this.config.selectors.buttons[s], i)), |
| 1178 | I(a, i), |
| 1179 | "play" === s ? (A.array(this.elements.buttons[s]) || (this.elements.buttons[s] = []), this.elements.buttons[s].push(a)) : (this.elements.buttons[s] = a), |
| 1180 | a |
| 1181 | ); |
| 1182 | }, |
| 1183 | createRange(e, t) { |
| 1184 | const i = O( |
| 1185 | "input", |
| 1186 | N( |
| 1187 | q(this.config.selectors.inputs[e]), |
| 1188 | { type: "range", min: 0, max: 100, step: 0.01, value: 0, autocomplete: "off", role: "slider", "aria-label": we.get(e, this.config), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": 0 }, |
| 1189 | t |
| 1190 | ) |
| 1191 | ); |
| 1192 | return (this.elements.inputs[e] = i), Me.updateRangeFill.call(this, i), f.setup(i), i; |
| 1193 | }, |
| 1194 | createProgress(e, t) { |
| 1195 | const i = O("progress", N(q(this.config.selectors.display[e]), { min: 0, max: 100, value: 0, role: "progressbar", "aria-hidden": !0 }, t)); |
| 1196 | if ("volume" !== e) { |
| 1197 | i.appendChild(O("span", null, "0")); |
| 1198 | const t = { played: "played", buffer: "buffered" }[e], |
| 1199 | s = t ? we.get(t, this.config) : ""; |
| 1200 | i.innerText = `% ${s.toLowerCase()}`; |
| 1201 | } |
| 1202 | return (this.elements.display[e] = i), i; |
| 1203 | }, |
| 1204 | createTime(e, t) { |
| 1205 | const i = q(this.config.selectors.display[e], t), |
| 1206 | s = O("div", N(i, { class: `${i.class ? i.class : ""} ${this.config.classNames.display.time} `.trim(), "aria-label": we.get(e, this.config), role: "timer" }), "00:00"); |
| 1207 | return (this.elements.display[e] = s), s; |
| 1208 | }, |
| 1209 | bindMenuItemShortcuts(e, t) { |
| 1210 | J.call( |
| 1211 | this, |
| 1212 | e, |
| 1213 | "keydown keyup", |
| 1214 | (i) => { |
| 1215 | if (![" ", "ArrowUp", "ArrowDown", "ArrowRight"].includes(i.key)) return; |
| 1216 | if ((i.preventDefault(), i.stopPropagation(), "keydown" === i.type)) return; |
| 1217 | const s = V(e, '[role="menuitemradio"]'); |
| 1218 | if (!s && [" ", "ArrowRight"].includes(i.key)) Me.showMenuPanel.call(this, t, !0); |
| 1219 | else { |
| 1220 | let t; |
| 1221 | " " !== i.key && |
| 1222 | ("ArrowDown" === i.key || (s && "ArrowRight" === i.key) |
| 1223 | ? ((t = e.nextElementSibling), A.element(t) || (t = e.parentNode.firstElementChild)) |
| 1224 | : ((t = e.previousElementSibling), A.element(t) || (t = e.parentNode.lastElementChild)), |
| 1225 | z.call(this, t, !0)); |
| 1226 | } |
| 1227 | }, |
| 1228 | !1 |
| 1229 | ), |
| 1230 | J.call(this, e, "keyup", (e) => { |
| 1231 | "Return" === e.key && Me.focusFirstMenuItem.call(this, null, !0); |
| 1232 | }); |
| 1233 | }, |
| 1234 | createMenuItem({ value: e, list: t, type: i, title: s, badge: n = null, checked: a = !1 }) { |
| 1235 | const r = q(this.config.selectors.inputs[i]), |
| 1236 | o = O("button", N(r, { type: "button", role: "menuitemradio", class: `${this.config.classNames.control} ${r.class ? r.class : ""}`.trim(), "aria-checked": a, value: e })), |
| 1237 | l = O("span"); |
| 1238 | (l.innerHTML = s), |
| 1239 | A.element(n) && l.appendChild(n), |
| 1240 | o.appendChild(l), |
| 1241 | Object.defineProperty(o, "checked", { |
| 1242 | enumerable: !0, |
| 1243 | get: () => "true" === o.getAttribute("aria-checked"), |
| 1244 | set(e) { |
| 1245 | e && |
| 1246 | Array.from(o.parentNode.children) |
| 1247 | .filter((e) => V(e, '[role="menuitemradio"]')) |
| 1248 | .forEach((e) => e.setAttribute("aria-checked", "false")), |
| 1249 | o.setAttribute("aria-checked", e ? "true" : "false"); |
| 1250 | }, |
| 1251 | }), |
| 1252 | this.listeners.bind( |
| 1253 | o, |
| 1254 | "click keyup", |
| 1255 | (t) => { |
| 1256 | if (!A.keyboardEvent(t) || " " === t.key) { |
| 1257 | switch ((t.preventDefault(), t.stopPropagation(), (o.checked = !0), i)) { |
| 1258 | case "language": |
| 1259 | this.currentTrack = Number(e); |
| 1260 | break; |
| 1261 | case "quality": |
| 1262 | this.quality = e; |
| 1263 | break; |
| 1264 | case "speed": |
| 1265 | this.speed = parseFloat(e); |
| 1266 | } |
| 1267 | Me.showMenuPanel.call(this, "home", A.keyboardEvent(t)); |
| 1268 | } |
| 1269 | }, |
| 1270 | i, |
| 1271 | !1 |
| 1272 | ), |
| 1273 | Me.bindMenuItemShortcuts.call(this, o, i), |
| 1274 | t.appendChild(o); |
| 1275 | }, |
| 1276 | formatTime(e = 0, t = !1) { |
| 1277 | if (!A.number(e)) return e; |
| 1278 | return Pe(e, Ce(this.duration) > 0, t); |
| 1279 | }, |
| 1280 | updateTimeDisplay(e = null, t = 0, i = !1) { |
| 1281 | A.element(e) && A.number(t) && (e.innerText = Me.formatTime(t, i)); |
| 1282 | }, |
| 1283 | updateVolume() { |
| 1284 | this.supported.ui && |
| 1285 | (A.element(this.elements.inputs.volume) && Me.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume), |
| 1286 | A.element(this.elements.buttons.mute) && (this.elements.buttons.mute.pressed = this.muted || 0 === this.volume)); |
| 1287 | }, |
| 1288 | setRange(e, t = 0) { |
| 1289 | A.element(e) && ((e.value = t), Me.updateRangeFill.call(this, e)); |
| 1290 | }, |
| 1291 | updateProgress(e) { |
| 1292 | if (!this.supported.ui || !A.event(e)) return; |
| 1293 | let t = 0; |
| 1294 | const i = (e, t) => { |
| 1295 | const i = A.number(t) ? t : 0, |
| 1296 | s = A.element(e) ? e : this.elements.display.buffer; |
| 1297 | if (A.element(s)) { |
| 1298 | s.value = i; |
| 1299 | const e = s.getElementsByTagName("span")[0]; |
| 1300 | A.element(e) && (e.childNodes[0].nodeValue = i); |
| 1301 | } |
| 1302 | }; |
| 1303 | if (e) |
| 1304 | switch (e.type) { |
| 1305 | case "timeupdate": |
| 1306 | case "seeking": |
| 1307 | case "seeked": |
| 1308 | (s = this.currentTime), |
| 1309 | (n = this.duration), |
| 1310 | (t = 0 === s || 0 === n || Number.isNaN(s) || Number.isNaN(n) ? 0 : ((s / n) * 100).toFixed(2)), |
| 1311 | "timeupdate" === e.type && Me.setRange.call(this, this.elements.inputs.seek, t); |
| 1312 | break; |
| 1313 | case "playing": |
| 1314 | case "progress": |
| 1315 | i(this.elements.display.buffer, 100 * this.buffered); |
| 1316 | } |
| 1317 | var s, n; |
| 1318 | }, |
| 1319 | updateRangeFill(e) { |
| 1320 | const t = A.event(e) ? e.target : e; |
| 1321 | if (A.element(t) && "range" === t.getAttribute("type")) { |
| 1322 | if (V(t, this.config.selectors.inputs.seek)) { |
| 1323 | t.setAttribute("aria-valuenow", this.currentTime); |
| 1324 | const e = Me.formatTime(this.currentTime), |
| 1325 | i = Me.formatTime(this.duration), |
| 1326 | s = we.get("seekLabel", this.config); |
| 1327 | t.setAttribute("aria-valuetext", s.replace("{currentTime}", e).replace("{duration}", i)); |
| 1328 | } else if (V(t, this.config.selectors.inputs.volume)) { |
| 1329 | const e = 100 * t.value; |
| 1330 | t.setAttribute("aria-valuenow", e), t.setAttribute("aria-valuetext", `${e.toFixed(1)}%`); |
| 1331 | } else t.setAttribute("aria-valuenow", t.value); |
| 1332 | (x.isWebKit || x.isIPadOS) && t.style.setProperty("--value", (t.value / t.max) * 100 + "%"); |
| 1333 | } |
| 1334 | }, |
| 1335 | updateSeekTooltip(e) { |
| 1336 | var t, i; |
| 1337 | if (!this.config.tooltips.seek || !A.element(this.elements.inputs.seek) || !A.element(this.elements.display.seekTooltip) || 0 === this.duration) return; |
| 1338 | const s = this.elements.display.seekTooltip, |
| 1339 | n = `${this.config.classNames.tooltip}--visible`, |
| 1340 | a = (e) => F(s, n, e); |
| 1341 | if (this.touch) return void a(!1); |
| 1342 | let r = 0; |
| 1343 | const o = this.elements.progress.getBoundingClientRect(); |
| 1344 | if (A.event(e)) r = (100 / o.width) * (e.pageX - o.left); |
| 1345 | else { |
| 1346 | if (!U(s, n)) return; |
| 1347 | r = parseFloat(s.style.left, 10); |
| 1348 | } |
| 1349 | r < 0 ? (r = 0) : r > 100 && (r = 100); |
| 1350 | const l = (this.duration / 100) * r; |
| 1351 | s.innerText = Me.formatTime(l); |
| 1352 | const c = null === (t = this.config.markers) || void 0 === t || null === (i = t.points) || void 0 === i ? void 0 : i.find(({ time: e }) => e === Math.round(l)); |
| 1353 | c && s.insertAdjacentHTML("afterbegin", `${c.label}<br>`), (s.style.left = `${r}%`), A.event(e) && ["mouseenter", "mouseleave"].includes(e.type) && a("mouseenter" === e.type); |
| 1354 | }, |
| 1355 | timeUpdate(e) { |
| 1356 | const t = !A.element(this.elements.display.duration) && this.config.invertTime; |
| 1357 | Me.updateTimeDisplay.call(this, this.elements.display.currentTime, t ? this.duration - this.currentTime : this.currentTime, t), (e && "timeupdate" === e.type && this.media.seeking) || Me.updateProgress.call(this, e); |
| 1358 | }, |
| 1359 | durationUpdate() { |
| 1360 | if (!this.supported.ui || (!this.config.invertTime && this.currentTime)) return; |
| 1361 | if (this.duration >= 2 ** 32) return H(this.elements.display.currentTime, !0), void H(this.elements.progress, !0); |
| 1362 | A.element(this.elements.inputs.seek) && this.elements.inputs.seek.setAttribute("aria-valuemax", this.duration); |
| 1363 | const e = A.element(this.elements.display.duration); |
| 1364 | !e && this.config.displayDuration && this.paused && Me.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration), |
| 1365 | e && Me.updateTimeDisplay.call(this, this.elements.display.duration, this.duration), |
| 1366 | this.config.markers.enabled && Me.setMarkers.call(this), |
| 1367 | Me.updateSeekTooltip.call(this); |
| 1368 | }, |
| 1369 | toggleMenuButton(e, t) { |
| 1370 | H(this.elements.settings.buttons[e], !t); |
| 1371 | }, |
| 1372 | updateSetting(e, t, i) { |
| 1373 | const s = this.elements.settings.panels[e]; |
| 1374 | let n = null, |
| 1375 | a = t; |
| 1376 | if ("captions" === e) n = this.currentTrack; |
| 1377 | else { |
| 1378 | if (((n = A.empty(i) ? this[e] : i), A.empty(n) && (n = this.config[e].default), !A.empty(this.options[e]) && !this.options[e].includes(n))) return void this.debug.warn(`Unsupported value of '${n}' for ${e}`); |
| 1379 | if (!this.config[e].options.includes(n)) return void this.debug.warn(`Disabled value of '${n}' for ${e}`); |
| 1380 | } |
| 1381 | if ((A.element(a) || (a = s && s.querySelector('[role="menu"]')), !A.element(a))) return; |
| 1382 | this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML = Me.getLabel.call(this, e, n); |
| 1383 | const r = a && a.querySelector(`[value="${n}"]`); |
| 1384 | A.element(r) && (r.checked = !0); |
| 1385 | }, |
| 1386 | getLabel(e, t) { |
| 1387 | switch (e) { |
| 1388 | case "speed": |
| 1389 | return 1 === t ? we.get("normal", this.config) : `${t}×`; |
| 1390 | case "quality": |
| 1391 | if (A.number(t)) { |
| 1392 | const e = we.get(`qualityLabel.${t}`, this.config); |
| 1393 | return e.length ? e : `${t}p`; |
| 1394 | } |
| 1395 | return fe(t); |
| 1396 | case "captions": |
| 1397 | return Ne.getLabel.call(this); |
| 1398 | default: |
| 1399 | return null; |
| 1400 | } |
| 1401 | }, |
| 1402 | setQualityMenu(e) { |
| 1403 | if (!A.element(this.elements.settings.panels.quality)) return; |
| 1404 | const t = "quality", |
| 1405 | i = this.elements.settings.panels.quality.querySelector('[role="menu"]'); |
| 1406 | A.array(e) && (this.options.quality = ne(e).filter((e) => this.config.quality.options.includes(e))); |
| 1407 | const s = !A.empty(this.options.quality) && this.options.quality.length > 1; |
| 1408 | if ((Me.toggleMenuButton.call(this, t, s), R(i), Me.checkMenu.call(this), !s)) return; |
| 1409 | const n = (e) => { |
| 1410 | const t = we.get(`qualityBadge.${e}`, this.config); |
| 1411 | return t.length ? Me.createBadge.call(this, t) : null; |
| 1412 | }; |
| 1413 | this.options.quality |
| 1414 | .sort((e, t) => { |
| 1415 | const i = this.config.quality.options; |
| 1416 | return i.indexOf(e) > i.indexOf(t) ? 1 : -1; |
| 1417 | }) |
| 1418 | .forEach((e) => { |
| 1419 | Me.createMenuItem.call(this, { value: e, list: i, type: t, title: Me.getLabel.call(this, "quality", e), badge: n(e) }); |
| 1420 | }), |
| 1421 | Me.updateSetting.call(this, t, i); |
| 1422 | }, |
| 1423 | setCaptionsMenu() { |
| 1424 | if (!A.element(this.elements.settings.panels.captions)) return; |
| 1425 | const e = "captions", |
| 1426 | t = this.elements.settings.panels.captions.querySelector('[role="menu"]'), |
| 1427 | i = Ne.getTracks.call(this), |
| 1428 | s = Boolean(i.length); |
| 1429 | if ((Me.toggleMenuButton.call(this, e, s), R(t), Me.checkMenu.call(this), !s)) return; |
| 1430 | const n = i.map((e, i) => ({ |
| 1431 | value: i, |
| 1432 | checked: this.captions.toggled && this.currentTrack === i, |
| 1433 | title: Ne.getLabel.call(this, e), |
| 1434 | badge: e.language && Me.createBadge.call(this, e.language.toUpperCase()), |
| 1435 | list: t, |
| 1436 | type: "language", |
| 1437 | })); |
| 1438 | n.unshift({ value: -1, checked: !this.captions.toggled, title: we.get("disabled", this.config), list: t, type: "language" }), n.forEach(Me.createMenuItem.bind(this)), Me.updateSetting.call(this, e, t); |
| 1439 | }, |
| 1440 | setSpeedMenu() { |
| 1441 | if (!A.element(this.elements.settings.panels.speed)) return; |
| 1442 | const e = "speed", |
| 1443 | t = this.elements.settings.panels.speed.querySelector('[role="menu"]'); |
| 1444 | this.options.speed = this.options.speed.filter((e) => e >= this.minimumSpeed && e <= this.maximumSpeed); |
| 1445 | const i = !A.empty(this.options.speed) && this.options.speed.length > 1; |
| 1446 | Me.toggleMenuButton.call(this, e, i), |
| 1447 | R(t), |
| 1448 | Me.checkMenu.call(this), |
| 1449 | i && |
| 1450 | (this.options.speed.forEach((i) => { |
| 1451 | Me.createMenuItem.call(this, { value: i, list: t, type: e, title: Me.getLabel.call(this, "speed", i) }); |
| 1452 | }), |
| 1453 | Me.updateSetting.call(this, e, t)); |
| 1454 | }, |
| 1455 | checkMenu() { |
| 1456 | const { buttons: e } = this.elements.settings, |
| 1457 | t = !A.empty(e) && Object.values(e).some((e) => !e.hidden); |
| 1458 | H(this.elements.settings.menu, !t); |
| 1459 | }, |
| 1460 | focusFirstMenuItem(e, t = !1) { |
| 1461 | if (this.elements.settings.popup.hidden) return; |
| 1462 | let i = e; |
| 1463 | A.element(i) || (i = Object.values(this.elements.settings.panels).find((e) => !e.hidden)); |
| 1464 | const s = i.querySelector('[role^="menuitem"]'); |
| 1465 | z.call(this, s, t); |
| 1466 | }, |
| 1467 | toggleMenu(e) { |
| 1468 | const { popup: t } = this.elements.settings, |
| 1469 | i = this.elements.buttons.settings; |
| 1470 | if (!A.element(t) || !A.element(i)) return; |
| 1471 | const { hidden: s } = t; |
| 1472 | let n = s; |
| 1473 | if (A.boolean(e)) n = e; |
| 1474 | else if (A.keyboardEvent(e) && "Escape" === e.key) n = !1; |
| 1475 | else if (A.event(e)) { |
| 1476 | const s = A.function(e.composedPath) ? e.composedPath()[0] : e.target, |
| 1477 | a = t.contains(s); |
| 1478 | if (a || (!a && e.target !== i && n)) return; |
| 1479 | } |
| 1480 | i.setAttribute("aria-expanded", n), |
| 1481 | H(t, !n), |
| 1482 | F(this.elements.container, this.config.classNames.menu.open, n), |
| 1483 | n && A.keyboardEvent(e) ? Me.focusFirstMenuItem.call(this, null, !0) : n || s || z.call(this, i, A.keyboardEvent(e)); |
| 1484 | }, |
| 1485 | getMenuSize(e) { |
| 1486 | const t = e.cloneNode(!0); |
| 1487 | (t.style.position = "absolute"), (t.style.opacity = 0), t.removeAttribute("hidden"), e.parentNode.appendChild(t); |
| 1488 | const i = t.scrollWidth, |
| 1489 | s = t.scrollHeight; |
| 1490 | return j(t), { width: i, height: s }; |
| 1491 | }, |
| 1492 | showMenuPanel(e = "", t = !1) { |
| 1493 | const i = this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`); |
| 1494 | if (!A.element(i)) return; |
| 1495 | const s = i.parentNode, |
| 1496 | n = Array.from(s.children).find((e) => !e.hidden); |
| 1497 | if (Y.transitions && !Y.reducedMotion) { |
| 1498 | (s.style.width = `${n.scrollWidth}px`), (s.style.height = `${n.scrollHeight}px`); |
| 1499 | const e = Me.getMenuSize.call(this, i), |
| 1500 | t = (e) => { |
| 1501 | e.target === s && ["width", "height"].includes(e.propertyName) && ((s.style.width = ""), (s.style.height = ""), G.call(this, s, P, t)); |
| 1502 | }; |
| 1503 | J.call(this, s, P, t), (s.style.width = `${e.width}px`), (s.style.height = `${e.height}px`); |
| 1504 | } |
| 1505 | H(n, !0), H(i, !1), Me.focusFirstMenuItem.call(this, i, t); |
| 1506 | }, |
| 1507 | setDownloadUrl() { |
| 1508 | const e = this.elements.buttons.download; |
| 1509 | A.element(e) && e.setAttribute("href", this.download); |
| 1510 | }, |
| 1511 | create(e) { |
| 1512 | const { bindMenuItemShortcuts: t, createButton: i, createProgress: s, createRange: n, createTime: a, setQualityMenu: r, setSpeedMenu: o, showMenuPanel: l } = Me; |
| 1513 | (this.elements.controls = null), A.array(this.config.controls) && this.config.controls.includes("play-large") && this.elements.container.appendChild(i.call(this, "play-large")); |
| 1514 | const c = O("div", q(this.config.selectors.controls.wrapper)); |
| 1515 | this.elements.controls = c; |
| 1516 | const u = { class: "plyr__controls__item" }; |
| 1517 | return ( |
| 1518 | ne(A.array(this.config.controls) ? this.config.controls : []).forEach((r) => { |
| 1519 | if ( |
| 1520 | ("restart" === r && c.appendChild(i.call(this, "restart", u)), |
| 1521 | "rewind" === r && c.appendChild(i.call(this, "rewind", u)), |
| 1522 | "play" === r && c.appendChild(i.call(this, "play", u)), |
| 1523 | "fast-forward" === r && c.appendChild(i.call(this, "fast-forward", u)), |
| 1524 | "progress" === r) |
| 1525 | ) { |
| 1526 | const t = O("div", { class: `${u.class} plyr__progress__container` }), |
| 1527 | i = O("div", q(this.config.selectors.progress)); |
| 1528 | if ((i.appendChild(n.call(this, "seek", { id: `plyr-seek-${e.id}` })), i.appendChild(s.call(this, "buffer")), this.config.tooltips.seek)) { |
| 1529 | const e = O("span", { class: this.config.classNames.tooltip }, "00:00"); |
| 1530 | i.appendChild(e), (this.elements.display.seekTooltip = e); |
| 1531 | } |
| 1532 | (this.elements.progress = i), t.appendChild(this.elements.progress), c.appendChild(t); |
| 1533 | } |
| 1534 | if (("current-time" === r && c.appendChild(a.call(this, "currentTime", u)), "duration" === r && c.appendChild(a.call(this, "duration", u)), "mute" === r || "volume" === r)) { |
| 1535 | let { volume: t } = this.elements; |
| 1536 | if ( |
| 1537 | ((A.element(t) && c.contains(t)) || ((t = O("div", N({}, u, { class: `${u.class} plyr__volume`.trim() }))), (this.elements.volume = t), c.appendChild(t)), |
| 1538 | "mute" === r && t.appendChild(i.call(this, "mute")), |
| 1539 | "volume" === r && !x.isIos && !x.isIPadOS) |
| 1540 | ) { |
| 1541 | const i = { max: 1, step: 0.05, value: this.config.volume }; |
| 1542 | t.appendChild(n.call(this, "volume", N(i, { id: `plyr-volume-${e.id}` }))); |
| 1543 | } |
| 1544 | } |
| 1545 | if (("captions" === r && c.appendChild(i.call(this, "captions", u)), "settings" === r && !A.empty(this.config.settings))) { |
| 1546 | const s = O("div", N({}, u, { class: `${u.class} plyr__menu`.trim(), hidden: "" })); |
| 1547 | s.appendChild(i.call(this, "settings", { "aria-haspopup": !0, "aria-controls": `plyr-settings-${e.id}`, "aria-expanded": !1 })); |
| 1548 | const n = O("div", { class: "plyr__menu__container", id: `plyr-settings-${e.id}`, hidden: "" }), |
| 1549 | a = O("div"), |
| 1550 | r = O("div", { id: `plyr-settings-${e.id}-home` }), |
| 1551 | o = O("div", { role: "menu" }); |
| 1552 | r.appendChild(o), |
| 1553 | a.appendChild(r), |
| 1554 | (this.elements.settings.panels.home = r), |
| 1555 | this.config.settings.forEach((i) => { |
| 1556 | const s = O( |
| 1557 | "button", |
| 1558 | N(q(this.config.selectors.buttons.settings), { |
| 1559 | type: "button", |
| 1560 | class: `${this.config.classNames.control} ${this.config.classNames.control}--forward`, |
| 1561 | role: "menuitem", |
| 1562 | "aria-haspopup": !0, |
| 1563 | hidden: "", |
| 1564 | }) |
| 1565 | ); |
| 1566 | t.call(this, s, i), |
| 1567 | J.call(this, s, "click", () => { |
| 1568 | l.call(this, i, !1); |
| 1569 | }); |
| 1570 | const n = O("span", null, we.get(i, this.config)), |
| 1571 | r = O("span", { class: this.config.classNames.menu.value }); |
| 1572 | (r.innerHTML = e[i]), n.appendChild(r), s.appendChild(n), o.appendChild(s); |
| 1573 | const c = O("div", { id: `plyr-settings-${e.id}-${i}`, hidden: "" }), |
| 1574 | u = O("button", { type: "button", class: `${this.config.classNames.control} ${this.config.classNames.control}--back` }); |
| 1575 | u.appendChild(O("span", { "aria-hidden": !0 }, we.get(i, this.config))), |
| 1576 | u.appendChild(O("span", { class: this.config.classNames.hidden }, we.get("menuBack", this.config))), |
| 1577 | J.call( |
| 1578 | this, |
| 1579 | c, |
| 1580 | "keydown", |
| 1581 | (e) => { |
| 1582 | "ArrowLeft" === e.key && (e.preventDefault(), e.stopPropagation(), l.call(this, "home", !0)); |
| 1583 | }, |
| 1584 | !1 |
| 1585 | ), |
| 1586 | J.call(this, u, "click", () => { |
| 1587 | l.call(this, "home", !1); |
| 1588 | }), |
| 1589 | c.appendChild(u), |
| 1590 | c.appendChild(O("div", { role: "menu" })), |
| 1591 | a.appendChild(c), |
| 1592 | (this.elements.settings.buttons[i] = s), |
| 1593 | (this.elements.settings.panels[i] = c); |
| 1594 | }), |
| 1595 | n.appendChild(a), |
| 1596 | s.appendChild(n), |
| 1597 | c.appendChild(s), |
| 1598 | (this.elements.settings.popup = n), |
| 1599 | (this.elements.settings.menu = s); |
| 1600 | } |
| 1601 | if (("pip" === r && Y.pip && c.appendChild(i.call(this, "pip", u)), "airplay" === r && Y.airplay && c.appendChild(i.call(this, "airplay", u)), "download" === r)) { |
| 1602 | const e = N({}, u, { element: "a", href: this.download, target: "_blank" }); |
| 1603 | this.isHTML5 && (e.download = ""); |
| 1604 | const { download: t } = this.config.urls; |
| 1605 | !A.url(t) && this.isEmbed && N(e, { icon: `logo-${this.provider}`, label: this.provider }), c.appendChild(i.call(this, "download", e)); |
| 1606 | } |
| 1607 | "fullscreen" === r && c.appendChild(i.call(this, "fullscreen", u)); |
| 1608 | }), |
| 1609 | this.isHTML5 && r.call(this, me.getQualityOptions.call(this)), |
| 1610 | o.call(this), |
| 1611 | c |
| 1612 | ); |
| 1613 | }, |
| 1614 | inject() { |
| 1615 | if (this.config.loadSprite) { |
| 1616 | const e = Me.getIconUrl.call(this); |
| 1617 | e.cors && Ee(e.url, "sprite-plyr"); |
| 1618 | } |
| 1619 | this.id = Math.floor(1e4 * Math.random()); |
| 1620 | let e = null; |
| 1621 | this.elements.controls = null; |
| 1622 | const t = { id: this.id, seektime: this.config.seekTime, title: this.config.title }; |
| 1623 | let i = !0; |
| 1624 | A.function(this.config.controls) && (this.config.controls = this.config.controls.call(this, t)), |
| 1625 | this.config.controls || (this.config.controls = []), |
| 1626 | A.element(this.config.controls) || A.string(this.config.controls) |
| 1627 | ? (e = this.config.controls) |
| 1628 | : ((e = Me.create.call(this, { id: this.id, seektime: this.config.seekTime, speed: this.speed, quality: this.quality, captions: Ne.getLabel.call(this) })), (i = !1)); |
| 1629 | let s; |
| 1630 | i && |
| 1631 | A.string(this.config.controls) && |
| 1632 | (e = ((e) => { |
| 1633 | let i = e; |
| 1634 | return ( |
| 1635 | Object.entries(t).forEach(([e, t]) => { |
| 1636 | i = ge(i, `{${e}}`, t); |
| 1637 | }), |
| 1638 | i |
| 1639 | ); |
| 1640 | })(e)), |
| 1641 | A.string(this.config.selectors.controls.container) && (s = document.querySelector(this.config.selectors.controls.container)), |
| 1642 | A.element(s) || (s = this.elements.container); |
| 1643 | if ((s[A.element(e) ? "insertAdjacentElement" : "insertAdjacentHTML"]("afterbegin", e), A.element(this.elements.controls) || Me.findElements.call(this), !A.empty(this.elements.buttons))) { |
| 1644 | const e = (e) => { |
| 1645 | const t = this.config.classNames.controlPressed; |
| 1646 | e.setAttribute("aria-pressed", "false"), |
| 1647 | Object.defineProperty(e, "pressed", { |
| 1648 | configurable: !0, |
| 1649 | enumerable: !0, |
| 1650 | get: () => U(e, t), |
| 1651 | set(i = !1) { |
| 1652 | F(e, t, i), e.setAttribute("aria-pressed", i ? "true" : "false"); |
| 1653 | }, |
| 1654 | }); |
| 1655 | }; |
| 1656 | Object.values(this.elements.buttons) |
| 1657 | .filter(Boolean) |
| 1658 | .forEach((t) => { |
| 1659 | A.array(t) || A.nodeList(t) ? Array.from(t).filter(Boolean).forEach(e) : e(t); |
| 1660 | }); |
| 1661 | } |
| 1662 | if ((x.isEdge && M(s), this.config.tooltips.controls)) { |
| 1663 | const { classNames: e, selectors: t } = this.config, |
| 1664 | i = `${t.controls.wrapper} ${t.labels} .${e.hidden}`, |
| 1665 | s = B.call(this, i); |
| 1666 | Array.from(s).forEach((e) => { |
| 1667 | F(e, this.config.classNames.hidden, !1), F(e, this.config.classNames.tooltip, !0); |
| 1668 | }); |
| 1669 | } |
| 1670 | }, |
| 1671 | setMediaMetadata() { |
| 1672 | try { |
| 1673 | "mediaSession" in navigator && |
| 1674 | (navigator.mediaSession.metadata = new window.MediaMetadata({ |
| 1675 | title: this.config.mediaMetadata.title, |
| 1676 | artist: this.config.mediaMetadata.artist, |
| 1677 | album: this.config.mediaMetadata.album, |
| 1678 | artwork: this.config.mediaMetadata.artwork, |
| 1679 | })); |
| 1680 | } catch (e) { } |
| 1681 | }, |
| 1682 | setMarkers() { |
| 1683 | var e, t; |
| 1684 | if (!this.duration || this.elements.markers) return; |
| 1685 | const i = null === (e = this.config.markers) || void 0 === e || null === (t = e.points) || void 0 === t ? void 0 : t.filter(({ time: e }) => e > 0 && e < this.duration); |
| 1686 | if (null == i || !i.length) return; |
| 1687 | const s = document.createDocumentFragment(), |
| 1688 | n = document.createDocumentFragment(); |
| 1689 | let a = null; |
| 1690 | const r = `${this.config.classNames.tooltip}--visible`, |
| 1691 | o = (e) => F(a, r, e); |
| 1692 | i.forEach((e) => { |
| 1693 | const t = O("span", { class: this.config.classNames.marker }, ""), |
| 1694 | i = (e.time / this.duration) * 100 + "%"; |
| 1695 | a && |
| 1696 | (t.addEventListener("mouseenter", () => { |
| 1697 | e.label || ((a.style.left = i), (a.innerHTML = e.label), o(!0)); |
| 1698 | }), |
| 1699 | t.addEventListener("mouseleave", () => { |
| 1700 | o(!1); |
| 1701 | })), |
| 1702 | t.addEventListener("click", () => { |
| 1703 | this.currentTime = e.time; |
| 1704 | }), |
| 1705 | (t.style.left = i), |
| 1706 | n.appendChild(t); |
| 1707 | }), |
| 1708 | s.appendChild(n), |
| 1709 | this.config.tooltips.seek || ((a = O("span", { class: this.config.classNames.tooltip }, "")), s.appendChild(a)), |
| 1710 | (this.elements.markers = { points: n, tip: a }), |
| 1711 | this.elements.progress.appendChild(s); |
| 1712 | }, |
| 1713 | }; |
| 1714 | function xe(e, t = !0) { |
| 1715 | let i = e; |
| 1716 | if (t) { |
| 1717 | const e = document.createElement("a"); |
| 1718 | (e.href = i), (i = e.href); |
| 1719 | } |
| 1720 | try { |
| 1721 | return new URL(i); |
| 1722 | } catch (e) { |
| 1723 | return null; |
| 1724 | } |
| 1725 | } |
| 1726 | function Le(e) { |
| 1727 | const t = new URLSearchParams(); |
| 1728 | return ( |
| 1729 | A.object(e) && |
| 1730 | Object.entries(e).forEach(([e, i]) => { |
| 1731 | t.set(e, i); |
| 1732 | }), |
| 1733 | t |
| 1734 | ); |
| 1735 | } |
| 1736 | const Ne = { |
| 1737 | setup() { |
| 1738 | if (!this.supported.ui) return; |
| 1739 | if (!this.isVideo || this.isYouTube || (this.isHTML5 && !Y.textTracks)) |
| 1740 | return void (A.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && Me.setCaptionsMenu.call(this)); |
| 1741 | var e, t; |
| 1742 | if ( |
| 1743 | (A.element(this.elements.captions) || |
| 1744 | ((this.elements.captions = O("div", q(this.config.selectors.captions))), |
| 1745 | this.elements.captions.setAttribute("dir", "auto"), |
| 1746 | (e = this.elements.captions), |
| 1747 | (t = this.elements.wrapper), |
| 1748 | A.element(e) && A.element(t) && t.parentNode.insertBefore(e, t.nextSibling)), |
| 1749 | x.isIE && window.URL) |
| 1750 | ) { |
| 1751 | const e = this.media.querySelectorAll("track"); |
| 1752 | Array.from(e).forEach((e) => { |
| 1753 | const t = e.getAttribute("src"), |
| 1754 | i = xe(t); |
| 1755 | null !== i && |
| 1756 | i.hostname !== window.location.href.hostname && |
| 1757 | ["http:", "https:"].includes(i.protocol) && |
| 1758 | ke(t, "blob") |
| 1759 | .then((t) => { |
| 1760 | e.setAttribute("src", window.URL.createObjectURL(t)); |
| 1761 | }) |
| 1762 | .catch(() => { |
| 1763 | j(e); |
| 1764 | }); |
| 1765 | }); |
| 1766 | } |
| 1767 | const i = ne((navigator.languages || [navigator.language || navigator.userLanguage || "en"]).map((e) => e.split("-")[0])); |
| 1768 | let s = (this.storage.get("language") || this.config.captions.language || "auto").toLowerCase(); |
| 1769 | "auto" === s && ([s] = i); |
| 1770 | let n = this.storage.get("captions"); |
| 1771 | if ((A.boolean(n) || ({ active: n } = this.config.captions), Object.assign(this.captions, { toggled: !1, active: n, language: s, languages: i }), this.isHTML5)) { |
| 1772 | const e = this.config.captions.update ? "addtrack removetrack" : "removetrack"; |
| 1773 | J.call(this, this.media.textTracks, e, Ne.update.bind(this)); |
| 1774 | } |
| 1775 | setTimeout(Ne.update.bind(this), 0); |
| 1776 | }, |
| 1777 | update() { |
| 1778 | const e = Ne.getTracks.call(this, !0), |
| 1779 | { active: t, language: i, meta: s, currentTrackNode: n } = this.captions, |
| 1780 | a = Boolean(e.find((e) => e.language === i)); |
| 1781 | this.isHTML5 && |
| 1782 | this.isVideo && |
| 1783 | e |
| 1784 | .filter((e) => !s.get(e)) |
| 1785 | .forEach((e) => { |
| 1786 | this.debug.log("Track added", e), s.set(e, { default: "showing" === e.mode }), "showing" === e.mode && (e.mode = "hidden"), J.call(this, e, "cuechange", () => Ne.updateCues.call(this)); |
| 1787 | }), |
| 1788 | ((a && this.language !== i) || !e.includes(n)) && (Ne.setLanguage.call(this, i), Ne.toggle.call(this, t && a)), |
| 1789 | this.elements && F(this.elements.container, this.config.classNames.captions.enabled, !A.empty(e)), |
| 1790 | A.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && Me.setCaptionsMenu.call(this); |
| 1791 | }, |
| 1792 | toggle(e, t = !0) { |
| 1793 | if (!this.supported.ui) return; |
| 1794 | const { toggled: i } = this.captions, |
| 1795 | s = this.config.classNames.captions.active, |
| 1796 | n = A.nullOrUndefined(e) ? !i : e; |
| 1797 | if (n !== i) { |
| 1798 | if ((t || ((this.captions.active = n), this.storage.set({ captions: n })), !this.language && n && !t)) { |
| 1799 | const e = Ne.getTracks.call(this), |
| 1800 | t = Ne.findTrack.call(this, [this.captions.language, ...this.captions.languages], !0); |
| 1801 | return (this.captions.language = t.language), void Ne.set.call(this, e.indexOf(t)); |
| 1802 | } |
| 1803 | this.elements.buttons.captions && (this.elements.buttons.captions.pressed = n), |
| 1804 | F(this.elements.container, s, n), |
| 1805 | (this.captions.toggled = n), |
| 1806 | Me.updateSetting.call(this, "captions"), |
| 1807 | ee.call(this, this.media, n ? "captionsenabled" : "captionsdisabled"); |
| 1808 | } |
| 1809 | setTimeout(() => { |
| 1810 | n && this.captions.toggled && (this.captions.currentTrackNode.mode = "hidden"); |
| 1811 | }); |
| 1812 | }, |
| 1813 | set(e, t = !0) { |
| 1814 | const i = Ne.getTracks.call(this); |
| 1815 | if (-1 !== e) |
| 1816 | if (A.number(e)) |
| 1817 | if (e in i) { |
| 1818 | if (this.captions.currentTrack !== e) { |
| 1819 | this.captions.currentTrack = e; |
| 1820 | const s = i[e], |
| 1821 | { language: n } = s || {}; |
| 1822 | (this.captions.currentTrackNode = s), |
| 1823 | Me.updateSetting.call(this, "captions"), |
| 1824 | t || ((this.captions.language = n), this.storage.set({ language: n })), |
| 1825 | this.isVimeo && this.embed.enableTextTrack(n), |
| 1826 | ee.call(this, this.media, "languagechange"); |
| 1827 | } |
| 1828 | Ne.toggle.call(this, !0, t), this.isHTML5 && this.isVideo && Ne.updateCues.call(this); |
| 1829 | } else this.debug.warn("Track not found", e); |
| 1830 | else this.debug.warn("Invalid caption argument", e); |
| 1831 | else Ne.toggle.call(this, !1, t); |
| 1832 | }, |
| 1833 | setLanguage(e, t = !0) { |
| 1834 | if (!A.string(e)) return void this.debug.warn("Invalid language argument", e); |
| 1835 | const i = e.toLowerCase(); |
| 1836 | this.captions.language = i; |
| 1837 | const s = Ne.getTracks.call(this), |
| 1838 | n = Ne.findTrack.call(this, [i]); |
| 1839 | Ne.set.call(this, s.indexOf(n), t); |
| 1840 | }, |
| 1841 | getTracks(e = !1) { |
| 1842 | return Array.from((this.media || {}).textTracks || []) |
| 1843 | .filter((t) => !this.isHTML5 || e || this.captions.meta.has(t)) |
| 1844 | .filter((e) => ["captions", "subtitles"].includes(e.kind)); |
| 1845 | }, |
| 1846 | findTrack(e, t = !1) { |
| 1847 | const i = Ne.getTracks.call(this), |
| 1848 | s = (e) => Number((this.captions.meta.get(e) || {}).default), |
| 1849 | n = Array.from(i).sort((e, t) => s(t) - s(e)); |
| 1850 | let a; |
| 1851 | return e.every((e) => ((a = n.find((t) => t.language === e)), !a)), a || (t ? n[0] : void 0); |
| 1852 | }, |
| 1853 | getCurrentTrack() { |
| 1854 | return Ne.getTracks.call(this)[this.currentTrack]; |
| 1855 | }, |
| 1856 | getLabel(e) { |
| 1857 | let t = e; |
| 1858 | return ( |
| 1859 | !A.track(t) && Y.textTracks && this.captions.toggled && (t = Ne.getCurrentTrack.call(this)), |
| 1860 | A.track(t) ? (A.empty(t.label) ? (A.empty(t.language) ? we.get("enabled", this.config) : e.language.toUpperCase()) : t.label) : we.get("disabled", this.config) |
| 1861 | ); |
| 1862 | }, |
| 1863 | updateCues(e) { |
| 1864 | if (!this.supported.ui) return; |
| 1865 | if (!A.element(this.elements.captions)) return void this.debug.warn("No captions element to render to"); |
| 1866 | if (!A.nullOrUndefined(e) && !Array.isArray(e)) return void this.debug.warn("updateCues: Invalid input", e); |
| 1867 | let t = e; |
| 1868 | if (!t) { |
| 1869 | const e = Ne.getCurrentTrack.call(this); |
| 1870 | t = Array.from((e || {}).activeCues || []) |
| 1871 | .map((e) => e.getCueAsHTML()) |
| 1872 | .map(be); |
| 1873 | } |
| 1874 | const i = t.map((e) => e.trim()).join("\n"); |
| 1875 | if (i !== this.elements.captions.innerHTML) { |
| 1876 | R(this.elements.captions); |
| 1877 | const e = O("span", q(this.config.selectors.caption)); |
| 1878 | (e.innerHTML = i), this.elements.captions.appendChild(e), ee.call(this, this.media, "cuechange"); |
| 1879 | } |
| 1880 | }, |
| 1881 | }, |
| 1882 | _e = { |
| 1883 | enabled: !0, |
| 1884 | title: "", |
| 1885 | debug: !1, |
| 1886 | autoplay: !1, |
| 1887 | autopause: !0, |
| 1888 | playsinline: !0, |
| 1889 | seekTime: 10, |
| 1890 | volume: 1, |
| 1891 | muted: !1, |
| 1892 | duration: null, |
| 1893 | displayDuration: !0, |
| 1894 | invertTime: !0, |
| 1895 | toggleInvert: !0, |
| 1896 | ratio: null, |
| 1897 | clickToPlay: !0, |
| 1898 | hideControls: !0, |
| 1899 | resetOnEnd: !1, |
| 1900 | disableContextMenu: !0, |
| 1901 | loadSprite: !0, |
| 1902 | iconPrefix: "plyr", |
| 1903 | iconUrl: "https://cdn.plyr.io/3.7.8/plyr.svg", |
| 1904 | blankVideo: "https://cdn.plyr.io/static/blank.mp4", |
| 1905 | quality: { default: 576, options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240], forced: !1, onChange: null }, |
| 1906 | loop: { active: !1 }, |
| 1907 | speed: { selected: 1, options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4] }, |
| 1908 | keyboard: { focused: !0, global: !1 }, |
| 1909 | tooltips: { controls: !1, seek: !0 }, |
| 1910 | captions: { active: !1, language: "auto", update: !1 }, |
| 1911 | fullscreen: { enabled: !0, fallback: !0, iosNative: !1 }, |
| 1912 | storage: { enabled: !0, key: "plyr" }, |
| 1913 | controls: ["play-large", "play", "progress", "current-time", "mute", "volume", "captions", "settings", "pip", "airplay", "fullscreen"], |
| 1914 | settings: ["captions", "quality", "speed"], |
| 1915 | i18n: { |
| 1916 | restart: "Restart", |
| 1917 | rewind: "Rewind {seektime}s", |
| 1918 | play: "Play", |
| 1919 | pause: "Pause", |
| 1920 | fastForward: "Forward {seektime}s", |
| 1921 | seek: "Seek", |
| 1922 | seekLabel: "{currentTime} of {duration}", |
| 1923 | played: "Played", |
| 1924 | buffered: "Buffered", |
| 1925 | currentTime: "Current time", |
| 1926 | duration: "Duration", |
| 1927 | volume: "Volume", |
| 1928 | mute: "Mute", |
| 1929 | unmute: "Unmute", |
| 1930 | enableCaptions: "Enable captions", |
| 1931 | disableCaptions: "Disable captions", |
| 1932 | download: "Download", |
| 1933 | enterFullscreen: "Fullscreen", |
| 1934 | exitFullscreen: "Exit fullscreen", |
| 1935 | frameTitle: "Player for {title}", |
| 1936 | captions: "Captions", |
| 1937 | settings: "Settings", |
| 1938 | pip: "Pop-up", |
| 1939 | menuBack: "Go back to previous menu", |
| 1940 | speed: "Speed", |
| 1941 | normal: "Normal", |
| 1942 | quality: "Quality", |
| 1943 | loop: "Loop", |
| 1944 | start: "Start", |
| 1945 | end: "End", |
| 1946 | all: "All", |
| 1947 | reset: "Reset", |
| 1948 | disabled: "Disabled", |
| 1949 | enabled: "Enabled", |
| 1950 | advertisement: "Ad", |
| 1951 | qualityBadge: { 2160: "4K", 1440: "HD", 1080: "HD", 720: "HD", 576: "SD", 480: "SD" }, |
| 1952 | }, |
| 1953 | urls: { |
| 1954 | download: null, |
| 1955 | vimeo: { sdk: "https://player.vimeo.com/api/player.js", iframe: "https://player.vimeo.com/video/{0}?{1}", api: "https://vimeo.com/api/oembed.json?url={0}" }, |
| 1956 | youtube: { sdk: "https://www.youtube.com/iframe_api", api: "https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}" }, |
| 1957 | googleIMA: { sdk: "https://imasdk.googleapis.com/js/sdkloader/ima3.js" }, |
| 1958 | }, |
| 1959 | listeners: { |
| 1960 | seek: null, |
| 1961 | play: null, |
| 1962 | pause: null, |
| 1963 | restart: null, |
| 1964 | rewind: null, |
| 1965 | fastForward: null, |
| 1966 | mute: null, |
| 1967 | volume: null, |
| 1968 | captions: null, |
| 1969 | download: null, |
| 1970 | fullscreen: null, |
| 1971 | pip: null, |
| 1972 | airplay: null, |
| 1973 | speed: null, |
| 1974 | quality: null, |
| 1975 | loop: null, |
| 1976 | language: null, |
| 1977 | }, |
| 1978 | events: [ |
| 1979 | "ended", |
| 1980 | "progress", |
| 1981 | "stalled", |
| 1982 | "playing", |
| 1983 | "waiting", |
| 1984 | "canplay", |
| 1985 | "canplaythrough", |
| 1986 | "loadstart", |
| 1987 | "loadeddata", |
| 1988 | "loadedmetadata", |
| 1989 | "timeupdate", |
| 1990 | "volumechange", |
| 1991 | "play", |
| 1992 | "pause", |
| 1993 | "error", |
| 1994 | "seeking", |
| 1995 | "seeked", |
| 1996 | "emptied", |
| 1997 | "ratechange", |
| 1998 | "cuechange", |
| 1999 | "download", |
| 2000 | "enterfullscreen", |
| 2001 | "exitfullscreen", |
| 2002 | "captionsenabled", |
| 2003 | "captionsdisabled", |
| 2004 | "languagechange", |
| 2005 | "controlshidden", |
| 2006 | "controlsshown", |
| 2007 | "ready", |
| 2008 | "statechange", |
| 2009 | "qualitychange", |
| 2010 | "adsloaded", |
| 2011 | "adscontentpause", |
| 2012 | "adscontentresume", |
| 2013 | "adstarted", |
| 2014 | "adsmidpoint", |
| 2015 | "adscomplete", |
| 2016 | "adsallcomplete", |
| 2017 | "adsimpression", |
| 2018 | "adsclick", |
| 2019 | ], |
| 2020 | selectors: { |
| 2021 | editable: "input, textarea, select, [contenteditable]", |
| 2022 | container: ".plyr", |
| 2023 | controls: { container: null, wrapper: ".plyr__controls" }, |
| 2024 | labels: "[data-plyr]", |
| 2025 | buttons: { |
| 2026 | play: '[data-plyr="play"]', |
| 2027 | pause: '[data-plyr="pause"]', |
| 2028 | restart: '[data-plyr="restart"]', |
| 2029 | rewind: '[data-plyr="rewind"]', |
| 2030 | fastForward: '[data-plyr="fast-forward"]', |
| 2031 | mute: '[data-plyr="mute"]', |
| 2032 | captions: '[data-plyr="captions"]', |
| 2033 | download: '[data-plyr="download"]', |
| 2034 | fullscreen: '[data-plyr="fullscreen"]', |
| 2035 | pip: '[data-plyr="pip"]', |
| 2036 | airplay: '[data-plyr="airplay"]', |
| 2037 | settings: '[data-plyr="settings"]', |
| 2038 | loop: '[data-plyr="loop"]', |
| 2039 | }, |
| 2040 | inputs: { seek: '[data-plyr="seek"]', volume: '[data-plyr="volume"]', speed: '[data-plyr="speed"]', language: '[data-plyr="language"]', quality: '[data-plyr="quality"]' }, |
| 2041 | display: { currentTime: ".plyr__time--current", duration: ".plyr__time--duration", buffer: ".plyr__progress__buffer", loop: ".plyr__progress__loop", volume: ".plyr__volume--display" }, |
| 2042 | progress: ".plyr__progress", |
| 2043 | captions: ".plyr__captions", |
| 2044 | caption: ".plyr__caption", |
| 2045 | }, |
| 2046 | classNames: { |
| 2047 | type: "plyr--{0}", |
| 2048 | provider: "plyr--{0}", |
| 2049 | video: "plyr__video-wrapper", |
| 2050 | embed: "plyr__video-embed", |
| 2051 | videoFixedRatio: "plyr__video-wrapper--fixed-ratio", |
| 2052 | embedContainer: "plyr__video-embed__container", |
| 2053 | poster: "plyr__poster", |
| 2054 | posterEnabled: "plyr__poster-enabled", |
| 2055 | ads: "plyr__ads", |
| 2056 | control: "plyr__control", |
| 2057 | controlPressed: "plyr__control--pressed", |
| 2058 | playing: "plyr--playing", |
| 2059 | paused: "plyr--paused", |
| 2060 | stopped: "plyr--stopped", |
| 2061 | loading: "plyr--loading", |
| 2062 | hover: "plyr--hover", |
| 2063 | tooltip: "plyr__tooltip", |
| 2064 | cues: "plyr__cues", |
| 2065 | marker: "plyr__progress__marker", |
| 2066 | hidden: "plyr__sr-only", |
| 2067 | hideControls: "plyr--hide-controls", |
| 2068 | isTouch: "plyr--is-touch", |
| 2069 | uiSupported: "plyr--full-ui", |
| 2070 | noTransition: "plyr--no-transition", |
| 2071 | display: { time: "plyr__time" }, |
| 2072 | menu: { value: "plyr__menu__value", badge: "plyr__badge", open: "plyr--menu-open" }, |
| 2073 | captions: { enabled: "plyr--captions-enabled", active: "plyr--captions-active" }, |
| 2074 | fullscreen: { enabled: "plyr--fullscreen-enabled", fallback: "plyr--fullscreen-fallback" }, |
| 2075 | pip: { supported: "plyr--pip-supported", active: "plyr--pip-active" }, |
| 2076 | airplay: { supported: "plyr--airplay-supported", active: "plyr--airplay-active" }, |
| 2077 | posterThumbnails: { |
| 2078 | thumbContainer: "plyr__preview-thumb", |
| 2079 | thumbContainerShown: "plyr__preview-thumb--is-shown", |
| 2080 | imageContainer: "plyr__preview-thumb__image-container", |
| 2081 | timeContainer: "plyr__preview-thumb__time-container", |
| 2082 | scrubbingContainer: "plyr__preview-scrubbing", |
| 2083 | scrubbingContainerShown: "plyr__preview-scrubbing--is-shown", |
| 2084 | }, |
| 2085 | }, |
| 2086 | attributes: { embed: { provider: "data-plyr-provider", id: "data-plyr-embed-id", hash: "data-plyr-embed-hash" } }, |
| 2087 | ads: { enabled: !1, publisherId: "", tagUrl: "" }, |
| 2088 | posterThumbnails: { enabled: !1, src: "" }, |
| 2089 | vimeo: { byline: !1, portrait: !1, title: !1, speed: !0, transparent: !1, customControls: !0, referrerPolicy: null, premium: !1 }, |
| 2090 | youtube: { rel: 0, showinfo: 0, iv_load_policy: 3, modestbranding: 1, customControls: !0, noCookie: !1 }, |
| 2091 | mediaMetadata: { title: "", artist: "", album: "", artwork: [] }, |
| 2092 | markers: { enabled: !1, points: [] }, |
| 2093 | }, |
| 2094 | Ie = "picture-in-picture", |
| 2095 | Oe = "inline", |
| 2096 | $e = { html5: "html5", youtube: "youtube", vimeo: "vimeo" }, |
| 2097 | je = "audio", |
| 2098 | Re = "video"; |
| 2099 | const De = () => { }; |
| 2100 | class qe { |
| 2101 | constructor(e = !1) { |
| 2102 | (this.enabled = window.console && e), this.enabled && this.log("Debugging enabled"); |
| 2103 | } |
| 2104 | get log() { |
| 2105 | return this.enabled ? Function.prototype.bind.call(console.log, console) : De; |
| 2106 | } |
| 2107 | get warn() { |
| 2108 | return this.enabled ? Function.prototype.bind.call(console.warn, console) : De; |
| 2109 | } |
| 2110 | get error() { |
| 2111 | return this.enabled ? Function.prototype.bind.call(console.error, console) : De; |
| 2112 | } |
| 2113 | } |
| 2114 | class He { |
| 2115 | constructor(e) { |
| 2116 | t(this, "onChange", () => { |
| 2117 | if (!this.supported) return; |
| 2118 | const e = this.player.elements.buttons.fullscreen; |
| 2119 | A.element(e) && (e.pressed = this.active); |
| 2120 | const t = this.target === this.player.media ? this.target : this.player.elements.container; |
| 2121 | ee.call(this.player, t, this.active ? "enterfullscreen" : "exitfullscreen", !0); |
| 2122 | }), |
| 2123 | t(this, "toggleFallback", (e = !1) => { |
| 2124 | if ( |
| 2125 | (e ? (this.scrollPosition = { x: window.scrollX ?? 0, y: window.scrollY ?? 0 }) : window.scrollTo(this.scrollPosition.x, this.scrollPosition.y), |
| 2126 | (document.body.style.overflow = e ? "hidden" : ""), |
| 2127 | F(this.target, this.player.config.classNames.fullscreen.fallback, e), |
| 2128 | x.isIos) |
| 2129 | ) { |
| 2130 | let t = document.head.querySelector('meta[name="viewport"]'); |
| 2131 | const i = "viewport-fit=cover"; |
| 2132 | t || ((t = document.createElement("meta")), t.setAttribute("name", "viewport")); |
| 2133 | const s = A.string(t.content) && t.content.includes(i); |
| 2134 | e |
| 2135 | ? ((this.cleanupViewport = !s), s || (t.content += `,${i}`)) |
| 2136 | : this.cleanupViewport && |
| 2137 | (t.content = t.content |
| 2138 | .split(",") |
| 2139 | .filter((e) => e.trim() !== i) |
| 2140 | .join(",")); |
| 2141 | } |
| 2142 | this.onChange(); |
| 2143 | }), |
| 2144 | t(this, "trapFocus", (e) => { |
| 2145 | if (x.isIos || x.isIPadOS || !this.active || "Tab" !== e.key) return; |
| 2146 | const t = document.activeElement, |
| 2147 | i = B.call(this.player, "a[href], button:not(:disabled), input:not(:disabled), [tabindex]"), |
| 2148 | [s] = i, |
| 2149 | n = i[i.length - 1]; |
| 2150 | t !== n || e.shiftKey ? t === s && e.shiftKey && (n.focus(), e.preventDefault()) : (s.focus(), e.preventDefault()); |
| 2151 | }), |
| 2152 | t(this, "update", () => { |
| 2153 | if (this.supported) { |
| 2154 | let e; |
| 2155 | (e = this.forceFallback ? "Fallback (forced)" : He.nativeSupported ? "Native" : "Fallback"), this.player.debug.log(`${e} fullscreen enabled`); |
| 2156 | } else this.player.debug.log("Fullscreen not supported and fallback disabled"); |
| 2157 | F(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.supported); |
| 2158 | }), |
| 2159 | t(this, "enter", () => { |
| 2160 | this.supported && |
| 2161 | (x.isIos && this.player.config.fullscreen.iosNative |
| 2162 | ? this.player.isVimeo |
| 2163 | ? this.player.embed.requestFullscreen() |
| 2164 | : this.target.webkitEnterFullscreen() |
| 2165 | : !He.nativeSupported || this.forceFallback |
| 2166 | ? this.toggleFallback(!0) |
| 2167 | : this.prefix |
| 2168 | ? A.empty(this.prefix) || this.target[`${this.prefix}Request${this.property}`]() |
| 2169 | : this.target.requestFullscreen({ navigationUI: "hide" })); |
| 2170 | }), |
| 2171 | t(this, "exit", () => { |
| 2172 | if (this.supported) |
| 2173 | if (x.isIos && this.player.config.fullscreen.iosNative) this.player.isVimeo ? this.player.embed.exitFullscreen() : this.target.webkitEnterFullscreen(), se(this.player.play()); |
| 2174 | else if (!He.nativeSupported || this.forceFallback) this.toggleFallback(!1); |
| 2175 | else if (this.prefix) { |
| 2176 | if (!A.empty(this.prefix)) { |
| 2177 | const e = "moz" === this.prefix ? "Cancel" : "Exit"; |
| 2178 | document[`${this.prefix}${e}${this.property}`](); |
| 2179 | } |
| 2180 | } else (document.cancelFullScreen || document.exitFullscreen).call(document); |
| 2181 | }), |
| 2182 | t(this, "toggle", () => { |
| 2183 | this.active ? this.exit() : this.enter(); |
| 2184 | }), |
| 2185 | (this.player = e), |
| 2186 | (this.prefix = He.prefix), |
| 2187 | (this.property = He.property), |
| 2188 | (this.scrollPosition = { x: 0, y: 0 }), |
| 2189 | (this.forceFallback = "force" === e.config.fullscreen.fallback), |
| 2190 | (this.player.elements.fullscreen = |
| 2191 | e.config.fullscreen.container && |
| 2192 | (function (e, t) { |
| 2193 | const { prototype: i } = Element; |
| 2194 | return ( |
| 2195 | i.closest || |
| 2196 | function () { |
| 2197 | let e = this; |
| 2198 | do { |
| 2199 | if (V.matches(e, t)) return e; |
| 2200 | e = e.parentElement || e.parentNode; |
| 2201 | } while (null !== e && 1 === e.nodeType); |
| 2202 | return null; |
| 2203 | } |
| 2204 | ).call(e, t); |
| 2205 | })(this.player.elements.container, e.config.fullscreen.container)), |
| 2206 | J.call(this.player, document, "ms" === this.prefix ? "MSFullscreenChange" : `${this.prefix}fullscreenchange`, () => { |
| 2207 | this.onChange(); |
| 2208 | }), |
| 2209 | J.call(this.player, this.player.elements.container, "dblclick", (e) => { |
| 2210 | (A.element(this.player.elements.controls) && this.player.elements.controls.contains(e.target)) || this.player.listeners.proxy(e, this.toggle, "fullscreen"); |
| 2211 | }), |
| 2212 | J.call(this, this.player.elements.container, "keydown", (e) => this.trapFocus(e)), |
| 2213 | this.update(); |
| 2214 | } |
| 2215 | static get nativeSupported() { |
| 2216 | return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled); |
| 2217 | } |
| 2218 | get useNative() { |
| 2219 | return He.nativeSupported && !this.forceFallback; |
| 2220 | } |
| 2221 | static get prefix() { |
| 2222 | if (A.function(document.exitFullscreen)) return ""; |
| 2223 | let e = ""; |
| 2224 | return ["webkit", "moz", "ms"].some((t) => !(!A.function(document[`${t}ExitFullscreen`]) && !A.function(document[`${t}CancelFullScreen`])) && ((e = t), !0)), e; |
| 2225 | } |
| 2226 | static get property() { |
| 2227 | return "moz" === this.prefix ? "FullScreen" : "Fullscreen"; |
| 2228 | } |
| 2229 | get supported() { |
| 2230 | return [ |
| 2231 | this.player.config.fullscreen.enabled, |
| 2232 | this.player.isVideo, |
| 2233 | He.nativeSupported || this.player.config.fullscreen.fallback, |
| 2234 | !this.player.isYouTube || He.nativeSupported || !x.isIos || (this.player.config.playsinline && !this.player.config.fullscreen.iosNative), |
| 2235 | ].every(Boolean); |
| 2236 | } |
| 2237 | get active() { |
| 2238 | if (!this.supported) return !1; |
| 2239 | if (!He.nativeSupported || this.forceFallback) return U(this.target, this.player.config.classNames.fullscreen.fallback); |
| 2240 | const e = this.prefix ? this.target.getRootNode()[`${this.prefix}${this.property}Element`] : this.target.getRootNode().fullscreenElement; |
| 2241 | return e && e.shadowRoot ? e === this.target.getRootNode().host : e === this.target; |
| 2242 | } |
| 2243 | get target() { |
| 2244 | return x.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen ?? this.player.elements.container; |
| 2245 | } |
| 2246 | } |
| 2247 | function Fe(e, t = 1) { |
| 2248 | return new Promise((i, s) => { |
| 2249 | const n = new Image(), |
| 2250 | a = () => { |
| 2251 | delete n.onload, delete n.onerror, (n.naturalWidth >= t ? i : s)(n); |
| 2252 | }; |
| 2253 | Object.assign(n, { onload: a, onerror: a, src: e }); |
| 2254 | }); |
| 2255 | } |
| 2256 | const Ue = { |
| 2257 | addStyleHook() { |
| 2258 | F(this.elements.container, this.config.selectors.container.replace(".", ""), !0), F(this.elements.container, this.config.classNames.uiSupported, this.supported.ui); |
| 2259 | }, |
| 2260 | toggleNativeControls(e = !1) { |
| 2261 | e && this.isHTML5 ? this.media.setAttribute("controls", "") : this.media.removeAttribute("controls"); |
| 2262 | }, |
| 2263 | build() { |
| 2264 | if ((this.listeners.media(), !this.supported.ui)) return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`), void Ue.toggleNativeControls.call(this, !0); |
| 2265 | A.element(this.elements.controls) || (Me.inject.call(this), this.listeners.controls()), |
| 2266 | Ue.toggleNativeControls.call(this), |
| 2267 | this.isHTML5 && Ne.setup.call(this), |
| 2268 | (this.volume = null), |
| 2269 | (this.muted = null), |
| 2270 | (this.loop = null), |
| 2271 | (this.quality = null), |
| 2272 | (this.speed = null), |
| 2273 | Me.updateVolume.call(this), |
| 2274 | Me.timeUpdate.call(this), |
| 2275 | Me.durationUpdate.call(this), |
| 2276 | Ue.checkPlaying.call(this), |
| 2277 | F(this.elements.container, this.config.classNames.pip.supported, Y.pip && this.isHTML5 && this.isVideo), |
| 2278 | F(this.elements.container, this.config.classNames.airplay.supported, Y.airplay && this.isHTML5), |
| 2279 | F(this.elements.container, this.config.classNames.isTouch, this.touch), |
| 2280 | (this.ready = !0), |
| 2281 | setTimeout(() => { |
| 2282 | ee.call(this, this.media, "ready"); |
| 2283 | }, 0), |
| 2284 | Ue.setTitle.call(this), |
| 2285 | this.poster && Ue.setPoster.call(this, this.poster, !1).catch(() => { }), |
| 2286 | this.config.duration && Me.durationUpdate.call(this), |
| 2287 | this.config.mediaMetadata && Me.setMediaMetadata.call(this); |
| 2288 | }, |
| 2289 | setTitle() { |
| 2290 | let e = we.get("play", this.config); |
| 2291 | if ( |
| 2292 | (A.string(this.config.title) && !A.empty(this.config.title) && (e += `, ${this.config.title}`), |
| 2293 | Array.from(this.elements.buttons.play || []).forEach((t) => { |
| 2294 | t.setAttribute("aria-label", e); |
| 2295 | }), |
| 2296 | this.isEmbed) |
| 2297 | ) { |
| 2298 | const e = W.call(this, "iframe"); |
| 2299 | if (!A.element(e)) return; |
| 2300 | const t = A.empty(this.config.title) ? "video" : this.config.title, |
| 2301 | i = we.get("frameTitle", this.config); |
| 2302 | e.setAttribute("title", i.replace("{title}", t)); |
| 2303 | } |
| 2304 | }, |
| 2305 | togglePoster(e) { |
| 2306 | F(this.elements.container, this.config.classNames.posterEnabled, e); |
| 2307 | }, |
| 2308 | setPoster(e, t = !0) { |
| 2309 | return t && this.poster |
| 2310 | ? Promise.reject(new Error("Poster already set")) |
| 2311 | : (this.media.setAttribute("data-poster", e), |
| 2312 | this.elements.poster.removeAttribute("hidden"), |
| 2313 | ie |
| 2314 | .call(this) |
| 2315 | .then(() => Fe(e)) |
| 2316 | .catch((t) => { |
| 2317 | throw (e === this.poster && Ue.togglePoster.call(this, !1), t); |
| 2318 | }) |
| 2319 | .then(() => { |
| 2320 | if (e !== this.poster) throw new Error("setPoster cancelled by later call to setPoster"); |
| 2321 | }) |
| 2322 | .then(() => (Object.assign(this.elements.poster.style, { backgroundImage: `url('${e}')`, backgroundSize: "" }), Ue.togglePoster.call(this, !0), e))); |
| 2323 | }, |
| 2324 | checkPlaying(e) { |
| 2325 | F(this.elements.container, this.config.classNames.playing, this.playing), |
| 2326 | F(this.elements.container, this.config.classNames.paused, this.paused), |
| 2327 | F(this.elements.container, this.config.classNames.stopped, this.stopped), |
| 2328 | Array.from(this.elements.buttons.play || []).forEach((e) => { |
| 2329 | Object.assign(e, { pressed: this.playing }), e.setAttribute("aria-label", we.get(this.playing ? "pause" : "play", this.config)); |
| 2330 | }), |
| 2331 | (A.event(e) && "timeupdate" === e.type) || Ue.toggleControls.call(this); |
| 2332 | }, |
| 2333 | checkLoading(e) { |
| 2334 | (this.loading = ["stalled", "waiting"].includes(e.type)), |
| 2335 | clearTimeout(this.timers.loading), |
| 2336 | (this.timers.loading = setTimeout( |
| 2337 | () => { |
| 2338 | F(this.elements.container, this.config.classNames.loading, this.loading), Ue.toggleControls.call(this); |
| 2339 | }, |
| 2340 | this.loading ? 250 : 0 |
| 2341 | )); |
| 2342 | }, |
| 2343 | toggleControls(e) { |
| 2344 | const { controls: t } = this.elements; |
| 2345 | if (t && this.config.hideControls) { |
| 2346 | const i = this.touch && this.lastSeekTime + 2e3 > Date.now(); |
| 2347 | this.toggleControls(Boolean(e || this.loading || this.paused || t.pressed || t.hover || i)); |
| 2348 | } |
| 2349 | }, |
| 2350 | migrateStyles() { |
| 2351 | Object.values({ ...this.media.style }) |
| 2352 | .filter((e) => !A.empty(e) && A.string(e) && e.startsWith("--plyr")) |
| 2353 | .forEach((e) => { |
| 2354 | this.elements.container.style.setProperty(e, this.media.style.getPropertyValue(e)), this.media.style.removeProperty(e); |
| 2355 | }), |
| 2356 | A.empty(this.media.style) && this.media.removeAttribute("style"); |
| 2357 | }, |
| 2358 | }; |
| 2359 | class Ve { |
| 2360 | constructor(e) { |
| 2361 | t(this, "firstTouch", () => { |
| 2362 | const { player: e } = this, |
| 2363 | { elements: t } = e; |
| 2364 | (e.touch = !0), F(t.container, e.config.classNames.isTouch, !0); |
| 2365 | }), |
| 2366 | t(this, "global", (e = !0) => { |
| 2367 | const { player: t } = this; |
| 2368 | t.config.keyboard.global && X.call(t, window, "keydown keyup", this.handleKey, e, !1), X.call(t, document.body, "click", this.toggleMenu, e), Z.call(t, document.body, "touchstart", this.firstTouch); |
| 2369 | }), |
| 2370 | t(this, "container", () => { |
| 2371 | const { player: e } = this, |
| 2372 | { config: t, elements: i, timers: s } = e; |
| 2373 | !t.keyboard.global && t.keyboard.focused && J.call(e, i.container, "keydown keyup", this.handleKey, !1), |
| 2374 | J.call(e, i.container, "mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen", (t) => { |
| 2375 | const { controls: n } = i; |
| 2376 | n && "enterfullscreen" === t.type && ((n.pressed = !1), (n.hover = !1)); |
| 2377 | let a = 0; |
| 2378 | ["touchstart", "touchmove", "mousemove"].includes(t.type) && (Ue.toggleControls.call(e, !0), (a = e.touch ? 3e3 : 2e3)), |
| 2379 | clearTimeout(s.controls), |
| 2380 | (s.controls = setTimeout(() => Ue.toggleControls.call(e, !1), a)); |
| 2381 | }); |
| 2382 | const n = () => { |
| 2383 | if (!e.isVimeo || e.config.vimeo.premium) return; |
| 2384 | const t = i.wrapper, |
| 2385 | { active: s } = e.fullscreen, |
| 2386 | [n, a] = ue.call(e), |
| 2387 | r = re(`aspect-ratio: ${n} / ${a}`); |
| 2388 | if (!s) return void (r ? ((t.style.width = null), (t.style.height = null)) : ((t.style.maxWidth = null), (t.style.margin = null))); |
| 2389 | const [o, l] = [Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0), Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)], |
| 2390 | c = o / l > n / a; |
| 2391 | r ? ((t.style.width = c ? "auto" : "100%"), (t.style.height = c ? "100%" : "auto")) : ((t.style.maxWidth = c ? (l / a) * n + "px" : null), (t.style.margin = c ? "0 auto" : null)); |
| 2392 | }, |
| 2393 | a = () => { |
| 2394 | clearTimeout(s.resized), (s.resized = setTimeout(n, 50)); |
| 2395 | }; |
| 2396 | J.call(e, i.container, "enterfullscreen exitfullscreen", (t) => { |
| 2397 | const { target: s } = e.fullscreen; |
| 2398 | if (s !== i.container) return; |
| 2399 | if (!e.isEmbed && A.empty(e.config.ratio)) return; |
| 2400 | n(); |
| 2401 | ("enterfullscreen" === t.type ? J : G).call(e, window, "resize", a); |
| 2402 | }); |
| 2403 | }), |
| 2404 | t(this, "media", () => { |
| 2405 | const { player: e } = this, |
| 2406 | { elements: t } = e; |
| 2407 | if ( |
| 2408 | (J.call(e, e.media, "timeupdate seeking seeked", (t) => Me.timeUpdate.call(e, t)), |
| 2409 | J.call(e, e.media, "durationchange loadeddata loadedmetadata", (t) => Me.durationUpdate.call(e, t)), |
| 2410 | J.call(e, e.media, "ended", () => { |
| 2411 | e.isHTML5 && e.isVideo && e.config.resetOnEnd && (e.restart(), e.pause()); |
| 2412 | }), |
| 2413 | J.call(e, e.media, "progress playing seeking seeked", (t) => Me.updateProgress.call(e, t)), |
| 2414 | J.call(e, e.media, "volumechange", (t) => Me.updateVolume.call(e, t)), |
| 2415 | J.call(e, e.media, "playing play pause ended emptied timeupdate", (t) => Ue.checkPlaying.call(e, t)), |
| 2416 | J.call(e, e.media, "waiting canplay seeked playing", (t) => Ue.checkLoading.call(e, t)), |
| 2417 | e.supported.ui && e.config.clickToPlay && !e.isAudio) |
| 2418 | ) { |
| 2419 | const i = W.call(e, `.${e.config.classNames.video}`); |
| 2420 | if (!A.element(i)) return; |
| 2421 | J.call(e, t.container, "click", (s) => { |
| 2422 | ([t.container, i].includes(s.target) || i.contains(s.target)) && |
| 2423 | ((e.touch && e.config.hideControls) || |
| 2424 | (e.ended |
| 2425 | ? (this.proxy(s, e.restart, "restart"), |
| 2426 | this.proxy( |
| 2427 | s, |
| 2428 | () => { |
| 2429 | se(e.play()); |
| 2430 | }, |
| 2431 | "play" |
| 2432 | )) |
| 2433 | : this.proxy( |
| 2434 | s, |
| 2435 | () => { |
| 2436 | se(e.togglePlay()); |
| 2437 | }, |
| 2438 | "play" |
| 2439 | ))); |
| 2440 | }); |
| 2441 | } |
| 2442 | e.supported.ui && |
| 2443 | e.config.disableContextMenu && |
| 2444 | J.call( |
| 2445 | e, |
| 2446 | t.wrapper, |
| 2447 | "contextmenu", |
| 2448 | (e) => { |
| 2449 | e.preventDefault(); |
| 2450 | }, |
| 2451 | !1 |
| 2452 | ), |
| 2453 | J.call(e, e.media, "volumechange", () => { |
| 2454 | e.storage.set({ volume: e.volume, muted: e.muted }); |
| 2455 | }), |
| 2456 | J.call(e, e.media, "ratechange", () => { |
| 2457 | Me.updateSetting.call(e, "speed"), e.storage.set({ speed: e.speed }); |
| 2458 | }), |
| 2459 | J.call(e, e.media, "qualitychange", (t) => { |
| 2460 | Me.updateSetting.call(e, "quality", null, t.detail.quality); |
| 2461 | }), |
| 2462 | J.call(e, e.media, "ready qualitychange", () => { |
| 2463 | Me.setDownloadUrl.call(e); |
| 2464 | }); |
| 2465 | const i = e.config.events.concat(["keyup", "keydown"]).join(" "); |
| 2466 | J.call(e, e.media, i, (i) => { |
| 2467 | let { detail: s = {} } = i; |
| 2468 | "error" === i.type && (s = e.media.error), ee.call(e, t.container, i.type, !0, s); |
| 2469 | }); |
| 2470 | }), |
| 2471 | t(this, "proxy", (e, t, i) => { |
| 2472 | const { player: s } = this, |
| 2473 | n = s.config.listeners[i]; |
| 2474 | let a = !0; |
| 2475 | A.function(n) && (a = n.call(s, e)), !1 !== a && A.function(t) && t.call(s, e); |
| 2476 | }), |
| 2477 | t(this, "bind", (e, t, i, s, n = !0) => { |
| 2478 | const { player: a } = this, |
| 2479 | r = a.config.listeners[s], |
| 2480 | o = A.function(r); |
| 2481 | J.call(a, e, t, (e) => this.proxy(e, i, s), n && !o); |
| 2482 | }), |
| 2483 | t(this, "controls", () => { |
| 2484 | const { player: e } = this, |
| 2485 | { elements: t } = e, |
| 2486 | i = x.isIE ? "change" : "input"; |
| 2487 | if ( |
| 2488 | (t.buttons.play && |
| 2489 | Array.from(t.buttons.play).forEach((t) => { |
| 2490 | this.bind( |
| 2491 | t, |
| 2492 | "click", |
| 2493 | () => { |
| 2494 | se(e.togglePlay()); |
| 2495 | }, |
| 2496 | "play" |
| 2497 | ); |
| 2498 | }), |
| 2499 | this.bind(t.buttons.restart, "click", e.restart, "restart"), |
| 2500 | this.bind( |
| 2501 | t.buttons.rewind, |
| 2502 | "click", |
| 2503 | () => { |
| 2504 | (e.lastSeekTime = Date.now()), e.rewind(); |
| 2505 | }, |
| 2506 | "rewind" |
| 2507 | ), |
| 2508 | this.bind( |
| 2509 | t.buttons.fastForward, |
| 2510 | "click", |
| 2511 | () => { |
| 2512 | (e.lastSeekTime = Date.now()), e.forward(); |
| 2513 | }, |
| 2514 | "fastForward" |
| 2515 | ), |
| 2516 | this.bind( |
| 2517 | t.buttons.mute, |
| 2518 | "click", |
| 2519 | () => { |
| 2520 | e.muted = !e.muted; |
| 2521 | }, |
| 2522 | "mute" |
| 2523 | ), |
| 2524 | this.bind(t.buttons.captions, "click", () => e.toggleCaptions()), |
| 2525 | this.bind( |
| 2526 | t.buttons.download, |
| 2527 | "click", |
| 2528 | () => { |
| 2529 | ee.call(e, e.media, "download"); |
| 2530 | }, |
| 2531 | "download" |
| 2532 | ), |
| 2533 | this.bind( |
| 2534 | t.buttons.fullscreen, |
| 2535 | "click", |
| 2536 | () => { |
| 2537 | e.fullscreen.toggle(); |
| 2538 | }, |
| 2539 | "fullscreen" |
| 2540 | ), |
| 2541 | this.bind( |
| 2542 | t.buttons.pip, |
| 2543 | "click", |
| 2544 | () => { |
| 2545 | e.pip = "toggle"; |
| 2546 | }, |
| 2547 | "pip" |
| 2548 | ), |
| 2549 | this.bind(t.buttons.airplay, "click", e.airplay, "airplay"), |
| 2550 | this.bind( |
| 2551 | t.buttons.settings, |
| 2552 | "click", |
| 2553 | (t) => { |
| 2554 | t.stopPropagation(), t.preventDefault(), Me.toggleMenu.call(e, t); |
| 2555 | }, |
| 2556 | null, |
| 2557 | !1 |
| 2558 | ), |
| 2559 | this.bind( |
| 2560 | t.buttons.settings, |
| 2561 | "keyup", |
| 2562 | (t) => { |
| 2563 | [" ", "Enter"].includes(t.key) && ("Enter" !== t.key ? (t.preventDefault(), t.stopPropagation(), Me.toggleMenu.call(e, t)) : Me.focusFirstMenuItem.call(e, null, !0)); |
| 2564 | }, |
| 2565 | null, |
| 2566 | !1 |
| 2567 | ), |
| 2568 | this.bind(t.settings.menu, "keydown", (t) => { |
| 2569 | "Escape" === t.key && Me.toggleMenu.call(e, t); |
| 2570 | }), |
| 2571 | this.bind(t.inputs.seek, "mousedown mousemove", (e) => { |
| 2572 | const i = t.progress.getBoundingClientRect(), |
| 2573 | s = (100 / i.width) * (e.pageX - i.left); |
| 2574 | e.currentTarget.setAttribute("seek-value", s); |
| 2575 | }), |
| 2576 | this.bind(t.inputs.seek, "mousedown mouseup keydown keyup touchstart touchend", (t) => { |
| 2577 | const i = t.currentTarget, |
| 2578 | s = "play-on-seeked"; |
| 2579 | if (A.keyboardEvent(t) && !["ArrowLeft", "ArrowRight"].includes(t.key)) return; |
| 2580 | e.lastSeekTime = Date.now(); |
| 2581 | const n = i.hasAttribute(s), |
| 2582 | a = ["mouseup", "touchend", "keyup"].includes(t.type); |
| 2583 | n && a ? (i.removeAttribute(s), se(e.play())) : !a && e.playing && (i.setAttribute(s, ""), e.pause()); |
| 2584 | }), |
| 2585 | x.isIos) |
| 2586 | ) { |
| 2587 | const t = B.call(e, 'input[type="range"]'); |
| 2588 | Array.from(t).forEach((e) => this.bind(e, i, (e) => M(e.target))); |
| 2589 | } |
| 2590 | this.bind( |
| 2591 | t.inputs.seek, |
| 2592 | i, |
| 2593 | (t) => { |
| 2594 | const i = t.currentTarget; |
| 2595 | let s = i.getAttribute("seek-value"); |
| 2596 | A.empty(s) && (s = i.value), i.removeAttribute("seek-value"), (e.currentTime = (s / i.max) * e.duration); |
| 2597 | }, |
| 2598 | "seek" |
| 2599 | ), |
| 2600 | this.bind(t.progress, "mouseenter mouseleave mousemove", (t) => Me.updateSeekTooltip.call(e, t)), |
| 2601 | this.bind(t.progress, "mousemove touchmove", (t) => { |
| 2602 | const { posterThumbnails: i } = e; |
| 2603 | i && i.loaded && i.startMove(t); |
| 2604 | }), |
| 2605 | this.bind(t.progress, "mouseleave touchend click", () => { |
| 2606 | const { posterThumbnails: t } = e; |
| 2607 | t && t.loaded && t.endMove(!1, !0); |
| 2608 | }), |
| 2609 | this.bind(t.progress, "mousedown touchstart", (t) => { |
| 2610 | const { posterThumbnails: i } = e; |
| 2611 | i && i.loaded && i.startScrubbing(t); |
| 2612 | }), |
| 2613 | this.bind(t.progress, "mouseup touchend", (t) => { |
| 2614 | const { posterThumbnails: i } = e; |
| 2615 | i && i.loaded && i.endScrubbing(t); |
| 2616 | }), |
| 2617 | x.isWebKit && |
| 2618 | Array.from(B.call(e, 'input[type="range"]')).forEach((t) => { |
| 2619 | this.bind(t, "input", (t) => Me.updateRangeFill.call(e, t.target)); |
| 2620 | }), |
| 2621 | e.config.toggleInvert && |
| 2622 | !A.element(t.display.duration) && |
| 2623 | this.bind(t.display.currentTime, "click", () => { |
| 2624 | 0 !== e.currentTime && ((e.config.invertTime = !e.config.invertTime), Me.timeUpdate.call(e)); |
| 2625 | }), |
| 2626 | this.bind( |
| 2627 | t.inputs.volume, |
| 2628 | i, |
| 2629 | (t) => { |
| 2630 | e.volume = t.target.value; |
| 2631 | }, |
| 2632 | "volume" |
| 2633 | ), |
| 2634 | this.bind(t.controls, "mouseenter mouseleave", (i) => { |
| 2635 | t.controls.hover = !e.touch && "mouseenter" === i.type; |
| 2636 | }), |
| 2637 | t.fullscreen && |
| 2638 | Array.from(t.fullscreen.children) |
| 2639 | .filter((e) => !e.contains(t.container)) |
| 2640 | .forEach((i) => { |
| 2641 | this.bind(i, "mouseenter mouseleave", (i) => { |
| 2642 | t.controls && (t.controls.hover = !e.touch && "mouseenter" === i.type); |
| 2643 | }); |
| 2644 | }), |
| 2645 | this.bind(t.controls, "mousedown mouseup touchstart touchend touchcancel", (e) => { |
| 2646 | t.controls.pressed = ["mousedown", "touchstart"].includes(e.type); |
| 2647 | }), |
| 2648 | this.bind(t.controls, "focusin", () => { |
| 2649 | const { config: i, timers: s } = e; |
| 2650 | F(t.controls, i.classNames.noTransition, !0), |
| 2651 | Ue.toggleControls.call(e, !0), |
| 2652 | setTimeout(() => { |
| 2653 | F(t.controls, i.classNames.noTransition, !1); |
| 2654 | }, 0); |
| 2655 | const n = this.touch ? 3e3 : 4e3; |
| 2656 | clearTimeout(s.controls), (s.controls = setTimeout(() => Ue.toggleControls.call(e, !1), n)); |
| 2657 | }), |
| 2658 | this.bind( |
| 2659 | t.inputs.volume, |
| 2660 | "wheel", |
| 2661 | (t) => { |
| 2662 | const i = t.webkitDirectionInvertedFromDevice, |
| 2663 | [s, n] = [t.deltaX, -t.deltaY].map((e) => (i ? -e : e)), |
| 2664 | a = Math.sign(Math.abs(s) > Math.abs(n) ? s : n); |
| 2665 | e.increaseVolume(a / 50); |
| 2666 | const { volume: r } = e.media; |
| 2667 | ((1 === a && r < 1) || (-1 === a && r > 0)) && t.preventDefault(); |
| 2668 | }, |
| 2669 | "volume", |
| 2670 | !1 |
| 2671 | ); |
| 2672 | }), |
| 2673 | (this.player = e), |
| 2674 | (this.lastKey = null), |
| 2675 | (this.focusTimer = null), |
| 2676 | (this.lastKeyDown = null), |
| 2677 | (this.handleKey = this.handleKey.bind(this)), |
| 2678 | (this.toggleMenu = this.toggleMenu.bind(this)), |
| 2679 | (this.firstTouch = this.firstTouch.bind(this)); |
| 2680 | } |
| 2681 | handleKey(e) { |
| 2682 | const { player: t } = this, |
| 2683 | { elements: i } = t, |
| 2684 | { key: s, type: n, altKey: a, ctrlKey: r, metaKey: o, shiftKey: l } = e, |
| 2685 | c = "keydown" === n, |
| 2686 | u = c && s === this.lastKey; |
| 2687 | if (a || r || o || l) return; |
| 2688 | if (!s) return; |
| 2689 | if (c) { |
| 2690 | const n = document.activeElement; |
| 2691 | if (A.element(n)) { |
| 2692 | const { editable: s } = t.config.selectors, |
| 2693 | { seek: a } = i.inputs; |
| 2694 | if (n !== a && V(n, s)) return; |
| 2695 | if (" " === e.key && V(n, 'button, [role^="menuitem"]')) return; |
| 2696 | } |
| 2697 | switch (([" ", "ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "c", "f", "k", "l", "m"].includes(s) && (e.preventDefault(), e.stopPropagation()), s)) { |
| 2698 | case "0": |
| 2699 | case "1": |
| 2700 | case "2": |
| 2701 | case "3": |
| 2702 | case "4": |
| 2703 | case "5": |
| 2704 | case "6": |
| 2705 | case "7": |
| 2706 | case "8": |
| 2707 | case "9": |
| 2708 | u || ((h = parseInt(s, 10)), (t.currentTime = (t.duration / 10) * h)); |
| 2709 | break; |
| 2710 | case " ": |
| 2711 | case "k": |
| 2712 | u || se(t.togglePlay()); |
| 2713 | break; |
| 2714 | case "ArrowUp": |
| 2715 | t.increaseVolume(0.1); |
| 2716 | break; |
| 2717 | case "ArrowDown": |
| 2718 | t.decreaseVolume(0.1); |
| 2719 | break; |
| 2720 | case "m": |
| 2721 | u || (t.muted = !t.muted); |
| 2722 | break; |
| 2723 | case "ArrowRight": |
| 2724 | t.forward(); |
| 2725 | break; |
| 2726 | case "ArrowLeft": |
| 2727 | t.rewind(); |
| 2728 | break; |
| 2729 | case "f": |
| 2730 | t.fullscreen.toggle(); |
| 2731 | break; |
| 2732 | case "c": |
| 2733 | u || t.toggleCaptions(); |
| 2734 | break; |
| 2735 | case "l": |
| 2736 | t.loop = !t.loop; |
| 2737 | } |
| 2738 | "Escape" === s && !t.fullscreen.usingNative && t.fullscreen.active && t.fullscreen.toggle(), (this.lastKey = s); |
| 2739 | } else this.lastKey = null; |
| 2740 | var h; |
| 2741 | } |
| 2742 | toggleMenu(e) { |
| 2743 | Me.toggleMenu.call(this.player, e); |
| 2744 | } |
| 2745 | } |
| 2746 | var Be = (function (e, t) { |
| 2747 | return e((t = { exports: {} }), t.exports), t.exports; |
| 2748 | })(function (e, t) { |
| 2749 | e.exports = (function () { |
| 2750 | var e = function () { }, |
| 2751 | t = {}, |
| 2752 | i = {}, |
| 2753 | s = {}; |
| 2754 | function n(e, t) { |
| 2755 | e = e.push ? e : [e]; |
| 2756 | var n, |
| 2757 | a, |
| 2758 | r, |
| 2759 | o = [], |
| 2760 | l = e.length, |
| 2761 | c = l; |
| 2762 | for ( |
| 2763 | n = function (e, i) { |
| 2764 | i.length && o.push(e), --c || t(o); |
| 2765 | }; |
| 2766 | l--; |
| 2767 | |
| 2768 | ) |
| 2769 | (a = e[l]), (r = i[a]) ? n(a, r) : (s[a] = s[a] || []).push(n); |
| 2770 | } |
| 2771 | function a(e, t) { |
| 2772 | if (e) { |
| 2773 | var n = s[e]; |
| 2774 | if (((i[e] = t), n)) for (; n.length;) n[0](e, t), n.splice(0, 1); |
| 2775 | } |
| 2776 | } |
| 2777 | function r(t, i) { |
| 2778 | t.call && (t = { success: t }), i.length ? (t.error || e)(i) : (t.success || e)(t); |
| 2779 | } |
| 2780 | function o(t, i, s, n) { |
| 2781 | var a, |
| 2782 | r, |
| 2783 | l = document, |
| 2784 | c = s.async, |
| 2785 | u = (s.numRetries || 0) + 1, |
| 2786 | h = s.before || e, |
| 2787 | d = t.replace(/[\?|#].*$/, ""), |
| 2788 | m = t.replace(/^(css|img)!/, ""); |
| 2789 | (n = n || 0), |
| 2790 | /(^css!|\.css$)/.test(d) |
| 2791 | ? (((r = l.createElement("link")).rel = "stylesheet"), (r.href = m), (a = "hideFocus" in r) && r.relList && ((a = 0), (r.rel = "preload"), (r.as = "style"))) |
| 2792 | : /(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d) |
| 2793 | ? ((r = l.createElement("img")).src = m) |
| 2794 | : (((r = l.createElement("script")).src = t), (r.async = void 0 === c || c)), |
| 2795 | (r.onload = r.onerror = r.onbeforeload = function (e) { |
| 2796 | var l = e.type[0]; |
| 2797 | if (a) |
| 2798 | try { |
| 2799 | r.sheet.cssText.length || (l = "e"); |
| 2800 | } catch (e) { |
| 2801 | 18 != e.code && (l = "e"); |
| 2802 | } |
| 2803 | if ("e" == l) { |
| 2804 | if ((n += 1) < u) return o(t, i, s, n); |
| 2805 | } else if ("preload" == r.rel && "style" == r.as) return (r.rel = "stylesheet"); |
| 2806 | i(t, l, e.defaultPrevented); |
| 2807 | }), |
| 2808 | !1 !== h(t, r) && l.head.appendChild(r); |
| 2809 | } |
| 2810 | function l(e, t, i) { |
| 2811 | var s, |
| 2812 | n, |
| 2813 | a = (e = e.push ? e : [e]).length, |
| 2814 | r = a, |
| 2815 | l = []; |
| 2816 | for ( |
| 2817 | s = function (e, i, s) { |
| 2818 | if (("e" == i && l.push(e), "b" == i)) { |
| 2819 | if (!s) return; |
| 2820 | l.push(e); |
| 2821 | } |
| 2822 | --a || t(l); |
| 2823 | }, |
| 2824 | n = 0; |
| 2825 | n < r; |
| 2826 | n++ |
| 2827 | ) |
| 2828 | o(e[n], s, i); |
| 2829 | } |
| 2830 | function c(e, i, s) { |
| 2831 | var n, o; |
| 2832 | if ((i && i.trim && (n = i), (o = (n ? s : i) || {}), n)) { |
| 2833 | if (n in t) throw "LoadJS"; |
| 2834 | t[n] = !0; |
| 2835 | } |
| 2836 | function c(t, i) { |
| 2837 | l( |
| 2838 | e, |
| 2839 | function (e) { |
| 2840 | r(o, e), t && r({ success: t, error: i }, e), a(n, e); |
| 2841 | }, |
| 2842 | o |
| 2843 | ); |
| 2844 | } |
| 2845 | if (o.returnPromise) return new Promise(c); |
| 2846 | c(); |
| 2847 | } |
| 2848 | return ( |
| 2849 | (c.ready = function (e, t) { |
| 2850 | return ( |
| 2851 | n(e, function (e) { |
| 2852 | r(t, e); |
| 2853 | }), |
| 2854 | c |
| 2855 | ); |
| 2856 | }), |
| 2857 | (c.done = function (e) { |
| 2858 | a(e, []); |
| 2859 | }), |
| 2860 | (c.reset = function () { |
| 2861 | (t = {}), (i = {}), (s = {}); |
| 2862 | }), |
| 2863 | (c.isDefined = function (e) { |
| 2864 | return e in t; |
| 2865 | }), |
| 2866 | c |
| 2867 | ); |
| 2868 | })(); |
| 2869 | }); |
| 2870 | function We(e) { |
| 2871 | return new Promise((t, i) => { |
| 2872 | Be(e, { success: t, error: i }); |
| 2873 | }); |
| 2874 | } |
| 2875 | function ze(e) { |
| 2876 | e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === e && ((this.media.paused = !e), ee.call(this, this.media, e ? "play" : "pause")); |
| 2877 | } |
| 2878 | const Ke = { |
| 2879 | setup() { |
| 2880 | const e = this; |
| 2881 | F(e.elements.wrapper, e.config.classNames.embed, !0), |
| 2882 | (e.options.speed = e.config.speed.options), |
| 2883 | he.call(e), |
| 2884 | A.object(window.Vimeo) |
| 2885 | ? Ke.ready.call(e) |
| 2886 | : We(e.config.urls.vimeo.sdk) |
| 2887 | .then(() => { |
| 2888 | Ke.ready.call(e); |
| 2889 | }) |
| 2890 | .catch((t) => { |
| 2891 | e.debug.warn("Vimeo SDK (player.js) failed to load", t); |
| 2892 | }); |
| 2893 | }, |
| 2894 | ready() { |
| 2895 | const e = this, |
| 2896 | t = e.config.vimeo, |
| 2897 | { premium: i, referrerPolicy: s, ...n } = t; |
| 2898 | let a = e.media.getAttribute("src"), |
| 2899 | r = ""; |
| 2900 | A.empty(a) |
| 2901 | ? ((a = e.media.getAttribute(e.config.attributes.embed.id)), (r = e.media.getAttribute(e.config.attributes.embed.hash))) |
| 2902 | : (r = (function (e) { |
| 2903 | const t = e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/); |
| 2904 | return t && 5 === t.length ? t[4] : null; |
| 2905 | })(a)); |
| 2906 | const o = r ? { h: r } : {}; |
| 2907 | i && Object.assign(n, { controls: !1, sidedock: !1 }); |
| 2908 | const l = Le({ loop: e.config.loop.active, autoplay: e.autoplay, muted: e.muted, gesture: "media", playsinline: e.config.playsinline, ...o, ...n }), |
| 2909 | c = ((u = a), A.empty(u) ? null : A.number(Number(u)) ? u : u.match(/^.*(vimeo.com\/|video\/)(\d+).*/) ? RegExp.$2 : u); |
| 2910 | var u; |
| 2911 | const h = O("iframe"), |
| 2912 | d = pe(e.config.urls.vimeo.iframe, c, l); |
| 2913 | if ( |
| 2914 | (h.setAttribute("src", d), |
| 2915 | h.setAttribute("allowfullscreen", ""), |
| 2916 | h.setAttribute("allow", ["autoplay", "fullscreen", "picture-in-picture", "encrypted-media", "accelerometer", "gyroscope"].join("; ")), |
| 2917 | A.empty(s) || h.setAttribute("referrerPolicy", s), |
| 2918 | i || !t.customControls) |
| 2919 | ) |
| 2920 | h.setAttribute("data-poster", e.poster), (e.media = D(h, e.media)); |
| 2921 | else { |
| 2922 | const t = O("div", { class: e.config.classNames.embedContainer, "data-poster": e.poster }); |
| 2923 | t.appendChild(h), (e.media = D(t, e.media)); |
| 2924 | } |
| 2925 | t.customControls || |
| 2926 | ke(pe(e.config.urls.vimeo.api, d)).then((t) => { |
| 2927 | !A.empty(t) && t.thumbnail_url && Ue.setPoster.call(e, t.thumbnail_url).catch(() => { }); |
| 2928 | }), |
| 2929 | (e.embed = new window.Vimeo.Player(h, { autopause: e.config.autopause, muted: e.muted })), |
| 2930 | (e.media.paused = !0), |
| 2931 | (e.media.currentTime = 0), |
| 2932 | e.supported.ui && e.embed.disableTextTrack(), |
| 2933 | (e.media.play = () => (ze.call(e, !0), e.embed.play())), |
| 2934 | (e.media.pause = () => (ze.call(e, !1), e.embed.pause())), |
| 2935 | (e.media.stop = () => { |
| 2936 | e.pause(), (e.currentTime = 0); |
| 2937 | }); |
| 2938 | let { currentTime: m } = e.media; |
| 2939 | Object.defineProperty(e.media, "currentTime", { |
| 2940 | get: () => m, |
| 2941 | set(t) { |
| 2942 | const { embed: i, media: s, paused: n, volume: a } = e, |
| 2943 | r = n && !i.hasPlayed; |
| 2944 | (s.seeking = !0), |
| 2945 | ee.call(e, s, "seeking"), |
| 2946 | Promise.resolve(r && i.setVolume(0)) |
| 2947 | .then(() => i.setCurrentTime(t)) |
| 2948 | .then(() => r && i.pause()) |
| 2949 | .then(() => r && i.setVolume(a)) |
| 2950 | .catch(() => { }); |
| 2951 | }, |
| 2952 | }); |
| 2953 | let p = e.config.speed.selected; |
| 2954 | Object.defineProperty(e.media, "playbackRate", { |
| 2955 | get: () => p, |
| 2956 | set(t) { |
| 2957 | e.embed |
| 2958 | .setPlaybackRate(t) |
| 2959 | .then(() => { |
| 2960 | (p = t), ee.call(e, e.media, "ratechange"); |
| 2961 | }) |
| 2962 | .catch(() => { |
| 2963 | e.options.speed = [1]; |
| 2964 | }); |
| 2965 | }, |
| 2966 | }); |
| 2967 | let { volume: g } = e.config; |
| 2968 | Object.defineProperty(e.media, "volume", { |
| 2969 | get: () => g, |
| 2970 | set(t) { |
| 2971 | e.embed.setVolume(t).then(() => { |
| 2972 | (g = t), ee.call(e, e.media, "volumechange"); |
| 2973 | }); |
| 2974 | }, |
| 2975 | }); |
| 2976 | let { muted: f } = e.config; |
| 2977 | Object.defineProperty(e.media, "muted", { |
| 2978 | get: () => f, |
| 2979 | set(t) { |
| 2980 | const i = !!A.boolean(t) && t; |
| 2981 | e.embed.setMuted(!!i || e.config.muted).then(() => { |
| 2982 | (f = i), ee.call(e, e.media, "volumechange"); |
| 2983 | }); |
| 2984 | }, |
| 2985 | }); |
| 2986 | let y, |
| 2987 | { loop: b } = e.config; |
| 2988 | Object.defineProperty(e.media, "loop", { |
| 2989 | get: () => b, |
| 2990 | set(t) { |
| 2991 | const i = A.boolean(t) ? t : e.config.loop.active; |
| 2992 | e.embed.setLoop(i).then(() => { |
| 2993 | b = i; |
| 2994 | }); |
| 2995 | }, |
| 2996 | }), |
| 2997 | e.embed |
| 2998 | .getVideoUrl() |
| 2999 | .then((t) => { |
| 3000 | (y = t), Me.setDownloadUrl.call(e); |
| 3001 | }) |
| 3002 | .catch((e) => { |
| 3003 | this.debug.warn(e); |
| 3004 | }), |
| 3005 | Object.defineProperty(e.media, "currentSrc", { get: () => y }), |
| 3006 | Object.defineProperty(e.media, "ended", { get: () => e.currentTime === e.duration }), |
| 3007 | Promise.all([e.embed.getVideoWidth(), e.embed.getVideoHeight()]).then((t) => { |
| 3008 | const [i, s] = t; |
| 3009 | (e.embed.ratio = de(i, s)), he.call(this); |
| 3010 | }), |
| 3011 | e.embed.setAutopause(e.config.autopause).then((t) => { |
| 3012 | e.config.autopause = t; |
| 3013 | }), |
| 3014 | e.embed.getVideoTitle().then((t) => { |
| 3015 | (e.config.title = t), Ue.setTitle.call(this); |
| 3016 | }), |
| 3017 | e.embed.getCurrentTime().then((t) => { |
| 3018 | (m = t), ee.call(e, e.media, "timeupdate"); |
| 3019 | }), |
| 3020 | e.embed.getDuration().then((t) => { |
| 3021 | (e.media.duration = t), ee.call(e, e.media, "durationchange"); |
| 3022 | }), |
| 3023 | e.embed.getTextTracks().then((t) => { |
| 3024 | (e.media.textTracks = t), Ne.setup.call(e); |
| 3025 | }), |
| 3026 | e.embed.on("cuechange", ({ cues: t = [] }) => { |
| 3027 | const i = t.map((e) => |
| 3028 | (function (e) { |
| 3029 | const t = document.createDocumentFragment(), |
| 3030 | i = document.createElement("div"); |
| 3031 | return t.appendChild(i), (i.innerHTML = e), t.firstChild.innerText; |
| 3032 | })(e.text) |
| 3033 | ); |
| 3034 | Ne.updateCues.call(e, i); |
| 3035 | }), |
| 3036 | e.embed.on("loaded", () => { |
| 3037 | if ( |
| 3038 | (e.embed.getPaused().then((t) => { |
| 3039 | ze.call(e, !t), t || ee.call(e, e.media, "playing"); |
| 3040 | }), |
| 3041 | A.element(e.embed.element) && e.supported.ui) |
| 3042 | ) { |
| 3043 | e.embed.element.setAttribute("tabindex", -1); |
| 3044 | } |
| 3045 | }), |
| 3046 | e.embed.on("bufferstart", () => { |
| 3047 | ee.call(e, e.media, "waiting"); |
| 3048 | }), |
| 3049 | e.embed.on("bufferend", () => { |
| 3050 | ee.call(e, e.media, "playing"); |
| 3051 | }), |
| 3052 | e.embed.on("play", () => { |
| 3053 | ze.call(e, !0), ee.call(e, e.media, "playing"); |
| 3054 | }), |
| 3055 | e.embed.on("pause", () => { |
| 3056 | ze.call(e, !1); |
| 3057 | }), |
| 3058 | e.embed.on("timeupdate", (t) => { |
| 3059 | (e.media.seeking = !1), (m = t.seconds), ee.call(e, e.media, "timeupdate"); |
| 3060 | }), |
| 3061 | e.embed.on("progress", (t) => { |
| 3062 | (e.media.buffered = t.percent), |
| 3063 | ee.call(e, e.media, "progress"), |
| 3064 | 1 === parseInt(t.percent, 10) && ee.call(e, e.media, "canplaythrough"), |
| 3065 | e.embed.getDuration().then((t) => { |
| 3066 | t !== e.media.duration && ((e.media.duration = t), ee.call(e, e.media, "durationchange")); |
| 3067 | }); |
| 3068 | }), |
| 3069 | e.embed.on("seeked", () => { |
| 3070 | (e.media.seeking = !1), ee.call(e, e.media, "seeked"); |
| 3071 | }), |
| 3072 | e.embed.on("ended", () => { |
| 3073 | (e.media.paused = !0), ee.call(e, e.media, "ended"); |
| 3074 | }), |
| 3075 | e.embed.on("error", (t) => { |
| 3076 | (e.media.error = t), ee.call(e, e.media, "error"); |
| 3077 | }), |
| 3078 | t.customControls && setTimeout(() => Ue.build.call(e), 0); |
| 3079 | }, |
| 3080 | }; |
| 3081 | function Ye(e) { |
| 3082 | e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === e && ((this.media.paused = !e), ee.call(this, this.media, e ? "play" : "pause")); |
| 3083 | } |
| 3084 | function Qe(e) { |
| 3085 | return e.noCookie ? "https://www.youtube-nocookie.com" : "http:" === window.location.protocol ? "http://www.youtube.com" : void 0; |
| 3086 | } |
| 3087 | const Xe = { |
| 3088 | setup() { |
| 3089 | if ((F(this.elements.wrapper, this.config.classNames.embed, !0), A.object(window.YT) && A.function(window.YT.Player))) Xe.ready.call(this); |
| 3090 | else { |
| 3091 | const e = window.onYouTubeIframeAPIReady; |
| 3092 | (window.onYouTubeIframeAPIReady = () => { |
| 3093 | A.function(e) && e(), Xe.ready.call(this); |
| 3094 | }), |
| 3095 | We(this.config.urls.youtube.sdk).catch((e) => { |
| 3096 | this.debug.warn("YouTube API failed to load", e); |
| 3097 | }); |
| 3098 | } |
| 3099 | }, |
| 3100 | getTitle(e) { |
| 3101 | ke(pe(this.config.urls.youtube.api, e)) |
| 3102 | .then((e) => { |
| 3103 | if (A.object(e)) { |
| 3104 | const { title: t, height: i, width: s } = e; |
| 3105 | (this.config.title = t), Ue.setTitle.call(this), (this.embed.ratio = de(s, i)); |
| 3106 | } |
| 3107 | he.call(this); |
| 3108 | }) |
| 3109 | .catch(() => { |
| 3110 | he.call(this); |
| 3111 | }); |
| 3112 | }, |
| 3113 | ready() { |
| 3114 | const e = this, |
| 3115 | t = e.config.youtube, |
| 3116 | i = e.media && e.media.getAttribute("id"); |
| 3117 | if (!A.empty(i) && i.startsWith("youtube-")) return; |
| 3118 | let s = e.media.getAttribute("src"); |
| 3119 | A.empty(s) && (s = e.media.getAttribute(this.config.attributes.embed.id)); |
| 3120 | const n = ((a = s), A.empty(a) ? null : a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/) ? RegExp.$2 : a); |
| 3121 | var a; |
| 3122 | const r = O("div", { id: `${e.provider}-${Math.floor(1e4 * Math.random())}`, "data-poster": t.customControls ? e.poster : void 0 }); |
| 3123 | if (((e.media = D(r, e.media)), t.customControls)) { |
| 3124 | const t = (e) => `https://i.ytimg.com/vi/${n}/${e}default.jpg`; |
| 3125 | Fe(t("maxres"), 121) |
| 3126 | .catch(() => Fe(t("sd"), 121)) |
| 3127 | .catch(() => Fe(t("hq"))) |
| 3128 | .then((t) => Ue.setPoster.call(e, t.src)) |
| 3129 | .then((t) => { |
| 3130 | t.includes("maxres") || (e.elements.poster.style.backgroundSize = "cover"); |
| 3131 | }) |
| 3132 | .catch(() => { }); |
| 3133 | } |
| 3134 | e.embed = new window.YT.Player(e.media, { |
| 3135 | videoId: n, |
| 3136 | host: Qe(t), |
| 3137 | playerVars: N( |
| 3138 | {}, |
| 3139 | { |
| 3140 | autoplay: e.config.autoplay ? 1 : 0, |
| 3141 | hl: e.config.hl, |
| 3142 | controls: e.supported.ui && t.customControls ? 0 : 1, |
| 3143 | disablekb: 1, |
| 3144 | playsinline: e.config.playsinline && !e.config.fullscreen.iosNative ? 1 : 0, |
| 3145 | cc_load_policy: e.captions.active ? 1 : 0, |
| 3146 | cc_lang_pref: e.config.captions.language, |
| 3147 | widget_referrer: window ? window.location.href : null, |
| 3148 | }, |
| 3149 | t |
| 3150 | ), |
| 3151 | events: { |
| 3152 | onError(t) { |
| 3153 | if (!e.media.error) { |
| 3154 | const i = t.data, |
| 3155 | s = |
| 3156 | { |
| 3157 | 2: "The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.", |
| 3158 | 5: "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.", |
| 3159 | 100: "The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.", |
| 3160 | 101: "The owner of the requested video does not allow it to be played in embedded players.", |
| 3161 | 150: "The owner of the requested video does not allow it to be played in embedded players.", |
| 3162 | }[i] || "An unknown error occurred"; |
| 3163 | (e.media.error = { code: i, message: s }), ee.call(e, e.media, "error"); |
| 3164 | } |
| 3165 | }, |
| 3166 | onPlaybackRateChange(t) { |
| 3167 | const i = t.target; |
| 3168 | (e.media.playbackRate = i.getPlaybackRate()), ee.call(e, e.media, "ratechange"); |
| 3169 | }, |
| 3170 | onReady(i) { |
| 3171 | if (A.function(e.media.play)) return; |
| 3172 | const s = i.target; |
| 3173 | Xe.getTitle.call(e, n), |
| 3174 | (e.media.play = () => { |
| 3175 | Ye.call(e, !0), s.playVideo(); |
| 3176 | }), |
| 3177 | (e.media.pause = () => { |
| 3178 | Ye.call(e, !1), s.pauseVideo(); |
| 3179 | }), |
| 3180 | (e.media.stop = () => { |
| 3181 | s.stopVideo(); |
| 3182 | }), |
| 3183 | (e.media.duration = s.getDuration()), |
| 3184 | (e.media.paused = !0), |
| 3185 | (e.media.currentTime = 0), |
| 3186 | Object.defineProperty(e.media, "currentTime", { |
| 3187 | get: () => Number(s.getCurrentTime()), |
| 3188 | set(t) { |
| 3189 | e.paused && !e.embed.hasPlayed && e.embed.mute(), (e.media.seeking = !0), ee.call(e, e.media, "seeking"), s.seekTo(t); |
| 3190 | }, |
| 3191 | }), |
| 3192 | Object.defineProperty(e.media, "playbackRate", { |
| 3193 | get: () => s.getPlaybackRate(), |
| 3194 | set(e) { |
| 3195 | s.setPlaybackRate(e); |
| 3196 | }, |
| 3197 | }); |
| 3198 | let { volume: a } = e.config; |
| 3199 | Object.defineProperty(e.media, "volume", { |
| 3200 | get: () => a, |
| 3201 | set(t) { |
| 3202 | (a = t), s.setVolume(100 * a), ee.call(e, e.media, "volumechange"); |
| 3203 | }, |
| 3204 | }); |
| 3205 | let { muted: r } = e.config; |
| 3206 | Object.defineProperty(e.media, "muted", { |
| 3207 | get: () => r, |
| 3208 | set(t) { |
| 3209 | const i = A.boolean(t) ? t : r; |
| 3210 | (r = i), s[i ? "mute" : "unMute"](), s.setVolume(100 * a), ee.call(e, e.media, "volumechange"); |
| 3211 | }, |
| 3212 | }), |
| 3213 | Object.defineProperty(e.media, "currentSrc", { get: () => s.getVideoUrl() }), |
| 3214 | Object.defineProperty(e.media, "ended", { get: () => e.currentTime === e.duration }); |
| 3215 | const o = s.getAvailablePlaybackRates(); |
| 3216 | (e.options.speed = o.filter((t) => e.config.speed.options.includes(t))), |
| 3217 | e.supported.ui && t.customControls && e.media.setAttribute("tabindex", -1), |
| 3218 | ee.call(e, e.media, "timeupdate"), |
| 3219 | ee.call(e, e.media, "durationchange"), |
| 3220 | clearInterval(e.timers.buffering), |
| 3221 | (e.timers.buffering = setInterval(() => { |
| 3222 | (e.media.buffered = s.getVideoLoadedFraction()), |
| 3223 | (null === e.media.lastBuffered || e.media.lastBuffered < e.media.buffered) && ee.call(e, e.media, "progress"), |
| 3224 | (e.media.lastBuffered = e.media.buffered), |
| 3225 | 1 === e.media.buffered && (clearInterval(e.timers.buffering), ee.call(e, e.media, "canplaythrough")); |
| 3226 | }, 200)), |
| 3227 | t.customControls && setTimeout(() => Ue.build.call(e), 50); |
| 3228 | }, |
| 3229 | onStateChange(i) { |
| 3230 | const s = i.target; |
| 3231 | clearInterval(e.timers.playing); |
| 3232 | switch ((e.media.seeking && [1, 2].includes(i.data) && ((e.media.seeking = !1), ee.call(e, e.media, "seeked")), i.data)) { |
| 3233 | case -1: |
| 3234 | ee.call(e, e.media, "timeupdate"), (e.media.buffered = s.getVideoLoadedFraction()), ee.call(e, e.media, "progress"); |
| 3235 | break; |
| 3236 | case 0: |
| 3237 | Ye.call(e, !1), e.media.loop ? (s.stopVideo(), s.playVideo()) : ee.call(e, e.media, "ended"); |
| 3238 | break; |
| 3239 | case 1: |
| 3240 | t.customControls && !e.config.autoplay && e.media.paused && !e.embed.hasPlayed |
| 3241 | ? e.media.pause() |
| 3242 | : (Ye.call(e, !0), |
| 3243 | ee.call(e, e.media, "playing"), |
| 3244 | (e.timers.playing = setInterval(() => { |
| 3245 | ee.call(e, e.media, "timeupdate"); |
| 3246 | }, 50)), |
| 3247 | e.media.duration !== s.getDuration() && ((e.media.duration = s.getDuration()), ee.call(e, e.media, "durationchange"))); |
| 3248 | break; |
| 3249 | case 2: |
| 3250 | e.muted || e.embed.unMute(), Ye.call(e, !1); |
| 3251 | break; |
| 3252 | case 3: |
| 3253 | ee.call(e, e.media, "waiting"); |
| 3254 | } |
| 3255 | ee.call(e, e.elements.container, "statechange", !1, { code: i.data }); |
| 3256 | }, |
| 3257 | }, |
| 3258 | }); |
| 3259 | }, |
| 3260 | }, |
| 3261 | Je = { |
| 3262 | setup() { |
| 3263 | this.media |
| 3264 | ? (F(this.elements.container, this.config.classNames.type.replace("{0}", this.type), !0), |
| 3265 | F(this.elements.container, this.config.classNames.provider.replace("{0}", this.provider), !0), |
| 3266 | this.isEmbed && F(this.elements.container, this.config.classNames.type.replace("{0}", "video"), !0), |
| 3267 | this.isVideo && |
| 3268 | ((this.elements.wrapper = O("div", { class: this.config.classNames.video })), |
| 3269 | _(this.media, this.elements.wrapper), |
| 3270 | (this.elements.poster = O("div", { class: this.config.classNames.poster })), |
| 3271 | this.elements.wrapper.appendChild(this.elements.poster)), |
| 3272 | this.isHTML5 ? me.setup.call(this) : this.isYouTube ? Xe.setup.call(this) : this.isVimeo && Ke.setup.call(this)) |
| 3273 | : this.debug.warn("No media element found!"); |
| 3274 | }, |
| 3275 | }; |
| 3276 | class Ge { |
| 3277 | constructor(e) { |
| 3278 | t(this, "load", () => { |
| 3279 | this.enabled && |
| 3280 | (A.object(window.google) && A.object(window.google.ima) |
| 3281 | ? this.ready() |
| 3282 | : We(this.player.config.urls.googleIMA.sdk) |
| 3283 | .then(() => { |
| 3284 | this.ready(); |
| 3285 | }) |
| 3286 | .catch(() => { |
| 3287 | this.trigger("error", new Error("Google IMA SDK failed to load")); |
| 3288 | })); |
| 3289 | }), |
| 3290 | t(this, "ready", () => { |
| 3291 | var e; |
| 3292 | this.enabled || ((e = this).manager && e.manager.destroy(), e.elements.displayContainer && e.elements.displayContainer.destroy(), e.elements.container.remove()), |
| 3293 | this.startSafetyTimer(12e3, "ready()"), |
| 3294 | this.managerPromise.then(() => { |
| 3295 | this.clearSafetyTimer("onAdsManagerLoaded()"); |
| 3296 | }), |
| 3297 | this.listeners(), |
| 3298 | this.setupIMA(); |
| 3299 | }), |
| 3300 | t(this, "setupIMA", () => { |
| 3301 | (this.elements.container = O("div", { class: this.player.config.classNames.ads })), |
| 3302 | this.player.elements.container.appendChild(this.elements.container), |
| 3303 | google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED), |
| 3304 | google.ima.settings.setLocale(this.player.config.ads.language), |
| 3305 | google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline), |
| 3306 | (this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media)), |
| 3307 | (this.loader = new google.ima.AdsLoader(this.elements.displayContainer)), |
| 3308 | this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, (e) => this.onAdsManagerLoaded(e), !1), |
| 3309 | this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, (e) => this.onAdError(e), !1), |
| 3310 | this.requestAds(); |
| 3311 | }), |
| 3312 | t(this, "requestAds", () => { |
| 3313 | const { container: e } = this.player.elements; |
| 3314 | try { |
| 3315 | const t = new google.ima.AdsRequest(); |
| 3316 | (t.adTagUrl = this.tagUrl), |
| 3317 | (t.linearAdSlotWidth = e.offsetWidth), |
| 3318 | (t.linearAdSlotHeight = e.offsetHeight), |
| 3319 | (t.nonLinearAdSlotWidth = e.offsetWidth), |
| 3320 | (t.nonLinearAdSlotHeight = e.offsetHeight), |
| 3321 | (t.forceNonLinearFullSlot = !1), |
| 3322 | t.setAdWillPlayMuted(!this.player.muted), |
| 3323 | this.loader.requestAds(t); |
| 3324 | } catch (e) { |
| 3325 | this.onAdError(e); |
| 3326 | } |
| 3327 | }), |
| 3328 | t(this, "pollCountdown", (e = !1) => { |
| 3329 | if (!e) return clearInterval(this.countdownTimer), void this.elements.container.removeAttribute("data-badge-text"); |
| 3330 | this.countdownTimer = setInterval(() => { |
| 3331 | const e = Pe(Math.max(this.manager.getRemainingTime(), 0)), |
| 3332 | t = `${we.get("advertisement", this.player.config)} - ${e}`; |
| 3333 | this.elements.container.setAttribute("data-badge-text", t); |
| 3334 | }, 100); |
| 3335 | }), |
| 3336 | t(this, "onAdsManagerLoaded", (e) => { |
| 3337 | if (!this.enabled) return; |
| 3338 | const t = new google.ima.AdsRenderingSettings(); |
| 3339 | (t.restoreCustomPlaybackStateOnAdBreakComplete = !0), |
| 3340 | (t.enablePreloading = !0), |
| 3341 | (this.manager = e.getAdsManager(this.player, t)), |
| 3342 | (this.cuePoints = this.manager.getCuePoints()), |
| 3343 | this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, (e) => this.onAdError(e)), |
| 3344 | Object.keys(google.ima.AdEvent.Type).forEach((e) => { |
| 3345 | this.manager.addEventListener(google.ima.AdEvent.Type[e], (e) => this.onAdEvent(e)); |
| 3346 | }), |
| 3347 | this.trigger("loaded"); |
| 3348 | }), |
| 3349 | t(this, "addCuePoints", () => { |
| 3350 | A.empty(this.cuePoints) || |
| 3351 | this.cuePoints.forEach((e) => { |
| 3352 | if (0 !== e && -1 !== e && e < this.player.duration) { |
| 3353 | const t = this.player.elements.progress; |
| 3354 | if (A.element(t)) { |
| 3355 | const i = (100 / this.player.duration) * e, |
| 3356 | s = O("span", { class: this.player.config.classNames.cues }); |
| 3357 | (s.style.left = `${i.toString()}%`), t.appendChild(s); |
| 3358 | } |
| 3359 | } |
| 3360 | }); |
| 3361 | }), |
| 3362 | t(this, "onAdEvent", (e) => { |
| 3363 | const { container: t } = this.player.elements, |
| 3364 | i = e.getAd(), |
| 3365 | s = e.getAdData(); |
| 3366 | switch ( |
| 3367 | (((e) => { |
| 3368 | ee.call(this.player, this.player.media, `ads${e.replace(/_/g, "").toLowerCase()}`); |
| 3369 | })(e.type), |
| 3370 | e.type) |
| 3371 | ) { |
| 3372 | case google.ima.AdEvent.Type.LOADED: |
| 3373 | this.trigger("loaded"), this.pollCountdown(!0), i.isLinear() || ((i.width = t.offsetWidth), (i.height = t.offsetHeight)); |
| 3374 | break; |
| 3375 | case google.ima.AdEvent.Type.STARTED: |
| 3376 | this.manager.setVolume(this.player.volume); |
| 3377 | break; |
| 3378 | case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: |
| 3379 | this.player.ended ? this.loadAds() : this.loader.contentComplete(); |
| 3380 | break; |
| 3381 | case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED: |
| 3382 | this.pauseContent(); |
| 3383 | break; |
| 3384 | case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED: |
| 3385 | this.pollCountdown(), this.resumeContent(); |
| 3386 | break; |
| 3387 | case google.ima.AdEvent.Type.LOG: |
| 3388 | s.adError && this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`); |
| 3389 | } |
| 3390 | }), |
| 3391 | t(this, "onAdError", (e) => { |
| 3392 | this.cancel(), this.player.debug.warn("Ads error", e); |
| 3393 | }), |
| 3394 | t(this, "listeners", () => { |
| 3395 | const { container: e } = this.player.elements; |
| 3396 | let t; |
| 3397 | this.player.on("canplay", () => { |
| 3398 | this.addCuePoints(); |
| 3399 | }), |
| 3400 | this.player.on("ended", () => { |
| 3401 | this.loader.contentComplete(); |
| 3402 | }), |
| 3403 | this.player.on("timeupdate", () => { |
| 3404 | t = this.player.currentTime; |
| 3405 | }), |
| 3406 | this.player.on("seeked", () => { |
| 3407 | const e = this.player.currentTime; |
| 3408 | A.empty(this.cuePoints) || |
| 3409 | this.cuePoints.forEach((i, s) => { |
| 3410 | t < i && i < e && (this.manager.discardAdBreak(), this.cuePoints.splice(s, 1)); |
| 3411 | }); |
| 3412 | }), |
| 3413 | window.addEventListener("resize", () => { |
| 3414 | this.manager && this.manager.resize(e.offsetWidth, e.offsetHeight, google.ima.ViewMode.NORMAL); |
| 3415 | }); |
| 3416 | }), |
| 3417 | t(this, "play", () => { |
| 3418 | const { container: e } = this.player.elements; |
| 3419 | this.managerPromise || this.resumeContent(), |
| 3420 | this.managerPromise |
| 3421 | .then(() => { |
| 3422 | this.manager.setVolume(this.player.volume), this.elements.displayContainer.initialize(); |
| 3423 | try { |
| 3424 | this.initialized || (this.manager.init(e.offsetWidth, e.offsetHeight, google.ima.ViewMode.NORMAL), this.manager.start()), (this.initialized = !0); |
| 3425 | } catch (e) { |
| 3426 | this.onAdError(e); |
| 3427 | } |
| 3428 | }) |
| 3429 | .catch(() => { }); |
| 3430 | }), |
| 3431 | t(this, "resumeContent", () => { |
| 3432 | (this.elements.container.style.zIndex = ""), (this.playing = !1), se(this.player.media.play()); |
| 3433 | }), |
| 3434 | t(this, "pauseContent", () => { |
| 3435 | (this.elements.container.style.zIndex = 3), (this.playing = !0), this.player.media.pause(); |
| 3436 | }), |
| 3437 | t(this, "cancel", () => { |
| 3438 | this.initialized && this.resumeContent(), this.trigger("error"), this.loadAds(); |
| 3439 | }), |
| 3440 | t(this, "loadAds", () => { |
| 3441 | this.managerPromise |
| 3442 | .then(() => { |
| 3443 | this.manager && this.manager.destroy(), |
| 3444 | (this.managerPromise = new Promise((e) => { |
| 3445 | this.on("loaded", e), this.player.debug.log(this.manager); |
| 3446 | })), |
| 3447 | (this.initialized = !1), |
| 3448 | this.requestAds(); |
| 3449 | }) |
| 3450 | .catch(() => { }); |
| 3451 | }), |
| 3452 | t(this, "trigger", (e, ...t) => { |
| 3453 | const i = this.events[e]; |
| 3454 | A.array(i) && |
| 3455 | i.forEach((e) => { |
| 3456 | A.function(e) && e.apply(this, t); |
| 3457 | }); |
| 3458 | }), |
| 3459 | t(this, "on", (e, t) => (A.array(this.events[e]) || (this.events[e] = []), this.events[e].push(t), this)), |
| 3460 | t(this, "startSafetyTimer", (e, t) => { |
| 3461 | this.player.debug.log(`Safety timer invoked from: ${t}`), |
| 3462 | (this.safetyTimer = setTimeout(() => { |
| 3463 | this.cancel(), this.clearSafetyTimer("startSafetyTimer()"); |
| 3464 | }, e)); |
| 3465 | }), |
| 3466 | t(this, "clearSafetyTimer", (e) => { |
| 3467 | A.nullOrUndefined(this.safetyTimer) || (this.player.debug.log(`Safety timer cleared from: ${e}`), clearTimeout(this.safetyTimer), (this.safetyTimer = null)); |
| 3468 | }), |
| 3469 | (this.player = e), |
| 3470 | (this.config = e.config.ads), |
| 3471 | (this.playing = !1), |
| 3472 | (this.initialized = !1), |
| 3473 | (this.elements = { container: null, displayContainer: null }), |
| 3474 | (this.manager = null), |
| 3475 | (this.loader = null), |
| 3476 | (this.cuePoints = null), |
| 3477 | (this.events = {}), |
| 3478 | (this.safetyTimer = null), |
| 3479 | (this.countdownTimer = null), |
| 3480 | (this.managerPromise = new Promise((e, t) => { |
| 3481 | this.on("loaded", e), this.on("error", t); |
| 3482 | })), |
| 3483 | this.load(); |
| 3484 | } |
| 3485 | get enabled() { |
| 3486 | const { config: e } = this; |
| 3487 | return this.player.isHTML5 && this.player.isVideo && e.enabled && (!A.empty(e.publisherId) || A.url(e.tagUrl)); |
| 3488 | } |
| 3489 | get tagUrl() { |
| 3490 | const { config: e } = this; |
| 3491 | if (A.url(e.tagUrl)) return e.tagUrl; |
| 3492 | return `https://go.aniview.com/api/adserver6/vast/?${Le({ |
| 3493 | AV_PUBLISHERID: "58c25bb0073ef448b1087ad6", |
| 3494 | AV_CHANNELID: "5a0458dc28a06145e4519d21", |
| 3495 | AV_URL: window.location.hostname, |
| 3496 | cb: Date.now(), |
| 3497 | AV_WIDTH: 640, |
| 3498 | AV_HEIGHT: 480, |
| 3499 | AV_CDIM2: e.publisherId, |
| 3500 | })}`; |
| 3501 | } |
| 3502 | } |
| 3503 | function Ze(e = 0, t = 0, i = 255) { |
| 3504 | return Math.min(Math.max(e, t), i); |
| 3505 | } |
| 3506 | const et = (e) => { |
| 3507 | const t = []; |
| 3508 | return ( |
| 3509 | e.split(/\r\n\r\n|\n\n|\r\r/).forEach((e) => { |
| 3510 | const i = {}; |
| 3511 | e.split(/\r\n|\n|\r/).forEach((e) => { |
| 3512 | if (A.number(i.startTime)) { |
| 3513 | if (!A.empty(e.trim()) && A.empty(i.text)) { |
| 3514 | const t = e.trim().split("#xywh="); |
| 3515 | ([i.text] = t), t[1] && ([i.x, i.y, i.w, i.h] = t[1].split(",")); |
| 3516 | } |
| 3517 | } else { |
| 3518 | const t = e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/); |
| 3519 | t && ((i.startTime = 60 * Number(t[1] || 0) * 60 + 60 * Number(t[2]) + Number(t[3]) + Number(`0.${t[4]}`)), (i.endTime = 60 * Number(t[6] || 0) * 60 + 60 * Number(t[7]) + Number(t[8]) + Number(`0.${t[9]}`))); |
| 3520 | } |
| 3521 | }), |
| 3522 | i.text && t.push(i); |
| 3523 | }), |
| 3524 | t |
| 3525 | ); |
| 3526 | }, |
| 3527 | tt = (e, t) => { |
| 3528 | const i = {}; |
| 3529 | return e > t.width / t.height ? ((i.width = t.width), (i.height = (1 / e) * t.width)) : ((i.height = t.height), (i.width = e * t.height)), i; |
| 3530 | }; |
| 3531 | class it { |
| 3532 | constructor(e) { |
| 3533 | t(this, "load", () => { |
| 3534 | this.player.elements.display.seekTooltip && (this.player.elements.display.seekTooltip.hidden = this.enabled), |
| 3535 | this.enabled && |
| 3536 | this.getThumbnails().then(() => { |
| 3537 | this.enabled && (this.render(), this.determineContainerAutoSizing(), this.listeners(), (this.loaded = !0)); |
| 3538 | }); |
| 3539 | }), |
| 3540 | t( |
| 3541 | this, |
| 3542 | "getThumbnails", |
| 3543 | () => |
| 3544 | new Promise((e) => { |
| 3545 | const { src: t } = this.player.config.posterThumbnails; |
| 3546 | if (A.empty(t)) throw new Error("Missing posterThumbnails.src config attribute"); |
| 3547 | const i = () => { |
| 3548 | this.thumbnails.sort((e, t) => e.height - t.height), this.player.debug.log("Preview thumbnails", this.thumbnails), e(); |
| 3549 | }; |
| 3550 | if (A.function(t)) |
| 3551 | t((e) => { |
| 3552 | (this.thumbnails = e), i(); |
| 3553 | }); |
| 3554 | else { |
| 3555 | const e = (A.string(t) ? [t] : t).map((e) => this.getThumbnail(e)); |
| 3556 | Promise.all(e).then(i); |
| 3557 | } |
| 3558 | }) |
| 3559 | ), |
| 3560 | t( |
| 3561 | this, |
| 3562 | "getThumbnail", |
| 3563 | (e) => |
| 3564 | new Promise((t) => { |
| 3565 | ke(e).then((i) => { |
| 3566 | const s = { frames: et(i), height: null, urlPrefix: "" }; |
| 3567 | s.frames[0].text.startsWith("/") || s.frames[0].text.startsWith("http://") || s.frames[0].text.startsWith("https://") || (s.urlPrefix = e.substring(0, e.lastIndexOf("/") + 1)); |
| 3568 | const n = new Image(); |
| 3569 | (n.onload = () => { |
| 3570 | (s.height = n.naturalHeight), (s.width = n.naturalWidth), this.thumbnails.push(s), t(); |
| 3571 | }), |
| 3572 | (n.src = s.urlPrefix + s.frames[0].text); |
| 3573 | }); |
| 3574 | }) |
| 3575 | ), |
| 3576 | t(this, "startMove", (e) => { |
| 3577 | if (this.loaded && A.event(e) && ["touchmove", "mousemove"].includes(e.type) && this.player.media.duration) { |
| 3578 | if ("touchmove" === e.type) this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100); |
| 3579 | else { |
| 3580 | var t, i; |
| 3581 | const s = this.player.elements.progress.getBoundingClientRect(), |
| 3582 | n = (100 / s.width) * (e.pageX - s.left); |
| 3583 | (this.seekTime = this.player.media.duration * (n / 100)), |
| 3584 | this.seekTime < 0 && (this.seekTime = 0), |
| 3585 | this.seekTime > this.player.media.duration - 1 && (this.seekTime = this.player.media.duration - 1), |
| 3586 | (this.mousePosX = e.pageX), |
| 3587 | (this.elements.thumb.time.innerText = Pe(this.seekTime)); |
| 3588 | const a = null === (t = this.player.config.markers) || void 0 === t || null === (i = t.points) || void 0 === i ? void 0 : i.find(({ time: e }) => e === Math.round(this.seekTime)); |
| 3589 | a && this.elements.thumb.time.insertAdjacentHTML("afterbegin", `${a.label}<br>`); |
| 3590 | } |
| 3591 | this.showImageAtCurrentTime(); |
| 3592 | } |
| 3593 | }), |
| 3594 | t(this, "endMove", () => { |
| 3595 | this.toggleThumbContainer(!1, !0); |
| 3596 | }), |
| 3597 | t(this, "startScrubbing", (e) => { |
| 3598 | (A.nullOrUndefined(e.button) || !1 === e.button || 0 === e.button) && |
| 3599 | ((this.mouseDown = !0), this.player.media.duration && (this.toggleScrubbingContainer(!0), this.toggleThumbContainer(!1, !0), this.showImageAtCurrentTime())); |
| 3600 | }), |
| 3601 | t(this, "endScrubbing", () => { |
| 3602 | (this.mouseDown = !1), |
| 3603 | Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime) |
| 3604 | ? this.toggleScrubbingContainer(!1) |
| 3605 | : Z.call(this.player, this.player.media, "timeupdate", () => { |
| 3606 | this.mouseDown || this.toggleScrubbingContainer(!1); |
| 3607 | }); |
| 3608 | }), |
| 3609 | t(this, "listeners", () => { |
| 3610 | this.player.on("play", () => { |
| 3611 | this.toggleThumbContainer(!1, !0); |
| 3612 | }), |
| 3613 | this.player.on("seeked", () => { |
| 3614 | this.toggleThumbContainer(!1); |
| 3615 | }), |
| 3616 | this.player.on("timeupdate", () => { |
| 3617 | this.lastTime = this.player.media.currentTime; |
| 3618 | }); |
| 3619 | }), |
| 3620 | t(this, "render", () => { |
| 3621 | (this.elements.thumb.container = O("div", { class: this.player.config.classNames.posterThumbnails.thumbContainer })), |
| 3622 | (this.elements.thumb.imageContainer = O("div", { class: this.player.config.classNames.posterThumbnails.imageContainer })), |
| 3623 | this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer); |
| 3624 | const e = O("div", { class: this.player.config.classNames.posterThumbnails.timeContainer }); |
| 3625 | (this.elements.thumb.time = O("span", {}, "00:00")), |
| 3626 | e.appendChild(this.elements.thumb.time), |
| 3627 | this.elements.thumb.imageContainer.appendChild(e), |
| 3628 | A.element(this.player.elements.progress) && this.player.elements.progress.appendChild(this.elements.thumb.container), |
| 3629 | (this.elements.scrubbing.container = O("div", { class: this.player.config.classNames.posterThumbnails.scrubbingContainer })), |
| 3630 | this.player.elements.wrapper.appendChild(this.elements.scrubbing.container); |
| 3631 | }), |
| 3632 | t(this, "destroy", () => { |
| 3633 | this.elements.thumb.container && this.elements.thumb.container.remove(), this.elements.scrubbing.container && this.elements.scrubbing.container.remove(); |
| 3634 | }), |
| 3635 | t(this, "showImageAtCurrentTime", () => { |
| 3636 | this.mouseDown ? this.setScrubbingContainerSize() : this.setThumbContainerSizeAndPos(); |
| 3637 | const e = this.thumbnails[0].frames.findIndex((e) => this.seekTime >= e.startTime && this.seekTime <= e.endTime), |
| 3638 | t = e >= 0; |
| 3639 | let i = 0; |
| 3640 | this.mouseDown || this.toggleThumbContainer(t), |
| 3641 | t && |
| 3642 | (this.thumbnails.forEach((t, s) => { |
| 3643 | this.loadedImages.includes(t.frames[e].text) && (i = s); |
| 3644 | }), |
| 3645 | e !== this.showingThumb && ((this.showingThumb = e), this.loadImage(i))); |
| 3646 | }), |
| 3647 | t(this, "loadImage", (e = 0) => { |
| 3648 | const t = this.showingThumb, |
| 3649 | i = this.thumbnails[e], |
| 3650 | { urlPrefix: s } = i, |
| 3651 | n = i.frames[t], |
| 3652 | a = i.frames[t].text, |
| 3653 | r = s + a; |
| 3654 | if (this.currentImageElement && this.currentImageElement.dataset.filename === a) |
| 3655 | this.showImage(this.currentImageElement, n, e, t, a, !1), (this.currentImageElement.dataset.index = t), this.removeOldImages(this.currentImageElement); |
| 3656 | else { |
| 3657 | this.loadingImage && this.usingSprites && (this.loadingImage.onload = null); |
| 3658 | const i = new Image(); |
| 3659 | (i.src = r), |
| 3660 | (i.dataset.index = t), |
| 3661 | (i.dataset.filename = a), |
| 3662 | (this.showingThumbFilename = a), |
| 3663 | this.player.debug.log(`Loading image: ${r}`), |
| 3664 | (i.onload = () => this.showImage(i, n, e, t, a, !0)), |
| 3665 | (this.loadingImage = i), |
| 3666 | this.removeOldImages(i); |
| 3667 | } |
| 3668 | }), |
| 3669 | t(this, "showImage", (e, t, i, s, n, a = !0) => { |
| 3670 | this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`), |
| 3671 | this.setImageSizeAndOffset(e, t), |
| 3672 | a && (this.currentImageContainer.appendChild(e), (this.currentImageElement = e), this.loadedImages.includes(n) || this.loadedImages.push(n)), |
| 3673 | this.preloadNearby(s, !0).then(this.preloadNearby(s, !1)).then(this.getHigherQuality(i, e, t, n)); |
| 3674 | }), |
| 3675 | t(this, "removeOldImages", (e) => { |
| 3676 | Array.from(this.currentImageContainer.children).forEach((t) => { |
| 3677 | if ("img" !== t.tagName.toLowerCase()) return; |
| 3678 | const i = this.usingSprites ? 500 : 1e3; |
| 3679 | if (t.dataset.index !== e.dataset.index && !t.dataset.deleting) { |
| 3680 | t.dataset.deleting = !0; |
| 3681 | const { currentImageContainer: e } = this; |
| 3682 | setTimeout(() => { |
| 3683 | e.removeChild(t), this.player.debug.log(`Removing thumb: ${t.dataset.filename}`); |
| 3684 | }, i); |
| 3685 | } |
| 3686 | }); |
| 3687 | }), |
| 3688 | t( |
| 3689 | this, |
| 3690 | "preloadNearby", |
| 3691 | (e, t = !0) => |
| 3692 | new Promise((i) => { |
| 3693 | setTimeout(() => { |
| 3694 | const s = this.thumbnails[0].frames[e].text; |
| 3695 | if (this.showingThumbFilename === s) { |
| 3696 | let n; |
| 3697 | n = t ? this.thumbnails[0].frames.slice(e) : this.thumbnails[0].frames.slice(0, e).reverse(); |
| 3698 | let a = !1; |
| 3699 | n.forEach((e) => { |
| 3700 | const t = e.text; |
| 3701 | if (t !== s && !this.loadedImages.includes(t)) { |
| 3702 | (a = !0), this.player.debug.log(`Preloading thumb filename: ${t}`); |
| 3703 | const { urlPrefix: e } = this.thumbnails[0], |
| 3704 | s = e + t, |
| 3705 | n = new Image(); |
| 3706 | (n.src = s), |
| 3707 | (n.onload = () => { |
| 3708 | this.player.debug.log(`Preloaded thumb filename: ${t}`), this.loadedImages.includes(t) || this.loadedImages.push(t), i(); |
| 3709 | }); |
| 3710 | } |
| 3711 | }), |
| 3712 | a || i(); |
| 3713 | } |
| 3714 | }, 300); |
| 3715 | }) |
| 3716 | ), |
| 3717 | t(this, "getHigherQuality", (e, t, i, s) => { |
| 3718 | if (e < this.thumbnails.length - 1) { |
| 3719 | let n = t.naturalHeight; |
| 3720 | this.usingSprites && (n = i.h), |
| 3721 | n < this.thumbContainerHeight && |
| 3722 | setTimeout(() => { |
| 3723 | this.showingThumbFilename === s && (this.player.debug.log(`Showing higher quality thumb for: ${s}`), this.loadImage(e + 1)); |
| 3724 | }, 300); |
| 3725 | } |
| 3726 | }), |
| 3727 | t(this, "toggleThumbContainer", (e = !1, t = !1) => { |
| 3728 | const i = this.player.config.classNames.posterThumbnails.thumbContainerShown; |
| 3729 | this.elements.thumb.container.classList.toggle(i, e), !e && t && ((this.showingThumb = null), (this.showingThumbFilename = null)); |
| 3730 | }), |
| 3731 | t(this, "toggleScrubbingContainer", (e = !1) => { |
| 3732 | const t = this.player.config.classNames.posterThumbnails.scrubbingContainerShown; |
| 3733 | this.elements.scrubbing.container.classList.toggle(t, e), e || ((this.showingThumb = null), (this.showingThumbFilename = null)); |
| 3734 | }), |
| 3735 | t(this, "determineContainerAutoSizing", () => { |
| 3736 | (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) && (this.sizeSpecifiedInCSS = !0); |
| 3737 | }), |
| 3738 | t(this, "setThumbContainerSizeAndPos", () => { |
| 3739 | const { imageContainer: e } = this.elements.thumb; |
| 3740 | if (this.sizeSpecifiedInCSS) { |
| 3741 | if (e.clientHeight > 20 && e.clientWidth < 20) { |
| 3742 | const t = Math.floor(e.clientHeight * this.thumbAspectRatio); |
| 3743 | e.style.width = `${t}px`; |
| 3744 | } else if (e.clientHeight < 20 && e.clientWidth > 20) { |
| 3745 | const t = Math.floor(e.clientWidth / this.thumbAspectRatio); |
| 3746 | e.style.height = `${t}px`; |
| 3747 | } |
| 3748 | } else { |
| 3749 | const t = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio); |
| 3750 | (e.style.height = `${this.thumbContainerHeight}px`), (e.style.width = `${t}px`); |
| 3751 | } |
| 3752 | this.setThumbContainerPos(); |
| 3753 | }), |
| 3754 | t(this, "setThumbContainerPos", () => { |
| 3755 | const e = this.player.elements.progress.getBoundingClientRect(), |
| 3756 | t = this.player.elements.container.getBoundingClientRect(), |
| 3757 | { container: i } = this.elements.thumb, |
| 3758 | s = t.left - e.left + 10, |
| 3759 | n = t.right - e.left - i.clientWidth - 10, |
| 3760 | a = this.mousePosX - e.left - i.clientWidth / 2, |
| 3761 | r = Ze(a, s, n); |
| 3762 | (i.style.left = `${r}px`), i.style.setProperty("--preview-arrow-offset", a - r + "px"); |
| 3763 | }), |
| 3764 | t(this, "setScrubbingContainerSize", () => { |
| 3765 | const { width: e, height: t } = tt(this.thumbAspectRatio, { width: this.player.media.clientWidth, height: this.player.media.clientHeight }); |
| 3766 | (this.elements.scrubbing.container.style.width = `${e}px`), (this.elements.scrubbing.container.style.height = `${t}px`); |
| 3767 | }), |
| 3768 | t(this, "setImageSizeAndOffset", (e, t) => { |
| 3769 | if (!this.usingSprites) return; |
| 3770 | const i = this.thumbContainerHeight / t.h; |
| 3771 | (e.style.height = e.naturalHeight * i + "px"), (e.style.width = e.naturalWidth * i + "px"), (e.style.left = `-${t.x * i}px`), (e.style.top = `-${t.y * i}px`); |
| 3772 | }), |
| 3773 | (this.player = e), |
| 3774 | (this.thumbnails = []), |
| 3775 | (this.loaded = !1), |
| 3776 | (this.lastMouseMoveTime = Date.now()), |
| 3777 | (this.mouseDown = !1), |
| 3778 | (this.loadedImages = []), |
| 3779 | (this.elements = { thumb: {}, scrubbing: {} }), |
| 3780 | this.load(); |
| 3781 | } |
| 3782 | get enabled() { |
| 3783 | return this.player.isHTML5 && this.player.isVideo && this.player.config.posterThumbnails.enabled; |
| 3784 | } |
| 3785 | get currentImageContainer() { |
| 3786 | return this.mouseDown ? this.elements.scrubbing.container : this.elements.thumb.imageContainer; |
| 3787 | } |
| 3788 | get usingSprites() { |
| 3789 | return Object.keys(this.thumbnails[0].frames[0]).includes("w"); |
| 3790 | } |
| 3791 | get thumbAspectRatio() { |
| 3792 | return this.usingSprites ? this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h : this.thumbnails[0].width / this.thumbnails[0].height; |
| 3793 | } |
| 3794 | get thumbContainerHeight() { |
| 3795 | if (this.mouseDown) { |
| 3796 | const { height: e } = tt(this.thumbAspectRatio, { width: this.player.media.clientWidth, height: this.player.media.clientHeight }); |
| 3797 | return e; |
| 3798 | } |
| 3799 | return this.sizeSpecifiedInCSS ? this.elements.thumb.imageContainer.clientHeight : Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4); |
| 3800 | } |
| 3801 | get currentImageElement() { |
| 3802 | return this.mouseDown ? this.currentScrubbingImageElement : this.currentThumbnailImageElement; |
| 3803 | } |
| 3804 | set currentImageElement(e) { |
| 3805 | this.mouseDown ? (this.currentScrubbingImageElement = e) : (this.currentThumbnailImageElement = e); |
| 3806 | } |
| 3807 | } |
| 3808 | const st = { |
| 3809 | insertElements(e, t) { |
| 3810 | A.string(t) |
| 3811 | ? $(e, this.media, { src: t }) |
| 3812 | : A.array(t) && |
| 3813 | t.forEach((t) => { |
| 3814 | $(e, this.media, t); |
| 3815 | }); |
| 3816 | }, |
| 3817 | change(e) { |
| 3818 | L(e, "sources.length") |
| 3819 | ? (me.cancelRequests.call(this), |
| 3820 | this.destroy.call( |
| 3821 | this, |
| 3822 | () => { |
| 3823 | (this.options.quality = []), j(this.media), (this.media = null), A.element(this.elements.container) && this.elements.container.removeAttribute("class"); |
| 3824 | const { sources: t, type: i } = e, |
| 3825 | [{ provider: s = $e.html5, src: n }] = t, |
| 3826 | a = "html5" === s ? i : "div", |
| 3827 | r = "html5" === s ? {} : { src: n }; |
| 3828 | Object.assign(this, { provider: s, type: i, supported: Y.check(i, s, this.config.playsinline), media: O(a, r) }), |
| 3829 | this.elements.container.appendChild(this.media), |
| 3830 | A.boolean(e.autoplay) && (this.config.autoplay = e.autoplay), |
| 3831 | this.isHTML5 && |
| 3832 | (this.config.crossorigin && this.media.setAttribute("crossorigin", ""), |
| 3833 | this.config.autoplay && this.media.setAttribute("autoplay", ""), |
| 3834 | A.empty(e.poster) || (this.poster = e.poster), |
| 3835 | this.config.loop.active && this.media.setAttribute("loop", ""), |
| 3836 | this.config.muted && this.media.setAttribute("muted", ""), |
| 3837 | this.config.playsinline && this.media.setAttribute("playsinline", "")), |
| 3838 | Ue.addStyleHook.call(this), |
| 3839 | this.isHTML5 && st.insertElements.call(this, "source", t), |
| 3840 | (this.config.title = e.title), |
| 3841 | Je.setup.call(this), |
| 3842 | this.isHTML5 && Object.keys(e).includes("tracks") && st.insertElements.call(this, "track", e.tracks), |
| 3843 | (this.isHTML5 || (this.isEmbed && !this.supported.ui)) && Ue.build.call(this), |
| 3844 | this.isHTML5 && this.media.load(), |
| 3845 | A.empty(e.posterThumbnails) || |
| 3846 | (Object.assign(this.config.posterThumbnails, e.posterThumbnails), |
| 3847 | this.posterThumbnails && this.posterThumbnails.loaded && (this.posterThumbnails.destroy(), (this.posterThumbnails = null)), |
| 3848 | this.config.posterThumbnails.enabled && (this.posterThumbnails = new it(this))), |
| 3849 | this.fullscreen.update(); |
| 3850 | }, |
| 3851 | !0 |
| 3852 | )) |
| 3853 | : this.debug.warn("Invalid source format"); |
| 3854 | }, |
| 3855 | }; |
| 3856 | class nt { |
| 3857 | constructor(e, i) { |
| 3858 | if ( |
| 3859 | (t(this, "play", () => (A.function(this.media.play) ? (this.ads && this.ads.enabled && this.ads.managerPromise.then(() => this.ads.play()).catch(() => se(this.media.play())), this.media.play()) : null)), |
| 3860 | t(this, "pause", () => (this.playing && A.function(this.media.pause) ? this.media.pause() : null)), |
| 3861 | t(this, "togglePlay", (e) => ((A.boolean(e) ? e : !this.playing) ? this.play() : this.pause())), |
| 3862 | t(this, "stop", () => { |
| 3863 | this.isHTML5 ? (this.pause(), this.restart()) : A.function(this.media.stop) && this.media.stop(); |
| 3864 | }), |
| 3865 | t(this, "restart", () => { |
| 3866 | this.currentTime = 0; |
| 3867 | }), |
| 3868 | t(this, "rewind", (e) => { |
| 3869 | this.currentTime -= A.number(e) ? e : this.config.seekTime; |
| 3870 | }), |
| 3871 | t(this, "forward", (e) => { |
| 3872 | this.currentTime += A.number(e) ? e : this.config.seekTime; |
| 3873 | }), |
| 3874 | t(this, "increaseVolume", (e) => { |
| 3875 | const t = this.media.muted ? 0 : this.volume; |
| 3876 | this.volume = t + (A.number(e) ? e : 0); |
| 3877 | }), |
| 3878 | t(this, "decreaseVolume", (e) => { |
| 3879 | this.increaseVolume(-e); |
| 3880 | }), |
| 3881 | t(this, "airplay", () => { |
| 3882 | Y.airplay && this.media.webkitShowPlaybackTargetPicker(); |
| 3883 | }), |
| 3884 | t(this, "toggleControls", (e) => { |
| 3885 | if (this.supported.ui && !this.isAudio) { |
| 3886 | const t = U(this.elements.container, this.config.classNames.hideControls), |
| 3887 | i = void 0 === e ? void 0 : !e, |
| 3888 | s = F(this.elements.container, this.config.classNames.hideControls, i); |
| 3889 | if ((s && A.array(this.config.controls) && this.config.controls.includes("settings") && !A.empty(this.config.settings) && Me.toggleMenu.call(this, !1), s !== t)) { |
| 3890 | const e = s ? "controlshidden" : "controlsshown"; |
| 3891 | ee.call(this, this.media, e); |
| 3892 | } |
| 3893 | return !s; |
| 3894 | } |
| 3895 | return !1; |
| 3896 | }), |
| 3897 | t(this, "on", (e, t) => { |
| 3898 | J.call(this, this.elements.container, e, t); |
| 3899 | }), |
| 3900 | t(this, "once", (e, t) => { |
| 3901 | Z.call(this, this.elements.container, e, t); |
| 3902 | }), |
| 3903 | t(this, "off", (e, t) => { |
| 3904 | G(this.elements.container, e, t); |
| 3905 | }), |
| 3906 | t(this, "destroy", (e, t = !1) => { |
| 3907 | if (!this.ready) return; |
| 3908 | const i = () => { |
| 3909 | (document.body.style.overflow = ""), |
| 3910 | (this.embed = null), |
| 3911 | t |
| 3912 | ? (Object.keys(this.elements).length && |
| 3913 | (j(this.elements.buttons.play), |
| 3914 | j(this.elements.captions), |
| 3915 | j(this.elements.controls), |
| 3916 | j(this.elements.wrapper), |
| 3917 | (this.elements.buttons.play = null), |
| 3918 | (this.elements.captions = null), |
| 3919 | (this.elements.controls = null), |
| 3920 | (this.elements.wrapper = null)), |
| 3921 | A.function(e) && e()) |
| 3922 | : (te.call(this), |
| 3923 | me.cancelRequests.call(this), |
| 3924 | D(this.elements.original, this.elements.container), |
| 3925 | ee.call(this, this.elements.original, "destroyed", !0), |
| 3926 | A.function(e) && e.call(this.elements.original), |
| 3927 | (this.ready = !1), |
| 3928 | setTimeout(() => { |
| 3929 | (this.elements = null), (this.media = null); |
| 3930 | }, 200)); |
| 3931 | }; |
| 3932 | this.stop(), |
| 3933 | clearTimeout(this.timers.loading), |
| 3934 | clearTimeout(this.timers.controls), |
| 3935 | clearTimeout(this.timers.resized), |
| 3936 | this.isHTML5 |
| 3937 | ? (Ue.toggleNativeControls.call(this, !0), i()) |
| 3938 | : this.isYouTube |
| 3939 | ? (clearInterval(this.timers.buffering), clearInterval(this.timers.playing), null !== this.embed && A.function(this.embed.destroy) && this.embed.destroy(), i()) |
| 3940 | : this.isVimeo && (null !== this.embed && this.embed.unload().then(i), setTimeout(i, 200)); |
| 3941 | }), |
| 3942 | t(this, "supports", (e) => Y.mime.call(this, e)), |
| 3943 | (this.timers = {}), |
| 3944 | (this.ready = !1), |
| 3945 | (this.loading = !1), |
| 3946 | (this.failed = !1), |
| 3947 | (this.touch = Y.touch), |
| 3948 | (this.media = e), |
| 3949 | A.string(this.media) && (this.media = document.querySelectorAll(this.media)), |
| 3950 | ((window.jQuery && this.media instanceof jQuery) || A.nodeList(this.media) || A.array(this.media)) && (this.media = this.media[0]), |
| 3951 | (this.config = N( |
| 3952 | {}, |
| 3953 | _e, |
| 3954 | nt.defaults, |
| 3955 | i || {}, |
| 3956 | (() => { |
| 3957 | try { |
| 3958 | return JSON.parse(this.media.getAttribute("data-plyr-config")); |
| 3959 | } catch (e) { |
| 3960 | return {}; |
| 3961 | } |
| 3962 | })() |
| 3963 | )), |
| 3964 | (this.elements = { container: null, fullscreen: null, captions: null, buttons: {}, display: {}, progress: {}, inputs: {}, settings: { popup: null, menu: null, panels: {}, buttons: {} } }), |
| 3965 | (this.captions = { active: null, currentTrack: -1, meta: new WeakMap() }), |
| 3966 | (this.fullscreen = { active: !1 }), |
| 3967 | (this.options = { speed: [], quality: [] }), |
| 3968 | (this.debug = new qe(this.config.debug)), |
| 3969 | this.debug.log("Config", this.config), |
| 3970 | this.debug.log("Support", Y), |
| 3971 | A.nullOrUndefined(this.media) || !A.element(this.media)) |
| 3972 | ) |
| 3973 | return void this.debug.error("Setup failed: no suitable element passed"); |
| 3974 | if (this.media.plyr) return void this.debug.warn("Target already setup"); |
| 3975 | if (!this.config.enabled) return void this.debug.error("Setup failed: disabled by config"); |
| 3976 | if (!Y.check().api) return void this.debug.error("Setup failed: no support"); |
| 3977 | const s = this.media.cloneNode(!0); |
| 3978 | (s.autoplay = !1), (this.elements.original = s); |
| 3979 | const n = this.media.tagName.toLowerCase(); |
| 3980 | let a = null, |
| 3981 | r = null; |
| 3982 | switch (n) { |
| 3983 | case "div": |
| 3984 | if (((a = this.media.querySelector("iframe")), A.element(a))) { |
| 3985 | if ( |
| 3986 | ((r = xe(a.getAttribute("src"))), |
| 3987 | (this.provider = (function (e) { |
| 3988 | return /^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e) ? $e.youtube : /^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e) ? $e.vimeo : null; |
| 3989 | })(r.toString())), |
| 3990 | (this.elements.container = this.media), |
| 3991 | (this.media = a), |
| 3992 | (this.elements.container.className = ""), |
| 3993 | r.search.length) |
| 3994 | ) { |
| 3995 | const e = ["1", "true"]; |
| 3996 | e.includes(r.searchParams.get("autoplay")) && (this.config.autoplay = !0), |
| 3997 | e.includes(r.searchParams.get("loop")) && (this.config.loop.active = !0), |
| 3998 | this.isYouTube ? ((this.config.playsinline = e.includes(r.searchParams.get("playsinline"))), (this.config.youtube.hl = r.searchParams.get("hl"))) : (this.config.playsinline = !0); |
| 3999 | } |
| 4000 | } else (this.provider = this.media.getAttribute(this.config.attributes.embed.provider)), this.media.removeAttribute(this.config.attributes.embed.provider); |
| 4001 | if (A.empty(this.provider) || !Object.values($e).includes(this.provider)) return void this.debug.error("Setup failed: Invalid provider"); |
| 4002 | this.type = Re; |
| 4003 | break; |
| 4004 | case "video": |
| 4005 | case "audio": |
| 4006 | (this.type = n), |
| 4007 | (this.provider = $e.html5), |
| 4008 | this.media.hasAttribute("crossorigin") && (this.config.crossorigin = !0), |
| 4009 | this.media.hasAttribute("autoplay") && (this.config.autoplay = !0), |
| 4010 | (this.media.hasAttribute("playsinline") || this.media.hasAttribute("webkit-playsinline")) && (this.config.playsinline = !0), |
| 4011 | this.media.hasAttribute("muted") && (this.config.muted = !0), |
| 4012 | this.media.hasAttribute("loop") && (this.config.loop.active = !0); |
| 4013 | break; |
| 4014 | default: |
| 4015 | return void this.debug.error("Setup failed: unsupported type"); |
| 4016 | } |
| 4017 | (this.supported = Y.check(this.type, this.provider)), |
| 4018 | this.supported.api |
| 4019 | ? ((this.eventListeners = []), |
| 4020 | (this.listeners = new Ve(this)), |
| 4021 | (this.storage = new Te(this)), |
| 4022 | (this.media.plyr = this), |
| 4023 | A.element(this.elements.container) || ((this.elements.container = O("div")), _(this.media, this.elements.container)), |
| 4024 | Ue.migrateStyles.call(this), |
| 4025 | Ue.addStyleHook.call(this), |
| 4026 | Je.setup.call(this), |
| 4027 | this.config.debug && |
| 4028 | J.call(this, this.elements.container, this.config.events.join(" "), (e) => { |
| 4029 | this.debug.log(`event: ${e.type}`); |
| 4030 | }), |
| 4031 | (this.fullscreen = new He(this)), |
| 4032 | (this.isHTML5 || (this.isEmbed && !this.supported.ui)) && Ue.build.call(this), |
| 4033 | this.listeners.container(), |
| 4034 | this.listeners.global(), |
| 4035 | this.config.ads.enabled && (this.ads = new Ge(this)), |
| 4036 | this.isHTML5 && this.config.autoplay && this.once("canplay", () => se(this.play())), |
| 4037 | (this.lastSeekTime = 0), |
| 4038 | this.config.posterThumbnails.enabled && (this.posterThumbnails = new it(this))) |
| 4039 | : this.debug.error("Setup failed: no support"); |
| 4040 | } |
| 4041 | get isHTML5() { |
| 4042 | return this.provider === $e.html5; |
| 4043 | } |
| 4044 | get isEmbed() { |
| 4045 | return this.isYouTube || this.isVimeo; |
| 4046 | } |
| 4047 | get isYouTube() { |
| 4048 | return this.provider === $e.youtube; |
| 4049 | } |
| 4050 | get isVimeo() { |
| 4051 | return this.provider === $e.vimeo; |
| 4052 | } |
| 4053 | get isVideo() { |
| 4054 | return this.type === Re; |
| 4055 | } |
| 4056 | get isAudio() { |
| 4057 | return this.type === je; |
| 4058 | } |
| 4059 | get playing() { |
| 4060 | return Boolean(this.ready && !this.paused && !this.ended); |
| 4061 | } |
| 4062 | get paused() { |
| 4063 | return Boolean(this.media.paused); |
| 4064 | } |
| 4065 | get stopped() { |
| 4066 | return Boolean(this.paused && 0 === this.currentTime); |
| 4067 | } |
| 4068 | get ended() { |
| 4069 | return Boolean(this.media.ended); |
| 4070 | } |
| 4071 | set currentTime(e) { |
| 4072 | if (!this.duration) return; |
| 4073 | const t = A.number(e) && e > 0; |
| 4074 | (this.media.currentTime = t ? Math.min(e, this.duration) : 0), this.debug.log(`Seeking to ${this.currentTime} seconds`); |
| 4075 | } |
| 4076 | get currentTime() { |
| 4077 | return Number(this.media.currentTime); |
| 4078 | } |
| 4079 | get buffered() { |
| 4080 | const { buffered: e } = this.media; |
| 4081 | return A.number(e) ? e : e && e.length && this.duration > 0 ? e.end(0) / this.duration : 0; |
| 4082 | } |
| 4083 | get seeking() { |
| 4084 | return Boolean(this.media.seeking); |
| 4085 | } |
| 4086 | get duration() { |
| 4087 | const e = parseFloat(this.config.duration), |
| 4088 | t = (this.media || {}).duration, |
| 4089 | i = A.number(t) && t !== 1 / 0 ? t : 0; |
| 4090 | return e || i; |
| 4091 | } |
| 4092 | set volume(e) { |
| 4093 | let t = e; |
| 4094 | A.string(t) && (t = Number(t)), |
| 4095 | A.number(t) || (t = this.storage.get("volume")), |
| 4096 | A.number(t) || ({ volume: t } = this.config), |
| 4097 | t > 1 && (t = 1), |
| 4098 | t < 0 && (t = 0), |
| 4099 | (this.config.volume = t), |
| 4100 | (this.media.volume = t), |
| 4101 | !A.empty(e) && this.muted && t > 0 && (this.muted = !1); |
| 4102 | } |
| 4103 | get volume() { |
| 4104 | return Number(this.media.volume); |
| 4105 | } |
| 4106 | set muted(e) { |
| 4107 | let t = e; |
| 4108 | A.boolean(t) || (t = this.storage.get("muted")), A.boolean(t) || (t = this.config.muted), (this.config.muted = t), (this.media.muted = t); |
| 4109 | } |
| 4110 | get muted() { |
| 4111 | return Boolean(this.media.muted); |
| 4112 | } |
| 4113 | get hasAudio() { |
| 4114 | return !this.isHTML5 || !!this.isAudio || Boolean(this.media.mozHasAudio) || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks && this.media.audioTracks.length); |
| 4115 | } |
| 4116 | set speed(e) { |
| 4117 | let t = null; |
| 4118 | A.number(e) && (t = e), A.number(t) || (t = this.storage.get("speed")), A.number(t) || (t = this.config.speed.selected); |
| 4119 | const { minimumSpeed: i, maximumSpeed: s } = this; |
| 4120 | (t = Ze(t, i, s)), |
| 4121 | (this.config.speed.selected = t), |
| 4122 | setTimeout(() => { |
| 4123 | this.media && (this.media.playbackRate = t); |
| 4124 | }, 0); |
| 4125 | } |
| 4126 | get speed() { |
| 4127 | return Number(this.media.playbackRate); |
| 4128 | } |
| 4129 | get minimumSpeed() { |
| 4130 | return this.isYouTube ? Math.min(...this.options.speed) : this.isVimeo ? 0.5 : 0.0625; |
| 4131 | } |
| 4132 | get maximumSpeed() { |
| 4133 | return this.isYouTube ? Math.max(...this.options.speed) : this.isVimeo ? 2 : 16; |
| 4134 | } |
| 4135 | set quality(e) { |
| 4136 | const t = this.config.quality, |
| 4137 | i = this.options.quality; |
| 4138 | if (!i.length) return; |
| 4139 | let s = [!A.empty(e) && Number(e), this.storage.get("quality"), t.selected, t.default].find(A.number), |
| 4140 | n = !0; |
| 4141 | if (!i.includes(s)) { |
| 4142 | const e = ae(i, s); |
| 4143 | this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`), (s = e), (n = !1); |
| 4144 | } |
| 4145 | (t.selected = s), (this.media.quality = s), n && this.storage.set({ quality: s }); |
| 4146 | } |
| 4147 | get quality() { |
| 4148 | return this.media.quality; |
| 4149 | } |
| 4150 | set loop(e) { |
| 4151 | const t = A.boolean(e) ? e : this.config.loop.active; |
| 4152 | (this.config.loop.active = t), (this.media.loop = t); |
| 4153 | } |
| 4154 | get loop() { |
| 4155 | return Boolean(this.media.loop); |
| 4156 | } |
| 4157 | set source(e) { |
| 4158 | st.change.call(this, e); |
| 4159 | } |
| 4160 | get source() { |
| 4161 | return this.media.currentSrc; |
| 4162 | } |
| 4163 | get download() { |
| 4164 | const { download: e } = this.config.urls; |
| 4165 | return A.url(e) ? e : this.source; |
| 4166 | } |
| 4167 | set download(e) { |
| 4168 | A.url(e) && ((this.config.urls.download = e), Me.setDownloadUrl.call(this)); |
| 4169 | } |
| 4170 | set poster(e) { |
| 4171 | this.isVideo ? Ue.setPoster.call(this, e, !1).catch(() => { }) : this.debug.warn("Poster can only be set for video"); |
| 4172 | } |
| 4173 | get poster() { |
| 4174 | return this.isVideo ? this.media.getAttribute("poster") || this.media.getAttribute("data-poster") : null; |
| 4175 | } |
| 4176 | get ratio() { |
| 4177 | if (!this.isVideo) return null; |
| 4178 | const e = ce(ue.call(this)); |
| 4179 | return A.array(e) ? e.join(":") : e; |
| 4180 | } |
| 4181 | set ratio(e) { |
| 4182 | this.isVideo ? (A.string(e) && le(e) ? ((this.config.ratio = ce(e)), he.call(this)) : this.debug.error(`Invalid aspect ratio specified (${e})`)) : this.debug.warn("Aspect ratio can only be set for video"); |
| 4183 | } |
| 4184 | set autoplay(e) { |
| 4185 | this.config.autoplay = A.boolean(e) ? e : this.config.autoplay; |
| 4186 | } |
| 4187 | get autoplay() { |
| 4188 | return Boolean(this.config.autoplay); |
| 4189 | } |
| 4190 | toggleCaptions(e) { |
| 4191 | Ne.toggle.call(this, e, !1); |
| 4192 | } |
| 4193 | set currentTrack(e) { |
| 4194 | Ne.set.call(this, e, !1), Ne.setup.call(this); |
| 4195 | } |
| 4196 | get currentTrack() { |
| 4197 | const { toggled: e, currentTrack: t } = this.captions; |
| 4198 | return e ? t : -1; |
| 4199 | } |
| 4200 | set language(e) { |
| 4201 | Ne.setLanguage.call(this, e, !1); |
| 4202 | } |
| 4203 | get language() { |
| 4204 | return (Ne.getCurrentTrack.call(this) || {}).language; |
| 4205 | } |
| 4206 | set pip(e) { |
| 4207 | if (!Y.pip) return; |
| 4208 | const t = A.boolean(e) ? e : !this.pip; |
| 4209 | A.function(this.media.webkitSetPresentationMode) && this.media.webkitSetPresentationMode(t ? Ie : Oe), |
| 4210 | A.function(this.media.requestPictureInPicture) && (!this.pip && t ? this.media.requestPictureInPicture() : this.pip && !t && document.exitPictureInPicture()); |
| 4211 | } |
| 4212 | get pip() { |
| 4213 | return Y.pip ? (A.empty(this.media.webkitPresentationMode) ? this.media === document.pictureInPictureElement : this.media.webkitPresentationMode === Ie) : null; |
| 4214 | } |
| 4215 | setposterThumbnails(e) { |
| 4216 | this.posterThumbnails && this.posterThumbnails.loaded && (this.posterThumbnails.destroy(), (this.posterThumbnails = null)), |
| 4217 | Object.assign(this.config.posterThumbnails, e), |
| 4218 | this.config.posterThumbnails.enabled && (this.posterThumbnails = new it(this)); |
| 4219 | } |
| 4220 | static supported(e, t) { |
| 4221 | return Y.check(e, t); |
| 4222 | } |
| 4223 | static loadSprite(e, t) { |
| 4224 | return Ee(e, t); |
| 4225 | } |
| 4226 | static setup(e, t = {}) { |
| 4227 | let i = null; |
| 4228 | return A.string(e) ? (i = Array.from(document.querySelectorAll(e))) : A.nodeList(e) ? (i = Array.from(e)) : A.array(e) && (i = e.filter(A.element)), A.empty(i) ? null : i.map((e) => new nt(e, t)); |
| 4229 | } |
| 4230 | } |
| 4231 | var at; |
| 4232 | return (nt.defaults = ((at = _e), JSON.parse(JSON.stringify(at)))), nt; |
| 4233 | }); |
| 4234 |