! function(e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("DPlayer", [], t) : "object" == typeof exports ? exports.DPlayer = t() : e.DPlayer = t() }(window, function() { return function(e) { var t = {}; function n(i) { if (t[i]) return t[i].exports; var a = t[i] = { i: i, l: !1, exports: {} }; return e[i].call(a.exports, a, a.exports, n), a.l = !0, a.exports } return n.m = e, n.c = t, n.d = function(e, t, i) { n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: i }) }, n.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, n.t = function(e, t) { if (1 & t && (e = n(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var i = Object.create(null); if (n.r(i), Object.defineProperty(i, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var a in e) n.d(i, a, function(t) { return e[t] }.bind(null, a)); return i }, n.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e }; return n.d(t, "a", t), t }, n.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, n.p = "/", n(n.s = 78) }([ function(e, t, n) { "use strict"; var i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, a = n(11), o = n(65), r = Object.prototype.toString; function s(e) { return "[object Array]" === r.call(e) } function l(e) { return null !== e && "object" === (void 0 === e ? "undefined" : i(e)) } function c(e) { return "[object Function]" === r.call(e) } function u(e, t) { if (null !== e && void 0 !== e) if ("object" !== (void 0 === e ? "undefined" : i(e)) && (e = [e]), s(e)) for (var n = 0, a = e.length; n < a; n++) t.call(null, e[n], n, e); else for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.call(null, e[o], o, e) } e.exports = { isArray: s, isArrayBuffer: function(e) { return "[object ArrayBuffer]" === r.call(e) }, isBuffer: o, isFormData: function(e) { return "undefined" != typeof FormData && e instanceof FormData }, isArrayBufferView: function(e) { return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer }, isString: function(e) { return "string" == typeof e }, isNumber: function(e) { return "number" == typeof e }, isObject: l, isUndefined: function(e) { return void 0 === e }, isDate: function(e) { return "[object Date]" === r.call(e) }, isFile: function(e) { return "[object File]" === r.call(e) }, isBlob: function(e) { return "[object Blob]" === r.call(e) }, isFunction: c, isStream: function(e) { return l(e) && c(e.pipe) }, isURLSearchParams: function(e) { return "undefined" != typeof URLSearchParams && e instanceof URLSearchParams }, isStandardBrowserEnv: function() { return ("undefined" == typeof navigator || "ReactNative" !== navigator.product) && "undefined" != typeof window && "undefined" != typeof document }, forEach: u, merge: function e() { var t = {}; function n(n, a) { "object" === i(t[a]) && "object" === (void 0 === n ? "undefined" : i(n)) ? t[a] = e(t[a], n) : t[a] = n } for (var a = 0, o = arguments.length; a < o; a++) u(arguments[a], n); return t }, extend: function(e, t, n) { return u(t, function(t, i) { e[i] = n && "function" == typeof t ? a(t, n) : t }), e }, trim: function(e) { return e.replace(/^\s*/, "").replace(/\s*$/, "") } } }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = /mobile/i.test(window.navigator.userAgent), a = { secondToTime: function(e) { var t = Math.floor(e / 3600), n = Math.floor((e - 3600 * t) / 60), i = Math.floor(e - 3600 * t - 60 * n); return (t > 0 ? [t, n, i] : [n, i]).map(function(e) { return e < 10 ? "0" + e : "" + e }).join(":") }, getElementViewLeft: function(e) { var t = e.offsetLeft, n = e.offsetParent, i = document.body.scrollLeft + document.documentElement.scrollLeft; if (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement) for (; null !== n && n !== e;) t += n.offsetLeft, n = n.offsetParent; else for (; null !== n;) t += n.offsetLeft, n = n.offsetParent; return t - i }, getBoundingClientRectViewLeft: function(e) { var t = document.documentElement.scrollTop; if (e.getBoundingClientRect) { if ("number" != typeof this.getBoundingClientRectViewLeft.offset) { var n = document.createElement("div"); n.style.cssText = "position:absolute;top:0;left:0;", document.body.appendChild(n), this.getBoundingClientRectViewLeft.offset = -n.getBoundingClientRect().top - t, document.body.removeChild(n), n = null } var i = e.getBoundingClientRect(), a = this.getBoundingClientRectViewLeft.offset; return i.left + a } return this.getElementViewLeft(e) }, getScrollPosition: function() { return { left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0, top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 } }, setScrollPosition: function(e) { var t = e.left, n = void 0 === t ? 0 : t, i = e.top, a = void 0 === i ? 0 : i; this.isFirefox ? (document.documentElement.scrollLeft = n, document.documentElement.scrollTop = a) : window.scrollTo(n, a) }, isMobile: i, isFirefox: /firefox/i.test(window.navigator.userAgent), isChrome: /chrome/i.test(window.navigator.userAgent), storage: { set: function(e, t) { localStorage.setItem(e, t) }, get: function(e) { return localStorage.getItem(e) } }, cumulativeOffset: function(e) { var t = 0, n = 0; do { t += e.offsetTop || 0, n += e.offsetLeft || 0, e = e.offsetParent } while (e); return { top: t, left: n } }, nameMap: { dragStart: i ? "touchstart" : "mousedown", dragMove: i ? "touchmove" : "mousemove", dragEnd: i ? "touchend" : "mouseup" }, color2Number: function(e) { return "#" === e[0] && (e = e.substr(1)), 3 === e.length && (e = "" + e[0] + e[0] + e[1] + e[1] + e[2] + e[2]), parseInt(e, 16) + 0 & 16777215 }, number2Color: function(e) { return "#" + ("00000" + e.toString(16)).slice(-6) }, number2Type: function(e) { switch (e) { case 0: return "right"; case 1: return "top"; case 2: return "bottom"; default: return "right" } } }; t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = b(n(46)), a = b(n(45)), o = b(n(44)), r = b(n(43)), s = b(n(42)), l = b(n(41)), c = b(n(40)), u = b(n(39)), d = b(n(38)), p = b(n(37)), h = b(n(36)), f = b(n(35)), y = b(n(34)), m = b(n(33)), v = b(n(32)), g = b(n(31)); function b(e) { return e && e.__esModule ? e : { default: e } } var w = { play: i.default, pause: a.default, volumeUp: o.default, volumeDown: r.default, volumeOff: s.default, full: l.default, fullWeb: c.default, setting: u.default, right: d.default, comment: p.default, commentOff: h.default, send: f.default, pallette: y.default, camera: m.default, subtitle: v.default, loading: g.default }; t.default = w }, function(e, t, n) { "use strict"; (function(t) { var i = n(0), a = n(63), o = { "Content-Type": "application/x-www-form-urlencoded" }; function r(e, t) { !i.isUndefined(e) && i.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t) } var s, l = { adapter: ("undefined" != typeof XMLHttpRequest ? s = n(10) : void 0 !== t && (s = n(10)), s), transformRequest: [ function(e, t) { return a(t, "Content-Type"), i.isFormData(e) || i.isArrayBuffer(e) || i.isBuffer(e) || i.isStream(e) || i.isFile(e) || i.isBlob(e) ? e : i.isArrayBufferView(e) ? e.buffer : i.isURLSearchParams(e) ? (r(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : i.isObject(e) ? (r(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e } ], transformResponse: [ function(e) { if ("string" == typeof e) try { e = JSON.parse(e) } catch (e) {} return e } ], timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, validateStatus: function(e) { return e >= 200 && e < 300 } }; l.headers = { common: { Accept: "application/json, text/plain, */*" } }, i.forEach(["delete", "get", "head"], function(e) { l.headers[e] = {} }), i.forEach(["post", "put", "patch"], function(e) { l.headers[e] = i.merge(o) }), e.exports = l }).call(this, n(12)) }, function(e, t, n) { "use strict"; var i, a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }; i = function() { return this }(); try { i = i || Function("return this")() || (0, eval)("this") } catch (e) { "object" === ("undefined" == typeof window ? "undefined" : a(window)) && (i = window) } e.exports = i }, function(e, t, n) { var i = n(6); e.exports = function(e) { "use strict"; var t = "", n = (e = e || {}).enableSubtitle, a = e.subtitle, o = e.current, r = e.pic, s = i.$escape, l = e.screenshot, c = e.preload, u = e.url; n = a && "webvtt" === a.type; return t += '\n 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n]; u.push(new y(e, t)), 1 !== u.length || d || l(f) }, y.prototype.run = function() { this.fun.apply(null, this.array) }, o.title = "browser", o.browser = !0, o.env = {}, o.argv = [], o.version = "", o.versions = {}, o.on = m, o.addListener = m, o.once = m, o.off = m, o.removeListener = m, o.removeAllListeners = m, o.emit = m, o.prependListener = m, o.prependOnceListener = m, o.listeners = function(e) { return [] }, o.binding = function(e) { throw new Error("process.binding is not supported") }, o.cwd = function() { return "/" }, o.chdir = function(e) { throw new Error("process.chdir is not supported") }, o.umask = function() { return 0 } }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.container = t.template.infoPanel, this.template = t.template, this.video = t.video, this.player = t, this.template.infoPanelClose.addEventListener("click", function() { n.hide() }) } return i(e, [{ key: "show", value: function() { this.beginTime = Date.now(), this.update(), this.player.timer.enable("info"), this.player.timer.enable("fps"), this.container.classList.remove("dplayer-info-panel-hide") } }, { key: "hide", value: function() { this.player.timer.disable("info"), this.player.timer.disable("fps"), this.container.classList.add("dplayer-info-panel-hide") } }, { key: "triggle", value: function() { this.container.classList.contains("dplayer-info-panel-hide") ? this.show() : this.hide() } }, { key: "update", value: function() { this.template.infoVersion.innerHTML = "v1.25.0 fdcf45b", this.template.infoType.innerHTML = this.player.type, this.template.infoUrl.innerHTML = this.player.options.video.url, this.template.infoResolution.innerHTML = this.player.video.videoWidth + " x " + this.player.video.videoHeight, this.template.infoDuration.innerHTML = this.player.video.duration, this.player.options.danmaku && (this.template.infoDanmakuId.innerHTML = this.player.options.danmaku.id, this.template.infoDanmakuApi.innerHTML = this.player.options.danmaku.api, this.template.infoDanmakuAmount.innerHTML = this.player.danmaku.dan.length) } }, { key: "fps", value: function(e) { this.template.infoFPS.innerHTML = "" + e.toFixed(1) } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.player = t, this.shown = !1, Array.prototype.slice.call(this.player.template.menuItem).forEach(function(e, t) { n.player.options.contextmenu[t].click && e.addEventListener("click", function() { n.player.options.contextmenu[t].click(n.player), n.hide() }) }), this.player.container.addEventListener("contextmenu", function(e) { if (n.shown) n.hide(); else { var t = e || window.event; t.preventDefault(); var i = n.player.container.getBoundingClientRect(); n.show(t.clientX - i.left, t.clientY - i.top), n.player.template.mask.addEventListener("click", function() { n.hide() }) } }) } return i(e, [{ key: "show", value: function(e, t) { this.player.template.menu.classList.add("dplayer-menu-show"); var n = this.player.container.getBoundingClientRect(); e + this.player.template.menu.offsetWidth >= n.width ? (this.player.template.menu.style.right = n.width - e + "px", this.player.template.menu.style.left = "initial") : (this.player.template.menu.style.left = e + "px", this.player.template.menu.style.right = "initial"), t + this.player.template.menu.offsetHeight >= n.height ? (this.player.template.menu.style.bottom = n.height - t + "px", this.player.template.menu.style.top = "initial") : (this.player.template.menu.style.top = t + "px", this.player.template.menu.style.bottom = "initial"), this.player.template.mask.classList.add("dplayer-mask-show"), this.shown = !0, this.player.events.trigger("contextmenu_show") } }, { key: "hide", value: function() { this.player.template.mask.classList.remove("dplayer-mask-show"), this.player.template.menu.classList.remove("dplayer-menu-show"), this.shown = !1, this.player.events.trigger("contextmenu_hide") } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); t.default = function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), t.options.hotkey && document.addEventListener("keydown", function(e) { if (t.focus) { var n = document.activeElement.tagName.toUpperCase(), i = document.activeElement.getAttribute("contenteditable"); if ("INPUT" !== n && "TEXTAREA" !== n && "" !== i && "true" !== i) { var a = e || window.event, o = void 0; switch (a.keyCode) { case 32: a.preventDefault(), t.toggle(); break; case 37: a.preventDefault(), t.seek(t.video.currentTime - 5), t.controller.setAutoHide(); break; case 39: a.preventDefault(), t.seek(t.video.currentTime + 5), t.controller.setAutoHide(); break; case 38: a.preventDefault(), o = t.volume() + .1, t.volume(o); break; case 40: a.preventDefault(), o = t.volume() - .1, t.volume(o) } } } }), document.addEventListener("keydown", function(e) { switch ((e || window.event).keyCode) { case 27: t.fullScreen.isFullScreen("web") && t.fullScreen.cancel("web") } }) } }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(), o = n(1), r = (i = o) && i.__esModule ? i : { default: i }; var s = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.player = t, this.player.template.mask.addEventListener("click", function() { n.hide() }), this.player.template.commentButton.addEventListener("click", function() { n.show() }), this.player.template.commentSettingButton.addEventListener("click", function() { n.toggleSetting() }), this.player.template.commentColorSettingBox.addEventListener("click", function() { if (n.player.template.commentColorSettingBox.querySelector("input:checked+span")) { var e = n.player.template.commentColorSettingBox.querySelector("input:checked").value; n.player.template.commentSettingFill.style.fill = e, n.player.template.commentInput.style.color = e, n.player.template.commentSendFill.style.fill = e } }), this.player.template.commentInput.addEventListener("click", function() { n.hideSetting() }), this.player.template.commentInput.addEventListener("keydown", function(e) { 13 === (e || window.event).keyCode && n.send() }), this.player.template.commentSendButton.addEventListener("click", function() { n.send() }) } return a(e, [{ key: "show", value: function() { this.player.controller.disableAutoHide = !0, this.player.template.controller.classList.add("dplayer-controller-comment"), this.player.template.mask.classList.add("dplayer-mask-show"), this.player.container.classList.add("dplayer-show-controller"), this.player.template.commentInput.focus() } }, { key: "hide", value: function() { this.player.template.controller.classList.remove("dplayer-controller-comment"), this.player.template.mask.classList.remove("dplayer-mask-show"), this.player.container.classList.remove("dplayer-show-controller"), this.player.controller.disableAutoHide = !1, this.hideSetting() } }, { key: "showSetting", value: function() { this.player.template.commentSettingBox.classList.add("dplayer-comment-setting-open") } }, { key: "hideSetting", value: function() { this.player.template.commentSettingBox.classList.remove("dplayer-comment-setting-open") } }, { key: "toggleSetting", value: function() { this.player.template.commentSettingBox.classList.contains("dplayer-comment-setting-open") ? this.hideSetting() : this.showSetting() } }, { key: "send", value: function() { var e = this; this.player.template.commentInput.blur(), this.player.template.commentInput.value.replace(/^\s+|\s+$/g, "") ? this.player.danmaku.send({ text: this.player.template.commentInput.value, color: r.default.color2Number(this.player.container.querySelector(".dplayer-comment-setting-color input:checked").value), type: parseInt(this.player.container.querySelector(".dplayer-comment-setting-type input:checked").value) }, function() { e.player.template.commentInput.value = "", e.hide() }) : this.player.notice(this.player.tran("Please input danmaku content!")) } }]), e }(); t.default = s }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(), o = n(1), r = (i = o) && i.__esModule ? i : { default: i }; var s = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.player = t, this.player.template.mask.addEventListener("click", function() { n.hide() }), this.player.template.settingButton.addEventListener("click", function() { n.show() }), this.loop = this.player.options.loop, this.player.template.loopToggle.checked = this.loop, this.player.template.loop.addEventListener("click", function() { n.player.template.loopToggle.checked = !n.player.template.loopToggle.checked, n.player.template.loopToggle.checked ? n.loop = !0 : n.loop = !1, n.hide() }), this.showDanmaku = this.player.user.get("danmaku"), this.showDanmaku || this.player.danmaku && this.player.danmaku.hide(), this.player.template.showDanmakuToggle.checked = this.showDanmaku, this.player.template.showDanmaku.addEventListener("click", function() { n.player.template.showDanmakuToggle.checked = !n.player.template.showDanmakuToggle.checked, n.player.template.showDanmakuToggle.checked ? (n.showDanmaku = !0, n.player.danmaku.show()) : (n.showDanmaku = !1, n.player.danmaku.hide()), n.player.user.set("danmaku", n.showDanmaku ? 1 : 0), n.hide() }), this.unlimitDanmaku = this.player.user.get("unlimited"), this.player.template.unlimitDanmakuToggle.checked = this.unlimitDanmaku, this.player.template.unlimitDanmaku.addEventListener("click", function() { n.player.template.unlimitDanmakuToggle.checked = !n.player.template.unlimitDanmakuToggle.checked, n.player.template.unlimitDanmakuToggle.checked ? (n.unlimitDanmaku = !0, n.player.danmaku.unlimit(!0)) : (n.unlimitDanmaku = !1, n.player.danmaku.unlimit(!1)), n.player.user.set("unlimited", n.unlimitDanmaku ? 1 : 0), n.hide() }), this.player.template.speed.addEventListener("click", function() { n.player.template.settingBox.classList.add("dplayer-setting-box-narrow"), n.player.template.settingBox.classList.add("dplayer-setting-box-speed") }); for (var i = function(e) { n.player.template.speedItem[e].addEventListener("click", function() { n.player.speed(n.player.template.speedItem[e].dataset.speed), n.hide() }) }, a = 0; a < this.player.template.speedItem.length; a++) i(a); if (this.player.danmaku) { this.player.on("danmaku_opacity", function(e) { n.player.bar.set("danmaku", e, "width"), n.player.user.set("opacity", e) }), this.player.danmaku.opacity(this.player.user.get("opacity")); var o = function(e) { var t = e || window.event, i = ((t.clientX || t.changedTouches[0].clientX) - r.default.getBoundingClientRectViewLeft(n.player.template.danmakuOpacityBarWrap)) / 130; i = Math.max(i, 0), i = Math.min(i, 1), n.player.danmaku.opacity(i) }, s = function e() { document.removeEventListener(r.default.nameMap.dragEnd, e), document.removeEventListener(r.default.nameMap.dragMove, o), n.player.template.danmakuOpacityBox.classList.remove("dplayer-setting-danmaku-active") }; this.player.template.danmakuOpacityBarWrapWrap.addEventListener("click", function(e) { var t = e || window.event, i = ((t.clientX || t.changedTouches[0].clientX) - r.default.getBoundingClientRectViewLeft(n.player.template.danmakuOpacityBarWrap)) / 130; i = Math.max(i, 0), i = Math.min(i, 1), n.player.danmaku.opacity(i) }), this.player.template.danmakuOpacityBarWrapWrap.addEventListener(r.default.nameMap.dragStart, function() { document.addEventListener(r.default.nameMap.dragMove, o), document.addEventListener(r.default.nameMap.dragEnd, s), n.player.template.danmakuOpacityBox.classList.add("dplayer-setting-danmaku-active") }) } } return a(e, [{ key: "hide", value: function() { var e = this; this.player.template.settingBox.classList.remove("dplayer-setting-box-open"), this.player.template.mask.classList.remove("dplayer-mask-show"), setTimeout(function() { e.player.template.settingBox.classList.remove("dplayer-setting-box-narrow"), e.player.template.settingBox.classList.remove("dplayer-setting-box-speed") }, 300), this.player.controller.disableAutoHide = !1 } }, { key: "show", value: function() { this.player.template.settingBox.classList.add("dplayer-setting-box-open"), this.player.template.mask.classList.add("dplayer-mask-show"), this.player.controller.disableAutoHide = !0 } }]), e }(); t.default = s }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.container = t.container, this.barWidth = t.barWidth, this.container.style.backgroundImage = "url('" + t.url + "')", this.events = t.events } return i(e, [{ key: "resize", value: function(e, t) { this.container.style.width = e + "px", this.container.style.height = t + "px", this.container.style.top = 2 - t + "px" } }, { key: "show", value: function() { this.container.style.display = "block", this.events && this.events.trigger("thumbnails_show") } }, { key: "move", value: function(e) { this.container.style.backgroundPosition = "-" + 160 * (Math.ceil(e / this.barWidth * 100) - 1) + "px 0", this.container.style.left = Math.min(Math.max(e - this.container.offsetWidth / 2, -10), this.barWidth - 150) + "px" } }, { key: "hide", value: function() { this.container.style.display = "none", this.events && this.events.trigger("thumbnails_hide") } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(), a = s(n(1)), o = s(n(18)), r = s(n(2)); function s(e) { return e && e.__esModule ? e : { default: e } } var l = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.player = t, this.autoHideTimer = 0, a.default.isMobile || (this.player.container.addEventListener("mousemove", function() { n.setAutoHide() }), this.player.container.addEventListener("click", function() { n.setAutoHide() }), this.player.on("play", function() { n.setAutoHide() }), this.player.on("pause", function() { n.setAutoHide() })), this.initPlayButton(), this.initThumbnails(), this.initPlayedBar(), this.initFullButton(), this.initQualityButton(), this.initScreenshotButton(), this.initSubtitleButton(), this.initHighlights(), a.default.isMobile || this.initVolumeButton() } return i(e, [{ key: "initPlayButton", value: function() { var e = this; this.player.template.playButton.addEventListener("click", function() { e.player.toggle() }), a.default.isMobile ? (this.player.template.videoWrap.addEventListener("click", function() { e.toggle() }), this.player.template.controllerMask.addEventListener("click", function() { e.toggle() })) : (this.player.template.videoWrap.addEventListener("click", function() { e.player.toggle() }), this.player.template.controllerMask.addEventListener("click", function() { e.player.toggle() })) } }, { key: "initHighlights", value: function() { var e = this; this.player.on("durationchange", function() { if (1 !== e.player.video.duration && e.player.video.duration !== 1 / 0 && e.player.options.highlight) { var t = document.querySelectorAll(".dplayer-highlight"); [].slice.call(t, 0).forEach(function(t) { e.player.template.playedBarWrap.removeChild(t) }); for (var n = 0; n < e.player.options.highlight.length; n++) if (e.player.options.highlight[n].text && e.player.options.highlight[n].time) { var i = document.createElement("div"); i.classList.add("dplayer-highlight"), i.style.left = e.player.options.highlight[n].time / e.player.video.duration * 100 + "%", i.innerHTML = '' + e.player.options.highlight[n].text + "", e.player.template.playedBarWrap.insertBefore(i, e.player.template.playedBarTime) } } }) } }, { key: "initThumbnails", value: function() { var e = this; this.player.options.video.thumbnails && (this.thumbnails = new o.default({ container: this.player.template.barPreview, barWidth: this.player.template.barWrap.offsetWidth, url: this.player.options.video.thumbnails, events: this.player.events }), this.player.on("loadedmetadata", function() { e.thumbnails.resize(160, e.player.video.videoHeight / e.player.video.videoWidth * 160) })) } }, { key: "initPlayedBar", value: function() { var e = this, t = function(t) { var n = ((t.clientX || t.changedTouches[0].clientX) - a.default.getBoundingClientRectViewLeft(e.player.template.playedBarWrap)) / e.player.template.playedBarWrap.clientWidth; n = Math.max(n, 0), n = Math.min(n, 1), e.player.bar.set("played", n, "width"), e.player.template.ptime.innerHTML = a.default.secondToTime(n * e.player.video.duration) }, n = function n(i) { document.removeEventListener(a.default.nameMap.dragEnd, n), document.removeEventListener(a.default.nameMap.dragMove, t); var o = ((i.clientX || i.changedTouches[0].clientX) - a.default.getBoundingClientRectViewLeft(e.player.template.playedBarWrap)) / e.player.template.playedBarWrap.clientWidth; o = Math.max(o, 0), o = Math.min(o, 1), e.player.bar.set("played", o, "width"), e.player.seek(e.player.bar.get("played") * e.player.video.duration), e.player.timer.enable("progress") }; this.player.template.playedBarWrap.addEventListener(a.default.nameMap.dragStart, function() { e.player.timer.disable("progress"), document.addEventListener(a.default.nameMap.dragMove, t), document.addEventListener(a.default.nameMap.dragEnd, n) }), this.player.template.playedBarWrap.addEventListener(a.default.nameMap.dragMove, function(t) { if (e.player.video.duration) { var n = a.default.cumulativeOffset(e.player.template.playedBarWrap).left, i = (t.clientX || t.changedTouches[0].clientX) - n; if (i < 0 || i > e.player.template.playedBarWrap.offsetWidth) return; var o = e.player.video.duration * (i / e.player.template.playedBarWrap.offsetWidth); a.default.isMobile && e.thumbnails && e.thumbnails.show(), e.thumbnails && e.thumbnails.move(i), e.player.template.playedBarTime.style.left = i - (o >= 3600 ? 25 : 20) + "px", e.player.template.playedBarTime.innerText = a.default.secondToTime(o), e.player.template.playedBarTime.classList.remove("hidden") } }), this.player.template.playedBarWrap.addEventListener(a.default.nameMap.dragEnd, function() { a.default.isMobile && e.thumbnails && e.thumbnails.hide() }), a.default.isMobile || (this.player.template.playedBarWrap.addEventListener("mouseenter", function() { e.player.video.duration && (e.thumbnails && e.thumbnails.show(), e.player.template.playedBarTime.classList.remove("hidden")) }), this.player.template.playedBarWrap.addEventListener("mouseleave", function() { e.player.video.duration && (e.thumbnails && e.thumbnails.hide(), e.player.template.playedBarTime.classList.add("hidden")) })) } }, { key: "initFullButton", value: function() { var e = this; this.player.template.browserFullButton.addEventListener("click", function() { e.player.fullScreen.toggle("browser") }), this.player.template.webFullButton.addEventListener("click", function() { e.player.fullScreen.toggle("web") }) } }, { key: "initVolumeButton", value: function() { var e = this, t = function(t) { var n = t || window.event, i = ((n.clientX || n.changedTouches[0].clientX) - a.default.getBoundingClientRectViewLeft(e.player.template.volumeBarWrap) - 5.5) / 35; e.player.volume(i) }, n = function n() { document.removeEventListener(a.default.nameMap.dragEnd, n), document.removeEventListener(a.default.nameMap.dragMove, t), e.player.template.volumeButton.classList.remove("dplayer-volume-active") }; this.player.template.volumeBarWrapWrap.addEventListener("click", function(t) { var n = t || window.event, i = ((n.clientX || n.changedTouches[0].clientX) - a.default.getBoundingClientRectViewLeft(e.player.template.volumeBarWrap) - 5.5) / 35; e.player.volume(i) }), this.player.template.volumeBarWrapWrap.addEventListener(a.default.nameMap.dragStart, function() { document.addEventListener(a.default.nameMap.dragMove, t), document.addEventListener(a.default.nameMap.dragEnd, n), e.player.template.volumeButton.classList.add("dplayer-volume-active") }), this.player.template.volumeButtonIcon.addEventListener("click", function() { e.player.video.muted ? (e.player.video.muted = !1, e.player.switchVolumeIcon(), e.player.bar.set("volume", e.player.volume(), "width")) : (e.player.video.muted = !0, e.player.template.volumeIcon.innerHTML = r.default.volumeOff, e.player.bar.set("volume", 0, "width")) }) } }, { key: "initQualityButton", value: function() { var e = this; this.player.options.video.quality && this.player.template.qualityList.addEventListener("click", function(t) { t.target.classList.contains("dplayer-quality-item") && e.player.switchQuality(t.target.dataset.index) }) } }, { key: "initScreenshotButton", value: function() { var e = this; this.player.options.screenshot && this.player.template.camareButton.addEventListener("click", function() { var t = document.createElement("canvas"); t.width = e.player.video.videoWidth, t.height = e.player.video.videoHeight, t.getContext("2d").drawImage(e.player.video, 0, 0, t.width, t.height); var n = void 0; t.toBlob(function(e) { n = URL.createObjectURL(e); var t = document.createElement("a"); t.href = n, t.download = "DPlayer.png", t.style.display = "none", document.body.appendChild(t), t.click(), document.body.removeChild(t), URL.revokeObjectURL(n) }), e.player.events.trigger("screenshot", n) }) } }, { key: "initSubtitleButton", value: function() { var e = this; this.player.options.subtitle && (this.player.events.on("subtitle_show", function() { e.player.template.subtitleButton.dataset.balloon = e.player.tran("Hide subtitle"), e.player.template.subtitleButtonInner.style.opacity = "", e.player.user.set("subtitle", 1) }), this.player.events.on("subtitle_hide", function() { e.player.template.subtitleButton.dataset.balloon = e.player.tran("Show subtitle"), e.player.template.subtitleButtonInner.style.opacity = "0.4", e.player.user.set("subtitle", 0) }), this.player.template.subtitleButton.addEventListener("click", function() { e.player.subtitle.toggle() })) } }, { key: "setAutoHide", value: function() { var e = this; this.show(), clearTimeout(this.autoHideTimer), this.autoHideTimer = setTimeout(function() { !e.player.video.played.length || e.player.paused || e.disableAutoHide || e.hide() }, 3e3) } }, { key: "show", value: function() { this.player.container.classList.remove("dplayer-hide-controller") } }, { key: "hide", value: function() { this.player.container.classList.add("dplayer-hide-controller"), this.player.setting.hide(), this.player.comment && this.player.comment.hide() } }, { key: "isShow", value: function() { return !this.player.container.classList.contains("dplayer-hide-controller") } }, { key: "toggle", value: function() { this.isShow() ? this.hide() : this.show() } }, { key: "destroy", value: function() { clearTimeout(this.autoHideTimer) } }]), e }(); t.default = l }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.container = t, this.container.addEventListener("animationend", function() { n.container.classList.remove("dplayer-bezel-transition") }) } return i(e, [{ key: "switch", value: function(e) { this.container.innerHTML = e, this.container.classList.add("dplayer-bezel-transition") } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.player = t, window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(e) { window.setTimeout(e, 1e3 / 60) }, this.types = ["loading", "info", "fps"], this.init() } return i(e, [{ key: "init", value: function() { var e = this; this.types.map(function(t) { return "fps" !== t && e["init" + t + "Checker"](), t }) } }, { key: "initloadingChecker", value: function() { var e = this, t = 0, n = 0, i = !1; this.loadingChecker = setInterval(function() { e.enableloadingChecker && (n = e.player.video.currentTime, i || n !== t || e.player.video.paused || (e.player.container.classList.add("dplayer-loading"), i = !0), i && n > t && !e.player.video.paused && (e.player.container.classList.remove("dplayer-loading"), i = !1), t = n) }, 100) } }, { key: "initfpsChecker", value: function() { var e = this; window.requestAnimationFrame(function() { if (e.enablefpsChecker) if (e.initfpsChecker(), e.fpsStart) { e.fpsIndex++; var t = new Date; t - e.fpsStart > 1e3 && (e.player.infoPanel.fps(e.fpsIndex / (t - e.fpsStart) * 1e3), e.fpsStart = new Date, e.fpsIndex = 0) } else e.fpsStart = new Date, e.fpsIndex = 0; else e.fpsStart = 0, e.fpsIndex = 0 }) } }, { key: "initinfoChecker", value: function() { var e = this; this.infoChecker = setInterval(function() { e.enableinfoChecker && e.player.infoPanel.update() }, 1e3) } }, { key: "enable", value: function(e) { this["enable" + e + "Checker"] = !0, "fps" === e && this.initfpsChecker() } }, { key: "disable", value: function(e) { this["enable" + e + "Checker"] = !1 } }, { key: "destroy", value: function() { var e = this; this.types.map(function(t) { return e["enable" + t + "Checker"] = !1, e[t + "Checker"] && clearInterval(e[t + "Checker"]), t }) } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.elements = {}, this.elements.volume = t.volumeBar, this.elements.played = t.playedBar, this.elements.loaded = t.loadedBar, this.elements.danmaku = t.danmakuOpacityBar } return i(e, [{ key: "set", value: function(e, t, n) { t = Math.max(t, 0), t = Math.min(t, 1), this.elements[e].style[n] = 100 * t + "%" } }, { key: "get", value: function(e) { return parseFloat(this.elements[e].style.width) / 100 } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e(t, n, i, a) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.container = t, this.video = n, this.options = i, this.events = a, this.init() } return i(e, [{ key: "init", value: function() { var e = this; if (this.container.style.fontSize = this.options.fontSize, this.container.style.bottom = this.options.bottom, this.container.style.color = this.options.color, this.video.textTracks && this.video.textTracks[0]) { var t = this.video.textTracks[0]; t.oncuechange = function() { var n = t.activeCues[0]; if (n) { e.container.innerHTML = ""; var i = document.createElement("p"); i.appendChild(n.getCueAsHTML()), e.container.appendChild(i) } else e.container.innerHTML = ""; e.events.trigger("subtitle_change") } } } }, { key: "show", value: function() { this.container.classList.remove("dplayer-subtitle-hide"), this.events.trigger("subtitle_show") } }, { key: "hide", value: function() { this.container.classList.add("dplayer-subtitle-hide"), this.events.trigger("subtitle_hide") } }, { key: "toggle", value: function() { this.container.classList.contains("dplayer-subtitle-hide") ? this.show() : this.hide() } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(), o = n(1), r = (i = o) && i.__esModule ? i : { default: i }; var s = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.storageName = { opacity: "dplayer-danmaku-opacity", volume: "dplayer-volume", unlimited: "dplayer-danmaku-unlimited", danmaku: "dplayer-danmaku-show", subtitle: "dplayer-subtitle-show" }, this.default = { opacity: .7, volume: t.options.hasOwnProperty("volume") ? t.options.volume : .7, unlimited: (t.options.danmaku && t.options.danmaku.unlimited ? 1 : 0) || 0, danmaku: 1, subtitle: 1 }, this.data = {}, this.init() } return a(e, [{ key: "init", value: function() { for (var e in this.storageName) { var t = this.storageName[e]; this.data[e] = parseFloat(r.default.storage.get(t) || this.default[e]) } } }, { key: "get", value: function(e) { return this.data[e] } }, { key: "set", value: function(e, t) { this.data[e] = t, r.default.storage.set(this.storageName[e], t) } }]), e }(); t.default = s }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(), o = n(1), r = (i = o) && i.__esModule ? i : { default: i }; var s = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.player = t, this.player.events.on("webfullscreen", function() { n.player.resize() }), this.player.events.on("webfullscreen_cancel", function() { n.player.resize(), r.default.setScrollPosition(n.lastScrollPosition) }); var i = function() { n.player.resize(), n.isFullScreen("browser") ? n.player.events.trigger("fullscreen") : (r.default.setScrollPosition(n.lastScrollPosition), n.player.events.trigger("fullscreen_cancel")) }, a = function() { var e = document.fullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; e && e !== n.player.container || (n.player.resize(), e ? n.player.events.trigger("fullscreen") : (r.default.setScrollPosition(n.lastScrollPosition), n.player.events.trigger("fullscreen_cancel"))) }; /Firefox/.test(navigator.userAgent) ? (document.addEventListener("mozfullscreenchange", a), document.addEventListener("fullscreenchange", a)) : (this.player.container.addEventListener("fullscreenchange", i), this.player.container.addEventListener("webkitfullscreenchange", i), document.addEventListener("msfullscreenchange", a), document.addEventListener("MSFullscreenChange", a)) } return a(e, [{ key: "isFullScreen", value: function() { switch (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser") { case "browser": return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement; case "web": return this.player.container.classList.contains("dplayer-fulled") } } }, { key: "request", value: function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser", t = "browser" === e ? "web" : "browser", n = this.isFullScreen(t); switch (n || (this.lastScrollPosition = r.default.getScrollPosition()), e) { case "browser": this.player.container.requestFullscreen ? this.player.container.requestFullscreen() : this.player.container.mozRequestFullScreen ? this.player.container.mozRequestFullScreen() : this.player.container.webkitRequestFullscreen ? this.player.container.webkitRequestFullscreen() : this.player.video.webkitEnterFullscreen ? this.player.video.webkitEnterFullscreen() : this.player.video.webkitEnterFullScreen ? this.player.video.webkitEnterFullScreen() : this.player.container.msRequestFullscreen && this.player.container.msRequestFullscreen(); break; case "web": this.player.container.classList.add("dplayer-fulled"), document.body.classList.add("dplayer-web-fullscreen-fix"), this.player.events.trigger("webfullscreen") } n && this.cancel(t) } }, { key: "cancel", value: function() { switch (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser") { case "browser": document.cancelFullScreen ? document.cancelFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.webkitCancelFullscreen ? document.webkitCancelFullscreen() : document.msCancelFullScreen ? document.msCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen(); break; case "web": this.player.container.classList.remove("dplayer-fulled"), document.body.classList.remove("dplayer-web-fullscreen-fix"), this.player.events.trigger("webfullscreen_cancel") } } }, { key: "toggle", value: function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser"; this.isFullScreen(e) ? this.cancel(e) : this.request(e) } }]), e }(); t.default = s }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(); var a = function() { function e() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.events = {}, this.videoEvents = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "mozaudioavailable", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"], this.playerEvents = ["screenshot", "thumbnails_show", "thumbnails_hide", "danmaku_show", "danmaku_hide", "danmaku_clear", "danmaku_loaded", "danmaku_send", "danmaku_opacity", "contextmenu_show", "contextmenu_hide", "notice_show", "notice_hide", "quality_start", "quality_end", "destroy", "resize", "fullscreen", "fullscreen_cancel", "webfullscreen", "webfullscreen_cancel", "subtitle_show", "subtitle_hide", "subtitle_change"] } return i(e, [{ key: "on", value: function(e, t) { this.type(e) && "function" == typeof t && (this.events[e] || (this.events[e] = []), this.events[e].push(t)) } }, { key: "trigger", value: function(e, t) { if (this.events[e] && this.events[e].length) for (var n = 0; n < this.events[e].length; n++) this.events[e][n](t) } }, { key: "type", value: function(e) { return -1 !== this.playerEvents.indexOf(e) ? "player" : -1 !== this.videoEvents.indexOf(e) ? "video" : (console.error("Unknown event name: " + e), null) } }]), e }(); t.default = a }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, o = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(), r = n(1), s = (i = r) && i.__esModule ? i : { default: i }; var l = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.options = t, this.container = this.options.container, this.danTunnel = { right: {}, top: {}, bottom: {} }, this.danIndex = 0, this.dan = [], this.showing = !0, this._opacity = this.options.opacity, this.events = this.options.events, this.unlimited = this.options.unlimited, this._measure(""), this.load() } return o(e, [{ key: "load", value: function() { var e = this, t = void 0; t = this.options.api.maximum ? this.options.api.address + "v3/?id=" + this.options.api.id + "&max=" + this.options.api.maximum : this.options.api.address + "v3/?id=" + this.options.api.id; var n = (this.options.api.addition || []).slice(0); n.push(t), this.events && this.events.trigger("danmaku_load_start", n), this._readAllEndpoints(n, function(t) { e.dan = [].concat.apply([], t).sort(function(e, t) { return e.time - t.time }), window.requestAnimationFrame(function() { e.frame() }), e.options.callback(), e.events && e.events.trigger("danmaku_load_end") }) } }, { key: "reload", value: function(e) { this.options.api = e, this.dan = [], this.clear(), this.load() } }, { key: "_readAllEndpoints", value: function(e, t) { for (var n = this, i = [], a = 0, o = function(o) { n.options.apiBackend.read({ url: e[o], success: function(n) { i[o] = n, ++a === e.length && t(i) }, error: function(r) { n.options.error(r || n.options.tran("Danmaku load failed")), i[o] = [], ++a === e.length && t(i) } }) }, r = 0; r < e.length; ++r) o(r) } }, { key: "send", value: function(e, t) { var n = this, i = { token: this.options.api.token, id: this.options.api.id, author: this.options.api.user, time: this.options.time(), text: e.text, color: e.color, type: e.type }; this.options.apiBackend.send({ url: this.options.api.address + "v3/", data: i, success: t, error: function(e) { n.options.error(e || n.options.tran("Danmaku send failed")) } }), this.dan.splice(this.danIndex, 0, i), this.danIndex++; var a = { text: this.htmlEncode(i.text), color: i.color, type: i.type, border: "2px solid " + this.options.borderColor }; this.draw(a), this.events && this.events.trigger("danmaku_send", i) } }, { key: "frame", value: function() { var e = this; if (this.dan.length && !this.paused && this.showing) { for (var t = this.dan[this.danIndex], n = []; t && this.options.time() > parseFloat(t.time);) n.push(t), t = this.dan[++this.danIndex]; this.draw(n) } window.requestAnimationFrame(function() { e.frame() }) } }, { key: "opacity", value: function(e) { if (void 0 !== e) { for (var t = this.container.getElementsByClassName("dplayer-danmaku-item"), n = 0; n < t.length; n++) t[n].style.opacity = e; this._opacity = e, this.events && this.events.trigger("danmaku_opacity", this._opacity) } return this._opacity } }, { key: "draw", value: function(e) { var t = this; if (this.showing) { var n = this.options.height, i = this.container.offsetWidth, o = this.container.offsetHeight, r = parseInt(o / n), l = function(e) { var n = e.offsetWidth || parseInt(e.style.width), i = e.getBoundingClientRect().right || t.container.getBoundingClientRect().right + n; return t.container.getBoundingClientRect().right - i }, c = function(e) { return (i + e) / 5 }, u = function(e, n, o) { for (var s = i / c(o), u = function(a) { var o = t.danTunnel[n][a + ""]; if (!o || !o.length) return t.danTunnel[n][a + ""] = [e], e.addEventListener("animationend", function() { t.danTunnel[n][a + ""].splice(0, 1) }), { v: a % r }; if ("right" !== n) return "continue"; for (var u = 0; u < o.length; u++) { var d = l(o[u]) - 10; if (d <= i - s * c(parseInt(o[u].style.width)) || d <= 0) break; if (u === o.length - 1) return t.danTunnel[n][a + ""].push(e), e.addEventListener("animationend", function() { t.danTunnel[n][a + ""].splice(0, 1) }), { v: a % r } } }, d = 0; t.unlimited || d < r; d++) { var p = u(d); switch (p) { case "continue": continue; default: if ("object" === (void 0 === p ? "undefined" : a(p))) return p.v } } return -1 }; "[object Array]" !== Object.prototype.toString.call(e) && (e = [e]); for (var d = document.createDocumentFragment(), p = function(a) { e[a].type = s.default.number2Type(e[a].type), e[a].color || (e[a].color = 16777215); var o = document.createElement("div"); o.classList.add("dplayer-danmaku-item"), o.classList.add("dplayer-danmaku-" + e[a].type), e[a].border ? o.innerHTML = '' + e[a].text + "" : o.innerHTML = e[a].text, o.style.opacity = t._opacity, o.style.color = s.default.number2Color(e[a].color), o.addEventListener("animationend", function() { t.container.removeChild(o) }); var r = t._measure(e[a].text), l = void 0; switch (e[a].type) { case "right": (l = u(o, e[a].type, r)) >= 0 && (o.style.width = r + 1 + "px", o.style.top = n * l + "px", o.style.transform = "translateX(-" + i + "px)"); break; case "top": (l = u(o, e[a].type)) >= 0 && (o.style.top = n * l + "px"); break; case "bottom": (l = u(o, e[a].type)) >= 0 && (o.style.bottom = n * l + "px"); break; default: console.error("Can't handled danmaku type: " + e[a].type) } l >= 0 && (o.classList.add("dplayer-danmaku-move"), d.appendChild(o)) }, h = 0; h < e.length; h++) p(h); return this.container.appendChild(d), d } } }, { key: "play", value: function() { this.paused = !1 } }, { key: "pause", value: function() { this.paused = !0 } }, { key: "_measure", value: function(e) { if (!this.context) { var t = getComputedStyle(this.container.getElementsByClassName("dplayer-danmaku-item")[0], null); this.context = document.createElement("canvas").getContext("2d"), this.context.font = t.getPropertyValue("font") } return this.context.measureText(e).width } }, { key: "seek", value: function() { this.clear(); for (var e = 0; e < this.dan.length; e++) { if (this.dan[e].time >= this.options.time()) { this.danIndex = e; break } this.danIndex = this.dan.length } } }, { key: "clear", value: function() { this.danTunnel = { right: {}, top: {}, bottom: {} }, this.danIndex = 0, this.options.container.innerHTML = "", this.events && this.events.trigger("danmaku_clear") } }, { key: "htmlEncode", value: function(e) { return e.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/") } }, { key: "resize", value: function() { for (var e = this.container.offsetWidth, t = this.container.getElementsByClassName("dplayer-danmaku-item"), n = 0; n < t.length; n++) t[n].style.transform = "translateX(-" + e + "px)" } }, { key: "hide", value: function() { this.showing = !1, this.pause(), this.clear(), this.events && this.events.trigger("danmaku_hide") } }, { key: "show", value: function() { this.seek(), this.showing = !0, this.play(), this.events && this.events.trigger("danmaku_show") } }, { key: "unlimit", value: function(e) { this.unlimited = e } }]), e }(); t.default = l }, function(e, t, n) { "use strict"; (function(t) { e.exports = !1; try { e.exports = "[object process]" === Object.prototype.toString.call(t.process) } catch (e) {} }).call(this, n(4)) }, function(e, t, n) { "use strict"; (function(t) { var i = n(28), a = Object.create(i ? t : window), o = /["&'<>]/; a.$escape = function(e) { return function(e) { var t = "" + e, n = o.exec(t); if (!n) return e; var i = "", a = void 0, r = void 0, s = void 0; for (a = n.index, r = 0; a < t.length; a++) { switch (t.charCodeAt(a)) { case 34: s = """; break; case 38: s = "&"; break; case 39: s = "'"; break; case 60: s = "<"; break; case 62: s = ">"; break; default: continue } r !== a && (i += t.substring(r, a)), r = a + 1, i += s } return r !== a ? i + t.substring(r, a) : i }(function e(t) { "string" != typeof t && (t = void 0 === t || null === t ? "" : "function" == typeof t ? e(t.call(t)) : JSON.stringify(t)); return t }(e)) }, a.$each = function(e, t) { if (Array.isArray(e)) for (var n = 0, i = e.length; n < i; n++) t(e[n], n); else for (var a in e) t(e[a], a) }, e.exports = a }).call(this, n(4)) }, function(e, t, n) { var i = n(6); e.exports = function(e) { "use strict"; e = e || {}; var t, a = "", o = (arguments[1], e.video), r = e.options, s = i.$escape, l = e.tran, c = e.icons, u = e.index, d = i.$each; e.$value, e.$index; var next=' '; a += '
\n
\n ', t = n(5)(o), a += t, a += "\n ", r.logo && (a += '\n \n '), a += '\n
> 8 - s % 1 * 8)) { if ((n = o.charCodeAt(s += .75)) > 255) throw new a; t = t << 8 | n } return r } }, function(e, t, n) { "use strict"; var i = n(0); e.exports = i.isStandardBrowserEnv() ? function() { var e, t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a"); function a(e) { var i = e; return t && (n.setAttribute("href", i), i = n.href), n.setAttribute("href", i), { href: n.href, protocol: n.protocol ? n.protocol.replace(/:$/, "") : "", host: n.host, search: n.search ? n.search.replace(/^\?/, "") : "", hash: n.hash ? n.hash.replace(/^#/, "") : "", hostname: n.hostname, port: n.port, pathname: "/" === n.pathname.charAt(0) ? n.pathname : "/" + n.pathname } } return e = a(window.location.href), function(t) { var n = i.isString(t) ? a(t) : t; return n.protocol === e.protocol && n.host === e.host } }() : function() { return !0 } }, function(e, t, n) { "use strict"; var i = n(0), a = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"]; e.exports = function(e) { var t, n, o, r = {}; return e ? (i.forEach(e.split("\n"), function(e) { if (o = e.indexOf(":"), t = i.trim(e.substr(0, o)).toLowerCase(), n = i.trim(e.substr(o + 1)), t) { if (r[t] && a.indexOf(t) >= 0) return; r[t] = "set-cookie" === t ? (r[t] ? r[t] : []).concat([n]) : r[t] ? r[t] + ", " + n : n } }), r) : r } }, function(e, t, n) { "use strict"; var i = n(0); function a(e) { return encodeURIComponent(e).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]") } e.exports = function(e, t, n) { if (!t) return e; var o; if (n) o = n(t); else if (i.isURLSearchParams(t)) o = t.toString(); else { var r = []; i.forEach(t, function(e, t) { null !== e && void 0 !== e && (i.isArray(e) ? t += "[]" : e = [e], i.forEach(e, function(e) { i.isDate(e) ? e = e.toISOString() : i.isObject(e) && (e = JSON.stringify(e)), r.push(a(t) + "=" + a(e)) })) }), o = r.join("&") } return o && (e += (-1 === e.indexOf("?") ? "?" : "&") + o), e } }, function(e, t, n) { "use strict"; e.exports = function(e, t, n, i, a) { return e.config = t, n && (e.code = n), e.request = i, e.response = a, e } }, function(e, t, n) { "use strict"; var i = n(9); e.exports = function(e, t, n) { var a = n.config.validateStatus; n.status && a && !a(n.status) ? t(i("Request failed with status code " + n.status, n.config, null, n.request, n)) : e(n) } }, function(e, t, n) { "use strict"; var i = n(0); e.exports = function(e, t) { i.forEach(e, function(n, i) { i !== t && i.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[i]) }) } }, function(e, t, n) { "use strict"; var i = n(3), a = n(0), o = n(55), r = n(54); function s(e) { this.defaults = e, this.interceptors = { request: new o, response: new o } } s.prototype.request = function(e) { "string" == typeof e && (e = a.merge({ url: arguments[0] }, arguments[1])), (e = a.merge(i, { method: "get" }, this.defaults, e)).method = e.method.toLowerCase(); var t = [r, void 0], n = Promise.resolve(e); for (this.interceptors.request.forEach(function(e) { t.unshift(e.fulfilled, e.rejected) }), this.interceptors.response.forEach(function(e) { t.push(e.fulfilled, e.rejected) }); t.length;) n = n.then(t.shift(), t.shift()); return n }, a.forEach(["delete", "get", "head", "options"], function(e) { s.prototype[e] = function(t, n) { return this.request(a.merge(n || {}, { method: e, url: t })) } }), a.forEach(["post", "put", "patch"], function(e) { s.prototype[e] = function(t, n, i) { return this.request(a.merge(i || {}, { method: e, url: t, data: n })) } }), e.exports = s }, function(e, t, n) { "use strict"; function i(e) { return !!e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e) } e.exports = function(e) { return null != e && (i(e) || function(e) { return "function" == typeof e.readFloatLE && "function" == typeof e.slice && i(e.slice(0, 0)) }(e) || !!e._isBuffer) } }, function(e, t, n) { "use strict"; var i = n(0), a = n(11), o = n(64), r = n(3); function s(e) { var t = new o(e), n = a(o.prototype.request, t); return i.extend(n, o.prototype, t), i.extend(n, t), n } var l = s(r); l.Axios = o, l.create = function(e) { return s(i.merge(r, e)) }, l.Cancel = n(7), l.CancelToken = n(50), l.isCancel = n(8), l.all = function(e) { return Promise.all(e) }, l.spread = n(49), e.exports = l, e.exports.default = l }, function(e, t, n) { "use strict"; e.exports = n(66) }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = n(67), o = (i = a) && i.__esModule ? i : { default: i }; t.default = { send: function(e) { o.default.post(e.url, e.data).then(function(t) { var n = t.data; n && 0 === n.code ? e.success && e.success(n) : e.error && e.error(n && n.msg) }).catch(function(t) { console.error(t), e.error && e.error() }) }, read: function(e) { o.default.get(e.url).then(function(t) { var n = t.data; n && 0 === n.code ? e.success && e.success(n.data.map(function(e) { return { time: e[0], type: e[1], color: e[2], author: e[3], text: e[4] } })) : e.error && e.error(n && n.msg) }).catch(function(t) { console.error(t), e.error && e.error() }) } } }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, o = n(68), r = (i = o) && i.__esModule ? i : { default: i }; t.default = function(e) { var t = { container: e.element || document.getElementsByClassName("dplayer")[0], live: !1, autoplay: !1, theme: "#b7daff", loop: !1, lang: (navigator.language || navigator.browserLanguage).toLowerCase(), screenshot: !1, hotkey: !0, preload: "metadata", volume: .7, apiBackend: r.default, video: {}, contextmenu: [], mutex: !0 }; for (var n in t) t.hasOwnProperty(n) && !e.hasOwnProperty(n) && (e[n] = t[n]); return e.video && !e.video.type && (e.video.type = "auto"), "object" === a(e.danmaku) && e.danmaku && !e.danmaku.user && (e.danmaku.user = "DIYgod"), e.subtitle && (!e.subtitle.type && (e.subtitle.type = "webvtt"), !e.subtitle.fontSize && (e.subtitle.fontSize = "20px"), !e.subtitle.bottom && (e.subtitle.bottom = "40px"), !e.subtitle.color && (e.subtitle.color = "#fff")), e.video.quality && (e.video.url = e.video.quality[e.video.defaultQuality].url), e.lang && (e.lang = e.lang.toLowerCase()), e.contextmenu = e.contextmenu.concat([{ text: "Video info", click: function(e) { e.infoPanel.triggle() } }, { text: "About Yimian", link: "https://www.yimian.xyz" }, { text: "DPlayer v1.25.0&author", link: "https://cn.yimian.xyz/etc/dplayer" }]), e } }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), t.default = function(e) { var t = this.constructor; return this.then(function(n) { return t.resolve(e()).then(function() { return n }) }, function(n) { return t.resolve(e()).then(function() { return t.reject(n) }) }) } }, function(e, t, n) { "use strict"; (function(e, t) { ! function(e, n) { if (!e.setImmediate) { var i, a, o, r, s, l = 1, c = {}, u = !1, d = e.document, p = Object.getPrototypeOf && Object.getPrototypeOf(e); p = p && p.setTimeout ? p : e, "[object process]" === {}.toString.call(e.process) ? i = function(e) { t.nextTick(function() { f(e) }) } : ! function() { if (e.postMessage && !e.importScripts) { var t = !0, n = e.onmessage; return e.onmessage = function() { t = !1 }, e.postMessage("", "*"), e.onmessage = n, t } }() ? e.MessageChannel ? ((o = new MessageChannel).port1.onmessage = function(e) { f(e.data) }, i = function(e) { o.port2.postMessage(e) }) : d && "onreadystatechange" in d.createElement("script") ? (a = d.documentElement, i = function(e) { var t = d.createElement("script"); t.onreadystatechange = function() { f(e), t.onreadystatechange = null, a.removeChild(t), t = null }, a.appendChild(t) }) : i = function(e) { setTimeout(f, 0, e) } : (r = "setImmediate$" + Math.random() + "$", s = function(t) { t.source === e && "string" == typeof t.data && 0 === t.data.indexOf(r) && f(+t.data.slice(r.length)) }, e.addEventListener ? e.addEventListener("message", s, !1) : e.attachEvent("onmessage", s), i = function(t) { e.postMessage(r + t, "*") }), p.setImmediate = function(e) { "function" != typeof e && (e = new Function("" + e)); for (var t = new Array(arguments.length - 1), n = 0; n < t.length; n++) t[n] = arguments[n + 1]; var a = { callback: e, args: t }; return c[l] = a, i(l), l++ }, p.clearImmediate = h } function h(e) { delete c[e] } function f(e) { if (u) setTimeout(f, 0, e); else { var t = c[e]; if (t) { u = !0; try { ! function(e) { var t = e.callback, i = e.args; switch (i.length) { case 0: t(); break; case 1: t(i[0]); break; case 2: t(i[0], i[1]); break; case 3: t(i[0], i[1], i[2]); break; default: t.apply(n, i) } }(t) } finally { h(e), u = !1 } } } } }("undefined" == typeof self ? void 0 === e ? void 0 : e : self) }).call(this, n(4), n(12)) }, function(e, t, n) { "use strict"; var i = Function.prototype.apply; function a(e, t) { this._id = e, this._clearFn = t } t.setTimeout = function() { return new a(i.call(setTimeout, window, arguments), clearTimeout) }, t.setInterval = function() { return new a(i.call(setInterval, window, arguments), clearInterval) }, t.clearTimeout = t.clearInterval = function(e) { e && e.close() }, a.prototype.unref = a.prototype.ref = function() {}, a.prototype.close = function() { this._clearFn.call(window, this._id) }, t.enroll = function(e, t) { clearTimeout(e._idleTimeoutId), e._idleTimeout = t }, t.unenroll = function(e) { clearTimeout(e._idleTimeoutId), e._idleTimeout = -1 }, t._unrefActive = t.active = function(e) { clearTimeout(e._idleTimeoutId); var t = e._idleTimeout; t >= 0 && (e._idleTimeoutId = setTimeout(function() { e._onTimeout && e._onTimeout() }, t)) }, n(71), t.setImmediate = setImmediate, t.clearImmediate = clearImmediate }, function(e, t, n) { "use strict"; (function(e) { Object.defineProperty(t, "__esModule", { value: !0 }); var i, a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, o = n(70), r = (i = o) && i.__esModule ? i : { default: i }; var s = setTimeout; function l() {} function c(e) { if (!(this instanceof c)) throw new TypeError("Promises must be constructed via new"); if ("function" != typeof e) throw new TypeError("not a function"); this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], f(e, this) } function u(e, t) { for (; 3 === e._state;) e = e._value; 0 !== e._state ? (e._handled = !0, c._immediateFn(function() { var n = 1 === e._state ? t.onFulfilled : t.onRejected; if (null !== n) { var i; try { i = n(e._value) } catch (e) { return void p(t.promise, e) } d(t.promise, i) } else(1 === e._state ? d : p)(t.promise, e._value) })) : e._deferreds.push(t) } function d(e, t) { try { if (t === e) throw new TypeError("A promise cannot be resolved with itself."); if (t && ("object" === (void 0 === t ? "undefined" : a(t)) || "function" == typeof t)) { var n = t.then; if (t instanceof c) return e._state = 3, e._value = t, void h(e); if ("function" == typeof n) return void f((i = n, o = t, function() { i.apply(o, arguments) }), e) } e._state = 1, e._value = t, h(e) } catch (t) { p(e, t) } var i, o } function p(e, t) { e._state = 2, e._value = t, h(e) } function h(e) { 2 === e._state && 0 === e._deferreds.length && c._immediateFn(function() { e._handled || c._unhandledRejectionFn(e._value) }); for (var t = 0, n = e._deferreds.length; t < n; t++) u(e, e._deferreds[t]); e._deferreds = null } function f(e, t) { var n = !1; try { e(function(e) { n || (n = !0, d(t, e)) }, function(e) { n || (n = !0, p(t, e)) }) } catch (e) { if (n) return; n = !0, p(t, e) } } c.prototype.catch = function(e) { return this.then(null, e) }, c.prototype.then = function(e, t) { var n = new this.constructor(l); return u(this, new function(e, t, n) { this.onFulfilled = "function" == typeof e ? e : null, this.onRejected = "function" == typeof t ? t : null, this.promise = n }(e, t, n)), n }, c.prototype.finally = r.default, c.all = function(e) { return new c(function(t, n) { if (!e || void 0 === e.length) throw new TypeError("Promise.all accepts an array"); var i = Array.prototype.slice.call(e); if (0 === i.length) return t([]); var o = i.length; function r(e, s) { try { if (s && ("object" === (void 0 === s ? "undefined" : a(s)) || "function" == typeof s)) { var l = s.then; if ("function" == typeof l) return void l.call(s, function(t) { r(e, t) }, n) } i[e] = s, 0 == --o && t(i) } catch (e) { n(e) } } for (var s = 0; s < i.length; s++) r(s, i[s]) }) }, c.resolve = function(e) { return e && "object" === (void 0 === e ? "undefined" : a(e)) && e.constructor === c ? e : new c(function(t) { t(e) }) }, c.reject = function(e) { return new c(function(t, n) { n(e) }) }, c.race = function(e) { return new c(function(t, n) { for (var i = 0, a = e.length; i < a; i++) e[i].then(t, n) }) }, c._immediateFn = "function" == typeof e && function(t) { e(t) } || function(e) { s(e, 0) }, c._unhandledRejectionFn = function(e) { "undefined" != typeof console && console && console.warn("Possible Unhandled Promise Rejection:", e) }, t.default = c }).call(this, n(72).setImmediate) }, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var i = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } return function(t, n, i) { return n && e(t.prototype, n), i && e(t, i), t } }(), a = L(n(73)), o = L(n(1)), r = L(n(69)), s = L(n(48)), l = L(n(47)), c = L(n(2)), u = L(n(27)), d = L(n(26)), p = L(n(25)), h = L(n(24)), f = L(n(23)), y = L(n(22)), m = L(n(21)), v = L(n(20)), g = L(n(19)), b = L(n(17)), w = L(n(16)), k = L(n(15)), x = L(n(14)), S = L(n(13)), T = L(n(5)); function L(e) { return e && e.__esModule ? e : { default: e } } var E = 0, M = [], _ = function() { function e(t) { var n = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.options = (0, r.default)(t), this.options.video.quality && (this.qualityIndex = this.options.video.defaultQuality, this.quality = this.options.video.quality[this.options.video.defaultQuality]), this.tran = new s.default(this.options.lang).tran, this.events = new d.default, this.user = new h.default(this), this.container = this.options.container, this.container.classList.add("dplayer"), this.options.danmaku || this.container.classList.add("dplayer-no-danmaku"), this.options.live && this.container.classList.add("dplayer-live"), o.default.isMobile && this.container.classList.add("dplayer-mobile"), this.arrow = this.container.offsetWidth <= 500, this.arrow && this.container.classList.add("dplayer-arrow"), this.template = new l.default({ container: this.container, options: this.options, index: E, tran: this.tran }), this.video = this.template.video, this.bar = new y.default(this.template), this.bezel = new v.default(this.template.bezel), this.fullScreen = new p.default(this), this.controller = new g.default(this), this.options.danmaku && (this.danmaku = new u.default({ container: this.template.danmaku, opacity: this.user.get("opacity"), callback: function() { setTimeout(function() { n.template.danmakuLoading.style.display = "none", n.options.autoplay && n.play() }, 0) }, error: function(e) { n.notice(e) }, apiBackend: this.options.apiBackend, borderColor: this.options.theme, height: this.arrow ? 24 : 30, time: function() { return n.video.currentTime }, unlimited: this.user.get("unlimited"), api: { id: this.options.danmaku.id, address: this.options.danmaku.api, token: this.options.danmaku.token, maximum: this.options.danmaku.maximum, addition: this.options.danmaku.addition, user: this.options.danmaku.user }, events: this.events, tran: function(e) { return n.tran(e) } }), this.comment = new w.default(this)), this.setting = new b.default(this), document.addEventListener("click", function() { n.focus = !1 }, !0), this.container.addEventListener("click", function() { n.focus = !0 }, !0), this.paused = !0, this.timer = new m.default(this), this.hotkey = new k.default(this), this.contextmenu = new x.default(this), this.initVideo(this.video, this.quality && this.quality.type || this.options.video.type), this.infoPanel = new S.default(this), !this.danmaku && this.options.autoplay && this.play(), E++, M.push(this) } return i(e, [{ key: "seek", value: function(e) { e = Math.max(e, 0), this.video.duration && (e = Math.min(e, this.video.duration)), this.video.currentTime < e ? this.notice(this.tran("FF") + " " + (e - this.video.currentTime).toFixed(0) + " " + this.tran("s")) : this.video.currentTime > e && this.notice(this.tran("REW") + " " + (this.video.currentTime - e).toFixed(0) + " " + this.tran("s")), this.video.currentTime = e, this.danmaku && this.danmaku.seek(), this.bar.set("played", e / this.video.duration, "width"), this.template.ptime.innerHTML = o.default.secondToTime(e) } }, { key: "play", value: function() { var e = this; if (this.paused = !1, this.video.paused && this.bezel.switch(c.default.play), this.template.playButton.innerHTML = c.default.pause, a.default.resolve(this.video.play()).catch(function() { e.pause() }).then(function() {}), this.timer.enable("loading"), this.container.classList.remove("dplayer-paused"), this.container.classList.add("dplayer-playing"), this.danmaku && this.danmaku.play(), this.options.mutex) for (var t = 0; t < M.length; t++) this !== M[t] && M[t].pause() } }, { key: "pause", value: function() { this.paused = !0, this.container.classList.remove("dplayer-loading"), this.video.paused || this.bezel.switch(c.default.pause), this.template.playButton.innerHTML = c.default.play, this.video.pause(), this.timer.disable("loading"), this.container.classList.remove("dplayer-playing"), this.container.classList.add("dplayer-paused"), this.danmaku && this.danmaku.pause() } }, { key: "switchVolumeIcon", value: function() { this.volume() >= .95 ? this.template.volumeIcon.innerHTML = c.default.volumeUp : this.volume() > 0 ? this.template.volumeIcon.innerHTML = c.default.volumeDown : this.template.volumeIcon.innerHTML = c.default.volumeOff } }, { key: "volume", value: function(e, t, n) { if (e = parseFloat(e), !isNaN(e)) { e = Math.max(e, 0), e = Math.min(e, 1), this.bar.set("volume", e, "width"); var i = (100 * e).toFixed(0) + "%"; this.template.volumeBarWrapWrap.dataset.balloon = i, t || this.user.set("volume", e), n || this.notice(this.tran("Volume") + " " + (100 * e).toFixed(0) + "%"), this.video.volume = e, this.video.muted && (this.video.muted = !1), this.switchVolumeIcon() } return this.video.volume } }, { key: "toggle", value: function() { this.video.paused ? this.play() : this.pause() } }, { key: "on", value: function(e, t) { this.events.on(e, t) } }, { key: "switchVideo", value: function(e, t) { this.pause(), this.video.poster = e.pic ? e.pic : "", this.video.src = e.url, this.initMSE(this.video, e.type || "auto"), t && (this.template.danmakuLoading.style.display = "block", this.bar.set("played", 0, "width"), this.bar.set("loaded", 0, "width"), this.template.ptime.innerHTML = "00:00", this.template.danmaku.innerHTML = "", this.danmaku && this.danmaku.reload({ id: t.id, address: t.api, token: t.token, maximum: t.maximum, addition: t.addition, user: t.user })) } }, { key: "initMSE", value: function(e, t) { var n = this; if (this.type = t, this.options.video.customType && this.options.video.customType[t]) "[object Function]" === Object.prototype.toString.call(this.options.video.customType[t]) ? this.options.video.customType[t](this.video, this) : console.error("Illegal customType: " + t); else switch ("auto" === this.type && (/m3u8(#|\?|$)/i.exec(e.src) ? this.type = "hls" : /.flv(#|\?|$)/i.exec(e.src) ? this.type = "flv" : /.mpd(#|\?|$)/i.exec(e.src) ? this.type = "dash" : this.type = "normal"), "hls" === this.type && (e.canPlayType("application/x-mpegURL") || e.canPlayType("application/vnd.apple.mpegURL")) && (this.type = "normal"), this.type) { case "hls": if (Hls) if (Hls.isSupported()) { var i = new Hls; i.loadSource(e.src), i.attachMedia(e) } else this.notice("Error: Hls is not supported."); else this.notice("Error: Can't find Hls."); break; case "flv": if (flvjs && flvjs.isSupported()) if (flvjs.isSupported()) { var a = flvjs.createPlayer({ type: "flv", url: e.src }); a.attachMediaElement(e), a.load() } else this.notice("Error: flvjs is not supported."); else this.notice("Error: Can't find flvjs."); break; case "dash": dashjs ? dashjs.MediaPlayer().create().initialize(e, e.src, !1) : this.notice("Error: Can't find dashjs."); break; case "webtorrent": if (WebTorrent) if (WebTorrent.WEBRTC_SUPPORT) { this.container.classList.add("dplayer-loading"); var o = new WebTorrent, r = e.src; o.add(r, function(e) { e.files.find(function(e) { return e.name.endsWith(".mp4") }).renderTo(n.video, { autoplay: n.options.autoplay }, function() { n.container.classList.remove("dplayer-loading") }) }) } else this.notice("Error: Webtorrent is not supported."); else this.notice("Error: Can't find Webtorrent.") } } }, { key: "initVideo", value: function(e, t) { var n = this; this.initMSE(e, t), this.on("durationchange", function() { 1 !== e.duration && e.duration !== 1 / 0 && (n.template.dtime.innerHTML = o.default.secondToTime(e.duration)) }), this.on("progress", function() { var t = e.buffered.length ? e.buffered.end(e.buffered.length - 1) / e.duration : 0; n.bar.set("loaded", t, "width") }), this.on("error", function() { n.video.error && n.tran && n.notice && (n.type, n.notice(n.tran("Video load failed"), -1)) }), this.on("ended", function() { n.bar.set("played", 1, "width"), n.setting.loop ? (n.seek(0), n.play()) : n.pause(), n.danmaku && (n.danmaku.danIndex = 0) }), this.on("play", function() { n.paused && n.play() }), this.on("pause", function() { n.paused || n.pause() }), this.on("timeupdate", function() { n.bar.set("played", n.video.currentTime / n.video.duration, "width"); var e = o.default.secondToTime(n.video.currentTime); n.template.ptime.innerHTML !== e && (n.template.ptime.innerHTML = e) }); for (var i = function(t) { e.addEventListener(n.events.videoEvents[t], function() { n.events.trigger(n.events.videoEvents[t]) }) }, a = 0; a < this.events.videoEvents.length; a++) i(a); this.volume(this.user.get("volume"), !0, !0), this.options.subtitle && (this.subtitle = new f.default(this.template.subtitle, this.video, this.options.subtitle, this.events), this.user.get("subtitle") || this.subtitle.hide()) } }, { key: "switchQuality", value: function(e) { var t = this; if (this.qualityIndex !== e && !this.switchingQuality) { this.qualityIndex = e, this.switchingQuality = !0, this.quality = this.options.video.quality[e], this.template.qualityButton.innerHTML = this.quality.name; var n = this.video.paused; this.video.pause(); var i = (0, T.default)({ current: !1, pic: null, screenshot: this.options.screenshot, preload: "auto", url: this.quality.url, subtitle: this.options.subtitle }), a = (new DOMParser).parseFromString(i, "text/html").body.firstChild; this.template.videoWrap.insertBefore(a, this.template.videoWrap.getElementsByTagName("div")[0]), this.prevVideo = this.video, this.video = a, this.initVideo(this.video, this.quality.type || this.options.video.type), this.seek(this.prevVideo.currentTime), this.notice(this.tran("Switching to") + " " + this.quality.name + " " + this.tran("quality"), -1), this.events.trigger("quality_start", this.quality), this.on("canplay", function() { if (t.prevVideo) { if (t.video.currentTime !== t.prevVideo.currentTime) return void t.seek(t.prevVideo.currentTime); t.template.videoWrap.removeChild(t.prevVideo), t.video.classList.add("dplayer-video-current"), n || t.video.play(), t.prevVideo = null, t.notice(t.tran("Switched to") + " " + t.quality.name + " " + t.tran("quality")), t.switchingQuality = !1, t.events.trigger("quality_end") } }) } } }, { key: "notice", value: function(e) { var t = this, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2e3, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : .8; this.template.notice.innerHTML = e, this.template.notice.style.opacity = i, this.noticeTime && clearTimeout(this.noticeTime), this.events.trigger("notice_show", e), n > 0 && (this.noticeTime = setTimeout(function() { t.template.notice.style.opacity = 0, t.events.trigger("notice_hide") }, n)) } }, { key: "resize", value: function() { this.danmaku && this.danmaku.resize(), this.events.trigger("resize") } }, { key: "speed", value: function(e) { this.video.playbackRate = e } }, { key: "destroy", value: function() { M.splice(M.indexOf(this), 1), this.pause(), this.controller.destroy(), this.timer.destroy(), this.video.src = "", this.container.innerHTML = "", this.events.trigger("destroy") } }], [{ key: "version", get: function() { return "1.25.0" } }]), e }(); t.default = _ }, , , function(e, t, n) {}, function(e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), n(77); var i, a = n(74), o = (i = a) && i.__esModule ? i : { default: i }; console.log("\n %c DPlayer v1.25.0 fdcf45b %c http://dplayer.js.org \n\n", "color: #fadfa3; background: #030307; padding:5px 0;", "background: #fadfa3; padding:5px 0;"), t.default = o.default } ]).default }); //# sourceMappingURL=DPlayer.min.js.map