@oplayer/full
Version:
Do More, Keep it simple.
8 lines • 102 kB
JavaScript
/**
* name: @oplayer/full
* version: v0.0.1-beta.26
* description: Do More, Keep it simple.
* author: shiyiya
* homepage: https://github.com/shiyiya/oplayer
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).OPlayer=t()}(this,(function(){"use strict";var e,t,n,i,o,a,r,s,l;function c(e){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=1540483477,i=24,o=t^e.length,a=e.length,r=0;for(;a>=4;){let t=u(e,r);t=h(t,n),t^=t>>>i,t=h(t,n),o=h(o,n),o^=t,r+=4,a-=4}switch(a){case 3:o^=d(e,r),o^=e.charCodeAt(r+2)<<16,o=h(o,n);break;case 2:o^=d(e,r),o=h(o,n);break;case 1:o^=e.charCodeAt(r),o=h(o,n)}return o^=o>>>13,o=h(o,n),o^=o>>>15,o>>>0}(e).toString(36)}function u(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function d(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function h(e,t){return(65535&(e|=0))*(t|=0)+(((e>>>16)*t&65535)<<16)|0}function g(e){return Boolean(e&&"object"==typeof e&&!Array.isArray(e))}function p(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(!n.length)return e;const o=n.shift();if(g(e)&&g(o))for(const a in o)g(o[a])?(e[a]||Object.assign(e,{[a]:{}}),p(e[a],o[a])):Object.assign(e,{[a]:o[a]});return p.apply(void 0,[e].concat(n))}var m,v=/[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g;function f(e){if(-1===e.indexOf(","))return[e];for(var t,n=[],i=[],o=0;t=v.exec(e);)switch(t[0]){case"(":o++;break;case")":o--;break;case",":if(o)break;n.push(t.index)}for(t=n.length;t--;)i.unshift(e.slice(n[t]+1)),e=e.slice(0,n[t]);return i.unshift(e),i}function b(e,t){let n=f(e);return f(t).map((e=>e.indexOf("&")>=0?e:"&"+e)).reduce(((e,t)=>e.concat(n.map((e=>t.replace(/\&/g,e))))),[]).join(",")}function y(e){return 0===e.indexOf("@media")}function k(e){return 0===e.indexOf("@keyframes")}function x(e,t){var n;let i=t.rules,o=t.mediaQuery,a=t.globalSelector,r={};return a&&(e=a),null==(n=Object.keys(i))||n.forEach((t=>{if(function(e){return 0===e.indexOf("@global")}(t)){const n=t,s=(t=t.substring(8)).indexOf("&");let l;-1!=s?(l=b(e,t),a=t.substring(0,s-1).trim()):l=t,p(r,x(l,{mediaQuery:o,rules:i[n],globalSelector:l}))}else if(function(e){let t=[":",".","[",">"," "],n=!1,i=e.charAt(0);for(let o=0;o<t.length;o++)if(i===t[o]){n=!0;break}return n||e.indexOf("&")>=0}(t))p(r,x(b(e,t),{rules:i[t],mediaQuery:o}));else if(y(t))p(r,x(e,{mediaQuery:(h=o,g=t,h?"@media "+h.substring(6)+" and "+g.substring(6):g),rules:i[t]}));else{var n,s,l,c,u,d;if(o)null!==(n=r[o])&&void 0!==n||(r[o]={}),null!==(c=(s=r[o])[l=e])&&void 0!==c||(s[l]={}),r[o][e][t]=i[t];else if(k(t))r[t]=i[t];else null!==(d=r[u=e])&&void 0!==d||(r[u]={}),r[e][t]=i[t]}var h,g})),r}function w(e){let t=[];for(const n in e)if(Object.hasOwnProperty.call(e,n)){const i=e[n];g(i)?t.push(n+"{"+w(i)+"}"):t.push(n+":"+i)}return/^\d%/.test(t[0])?t.join(" "):t.join(";")}function E(e){let t=[];for(const n in e)if(Object.hasOwnProperty.call(e,n)){const i=e[n];if(y(n))t.push(n+"{"+E(i)+"}");else if(k(n))t.push(n+"{"+w(i)+"}");else{const e=Object.entries(i).map((e=>e[0]+":"+e[1])).join(";");t.push(n+"{"+e+"}")}}return t}function L(e,t){return E(x(t,{rules:e}))}(e=>{function t(t){if(!(0,e.isBrowser)())return null;let n=document.createElement("style");n.setAttribute("data-"+t,""),n.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(n);for(let e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===n)return document.styleSheets.item(e);return null}e.create=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const i=-1!==e.indexOf("#"),o=-1!==e.indexOf("."),a=i?e.split("#"):o?e.split("."):[e],r=a[0],s=a[1],l=document.createElement(r);return i&&(l.id=s),o&&l.classList.add(s),n&&(l.innerHTML=n),Object.keys(t).forEach((e=>{const n=t[e];"video"!==r&&"audio"!==r||"boolean"!=typeof n?void 0!==n&&l.setAttribute(e,""+n):n&&l.setAttribute(e,"")})),l},e.render=(e,t)=>t.appendChild(e),e.isBrowser=()=>Boolean("undefined"!=typeof globalThis&&globalThis.document&&globalThis.document.documentElement),e.createSheet=t;const n=(()=>{const e=Object.create({});return t=>{const n="object"==typeof t?JSON.stringify(t):t;return e[n]||(e[n]="css-"+c(n)),e[n]}})();e.createCss=e=>{let t=e.sheet,i=e.ssrData;return function(){for(var e,o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];const s=Boolean(a[0]&&a[0].length&&a[0].raw);let l="";if(s){let e=a[0];l+=e[0];for(let t=1;t<a.length;t++)l+="string"!=typeof a[t]?"":a[t],l+=e[t]}else l="string"==typeof a[0]?a[0]:JSON.stringify(a[0]);const c=n(l);if(t)for(let n=0;n<t.cssRules.length;n++)if((null==(e=t.cssRules[n])?void 0:e.selectorText)=="."+c)return c;let u=["."+c+"{"+l+"}"];return s||"object"!=typeof a[0]||(u=L(a[0],"."+c)),t?u.forEach((e=>{t.insertRule(e,t.cssRules.length)})):i=i.concat(u),c}},e.createStyled=()=>{const n=[],i=t("oplayer");return{css:(0,e.createCss)({sheet:i,ssrData:n}),getCssValue:()=>n}};var i=(0,e.createStyled)();e.css=i.css,e.getCssValue=i.getCssValue,e.cls=e=>"css-"+c(e)})(m||(m={}));const T=/(iPad)/gi.test(null==(e=globalThis.navigator)?void 0:e.userAgent)||/Macintosh/i.test(null==(t=globalThis.navigator)?void 0:t.userAgent)&&Boolean(null==(n=globalThis.navigator)?void 0:n.maxTouchPoints)&&(null==(i=globalThis.navigator)?void 0:i.maxTouchPoints)>=1,S=/iPhone/gi.test(null==(o=globalThis.navigator)?void 0:o.userAgent),$=/^((?!chrome|android).)*safari/i.test(null==(a=globalThis.navigator)?void 0:a.userAgent),C=S||T,A=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(null==(r=globalThis.navigator)?void 0:r.userAgent)||C,P=/mqqbrowser/i.test(null==(s=globalThis.navigator)?void 0:s.userAgent)&&!/ qq/i.test(null==(l=globalThis.navigator)?void 0:l.userAgent),O=(e,t,n)=>{var i;const o=document.createElement("script");o.src=e,o.onload=t,o.onerror=n;const a=document.getElementsByTagName("script")[0];null==(i=null==a?void 0:a.parentNode)||i.insertBefore(o,a)},M={},z=e=>void 0===e,R=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>!0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:O;const a=e=>z(window[e])?window.exports&&window.exports[e]?window.exports[e]:window.module&&window.module.exports&&window.module.exports[e]?window.module.exports[e]:void 0:window[e],r=a(t);return r&&i(r)?Promise.resolve(r):new Promise(((i,r)=>{if(!z(M[e]))return void M[e].push({resolve:i,reject:r});M[e]=[{resolve:i,reject:r}];const s=t=>{var n;null==(n=M[e])||n.forEach((e=>e.resolve(t)))};if(!z(n)){const e=window[n];window[n]=function(){z(e)||e.apply(void 0,arguments),s(a(t))}}o(e,(()=>{z(n)&&s(a(t))}),(t=>{var n;null==(n=M[e])||n.forEach((e=>{e.reject(t)})),delete M[e]}))}))},B=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","encrypted","waitingforkey","enterpictureinpicture","leavepictureinpicture"],F=["contextmenu"];class j{constructor(){this.events=Object.create(null)}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}onAny(e,t){e.forEach((e=>this.on(e,t)))}once(e,t){const n=n=>{t({type:e,payload:n.payload})};n.raw=t,this.on(e,n)}off(e,t){if(this.events[e])for(let n=0;n<this.events[e].length;n++){const i=this.events[e][n];i!=t&&t!=i.raw||this.events[e].splice(n,1)}}offAny(e){this.events[e]=[]}offAll(){this.events=Object.create(null)}emit(e,t){var n,i;const o=[];null==(n=this.events[e])||n.forEach((n=>{n({type:e,payload:t}),n.raw&&o.push(n)})),null==(i=this.events["*"])||i.forEach((n=>{n({type:e,payload:t}),n.raw&&o.push(n)})),o.forEach((t=>{this.off(e,t)}))}}const q={Play:"播放",Pause:"暂停",Loop:"循环播放",Volume:"音量","Volume: %s":"音量:%s",Mute:"静音",Speed:"播放速度",Live:"直播","Back to Live":"回到直播",Language:"语言",Screenshot:"截图",Subtitle:"字幕",Quality:"画质",Fullscreen:"全屏",Settings:"设置","Picture in Picture":"画中画",Danmaku:"弹幕",Display:"显示",Opacity:"透明度",FontSize:"字体大小","Display Area":"显示区域",Off:"关闭",Auto:"自动",Default:"默认",Normal:"正常","%ss":"%s秒",Close:"关闭","Can be closed after %ss":"%s秒后可关闭广告"},I={Play:"پخش",Next:"بعدی",Previous:"قبلی",Pause:"توقف",Loop:"تکرار",Volume:"حجم صدا","Volume: %s":"حجم صدا: %s",Mute:"بیصدا کردن",Speed:"سرعت",LIVE:"زنده",WebFullscreen:"تمام صفحه وب",Chromecast:"کروم کاست",AirPlay:"ایر پلی",Playlist:"پلیلیست",Heatmap:"نقشهٔ حرارتی",Language:"زبان",Screenshot:"عکس صفحه",Subtitle:"زیرنویس",Quality:"کیفیت",Fullscreen:"تمام صفحه",Settings:"تنظیمات","Picture in Picture":"تصویر در تصویر",Danmaku:"دانماکو",Display:"نمایش",Opacity:"شفافیت",FontSize:"اندازه فونت","Display Area":"ناحیه نمایش",Off:"خاموش",Auto:"خودکار",Default:"پیشفرض",Normal:"عادی","%ss":"%s ثانیه",Close:"بستن","Can be closed after %ss":"قابل بستن پس از %s ثانیه"},H={Play:"پلېکول",Next:"بل",Previous:"مخکېنی",Pause:"تم کول",Loop:"تکرار",Volume:"غږ","Volume: %s":"غږ: %s",Mute:"غلی کول",Speed:"چټکتیا",LIVE:"ژوندی",WebFullscreen:"د تمام صفحه وب",Chromecast:"کروم کاسټ",AirPlay:"ایر پلی",Playlist:"پلېلسټ",Heatmap:"د ډېرو کتلو نقشه",Language:"ژبه",Screenshot:"سکرین شاټ",Subtitle:"لاندې لیک",Quality:"کیفیت",Fullscreen:"پوره پرده","":"د متن ډیکوډر ملاتړ نه لري",Settings:"ترتیبات","Picture in Picture":"انځور په انځور",Danmaku:"دانماکو",Display:"ښکاره کول",Opacity:"روڼوالی",FontSize:"د خط اندازه","Display Area":"د ښودلو ساحه",Off:"بند",Auto:"خودکار",Default:"پېل شوی",Normal:"عادي","%ss":"%s ثانیه",Close:"بندول","Can be closed after %ss":"د %s ثانیو وروسته تړل کېدای شي"};class D{constructor(e,t){this.languages={zh:q,"zh-CN":q,fa:I,pa:H,en:Object.keys(q).reduce(((e,t)=>(e[t]=t,e)),{})},this.lang="auto"===e?navigator.language:e,t&&p(this.languages,t),this.languages[this.lang]||navigator.languages.some((e=>{if(this.languages[e])return this.lang=e,!0;if(-1!==e.indexOf("-")){const t=e.split("-")[0];if(t&&this.languages[t])return this.lang=t,!0}return!1})),this.languages[this.lang]||(this.lang="en")}get(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];const o=this.languages[this.lang][e];if(null==o)return e;let a=0;return o.replace(/%s/gi,(()=>{var e;return null!==(e=n[a++])&&void 0!==e?e:""}))}update(e){p(this.languages,e)}}const N={autoplay:!1,muted:!1,loop:!1,volume:1,preload:"metadata",playbackRate:1,playsinline:!0,lang:"auto",source:{},videoAttr:{},isLive:!1,autopause:!0,isNativeUI:()=>P},V=class e{constructor(e,t){if(this.plugins=[],this.context={},this.listeners=Object.create(null),this.hasError=!1,this.isSourceChanging=!1,this.container="string"==typeof e?document.querySelector(e):e,!this.container)throw new Error(("string"==typeof e?e:"Element")+"does not exist");this.options=Object.assign({},N,"string"==typeof t?{source:{src:t}}:t),this.locales=new D(this.options.lang,this.options.languages),this.eventEmitter=new j}static make(t,n){return new e(t,n)}use(e){return e.forEach((e=>{this.plugins.push(e)})),this}create(){return this.render(),this.initEvent(),this.plugins.forEach((e=>this.applyPlugin(e,!0))),this.options.source.src&&this.load(this.options.source),e.players.push(this),this}initEvent(){this.listeners.error=e=>{this.$video.error&&(this.hasError=!0,this.eventEmitter.emit("error",e))},this.$video.addEventListener("error",(e=>this.listeners.error(e)));const e=(e,t)=>{this.eventEmitter.emit(e,t)};[[this.$video,["fullscreenchange","webkitbeginfullscreen","webkitendfullscreen"],["fullscreenerror","webkitfullscreenerror","mozfullscreenerror"]],[this.$root,["fullscreenchange","webkitfullscreenchange"],["fullscreenerror","webkitfullscreenerror","mozfullscreenerror"]]].forEach((t=>{const n=t[0];t.slice(1).forEach((t=>{const i=t[0];this.listeners[i]=e,t.forEach((e=>{n.addEventListener(e,(e=>{this.listeners[i](i,e)}),{passive:!0})}))}))})),[[this.$video,B],[this.$root,F]].forEach((t=>{let n=t[0];t[1].forEach((t=>{this.listeners[t]||(this.listeners[t]=e,n.addEventListener(t,(e=>{var n;null==(n=this.listeners)||n[t](t,e)}),{passive:!0}))}))}))}render(){this.$video=m.create("video."+m.css("\n width: 100%;\n height: 100%;\n display: block;\n position: relative;\n "),Object.assign({autoplay:this.options.autoplay,loop:this.options.loop,playsinline:this.options.playsinline,"webkit-playsinline":this.options.playsinline,"x5-playsinline":this.options.playsinline,preload:this.options.preload,poster:this.options.source.poster},this.options.videoAttr));const e=this.options,t=e.muted,n=e.volume,i=e.playbackRate;t&&this.mute(),this.$video.volume=n,setTimeout((()=>{this.$root&&this.setPlaybackRate(i)})),this.$root=m.create("div."+m.css("\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n background-color: #000;\n ")),m.render(this.$video,this.$root),m.render(this.$root,this.container)}async load(e){var t;await(null==(t=this.loader)?void 0:t.destroy()),this.loader=void 0;for(const n of this.plugins)if(n.load){const t=await n.load(this,e);if(0!=t&&!this.loader){this.loader=t,this.emit("loaderchange",t);break}}return this.loader||(this.$video.src=e.src),e}applyPlugin(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.name,i=e.key;if(this.context[e.key||e.name])throw new Error("duplicate plugin");t||this.plugins.push(e);const o=e.apply(this);o&&(this.context[i||n]=o)}on(e,t){return"string"==typeof e?this.eventEmitter.on(e,t):Array.isArray(e)?this.eventEmitter.onAny(e,t):"function"==typeof e&&this.eventEmitter.on("*",e),this}once(e,t){this.eventEmitter.once(e,t)}off(e,t){this.eventEmitter.off(e,t)}emit(e,t){this.eventEmitter.emit(e,t)}setPoster(e){this.$video.poster=e}play(){if((this.$video.src||this.$video.currentSrc)&&!this.isSourceChanging){if(this.options.autopause)for(let t=0;t<e.players.length;t++){const n=e.players[t];n!=this&&n.pause()}return this.$video.play()}}pause(){return this.$video.pause()}togglePlay(){return this.isPlaying?this.pause():this.play()}mute(){this.$video.muted=!0}unmute(){this.$video.muted=!1}toggleMute(){this.isMuted?this.unmute():this.mute()}setVolume(e){this.$video.volume=e>1?1:e<0?0:e,this.$video.volume>0&&this.isMuted&&this.unmute()}setPlaybackRate(e){this.$video.playbackRate=e}seek(e){this.$video.currentTime=e}setLoop(e){this.$video.loop=e}async enterFullscreen(){this.isInPip&&await this.exitPip(),this._requestFullscreen?this._requestFullscreen.call(this.$root,{navigationUI:"hide"}):this.$video.webkitEnterFullscreen()}exitFullscreen(){return this._exitFullscreen.call(document)}get isFullscreenEnabled(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||this.$video.webkitEnterFullscreen}get isFullScreen(){return Boolean((document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)===this.$root||this.$video.webkitDisplayingFullscreen)}toggleFullScreen(){return this.isFullScreen?this.exitFullscreen():this.enterFullscreen()}get isPipEnabled(){return document.pictureInPictureEnabled}enterPip(){return this.$video.requestPictureInPicture()}exitPip(){return!!this.isInPip&&document.exitPictureInPicture()}get isInPip(){return document.pictureInPictureElement==this.$video}togglePip(){return this.isInPip?this.exitPip():this.enterPip()}changeQuality(e){return this.hasError=!1,this._loader(e,{keepPlaying:!0,keepTime:!0,preEvent:"videoqualitychange",event:"videoqualitychanged",brokenEvent:"qualitychangeerror"})}changeSource(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.hasError=!1,this._loader(e,{keepPlaying:t,preEvent:"videosourcechange",event:"videosourcechanged",brokenEvent:"sourcechangeerror"})}_loader(e,t){return new Promise(((n,i)=>{if(this.isSourceChanging)return i(Error("Previous Source is Changing."));const o=this.isPlaying,a=this.currentTime,r=this.volume,s=this.playbackRate;this.pause(),this.hasError=!1,this.isSourceChanging=!0,this.emit(t.preEvent,e);const l=t.keepPlaying,c=t.keepTime,u="none"==this.options.preload,d=u?"loadstart":"loadedmetadata",h=l&&o;let g;const p=n=>{this.$root&&(this.off(d,v),this.emit(t.brokenEvent,{source:g||e,error:n}),"videosourcechanged"==t.event?this.isSourceChanging=!1:this.load(this.options.source).then(m).finally((()=>{this.isSourceChanging=!1})),i(n))},m=()=>{r!=this.volume&&this.setVolume(r),s!=this.playbackRate&&this.setPlaybackRate(s),u&&c&&this.$video.load(),c&&!this.options.isLive&&this.seek(a),h&&!this.isPlaying&&this.$video.play(),Object.assign(this.options.source,g)},v=()=>{this.$root&&(this.off("error",p),m(),this.isSourceChanging=!1,this.emit(t.event,g),n())};return(e instanceof Promise?e:Promise.resolve(e)).then((e=>{if(!e.src)throw new Error("Empty Source");return g=e,this.$video.poster=e.poster||"",this.once("error",p),this.once(d,v),e})).then((e=>this.load(e))).catch(p)}))}async destroy(){e.players.splice(e.players.indexOf(this),1);const t=this.eventEmitter,n=this.loader,i=this.plugins,o=this.container,a=this.$root,r=this.$video,s=this.isPlaying,l=this.isFullScreen,c=this.isInPip;t.emit("destroy"),t.offAll(),await(null==n?void 0:n.destroy());for await(const e of i)!e.load&&(null==e?void 0:e.destroy)&&await e.destroy();s&&this.pause(),l&&this.exitFullscreen(),c&&this.exitPip(),r.src&&URL.revokeObjectURL(r.src),o.removeChild(a),this.eventEmitter=this.locales=this.options=this.listeners=this.context=this.plugins=this.container=this.$root=this.$video=this.loader=void 0}get isNativeUI(){return this.options.isNativeUI()}get state(){return this.$video.readyState}get isPlaying(){return!this.$video.paused}get isMuted(){return this.$video.muted}get isEnded(){return this.$video.ended}get isLoop(){return this.$video.loop}get isAutoPlay(){return this.$video.autoplay}get duration(){return this.$video.duration}get buffered(){return this.$video.buffered}get currentTime(){return this.$video.currentTime}get volume(){return this.$video.volume}get playbackRate(){return this.$video.playbackRate}get _requestFullscreen(){return HTMLElement.prototype.requestFullscreen||HTMLElement.prototype.webkitRequestFullscreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.msRequestFullscreen}get _exitFullscreen(){return Document.prototype.exitFullscreen||Document.prototype.webkitExitFullscreen||Document.prototype.cancelFullScreen||Document.prototype.mozCancelFullScreen||Document.prototype.msExitFullscreen}static get version(){return"1.2.38-beta.2"}};V.players=[];let _=V;globalThis.window&&console.log("%cOPlayer%c v%s\n %c\nOh! Another HTML5 video player.\nhttps://github.com/shiyiya/oplayer\n","font-size:32px;","font-size:12px;color:#999999;",_.version,"font-size:14px;");const U=Object.freeze(Object.defineProperty({__proto__:null,get $(){return m},Player:_,default:_,isIOS:C,isMobile:A,isObject:g,isPlainObject:function(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},isQQBrowser:P,isSafari:$,isUndefined:z,isiPad:T,isiPhone:S,loadSDK:R,loadScript:O,mergeDeep:p},Symbol.toStringTag,{value:"Module"}));var Q,W,X,Y,K,G,J,Z;function ee(e,t){return t||(t=e.slice(0)),e.raw=t,e}const te=m.cls("loading"),ne=m.cls("playing"),ie=m.cls("focused"),oe=m.cls("fullscreen"),ae=m.cls("settingShown"),re=m.css("display:none"),se="data-ctrl-hidden",le=m.css({["."+ne]:{cursor:"none"}}),ce=m.cls("error"),ue=m.css(Q||(Q=ee(["\n z-index: 99 !important;\n position: fixed !important;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;"]))),de=m.css({background:"none",border:"none",cursor:"pointer",padding:0,outline:"none",font:"inherit",color:"inherit",fill:"#fff","line-height":"inherit","text-align":"inherit",width:"100%","-webkit-tap-highlight-color":"transparent","user-select":"none"}),he=m.css({"& > *:nth-child(1)":{display:"none"}}),ge=m.css({"& > *:nth-child(2)":{display:"none"}}),pe=A?"":m.css({position:"relative","&:hover":{"&::after":{opacity:1,transform:"translateX(-50%) scale(1)"},"&:not([data-tooltip-pos]):last-child::after":{right:0,left:"auto",transform:"translateY(0) scale(1)"},"&[data-tooltip-pos=down]::after":{transform:"translateX(-50%) scale(1)"},"&[data-tooltip-pos=down]:last-child::after":{right:0,transform:"translateY(0) scale(1)"}},"&::after":{position:"absolute",content:"attr(aria-label)",bottom:"100%",left:"50%","margin-bottom":"0.5em","white-space":"nowrap",background:"var(--shadow-background-color)",transform:"translate(-50%, 10px) scale(.8)","transform-origin":"50% 100%",opacity:0,padding:"6px 8px","border-radius":"2px",transition:"transform .2s ease .1s,opacity .2s ease .1s","pointer-events":"none","font-size":"0.75em"},"&[data-tooltip-pos=down]::after":{top:"100%",bottom:"auto","margin-top":"0.5em",transform:"translate(-50%, -10px) scale(.8)"},"&[data-tooltip-pos=down]:last-child::after":{right:0,top:"100%",bottom:"unset",left:"auto","margin-top":"0.5em",transform:"translateY(-10px) scale(.8)","transform-origin":"100% 0"},"&:not([data-tooltip-pos]):last-child::after":{right:0,left:"auto",transform:"translateY(10px) scale(.8)","transform-origin":"100% 100%"}}),me={play:'<svg viewBox="0 0 1024 1024"><path d="M245.76 785.203V238.797c0-50.442 34.918-69.182 77.967-42.046l422.196 266.117c43.11 27.157 43.069 71.128 0 98.284L323.727 827.249c-43.11 27.177-77.967 8.315-77.967-42.046z" /></svg>',pause:'<svg viewBox="0 0 1024 1024"><path d="M327.68 184.32a81.92 81.92 0 0 1 81.92 81.92v491.52a81.92 81.92 0 1 1-163.84 0V266.24a81.92 81.92 0 0 1 81.92-81.92z m368.64 0a81.92 81.92 0 0 1 81.92 81.92v491.52a81.92 81.92 0 1 1-163.84 0V266.24a81.92 81.92 0 0 1 81.92-81.92z" /></svg>',volume:['<svg viewBox="0 0 1024 1024"><path d="M128 426.666667v170.666666c0 23.466667 19.2 42.666667 42.666667 42.666667h128l140.373333 140.373333c26.88 26.88 72.96 7.68 72.96-30.293333V273.493333c0-37.973333-46.08-57.173333-72.96-30.293333L298.666667 384H170.666667c-23.466667 0-42.666667 19.2-42.666667 42.666667z m576 85.333333A192 192 0 0 0 597.333333 340.053333v343.466667c63.146667-31.146667 106.666667-96 106.666667-171.52zM597.333333 189.866667v8.533333c0 16.213333 10.666667 30.293333 25.6 36.266667C733.013333 278.613333 810.666667 386.56 810.666667 512s-77.653333 233.386667-187.733334 277.333333c-15.36 5.973333-25.6 20.053333-25.6 36.266667v8.533333c0 26.88 26.88 45.653333 51.626667 36.266667C793.6 815.36 896 675.84 896 512s-102.4-303.36-247.04-358.4c-24.746667-9.813333-51.626667 9.386667-51.626667 36.266667z"></path></svg>','<svg viewBox="0 0 1024 1024"><path d="M154.88 154.88a42.496 42.496 0 0 0 0 60.16L311.04 371.2 298.666667 384H170.666667c-23.466667 0-42.666667 19.2-42.666667 42.666667v170.666666c0 23.466667 19.2 42.666667 42.666667 42.666667h128l140.373333 140.373333c26.88 26.88 72.96 7.68 72.96-30.293333v-177.92l178.346667 178.346667c-20.906667 15.786667-43.52 29.013333-68.266667 38.826666-15.36 6.4-24.746667 22.613333-24.746667 39.253334 0 30.72 31.146667 50.346667 59.306667 38.826666 34.133333-14.08 66.133333-32.853333 94.72-55.893333l57.173333 57.173333a42.496 42.496 0 1 0 60.16-60.16L215.466667 154.88c-16.64-16.64-43.52-16.64-60.586667 0zM810.666667 512c0 34.986667-6.4 68.693333-17.493334 99.84l65.28 65.28c23.893333-49.92 37.546667-105.813333 37.546667-165.12 0-163.413333-102.4-303.36-246.613333-358.4-25.173333-9.813333-52.053333 9.813333-52.053334 36.693333v8.106667c0 16.213333 10.666667 30.293333 26.026667 36.266667C733.013333 279.04 810.666667 386.56 810.666667 512z m-371.626667-268.373333l-7.253333 7.253333L512 331.093333V273.493333c0-37.973333-46.08-56.746667-72.96-29.866666zM704 512A192 192 0 0 0 597.333333 340.053333v76.373334l105.813334 105.813333c0.426667-3.413333 0.853333-6.826667 0.853333-10.24z"></path></svg>'],fullscreen:['<svg viewBox="-113 -113 1250 1250"><path d="M0 232.732444A232.732444 232.732444 0 0 1 232.732444 0h558.535112A232.732444 232.732444 0 0 1 1024 232.732444v558.535112A232.732444 232.732444 0 0 1 791.267556 1024H232.732444A232.732444 232.732444 0 0 1 0 791.267556V232.732444z m232.732444-139.662222a139.662222 139.662222 0 0 0-139.662222 139.662222v558.535112a139.662222 139.662222 0 0 0 139.662222 139.662222h558.535112a139.662222 139.662222 0 0 0 139.662222-139.662222V232.732444a139.662222 139.662222 0 0 0-139.662222-139.662222H232.732444z"></path><path d="M549.575111 245.845333c0-25.799111 20.935111-46.734222 46.734222-46.734222h116.821334A140.202667 140.202667 0 0 1 853.333333 339.313778v116.821333a46.734222 46.734222 0 0 1-93.468444 0v-116.821333c0-25.827556-20.906667-46.734222-46.734222-46.734222h-116.821334a46.734222 46.734222 0 0 1-46.734222-46.734223zM245.845333 549.546667c25.799111 0 46.734222 20.935111 46.734223 46.734222v116.821333c0 25.827556 20.906667 46.734222 46.734222 46.734222h116.821333a46.734222 46.734222 0 0 1 0 93.468445h-116.821333A140.202667 140.202667 0 0 1 199.111111 713.130667v-116.821334c0-25.799111 20.935111-46.734222 46.734222-46.734222z"></path></svg>','<svg viewBox="-113 -113 1250 1250"><path d="M0.739556 233.130667a232.391111 232.391111 0 0 1 232.391111-232.391111h557.738666a232.391111 232.391111 0 0 1 232.391111 232.391111v557.738666a232.391111 232.391111 0 0 1-232.391111 232.391111H233.130667a232.391111 232.391111 0 0 1-232.391111-232.391111V233.130667z m232.391111-139.434667a139.434667 139.434667 0 0 0-139.434667 139.434667v557.738666a139.434667 139.434667 0 0 0 139.434667 139.434667h557.738666a139.434667 139.434667 0 0 0 139.434667-139.434667V233.130667a139.434667 139.434667 0 0 0-139.434667-139.434667H233.130667z"></path><path d="M601.088 186.652444c25.685333 0 46.506667 20.792889 46.506667 46.478223v96.796444c0 25.685333 20.792889 46.478222 46.478222 46.478222h96.796444a46.478222 46.478222 0 1 1 0 92.984889h-96.796444a139.434667 139.434667 0 0 1-139.463111-139.463111V233.130667c0-25.685333 20.821333-46.478222 46.478222-46.478223z m-414.435556 414.435556c0-25.656889 20.792889-46.478222 46.478223-46.478222h96.796444a139.434667 139.434667 0 0 1 139.463111 139.463111v96.796444a46.478222 46.478222 0 0 1-92.984889 0v-96.796444c0-25.685333-20.792889-46.478222-46.478222-46.478222H233.130667a46.478222 46.478222 0 0 1-46.478223-46.506667z"></path></svg>'],pip:['<svg viewBox="0 0 1024 1024"><path d="M768 213.333333H256a85.333333 85.333333 0 0 0-85.333333 85.333334v426.666666a85.333333 85.333333 0 0 0 85.333333 85.333334h170.666667a42.666667 42.666667 0 1 1 0 85.333333H256a170.666667 170.666667 0 0 1-170.666667-170.666667V298.666667a170.666667 170.666667 0 0 1 170.666667-170.666667h512a170.666667 170.666667 0 0 1 170.666667 170.666667v128a42.666667 42.666667 0 1 1-85.333334 0V298.666667a85.333333 85.333333 0 0 0-85.333333-85.333334z m-128 341.333334a128 128 0 0 0-128 128v85.333333a128 128 0 0 0 128 128h170.666667a128 128 0 0 0 128-128v-85.333333a128 128 0 0 0-128-128h-170.666667z"></path></svg>','<svg viewBox="0 0 1024 1024"><path d="m768,213.33333l-512,0a85.33333,85.33333 0 0 0 -85.33333,85.33334l0,426.66666a85.33333,85.33333 0 0 0 85.33333,85.33334l170.66667,0a42.66667,42.66667 0 1 1 0,85.33333l-170.66667,0a170.66667,170.66667 0 0 1 -170.66667,-170.66667l0,-426.66666a170.66667,170.66667 0 0 1 170.66667,-170.66667l512,0a170.66667,170.66667 0 0 1 170.66667,170.66667l0,128a42.66667,42.66667 0 1 1 -85.33334,0l0,-128a85.33333,85.33333 0 0 0 -85.33333,-85.33334zm-128,341.33334a128,128 0 0 0 -128,128l0,85.33333a128,128 0 0 0 128,128l170.66667,0a128,128 0 0 0 128,-128l0,-85.33333a128,128 0 0 0 -128,-128l-170.66667,0z"></path><g stroke="null"><g stroke="null" transform="matrix(0.6896517266997474,0,0,0.6896517266997474,-10241.200782450309,-10001.206060939305) "><rect stroke="null" x="15122.523407" y="14826.656681" width="582" height="402" fill="none"></rect></g><g stroke="null" transform="matrix(0.6896517266997474,0,0,0.6896517266997474,-10241.200782450309,-10001.206060939305) "><path stroke="null" d="m15503.523407,14924.856681l-161.8,0c-66.2,0 -120,53.8 -120,120l0,161.8c0,22.1 17.9,40 40,40s40,-17.9 40,-40l0,-144.4l169.8,169.8c7.8,7.8 18,11.7 28.3,11.7c10.2,0 20.5,-3.9 28.3,-11.7c15.6,-15.6 15.6,-40.9 0,-56.6l-170.7,-170.6l146.1,0c22.1,0 40,-17.9 40,-40s-17.9,-40 -40,-40z"></path></g></g></svg>'],setting:'<svg viewBox="0 0 1024 1024" style="transform: scale(1.1);"><path d="M0 0h1024v1024H0z" fill-opacity="0"></path><path d="M501.333333 127.573333a21.333333 21.333333 0 0 1 21.333334 0l316.928 182.954667a21.333333 21.333333 0 0 1 10.666666 18.474667v365.994666a21.333333 21.333333 0 0 1-10.666666 18.474667L522.666667 896.426667a21.333333 21.333333 0 0 1-21.333334 0l-316.928-182.954667a21.333333 21.333333 0 0 1-10.666666-18.474667V328.96a21.333333 21.333333 0 0 1 10.666666-18.474667zM512 219.946667L259.029333 365.952v292.053333L512 804.010667l252.928-146.005334V365.952L512 219.946667zM512 426.666667a85.333333 85.333333 0 1 1 0 170.666666 85.333333 85.333333 0 0 1 0-170.666666z"></path></svg>\n',screenshot:'<svg viewBox="0 0 1024 1024"><path d="M412.245333 757.333333a42.666667 42.666667 0 0 1-56.490666-64l356.48-314.794666a42.666667 42.666667 0 0 1 56.746666 0.256l112.896 101.461333a42.666667 42.666667 0 1 1-57.088 63.488L740.266667 467.626667l-328.021334 289.706666zM810.666667 213.333333h-128a42.666667 42.666667 0 0 1 0-85.333333h170.666666a42.666667 42.666667 0 0 1 42.666667 42.666667v170.666666a42.666667 42.666667 0 0 1-85.333333 0V213.333333zM213.333333 213.333333v128a42.666667 42.666667 0 1 1-85.333333 0V170.666667a42.666667 42.666667 0 0 1 42.666667-42.666667h170.666666a42.666667 42.666667 0 1 1 0 85.333333H213.333333z m597.333334 597.333334v-128a42.666667 42.666667 0 0 1 85.333333 0v170.666666a42.666667 42.666667 0 0 1-42.666667 42.666667h-170.666666a42.666667 42.666667 0 0 1 0-85.333333h128zM213.333333 810.666667h128a42.666667 42.666667 0 0 1 0 85.333333H170.666667a42.666667 42.666667 0 0 1-42.666667-42.666667v-170.666666a42.666667 42.666667 0 0 1 85.333333 0v128z m170.666667-298.666667a128 128 0 1 1 0-256 128 128 0 0 1 0 256z m0-85.333333a42.666667 42.666667 0 1 0 0-85.333334 42.666667 42.666667 0 0 0 0 85.333334z"></path></svg>',playbackRate:'<svg viewBox="0 0 1024 1024"><path d="M512 951.04a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z m0-819.2a384 384 0 1 0 384 384A384 384 0 0 0 512 132.096z"></path><path d="M468.992 493.824l-130.048-75.008a20.992 20.992 0 0 0-31.232 18.176v150.016a20.992 20.992 0 0 0 31.232 18.176l130.048-75.008a20.992 20.992 0 0 0 0-36.352zM684.8 493.824l-129.536-75.008a21.248 21.248 0 0 0-31.744 18.432v149.504a21.248 21.248 0 0 0 31.744 18.432l129.536-75.008a20.992 20.992 0 0 0 0-36.352z"></path></svg>',subtitle:'<svg viewBox="0 0 1024 1024" version="1.1"><path d="M800 170.666667A138.666667 138.666667 0 0 1 938.666667 309.333333v405.546667a138.666667 138.666667 0 0 1-138.666667 138.666667H224A138.666667 138.666667 0 0 1 85.333333 714.88V309.333333a138.666667 138.666667 0 0 1 130.816-138.453333L224 170.666667h576z m0 64H224l-6.144 0.256A74.666667 74.666667 0 0 0 149.333333 309.333333v405.546667c0 41.216 33.450667 74.666667 74.666667 74.666667h576a74.666667 74.666667 0 0 0 74.666667-74.666667V309.333333a74.666667 74.666667 0 0 0-74.666667-74.666666zM234.666667 512c0-134.229333 115.754667-203.733333 218.538666-145.109333A32 32 0 0 1 421.461333 422.4C361.856 388.437333 298.666667 426.410667 298.666667 512c0 85.546667 63.317333 123.562667 122.88 89.728a32 32 0 0 1 31.573333 55.637333C350.549333 715.733333 234.666667 646.101333 234.666667 512z m320 0c0-134.229333 115.754667-203.733333 218.538666-145.109333a32 32 0 0 1-31.744 55.552C681.856 388.437333 618.666667 426.410667 618.666667 512c0 85.546667 63.317333 123.562667 122.88 89.728a32 32 0 0 1 31.573333 55.637333C670.549333 715.733333 554.666667 646.101333 554.666667 512z"></path></svg>',loop:'<svg viewBox="0 0 32 32"><g><path d="m16 2a13.9 13.9 0 0 0 -9 3.32v-2.32a1 1 0 0 0 -2 0v5a1 1 0 0 0 1 1h5a1 1 0 0 0 0-2h-2.89a11.87 11.87 0 0 1 7.89-3 12 12 0 1 1 -11.67 9.23 1 1 0 1 0 -1.94-.46 13.72 13.72 0 0 0 -.39 3.23 14 14 0 1 0 14-14z"/><path d="m14 21.2a2 2 0 0 0 1.06-.31l5.11-3.19a2 2 0 0 0 0-3.4l-5.11-3.19a2 2 0 0 0 -3.06 1.69v6.4a2 2 0 0 0 2 2zm0-8.4 5.11 3.2-5.11 3.2z"/></g></svg>',quality:'<svg viewBox="0 0 32 32"><g><path d="m16 2a14 14 0 1 0 14 14 14 14 0 0 0 -14-14zm0 26a12 12 0 1 1 12-12 12 12 0 0 1 -12 12z"/><path d="m14.5 11a1 1 0 0 0 -1 1v3h-2v-3a1 1 0 0 0 -2 0v8a1 1 0 0 0 2 0v-3h2v3a1 1 0 0 0 2 0v-8a1 1 0 0 0 -1-1z"/><path d="m19.5 11h-2a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h2a3 3 0 0 0 3-3v-4a3 3 0 0 0 -3-3zm1 7a1 1 0 0 1 -1 1h-1v-6h1a1 1 0 0 1 1 1z"/></g></svg>',lang:'<svg viewBox="0 0 1024 1024"><path d="M512 85.333333C277.333333 85.333333 85.333333 277.333333 85.333333 512s192 426.666667 426.666667 426.666667 426.666667-192 426.666667-426.666667S746.666667 85.333333 512 85.333333z m294.4 256H682.666667c-12.8-55.466667-34.133333-102.4-59.733334-153.6 76.8 29.866667 145.066667 81.066667 183.466667 153.6zM512 170.666667c34.133333 51.2 64 106.666667 81.066667 170.666666h-162.133334c17.066667-59.733333 46.933333-119.466667 81.066667-170.666666zM183.466667 597.333333c-8.533333-25.6-12.8-55.466667-12.8-85.333333s4.266667-59.733333 12.8-85.333333h145.066666c-4.266667 29.866667-4.266667 55.466667-4.266666 85.333333s4.266667 55.466667 4.266666 85.333333H183.466667z m34.133333 85.333334H341.333333c12.8 55.466667 34.133333 102.4 59.733334 153.6-76.8-29.866667-145.066667-81.066667-183.466667-153.6zM341.333333 341.333333H217.6c42.666667-72.533333 106.666667-123.733333 183.466667-153.6C375.466667 238.933333 354.133333 285.866667 341.333333 341.333333z m170.666667 512c-34.133333-51.2-64-106.666667-81.066667-170.666666h162.133334c-17.066667 59.733333-46.933333 119.466667-81.066667 170.666666z m98.133333-256H413.866667c-4.266667-29.866667-8.533333-55.466667-8.533334-85.333333s4.266667-55.466667 8.533334-85.333333h200.533333c4.266667 29.866667 8.533333 55.466667 8.533333 85.333333s-8.533333 55.466667-12.8 85.333333z m12.8 238.933334c25.6-46.933333 46.933333-98.133333 59.733334-153.6h123.733333c-38.4 72.533333-106.666667 123.733333-183.466667 153.6z m76.8-238.933334c4.266667-29.866667 4.266667-55.466667 4.266667-85.333333s-4.266667-55.466667-4.266667-85.333333h145.066667c8.533333 25.6 12.8 55.466667 12.8 85.333333s-4.266667 59.733333-12.8 85.333333h-145.066667z"></path></svg>',progressIndicator:null,loadingIndicator:null,previous:null,next:null,chromecast:null,airplay:null,danmaku:null,playlist:null};var ve,fe;(fe=ve||(ve={})).setupIcons=e=>{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(me[t]=e[t]);return me},fe.get=e=>me[e];const be=e=>{const t=()=>e.$root.classList.add(te),n=()=>{e.isSourceChanging||e.$root.classList.remove(te)};"none"!=e.$video.preload&&t(),e.on("loadstart",(()=>{"none"==e.$video.preload&&n()})),e.on(["loading","waiting","seeking","videoqualitychange","videosourcechange"],t),e.on(["loaded","canplaythrough","playing","pause","seeked","error"],n),e.on(e.options.autoplay||$?"loadedmetadata":"canplay",(()=>e.$root.classList.remove(te))),e.options.isLive||e.on(["waiting","playing"],(()=>{const i=e.currentTime,o=()=>{i!==e.currentTime?(n(),e.off("timeupdate",o)):t()};e.on("timeupdate",o)}))},ye=(e,t)=>{(e=>{e.on("play",(()=>{e.$root.classList.add(ne)})),e.on(["pause","videosourcechange"],(()=>{e.$root.classList.remove(ne)}))})(e),be(e),(e=>{e.on("fullscreenchange",(t=>{if(t.payload.isWeb)e.$root.classList.toggle(ue);else{if(!e._requestFullscreen)return;e.$root.classList.toggle(oe)}}))})(e),A||((e,t)=>{function n(t){let n=t.target;n&&(e.$root.contains(n)||e.$root==n)?e.$root.classList.add(ie):e.$root.classList.remove(ie)}t&&e.$root.classList.add(ie),document.addEventListener("click",n),document.addEventListener("contextmenu",n),e.on("destroy",(()=>{document.removeEventListener("click",n),document.removeEventListener("contextmenu",n)}))})(e,t.autoFocus)};function ke(e,t,n){return Math.min(Math.max(e,t),n)}function xe(e){return e<10?"0"+e:""+e}function we(e){if(!isFinite(e))return"--:--";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=Math.floor(e%3600%60);return(t>0?xe(t)+":":"")+xe(n)+":"+xe(i)}const Ee=e=>{if((e=>e.$root.classList.contains(te))(e)||isNaN(e.duration))return void e.emit("notice",{text:e.locales.get("Please wait for loading to complete")});const t=(e=>{var t;try{const n=e.$video,i=e.$root,o=e.context.ui,a=document.createElement("canvas"),r=n.videoWidth,s=n.videoHeight;a.width=r,a.height=s,a.getContext("2d").drawImage(n,0,0,r,s);const l=(null==(t=o.$watermark)?void 0:t.style)||{},c=l.top,u=l.left,d=l.right,h=l.bottom;if(o.$watermark&&[c,u,d,h].filter((e=>null!=e)).length>1){const e=o.$watermark,t=e.offsetLeft,n=e.offsetTop,s=e.offsetWidth,l=e.offsetHeight,g=o.$watermark.getBoundingClientRect(),p=g.width,m=g.height;let v=0,f=0;u?v=t:d&&(v=r-(i.clientWidth-t-s)-s),c?f=n:h&&(f=r-(i.clientHeight-n-l)-l),a.getContext("2d").drawImage(o.$watermark,v,f,p,m)}return a.toDataURL("image/png")}catch(n){return n}})(e);if(t instanceof Error)e.emit("notice",{text:t.message});else{!function(e,t){const n=document.createElement("a");n.href=e,n.download=t,n.click()}(t,(e.options.source.title||"OPlayer-ScreenShot")+"-"+we(e.currentTime).replace(/:/g,"-")+".png")}},Le=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,n=null;const i=()=>n&&clearTimeout(n);return{callee:()=>{i(),n=setTimeout((()=>{e()}),t)},clear:i}};function Te(e,t){return e.classList.add(t),e}function Se(e,t){return e.classList.remove(t),e}function $e(e,t){return e.classList.contains(t)}const Ce={dragStart:A?"touchstart":"mousedown",dragMove:A?"touchmove":"mousemove",dragEnd:A?"touchend":"mouseup"},Ae={ARROWUP:e=>{const t=100*e.volume+10;e.setVolume(t/100),e.emit("notice",{text:e.locales.get("Volume: %s",~~(100*e.volume)+"%")})},ARROWDOWN:e=>{const t=100*e.volume-10;e.setVolume(t/100),e.emit("notice",{text:e.locales.get("Volume: %s",~~(100*e.volume)+"%")})},ARROWLEFT:(e,t)=>{var n,i;if(e.options.isLive||e.hasError)return;e.currentTime-((null==(n=t.theme.progress)?void 0:n.backward)||5)<0?e.seek(0):e.seek(e.currentTime-((null==(i=t.theme.progress)?void 0:i.forward)||5)),e.emit("notice",{text:we(e.currentTime)+" / "+we(e.duration)})},ARROWRIGHT:e=>{e.options.isLive||e.hasError||(e.seek(e.currentTime+5),e.emit("notice",{text:we(e.currentTime)+" / "+we(e.duration)}))}," ":e=>e.togglePlay(),K:e=>e.togglePlay(),ESCAPE:e=>{e.isFullScreen?e.exitFullscreen():e.$root.classList.contains(ue)&&e.emit("fullscreenchange",{isWeb:!0})},F:e=>e.toggleFullScreen(),W:e=>e.emit("fullscreenchange",{isWeb:!0}),S:Ee,M:e=>e.isMuted?e.unmute():e.mute()};function Pe(e){var t,n;const i=e.player,o=e.config;function a(e){var t,n,a;if("INPUT"==(null==(t=document.activeElement)?void 0:t.tagName)||"TEXTAREA"==(null==(n=document.activeElement)?void 0:n.tagName)||(null==(a=document.activeElement)?void 0:a.getAttribute("contenteditable"))||o.keyboard.focused&&!(e=>e.$root.classList.contains(ie))(i)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;const r=e.key.toLocaleUpperCase();Ae[r]&&(e.preventDefault(),Ae[r](i,o))}(!A||(null==(t=o.keyboard)?void 0:t.focused)||(null==(n=o.keyboard)?void 0:n.global))&&(e.keyboard={register:function(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Ae[t]=e[t])},unregister:function(e){e.forEach((e=>{delete Ae[e]}))}},document.addEventListener("keydown",a),i.on("destroy",(()=>{document.removeEventListener("keydown",a)})))}const Oe="speed";function Me(e){var t;const n=e.player,i=e.config.theme,o=e.$mask,a=null==(t=i.controller)?void 0:t.slideToSeek;A&&!n.options.isLive&&a&&"none"!=a&&n.once("loadedmetadata",(()=>{let e,t=0,i=0,r=0,s=0;const l=n.$root.getBoundingClientRect();function c(e){if(0==t&&0==i)return;const o=e.changedTouches[0],a=o.clientX,r=o.clientY,c=a-t,u=i-r;if(Math.abs(c)<2&&Math.abs(u)<2)return;const d=function(e,t){return 180*Math.atan2(t,e)/Math.PI}(c,u);(d>=-45&&d<45||d>=135&&d<=180||d>=-180&&d<-135)&&(e.preventDefault(),s=60*c/l.width,n.emit("notice",{text:we(ke(n.currentTime+s,0,n.duration))+" / "+we(n.duration),pos:"top"}))}function u(){0==t&&0==i||("long-touch"==a&&r<1e3&&(e&&clearInterval(e),o.removeEventListener("touchmove",c)),Math.abs(s)>=1&&n.seek(ke(n.currentTime+s,0,n.duration)),t=i=s=r=0)}"always"==a&&(o.addEventListener("touchstart",(e=>{if($e(n.$root,ae))return;const o=e.changedTouches[0],a=o.clientX,r=o.clientY;t=a,i=r})),o.addEventListener("touchmove",c),o.addEventListener("touchend",u)),"long-touch"==a&&o.addEventListener("touchstart",(a=>{if($e(n.$root,ae))return;const s=a.changedTouches[0],l=s.clientX,d=s.clientY;t=l,i=d,e=window.setInterval((()=>{r+=100,r>=1e3&&(clearInterval(e),n.emit("notice",{text:"slid left or right to seek",pos:"top"}),o.addEventListener("touchmove",c))}),100),o.addEventListener("touchend",u,{once:!0})}))}))}const ze=m.css(W||(W=ee(["\n font-variant-numeric: tabular-nums;\n font-size: 0.875em;\n"]))),Re=m.css("width:0.5em!important;height:0.5em!important;;background-color:var(--primary-color);border-radius:50%;margin-right:0.5em"),Be=m.css("\n position: absolute;\n top: 10px;\n right: 50%;\n border-radius: 2px;\n box-sizing: border-box;\n transform: translate(50%, -100%);\n transition: opacity 0.2s ease, top 0.2s ease;\n font-size: 0.875em;\n"),Fe=m.css("\n top: calc(100% - 10px);\n right: 50%;\n transform: translateX(50%);\n"),je=m.css({position:"relative",display:"flex",["& ."+Be]:{visibility:"hidden",opacity:0,"background-color":"var(--shadow-background-color)"}}),qe=m.css({"&:hover":{"padding-top":"0.5em","margin-top":"-0.5em",["& ."+Be]:{visibility:"visible",opacity:1,top:0}},"&[data-dropdown-pos=top]:hover":{"padding-bottom":"0.5em","margin-bottom":"-0.5em",["& ."+Be]:{top:"100%"}}}),Ie=m.css({padding:"0 0.5em","min-width":"6em",display:"block",height:"2.4em","line-height":"2.4em",cursor:"pointer","text-align":"center","word-break":"keep-all","&:nth-last-child(1)":{"margin-bottom":"0px"},"& *":{"pointer-events":"none"},"&[aria-checked=true]":{color:"var(--primary-color)"},"&:hover":{"background-color":"rgba(255, 255, 255, 0.1)"}}),He=m.cls("textIcon"),De=m.css({display:"flex","align-items":"center",["& > ."+de+":last-child"+(A?", & > ."+de+'[aria-label="Play"], & > .'+de+'[aria-label="Pause"]':"")]:{"margin-right":0}}),Ne=m.css({color:"#fff",height:"2.375em",display:"flex","box-sizing":"border-box","justify-content":"space-between","align-items":"center","padding-bottom":A?0:"0.25em",["& ."+de+"."+He]:{width:"auto","min-width":"2em","font-size":"0.875em",padding:"0 4px","border-radius":"2px","& > *":{height:"auto",width:"auto"}},["& ."+de]:Object.assign({width:"2em",height:A?"auto":"2em","margin-right":"0.5em","justify-content":"center","align-items":"center",display:"inline-flex","& > *":{height:"1.5em",width:"1.5em","pointer-events":"none"}},A?{"&:active > *":{transform:"scale(.9)"}}:{"&:hover":{"background-color":"rgb(255 255 255 / .2)"}})}),Ve=m.css({flex:1,height:"100%","padding-left":"0.5em","> div":{height:"100%",display:"flex","align-items":"center"}}),_e=m.css("display: block;"),Ue=m.css("min-width: 15.5em;"),Qe=m.css("min-width: 10.5em;"),We=m.css("\n display: none;\n width: 1.4em;\n height: 1.4em;\n"),Xe=m.css("\n width: 2em;\n height: 2em;\n margin: 0 -10px 0 -5px;\n"),Ye=m.css("\n width: 2em;\n height: 2em;\n transform: rotate(180deg);\n margin-left: -10px;\n"),Ke=m.css({position:"absolute",cursor:"pointer",top:"0",left:"0",right:"0",bottom:"0","background-color":"#ccc",transition:".3s","border-radius":"34px","&:before":{position:"absolute",content:'""',height:"1em",width:"1em",left:"0.25em",bottom:"0.1875em","background-color":"white",transition:".3s","border-radius":"50%"}}),Ge=m.css("\n position: relative;\n width: 2.5em;\n height: 1.375em;\n"),Je=m.css("\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.7);\n font-size: 0.8em;\n"),Ze=m.css({height:"2.4em",cursor:"pointer",color:"#fff","justify-content":"space-between","align-items":"center",padding:"0 0.75em","line-height":"1",display:"flex",overflow:"hidden","&:not([aria-label=slider]) > *":{"pointer-events":"none"},"&:hover":{"background-color":"rgba(255, 255, 255, 0.1)"},"&[aria-checked='true']":{["& ."+We]:{display:"block"},"&[data-index]":{"background-color":"rgba(255, 255, 255, 0.1)"},["& ."+Ke]:{"background-color":"var(--primary-color)","&:before":{transform:"translateX(1em)"}}}}),et=m.css({display:"flex","align-items":"center","margin-right":"10px","& > svg":{width:"1.7em",height:"1.7em","margin-right":"0.5em"}}),tt=m.css("\n display: flex;\n align-items: center;\n justify-content: flex-end;\n"),nt=m.css({width:"100%",display:"flex","align-items":"center","border-bottom":"1px solid rgb(255 255 255 / 10%)"}),it=m.css({"-webkit-appearance":"none",width:"90%",height:"0.4em",outline:"none","border-radius":"34px",background:"rgb(204, 204, 204)",margin:"0",cursor:"pointer",position:"relative","&::-webkit-slider-thumb":{"-webkit-appearance":"none",appearance:"none",background:"#fff",height:"1em",width:"1em","border-radius":"50%",border:"none"},"&:hover::before":{visibility:"visible"},"::before":{position:"absolute",left:"-0.3em",top:"50%",transform:"translate(-100%, -50%)",content:"attr(value)",color:"rgba(255, 255, 255, 0.7)",visibility:"hidden","font-size":"0.8em"}}),ot=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xe;return"<svg "+(e?'class="'+e+'"':"")+' viewBox="0 0 32 32"><path d="m 12.59,20.34 4.58,-4.59 -4.58,-4.59 1.41,-1.41 6,6 -6,6 z" fill="#fff"></path></svg>'},at=function(e){return'<div class="'+et+'">\n '+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+"\n <span>"+e+"</span>\n </div>\n <div class="+tt+'>\n <span role="label" class='+Je+"></span>\n "+ot()+"\n </div>\n"};function rt(e){let t=e.type,n=e.key,i=e.name,o=e.icon,a=e.default,r=e.index,s=e.max,l=e.min,c=e.step,u=e.hasChildren,d=m.create("div."+Ze,{"data-key":n,role:"option"==t?"menuitemradio":"menuitem","aria-haspopup":!!u&&"menu","aria-label":t||"menuitem"});const h={$row:d,$label:void 0};switch(t){case"switcher":d.innerHTML=function(e){return'<div class="'+et+'">\n '+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+"\n <span>"+e+"</span>\n </div>\n <div class="+tt+">\n <label class="+Ge+">\n <span class="+Ke+"></span>\n </label>\n </div>\n"}(i,o),d.setAttribute("aria-checked",a||!1);break;case"selector":d.innerHTML=at(i,o),h.$label=d.querySelector('span[role="label"]');break;case"back":d.innerHTML=(e=>'<div class="'+nt+'">\n '+ot(Ye)+"\n <span>"+e+"</span>\n </div>\n")(i);break;case"slider":d.innerHTML=(e=>{let t=e.name,n=e.icon,i=void 0===n?"":n,o=e.max,a=void 0===o?1:o,r=e.min,s=void 0===r?0:r,l=e.value,c=void 0===l?0:l,u=e.step;return'<div class="'+et+'">\n '+i+"\n <span>"+t+"</span>\n </div>\n <div class="+tt+'>\n <input type="range" min="'+s+'" max="'+a+'" step="'+(void 0===u?1:u)+'" value="'+c+'" class="'+it+'" />\n </div>'})({name:i,max:s,min:l,icon:o,value:a,step:c});break;case"option":d.innerHTML=function(e){return'<div class="'+et+'">\n '+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+"\n <span>"+e+"</span>\n </div>\n <svg class="+We+' viewBox="0 0 24 24">\n <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" fill="#fff"></path>\n </svg>\n'}(i,o),d.setAttribute("aria-checked",a||!1),"number"==typeof r&&d.setAttribute("data-index",r.toString());break;default:d.innerHTML=u?at(i,o):function(e){return'<div class="'+et+'">\n '+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+"\n <span>"+e+"</span>\n </div>\n"}(i,o)}return h}function st(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!n||0==n.length)return;const o=i.key,a=i.target,r=i.parent,s=i.isSelectorOptionsPanel,l=i.name;let c={},u=o||"root";t[0]&&"root"==u?(c=t[0],u=t[0].key):(c.$ref=m.create("div."+(t[0]&&s?Qe:Ue),{"data-key":u,role:"menu"}),c.key=u,t.push(c)),c.parent=r;const d="root"==c.key;if(!d){const e=rt({name:l,type:"back"}).$row;e.addEventListener("click",(()=>{var e;c.$ref.classList.remove(_e),null==(e=c.parent)||e.$ref.classList.add(_e)})),m.render(e,c.$ref)}for(let h=0;h<n.length;h++){const o=n[h],r=o.name,l=o.type,u=o.key,g=o.children,p=o.icon,v=o.default,f=o.onChange,b=o.max,y=o.min,k=o.step,x=o.value,w=rt(Object.assign({name:r,type:s?"option":l,key:u,icon:p,default:v,max:b,min:y,step:k,hasChildren:Boolean(g)},!d&&s&&{index:h})),E=w.$row,L=w.$label;if(m.render(E,c.$ref),m.render(c.$ref,a),g){const n="selector"==l&&g.every((e=>!Boolean(e.type)||"option"==e.type)),i=st(e,t,g,{key:u||r,target:a,parent:c,isSelectorOptionsPanel:n,name:r,parenOnChange:f});if(E.addEventListener("click",(()=>{c.$ref.classList.remove(_e),i.$ref.classList.add(_e)})),n){const t=g.find((e=>e.default));t&&(L.innerText=t.name),i.select=(t,n)=>{var o;if(-1==t)return void(null==(o=i.$ref.querySelector("[aria-checked=true]"))||o.setAttribute("aria-checked","false"));const a=i.$ref.querySelectorAll("[aria-checked]");if("true"!=a.item(t).getAttribute("aria-checked")){a.forEach((e=>e.setAttribute("aria-checked","false"))),a.item(t).setAttribute("aria-checked","true");const i=g[t];L.innerText=i.name,n&&(null==f||f(i,{index:t,player:e}))}},i.$ref.addEventListener("click",(e=>{const t=e.target;t.hasAttribute("data-index")&&(i.select(+t.getAttribute("data-index"),!0),c.$ref.classList.add(_e),i.$ref.classList.remove(_e))}))}}else if("switcher"==l)E.select=function(e){const t="true"==this.getAttribute("aria-checked");this.setAttribute("aria-checked",""+!t),e&&(null==f||f(!t))},E.addEventListener("click",(()=>E.select(!0)));else if("slider"==l){const e=E.querySelector("input");e.oninput=function(e){e.target.setAttribute("value",e.target.value)},e.onchange=function(e){null==f||f(e.target.value)}}else("option"==l||null==l&&!s)&&E.addEventListener("click",(()=>{var e;return null==(e=f||i.parenOnChange)?void 0:e(x)