! 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" } }, function(e, t, n) { "use strict"; e.exports = n(29) }, function(e, t, n) { "use strict"; function i(e) { this.message = e } i.prototype.toString = function() { return "Cancel" + (this.message ? ": " + this.message : "") }, i.prototype.__CANCEL__ = !0, e.exports = i }, function(e, t, n) { "use strict"; e.exports = function(e) { return !(!e || !e.__CANCEL__) } }, function(e, t, n) { "use strict"; var i = n(61); e.exports = function(e, t, n, a, o) { var r = new Error(e); return i(r, t, n, a, o) } }, function(e, t, n) { "use strict"; var i = n(0), a = n(62), o = n(60), r = n(59), s = n(58), l = n(9), c = "undefined" != typeof window && window.btoa && window.btoa.bind(window) || n(57); e.exports = function(e) { return new Promise(function(t, u) { var d = e.data, p = e.headers; i.isFormData(d) && delete p["Content-Type"]; var h = new XMLHttpRequest, f = "onreadystatechange", y = !1; if ("undefined" == typeof window || !window.XDomainRequest || "withCredentials" in h || s(e.url) || (h = new window.XDomainRequest, f = "onload", y = !0, h.onprogress = function() {}, h.ontimeout = function() {}), e.auth) { var m = e.auth.username || "", v = e.auth.password || ""; p.Authorization = "Basic " + c(m + ":" + v) } if (h.open(e.method.toUpperCase(), o(e.url, e.params, e.paramsSerializer), !0), h.timeout = e.timeout, h[f] = function() { if (h && (4 === h.readyState || y) && (0 !== h.status || h.responseURL && 0 === h.responseURL.indexOf("file:"))) { var n = "getAllResponseHeaders" in h ? r(h.getAllResponseHeaders()) : null, i = { data: e.responseType && "text" !== e.responseType ? h.response : h.responseText, status: 1223 === h.status ? 204 : h.status, statusText: 1223 === h.status ? "No Content" : h.statusText, headers: n, config: e, request: h }; a(t, u, i), h = null } }, h.onerror = function() { u(l("Network Error", e, null, h)), h = null }, h.ontimeout = function() { u(l("timeout of " + e.timeout + "ms exceeded", e, "ECONNABORTED", h)), h = null }, i.isStandardBrowserEnv()) { var g = n(56), b = (e.withCredentials || s(e.url)) && e.xsrfCookieName ? g.read(e.xsrfCookieName) : void 0; b && (p[e.xsrfHeaderName] = b) } if ("setRequestHeader" in h && i.forEach(p, function(e, t) { void 0 === d && "content-type" === t.toLowerCase() ? delete p[t] : h.setRequestHeader(t, e) }), e.withCredentials && (h.withCredentials = !0), e.responseType) try { h.responseType = e.responseType } catch (t) { if ("json" !== e.responseType) throw t } "function" == typeof e.onDownloadProgress && h.addEventListener("progress", e.onDownloadProgress), "function" == typeof e.onUploadProgress && h.upload && h.upload.addEventListener("progress", e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then(function(e) { h && (h.abort(), u(e), h = null) }), void 0 === d && (d = null), h.send(d) }) } }, function(e, t, n) { "use strict"; e.exports = function(e, t) { return function() { for (var n = new Array(arguments.length), i = 0; i < n.length; i++) n[i] = arguments[i]; return e.apply(t, n) } } }, function(e, t, n) { "use strict"; var i, a, o = e.exports = {}; function r() { throw new Error("setTimeout has not been defined") } function s() { throw new Error("clearTimeout has not been defined") } function l(e) { if (i === setTimeout) return setTimeout(e, 0); if ((i === r || !i) && setTimeout) return i = setTimeout, setTimeout(e, 0); try { return i(e, 0) } catch (t) { try { return i.call(null, e, 0) } catch (t) { return i.call(this, e, 0) } } }! function() { try { i = "function" == typeof setTimeout ? setTimeout : r } catch (e) { i = r } try { a = "function" == typeof clearTimeout ? clearTimeout : s } catch (e) { a = s } }(); var c, u = [], d = !1, p = -1; function h() { d && c && (d = !1, c.length ? u = c.concat(u) : p = -1, u.length && f()) } function f() { if (!d) { var e = l(h); d = !0; for (var t = u.length; t;) { for (c = u, u = []; ++p < t;) c && c[p].run(); p = -1, t = u.length } c = null, d = !1, function(e) { if (a === clearTimeout) return clearTimeout(e); if ((a === s || !a) && clearTimeout) return a = clearTimeout, clearTimeout(e); try { a(e) } catch (t) { try { return a.call(null, e) } catch (t) { return a.call(this, e) } } }(e) } } function y(e, t) { this.fun = e, this.array = t } function m() {} o.nextTick = function(e) { var t = new Array(arguments.length - 1); if (arguments.length > 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