3 lines
154 KiB
JavaScript
3 lines
154 KiB
JavaScript
"object"==typeof navigator&&function(){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var n=t(function(e,t){function n(e,t){for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}function i(e,t){var i=[],r=[];return null==t&&(t=function(e,t){return i[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n(i,t)).join(".")+"]"}),function(a,s){if(i.length>0){var o=n(i,this);~o?i.splice(o+1):i.push(this),~o?r.splice(o,1/0,a):r.push(a),~n(i,s)&&(s=t.call(this,a,s))}else i.push(s);return null==e?s instanceof Error?function(e){var t={stack:e.stack,message:e.message,name:e.name};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}(s):s:e.call(this,a,s)}}(e.exports=function(e,t,n,r){return JSON.stringify(e,i(t,r),n)}).getSerialize=i}),i=(n.getSerialize,"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{});function r(e){return void 0===e}function a(e){return"[object Object]"===Object.prototype.toString.call(e)}function s(e){return"[object String]"===Object.prototype.toString.call(e)}function o(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(){if(!("fetch"in i))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function c(e,t){var n,i;if(r(e.length))for(n in e)d(e,n)&&t.call(null,n,e[n]);else if(i=e.length)for(n=0;n<i;n++)t.call(null,n,e[n])}function u(e,t){if("number"!=typeof t)throw new Error("2nd argument to `truncate` function should be a number");return"string"!=typeof e||0===t?e:e.length<=t?e:e.substr(0,t)+"…"}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function h(e){for(var t,n=[],i=0,r=e.length;i<r;i++)s(t=e[i])?n.push(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):t&&t.source&&n.push(t.source);return new RegExp(n.join("|"),"i")}function p(e){var t,n,i,r,a,o=[];if(!e||!e.tagName)return"";if(o.push(e.tagName.toLowerCase()),e.id&&o.push("#"+e.id),(t=e.className)&&s(t))for(n=t.split(/\s+/),a=0;a<n.length;a++)o.push("."+n[a]);var l=["type","name","title","alt"];for(a=0;a<l.length;a++)i=l[a],(r=e.getAttribute(i))&&o.push("["+i+'="'+r+'"]');return o.join("")}function m(e,t){return!!(!!e^!!t)}function f(e,t){if(m(e,t))return!1;var n,i,r=e.frames,a=t.frames;if(void 0===r||void 0===a)return!1;if(r.length!==a.length)return!1;for(var s=0;s<r.length;s++)if(n=r[s],i=a[s],n.filename!==i.filename||n.lineno!==i.lineno||n.colno!==i.colno||n.function!==i.function)return!1;return!0}var g=3,y=51200,v=40;function b(e){return function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(e))}function k(e){if("string"==typeof e){return u(e,40)}if("number"==typeof e||"boolean"==typeof e||void 0===e)return e;var t=Object.prototype.toString.call(e);return"[object Object]"===t?"[Object]":"[object Array]"===t?"[Array]":"[object Function]"===t?e.name?"[Function: "+e.name+"]":"[Function]":e}var w={isObject:function(e){return"object"==typeof e&&null!==e},isError:function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},isErrorEvent:function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)},isDOMError:function(e){return"[object DOMError]"===Object.prototype.toString.call(e)},isDOMException:function(e){return"[object DOMException]"===Object.prototype.toString.call(e)},isUndefined:r,isFunction:function(e){return"function"==typeof e},isPlainObject:a,isString:s,isArray:o,isEmptyObject:function(e){if(!a(e))return!1;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},supportsErrorEvent:function(){try{return new ErrorEvent(""),!0}catch(e){return!1}},supportsDOMError:function(){try{return new DOMError(""),!0}catch(e){return!1}},supportsDOMException:function(){try{return new DOMException(""),!0}catch(e){return!1}},supportsFetch:l,supportsReferrerPolicy:function(){if(!l())return!1;try{return new Request("pickleRick",{referrerPolicy:"origin"}),!0}catch(e){return!1}},supportsPromiseRejectionEvent:function(){return"function"==typeof PromiseRejectionEvent},wrappedCallback:function(e){return function(t,n){var i=e(t)||t;return n&&n(i)||i}},each:c,objectMerge:function(e,t){return t?(c(t,function(t,n){e[t]=n}),e):e},truncate:u,objectFrozen:function(e){return!!Object.isFrozen&&Object.isFrozen(e)},hasKey:d,joinRegExp:h,urlencode:function(e){var t=[];return c(e,function(e,n){t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))}),t.join("&")},uuid4:function(){var e=i.crypto||i.msCrypto;if(!r(e)&&e.getRandomValues){var t=new Uint16Array(8);e.getRandomValues(t),t[3]=4095&t[3]|16384,t[4]=16383&t[4]|32768;var n=function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t};return n(t[0])+n(t[1])+n(t[2])+n(t[3])+n(t[4])+n(t[5])+n(t[6])+n(t[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},htmlTreeAsString:function(e){for(var t,n=[],i=0,r=0,a=" > ".length;e&&i++<5&&!("html"===(t=p(e))||i>1&&r+n.length*a+t.length>=80);)n.push(t),r+=t.length,e=e.parentNode;return n.reverse().join(" > ")},htmlElementAsString:p,isSameException:function(e,t){return!m(e,t)&&(e=e.values[0],t=t.values[0],e.type===t.type&&e.value===t.value&&(n=e.stacktrace,i=t.stacktrace,(!r(n)||!r(i))&&f(e.stacktrace,t.stacktrace)));var n,i},isSameStacktrace:f,parseUrl:function(e){if("string"!=typeof e)return{};var t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/),n=t[6]||"",i=t[8]||"";return{protocol:t[2],host:t[4],path:t[5],relative:t[5]+n+i}},fill:function(e,t,n,i){if(null!=e){var r=e[t];e[t]=n(r),e[t].__raven__=!0,e[t].__orig__=r,i&&i.push([e,t,r])}},safeJoin:function(e,t){if(!o(e))return"";for(var n=[],i=0;i<e.length;i++)try{n.push(String(e[i]))}catch(e){n.push("[value cannot be serialized]")}return n.join(t)},serializeException:function e(t,i,r){if(!a(t))return t;r="number"!=typeof(i="number"!=typeof i?g:i)?y:r;var s=function e(t,n){return 0===n?k(t):a(t)?Object.keys(t).reduce(function(i,r){return i[r]=e(t[r],n-1),i},{}):Array.isArray(t)?t.map(function(t){return e(t,n-1)}):k(t)}(t,i);return b(n(s))>r?e(t,i-1):s},serializeKeysForMessage:function(e,t){if("number"==typeof e||"string"==typeof e)return e.toString();if(!Array.isArray(e))return"";if(0===(e=e.filter(function(e){return"string"==typeof e})).length)return"[object has no keys]";if(t="number"!=typeof t?v:t,e[0].length>=t)return e[0];for(var n=e.length;n>0;n--){var i=e.slice(0,n).join(", ");if(!(i.length>t))return n===e.length?i:i+"…"}return""},sanitize:function(e,t){if(!o(t)||o(t)&&0===t.length)return e;var i,r=h(t),s="********";try{i=JSON.parse(n(e))}catch(t){return e}return function e(t){return o(t)?t.map(function(t){return e(t)}):a(t)?Object.keys(t).reduce(function(n,i){return r.test(i)?n[i]=s:n[i]=e(t[i]),n},{}):t}(i)}},_={collectWindowErrors:!0,debug:!1},T="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},E=[].slice,S="?",C=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function x(){return"undefined"==typeof document||null==document.location?"":document.location.href}_.report=function(){var e,t,n=[],i=null,r=null,a=null;function s(e,t){var i=null;if(!t||_.collectWindowErrors){for(var r in n)if(n.hasOwnProperty(r))try{n[r].apply(null,[e].concat(E.call(arguments,2)))}catch(e){i=e}if(i)throw i}}function o(t,n,i,r,o){var c=w.isErrorEvent(o)?o.error:o,u=w.isErrorEvent(t)?t.message:t;if(a)_.computeStackTrace.augmentStackTraceWithInitialElement(a,n,i,u),l();else if(c&&w.isError(c))s(_.computeStackTrace(c),!0);else{var d,h={url:n,line:i,column:r},p=void 0;if("[object String]"==={}.toString.call(u))(d=u.match(C))&&(p=d[1],u=d[2]);h.func=S,s({name:p,message:u,url:x(),stack:[h]},!0)}return!!e&&e.apply(this,arguments)}function l(){var e=a,t=i;i=null,a=null,r=null,s.apply(null,[e,!1].concat(t))}function c(e,t){var n=E.call(arguments,1);if(a){if(r===e)return;l()}var s=_.computeStackTrace(e);if(a=s,r=e,i=n,setTimeout(function(){r===e&&l()},s.incomplete?2e3:0),!1!==t)throw e}return c.subscribe=function(i){t||(e=T.onerror,T.onerror=o,t=!0),n.push(i)},c.unsubscribe=function(e){for(var t=n.length-1;t>=0;--t)n[t]===e&&n.splice(t,1)},c.uninstall=function(){t&&(T.onerror=e,t=!1,e=void 0),n=[]},c}(),_.computeStackTrace=function(){function e(e){if(void 0!==e.stack&&e.stack){for(var t,n,i,r=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,s=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,o=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,l=/\((\S*)(?::(\d+))(?::(\d+))\)/,c=e.stack.split("\n"),u=[],d=(/^(.*) is undefined$/.exec(e.message),0),h=c.length;d<h;++d){if(n=r.exec(c[d])){var p=n[2]&&0===n[2].indexOf("native");n[2]&&0===n[2].indexOf("eval")&&(t=l.exec(n[2]))&&(n[2]=t[1],n[3]=t[2],n[4]=t[3]),i={url:p?null:n[2],func:n[1]||S,args:p?[n[2]]:[],line:n[3]?+n[3]:null,column:n[4]?+n[4]:null}}else if(n=a.exec(c[d]))i={url:n[2],func:n[1]||S,args:[],line:+n[3],column:n[4]?+n[4]:null};else{if(!(n=s.exec(c[d])))continue;n[3]&&n[3].indexOf(" > eval")>-1&&(t=o.exec(n[3]))?(n[3]=t[1],n[4]=t[2],n[5]=null):0!==d||n[5]||void 0===e.columnNumber||(u[0].column=e.columnNumber+1),i={url:n[3],func:n[1]||S,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}if(!i.func&&i.line&&(i.func=S),i.url&&"blob:"===i.url.substr(0,5)){var m=new XMLHttpRequest;if(m.open("GET",i.url,!1),m.send(null),200===m.status){var f=m.responseText||"",g=(f=f.slice(-300)).match(/\/\/# sourceMappingURL=(.*)$/);if(g){var y=g[1];"~"===y.charAt(0)&&(y=("undefined"==typeof document||null==document.location?"":document.location.origin?document.location.origin:document.location.protocol+"//"+document.location.hostname+(document.location.port?":"+document.location.port:""))+y.slice(1)),i.url=y.slice(0,-4)}}}u.push(i)}return u.length?{name:e.name,message:e.message,url:x(),stack:u}:null}}function t(e,t,n,i){var r={url:t,line:n};if(r.url&&r.line){if(e.incomplete=!1,r.func||(r.func=S),e.stack.length>0&&e.stack[0].url===r.url){if(e.stack[0].line===r.line)return!1;if(!e.stack[0].line&&e.stack[0].func===r.func)return e.stack[0].line=r.line,!1}return e.stack.unshift(r),e.partial=!0,!0}return e.incomplete=!0,!1}function n(e,r){for(var a,s,o=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,l=[],c={},u=!1,d=n.caller;d&&!u;d=d.caller)if(d!==i&&d!==_.report){if(s={url:null,func:S,line:null,column:null},d.name?s.func=d.name:(a=o.exec(d.toString()))&&(s.func=a[1]),void 0===s.func)try{s.func=a.input.substring(0,a.input.indexOf("{"))}catch(e){}c[""+d]?u=!0:c[""+d]=!0,l.push(s)}r&&l.splice(0,r);var h={name:e.name,message:e.message,url:x(),stack:l};return t(h,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),h}function i(t,i){var r=null;i=null==i?0:+i;try{if(r=e(t))return r}catch(e){if(_.debug)throw e}try{if(r=n(t,i+1))return r}catch(e){if(_.debug)throw e}return{name:t.name,message:t.message,url:x()}}return i.augmentStackTraceWithInitialElement=t,i.computeStackTraceFromStackProp=e,i}();var A=_;function P(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function O(e,t,n,i,r,a){return P((s=P(P(t,e),P(i,a)))<<(o=r)|s>>>32-o,n);var s,o}function M(e,t,n,i,r,a,s){return O(t&n|~t&i,e,t,r,a,s)}function N(e,t,n,i,r,a,s){return O(t&i|n&~i,e,t,r,a,s)}function L(e,t,n,i,r,a,s){return O(t^n^i,e,t,r,a,s)}function I(e,t,n,i,r,a,s){return O(n^(t|~i),e,t,r,a,s)}function j(e,t){var n,i,r,a,s;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var o=1732584193,l=-271733879,c=-1732584194,u=271733878;for(n=0;n<e.length;n+=16)i=o,r=l,a=c,s=u,o=M(o,l,c,u,e[n],7,-680876936),u=M(u,o,l,c,e[n+1],12,-389564586),c=M(c,u,o,l,e[n+2],17,606105819),l=M(l,c,u,o,e[n+3],22,-1044525330),o=M(o,l,c,u,e[n+4],7,-176418897),u=M(u,o,l,c,e[n+5],12,1200080426),c=M(c,u,o,l,e[n+6],17,-1473231341),l=M(l,c,u,o,e[n+7],22,-45705983),o=M(o,l,c,u,e[n+8],7,1770035416),u=M(u,o,l,c,e[n+9],12,-1958414417),c=M(c,u,o,l,e[n+10],17,-42063),l=M(l,c,u,o,e[n+11],22,-1990404162),o=M(o,l,c,u,e[n+12],7,1804603682),u=M(u,o,l,c,e[n+13],12,-40341101),c=M(c,u,o,l,e[n+14],17,-1502002290),o=N(o,l=M(l,c,u,o,e[n+15],22,1236535329),c,u,e[n+1],5,-165796510),u=N(u,o,l,c,e[n+6],9,-1069501632),c=N(c,u,o,l,e[n+11],14,643717713),l=N(l,c,u,o,e[n],20,-373897302),o=N(o,l,c,u,e[n+5],5,-701558691),u=N(u,o,l,c,e[n+10],9,38016083),c=N(c,u,o,l,e[n+15],14,-660478335),l=N(l,c,u,o,e[n+4],20,-405537848),o=N(o,l,c,u,e[n+9],5,568446438),u=N(u,o,l,c,e[n+14],9,-1019803690),c=N(c,u,o,l,e[n+3],14,-187363961),l=N(l,c,u,o,e[n+8],20,1163531501),o=N(o,l,c,u,e[n+13],5,-1444681467),u=N(u,o,l,c,e[n+2],9,-51403784),c=N(c,u,o,l,e[n+7],14,1735328473),o=L(o,l=N(l,c,u,o,e[n+12],20,-1926607734),c,u,e[n+5],4,-378558),u=L(u,o,l,c,e[n+8],11,-2022574463),c=L(c,u,o,l,e[n+11],16,1839030562),l=L(l,c,u,o,e[n+14],23,-35309556),o=L(o,l,c,u,e[n+1],4,-1530992060),u=L(u,o,l,c,e[n+4],11,1272893353),c=L(c,u,o,l,e[n+7],16,-155497632),l=L(l,c,u,o,e[n+10],23,-1094730640),o=L(o,l,c,u,e[n+13],4,681279174),u=L(u,o,l,c,e[n],11,-358537222),c=L(c,u,o,l,e[n+3],16,-722521979),l=L(l,c,u,o,e[n+6],23,76029189),o=L(o,l,c,u,e[n+9],4,-640364487),u=L(u,o,l,c,e[n+12],11,-421815835),c=L(c,u,o,l,e[n+15],16,530742520),o=I(o,l=L(l,c,u,o,e[n+2],23,-995338651),c,u,e[n],6,-198630844),u=I(u,o,l,c,e[n+7],10,1126891415),c=I(c,u,o,l,e[n+14],15,-1416354905),l=I(l,c,u,o,e[n+5],21,-57434055),o=I(o,l,c,u,e[n+12],6,1700485571),u=I(u,o,l,c,e[n+3],10,-1894986606),c=I(c,u,o,l,e[n+10],15,-1051523),l=I(l,c,u,o,e[n+1],21,-2054922799),o=I(o,l,c,u,e[n+8],6,1873313359),u=I(u,o,l,c,e[n+15],10,-30611744),c=I(c,u,o,l,e[n+6],15,-1560198380),l=I(l,c,u,o,e[n+13],21,1309151649),o=I(o,l,c,u,e[n+4],6,-145523070),u=I(u,o,l,c,e[n+11],10,-1120210379),c=I(c,u,o,l,e[n+2],15,718787259),l=I(l,c,u,o,e[n+9],21,-343485551),o=P(o,i),l=P(l,r),c=P(c,a),u=P(u,s);return[o,l,c,u]}function R(e){var t,n="",i=32*e.length;for(t=0;t<i;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function D(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var i=8*e.length;for(t=0;t<i;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function F(e){var t,n,i="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),i+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return i}function B(e){return unescape(encodeURIComponent(e))}function H(e){return function(e){return R(j(D(e),8*e.length))}(B(e))}function q(e,t){return function(e,t){var n,i,r=D(e),a=[],s=[];for(a[15]=s[15]=void 0,r.length>16&&(r=j(r,8*e.length)),n=0;n<16;n+=1)a[n]=909522486^r[n],s[n]=1549556828^r[n];return i=j(a.concat(D(t)),512+8*t.length),R(j(s.concat(i),640))}(B(e),B(t))}var U=function(e,t,n){return t?n?q(t,e):F(q(t,e)):n?H(e):F(H(e))};function V(e){this.name="RavenConfigError",this.message=e}V.prototype=new Error,V.prototype.constructor=V;var z=V,W=function(e,t,n){var i=e[t],r=e;if(t in e){var a="warn"===t?"warning":t;e[t]=function(){var e=[].slice.call(arguments),s=w.safeJoin(e," "),o={level:a,logger:"console",extra:{arguments:e}};"assert"===t?!1===e[0]&&(s="Assertion failed: "+(w.safeJoin(e.slice(1)," ")||"console.assert"),o.extra.arguments=e.slice(1),n&&n(s,o)):n&&n(s,o),i&&Function.prototype.apply.call(i,r,e)}}},K=w.isErrorEvent,X=w.isDOMError,$=w.isDOMException,Y=w.isError,J=w.isObject,G=w.isPlainObject,Q=w.isUndefined,Z=w.isFunction,ee=w.isString,te=w.isArray,ne=w.isEmptyObject,ie=w.each,re=w.objectMerge,ae=w.truncate,se=w.objectFrozen,oe=w.hasKey,le=w.joinRegExp,ce=w.urlencode,ue=w.uuid4,de=w.htmlTreeAsString,he=w.isSameException,pe=w.isSameStacktrace,me=w.parseUrl,fe=w.fill,ge=w.supportsFetch,ye=w.supportsReferrerPolicy,ve=w.serializeKeysForMessage,be=w.serializeException,ke=w.sanitize,we=W,_e="source protocol user pass host port path".split(" "),Te=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;function Ee(){return+new Date}var Se="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Ce=Se.document,xe=Se.navigator;function Ae(e,t){return Z(t)?function(n){return t(n,e)}:t}function Pe(){for(var e in this._hasJSON=!("object"!=typeof JSON||!JSON.stringify),this._hasDocument=!Q(Ce),this._hasNavigator=!Q(xe),this._lastCapturedException=null,this._lastData=null,this._lastEventId=null,this._globalServer=null,this._globalKey=null,this._globalProject=null,this._globalContext={},this._globalOptions={release:Se.SENTRY_RELEASE&&Se.SENTRY_RELEASE.id,logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],headers:null,collectWindowErrors:!0,captureUnhandledRejections:!0,maxMessageLength:0,maxUrlLength:250,stackTraceLimit:50,autoBreadcrumbs:!0,instrument:!0,sampleRate:1,sanitizeKeys:[]},this._fetchDefaults={method:"POST",referrerPolicy:ye()?"origin":""},this._ignoreOnError=0,this._isRavenInstalled=!1,this._originalErrorStackTraceLimit=Error.stackTraceLimit,this._originalConsole=Se.console||{},this._originalConsoleMethods={},this._plugins=[],this._startTime=Ee(),this._wrappedBuiltIns=[],this._breadcrumbs=[],this._lastCapturedEvent=null,this._keypressTimeout,this._location=Se.location,this._lastHref=this._location&&this._location.href,this._resetBackoff(),this._originalConsole)this._originalConsoleMethods[e]=this._originalConsole[e]}Pe.prototype={VERSION:"3.27.0",debug:!1,TraceKit:A,config:function(e,t){var n=this;if(n._globalServer)return this._logDebug("error","Error: Raven has already been configured"),n;if(!e)return n;var i=n._globalOptions;t&&ie(t,function(e,t){"tags"===e||"extra"===e||"user"===e?n._globalContext[e]=t:i[e]=t}),n.setDSN(e),i.ignoreErrors.push(/^Script error\.?$/),i.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),i.ignoreErrors=le(i.ignoreErrors),i.ignoreUrls=!!i.ignoreUrls.length&&le(i.ignoreUrls),i.whitelistUrls=!!i.whitelistUrls.length&&le(i.whitelistUrls),i.includePaths=le(i.includePaths),i.maxBreadcrumbs=Math.max(0,Math.min(i.maxBreadcrumbs||100,100));var r={xhr:!0,console:!0,dom:!0,location:!0,sentry:!0},a=i.autoBreadcrumbs;"[object Object]"==={}.toString.call(a)?a=re(r,a):!1!==a&&(a=r),i.autoBreadcrumbs=a;var s={tryCatch:!0},o=i.instrument;return"[object Object]"==={}.toString.call(o)?o=re(s,o):!1!==o&&(o=s),i.instrument=o,A.collectWindowErrors=!!i.collectWindowErrors,n},install:function(){var e=this;return e.isSetup()&&!e._isRavenInstalled&&(A.report.subscribe(function(){e._handleOnErrorStackInfo.apply(e,arguments)}),e._globalOptions.captureUnhandledRejections&&e._attachPromiseRejectionHandler(),e._patchFunctionToString(),e._globalOptions.instrument&&e._globalOptions.instrument.tryCatch&&e._instrumentTryCatch(),e._globalOptions.autoBreadcrumbs&&e._instrumentBreadcrumbs(),e._drainPlugins(),e._isRavenInstalled=!0),Error.stackTraceLimit=e._globalOptions.stackTraceLimit,this},setDSN:function(e){var t=this._parseDSN(e),n=t.path.lastIndexOf("/"),i=t.path.substr(1,n);this._dsn=e,this._globalKey=t.user,this._globalSecret=t.pass&&t.pass.substr(1),this._globalProject=t.path.substr(n+1),this._globalServer=this._getGlobalServer(t),this._globalEndpoint=this._globalServer+"/"+i+"api/"+this._globalProject+"/store/",this._resetBackoff()},context:function(e,t,n){return Z(e)&&(n=t||[],t=e,e={}),this.wrap(e,t).apply(this,n)},wrap:function(e,t,n){var i=this;if(Q(t)&&!Z(e))return e;if(Z(e)&&(t=e,e=void 0),!Z(t))return t;try{if(t.__raven__)return t;if(t.__raven_wrapper__)return t.__raven_wrapper__}catch(e){return t}function r(){var r=[],a=arguments.length,s=!e||e&&!1!==e.deep;for(n&&Z(n)&&n.apply(this,arguments);a--;)r[a]=s?i.wrap(e,arguments[a]):arguments[a];try{return t.apply(this,r)}catch(t){throw i._ignoreNextOnError(),i.captureException(t,e),t}}for(var a in t)oe(t,a)&&(r[a]=t[a]);return r.prototype=t.prototype,t.__raven_wrapper__=r,r.__raven__=!0,r.__orig__=t,r},uninstall:function(){return A.report.uninstall(),this._detachPromiseRejectionHandler(),this._unpatchFunctionToString(),this._restoreBuiltIns(),this._restoreConsole(),Error.stackTraceLimit=this._originalErrorStackTraceLimit,this._isRavenInstalled=!1,this},_promiseRejectionHandler:function(e){this._logDebug("debug","Raven caught unhandled promise rejection:",e),this.captureException(e.reason,{mechanism:{type:"onunhandledrejection",handled:!1}})},_attachPromiseRejectionHandler:function(){return this._promiseRejectionHandler=this._promiseRejectionHandler.bind(this),Se.addEventListener&&Se.addEventListener("unhandledrejection",this._promiseRejectionHandler),this},_detachPromiseRejectionHandler:function(){return Se.removeEventListener&&Se.removeEventListener("unhandledrejection",this._promiseRejectionHandler),this},captureException:function(e,t){if(t=re({trimHeadFrames:0},t||{}),K(e)&&e.error)e=e.error;else{if(X(e)||$(e)){var n=e.name||(X(e)?"DOMError":"DOMException"),i=e.message?n+": "+e.message:n;return this.captureMessage(i,re(t,{stacktrace:!0,trimHeadFrames:t.trimHeadFrames+1}))}if(Y(e))e=e;else{if(!G(e))return this.captureMessage(e,re(t,{stacktrace:!0,trimHeadFrames:t.trimHeadFrames+1}));t=this._getCaptureExceptionOptionsFromPlainObject(t,e),e=new Error(t.message)}}this._lastCapturedException=e;try{var r=A.computeStackTrace(e);this._handleStackInfo(r,t)}catch(t){if(e!==t)throw t}return this},_getCaptureExceptionOptionsFromPlainObject:function(e,t){var n=Object.keys(t).sort(),i=re(e,{message:"Non-Error exception captured with keys: "+ve(n),fingerprint:[U(n)],extra:e.extra||{}});return i.extra.__serialized__=be(t),i},captureMessage:function(e,t){if(!this._globalOptions.ignoreErrors.test||!this._globalOptions.ignoreErrors.test(e)){var n,i=re({message:e+=""},t=t||{});try{throw new Error(e)}catch(e){n=e}n.name=null;var r=A.computeStackTrace(n),a=te(r.stack)&&r.stack[1];a&&"Raven.captureException"===a.func&&(a=r.stack[2]);var s=a&&a.url||"";if((!this._globalOptions.ignoreUrls.test||!this._globalOptions.ignoreUrls.test(s))&&(!this._globalOptions.whitelistUrls.test||this._globalOptions.whitelistUrls.test(s))){if(this._globalOptions.stacktrace||t.stacktrace||""===i.message){i.fingerprint=null==i.fingerprint?e:i.fingerprint,(t=re({trimHeadFrames:0},t)).trimHeadFrames+=1;var o=this._prepareFrames(r,t);i.stacktrace={frames:o.reverse()}}return i.fingerprint&&(i.fingerprint=te(i.fingerprint)?i.fingerprint:[i.fingerprint]),this._send(i),this}}},captureBreadcrumb:function(e){var t=re({timestamp:Ee()/1e3},e);if(Z(this._globalOptions.breadcrumbCallback)){var n=this._globalOptions.breadcrumbCallback(t);if(J(n)&&!ne(n))t=n;else if(!1===n)return this}return this._breadcrumbs.push(t),this._breadcrumbs.length>this._globalOptions.maxBreadcrumbs&&this._breadcrumbs.shift(),this},addPlugin:function(e){var t=[].slice.call(arguments,1);return this._plugins.push([e,t]),this._isRavenInstalled&&this._drainPlugins(),this},setUserContext:function(e){return this._globalContext.user=e,this},setExtraContext:function(e){return this._mergeContext("extra",e),this},setTagsContext:function(e){return this._mergeContext("tags",e),this},clearContext:function(){return this._globalContext={},this},getContext:function(){return JSON.parse(n(this._globalContext))},setEnvironment:function(e){return this._globalOptions.environment=e,this},setRelease:function(e){return this._globalOptions.release=e,this},setDataCallback:function(e){var t=this._globalOptions.dataCallback;return this._globalOptions.dataCallback=Ae(t,e),this},setBreadcrumbCallback:function(e){var t=this._globalOptions.breadcrumbCallback;return this._globalOptions.breadcrumbCallback=Ae(t,e),this},setShouldSendCallback:function(e){var t=this._globalOptions.shouldSendCallback;return this._globalOptions.shouldSendCallback=Ae(t,e),this},setTransport:function(e){return this._globalOptions.transport=e,this},lastException:function(){return this._lastCapturedException},lastEventId:function(){return this._lastEventId},isSetup:function(){return!!this._hasJSON&&(!!this._globalServer||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this._logDebug("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var e=Se.RavenConfig;e&&this.config(e.dsn,e.config).install()},showReportDialog:function(e){if(Ce){if(!(e=re({eventId:this.lastEventId(),dsn:this._dsn,user:this._globalContext.user||{}},e)).eventId)throw new z("Missing eventId");if(!e.dsn)throw new z("Missing DSN");var t=encodeURIComponent,n=[];for(var i in e)if("user"===i){var r=e.user;r.name&&n.push("name="+t(r.name)),r.email&&n.push("email="+t(r.email))}else n.push(t(i)+"="+t(e[i]));var a=this._getGlobalServer(this._parseDSN(e.dsn)),s=Ce.createElement("script");s.async=!0,s.src=a+"/api/embed/error-page/?"+n.join("&"),(Ce.head||Ce.body).appendChild(s)}},_ignoreNextOnError:function(){var e=this;this._ignoreOnError+=1,setTimeout(function(){e._ignoreOnError-=1})},_triggerEvent:function(e,t){var n,i;if(this._hasDocument){for(i in t=t||{},e="raven"+e.substr(0,1).toUpperCase()+e.substr(1),Ce.createEvent?(n=Ce.createEvent("HTMLEvents")).initEvent(e,!0,!0):(n=Ce.createEventObject()).eventType=e,t)oe(t,i)&&(n[i]=t[i]);if(Ce.createEvent)Ce.dispatchEvent(n);else try{Ce.fireEvent("on"+n.eventType.toLowerCase(),n)}catch(e){}}},_breadcrumbEventHandler:function(e){var t=this;return function(n){if(t._keypressTimeout=null,t._lastCapturedEvent!==n){var i;t._lastCapturedEvent=n;try{i=de(n.target)}catch(e){i="<unknown>"}t.captureBreadcrumb({category:"ui."+e,message:i})}}},_keypressEventHandler:function(){var e=this;return function(t){var n;try{n=t.target}catch(e){return}var i=n&&n.tagName;if(i&&("INPUT"===i||"TEXTAREA"===i||n.isContentEditable)){var r=e._keypressTimeout;r||e._breadcrumbEventHandler("input")(t),clearTimeout(r),e._keypressTimeout=setTimeout(function(){e._keypressTimeout=null},1e3)}}},_captureUrlChange:function(e,t){var n=me(this._location.href),i=me(t),r=me(e);this._lastHref=t,n.protocol===i.protocol&&n.host===i.host&&(t=i.relative),n.protocol===r.protocol&&n.host===r.host&&(e=r.relative),this.captureBreadcrumb({category:"navigation",data:{to:t,from:e}})},_patchFunctionToString:function(){var e=this;e._originalFunctionToString=Function.prototype.toString,Function.prototype.toString=function(){return"function"==typeof this&&this.__raven__?e._originalFunctionToString.apply(this.__orig__,arguments):e._originalFunctionToString.apply(this,arguments)}},_unpatchFunctionToString:function(){this._originalFunctionToString&&(Function.prototype.toString=this._originalFunctionToString)},_instrumentTryCatch:function(){var e=this,t=e._wrappedBuiltIns;function n(t){return function(n,i){for(var r=new Array(arguments.length),a=0;a<r.length;++a)r[a]=arguments[a];var s=r[0];return Z(s)&&(r[0]=e.wrap({mechanism:{type:"instrument",data:{function:t.name||"<anonymous>"}}},s)),t.apply?t.apply(this,r):t(r[0],r[1])}}var i=this._globalOptions.autoBreadcrumbs;function r(n){var r=Se[n]&&Se[n].prototype;r&&r.hasOwnProperty&&r.hasOwnProperty("addEventListener")&&(fe(r,"addEventListener",function(t){return function(r,a,s,o){try{a&&a.handleEvent&&(a.handleEvent=e.wrap({mechanism:{type:"instrument",data:{target:n,function:"handleEvent",handler:a&&a.name||"<anonymous>"}}},a.handleEvent))}catch(e){}var l,c,u;return i&&i.dom&&("EventTarget"===n||"Node"===n)&&(c=e._breadcrumbEventHandler("click"),u=e._keypressEventHandler(),l=function(e){if(e){var t;try{t=e.type}catch(e){return}return"click"===t?c(e):"keypress"===t?u(e):void 0}}),t.call(this,r,e.wrap({mechanism:{type:"instrument",data:{target:n,function:"addEventListener",handler:a&&a.name||"<anonymous>"}}},a,l),s,o)}},t),fe(r,"removeEventListener",function(e){return function(t,n,i,r){try{n=n&&(n.__raven_wrapper__?n.__raven_wrapper__:n)}catch(e){}return e.call(this,t,n,i,r)}},t))}fe(Se,"setTimeout",n,t),fe(Se,"setInterval",n,t),Se.requestAnimationFrame&&fe(Se,"requestAnimationFrame",function(t){return function(n){return t(e.wrap({mechanism:{type:"instrument",data:{function:"requestAnimationFrame",handler:t&&t.name||"<anonymous>"}}},n))}},t);for(var a=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],s=0;s<a.length;s++)r(a[s])},_instrumentBreadcrumbs:function(){var e=this,t=this._globalOptions.autoBreadcrumbs,n=e._wrappedBuiltIns;function i(t,n){t in n&&Z(n[t])&&fe(n,t,function(n){return e.wrap({mechanism:{type:"instrument",data:{function:t,handler:n&&n.name||"<anonymous>"}}},n)})}if(t.xhr&&"XMLHttpRequest"in Se){var r=Se.XMLHttpRequest&&Se.XMLHttpRequest.prototype;fe(r,"open",function(t){return function(n,i){return ee(i)&&-1===i.indexOf(e._globalKey)&&(this.__raven_xhr={method:n,url:i,status_code:null}),t.apply(this,arguments)}},n),fe(r,"send",function(t){return function(){var n=this;function r(){if(n.__raven_xhr&&4===n.readyState){try{n.__raven_xhr.status_code=n.status}catch(e){}e.captureBreadcrumb({type:"http",category:"xhr",data:n.__raven_xhr})}}for(var a=["onload","onerror","onprogress"],s=0;s<a.length;s++)i(a[s],n);return"onreadystatechange"in n&&Z(n.onreadystatechange)?fe(n,"onreadystatechange",function(t){return e.wrap({mechanism:{type:"instrument",data:{function:"onreadystatechange",handler:t&&t.name||"<anonymous>"}}},t,r)}):n.onreadystatechange=r,t.apply(this,arguments)}},n)}t.xhr&&ge()&&fe(Se,"fetch",function(t){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;++i)n[i]=arguments[i];var r,a=n[0],s="GET";if("string"==typeof a?r=a:"Request"in Se&&a instanceof Se.Request?(r=a.url,a.method&&(s=a.method)):r=""+a,-1!==r.indexOf(e._globalKey))return t.apply(this,n);n[1]&&n[1].method&&(s=n[1].method);var o={method:s,url:r,status_code:null};return t.apply(this,n).then(function(t){return o.status_code=t.status,e.captureBreadcrumb({type:"http",category:"fetch",data:o}),t}).catch(function(t){throw e.captureBreadcrumb({type:"http",category:"fetch",data:o,level:"error"}),t})}},n),t.dom&&this._hasDocument&&(Ce.addEventListener?(Ce.addEventListener("click",e._breadcrumbEventHandler("click"),!1),Ce.addEventListener("keypress",e._keypressEventHandler(),!1)):Ce.attachEvent&&(Ce.attachEvent("onclick",e._breadcrumbEventHandler("click")),Ce.attachEvent("onkeypress",e._keypressEventHandler())));var a=Se.chrome,s=!(a&&a.app&&a.app.runtime)&&Se.history&&Se.history.pushState&&Se.history.replaceState;if(t.location&&s){var o=Se.onpopstate;Se.onpopstate=function(){var t=e._location.href;if(e._captureUrlChange(e._lastHref,t),o)return o.apply(this,arguments)};var l=function(t){return function(){var n=arguments.length>2?arguments[2]:void 0;return n&&e._captureUrlChange(e._lastHref,n+""),t.apply(this,arguments)}};fe(Se.history,"pushState",l,n),fe(Se.history,"replaceState",l,n)}if(t.console&&"console"in Se&&console.log){var c=function(t,n){e.captureBreadcrumb({message:t,level:n.level,category:"console"})};ie(["debug","info","warn","error","log"],function(e,t){we(console,t,c)})}},_restoreBuiltIns:function(){for(var e;this._wrappedBuiltIns.length;){var t=(e=this._wrappedBuiltIns.shift())[0],n=e[1],i=e[2];t[n]=i}},_restoreConsole:function(){for(var e in this._originalConsoleMethods)this._originalConsole[e]=this._originalConsoleMethods[e]},_drainPlugins:function(){var e=this;ie(this._plugins,function(t,n){var i=n[0],r=n[1];i.apply(e,[e].concat(r))})},_parseDSN:function(e){var t=Te.exec(e),n={},i=7;try{for(;i--;)n[_e[i]]=t[i]||""}catch(t){throw new z("Invalid DSN: "+e)}if(n.pass&&!this._globalOptions.allowSecretKey)throw new z("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return n},_getGlobalServer:function(e){var t="//"+e.host+(e.port?":"+e.port:"");return e.protocol&&(t=e.protocol+":"+t),t},_handleOnErrorStackInfo:function(e,t){(t=t||{}).mechanism=t.mechanism||{type:"onerror",handled:!1},this._ignoreOnError||this._handleStackInfo(e,t)},_handleStackInfo:function(e,t){var n=this._prepareFrames(e,t);this._triggerEvent("handle",{stackInfo:e,options:t}),this._processException(e.name,e.message,e.url,e.lineno,n,t)},_prepareFrames:function(e,t){var n=this,i=[];if(e.stack&&e.stack.length&&(ie(e.stack,function(t,r){var a=n._normalizeFrame(r,e.url);a&&i.push(a)}),t&&t.trimHeadFrames))for(var r=0;r<t.trimHeadFrames&&r<i.length;r++)i[r].in_app=!1;return i=i.slice(0,this._globalOptions.stackTraceLimit)},_normalizeFrame:function(e,t){var n={filename:e.url,lineno:e.line,colno:e.column,function:e.func||"?"};return e.url||(n.filename=t),n.in_app=!(this._globalOptions.includePaths.test&&!this._globalOptions.includePaths.test(n.filename)||/(Raven|TraceKit)\./.test(n.function)||/raven\.(min\.)?js$/.test(n.filename)),n},_processException:function(e,t,n,i,r,a){var s,o=(e?e+": ":"")+(t||"");if((!this._globalOptions.ignoreErrors.test||!this._globalOptions.ignoreErrors.test(t)&&!this._globalOptions.ignoreErrors.test(o))&&(r&&r.length?(n=r[0].filename||n,r.reverse(),s={frames:r}):n&&(s={frames:[{filename:n,lineno:i,in_app:!0}]}),(!this._globalOptions.ignoreUrls.test||!this._globalOptions.ignoreUrls.test(n))&&(!this._globalOptions.whitelistUrls.test||this._globalOptions.whitelistUrls.test(n)))){var l=re({exception:{values:[{type:e,value:t,stacktrace:s}]},transaction:n},a),c=l.exception.values[0];null==c.type&&""===c.value&&(c.value="Unrecoverable error caught"),!l.exception.mechanism&&l.mechanism&&(l.exception.mechanism=l.mechanism,delete l.mechanism),l.exception.mechanism=re({type:"generic",handled:!0},l.exception.mechanism||{}),this._send(l)}},_trimPacket:function(e){var t=this._globalOptions.maxMessageLength;if(e.message&&(e.message=ae(e.message,t)),e.exception){var n=e.exception.values[0];n.value=ae(n.value,t)}var i=e.request;return i&&(i.url&&(i.url=ae(i.url,this._globalOptions.maxUrlLength)),i.Referer&&(i.Referer=ae(i.Referer,this._globalOptions.maxUrlLength))),e.breadcrumbs&&e.breadcrumbs.values&&this._trimBreadcrumbs(e.breadcrumbs),e},_trimBreadcrumbs:function(e){for(var t,n,i,r=["to","from","url"],a=0;a<e.values.length;++a)if((n=e.values[a]).hasOwnProperty("data")&&J(n.data)&&!se(n.data)){i=re({},n.data);for(var s=0;s<r.length;++s)t=r[s],i.hasOwnProperty(t)&&i[t]&&(i[t]=ae(i[t],this._globalOptions.maxUrlLength));e.values[a].data=i}},_getHttpData:function(){if(this._hasNavigator||this._hasDocument){var e={};return this._hasNavigator&&xe.userAgent&&(e.headers={"User-Agent":xe.userAgent}),Se.location&&Se.location.href&&(e.url=Se.location.href),this._hasDocument&&Ce.referrer&&(e.headers||(e.headers={}),e.headers.Referer=Ce.referrer),e}},_resetBackoff:function(){this._backoffDuration=0,this._backoffStart=null},_shouldBackoff:function(){return this._backoffDuration&&Ee()-this._backoffStart<this._backoffDuration},_isRepeatData:function(e){var t=this._lastData;return!(!t||e.message!==t.message||e.transaction!==t.transaction)&&(e.stacktrace||t.stacktrace?pe(e.stacktrace,t.stacktrace):!e.exception&&!t.exception||he(e.exception,t.exception))},_setBackoffState:function(e){if(!this._shouldBackoff()){var t=e.status;if(400===t||401===t||429===t){var n;try{n=ge()?e.headers.get("Retry-After"):e.getResponseHeader("Retry-After"),n=1e3*parseInt(n,10)}catch(e){}this._backoffDuration=n||(2*this._backoffDuration||1e3),this._backoffStart=Ee()}}},_send:function(e){var t=this._globalOptions,n={project:this._globalProject,logger:t.logger,platform:"javascript"},i=this._getHttpData();i&&(n.request=i),e.trimHeadFrames&&delete e.trimHeadFrames,(e=re(n,e)).tags=re(re({},this._globalContext.tags),e.tags),e.extra=re(re({},this._globalContext.extra),e.extra),e.extra["session:duration"]=Ee()-this._startTime,this._breadcrumbs&&this._breadcrumbs.length>0&&(e.breadcrumbs={values:[].slice.call(this._breadcrumbs,0)}),this._globalContext.user&&(e.user=this._globalContext.user),t.environment&&(e.environment=t.environment),t.release&&(e.release=t.release),t.serverName&&(e.server_name=t.serverName),e=this._sanitizeData(e),Object.keys(e).forEach(function(t){(null==e[t]||""===e[t]||ne(e[t]))&&delete e[t]}),Z(t.dataCallback)&&(e=t.dataCallback(e)||e),e&&!ne(e)&&(Z(t.shouldSendCallback)&&!t.shouldSendCallback(e)||(this._shouldBackoff()?this._logDebug("warn","Raven dropped error due to backoff: ",e):"number"==typeof t.sampleRate?Math.random()<t.sampleRate&&this._sendProcessedPayload(e):this._sendProcessedPayload(e)))},_sanitizeData:function(e){return ke(e,this._globalOptions.sanitizeKeys)},_getUuid:function(){return ue()},_sendProcessedPayload:function(e,t){var n=this,i=this._globalOptions;if(this.isSetup())if(e=this._trimPacket(e),this._globalOptions.allowDuplicates||!this._isRepeatData(e)){this._lastEventId=e.event_id||(e.event_id=this._getUuid()),this._lastData=e,this._logDebug("debug","Raven about to send:",e);var r={sentry_version:"7",sentry_client:"raven-js/"+this.VERSION,sentry_key:this._globalKey};this._globalSecret&&(r.sentry_secret=this._globalSecret);var a=e.exception&&e.exception.values[0];this._globalOptions.autoBreadcrumbs&&this._globalOptions.autoBreadcrumbs.sentry&&this.captureBreadcrumb({category:"sentry",message:a?(a.type?a.type+": ":"")+a.value:e.message,event_id:e.event_id,level:e.level||"error"});var s=this._globalEndpoint;(i.transport||this._makeRequest).call(this,{url:s,auth:r,data:e,options:i,onSuccess:function(){n._resetBackoff(),n._triggerEvent("success",{data:e,src:s}),t&&t()},onError:function(i){n._logDebug("error","Raven transport failed to send: ",i),i.request&&n._setBackoffState(i.request),n._triggerEvent("failure",{data:e,src:s}),i=i||new Error("Raven send failed (no additional details provided)"),t&&t(i)}})}else this._logDebug("warn","Raven dropped repeat event: ",e)},_makeRequest:function(e){var t=e.url+"?"+ce(e.auth),i=null,r={};if(e.options.headers&&(i=this._evaluateHash(e.options.headers)),e.options.fetchParameters&&(r=this._evaluateHash(e.options.fetchParameters)),ge()){r.body=n(e.data);var a=re({},this._fetchDefaults),s=re(a,r);return i&&(s.headers=i),Se.fetch(t,s).then(function(t){if(t.ok)e.onSuccess&&e.onSuccess();else{var n=new Error("Sentry error code: "+t.status);n.request=t,e.onError&&e.onError(n)}}).catch(function(){e.onError&&e.onError(new Error("Sentry error code: network unavailable"))})}var o=Se.XMLHttpRequest&&new Se.XMLHttpRequest;o&&(("withCredentials"in o||"undefined"!=typeof XDomainRequest)&&("withCredentials"in o?o.onreadystatechange=function(){if(4===o.readyState)if(200===o.status)e.onSuccess&&e.onSuccess();else if(e.onError){var t=new Error("Sentry error code: "+o.status);t.request=o,e.onError(t)}}:(o=new XDomainRequest,t=t.replace(/^https?:/,""),e.onSuccess&&(o.onload=e.onSuccess),e.onError&&(o.onerror=function(){var t=new Error("Sentry error code: XDomainRequest");t.request=o,e.onError(t)})),o.open("POST",t),i&&ie(i,function(e,t){o.setRequestHeader(e,t)}),o.send(n(e.data))))},_evaluateHash:function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];t[n]="function"==typeof i?i():i}return t},_logDebug:function(e){this._originalConsoleMethods[e]&&(this.debug||this._globalOptions.debug)&&Function.prototype.apply.call(this._originalConsoleMethods[e],this._originalConsole,[].slice.call(arguments,1))},_mergeContext:function(e,t){Q(t)?delete this._globalContext[e]:this._globalContext[e]=re(this._globalContext[e]||{},t)}},Pe.prototype.setUser=Pe.prototype.setUserContext,Pe.prototype.setReleaseContext=Pe.prototype.setRelease;var Oe=Pe,Me="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Ne=Me.Raven,Le=new Oe;Le.noConflict=function(){return Me.Raven=Ne,Le},Le.afterLoad();var Ie=Le,je=Oe;function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function De(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)}}function Fe(e,t,n){return t&&De(e.prototype,t),n&&De(e,n),e}function Be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function He(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],i=!0,r=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(i=(s=o.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==o.return||o.return()}finally{if(r)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function qe(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}Ie.Client=je;const Ue={addCSS:!0,thumbWidth:15,watch:!0};const Ve=e=>null!=e?e.constructor:null,ze=(e,t)=>Boolean(e&&t&&e instanceof t),We=e=>null==e,Ke=e=>Ve(e)===Object,Xe=e=>Ve(e)===String,$e=e=>Array.isArray(e),Ye=e=>ze(e,NodeList);var Je={nullOrUndefined:We,object:Ke,number:e=>Ve(e)===Number&&!Number.isNaN(e),string:Xe,boolean:e=>Ve(e)===Boolean,function:e=>Ve(e)===Function,array:$e,nodeList:Ye,element:e=>ze(e,Element),event:e=>ze(e,Event),empty:e=>We(e)||(Xe(e)||$e(e)||Ye(e))&&!e.length||Ke(e)&&!Object.keys(e).length};function Ge(e,t){if(t<1){const n=function(e){const t=`${e}`.match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}class Qe{constructor(e,t){Je.element(e)?this.element=e:Je.string(e)&&(this.element=document.querySelector(e)),Je.element(this.element)&&Je.empty(this.element.rangeTouch)&&(this.config=Object.assign({},Ue,t),this.init())}static get enabled(){return"ontouchstart"in document.documentElement}static setup(e,t={}){let n=null;if(Je.empty(e)||Je.string(e)?n=Array.from(document.querySelectorAll(Je.string(e)?e:'input[type="range"]')):Je.element(e)?n=[e]:Je.nodeList(e)?n=Array.from(e):Je.array(e)&&(n=e.filter(Je.element)),Je.empty(n))return null;const i=Object.assign({},Ue,t);if(Je.string(e)&&i.watch){new MutationObserver(t=>{Array.from(t).forEach(t=>{Array.from(t.addedNodes).forEach(t=>{if(!Je.element(t)||!function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(t,e))return;new Qe(t,i)})})}).observe(document.body,{childList:!0,subtree:!0})}return n.map(e=>new Qe(e,t))}init(){Qe.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}destroy(){Qe.enabled&&(this.listeners(!1),this.element.rangeTouch=null)}listeners(e){const t=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(e=>{this.element[t](e,e=>this.set(e),!1)})}get(e){if(!Qe.enabled||!Je.event(e))return null;const t=e.target,n=e.changedTouches[0],i=parseFloat(t.getAttribute("min"))||0,r=parseFloat(t.getAttribute("max"))||100,a=parseFloat(t.getAttribute("step"))||1,s=r-i;let o;const l=t.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return(o=100/l.width*(n.clientX-l.left))<0?o=0:o>100&&(o=100),o<50?o-=(100-2*o)*c:o>50&&(o+=2*(o-50)*c),i+Ge(s*(o/100),a)}set(e){Qe.enabled&&Je.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),function(e,t){if(!e||!t)return;const n=new Event(t);e.dispatchEvent(n)}(e.target,"touchend"===e.type?"change":"input"))}}var Ze=function(e){return null!=e?e.constructor:null},et=function(e,t){return Boolean(e&&t&&e instanceof t)},tt=function(e){return null==e},nt=function(e){return Ze(e)===Object},it=function(e){return Ze(e)===String},rt=function(e){return Array.isArray(e)},at=function(e){return et(e,NodeList)},st=function(e){return tt(e)||(it(e)||rt(e)||at(e))&&!e.length||nt(e)&&!Object.keys(e).length},ot={nullOrUndefined:tt,object:nt,number:function(e){return Ze(e)===Number&&!Number.isNaN(e)},string:it,boolean:function(e){return Ze(e)===Boolean},function:function(e){return Ze(e)===Function},array:rt,weakMap:function(e){return et(e,WeakMap)},nodeList:at,element:function(e){return et(e,Element)},textNode:function(e){return Ze(e)===Text},event:function(e){return et(e,Event)},keyboardEvent:function(e){return et(e,KeyboardEvent)},cue:function(e){return et(e,window.TextTrackCue)||et(e,window.VTTCue)},track:function(e){return et(e,TextTrack)||!tt(e)&&it(e.kind)},promise:function(e){return et(e,Promise)},url:function(e){if(et(e,window.URL))return!0;if(!it(e))return!1;var t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!st(new URL(t).hostname)}catch(e){return!1}},empty:st},lt=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function ct(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!ot.empty(t)&&ot.function(n)){var o=t.split(" "),l=s;lt&&(l={passive:a,capture:s}),o.forEach(function(t){i&&i.eventListeners&&r&&i.eventListeners.push({element:e,type:t,callback:n,options:l}),e[r?"addEventListener":"removeEventListener"](t,n,l)})}}function ut(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];ct.call(this,e,t,n,!0,i,r)}function dt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];ct.call(this,e,t,n,!1,i,r)}function ht(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];ct.call(this,e,n,function s(){dt(e,n,s,r,a);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];i.apply(t,l)},!0,r,a)}function pt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(ot.element(e)&&!ot.empty(t)){var r=new CustomEvent(t,{bubbles:n,detail:Object.assign({},i,{plyr:this})});e.dispatchEvent(r)}}function mt(e,t){var n=e.length?e:[e];Array.from(n).reverse().forEach(function(e,n){var i=n>0?t.cloneNode(!0):t,r=e.parentNode,a=e.nextSibling;i.appendChild(e),a?r.insertBefore(i,a):r.appendChild(i)})}function ft(e,t){ot.element(e)&&!ot.empty(t)&&Object.entries(t).filter(function(e){var t=He(e,2)[1];return!ot.nullOrUndefined(t)}).forEach(function(t){var n=He(t,2),i=n[0],r=n[1];return e.setAttribute(i,r)})}function gt(e,t,n){var i=document.createElement(e);return ot.object(t)&&ft(i,t),ot.string(n)&&(i.innerText=n),i}function yt(e,t,n,i){ot.element(t)&&t.appendChild(gt(e,n,i))}function vt(e){ot.nodeList(e)||ot.array(e)?Array.from(e).forEach(vt):ot.element(e)&&ot.element(e.parentNode)&&e.parentNode.removeChild(e)}function bt(e){if(ot.element(e))for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function kt(e,t){return ot.element(t)&&ot.element(t.parentNode)&&ot.element(e)?(t.parentNode.replaceChild(e,t),e):null}function wt(e,t){if(!ot.string(e)||ot.empty(e))return{};var n={},i=t;return e.split(",").forEach(function(e){var t=e.trim(),r=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),s=a[0],o=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":ot.object(i)&&ot.string(i.class)&&(i.class+=" ".concat(r)),n.class=r;break;case"#":n.id=t.replace("#","");break;case"[":n[s]=o}}),n}function _t(e,t){if(ot.element(e)){var n=t;ot.boolean(n)||(n=!e.hidden),n?e.setAttribute("hidden",""):e.removeAttribute("hidden")}}function Tt(e,t,n){if(ot.nodeList(e))return Array.from(e).map(function(e){return Tt(e,t,n)});if(ot.element(e)){var i="toggle";return void 0!==n&&(i=n?"add":"remove"),e.classList[i](t),e.classList.contains(t)}return!1}function Et(e,t){return ot.element(e)&&e.classList.contains(t)}function St(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function Ct(e){return this.elements.container.querySelectorAll(e)}function xt(e){return this.elements.container.querySelector(e)}function At(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];ot.element(e)&&(e.focus({preventScroll:!0}),t&&Tt(e,this.config.classNames.tabFocus))}var Pt,Ot,Mt,Nt=(Pt=document.createElement("span"),Ot={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},Mt=Object.keys(Ot).find(function(e){return void 0!==Pt.style[e]}),!!ot.string(Mt)&&Ot[Mt]);function Lt(e){setTimeout(function(){try{_t(e,!0),e.offsetHeight,_t(e,!1)}catch(e){}},0)}var It,jt={isIE:!!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform)},Rt={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},Dt={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,n){var i=jt.isIPhone&&n&&Dt.playsinline,r=Dt[e]||"html5"!==t;return{api:r,ui:r&&Dt.rangeInput&&("video"!==e||!jt.isIPhone||i)}},pip:!(jt.isIPhone||!ot.function(gt("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||gt("video").disablePictureInPicture)),airplay:ot.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){if(ot.empty(e))return!1;var t=He(e.split("/"),1)[0],n=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(Rt).includes(n)&&(n+='; codecs="'.concat(Rt[e],'"'));try{return Boolean(n&&this.media.canPlayType(n).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(It=document.createElement("input"),It.type="range","range"===It.type),touch:"ontouchstart"in document.documentElement,transitions:!1!==Nt,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Ft={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(function(t){var n=t.getAttribute("type");return!!ot.empty(n)||Dt.mime.call(e,n)}):[]},getQualityOptions:function(){return Ft.getSources.call(this).map(function(e){return Number(e.getAttribute("size"))}).filter(Boolean)},extend:function(){if(this.isHTML5){var e=this;Object.defineProperty(e.media,"quality",{get:function(){var t=Ft.getSources.call(e).find(function(t){return t.getAttribute("src")===e.source});return t&&Number(t.getAttribute("size"))},set:function(t){var n=Ft.getSources.call(e).find(function(e){return Number(e.getAttribute("size"))===t});if(n){var i=e.media,r=i.currentTime,a=i.paused,s=i.preload,o=i.readyState;e.media.src=n.getAttribute("src"),("none"!==s||o)&&(e.once("loadedmetadata",function(){e.currentTime=r,a||e.play()}),e.media.load()),pt.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(vt(Ft.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function Bt(e){return ot.array(e)?e.filter(function(t,n){return e.indexOf(t)===n}):e}function Ht(e,t){return t.split(".").reduce(function(e,t){return e&&e[t]},e)}function qt(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},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;var r=n.shift();return ot.object(r)?(Object.keys(r).forEach(function(t){ot.object(r[t])?(Object.keys(e).includes(t)||Object.assign(e,Be({},t,{})),qt(e[t],r[t])):Object.assign(e,Be({},t,r[t]))}),qt.apply(void 0,[e].concat(n))):e}function Ut(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ot.empty(e)?e:e.toString().replace(/{(\d+)}/g,function(e,t){return n[t].toString()})}function Vt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"),"g"),n.toString())}function zt(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})}function Wt(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return(e=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return e=Vt(e,"-"," "),e=Vt(e,"_"," "),Vt(e=zt(e)," ","")}(e)).charAt(0).toLowerCase()+e.slice(1)}function Kt(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var Xt={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},$t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(ot.empty(e)||ot.empty(t))return"";var n=Ht(t.i18n,e);if(ot.empty(n))return Object.keys(Xt).includes(e)?Xt[e]:"";var i={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(i).forEach(function(e){var t=He(e,2),i=t[0],r=t[1];n=Vt(n,i,r)}),n},Yt=function(){function e(t){Re(this,e),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}return Fe(e,[{key:"get",value:function(t){if(!e.supported||!this.enabled)return null;var n=window.localStorage.getItem(this.key);if(ot.empty(n))return null;var i=JSON.parse(n);return ot.string(t)&&t.length?i[t]:i}},{key:"set",value:function(t){if(e.supported&&this.enabled&&ot.object(t)){var n=this.get();ot.empty(n)&&(n={}),qt(n,t),window.localStorage.setItem(this.key,JSON.stringify(n))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;return window.localStorage.setItem("___test","___test"),window.localStorage.removeItem("___test"),!0}catch(e){return!1}}}]),e}();function Jt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise(function(n,i){try{var r=new XMLHttpRequest;if(!("withCredentials"in r))return;r.addEventListener("load",function(){if("text"===t)try{n(JSON.parse(r.responseText))}catch(e){n(r.responseText)}else n(r.response)}),r.addEventListener("error",function(){throw new Error(r.status)}),r.open("GET",e,!0),r.responseType=t,r.send()}catch(e){i(e)}})}function Gt(e,t){if(ot.string(e)){var n=ot.string(t),i=function(){return null!==document.getElementById(t)},r=function(e,t){e.innerHTML=t,n&&i()||document.body.insertAdjacentElement("afterbegin",e)};if(!n||!i()){var a=Yt.supported,s=document.createElement("div");if(s.setAttribute("hidden",""),n&&s.setAttribute("id",t),a){var o=window.localStorage.getItem("".concat("cache","-").concat(t));if(null!==o){var l=JSON.parse(o);r(s,l.content)}}Jt(e).then(function(e){ot.empty(e)||(a&&window.localStorage.setItem("".concat("cache","-").concat(t),JSON.stringify({content:e})),r(s,e))}).catch(function(){})}}}var Qt=function(e){return Math.trunc(e/60/60%60,10)},Zt=function(e){return Math.trunc(e/60%60,10)},en=function(e){return Math.trunc(e%60,10)};function tn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!ot.number(e))return tn(null,t,n);var i=function(e){return"0".concat(e).slice(-2)},r=Qt(e),a=Zt(e),s=en(e);return r=t||r>0?"".concat(r,":"):"","".concat(n&&e>0?"-":"").concat(r).concat(i(a),":").concat(i(s))}var nn={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||jt.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=xt.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:Ct.call(this,this.config.selectors.buttons.play),pause:xt.call(this,this.config.selectors.buttons.pause),restart:xt.call(this,this.config.selectors.buttons.restart),rewind:xt.call(this,this.config.selectors.buttons.rewind),fastForward:xt.call(this,this.config.selectors.buttons.fastForward),mute:xt.call(this,this.config.selectors.buttons.mute),pip:xt.call(this,this.config.selectors.buttons.pip),airplay:xt.call(this,this.config.selectors.buttons.airplay),settings:xt.call(this,this.config.selectors.buttons.settings),captions:xt.call(this,this.config.selectors.buttons.captions),fullscreen:xt.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=xt.call(this,this.config.selectors.progress),this.elements.inputs={seek:xt.call(this,this.config.selectors.inputs.seek),volume:xt.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:xt.call(this,this.config.selectors.display.buffer),currentTime:xt.call(this,this.config.selectors.display.currentTime),duration:xt.call(this,this.config.selectors.display.duration)},ot.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip))),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon:function(e,t){var n=nn.getIconUrl.call(this),i="".concat(n.cors?"":n.url,"#").concat(this.config.iconPrefix),r=document.createElementNS("http://www.w3.org/2000/svg","svg");ft(r,qt(t,{role:"presentation",focusable:"false"}));var a=document.createElementNS("http://www.w3.org/2000/svg","use"),s="".concat(i,"-").concat(e);return"href"in a&&a.setAttributeNS("http://www.w3.org/1999/xlink","href",s),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),r.appendChild(a),r},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=$t(e,this.config);return gt("span",Object.assign({},t,{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")}),n)},createBadge:function(e){if(ot.empty(e))return null;var t=gt("span",{class:this.config.classNames.menu.value});return t.appendChild(gt("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var n=Object.assign({},t),i=Wt(e),r={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(function(e){Object.keys(n).includes(e)&&(r[e]=n[e],delete n[e])}),"button"!==r.element||Object.keys(n).includes("type")||(n.type="button"),Object.keys(n).includes("class")?n.class.includes(this.config.classNames.control)||(n.class+=" ".concat(this.config.classNames.control)):n.class=this.config.classNames.control,e){case"play":r.toggle=!0,r.label="play",r.labelPressed="pause",r.icon="play",r.iconPressed="pause";break;case"mute":r.toggle=!0,r.label="mute",r.labelPressed="unmute",r.icon="volume",r.iconPressed="muted";break;case"captions":r.toggle=!0,r.label="enableCaptions",r.labelPressed="disableCaptions",r.icon="captions-off",r.iconPressed="captions-on";break;case"fullscreen":r.toggle=!0,r.label="enterFullscreen",r.labelPressed="exitFullscreen",r.icon="enter-fullscreen",r.iconPressed="exit-fullscreen";break;case"play-large":n.class+=" ".concat(this.config.classNames.control,"--overlaid"),i="play",r.label="play",r.icon="play";break;default:ot.empty(r.label)&&(r.label=i),ot.empty(r.icon)&&(r.icon=e)}var a=gt(r.element);return r.toggle?(a.appendChild(nn.createIcon.call(this,r.iconPressed,{class:"icon--pressed"})),a.appendChild(nn.createIcon.call(this,r.icon,{class:"icon--not-pressed"})),a.appendChild(nn.createLabel.call(this,r.labelPressed,{class:"label--pressed"})),a.appendChild(nn.createLabel.call(this,r.label,{class:"label--not-pressed"}))):(a.appendChild(nn.createIcon.call(this,r.icon)),a.appendChild(nn.createLabel.call(this,r.label))),qt(n,wt(this.config.selectors.buttons[i],n)),ft(a,n),"play"===i?(ot.array(this.elements.buttons[i])||(this.elements.buttons[i]=[]),this.elements.buttons[i].push(a)):this.elements.buttons[i]=a,a},createRange:function(e,t){var n=gt("input",qt(wt(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":$t(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=n,nn.updateRangeFill.call(this,n),Qe.setup(n),n},createProgress:function(e,t){var n=gt("progress",qt(wt(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"presentation","aria-hidden":!0},t));if("volume"!==e){n.appendChild(gt("span",null,"0"));var i={played:"played",buffer:"buffered"}[e],r=i?$t(i,this.config):"";n.innerText="% ".concat(r.toLowerCase())}return this.elements.display[e]=n,n},createTime:function(e){var t=wt(this.config.selectors.display[e]),n=gt("div",qt(t,{class:"".concat(this.config.classNames.display.time," ").concat(t.class?t.class:"").trim(),"aria-label":$t(e,this.config)}),"00:00");return this.elements.display[e]=n,n},bindMenuItemShortcuts:function(e,t){var n=this;ut(e,"keydown keyup",function(i){if([32,38,39,40].includes(i.which)&&(i.preventDefault(),i.stopPropagation(),"keydown"!==i.type)){var r,a=St(e,'[role="menuitemradio"]');if(!a&&[32,39].includes(i.which))nn.showMenuPanel.call(n,t,!0);else 32!==i.which&&(40===i.which||a&&39===i.which?(r=e.nextElementSibling,ot.element(r)||(r=e.parentNode.firstElementChild)):(r=e.previousElementSibling,ot.element(r)||(r=e.parentNode.lastElementChild)),At.call(n,r,!0))}},!1),ut(e,"keyup",function(e){13===e.which&&nn.focusFirstMenuItem.call(n,null,!0)})},createMenuItem:function(e){var t=this,n=e.value,i=e.list,r=e.type,a=e.title,s=e.badge,o=void 0===s?null:s,l=e.checked,c=void 0!==l&&l,u=wt(this.config.selectors.inputs[r]),d=gt("button",qt(u,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(u.class?u.class:"").trim(),"aria-checked":c,value:n})),h=gt("span");h.innerHTML=a,ot.element(o)&&h.appendChild(o),d.appendChild(h),Object.defineProperty(d,"checked",{enumerable:!0,get:function(){return"true"===d.getAttribute("aria-checked")},set:function(e){e&&Array.from(d.parentNode.children).filter(function(e){return St(e,'[role="menuitemradio"]')}).forEach(function(e){return e.setAttribute("aria-checked","false")}),d.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(d,"click keyup",function(e){if(!ot.keyboardEvent(e)||32===e.which){switch(e.preventDefault(),e.stopPropagation(),d.checked=!0,r){case"language":t.currentTrack=Number(n);break;case"quality":t.quality=n;break;case"speed":t.speed=parseFloat(n)}nn.showMenuPanel.call(t,"home",ot.keyboardEvent(e))}},r,!1),nn.bindMenuItemShortcuts.call(this,d,r),i.appendChild(d)},formatTime:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ot.number(e)?tn(e,Qt(this.duration)>0,t):e},updateTimeDisplay:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];ot.element(e)&&ot.number(t)&&(e.innerText=nn.formatTime(t,n))},updateVolume:function(){this.supported.ui&&(ot.element(this.elements.inputs.volume)&&nn.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),ot.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;ot.element(e)&&(e.value=t,nn.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&ot.event(e)){var n,i,r=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":n=this.currentTime,i=this.duration,r=0===n||0===i||Number.isNaN(n)||Number.isNaN(i)?0:(n/i*100).toFixed(2),"timeupdate"===e.type&&nn.setRange.call(this,this.elements.inputs.seek,r);break;case"playing":case"progress":!function(e,n){var i=ot.number(n)?n:0,r=ot.element(e)?e:t.elements.display.buffer;if(ot.element(r)){r.value=i;var a=r.getElementsByTagName("span")[0];ot.element(a)&&(a.childNodes[0].nodeValue=i)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=ot.event(e)?e.target:e;if(ot.element(t)&&"range"===t.getAttribute("type")){if(St(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var n=nn.formatTime(this.currentTime),i=nn.formatTime(this.duration),r=$t("seekLabel",this.config);t.setAttribute("aria-valuetext",r.replace("{currentTime}",n).replace("{duration}",i))}else if(St(t,this.config.selectors.inputs.volume)){var a=100*t.value;t.setAttribute("aria-valuenow",a),t.setAttribute("aria-valuetext","".concat(a.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);jt.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&ot.element(this.elements.inputs.seek)&&ot.element(this.elements.display.seekTooltip)&&0!==this.duration){var n=0,i=this.elements.progress.getBoundingClientRect(),r="".concat(this.config.classNames.tooltip,"--visible"),a=function(e){Tt(t.elements.display.seekTooltip,r,e)};if(this.touch)a(!1);else{if(ot.event(e))n=100/i.width*(e.pageX-i.left);else{if(!Et(this.elements.display.seekTooltip,r))return;n=parseFloat(this.elements.display.seekTooltip.style.left,10)}n<0?n=0:n>100&&(n=100),nn.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*n),this.elements.display.seekTooltip.style.left="".concat(n,"%"),ot.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&a("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!ot.element(this.elements.display.duration)&&this.config.invertTime;nn.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||nn.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){if(this.duration>=Math.pow(2,32))return _t(this.elements.display.currentTime,!0),void _t(this.elements.progress,!0);ot.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=ot.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&nn.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&nn.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),nn.updateSeekTooltip.call(this)}},toggleMenuButton:function(e,t){_t(this.elements.settings.buttons[e],!t)},updateSetting:function(e,t,n){var i=this.elements.settings.panels[e],r=null,a=t;if("captions"===e)r=this.currentTrack;else{if(r=ot.empty(n)?this[e]:n,ot.empty(r)&&(r=this.config[e].default),!ot.empty(this.options[e])&&!this.options[e].includes(r))return void this.debug.warn("Unsupported value of '".concat(r,"' for ").concat(e));if(!this.config[e].options.includes(r))return void this.debug.warn("Disabled value of '".concat(r,"' for ").concat(e))}if(ot.element(a)||(a=i&&i.querySelector('[role="menu"]')),ot.element(a)){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=nn.getLabel.call(this,e,r);var s=a&&a.querySelector('[value="'.concat(r,'"]'));ot.element(s)&&(s.checked=!0)}},getLabel:function(e,t){switch(e){case"speed":return 1===t?$t("normal",this.config):"".concat(t,"×");case"quality":if(ot.number(t)){var n=$t("qualityLabel.".concat(t),this.config);return n.length?n:"".concat(t,"p")}return zt(t);case"captions":return sn.getLabel.call(this);default:return null}},setQualityMenu:function(e){var t=this;if(ot.element(this.elements.settings.panels.quality)){var n=this.elements.settings.panels.quality.querySelector('[role="menu"]');ot.array(e)&&(this.options.quality=Bt(e).filter(function(e){return t.config.quality.options.includes(e)}));var i=!ot.empty(this.options.quality)&&this.options.quality.length>1;if(nn.toggleMenuButton.call(this,"quality",i),bt(n),nn.checkMenu.call(this),i){var r=function(e){var n=$t("qualityBadge.".concat(e),t.config);return n.length?nn.createBadge.call(t,n):null};this.options.quality.sort(function(e,n){var i=t.config.quality.options;return i.indexOf(e)>i.indexOf(n)?1:-1}).forEach(function(e){nn.createMenuItem.call(t,{value:e,list:n,type:"quality",title:nn.getLabel.call(t,"quality",e),badge:r(e)})}),nn.updateSetting.call(this,"quality",n)}}},setCaptionsMenu:function(){var e=this;if(ot.element(this.elements.settings.panels.captions)){var t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),n=sn.getTracks.call(this),i=Boolean(n.length);if(nn.toggleMenuButton.call(this,"captions",i),bt(t),nn.checkMenu.call(this),i){var r=n.map(function(n,i){return{value:i,checked:e.captions.toggled&&e.currentTrack===i,title:sn.getLabel.call(e,n),badge:n.language&&nn.createBadge.call(e,n.language.toUpperCase()),list:t,type:"language"}});r.unshift({value:-1,checked:!this.captions.toggled,title:$t("disabled",this.config),list:t,type:"language"}),r.forEach(nn.createMenuItem.bind(this)),nn.updateSetting.call(this,"captions",t)}}},setSpeedMenu:function(e){var t=this;if(ot.element(this.elements.settings.panels.speed)){var n=this.elements.settings.panels.speed.querySelector('[role="menu"]');ot.array(e)?this.options.speed=e:(this.isHTML5||this.isVimeo)&&(this.options.speed=[.5,.75,1,1.25,1.5,1.75,2]),this.options.speed=this.options.speed.filter(function(e){return t.config.speed.options.includes(e)});var i=!ot.empty(this.options.speed)&&this.options.speed.length>1;nn.toggleMenuButton.call(this,"speed",i),bt(n),nn.checkMenu.call(this),i&&(this.options.speed.forEach(function(e){nn.createMenuItem.call(t,{value:e,list:n,type:"speed",title:nn.getLabel.call(t,"speed",e)})}),nn.updateSetting.call(this,"speed",n))}},checkMenu:function(){var e=this.elements.settings.buttons,t=!ot.empty(e)&&Object.values(e).some(function(e){return!e.hidden});_t(this.elements.settings.menu,!t)},focusFirstMenuItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.elements.settings.popup.hidden){var n=e;ot.element(n)||(n=Object.values(this.elements.settings.panels).find(function(e){return!e.hidden}));var i=n.querySelector('[role^="menuitem"]');At.call(this,i,t)}},toggleMenu:function(e){var t=this.elements.settings.popup,n=this.elements.buttons.settings;if(ot.element(t)&&ot.element(n)){var i=t.hidden,r=i;if(ot.boolean(e))r=e;else if(ot.keyboardEvent(e)&&27===e.which)r=!1;else if(ot.event(e)){var a=t.contains(e.target);if(a||!a&&e.target!==n&&r)return}n.setAttribute("aria-expanded",r),_t(t,!r),Tt(this.elements.container,this.config.classNames.menu.open,r),r&&ot.keyboardEvent(e)?nn.focusFirstMenuItem.call(this,null,!0):r||i||At.call(this,n,ot.keyboardEvent(e))}},getMenuSize:function(e){var t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);var n=t.scrollWidth,i=t.scrollHeight;return vt(t),{width:n,height:i}},showMenuPanel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=document.getElementById("plyr-settings-".concat(this.id,"-").concat(t));if(ot.element(i)){var r=i.parentNode,a=Array.from(r.children).find(function(e){return!e.hidden});if(Dt.transitions&&!Dt.reducedMotion){r.style.width="".concat(a.scrollWidth,"px"),r.style.height="".concat(a.scrollHeight,"px");var s=nn.getMenuSize.call(this,i);ut.call(this,r,Nt,function t(n){n.target===r&&["width","height"].includes(n.propertyName)&&(r.style.width="",r.style.height="",dt.call(e,r,Nt,t))}),r.style.width="".concat(s.width,"px"),r.style.height="".concat(s.height,"px")}_t(a,!0),_t(i,!1),nn.focusFirstMenuItem.call(this,i,n)}},setDownloadLink:function(){var e=this.elements.buttons.download;ot.element(e)&&e.setAttribute("href",this.download)},create:function(e){var t=this,n=gt("div",wt(this.config.selectors.controls.wrapper));if(this.config.controls.includes("restart")&&n.appendChild(nn.createButton.call(this,"restart")),this.config.controls.includes("rewind")&&n.appendChild(nn.createButton.call(this,"rewind")),this.config.controls.includes("play")&&n.appendChild(nn.createButton.call(this,"play")),this.config.controls.includes("fast-forward")&&n.appendChild(nn.createButton.call(this,"fast-forward")),this.config.controls.includes("progress")){var i=gt("div",wt(this.config.selectors.progress));if(i.appendChild(nn.createRange.call(this,"seek",{id:"plyr-seek-".concat(e.id)})),i.appendChild(nn.createProgress.call(this,"buffer")),this.config.tooltips.seek){var r=gt("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(r),this.elements.display.seekTooltip=r}this.elements.progress=i,n.appendChild(this.elements.progress)}if(this.config.controls.includes("current-time")&&n.appendChild(nn.createTime.call(this,"currentTime")),this.config.controls.includes("duration")&&n.appendChild(nn.createTime.call(this,"duration")),this.config.controls.includes("mute")||this.config.controls.includes("volume")){var a=gt("div",{class:"plyr__volume"});if(this.config.controls.includes("mute")&&a.appendChild(nn.createButton.call(this,"mute")),this.config.controls.includes("volume")){var s={max:1,step:.05,value:this.config.volume};a.appendChild(nn.createRange.call(this,"volume",qt(s,{id:"plyr-volume-".concat(e.id)}))),this.elements.volume=a}n.appendChild(a)}if(this.config.controls.includes("captions")&&n.appendChild(nn.createButton.call(this,"captions")),this.config.controls.includes("settings")&&!ot.empty(this.config.settings)){var o=gt("div",{class:"plyr__menu",hidden:""});o.appendChild(nn.createButton.call(this,"settings",{"aria-haspopup":!0,"aria-controls":"plyr-settings-".concat(e.id),"aria-expanded":!1}));var l=gt("div",{class:"plyr__menu__container",id:"plyr-settings-".concat(e.id),hidden:""}),c=gt("div"),u=gt("div",{id:"plyr-settings-".concat(e.id,"-home")}),d=gt("div",{role:"menu"});u.appendChild(d),c.appendChild(u),this.elements.settings.panels.home=u,this.config.settings.forEach(function(n){var i=gt("button",qt(wt(t.config.selectors.buttons.settings),{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--forward"),role:"menuitem","aria-haspopup":!0,hidden:""}));nn.bindMenuItemShortcuts.call(t,i,n),ut(i,"click",function(){nn.showMenuPanel.call(t,n,!1)});var r=gt("span",null,$t(n,t.config)),a=gt("span",{class:t.config.classNames.menu.value});a.innerHTML=e[n],r.appendChild(a),i.appendChild(r),d.appendChild(i);var s=gt("div",{id:"plyr-settings-".concat(e.id,"-").concat(n),hidden:""}),o=gt("button",{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--back")});o.appendChild(gt("span",{"aria-hidden":!0},$t(n,t.config))),o.appendChild(gt("span",{class:t.config.classNames.hidden},$t("menuBack",t.config))),ut(s,"keydown",function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),nn.showMenuPanel.call(t,"home",!0))},!1),ut(o,"click",function(){nn.showMenuPanel.call(t,"home",!1)}),s.appendChild(o),s.appendChild(gt("div",{role:"menu"})),c.appendChild(s),t.elements.settings.buttons[n]=i,t.elements.settings.panels[n]=s}),l.appendChild(c),o.appendChild(l),n.appendChild(o),this.elements.settings.popup=l,this.elements.settings.menu=o}if(this.config.controls.includes("pip")&&Dt.pip&&n.appendChild(nn.createButton.call(this,"pip")),this.config.controls.includes("airplay")&&Dt.airplay&&n.appendChild(nn.createButton.call(this,"airplay")),this.config.controls.includes("download")){var h={element:"a",href:this.download,target:"_blank"},p=this.config.urls.download;!ot.url(p)&&this.isEmbed&&qt(h,{icon:"logo-".concat(this.provider),label:this.provider}),n.appendChild(nn.createButton.call(this,"download",h))}return this.config.controls.includes("fullscreen")&&n.appendChild(nn.createButton.call(this,"fullscreen")),this.config.controls.includes("play-large")&&this.elements.container.appendChild(nn.createButton.call(this,"play-large")),this.elements.controls=n,this.isHTML5&&nn.setQualityMenu.call(this,Ft.getQualityOptions.call(this)),nn.setSpeedMenu.call(this),n},inject:function(){var e=this;if(this.config.loadSprite){var t=nn.getIconUrl.call(this);t.cors&&Gt(t.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());var n=null;this.elements.controls=null;var i={id:this.id,seektime:this.config.seekTime,title:this.config.title},r=!0;ot.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,i)),this.config.controls||(this.config.controls=[]),ot.element(this.config.controls)||ot.string(this.config.controls)?n=this.config.controls:(n=nn.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:sn.getLabel.call(this)}),r=!1);var a,s=function(e){var t=e;return Object.entries(i).forEach(function(e){var n=He(e,2),i=n[0],r=n[1];t=Vt(t,"{".concat(i,"}"),r)}),t};if(r&&(ot.string(this.config.controls)?n=s(n):ot.element(n)&&(n.innerHTML=s(n.innerHTML))),ot.string(this.config.selectors.controls.container)&&(a=document.querySelector(this.config.selectors.controls.container)),ot.element(a)||(a=this.elements.container),a[ot.element(n)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",n),ot.element(this.elements.controls)||nn.findElements.call(this),!ot.empty(this.elements.buttons)){var o=function(t){var n=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return Et(t,n)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Tt(t,n,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(function(e){ot.array(e)||ot.nodeList(e)?Array.from(e).filter(Boolean).forEach(o):o(e)})}if(jt.isEdge&&Lt(a),this.config.tooltips.controls){var l=this.config,c=l.classNames,u=l.selectors,d="".concat(u.controls.wrapper," ").concat(u.labels," .").concat(c.hidden),h=Ct.call(this,d);Array.from(h).forEach(function(t){Tt(t,e.config.classNames.hidden,!1),Tt(t,e.config.classNames.tooltip,!0)})}}};function rn(e){var t=e;if(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]){var n=document.createElement("a");n.href=t,t=n.href}try{return new URL(t)}catch(e){return null}}function an(e){var t=new URLSearchParams;return ot.object(e)&&Object.entries(e).forEach(function(e){var n=He(e,2),i=n[0],r=n[1];t.set(i,r)}),t}var sn={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!Dt.textTracks)ot.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&nn.setCaptionsMenu.call(this);else{var e,t;if(ot.element(this.elements.captions)||(this.elements.captions=gt("div",wt(this.config.selectors.captions)),e=this.elements.captions,t=this.elements.wrapper,ot.element(e)&&ot.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)),jt.isIE&&window.URL){var n=this.media.querySelectorAll("track");Array.from(n).forEach(function(e){var t=e.getAttribute("src"),n=rn(t);null!==n&&n.hostname!==window.location.href.hostname&&["http:","https:"].includes(n.protocol)&&Jt(t,"blob").then(function(t){e.setAttribute("src",window.URL.createObjectURL(t))}).catch(function(){vt(e)})})}var i=Bt((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(function(e){return e.split("-")[0]})),r=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();if("auto"===r)r=He(i,1)[0];var a=this.storage.get("captions");if(ot.boolean(a)||(a=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:a,language:r,languages:i}),this.isHTML5){var s=this.config.captions.update?"addtrack removetrack":"removetrack";ut.call(this,this.media.textTracks,s,sn.update.bind(this))}setTimeout(sn.update.bind(this),0)}},update:function(){var e=this,t=sn.getTracks.call(this,!0),n=this.captions,i=n.active,r=n.language,a=n.meta,s=n.currentTrackNode,o=Boolean(t.find(function(e){return e.language===r}));this.isHTML5&&this.isVideo&&t.filter(function(e){return!a.get(e)}).forEach(function(t){e.debug.log("Track added",t),a.set(t,{default:"showing"===t.mode}),t.mode="hidden",ut.call(e,t,"cuechange",function(){return sn.updateCues.call(e)})}),(o&&this.language!==r||!t.includes(s))&&(sn.setLanguage.call(this,r),sn.toggle.call(this,i&&o)),Tt(this.elements.container,this.config.classNames.captions.enabled,!ot.empty(t)),(this.config.controls||[]).includes("settings")&&this.config.settings.includes("captions")&&nn.setCaptionsMenu.call(this)},toggle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.supported.ui){var n=this.captions.toggled,i=this.config.classNames.captions.active,r=ot.nullOrUndefined(e)?!n:e;if(r!==n){if(t||(this.captions.active=r,this.storage.set({captions:r})),!this.language&&r&&!t){var a=sn.getTracks.call(this),s=sn.findTrack.call(this,[this.captions.language].concat(qe(this.captions.languages)),!0);return this.captions.language=s.language,void sn.set.call(this,a.indexOf(s))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=r),Tt(this.elements.container,i,r),this.captions.toggled=r,nn.updateSetting.call(this,"captions"),pt.call(this,this.media,r?"captionsenabled":"captionsdisabled")}}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=sn.getTracks.call(this);if(-1!==e)if(ot.number(e))if(e in n){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var i=n[e],r=(i||{}).language;this.captions.currentTrackNode=i,nn.updateSetting.call(this,"captions"),t||(this.captions.language=r,this.storage.set({language:r})),this.isVimeo&&this.embed.enableTextTrack(r),pt.call(this,this.media,"languagechange")}sn.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&sn.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else sn.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(ot.string(e)){var n=e.toLowerCase();this.captions.language=n;var i=sn.getTracks.call(this),r=sn.findTrack.call(this,[n]);sn.set.call(this,i.indexOf(r),t)}else this.debug.warn("Invalid language argument",e)},getTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Array.from((this.media||{}).textTracks||[]).filter(function(n){return!e.isHTML5||t||e.captions.meta.has(n)}).filter(function(e){return["captions","subtitles"].includes(e.kind)})},findTrack:function(e){var t,n=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=sn.getTracks.call(this),a=function(e){return Number((n.captions.meta.get(e)||{}).default)},s=Array.from(r).sort(function(e,t){return a(t)-a(e)});return e.every(function(e){return!(t=s.find(function(t){return t.language===e}))}),t||(i?s[0]:void 0)},getCurrentTrack:function(){return sn.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!ot.track(t)&&Dt.textTracks&&this.captions.toggled&&(t=sn.getCurrentTrack.call(this)),ot.track(t)?ot.empty(t.label)?ot.empty(t.language)?$t("enabled",this.config):e.language.toUpperCase():t.label:$t("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(ot.element(this.elements.captions))if(ot.nullOrUndefined(e)||Array.isArray(e)){var t=e;if(!t){var n=sn.getCurrentTrack.call(this);t=Array.from((n||{}).activeCues||[]).map(function(e){return e.getCueAsHTML()}).map(Kt)}var i=t.map(function(e){return e.trim()}).join("\n");if(i!==this.elements.captions.innerHTML){bt(this.elements.captions);var r=gt("span",wt(this.config.selectors.caption));r.innerHTML=i,this.elements.captions.appendChild(r),pt.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},on={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:"16:9",clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.5.0-beta.4/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240]},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/v2/video/{0}.json"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://www.googleapis.com/youtube/v3/videos?id={0}&key={1}&fields=items(snippet(title))&part=snippet"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption",menu:{quality:".js-plyr__menu__list--quality"}},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id"}},keys:{google:null},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1},youtube:{noCookie:!1,rel:0,showinfo:0,iv_load_policy:3,modestbranding:1}},ln="picture-in-picture",cn="inline",un={html5:"html5",youtube:"youtube",vimeo:"vimeo"},dn={audio:"audio",video:"video"};var hn=function(){},pn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Re(this,e),this.enabled=window.console&&t,this.enabled&&this.log("Debugging enabled")}return Fe(e,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):hn}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):hn}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):hn}}]),e}();function mn(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;ot.element(e)&&(e.pressed=this.active),pt.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0),jt.isIos||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(ot.element(e)){var n=Ct.call(this,"button:not(:disabled), input:not(:disabled), [tabindex]"),i=n[0],r=n[n.length-1];ct.call(this,this.elements.container,"keydown",function(e){if("Tab"===e.key&&9===e.keyCode){var t=document.activeElement;t!==r||e.shiftKey?t===i&&e.shiftKey&&(r.focus(),e.preventDefault()):(i.focus(),e.preventDefault())}},t,!1)}}.call(this.player,this.target,this.active)}}function fn(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(t?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=t?"hidden":"",Tt(this.target,this.player.config.classNames.fullscreen.fallback,t),jt.isIos){var n=document.head.querySelector('meta[name="viewport"]'),i="viewport-fit=cover";n||(n=document.createElement("meta")).setAttribute("name","viewport");var r=ot.string(n.content)&&n.content.includes(i);t?(this.cleanupViewport=!r,r||(n.content+=",".concat(i))):this.cleanupViewport&&(n.content=n.content.split(",").filter(function(e){return e.trim()!==i}).join(",")),setTimeout(function(){return Lt(e.target)},100)}mn.call(this)}var gn=function(){function e(t){var n=this;Re(this,e),this.player=t,this.prefix=e.prefix,this.property=e.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===t.config.fullscreen.fallback,ut.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),function(){mn.call(n)}),ut.call(this.player,this.player.elements.container,"dblclick",function(e){ot.element(n.player.elements.controls)&&n.player.elements.controls.contains(e.target)||n.toggle()}),this.update()}return Fe(e,[{key:"update",value:function(){var t;this.enabled?(t=this.forceFallback?"Fallback (forced)":e.native?"Native":"Fallback",this.player.debug.log("".concat(t," fullscreen enabled"))):this.player.debug.log("Fullscreen not supported and fallback disabled");Tt(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(jt.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!e.native||this.forceFallback?fn.call(this,!0):this.prefix?ot.empty(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen())}},{key:"exit",value:function(){if(this.enabled)if(jt.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),this.player.play();else if(!e.native||this.forceFallback)fn.call(this,!1);else if(this.prefix){if(!ot.empty(this.prefix)){var t="moz"===this.prefix?"Cancel":"Exit";document["".concat(this.prefix).concat(t).concat(this.property)]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"usingNative",get:function(){return e.native&&!this.forceFallback}},{key:"enabled",get:function(){return(e.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}},{key:"active",get:function(){return!!this.enabled&&(!e.native||this.forceFallback?Et(this.target,this.player.config.classNames.fullscreen.fallback):(this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement)===this.target)}},{key:"target",get:function(){return jt.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.container}}],[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(ot.function(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some(function(t){return!(!ot.function(document["".concat(t,"ExitFullscreen")])&&!ot.function(document["".concat(t,"CancelFullScreen")]))&&(e=t,!0)}),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),e}();function yn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise(function(n,i){var r=new Image,a=function(){delete r.onload,delete r.onerror,(r.naturalWidth>=t?n:i)(r)};Object.assign(r,{onload:a,onerror:a,src:e})})}var vn={addStyleHook:function(){Tt(this.elements.container,this.config.selectors.container.replace(".",""),!0),Tt(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build:function(){var e=this;if(this.listeners.media(),!this.supported.ui)return this.debug.warn("Basic support only for ".concat(this.provider," ").concat(this.type)),void vn.toggleNativeControls.call(this,!0);ot.element(this.elements.controls)||(nn.inject.call(this),this.listeners.controls()),vn.toggleNativeControls.call(this),this.isHTML5&&sn.setup.call(this),this.volume=null,this.muted=null,this.speed=null,this.loop=null,this.quality=null,nn.updateVolume.call(this),nn.timeUpdate.call(this),vn.checkPlaying.call(this),Tt(this.elements.container,this.config.classNames.pip.supported,Dt.pip&&this.isHTML5&&this.isVideo),Tt(this.elements.container,this.config.classNames.airplay.supported,Dt.airplay&&this.isHTML5),Tt(this.elements.container,this.config.classNames.isIos,jt.isIos),Tt(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(function(){pt.call(e,e.media,"ready")},0),vn.setTitle.call(this),this.poster&&vn.setPoster.call(this,this.poster,!1).catch(function(){}),this.config.duration&&nn.durationUpdate.call(this)},setTitle:function(){var e=$t("play",this.config);if(ot.string(this.config.title)&&!ot.empty(this.config.title)&&(e+=", ".concat(this.config.title)),Array.from(this.elements.buttons.play||[]).forEach(function(t){t.setAttribute("aria-label",e)}),this.isEmbed){var t=xt.call(this,"iframe");if(!ot.element(t))return;var n=ot.empty(this.config.title)?"video":this.config.title,i=$t("frameTitle",this.config);t.setAttribute("title",i.replace("{title}",n))}},togglePoster:function(e){Tt(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster:function(e){var t=this;return arguments.length>1&&void 0!==arguments[1]&&!arguments[1]||!this.poster?(this.media.setAttribute("poster",e),function(){var e=this;return new Promise(function(t){return e.ready?setTimeout(t,0):ut.call(e,e.elements.container,"ready",t)}).then(function(){})}.call(this).then(function(){return yn(e)}).catch(function(n){throw e===t.poster&&vn.togglePoster.call(t,!1),n}).then(function(){if(e!==t.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(function(){return Object.assign(t.elements.poster.style,{backgroundImage:"url('".concat(e,"')"),backgroundSize:""}),vn.togglePoster.call(t,!0),e})):Promise.reject(new Error("Poster already set"))},checkPlaying:function(e){var t=this;Tt(this.elements.container,this.config.classNames.playing,this.playing),Tt(this.elements.container,this.config.classNames.paused,this.paused),Tt(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(function(e){e.pressed=t.playing}),ot.event(e)&&"timeupdate"===e.type||vn.toggleControls.call(this)},checkLoading:function(e){var t=this;this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(function(){Tt(t.elements.container,t.config.classNames.loading,t.loading),vn.toggleControls.call(t)},this.loading?250:0)},toggleControls:function(e){var t=this.elements.controls;if(t&&this.config.hideControls){var n=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||n))}}};function bn(e){var t=e;ot.string(t)||ot.nullOrUndefined(this.embed)||(t=this.embed.ratio),ot.string(t)||(t=this.config.ratio);var n=He(t.split(":").map(Number),2),i=100/n[0]*n[1];if(this.elements.wrapper.style.paddingBottom="".concat(i,"%"),this.isVimeo&&this.supported.ui){var r=(240-i)/4.8;this.media.style.transform="translateY(-".concat(r,"%)")}return{padding:i,ratio:t}}var kn=function(){function e(t){Re(this,e),this.player=t,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}return Fe(e,[{key:"handleKey",value:function(e){var t=this.player,n=t.elements,i=e.keyCode?e.keyCode:e.which,r="keydown"===e.type,a=r&&i===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&ot.number(i)){if(r){var s=document.activeElement;if(ot.element(s)){var o=t.config.selectors.editable;if(s!==n.inputs.seek&&St(s,o))return;if(32===e.which&&St(s,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(i)&&(e.preventDefault(),e.stopPropagation()),i){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a||(t.currentTime=t.duration/10*(i-48));break;case 32:case 75:a||t.togglePlay();break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:a||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:a||t.toggleCaptions();break;case 76:t.loop=!t.loop}27===i&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=i}else this.lastKey=null}}},{key:"toggleMenu",value:function(e){nn.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){var e=this.player,t=e.elements;e.touch=!0,Tt(t.container,e.config.classNames.isTouch,!0)}},{key:"setTabFocus",value:function(e){var t=this.player,n=t.elements;if(clearTimeout(this.focusTimer),"keydown"!==e.type||9===e.which){"keydown"===e.type&&(this.lastKeyDown=e.timeStamp);var i,r=e.timeStamp-this.lastKeyDown<=20;if("focus"!==e.type||r)i=t.config.classNames.tabFocus,Tt(Ct.call(t,".".concat(i)),i,!1),this.focusTimer=setTimeout(function(){var e=document.activeElement;n.container.contains(e)&&Tt(document.activeElement,t.config.classNames.tabFocus,!0)},10)}}},{key:"global",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.player;t.config.keyboard.global&&ct.call(t,window,"keydown keyup",this.handleKey,e,!1),ct.call(t,document.body,"click",this.toggleMenu,e),ht.call(t,document.body,"touchstart",this.firstTouch),ct.call(t,document.body,"keydown focus blur",this.setTabFocus,e,!1,!0)}},{key:"container",value:function(){var e=this.player,t=e.config,n=e.elements,i=e.timers;!t.keyboard.global&&t.keyboard.focused&&ut.call(e,n.container,"keydown keyup",this.handleKey,!1),ut.call(e,n.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",function(t){var r=n.controls;r&&"enterfullscreen"===t.type&&(r.pressed=!1,r.hover=!1);var a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(vn.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(i.controls),i.controls=setTimeout(function(){return vn.toggleControls.call(e,!1)},a)});var r=function(t){if(!t)return bn.call(e);var i=n.container.getBoundingClientRect(),r=i.width,a=i.height;return bn.call(e,"".concat(r,":").concat(a))},a=function(){window.clearTimeout(i.resized),i.resized=window.setTimeout(r,50)};ut.call(e,n.container,"enterfullscreen exitfullscreen",function(t){var i=e.fullscreen,s=i.target,o=i.usingNative;if(e.isEmbed&&s===n.container){var l="enterfullscreen"===t.type,c=r(l);c.padding;!function(t,n,i){if(e.isVimeo){var r=e.elements.wrapper.firstChild,a=He(t.split(":").map(Number),2)[1],s=He(e.embed.ratio.split(":").map(Number),2),o=s[0],l=s[1];r.style.maxWidth=i?"".concat(a/l*o,"px"):null,r.style.margin=i?"0 auto":null}}(c.ratio,0,l),o||(l?ut.call(e,window,"resize",a):dt.call(e,window,"resize",a))}})}},{key:"media",value:function(){var e=this,t=this.player,n=t.elements;if(ut.call(t,t.media,"timeupdate seeking seeked",function(e){return nn.timeUpdate.call(t,e)}),ut.call(t,t.media,"durationchange loadeddata loadedmetadata",function(e){return nn.durationUpdate.call(t,e)}),ut.call(t,t.media,"canplay loadeddata",function(){_t(n.volume,!t.hasAudio),_t(n.buttons.mute,!t.hasAudio)}),ut.call(t,t.media,"ended",function(){t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&t.restart()}),ut.call(t,t.media,"progress playing seeking seeked",function(e){return nn.updateProgress.call(t,e)}),ut.call(t,t.media,"volumechange",function(e){return nn.updateVolume.call(t,e)}),ut.call(t,t.media,"playing play pause ended emptied timeupdate",function(e){return vn.checkPlaying.call(t,e)}),ut.call(t,t.media,"waiting canplay seeked playing",function(e){return vn.checkLoading.call(t,e)}),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){var i=xt.call(t,".".concat(t.config.classNames.video));if(!ot.element(i))return;ut.call(t,n.container,"click",function(r){([n.container,i].includes(r.target)||i.contains(r.target))&&(t.touch&&t.config.hideControls||(t.ended?(e.proxy(r,t.restart,"restart"),e.proxy(r,t.play,"play")):e.proxy(r,t.togglePlay,"play")))})}t.supported.ui&&t.config.disableContextMenu&&ut.call(t,n.wrapper,"contextmenu",function(e){e.preventDefault()},!1),ut.call(t,t.media,"volumechange",function(){t.storage.set({volume:t.volume,muted:t.muted})}),ut.call(t,t.media,"ratechange",function(){nn.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})}),ut.call(t,t.media,"qualitychange",function(e){nn.updateSetting.call(t,"quality",null,e.detail.quality)}),ut.call(t,t.media,"ready qualitychange",function(){nn.setDownloadLink.call(t)});var r=t.config.events.concat(["keyup","keydown"]).join(" ");ut.call(t,t.media,r,function(e){var i=e.detail,r=void 0===i?{}:i;"error"===e.type&&(r=t.media.error),pt.call(t,n.container,e.type,!0,r)})}},{key:"proxy",value:function(e,t,n){var i=this.player,r=i.config.listeners[n],a=!0;ot.function(r)&&(a=r.call(i,e)),a&&ot.function(t)&&t.call(i,e)}},{key:"bind",value:function(e,t,n,i){var r=this,a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=this.player,o=s.config.listeners[i],l=ot.function(o);ut.call(s,e,t,function(e){return r.proxy(e,n,i)},a&&!l)}},{key:"controls",value:function(){var e=this,t=this.player,n=t.elements,i=jt.isIE?"change":"input";if(n.buttons.play&&Array.from(n.buttons.play).forEach(function(n){e.bind(n,"click",t.togglePlay,"play")}),this.bind(n.buttons.restart,"click",t.restart,"restart"),this.bind(n.buttons.rewind,"click",t.rewind,"rewind"),this.bind(n.buttons.fastForward,"click",t.forward,"fastForward"),this.bind(n.buttons.mute,"click",function(){t.muted=!t.muted},"mute"),this.bind(n.buttons.captions,"click",function(){return t.toggleCaptions()}),this.bind(n.buttons.download,"click",function(){pt.call(t,t.media,"download")},"download"),this.bind(n.buttons.fullscreen,"click",function(){t.fullscreen.toggle()},"fullscreen"),this.bind(n.buttons.pip,"click",function(){t.pip="toggle"},"pip"),this.bind(n.buttons.airplay,"click",t.airplay,"airplay"),this.bind(n.buttons.settings,"click",function(e){e.stopPropagation(),nn.toggleMenu.call(t,e)}),this.bind(n.buttons.settings,"keyup",function(e){var n=e.which;[13,32].includes(n)&&(13!==n?(e.preventDefault(),e.stopPropagation(),nn.toggleMenu.call(t,e)):nn.focusFirstMenuItem.call(t,null,!0))},null,!1),this.bind(n.settings.menu,"keydown",function(e){27===e.which&&nn.toggleMenu.call(t,e)}),this.bind(n.inputs.seek,"mousedown mousemove",function(e){var t=n.progress.getBoundingClientRect(),i=100/t.width*(e.pageX-t.left);e.currentTarget.setAttribute("seek-value",i)}),this.bind(n.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",function(e){var n=e.currentTarget,i=e.keyCode?e.keyCode:e.which;if(!ot.keyboardEvent(e)||39===i||37===i){t.lastSeekTime=Date.now();var r=n.hasAttribute("play-on-seeked"),a=["mouseup","touchend","keyup"].includes(e.type);r&&a?(n.removeAttribute("play-on-seeked"),t.play()):!a&&t.playing&&(n.setAttribute("play-on-seeked",""),t.pause())}}),jt.isIos){var r=Ct.call(t,'input[type="range"]');Array.from(r).forEach(function(t){return e.bind(t,i,function(e){return Lt(e.target)})})}this.bind(n.inputs.seek,i,function(e){var n=e.currentTarget,i=n.getAttribute("seek-value");ot.empty(i)&&(i=n.value),n.removeAttribute("seek-value"),t.currentTime=i/n.max*t.duration},"seek"),this.bind(n.progress,"mouseenter mouseleave mousemove",function(e){return nn.updateSeekTooltip.call(t,e)}),this.bind(n.progress,"mousemove touchmove",function(e){var n=t.previewThumbnails;n&&n.loaded&&n.startMove(e)}),this.bind(n.progress,"mouseleave click",function(){var e=t.previewThumbnails;e&&e.loaded&&e.endMove(!1,!0)}),this.bind(n.progress,"mousedown touchstart",function(e){var n=t.previewThumbnails;n&&n.loaded&&n.startScrubbing(e)}),this.bind(n.progress,"mouseup touchend",function(e){var n=t.previewThumbnails;n&&n.loaded&&n.endScrubbing(e)}),jt.isWebkit&&Array.from(Ct.call(t,'input[type="range"]')).forEach(function(n){e.bind(n,"input",function(e){return nn.updateRangeFill.call(t,e.target)})}),t.config.toggleInvert&&!ot.element(n.display.duration)&&this.bind(n.display.currentTime,"click",function(){0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,nn.timeUpdate.call(t))}),this.bind(n.inputs.volume,i,function(e){t.volume=e.target.value},"volume"),this.bind(n.controls,"mouseenter mouseleave",function(e){n.controls.hover=!t.touch&&"mouseenter"===e.type}),this.bind(n.controls,"mousedown mouseup touchstart touchend touchcancel",function(e){n.controls.pressed=["mousedown","touchstart"].includes(e.type)}),this.bind(n.controls,"focusin",function(){var n=t.config,i=t.elements,r=t.timers;Tt(i.controls,n.classNames.noTransition,!0),vn.toggleControls.call(t,!0),setTimeout(function(){Tt(i.controls,n.classNames.noTransition,!1)},0);var a=e.touch?3e3:4e3;clearTimeout(r.controls),r.controls=setTimeout(function(){return vn.toggleControls.call(t,!1)},a)}),this.bind(n.inputs.volume,"wheel",function(e){var n=e.webkitDirectionInvertedFromDevice,i=He([e.deltaX,-e.deltaY].map(function(e){return n?-e:e}),2),r=i[0],a=i[1],s=Math.sign(Math.abs(r)>Math.abs(a)?r:a);t.increaseVolume(s/50);var o=t.media.volume;(1===s&&o<1||-1===s&&o>0)&&e.preventDefault()},"volume",!1)}}]),e}(),wn=t(function(e,t){e.exports=function(){var e=function(){},t={},n={},i={};function r(e,t){if(e){var r=i[e];if(n[e]=t,r)for(;r.length;)r[0](e,t),r.splice(0,1)}}function a(t,n){t.call&&(t={success:t}),n.length?(t.error||e)(n):(t.success||e)(t)}function s(t,n,i,r){var a,o,l=document,c=i.async,u=(i.numRetries||0)+1,d=i.before||e,h=t.replace(/^(css|img)!/,"");r=r||0,/(^css!|\.css$)/.test(t)?(a=!0,(o=l.createElement("link")).rel="stylesheet",o.href=h):/(^img!|\.(png|gif|jpg|svg)$)/.test(t)?(o=l.createElement("img")).src=h:((o=l.createElement("script")).src=t,o.async=void 0===c||c),o.onload=o.onerror=o.onbeforeload=function(e){var l=e.type[0];if(a&&"hideFocus"in o)try{o.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l&&(r+=1)<u)return s(t,n,i,r);n(t,l,e.defaultPrevented)},!1!==d(t,o)&&l.head.appendChild(o)}function o(e,n,i){var o,l;if(n&&n.trim&&(o=n),l=(o?i:n)||{},o){if(o in t)throw"LoadJS";t[o]=!0}!function(e,t,n){var i,r,a=(e=e.push?e:[e]).length,o=a,l=[];for(i=function(e,n,i){if("e"==n&&l.push(e),"b"==n){if(!i)return;l.push(e)}--a||t(l)},r=0;r<o;r++)s(e[r],i,n)}(e,function(e){a(l,e),r(o,e)},l)}return o.ready=function(e,t){return function(e,t){e=e.push?e:[e];var r,a,s,o=[],l=e.length,c=l;for(r=function(e,n){n.length&&o.push(e),--c||t(o)};l--;)a=e[l],(s=n[a])?r(a,s):(i[a]=i[a]||[]).push(r)}(e,function(e){a(t,e)}),o},o.done=function(e){r(e,[])},o.reset=function(){t={},n={},i={}},o.isDefined=function(e){return e in t},o}()});function _n(e){return new Promise(function(t,n){wn(e,{success:t,error:n})})}function Tn(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,pt.call(this,this.media,e?"play":"pause"))}var En={setup:function(){var e=this;Tt(this.elements.wrapper,this.config.classNames.embed,!0),bn.call(this),ot.object(window.Vimeo)?En.ready.call(this):_n(this.config.urls.vimeo.sdk).then(function(){En.ready.call(e)}).catch(function(t){e.debug.warn("Vimeo API failed to load",t)})},ready:function(){var e=this,t=this,n=t.config.vimeo,i=an(qt({},{loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},n)),r=t.media.getAttribute("src");ot.empty(r)&&(r=t.media.getAttribute(t.config.attributes.embed.id));var a,s=(a=r,ot.empty(a)?null:ot.number(Number(a))?a:a.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:a),o=gt("iframe"),l=Ut(t.config.urls.vimeo.iframe,s,i);o.setAttribute("src",l),o.setAttribute("allowfullscreen",""),o.setAttribute("allowtransparency",""),o.setAttribute("allow","autoplay");var c=gt("div",{poster:t.poster,class:t.config.classNames.embedContainer});c.appendChild(o),t.media=kt(c,t.media),Jt(Ut(t.config.urls.vimeo.api,s),"json").then(function(e){if(!ot.empty(e)){var n=new URL(e[0].thumbnail_large);n.pathname="".concat(n.pathname.split("_")[0],".jpg"),vn.setPoster.call(t,n.href).catch(function(){})}}),t.embed=new window.Vimeo.Player(o,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=function(){return Tn.call(t,!0),t.embed.play()},t.media.pause=function(){return Tn.call(t,!1),t.embed.pause()},t.media.stop=function(){t.pause(),t.currentTime=0};var u=t.media.currentTime;Object.defineProperty(t.media,"currentTime",{get:function(){return u},set:function(e){var n=t.embed,i=t.media,r=t.paused,a=t.volume,s=r&&!n.hasPlayed;i.seeking=!0,pt.call(t,i,"seeking"),Promise.resolve(s&&n.setVolume(0)).then(function(){return n.setCurrentTime(e)}).then(function(){return s&&n.pause()}).then(function(){return s&&n.setVolume(a)}).catch(function(){})}});var d=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:function(){return d},set:function(e){t.embed.setPlaybackRate(e).then(function(){d=e,pt.call(t,t.media,"ratechange")}).catch(function(e){"Error"===e.name&&nn.setSpeedMenu.call(t,[])})}});var h=t.config.volume;Object.defineProperty(t.media,"volume",{get:function(){return h},set:function(e){t.embed.setVolume(e).then(function(){h=e,pt.call(t,t.media,"volumechange")})}});var p=t.config.muted;Object.defineProperty(t.media,"muted",{get:function(){return p},set:function(e){var n=!!ot.boolean(e)&&e;t.embed.setVolume(n?0:t.config.volume).then(function(){p=n,pt.call(t,t.media,"volumechange")})}});var m,f=t.config.loop;Object.defineProperty(t.media,"loop",{get:function(){return f},set:function(e){var n=ot.boolean(e)?e:t.config.loop.active;t.embed.setLoop(n).then(function(){f=n})}}),t.embed.getVideoUrl().then(function(e){m=e,nn.setDownloadLink.call(t)}).catch(function(t){e.debug.warn(t)}),Object.defineProperty(t.media,"currentSrc",{get:function(){return m}}),Object.defineProperty(t.media,"ended",{get:function(){return t.currentTime===t.duration}}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then(function(n){var i=He(n,2),r=i[0],a=i[1];t.embed.ratio="".concat(r,":").concat(a),bn.call(e,t.embed.ratio)}),t.embed.setAutopause(t.config.autopause).then(function(e){t.config.autopause=e}),t.embed.getVideoTitle().then(function(n){t.config.title=n,vn.setTitle.call(e)}),t.embed.getCurrentTime().then(function(e){u=e,pt.call(t,t.media,"timeupdate")}),t.embed.getDuration().then(function(e){t.media.duration=e,pt.call(t,t.media,"durationchange")}),t.embed.getTextTracks().then(function(e){t.media.textTracks=e,sn.setup.call(t)}),t.embed.on("cuechange",function(e){var n=e.cues,i=(void 0===n?[]:n).map(function(e){return t=e.text,n=document.createDocumentFragment(),i=document.createElement("div"),n.appendChild(i),i.innerHTML=t,n.firstChild.innerText;var t,n,i});sn.updateCues.call(t,i)}),t.embed.on("loaded",function(){(t.embed.getPaused().then(function(e){Tn.call(t,!e),e||pt.call(t,t.media,"playing")}),ot.element(t.embed.element)&&t.supported.ui)&&t.embed.element.setAttribute("tabindex",-1)}),t.embed.on("play",function(){Tn.call(t,!0),pt.call(t,t.media,"playing")}),t.embed.on("pause",function(){Tn.call(t,!1)}),t.embed.on("timeupdate",function(e){t.media.seeking=!1,u=e.seconds,pt.call(t,t.media,"timeupdate")}),t.embed.on("progress",function(e){t.media.buffered=e.percent,pt.call(t,t.media,"progress"),1===parseInt(e.percent,10)&&pt.call(t,t.media,"canplaythrough"),t.embed.getDuration().then(function(e){e!==t.media.duration&&(t.media.duration=e,pt.call(t,t.media,"durationchange"))})}),t.embed.on("seeked",function(){t.media.seeking=!1,pt.call(t,t.media,"seeked")}),t.embed.on("ended",function(){t.media.paused=!0,pt.call(t,t.media,"ended")}),t.embed.on("error",function(e){t.media.error=e,pt.call(t,t.media,"error")}),setTimeout(function(){return vn.build.call(t)},0)}};function Sn(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,pt.call(this,this.media,e?"play":"pause"))}var Cn,xn,An,Pn={setup:function(){var e=this;Tt(this.elements.wrapper,this.config.classNames.embed,!0),bn.call(this),ot.object(window.YT)&&ot.function(window.YT.Player)?Pn.ready.call(this):(_n(this.config.urls.youtube.sdk).catch(function(t){e.debug.warn("YouTube API failed to load",t)}),window.onYouTubeReadyCallbacks=window.onYouTubeReadyCallbacks||[],window.onYouTubeReadyCallbacks.push(function(){Pn.ready.call(e)}),window.onYouTubeIframeAPIReady=function(){window.onYouTubeReadyCallbacks.forEach(function(e){e()})})},getTitle:function(e){var t=this;if(ot.function(this.embed.getVideoData)){var n=this.embed.getVideoData().title;if(ot.empty(n))return this.config.title=n,void vn.setTitle.call(this)}var i=this.config.keys.google;ot.string(i)&&!ot.empty(i)&&Jt(Ut(this.config.urls.youtube.api,e,i)).then(function(e){ot.object(e)&&(t.config.title=e.items[0].snippet.title,vn.setTitle.call(t))}).catch(function(){})},ready:function(){var e=this,t=e.media.getAttribute("id");if(ot.empty(t)||!t.startsWith("youtube-")){var n=e.media.getAttribute("src");ot.empty(n)&&(n=e.media.getAttribute(this.config.attributes.embed.id));var i,r,a=(i=n,ot.empty(i)?null:i.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:i),s=(r=e.provider,"".concat(r,"-").concat(Math.floor(1e4*Math.random()))),o=gt("div",{id:s,poster:e.poster});e.media=kt(o,e.media);var l=function(e){return"https://img.youtube.com/vi/".concat(a,"/").concat(e,"default.jpg")};yn(l("maxres"),121).catch(function(){return yn(l("sd"),121)}).catch(function(){return yn(l("hq"))}).then(function(t){return vn.setPoster.call(e,t.src)}).then(function(t){t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(function(){});var c=e.config.youtube;e.embed=new window.YT.Player(s,{videoId:a,host:c.noCookie?"https://www.youtube-nocookie.com":void 0,playerVars:qt({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},c),events:{onError:function(t){if(!e.media.error){var n=t.data,i={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[n]||"An unknown error occured";e.media.error={code:n,message:i},pt.call(e,e.media,"error")}},onPlaybackRateChange:function(t){var n=t.target;e.media.playbackRate=n.getPlaybackRate(),pt.call(e,e.media,"ratechange")},onReady:function(t){if(!ot.function(e.media.play)){var n=t.target;Pn.getTitle.call(e,a),e.media.play=function(){Sn.call(e,!0),n.playVideo()},e.media.pause=function(){Sn.call(e,!1),n.pauseVideo()},e.media.stop=function(){n.stopVideo()},e.media.duration=n.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:function(){return Number(n.getCurrentTime())},set:function(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,pt.call(e,e.media,"seeking"),n.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:function(){return n.getPlaybackRate()},set:function(e){n.setPlaybackRate(e)}});var i=e.config.volume;Object.defineProperty(e.media,"volume",{get:function(){return i},set:function(t){i=t,n.setVolume(100*i),pt.call(e,e.media,"volumechange")}});var r=e.config.muted;Object.defineProperty(e.media,"muted",{get:function(){return r},set:function(t){var i=ot.boolean(t)?t:r;r=i,n[i?"mute":"unMute"](),pt.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:function(){return n.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get:function(){return e.currentTime===e.duration}}),e.options.speed=n.getAvailablePlaybackRates(),e.supported.ui&&e.media.setAttribute("tabindex",-1),pt.call(e,e.media,"timeupdate"),pt.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(function(){e.media.buffered=n.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&pt.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),pt.call(e,e.media,"canplaythrough"))},200),setTimeout(function(){return vn.build.call(e)},50)}},onStateChange:function(t){var n=t.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,pt.call(e,e.media,"seeked")),t.data){case-1:pt.call(e,e.media,"timeupdate"),e.media.buffered=n.getVideoLoadedFraction(),pt.call(e,e.media,"progress");break;case 0:Sn.call(e,!1),e.media.loop?(n.stopVideo(),n.playVideo()):pt.call(e,e.media,"ended");break;case 1:e.media.paused&&!e.embed.hasPlayed?e.media.pause():(Sn.call(e,!0),pt.call(e,e.media,"playing"),e.timers.playing=setInterval(function(){pt.call(e,e.media,"timeupdate")},50),e.media.duration!==n.getDuration()&&(e.media.duration=n.getDuration(),pt.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),Sn.call(e,!1)}pt.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}}},On={setup:function(){this.media?(Tt(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),Tt(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&Tt(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=gt("div",{class:this.config.classNames.video}),mt(this.media,this.elements.wrapper),this.elements.poster=gt("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Ft.extend.call(this):this.isYouTube?Pn.setup.call(this):this.isVimeo&&En.setup.call(this)):this.debug.warn("No media element found!")}},Mn=function(){function e(t){var n=this;Re(this,e),this.player=t,this.config=t.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise(function(e,t){n.on("loaded",e),n.on("error",t)}),this.load()}return Fe(e,[{key:"load",value:function(){var e=this;this.enabled&&(ot.object(window.google)&&ot.object(window.google.ima)?this.ready():_n(this.player.config.urls.googleIMA.sdk).then(function(){e.ready()}).catch(function(){e.trigger("error",new Error("Google IMA SDK failed to load"))}))}},{key:"ready",value:function(){var e=this;this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(function(){e.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}},{key:"setupIMA",value:function(){this.elements.container=gt("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.requestAds()}},{key:"requestAds",value:function(){var e=this,t=this.player.elements.container;try{this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,function(t){return e.onAdsManagerLoaded(t)},!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,function(t){return e.onAdError(t)},!1);var n=new google.ima.AdsRequest;n.adTagUrl=this.tagUrl,n.linearAdSlotWidth=t.offsetWidth,n.linearAdSlotHeight=t.offsetHeight,n.nonLinearAdSlotWidth=t.offsetWidth,n.nonLinearAdSlotHeight=t.offsetHeight,n.forceNonLinearFullSlot=!1,n.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(n)}catch(e){this.onAdError(e)}}},{key:"pollCountdown",value:function(){var e=this;if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0]))return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(function(){var t=tn(Math.max(e.manager.getRemainingTime(),0)),n="".concat($t("advertisement",e.player.config)," - ").concat(t);e.elements.container.setAttribute("data-badge-text",n)},100)}},{key:"onAdsManagerLoaded",value:function(e){var t=this;if(this.enabled){var n=new google.ima.AdsRenderingSettings;n.restoreCustomPlaybackStateOnAdBreakComplete=!0,n.enablePreloading=!0,this.manager=e.getAdsManager(this.player,n),this.cuePoints=this.manager.getCuePoints(),this.manager.setVolume(this.player.volume),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,function(e){return t.onAdError(e)}),Object.keys(google.ima.AdEvent.Type).forEach(function(e){t.manager.addEventListener(google.ima.AdEvent.Type[e],function(e){return t.onAdEvent(e)})}),this.trigger("loaded")}}},{key:"addCuePoints",value:function(){var e=this;ot.empty(this.cuePoints)||this.cuePoints.forEach(function(t){if(0!==t&&-1!==t&&t<e.player.duration){var n=e.player.elements.progress;if(ot.element(n)){var i=100/e.player.duration*t,r=gt("span",{class:e.player.config.classNames.cues});r.style.left="".concat(i.toString(),"%"),n.appendChild(r)}}})}},{key:"onAdEvent",value:function(e){var t=this,n=this.player.elements.container,i=e.getAd(),r=e.getAdData(),a=function(e){var n="ads".concat(e.replace(/_/g,"").toLowerCase());pt.call(t.player,t.player.media,n)};switch(e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),a(e.type),this.pollCountdown(!0),i.isLinear()||(i.width=n.offsetWidth,i.height=n.offsetHeight);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:a(e.type),this.loadAds();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:a(e.type),this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:a(e.type),this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.STARTED:case google.ima.AdEvent.Type.MIDPOINT:case google.ima.AdEvent.Type.COMPLETE:case google.ima.AdEvent.Type.IMPRESSION:case google.ima.AdEvent.Type.CLICK:a(e.type);break;case google.ima.AdEvent.Type.LOG:r.adError&&this.player.debug.warn("Non-fatal ad error: ".concat(r.adError.getMessage()))}}},{key:"onAdError",value:function(e){this.cancel(),this.player.debug.warn("Ads error",e)}},{key:"listeners",value:function(){var e,t=this,n=this.player.elements.container;this.player.on("canplay",function(){t.addCuePoints()}),this.player.on("ended",function(){t.loader.contentComplete()}),this.player.on("timeupdate",function(){e=t.player.currentTime}),this.player.on("seeked",function(){var n=t.player.currentTime;ot.empty(t.cuePoints)||t.cuePoints.forEach(function(i,r){e<i&&i<n&&(t.manager.discardAdBreak(),t.cuePoints.splice(r,1))})}),window.addEventListener("resize",function(){t.manager&&t.manager.resize(n.offsetWidth,n.offsetHeight,google.ima.ViewMode.NORMAL)})}},{key:"play",value:function(){var e=this,t=this.player.elements.container;this.managerPromise||this.resumeContent(),this.managerPromise.then(function(){e.elements.displayContainer.initialize();try{e.initialized||(e.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),e.manager.start()),e.initialized=!0}catch(t){e.onAdError(t)}}).catch(function(){})}},{key:"resumeContent",value:function(){this.elements.container.style.zIndex="",this.playing=!1,this.player.media.play()}},{key:"pauseContent",value:function(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}},{key:"cancel",value:function(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}},{key:"loadAds",value:function(){var e=this;this.managerPromise.then(function(){e.manager&&e.manager.destroy(),e.managerPromise=new Promise(function(t){e.on("loaded",t),e.player.debug.log(e.manager)}),e.requestAds()}).catch(function(){})}},{key:"trigger",value:function(e){for(var t=this,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var a=this.events[e];ot.array(a)&&a.forEach(function(e){ot.function(e)&&e.apply(t,i)})}},{key:"on",value:function(e,t){return ot.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}},{key:"startSafetyTimer",value:function(e,t){var n=this;this.player.debug.log("Safety timer invoked from: ".concat(t)),this.safetyTimer=setTimeout(function(){n.cancel(),n.clearSafetyTimer("startSafetyTimer()")},e)}},{key:"clearSafetyTimer",value:function(e){ot.nullOrUndefined(this.safetyTimer)||(this.player.debug.log("Safety timer cleared from: ".concat(e)),clearTimeout(this.safetyTimer),this.safetyTimer=null)}},{key:"enabled",get:function(){var e=this.config;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!ot.empty(e.publisherId)||ot.url(e.tagUrl))}},{key:"tagUrl",get:function(){var e=this.config;if(ot.url(e.tagUrl))return e.tagUrl;var t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:this.publisherId};return"".concat("https://go.aniview.com/api/adserver6/vast/","?").concat(an(t))}}]),e}(),Nn=function(){function e(t){Re(this,e),this.player=t,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}return Fe(e,[{key:"load",value:function(){var e=this;this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(function(){e.render(),e.determineContainerAutoSizing(),e.loaded=!0})}},{key:"getThumbnails",value:function(){var e=this;return new Promise(function(t){var n=e.player.config.previewThumbnails.src;if(ot.empty(n))throw new Error("Missing previewThumbnails.src config attribute");var i=(ot.string(n)?[n]:n).map(function(t){return e.getThumbnail(t)});Promise.all(i).then(function(){e.thumbnails.sort(function(e,t){return e.height-t.height}),e.player.debug.log("Preview thumbnails",e.thumbnails),t()})})}},{key:"getThumbnail",value:function(e){var t=this;return new Promise(function(n){Jt(e).then(function(i){var r,a,s={frames:(r=i,a=[],r.split(/\r\n\r\n|\n\n|\r\r/).forEach(function(e){var t={};e.split(/\r\n|\n|\r/).forEach(function(e){if(ot.number(t.startTime)){if(!ot.empty(e.trim())&&ot.empty(t.text)){var n=e.trim().split("#xywh="),i=He(n,1);if(t.text=i[0],n[1]){var r=He(n[1].split(","),4);t.x=r[0],t.y=r[1],t.w=r[2],t.h=r[3]}}}else{var a=e.match(/([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);a&&(t.startTime=60*Number(a[1])*60+60*Number(a[2])+Number(a[3])+Number("0.".concat(a[4])),t.endTime=60*Number(a[6])*60+60*Number(a[7])+Number(a[8])+Number("0.".concat(a[9])))}}),t.text&&a.push(t)}),a),height:null,urlPrefix:""};s.frames[0].text.startsWith("/")||(s.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));var o=new Image;o.onload=function(){s.height=o.naturalHeight,s.width=o.naturalWidth,t.thumbnails.push(s),n()},o.src=s.urlPrefix+s.frames[0].text})})}},{key:"startMove",value:function(e){if(this.loaded&&ot.event(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t=this.player.elements.progress.getBoundingClientRect(),n=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=tn(this.seekTime)}this.showImageAtCurrentTime()}}},{key:"endMove",value:function(){this.toggleThumbContainer(!1,!0)}},{key:"startScrubbing",value:function(e){!1!==e.button&&0!==e.button||(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}},{key:"endScrubbing",value:function(){var e=this;this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):ht.call(this.player,this.player.media,"timeupdate",function(){e.mouseDown||e.toggleScrubbingContainer(!1)})}},{key:"listeners",value:function(){var e=this;this.player.on("play",function(){e.toggleThumbContainer(!1,!0)}),this.player.on("seeked",function(){e.toggleThumbContainer(!1)}),this.player.on("timeupdate",function(){e.lastTime=e.player.media.currentTime})}},{key:"render",value:function(){this.elements.thumb.container=gt("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=gt("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);var e=gt("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=gt("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=gt("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}},{key:"showImageAtCurrentTime",value:function(){var e=this;this.mouseDown?this.setScrubbingContainerSize():(this.toggleThumbContainer(!0),this.setThumbContainerSizeAndPos());var t=this.thumbnails[0].frames.findIndex(function(t){return e.seekTime>=t.startTime&&e.seekTime<=t.endTime}),n=t>=0,i=0;this.toggleThumbContainer(n),n&&(this.thumbnails.forEach(function(n,r){e.loadedImages.includes(n.frames[t].text)&&(i=r)}),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(i)))}},{key:"loadImage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=this.showingThumb,i=this.thumbnails[t],r=i.urlPrefix,a=i.frames[n],s=i.frames[n].text,o=r+s;if(this.currentImageElement&&this.currentImageElement.dataset.filename===s)this.showImage(this.currentImageElement,a,t,n,s,!1),this.currentImageElement.dataset.index=n,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);var l=new Image;l.src=o,l.dataset.index=n,l.dataset.filename=s,this.showingThumbFilename=s,this.player.debug.log("Loading image: ".concat(o)),l.onload=function(){return e.showImage(l,a,t,n,s,!0)},this.loadingImage=l,this.removeOldImages(l)}}},{key:"showImage",value:function(e,t,n,i,r){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];this.player.debug.log("Showing thumb: ".concat(r,". num: ").concat(i,". qual: ").concat(n,". newimg: ").concat(a)),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(r)||this.loadedImages.push(r)),this.preloadNearby(i,!0).then(this.preloadNearby(i,!1)).then(this.getHigherQuality(n,e,t,r))}},{key:"removeOldImages",value:function(e){var t=this;Array.from(this.currentImageContainer.children).forEach(function(n){if("img"===n.tagName.toLowerCase()){var i=t.usingSprites?500:1e3;if(n.dataset.index!==e.dataset.index&&!n.dataset.deleting){n.dataset.deleting=!0;var r=t.currentImageContainer;setTimeout(function(){r.removeChild(n),t.player.debug.log("Removing thumb: ".concat(n.dataset.filename))},i)}}})}},{key:"preloadNearby",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new Promise(function(i){setTimeout(function(){var r=t.thumbnails[0].frames[e].text;if(t.showingThumbFilename===r){var a;a=n?t.thumbnails[0].frames.slice(e):t.thumbnails[0].frames.slice(0,e).reverse();var s=!1;a.forEach(function(e){var n=e.text;if(n!==r&&!t.loadedImages.includes(n)){s=!0,t.player.debug.log("Preloading thumb filename: ".concat(n));var a=t.thumbnails[0].urlPrefix+n,o=new Image;o.src=a,o.onload=function(){t.player.debug.log("Preloaded thumb filename: ".concat(n)),t.loadedImages.includes(n)||t.loadedImages.push(n),i()}}}),s||i()}},300)})}},{key:"getHigherQuality",value:function(e,t,n,i){var r=this;if(e<this.thumbnails.length-1){var a=t.naturalHeight;this.usingSprites&&(a=n.h),a<this.thumbContainerHeight&&setTimeout(function(){r.showingThumbFilename===i&&(r.player.debug.log("Showing higher quality thumb for: ".concat(i)),r.loadImage(e+1))},300)}}},{key:"toggleThumbContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(n,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"toggleScrubbingContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"determineContainerAutoSizing",value:function(){this.elements.thumb.imageContainer.clientHeight>20&&(this.sizeSpecifiedInCSS=!0)}},{key:"setThumbContainerSizeAndPos",value:function(){if(!this.sizeSpecifiedInCSS){var e=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(this.thumbContainerHeight,"px"),this.elements.thumb.imageContainer.style.width="".concat(e,"px")}this.setThumbContainerPos()}},{key:"setThumbContainerPos",value:function(){var e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),n=this.elements.thumb.container,i=t.left-e.left+10,r=t.right-e.left-n.clientWidth-10,a=this.mousePosX-e.left-n.clientWidth/2;a<i&&(a=i),a>r&&(a=r),n.style.left="".concat(a,"px")}},{key:"setScrubbingContainerSize",value:function(){this.elements.scrubbing.container.style.width="".concat(this.player.media.clientWidth,"px"),this.elements.scrubbing.container.style.height="".concat(this.player.media.clientWidth/this.thumbAspectRatio,"px")}},{key:"setImageSizeAndOffset",value:function(e,t){if(this.usingSprites){var n=this.thumbContainerHeight/t.h;e.style.height="".concat(Math.floor(e.naturalHeight*n),"px"),e.style.width="".concat(Math.floor(e.naturalWidth*n),"px"),e.style.left="-".concat(t.x*n,"px"),e.style.top="-".concat(t.y*n,"px")}}},{key:"enabled",get:function(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}},{key:"currentImageContainer",get:function(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}},{key:"usingSprites",get:function(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}},{key:"thumbAspectRatio",get:function(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}},{key:"thumbContainerHeight",get:function(){return this.mouseDown?Math.floor(this.player.media.clientWidth/this.thumbAspectRatio):Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}},{key:"currentImageElement",get:function(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement},set:function(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}]),e}(),Ln={insertElements:function(e,t){var n=this;ot.string(t)?yt(e,this.media,{src:t}):ot.array(t)&&t.forEach(function(t){yt(e,n.media,t)})},change:function(e){var t=this;Ht(e,"sources.length")?(Ft.cancelRequests.call(this),this.destroy.call(this,function(){t.options.quality=[],vt(t.media),t.media=null,ot.element(t.elements.container)&&t.elements.container.removeAttribute("class");var n=e.sources,i=e.type,r=He(n,1)[0],a=r.provider,s=void 0===a?un.html5:a,o=r.src,l="html5"===s?i:"div",c="html5"===s?{}:{src:o};Object.assign(t,{provider:s,type:i,supported:Dt.check(i,s,t.config.playsinline),media:gt(l,c)}),t.elements.container.appendChild(t.media),ot.boolean(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),ot.empty(e.poster)||(t.poster=e.poster),t.config.loop.active&&t.media.setAttribute("loop",""),t.config.muted&&t.media.setAttribute("muted",""),t.config.playsinline&&t.media.setAttribute("playsinline","")),vn.addStyleHook.call(t),t.isHTML5&&Ln.insertElements.call(t,"source",n),t.config.title=e.title,On.setup.call(t),t.isHTML5&&Object.keys(e).includes("tracks")&&Ln.insertElements.call(t,"track",e.tracks),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&vn.build.call(t),t.isHTML5&&t.media.load(),t.previewThumbnails&&t.previewThumbnails.load(),t.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}},In=function(){function e(t,n){var i=this;if(Re(this,e),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=Dt.touch,this.media=t,ot.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||ot.nodeList(this.media)||ot.array(this.media))&&(this.media=this.media[0]),this.config=qt({},on,e.defaults,n||{},function(){try{return JSON.parse(i.media.getAttribute("data-plyr-config"))}catch(e){return{}}}()),this.elements={container:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new pn(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",Dt),!ot.nullOrUndefined(this.media)&&ot.element(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(Dt.check().api){var r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;var a=this.media.tagName.toLowerCase(),s=null,o=null;switch(a){case"div":if(s=this.media.querySelector("iframe"),ot.element(s)){if(o=rn(s.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?un.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?un.vimeo:null}(o.toString()),this.elements.container=this.media,this.media=s,this.elements.container.className="",o.search.length){var l=["1","true"];l.includes(o.searchParams.get("autoplay"))&&(this.config.autoplay=!0),l.includes(o.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=l.includes(o.searchParams.get("playsinline")),this.config.youtube.hl=o.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(ot.empty(this.provider)||!Object.keys(un).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=dn.video;break;case"video":case"audio":this.type=a,this.provider=un.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=Dt.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new kn(this),this.storage=new Yt(this),this.media.plyr=this,ot.element(this.elements.container)||(this.elements.container=gt("div",{tabindex:0}),mt(this.media,this.elements.container)),vn.addStyleHook.call(this),On.setup.call(this),this.config.debug&&ut.call(this,this.elements.container,this.config.events.join(" "),function(e){i.debug.log("event: ".concat(e.type))}),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&vn.build.call(this),this.listeners.container(),this.listeners.global(),this.fullscreen=new gn(this),this.config.ads.enabled&&(this.ads=new Mn(this)),this.config.autoplay&&this.play(),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Nn(this))):this.debug.error("Setup failed: no support")}else this.debug.error("Setup failed: no support");else this.debug.error("Setup failed: disabled by config");else this.debug.error("Setup failed: no suitable element passed")}return Fe(e,[{key:"play",value:function(){var e=this;return ot.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(function(){return e.ads.play()}).catch(function(){return e.media.play()}),this.media.play()):null}},{key:"pause",value:function(){this.playing&&ot.function(this.media.pause)&&this.media.pause()}},{key:"togglePlay",value:function(e){(ot.boolean(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):ot.function(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime=this.currentTime-(ot.number(e)?e:this.config.seekTime)}},{key:"forward",value:function(e){this.currentTime=this.currentTime+(ot.number(e)?e:this.config.seekTime)}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(ot.number(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleCaptions",value:function(e){sn.toggle.call(this,e,!1)}},{key:"airplay",value:function(){Dt.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=Et(this.elements.container,this.config.classNames.hideControls),n=void 0===e?void 0:!e,i=Tt(this.elements.container,this.config.classNames.hideControls,n);if(i&&this.config.controls.includes("settings")&&!ot.empty(this.config.settings)&&nn.toggleMenu.call(this,!1),i!==t){var r=i?"controlshidden":"controlsshown";pt.call(this,this.media,r)}return!i}return!1}},{key:"on",value:function(e,t){ut.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){ht.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){dt(this.elements.container,e,t)}},{key:"destroy",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ready){var i=function(){document.body.style.overflow="",t.embed=null,n?(Object.keys(t.elements).length&&(vt(t.elements.buttons.play),vt(t.elements.captions),vt(t.elements.controls),vt(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),ot.function(e)&&e()):(function(){this&&this.eventListeners&&(this.eventListeners.forEach(function(e){var t=e.element,n=e.type,i=e.callback,r=e.options;t.removeEventListener(n,i,r)}),this.eventListeners=[])}.call(t),kt(t.elements.original,t.elements.container),pt.call(t,t.elements.original,"destroyed",!0),ot.function(e)&&e.call(t.elements.original),t.ready=!1,setTimeout(function(){t.elements=null,t.media=null},200))};this.stop(),this.isHTML5?(clearTimeout(this.timers.loading),vn.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&ot.function(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))}}},{key:"supports",value:function(e){return Dt.mime.call(this,e)}},{key:"isHTML5",get:function(){return Boolean(this.provider===un.html5)}},{key:"isEmbed",get:function(){return Boolean(this.isYouTube||this.isVimeo)}},{key:"isYouTube",get:function(){return Boolean(this.provider===un.youtube)}},{key:"isVimeo",get:function(){return Boolean(this.provider===un.vimeo)}},{key:"isVideo",get:function(){return Boolean(this.type===dn.video)}},{key:"isAudio",get:function(){return Boolean(this.type===dn.audio)}},{key:"playing",get:function(){return Boolean(this.ready&&!this.paused&&!this.ended)}},{key:"paused",get:function(){return Boolean(this.media.paused)}},{key:"stopped",get:function(){return Boolean(this.paused&&0===this.currentTime)}},{key:"ended",get:function(){return Boolean(this.media.ended)}},{key:"currentTime",set:function(e){if(this.duration){var t=ot.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log("Seeking to ".concat(this.currentTime," seconds"))}},get:function(){return Number(this.media.currentTime)}},{key:"buffered",get:function(){var e=this.media.buffered;return ot.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}},{key:"seeking",get:function(){return Boolean(this.media.seeking)}},{key:"duration",get:function(){var e=parseFloat(this.config.duration),t=(this.media||{}).duration,n=ot.number(t)&&t!==1/0?t:0;return e||n}},{key:"volume",set:function(e){var t=e;ot.string(t)&&(t=Number(t)),ot.number(t)||(t=this.storage.get("volume")),ot.number(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!ot.empty(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;ot.boolean(t)||(t=this.storage.get("muted")),ot.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t},get:function(){return Boolean(this.media.muted)}},{key:"hasAudio",get:function(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}},{key:"speed",set:function(e){var t=null;ot.number(e)&&(t=e),ot.number(t)||(t=this.storage.get("speed")),ot.number(t)||(t=this.config.speed.selected),t<.1&&(t=.1),t>2&&(t=2),this.config.speed.options.includes(t)?(this.config.speed.selected=t,this.media.playbackRate=t):this.debug.warn("Unsupported speed (".concat(t,")"))},get:function(){return Number(this.media.playbackRate)}},{key:"quality",set:function(e){var t=this.config.quality,n=this.options.quality;if(n.length){var i=[!ot.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(ot.number),r=!0;if(!n.includes(i)){var a=function(e,t){return ot.array(e)&&e.length?e.reduce(function(e,n){return Math.abs(n-t)<Math.abs(e-t)?n:e}):null}(n,i);this.debug.warn("Unsupported quality option: ".concat(i,", using ").concat(a," instead")),i=a,r=!1}t.selected=i,this.media.quality=i,r&&this.storage.set({quality:i})}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=ot.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t},get:function(){return Boolean(this.media.loop)}},{key:"source",set:function(e){Ln.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"download",get:function(){var e=this.config.urls.download;return ot.url(e)?e:this.source}},{key:"poster",set:function(e){this.isVideo?vn.setPoster.call(this,e,!1).catch(function(){}):this.debug.warn("Poster can only be set for video")},get:function(){return this.isVideo?this.media.getAttribute("poster"):null}},{key:"autoplay",set:function(e){var t=ot.boolean(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){sn.set.call(this,e,!1)},get:function(){var e=this.captions,t=e.toggled,n=e.currentTrack;return t?n:-1}},{key:"language",set:function(e){sn.setLanguage.call(this,e,!1)},get:function(){return(sn.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){if(Dt.pip){var t=ot.boolean(e)?e:!this.pip;ot.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?ln:cn),ot.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}},get:function(){return Dt.pip?ot.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===ln:null}}],[{key:"supported",value:function(e,t,n){return Dt.check(e,t,n)}},{key:"loadSprite",value:function(e,t){return Gt(e,t)}},{key:"setup",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null;return ot.string(t)?i=Array.from(document.querySelectorAll(t)):ot.nodeList(t)?i=Array.from(t):ot.array(t)&&(i=t.filter(ot.element)),ot.empty(i)?null:i.map(function(t){return new e(t,n)})}}]),e}();In.defaults=(Cn=on,JSON.parse(JSON.stringify(Cn))),xn=window.location.host,An="plyr.io"===xn,document.addEventListener("DOMContentLoaded",function(){Ie.context(function(){var e=document.getElementById("container");window.Shr&&window.Shr.setup(".js-shr-button",{count:{classname:"button__count"}}),document.addEventListener("focusout",function(t){t.target.classList&&!e.contains(t.target)&&t.target.classList.remove("tab-focus")}),document.addEventListener("keydown",function(t){9===t.keyCode&&setTimeout(function(){var t=document.activeElement;t&&t.classList&&!e.contains(t)&&t.classList.add("tab-focus")},10)});var t="https://pubads.g.doubleclick.net/gampad/live/ads?sz=640x360&iu=/21736521837/ovo/web&impl=s&gdfp_req=1&env=vp&output=vast&cust_params=usergroup%3D".concat("annon","%26content-type%3D").concat("on-demand","&cmsid=").concat(2490180,"&vid=").concat(3788),n=new In("#player",{debug:!0,title:"View From A Blue Moon",iconUrl:"dist/plyr.svg",keyboard:{global:!0},tooltips:{controls:!0},captions:{active:!0},keys:{google:"AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c"},ads:{enabled:!0,tagUrl:t},previewThumbnails:{enabled:!0,src:["https://cdn.plyr.io/static/demo/thumbs/100p.vtt","https://cdn.plyr.io/static/demo/thumbs/240p.vtt"]}});window.player=n;var i=document.querySelectorAll("[data-source]"),r={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},a=window.location.hash.replace("#",""),s=window.history&&window.history.pushState;function o(e,t,n){e&&e.classList[n?"add":"remove"](t)}function l(e,t){if(e in r&&(t||e!==a)&&(a.length||e!==r.video)){switch(e){case r.video:n.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4",type:"video/mp4",size:576},{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4",type:"video/mp4",size:720},{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1080p.mp4",type:"video/mp4",size:1080},{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1440p.mp4",type:"video/mp4",size:1440}],poster:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0},{kind:"captions",label:"French",srclang:"fr",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt"}]};break;case r.audio:n.source={type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",sources:[{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]};break;case r.youtube:n.source={type:"video",sources:[{src:"https://youtube.com/watch?v=bTqVqk7FSmY",provider:"youtube"}]};break;case r.vimeo:n.source={type:"video",sources:[{src:"https://vimeo.com/76979871",provider:"vimeo"}]}}a=e,Array.from(i).forEach(function(e){return o(e.parentElement,"active",!1)}),o(document.querySelector('[data-source="'.concat(e,'"]')),"active",!0),Array.from(document.querySelectorAll(".plyr__cite")).forEach(function(e){e.setAttribute("hidden","")}),document.querySelector(".plyr__cite--".concat(e)).removeAttribute("hidden")}}if(Array.from(i).forEach(function(e){e.addEventListener("click",function(){var t=e.getAttribute("data-source");l(t),s&&window.history.pushState({type:t},"","#".concat(t))})}),window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&l(e.state.type)}),s){var c=!a.length;c&&(a=r.video),a in r&&window.history.replaceState({type:a},"",c?"":"#".concat(a)),a!==r.video&&l(a,!0)}})}),An&&Ie.config("https://d4ad9866ad834437a4754e23937071e4@sentry.io/305555").install()}();
|
|
//# sourceMappingURL=demo.min.js.map
|