!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.videojs=e()}(this,function(){function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t,e){fe(t).foreach(function(n){return e(t[n],n)})}function n(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return fe(t).reduce(function(n,r){return e(n,t[r],r)},n)}function r(t){for(var n=arguments.length,r=array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3],i=ce.createelement(t);return object.getownpropertynames(e).foreach(function(t){var n=e[t];-1!==t.indexof("aria-")||"role"===t||"type"===t?(ze.warn(xe(qe,t,n)),i.setattribute(t,n)):"textcontent"===t?v(i,n):i[t]=n}),object.getownpropertynames(n).foreach(function(t){i.setattribute(t,n[t])}),r&&i(i,r),i}function v(t,e){return void 0===t.textcontent?t.innertext=e:t.textcontent=e,t}function y(t,e){e.firstchild?e.insertbefore(t,e.firstchild):e.appendchild(t)}function g(t,e){return c(e),t.classlist?t.classlist.contains(e):u(e).test(t.classname)}function m(t,e){return t.classlist?t.classlist.add(e):g(t,e)||(t.classname=(t.classname+" "+e).trim()),t}function _(t,e){return t.classlist?t.classlist.remove(e):(c(e),t.classname=t.classname.split(/\s+/).filter(function(t){return t!==e}).join(" ")),t}function b(t,e,n){var r=g(t,e);if("function"==typeof n&&(n=n(t,e)),"boolean"!=typeof n&&(n=!r),n!==r)return n?m(t,e):_(t,e),t}function t(t,e){object.getownpropertynames(e).foreach(function(n){var r=e[n];null===r||void 0===r||!1===r?t.removeattribute(n):t.setattribute(n,!0===r?"":r)})}function c(t){var e={};if(t&&t.attributes&&t.attributes.length>0)for(var n=t.attributes,r=n.length-1;r>=0;r--){var i=n[r].name,o=n[r].value;"boolean"!=typeof t[i]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultmuted,".indexof(","+i+",")||(o=null!==o),e[i]=o}return e}function k(t,e){return t.getattribute(e)}function w(t,e,n){t.setattribute(e,n)}function e(t,e){t.removeattribute(e)}function s(){ce.body.focus(),ce.onselectstart=function(){return!1}}function x(){ce.onselectstart=function(){return!0}}function j(t){if(t&&t.getboundingclientrect&&t.parentnode){var e=t.getboundingclientrect(),n={};return["bottom","height","left","right","top","width"].foreach(function(t){void 0!==e[t]&&(n[t]=e[t])}),n.height||(n.height=parsefloat(a(t,"height"))),n.width||(n.width=parsefloat(a(t,"width"))),n}}function a(t){var e=void 0;if(t.getboundingclientrect&&t.parentnode&&(e=t.getboundingclientrect()),!e)return{left:0,top:0};var n=ce.documentelement,r=ce.body,i=n.clientleft||r.clientleft||0,o=ie.pagexoffset||r.scrollleft,s=e.left+o-i,a=n.clienttop||r.clienttop||0,l=ie.pageyoffset||r.scrolltop,c=e.top+l-a;return{left:math.round(s),top:math.round(c)}}function p(t,e){var n={},r=a(t),i=t.offsetwidth,o=t.offsetheight,s=r.top,a=r.left,l=e.pagey,c=e.pagex;return e.changedtouches&&(c=e.changedtouches[0].pagex,l=e.changedtouches[0].pagey),n.y=math.max(0,math.min(1,(s-l+o)/o)),n.x=math.max(0,math.min(1,(c-a)/i)),n}function n(t){return i(t)&&3===t.nodetype}function o(t){for(;t.firstchild;)t.removechild(t.firstchild);return t}function m(t){return"function"==typeof t&&(t=t()),(array.isarray(t)?t:[t]).map(function(t){return"function"==typeof t&&(t=t()),p(t)||n(t)?t:"string"==typeof t&&/\s/.test(t)?ce.createtextnode(t):void 0}).filter(function(t){return t})}function i(t,e){return m(e).foreach(function(e){return t.appendchild(e)}),t}function d(t,e){return i(o(t),e)}function l(){return $e++}function r(t){var e=t[qe];return e||(e=t[qe]=l()),je[e]||(je[e]={}),je[e]}function b(t){var e=t[qe];return!!e&&!!object.getownpropertynames(je[e]).length}function f(t){var e=t[qe];if(e){delete je[e];try{delete t[qe]}catch(e){t.removeattribute?t.removeattribute(qe):t[qe]=null}}}function v(t,e){var n=r(t);0===n.handlers[e].length&&(delete n.handlers[e],t.removeeventlistener?t.removeeventlistener(e,n.dispatcher,!1):t.detachevent&&t.detachevent("on"+e,n.dispatcher)),object.getownpropertynames(n.handlers).length<=0&&(delete n.handlers,delete n.dispatcher,delete n.disabled),0===object.getownpropertynames(n).length&&f(t)}function h(t,e,n,r){n.foreach(function(n){t(e,n,r)})}function w(t){function e(){return!0}function n(){return!1}if(!t||!t.ispropagationstopped){var r=t||ie.event;t={};for(var i in r)"layerx"!==i&&"layery"!==i&&"keylocation"!==i&&"webkitmovementx"!==i&&"webkitmovementy"!==i&&("returnvalue"===i&&r.preventdefault||(t[i]=r[i]));if(t.target||(t.target=t.srcelement||ce),t.relatedtarget||(t.relatedtarget=t.fromelement===t.target?t.toelement:t.fromelement),t.preventdefault=function(){r.preventdefault&&r.preventdefault(),t.returnvalue=!1,r.returnvalue=!1,t.defaultprevented=!0},t.defaultprevented=!1,t.stoppropagation=function(){r.stoppropagation&&r.stoppropagation(),t.cancelbubble=!0,r.cancelbubble=!0,t.ispropagationstopped=e},t.ispropagationstopped=n,t.stopimmediatepropagation=function(){r.stopimmediatepropagation&&r.stopimmediatepropagation(),t.isimmediatepropagationstopped=e,t.stoppropagation()},t.isimmediatepropagationstopped=n,null!==t.clientx&&void 0!==t.clientx){var o=ce.documentelement,s=ce.body;t.pagex=t.clientx+(o&&o.scrollleft||s&&s.scrollleft||0)-(o&&o.clientleft||s&&s.clientleft||0),t.pagey=t.clienty+(o&&o.scrolltop||s&&s.scrolltop||0)-(o&&o.clienttop||s&&s.clienttop||0)}t.which=t.charcode||t.keycode,null!==t.button&&void 0!==t.button&&(t.button=1&t.button?0:4&t.button?1:2&t.button?2:0)}return t}function u(t,e,n){if(array.isarray(e))return h(u,t,e,n);var r=r(t);if(r.handlers||(r.handlers={}),r.handlers[e]||(r.handlers[e]=[]),n.guid||(n.guid=l()),r.handlers[e].push(n),r.dispatcher||(r.disabled=!1,r.dispatcher=function(e,n){if(!r.disabled){e=w(e);var i=r.handlers[e.type];if(i)for(var o=i.slice(0),s=0,a=o.length;s-1&&(i={passive:!0}),t.addeventlistener(e,r.dispatcher,i)}else t.attachevent&&t.attachevent("on"+e,r.dispatcher)}function z(t,e,n){if(b(t)){var r=r(t);if(r.handlers){if(array.isarray(e))return h(z,t,e,n);var i=function(e){r.handlers[e]=[],v(t,e)};if(e){var o=r.handlers[e];if(o){if(!n)return void i(e);if(n.guid)for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:{},n=e.eventbuskey;if(n){if(!t[n].nodename)throw new error('the eventbuskey "'+n+'" does not refer to an element.');t.eventbusel_=t[n]}else t.eventbusel_=f("span",{classname:"vjs-event-bus"});return r(t,mn),t.on("dispose",function(){return t.off()}),t}function g(t,e){return r(t,_n),t.state=r({},t.state,e),"function"==typeof t.handlestatechanged&&hn(t)&&t.on("statechanged",t.handlestatechanged),t}function $(t){return"string"!=typeof t?t:t.charat(0).touppercase()+t.slice(1)}function j(t,e){return $(t)===$(e)}function q(){for(var t={},n=arguments.length,r=array(n),i=0;in)throw new error("failed to execute '"+t+"' on 'timeranges': the index provided ("+e+") is non-numeric or out of bounds (0-"+n+").")}function tt(t,e,n,r){return z(t,r,n.length-1),n[r][e]}function et(t){return void 0===t||0===t.length?{length:0,start:function(){throw new error("this timeranges object is empty")},end:function(){throw new error("this timeranges object is empty")}}:{length:t.length,start:tt.bind(null,"start",0,t),end:tt.bind(null,"end",1,t)}}function nt(t,e){return array.isarray(t)?et(t):void 0===t||void 0===e?et():et([[t,e]])}function rt(t,e){var n=0,r=void 0,i=void 0;if(!e)return 0;t&&t.length||(t=nt(0,0));for(var o=0;oe&&(i=e),n+=i-r;return n/e}function it(t){if(t instanceof it)return t;"number"==typeof t?this.code=t:"string"==typeof t?this.message=t:i(t)&&("number"==typeof t.code&&(this.code=t.code),r(this,t)),this.message||(this.message=it.defaultmessages[this.code]||"")}function ot(t,e){var n,r=null;try{n=json.parse(t,e)}catch(t){r=t}return[r,n]}function st(t){var e=er.call(t);return"[object function]"===e||"function"==typeof t&&"[object regexp]"!==e||"undefined"!=typeof window&&(t===window.settimeout||t===window.alert||t===window.confirm||t===window.prompt)}function at(t,e,n){if(!tr(e))throw new typeerror("iterator must be a function");arguments.length<3&&(n=this),"[object array]"===ir.call(t)?lt(t,e,n):"string"==typeof t?ct(t,e,n):ut(t,e,n)}function lt(t,e,n){for(var r=0,i=t.length;r0&&(u=settimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new error("xmlhttprequest timeout");t.code="etimedout",r(t)}},t.timeout)),a.setrequestheader)for(l in f)f.hasownproperty(l)&&a.setrequestheader(l,f[l]);else if(t.headers&&!pt(t.headers))throw new error("headers cannot be set on an xdomainrequest object");return"responsetype"in t&&(a.responsetype=t.responsetype),"beforesend"in t&&"function"==typeof t.beforesend&&t.beforesend(a),a.send(d||null),a}function yt(t){if("document"===t.responsetype)return t.responsexml;var e=t.responsexml&&"parsererror"===t.responsexml.documentelement.nodename;return""!==t.responsetype||e?null:t.responsexml}function gt(){}function mt(t,e){this.name="parsingerror",this.code=t.code,this.message=e||t.message}function _t(t){function e(t,e,n,r){return 3600*(0|t)+60*(0|e)+(0|n)+(0|r)/1e3}var n=t.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return n?n[3]?e(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?e(n[1],n[2],0,n[4]):e(0,n[1],n[2],n[4]):null}function bt(){this.values=cr(null)}function tt(t,e,n,r){var i=r?t.split(r):[t];for(var o in i)if("string"==typeof i[o]){var s=i[o].split(n);if(2===s.length){var a=s[0],l=s[1];e(a,l)}}}function ct(t,e,n){function r(){var e=_t(t);if(null===e)throw new mt(mt.errors.badtimestamp,"malformed timestamp: "+o);return t=t.replace(/^[^\sa-za-z-]+/,""),e}function i(){t=t.replace(/^\s+/,"")}var o=t;if(i(),e.starttime=r(),i(),"--\x3e"!==t.substr(0,3))throw new mt(mt.errors.badtimestamp,"malformed time stamp (time stamps must be separated by '--\x3e'): "+o);t=t.substr(3),i(),e.endtime=r(),i(),function(t,e){var r=new bt;tt(t,function(t,e){switch(t){case"region":for(var i=n.length-1;i>=0;i--)if(n[i].id===e){r.set(t,n[i].region);break}break;case"vertical":r.alt(t,e,["rl","lr"]);break;case"line":var o=e.split(","),s=o[0];r.integer(t,s),r.percent(t,s)&&r.set("snaptolines",!1),r.alt(t,s,["auto"]),2===o.length&&r.alt("linealign",o[1],["start","middle","end"]);break;case"position":o=e.split(","),r.percent(t,o[0]),2===o.length&&r.alt("positionalign",o[1],["start","middle","end"]);break;case"size":r.percent(t,e);break;case"align":r.alt(t,e,["start","middle","end","left","right"])}},/:/,/\s/),e.region=r.get("region",null),e.vertical=r.get("vertical",""),e.line=r.get("line","auto"),e.linealign=r.get("linealign","start"),e.snaptolines=r.get("snaptolines",!0),e.size=r.get("size",100),e.align=r.get("align","middle"),e.position=r.get("position",{start:0,left:0,middle:50,end:100,right:100},e.align),e.positionalign=r.get("positionalign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},e.align)}(t,e)}function kt(t,e){function n(t){return kr[t]}for(var r,i=t.document.createelement("div"),o=i,s=[];null!==(r=function(){if(!e)return null;var t=e.match(/^([^<]*)(<[^>]+>?)?/);return function(t){return e=e.substr(t.length),t}(t[1]?t[1]:t[2])}());)if("<"!==r[0])o.appendchild(t.document.createtextnode(function(t){for(;c=t.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)t=t.replace(c[0],n);return t}(r)));else{if("/"===r[1]){s.length&&s[s.length-1]===r.substr(2).replace(">","")&&(s.pop(),o=o.parentnode);continue}var a,l=_t(r.substr(1,r.length-2));if(l){a=t.document.createprocessinginstruction("timestamp",l),o.appendchild(a);continue}var c=r.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!c)continue;if(!(a=function(e,n){var r=wr[e];if(!r)return null;var i=t.document.createelement(r);i.localname=r;var o=er[e];return o&&n&&(i[o]=n.trim()),i}(c[1],c[3])))continue;if(!function(t,e){return!sr[e.localname]||sr[e.localname]===t.localname}(o,a))continue;c[2]&&(a.classname=c[2].substr(1).replace("."," ")),s.push(c[1]),o.appendchild(a),o=a}return i}function wt(t){for(var e=0;e=n[0]&&t<=n[1])return!0}return!1}function et(t){function e(t,e){for(var n=e.childnodes.length-1;n>=0;n--)t.push(e.childnodes[n])}function n(t){if(!t||!t.length)return null;var r=t.pop(),i=r.textcontent||r.innertext;if(i){var o=i.match(/^.*(\n|\r)/);return o?(t.length=0,o[0]):i}return"ruby"===r.tagname?n(t):r.childnodes?(e(t,r),n(t)):void 0}var r,i=[],o="";if(!t||!t.childnodes)return"ltr";for(e(i,t);o=n(i);)for(var s=0;s=0&&t.line<=100))return t.line;if(!t.track||!t.track.texttracklist||!t.track.texttracklist.mediaelement)return-1;for(var e=t.track,n=e.texttracklist,r=0,i=0;ih&&(u=u<0?-1:1,u*=math.ceil(h/c)*c),s<0&&(u+=""===o.vertical?n.height:n.width,a=a.reverse()),i.move(p,u)}else{var d=i.lineheight/n.height*100;switch(o.linealign){case"middle":s-=d/2;break;case"end":s-=d}switch(o.vertical){case"":e.applystyles({top:e.formatstyle(s,"%")});break;case"rl":e.applystyles({left:e.formatstyle(s,"%")});break;case"lr":e.applystyles({right:e.formatstyle(s,"%")})}a=["+y","-x","+x","-y"],i=new at(e)}var f=function(t,e){for(var i,o=new at(t),s=1,a=0;al&&(i=new at(t),s=l),t=new at(o)}return i||o}(i,a);e.move(f.tocsscompatvalues(n))}function nt(){}function ot(t){return"string"==typeof t&&(!!pr[t.tolowercase()]&&t.tolowercase())}function mt(t){return"string"==typeof t&&(!!nr[t.tolowercase()]&&t.tolowercase())}function it(t){for(var e=1;e100)throw new error("position must be between 0 and 100.");y=t,this.hasbeenreset=!0}})),object.defineproperty(r,"positionalign",it({},o,{get:function(){return g},set:function(t){var e=mt(t);if(!e)throw new syntaxerror("an invalid or illegal string was specified.");g=e,this.hasbeenreset=!0}})),object.defineproperty(r,"size",it({},o,{get:function(){return m},set:function(t){if(t<0||t>100)throw new error("size must be between 0 and 100.");m=t,this.hasbeenreset=!0}})),object.defineproperty(r,"align",it({},o,{get:function(){return _},set:function(t){var e=mt(t);if(!e)throw new syntaxerror("an invalid or illegal string was specified.");_=e,this.hasbeenreset=!0}})),r.displaystate=void 0,i)return r}function lt(t){return"string"==typeof t&&(!!mr[t.tolowercase()]&&t.tolowercase())}function rt(t){return"number"==typeof t&&t>=0&&t<=100}function bt(){var t=100,e=3,n=0,r=100,i=0,o=100,s="";object.defineproperties(this,{width:{enumerable:!0,get:function(){return t},set:function(e){if(!rt(e))throw new error("width must be between 0 and 100.");t=e}},lines:{enumerable:!0,get:function(){return e},set:function(t){if("number"!=typeof t)throw new typeerror("lines must be set to a number.");e=t}},regionanchory:{enumerable:!0,get:function(){return r},set:function(t){if(!rt(t))throw new error("regionanchorx must be between 0 and 100.");r=t}},regionanchorx:{enumerable:!0,get:function(){return n},set:function(t){if(!rt(t))throw new error("regionanchory must be between 0 and 100.");n=t}},viewportanchory:{enumerable:!0,get:function(){return o},set:function(t){if(!rt(t))throw new error("viewportanchory must be between 0 and 100.");o=t}},viewportanchorx:{enumerable:!0,get:function(){return i},set:function(t){if(!rt(t))throw new error("viewportanchorx must be between 0 and 100.");i=t}},scroll:{enumerable:!0,get:function(){return s},set:function(t){var e=lt(t);if(!1===e)throw new syntaxerror("an invalid or illegal string was specified.");s=e}}})}function ft(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=t.texttracks();i.kind=e,n&&(i.label=n),r&&(i.language=r),i.tech=t;var s=new tr.text.trackclass(i);return o.addtrack(s),s}function vt(t,e){rr[t]=rr[t]||[],rr[t].push(e)}function ht(t,e,n){t.settimeout(function(){return qt(e,rr[e.type],n,t)},1)}function wt(t,e){t.foreach(function(t){return t.settech&&t.settech(e)})}function ut(t,e,n){return t.reduceright(xt(n),e[n]())}function zt(t,e,n,r){return e[n](t.reduce(xt(n),r))}function xt(t){return function(e,n){return n[t]?n[t](e):e}}function qt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments[2],i=arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=e[0],l=e.slice(1);if("string"==typeof a)qt(t,rr[a],n,i,o,s);else if(a){var c=a(i);c.setsource(r({},t),function(e,r){if(e)return qt(t,l,n,i,o,s);o.push(c),qt(r,t.type===r.type?l:rr[r.type],n,i,o,s)})}else l.length?qt(t,l,n,i,o,s):s?n(t,o):qt(t,rr["*"],n,i,o,!0)}function kt(t,e){return"rgba("+parseint(t[1]+t[1],16)+","+parseint(t[2]+t[2],16)+","+parseint(t[3]+t[3],16)+","+e+")"}function yt(t,e,n){try{t.style[e]=n}catch(t){return}}function gt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;t=t<0?0:t;var n=math.floor(t%60),r=math.floor(t/60%60),i=math.floor(t/3600),o=math.floor(e/60%60),s=math.floor(e/3600);return(isnan(t)||t===1/0)&&(i=r=n="-"),i=i>0||s>0?i+":":"",r=((i||o>=10)&&r<10?"0"+r:r)+":",n=n<10?"0"+n:n,i+r+n}function $t(t,e){if(e&&(t=e(t)),t&&"none"!==t)return t}function jt(t,e){return $t(t.options[t.options.selectedindex].value,e)}function qt(t,e,n){if(e)for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:!!xe&&xe<11,r=ve.levels[he],o=new regexp("^("+r+")$");"log"!==t&&e.unshift(t.touppercase()+":"),we&&we.push([].concat(e)),e.unshift("videojs:");var s=ie.console&&ie.console[t];s&&r&&o.test(t)&&(n&&(e=e.map(function(t){if(i(t)||array.isarray(t))try{return json.stringify(t)}catch(e){return string(t)}return string(t)}).join(" ")),s.apply?s[array.isarray(e)?"apply":"call"](ie.console,e):s(e))};ve=function(){for(var t=arguments.length,e=array(t),n=0;n0)for(var r=0,i=t.length;r0)for(var o=0,s=e.length;o0)for(var a=0,l=n.length;a=e&&(t.apply(void 0,arguments),n=r)}},un=function(){};un.prototype.allowedevents_={},un.prototype.on=function(t,e){var n=this.addeventlistener;this.addeventlistener=function(){},u(this,t,e),this.addeventlistener=n},un.prototype.addeventlistener=un.prototype.on,un.prototype.off=function(t,e){z(this,t,e)},un.prototype.removeeventlistener=un.prototype.off,un.prototype.one=function(t,e){var n=this.addeventlistener;this.addeventlistener=function(){},q(this,t,e),this.addeventlistener=n},un.prototype.trigger=function(t){var e=t.type||t;"string"==typeof t&&(t={type:e}),t=w(t),this.allowedevents_[e]&&this["on"+e]&&this["on"+e](t),x(this,t)},un.prototype.dispatchevent=un.prototype.trigger;var hn=function(t){return t instanceof un||!!t.eventbusel_&&["on","one","off","trigger"].every(function(e){return"function"==typeof t[e]})},pn=function(t){return"string"==typeof t&&/\s/.test(t)||array.isarray(t)&&!!t.length},dn=function(t){if(!t.nodename&&!hn(t))throw new error("invalid target; must be a dom node or evented object.")},fn=function(t){if(!pn(t))throw new error("invalid event type; must be a non-empty string or array.")},vn=function(t){if("function"!=typeof t)throw new error("invalid listener; must be a function.")},yn=function(t,e){var n=e.length<3||e[0]===t||e[0]===t.eventbusel_,r=void 0,i=void 0,o=void 0;return n?(r=t.eventbusel_,e.length>=3&&e.shift(),i=e[0],o=e[1]):(r=e[0],i=e[1],o=e[2]),dn(r),fn(i),vn(o),o=ln(t,o),{istargetingself:n,target:r,type:i,listener:o}},gn=function(t,e,n,r){dn(t),t.nodename?en[e](t,n,r):t[e](n,r)},mn={on:function(){for(var t=this,e=arguments.length,n=array(e),r=0;r=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childindex_=null,this.childnameindex_=null,this.el_&&(this.el_.parentnode&&this.el_.parentnode.removechild(this.el_),f(this.el_),this.el_=null)},t.prototype.player=function(){return this.player_},t.prototype.options=function(t){return ze.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),t?(this.options_=q(this.options_,t),this.options_):this.options_},t.prototype.el=function(){return this.el_},t.prototype.createel=function(t,e,n){return f(t,e,n)},t.prototype.localize=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),o=i&&i[r],s=r&&r.split("-")[0],a=i&&i[s],l=n;return o&&o[t]?l=o[t]:a&&a[t]&&(l=a[t]),e&&(l=l.replace(/\{(\d+)\}/g,function(t,n){var r=e[n-1],i=r;return void 0===r&&(i=t),i})),l},t.prototype.contentel=function(){return this.contentel_||this.el_},t.prototype.id=function(){return this.id_},t.prototype.name=function(){return this.name_},t.prototype.children=function(){return this.children_},t.prototype.getchildbyid=function(t){return this.childindex_[t]},t.prototype.getchild=function(t){if(t)return t=$(t),this.childnameindex_[t]},t.prototype.addchild=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length,i=void 0,o=void 0;if("string"==typeof e){o=$(e);var s=n.componentclass||o;n.name=o;var a=t.getcomponent(s);if(!a)throw new error("component "+s+" does not exist");if("function"!=typeof a)return null;i=new a(this.player_||this,n)}else i=e;if(this.children_.splice(r,0,i),"function"==typeof i.id&&(this.childindex_[i.id()]=i),o=o||i.name&&$(i.name()),o&&(this.childnameindex_[o]=i),"function"==typeof i.el&&i.el()){var l=this.contentel().children,c=l[r]||null;this.contentel().insertbefore(i.el(),c)}return i},t.prototype.removechild=function(t){if("string"==typeof t&&(t=this.getchild(t)),t&&this.children_){for(var e=!1,n=this.children_.length-1;n>=0;n--)if(this.children_[n]===t){e=!0,this.children_.splice(n,1);break}if(e){this.childindex_[t.id()]=null,this.childnameindex_[t.name()]=null;var r=t.el();r&&r.parentnode===this.contentel()&&this.contentel().removechild(t.el())}}},t.prototype.initchildren=function(){var e=this,n=this.options_.children;if(n){var r=this.options_,i=function(t){var n=t.name,i=t.opts;if(void 0!==r[n]&&(i=r[n]),!1!==i){!0===i&&(i={}),i.playeroptions=e.options_.playeroptions;var o=e.addchild(n,i);o&&(e[n]=o)}},o=void 0,s=t.getcomponent("tech");o=array.isarray(n)?n:object.keys(n),o.concat(object.keys(this.options_).filter(function(t){return!o.some(function(e){return"string"==typeof e?t===e:t===e.name})})).map(function(t){var r=void 0,i=void 0;return"string"==typeof t?(r=t,i=n[r]||e.options_[r]||{}):(r=t.name,i=t),{name:r,opts:i}}).filter(function(e){var n=t.getcomponent(e.opts.componentclass||$(e.name));return n&&!s.istech(n)}).foreach(i)}},t.prototype.buildcssclass=function(){return""},t.prototype.ready=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t&&(this.isready_?e?t.call(this):this.settimeout(t,1):(this.readyqueue_=this.readyqueue_||[],this.readyqueue_.push(t)))},t.prototype.triggerready=function(){this.isready_=!0,this.settimeout(function(){var t=this.readyqueue_;this.readyqueue_=[],t&&t.length>0&&t.foreach(function(t){t.call(this)},this),this.trigger("ready")},1)},t.prototype.$=function(t,e){return ke(t,e||this.contentel())},t.prototype.$$=function(t,e){return ye(t,e||this.contentel())},t.prototype.hasclass=function(t){return g(this.el_,t)},t.prototype.addclass=function(t){m(this.el_,t)},t.prototype.removeclass=function(t){_(this.el_,t)},t.prototype.toggleclass=function(t,e){b(this.el_,t,e)},t.prototype.show=function(){this.removeclass("vjs-hidden")},t.prototype.hide=function(){this.addclass("vjs-hidden")},t.prototype.lockshowing=function(){this.addclass("vjs-lock-showing")},t.prototype.unlockshowing=function(){this.removeclass("vjs-lock-showing")},t.prototype.getattribute=function(t){return k(this.el_,t)},t.prototype.setattribute=function(t,e){w(this.el_,t,e)},t.prototype.removeattribute=function(t){e(this.el_,t)},t.prototype.width=function(t,e){return this.dimension("width",t,e)},t.prototype.height=function(t,e){return this.dimension("height",t,e)},t.prototype.dimensions=function(t,e){this.width(t,!0),this.height(e)},t.prototype.dimension=function(t,e,n){if(void 0!==e)return null!==e&&e===e||(e=0),-1!==(""+e).indexof("%")||-1!==(""+e).indexof("px")?this.el_.style[t]=e:this.el_.style[t]="auto"===e?"":e+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var r=this.el_.style[t],i=r.indexof("px");return-1!==i?parseint(r.slice(0,i),10):parseint(this.el_["offset"+$(t)],10)},t.prototype.currentdimension=function(t){var e=0;if("width"!==t&&"height"!==t)throw new error("currentdimension only accepts width or height value");if("function"==typeof ie.getcomputedstyle){var n=ie.getcomputedstyle(this.el_);e=n.getpropertyvalue(t)||n[t]}if(0===(e=parsefloat(e))){var r="offset"+$(t);e=this.el_[r]}return e},t.prototype.currentdimensions=function(){return{width:this.currentdimension("width"),height:this.currentdimension("height")}},t.prototype.currentwidth=function(){return this.currentdimension("width")},t.prototype.currentheight=function(){return this.currentdimension("height")},t.prototype.focus=function(){this.el_.focus()},t.prototype.blur=function(){this.el_.blur()},t.prototype.emittapevents=function(){var t=0,e=null,n=void 0;this.on("touchstart",function(r){1===r.touches.length&&(e={pagex:r.touches[0].pagex,pagey:r.touches[0].pagey},t=(new date).gettime(),n=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)n=!1;else if(e){var r=t.touches[0].pagex-e.pagex,i=t.touches[0].pagey-e.pagey,o=math.sqrt(r*r+i*i);o>10&&(n=!1)}});var r=function(){n=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(r){if(e=null,!0===n){(new date).gettime()-t<200&&(r.preventdefault(),this.trigger("tap"))}})},t.prototype.enabletouchactivity=function(){if(this.player()&&this.player().reportuseractivity){var t=ln(this.player(),this.player().reportuseractivity),e=void 0;this.on("touchstart",function(){t(),this.clearinterval(e),e=this.setinterval(t,250)});var n=function(n){t(),this.clearinterval(e)};this.on("touchmove",t),this.on("touchend",n),this.on("touchcancel",n)}},t.prototype.settimeout=function(t,e){t=ln(this,t);var n=ie.settimeout(t,e),r=function(){this.cleartimeout(n)};return r.guid="vjs-timeout-"+n,this.on("dispose",r),n},t.prototype.cleartimeout=function(t){ie.cleartimeout(t);var e=function(){};return e.guid="vjs-timeout-"+t,this.off("dispose",e),t},t.prototype.setinterval=function(t,e){t=ln(this,t);var n=ie.setinterval(t,e),r=function(){this.clearinterval(n)};return r.guid="vjs-interval-"+n,this.on("dispose",r),n},t.prototype.clearinterval=function(t){ie.clearinterval(t);var e=function(){};return e.guid="vjs-interval-"+t,this.off("dispose",e),t},t.prototype.requestanimationframe=function(t){var e=this;if(this.supportsraf_){t=ln(this,t);var n=ie.requestanimationframe(t),r=function(){return e.cancelanimationframe(n)};return r.guid="vjs-raf-"+n,this.on("dispose",r),n}return this.settimeout(t,1e3/60)},t.prototype.cancelanimationframe=function(t){if(this.supportsraf_){ie.cancelanimationframe(t);var e=function(){};return e.guid="vjs-raf-"+t,this.off("dispose",e),t}return this.cleartimeout(t)},t.registercomponent=function(e,n){if("string"!=typeof e||!e)throw new error('illegal component name, "'+e+'"; must be a non-empty string.');var r=t.getcomponent("tech"),i=r&&r.istech(n),o=t===n||t.prototype.isprototypeof(n.prototype);if(i||!o){var s=void 0;throw s=i?"techs must be registered using tech.registertech()":"must be a component subclass",new error('illegal component, "'+e+'"; '+s+".")}e=$(e),t.components_||(t.components_={});var a=t.getcomponent("player");if("player"===e&&a&&a.players){var l=a.players,c=object.keys(l);if(l&&c.length>0&&c.map(function(t){return l[t]}).every(boolean))throw new error("can not register player component after player has been created.")}return t.components_[e]=n,n},t.getcomponent=function(e){if(e)return e=$(e),t.components_&&t.components_[e]?t.components_[e]:void 0},t}();bn.prototype.supportsraf_="function"==typeof ie.requestanimationframe&&"function"==typeof ie.cancelanimationframe,bn.registercomponent("component",bn);for(var tn={},cn=[["requestfullscreen","exitfullscreen","fullscreenelement","fullscreenenabled","fullscreenchange","fullscreenerror"],["webkitrequestfullscreen","webkitexitfullscreen","webkitfullscreenelement","webkitfullscreenenabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitrequestfullscreen","webkitcancelfullscreen","webkitcurrentfullscreenelement","webkitcancelfullscreen","webkitfullscreenchange","webkitfullscreenerror"],["mozrequestfullscreen","mozcancelfullscreen","mozfullscreenelement","mozfullscreenenabled","mozfullscreenchange","mozfullscreenerror"],["msrequestfullscreen","msexitfullscreen","msfullscreenelement","msfullscreenenabled","msfullscreenchange","msfullscreenerror"]],kn=cn[0],wn=void 0,en=0;en0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ie(this,e);var o=le(this,t.call(this));if(!i&&(i=o,se)){i=ce.createelement("custom");for(var s in e.prototype)"constructor"!==s&&(i[s]=e.prototype[s])}i.tracks_=[],object.defineproperty(i,"length",{get:function(){return this.tracks_.length}});for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:[];ie(this,e);for(var o=void 0,s=i.length-1;s>=0;s--)if(i[s].enabled){rn(i,i[s]);break}if(se){o=ce.createelement("custom");for(var a in dn.prototype)"constructor"!==a&&(o[a]=dn.prototype[a]);for(var l in e.prototype)"constructor"!==l&&(o[l]=e.prototype[l])}return o=n=le(this,t.call(this,i,o)),o.changing_=!1,r=o,le(n,r)}return de(e,t),e.prototype.addtrack=function(e){var n=this;e.enabled&&rn(this,e),t.prototype.addtrack.call(this,e),e.addeventlistener&&e.addeventlistener("enabledchange",function(){n.changing_||(n.changing_=!0,rn(n,e),n.changing_=!1,n.trigger("change"))})},e}(dn),fn=function(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[];ie(this,e);for(var o=void 0,s=i.length-1;s>=0;s--)if(i[s].selected){fn(i,i[s]);break}if(se){o=ce.createelement("custom");for(var a in dn.prototype)"constructor"!==a&&(o[a]=dn.prototype[a]);for(var l in e.prototype)"constructor"!==l&&(o[l]=e.prototype[l])}return o=n=le(this,t.call(this,i,o)),o.changing_=!1,object.defineproperty(o,"selectedindex",{get:function(){for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:[];ie(this,e);var o=void 0;if(se){o=ce.createelement("custom");for(var s in dn.prototype)"constructor"!==s&&(o[s]=dn.prototype[s]);for(var a in e.prototype)"constructor"!==a&&(o[a]=e.prototype[a])}return o=n=le(this,t.call(this,i,o)),r=o,le(n,r)}return de(e,t),e.prototype.addtrack=function(e){t.prototype.addtrack.call(this,e),e.addeventlistener("modechange",ln(this,function(){this.trigger("change")})),-1===["metadata","chapters"].indexof(e.kind)&&e.addeventlistener("modechange",ln(this,function(){this.trigger("selectedlanguagechange")}))},e}(dn),wn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];ie(this,t);var n=this;if(se){n=ce.createelement("custom");for(var r in t.prototype)"constructor"!==r&&(n[r]=t.prototype[r])}n.trackelements_=[],object.defineproperty(n,"length",{get:function(){return this.trackelements_.length}});for(var i=0,o=e.length;i0&&void 0!==arguments[0]?arguments[0]:{};ie(this,e);var i=le(this,t.call(this)),o=i;if(se){o=ce.createelement("custom");for(var s in e.prototype)"constructor"!==s&&(o[s]=e.prototype[s])}var a={id:r.id||"vjs_track_"+l(),kind:r.kind||"",label:r.label||"",language:r.language||""};for(var l in a)!function(t){object.defineproperty(o,t,{get:function(){return a[t]},set:function(){}})}(l);return n=o,le(i,n)}return de(e,t),e}(un),gn=function(t){var e=["protocol","hostname","port","pathname","search","hash","host"],n=ce.createelement("a");n.href=t;var r=""===n.host&&"file:"!==n.protocol,i=void 0;r&&(i=ce.createelement("div"),i.innerhtml='',n=i.firstchild,i.setattribute("style","display:none; position:absolute;"),ce.body.appendchild(i));for(var o={},s=0;sx',t=e.firstchild.href}return t},jn=function(t){if("string"==typeof t){var e=/^(\/?)([\s\s]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i,n=e.exec(t);if(n)return n.pop().tolowercase()}return""},qn=function(t){var e=ie.location,n=gn(t);return(":"===n.protocol?e.protocol:n.protocol)+n.host!==e.protocol+e.host},zn=(object.freeze||object)({parseurl:gn,getabsoluteurl:$n,getfileextension:jn,iscrossorigin:qn}),tr=st,er=object.prototype.tostring,nr=t(function(t,e){function n(t){return t.replace(/^\s*|\s*$/g,"")}e=t.exports=n,e.left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}}),rr=at,ir=object.prototype.tostring,or=object.prototype.hasownproperty,sr=function(t){return"[object array]"===object.prototype.tostring.call(t)},ar=function(t){if(!t)return{};var e={};return rr(nr(t).split("\n"),function(t){var n=t.indexof(":"),r=nr(t.slice(0,n)).tolowercase(),i=nr(t.slice(n+1));void 0===e[r]?e[r]=i:sr(e[r])?e[r].push(i):e[r]=[e[r],i]}),e},lr=ht,cr=object.prototype.hasownproperty,ur=ft;ft.xmlhttprequest=ie.xmlhttprequest||gt,ft.xdomainrequest="withcredentials"in new ft.xmlhttprequest?ft.xmlhttprequest:ie.xdomainrequest,function(t,e){for(var n=0;n0&&(ie.console&&ie.console.groupcollapsed&&ie.console.groupcollapsed("text track parsing errors for "+e.src),r.foreach(function(t){return ze.error(t)}),ie.console&&ie.console.groupend&&ie.console.groupend()),n.flush()},pr=function(t,e){var n={uri:t},r=qn(t);r&&(n.cors=r),ur(n,ln(this,function(t,n,r){if(t)return ze.error(t,n);if(e.loaded_=!0,"function"!=typeof ie.webvtt){if(e.tech_){var i=function(){return hr(r,e)};e.tech_.on("vttjsloaded",i),e.tech_.on("vttjserror",function(){ze.error("vttjs failed to load, stopping trying to process "+e.src),e.tech_.off("vttjsloaded",i)})}}else hr(r,e)}))},dr=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(ie(this,e),!i.tech)throw new error("a tech was not provided.");var o=q(i,{kind:qn[i.kind]||"subtitles",language:i.language||i.srclang||""}),s=kn[o.mode]||"disabled",a=o.default;"metadata"!==o.kind&&"chapters"!==o.kind||(s="hidden");var l=n=le(this,t.call(this,o));if(l.tech_=o.tech,se)for(var c in e.prototype)"constructor"!==c&&(l[c]=e.prototype[c]);l.cues_=[],l.activecues_=[];var u=new un(l.cues_),h=new un(l.activecues_),p=!1,d=ln(l,function(){this.activecues,p&&(this.trigger("cuechange"),p=!1)});return"disabled"!==s&&l.tech_.ready(function(){l.tech_.on("timeupdate",d)},!0),object.defineproperty(l,"default",{get:function(){return a},set:function(){}}),object.defineproperty(l,"mode",{get:function(){return s},set:function(t){var e=this;kn[t]&&(s=t,"showing"===s&&this.tech_.ready(function(){e.tech_.on("timeupdate",d)},!0),this.trigger("modechange"))}}),object.defineproperty(l,"cues",{get:function(){return this.loaded_?u:null},set:function(){}}),object.defineproperty(l,"activecues",{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return h;for(var t=this.tech_.currenttime(),e=[],n=0,r=this.cues.length;n=t?e.push(i):i.starttime===i.endtime&&i.starttime<=t&&i.starttime+.5>=t&&e.push(i)}if(p=!1,e.length!==this.activecues_.length)p=!0;else for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};ie(this,e);var o=q(i,{kind:xn[i.kind]||""}),s=n=le(this,t.call(this,o)),a=!1;if(se)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return object.defineproperty(s,"enabled",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("enabledchange"))}}),o.enabled&&(s.enabled=o.enabled),s.loaded_=!0,r=s,le(n,r)}return de(e,t),e}(yn),vr=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ie(this,e);var o=q(i,{kind:zn[i.kind]||""}),s=n=le(this,t.call(this,o)),a=!1;if(se)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return object.defineproperty(s,"selected",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("selectedchange"))}}),o.selected&&(s.selected=o.selected),r=s,le(n,r)}return de(e,t),e}(yn),yr=0,gr=2,mr=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ie(this,e);var r=le(this,t.call(this)),i=void 0,o=r;if(se){o=ce.createelement("custom") ;for(var s in e.prototype)"constructor"!==s&&(o[s]=e.prototype[s])}var a=new dr(n);if(o.kind=a.kind,o.src=a.src,o.srclang=a.language,o.label=a.label,o.default=a.default,object.defineproperty(o,"readystate",{get:function(){return i}}),object.defineproperty(o,"track",{get:function(){return a}}),i=yr,a.addeventlistener("loadeddata",function(){i=gr,o.trigger({type:"load",target:o})}),se){var l;return l=o,le(r,l)}return r}return de(e,t),e}(un);mr.prototype.allowedevents_={load:"load"},mr.none=yr,mr.loading=1,mr.loaded=gr,mr.error=3;var _r={audio:{listclass:bn,trackclass:fr,capitalname:"audio"},video:{listclass:vn,trackclass:vr,capitalname:"video"},text:{listclass:hn,trackclass:dr,capitalname:"text"}};object.keys(_r).foreach(function(t){_r[t].gettername=t+"tracks",_r[t].privatename=t+"tracks_"});var br={remotetext:{listclass:hn,trackclass:dr,capitalname:"remotetext",gettername:"remotetexttracks",privatename:"remotetexttracks_"},remotetextel:{listclass:wn,trackclass:mr,capitalname:"remotetexttrackels",gettername:"remotetexttrackels",privatename:"remotetexttrackels_"}},tr=q(_r,br);br.names=object.keys(br),_r.names=object.keys(_r),tr.names=[].concat(br.names).concat(_r.names);var cr=object.create||function(){function t(){}return function(e){if(1!==arguments.length)throw new error("object.create shim only accepts one parameter.");return t.prototype=e,new t}}();mt.prototype=cr(error.prototype),mt.prototype.constructor=mt,mt.errors={badsignature:{code:0,message:"malformed webvtt signature."},badtimestamp:{code:1,message:"malformed time stamp."}},bt.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,n){return n?this.has(t)?this.values[t]:e[n]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,n){for(var r=0;r=0&&e<=100)&&(this.set(t,e),!0)}};var kr={"&":"&","<":"<",">":">","‎":"‎","‏":"‏"," ":" "},wr={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},er={v:"title",lang:"lang"},sr={rt:"ruby"},xr=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];xt.prototype.applystyles=function(t,e){e=e||this.div;for(var n in t)t.hasownproperty(n)&&(e.style[n]=t[n])},xt.prototype.formatstyle=function(t,e){return 0===t?0:t+e},jt.prototype=cr(xt.prototype),jt.prototype.constructor=jt,at.prototype.move=function(t,e){switch(e=void 0!==e?e:this.lineheight,t){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e}},at.prototype.overlaps=function(t){return this.leftt.left&&this.topt.top},at.prototype.overlapsany=function(t){for(var e=0;e=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right},at.prototype.overlapsoppositeaxis=function(t,e){switch(e){case"+x":return this.leftt.right;case"+y":return this.topt.bottom}},at.prototype.intersectpercentage=function(t){return math.max(0,math.min(this.right,t.right)-math.max(this.left,t.left))*math.max(0,math.min(this.bottom,t.bottom)-math.max(this.top,t.top))/(this.height*this.width)},at.prototype.tocsscompatvalues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}},at.getsimpleboxposition=function(t){var e=t.div?t.div.offsetheight:t.tagname?t.offsetheight:0,n=t.div?t.div.offsetwidth:t.tagname?t.offsetwidth:0,r=t.div?t.div.offsettop:t.tagname?t.offsettop:0;return t=t.div?t.div.getboundingclientrect():t.tagname?t.getboundingclientrect():t,{left:t.left,right:t.right,top:t.top||r,height:t.height||e,bottom:t.bottom||r+(t.height||e),width:t.width||n}},nt.stringdecoder=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new error("error - expected string data.");return decodeuricomponent(encodeuricomponent(t))}}},nt.convertcuetodomtree=function(t,e){return t&&e?kt(t,e):null};nt.processcues=function(t,e,n){if(!t||!e||!n)return null;for(;n.firstchild;)n.removechild(n.firstchild);var r=t.document.createelement("div");if(r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin="1.5%",n.appendchild(r),function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};ie(this,e),n.reporttouchactivity=!1;var i=le(this,t.call(this,null,n,r));return i.hasstarted_=!1,i.on("playing",function(){this.hasstarted_=!0}),i.on("loadstart",function(){this.hasstarted_=!1}),tr.names.foreach(function(t){var e=tr[t];n&&n[e.gettername]&&(i[e.privatename]=n[e.gettername])}),i.featuresprogressevents||i.manualprogresson(),i.featurestimeupdateevents||i.manualtimeupdateson(),["text","audio","video"].foreach(function(t){!1===n["native"+t+"tracks"]&&(i["featuresnative"+t+"tracks"]=!1)}),!1===n.nativecaptions||!1===n.nativetexttracks?i.featuresnativetexttracks=!1:!0!==n.nativecaptions&&!0!==n.nativetexttracks||(i.featuresnativetexttracks=!0),i.featuresnativetexttracks||i.emulatetexttracks(),i.autoremotetexttracks_=new tr.text.listclass,i.inittracklisteners(),n.nativecontrolsfortouch||i.emittapevents(),i.constructor&&(i.name_=i.constructor.name||"unknown tech"),i}return de(e,t),e.prototype.manualprogresson=function(){this.on("durationchange",this.ondurationchange),this.manualprogress=!0,this.one("ready",this.trackprogress)},e.prototype.manualprogressoff=function(){this.manualprogress=!1,this.stoptrackingprogress(),this.off("durationchange",this.ondurationchange)},e.prototype.trackprogress=function(t){this.stoptrackingprogress(),this.progressinterval=this.setinterval(ln(this,function(){var t=this.bufferedpercent();this.bufferedpercent_!==t&&this.trigger("progress"),this.bufferedpercent_=t,1===t&&this.stoptrackingprogress()}),500)},e.prototype.ondurationchange=function(t){this.duration_=this.duration()},e.prototype.buffered=function(){return nt(0,0)},e.prototype.bufferedpercent=function(){return rt(this.buffered(),this.duration_)},e.prototype.stoptrackingprogress=function(){this.clearinterval(this.progressinterval)},e.prototype.manualtimeupdateson=function(){this.manualtimeupdates=!0,this.on("play",this.trackcurrenttime),this.on("pause",this.stoptrackingcurrenttime)},e.prototype.manualtimeupdatesoff=function(){this.manualtimeupdates=!1,this.stoptrackingcurrenttime(),this.off("play",this.trackcurrenttime),this.off("pause",this.stoptrackingcurrenttime)},e.prototype.trackcurrenttime=function(){this.currenttimeinterval&&this.stoptrackingcurrenttime(),this.currenttimeinterval=this.setinterval(function(){this.trigger({type:"timeupdate",target:this,manuallytriggered:!0})},250)},e.prototype.stoptrackingcurrenttime=function(){this.clearinterval(this.currenttimeinterval),this.trigger({type:"timeupdate",target:this,manuallytriggered:!0})},e.prototype.dispose=function(){this.cleartracks(_r.names),this.manualprogress&&this.manualprogressoff(),this.manualtimeupdates&&this.manualtimeupdatesoff(),t.prototype.dispose.call(this)},e.prototype.cleartracks=function(t){var e=this;t=[].concat(t),t.foreach(function(t){for(var n=e[t+"tracks"]()||[],r=n.length;r--;){var i=n[r];"text"===t&&e.removeremotetexttrack(i),n.removetrack(i)}})},e.prototype.cleanupautotexttracks=function(){for(var t=this.autoremotetexttracks_||[],e=t.length;e--;){var n=t[e];this.removeremotetexttrack(n)}},e.prototype.reset=function(){},e.prototype.error=function(t){return void 0!==t&&(this.error_=new it(t),this.trigger("error")),this.error_},e.prototype.played=function(){return this.hasstarted_?nt(0,0):nt()},e.prototype.setcurrenttime=function(){this.manualtimeupdates&&this.trigger({type:"timeupdate",target:this,manuallytriggered:!0})},e.prototype.inittracklisteners=function(){var t=this;_r.names.foreach(function(e){var n=_r[e],r=function(){t.trigger(e+"trackchange")},i=t[n.gettername]();i.addeventlistener("removetrack",r),i.addeventlistener("addtrack",r),t.on("dispose",function(){i.removeeventlistener("removetrack",r),i.removeeventlistener("addtrack",r)})})},e.prototype.addwebvttscript_=function(){var t=this;if(!ie.webvtt)if(ce.body.contains(this.el())){if(!this.options_["vtt.js"]&&o(dr)&&object.keys(dr).length>0)return void this.trigger("vttjsloaded");var e=ce.createelement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js",e.onload=function(){t.trigger("vttjsloaded")},e.onerror=function(){t.trigger("vttjserror")},this.on("dispose",function(){e.onload=null,e.onerror=null}),ie.webvtt=!0,this.el().parentnode.appendchild(e)}else this.ready(this.addwebvttscript_)},e.prototype.emulatetexttracks=function(){var t=this,e=this.texttracks(),n=this.remotetexttracks(),r=function(t){return e.addtrack(t.track)},i=function(t){return e.removetrack(t.track)};n.on("addtrack",r),n.on("removetrack",i),this.addwebvttscript_();var o=function(){return t.trigger("texttrackchange")},s=function(){o();for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1],r=this.createremotetexttrack(e);return!0!==n&&!1!==n&&(ze.warn('calling addremotetexttrack without explicitly setting the "manualcleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),n=!0),this.remotetexttrackels().addtrackelement_(r),this.remotetexttracks().addtrack(r.track),!0!==n&&this.ready(function(){return t.autoremotetexttracks_.addtrack(r.track)}),r},e.prototype.removeremotetexttrack=function(t){var e=this.remotetexttrackels().gettrackelementbytrack_(t);this.remotetexttrackels().removetrackelement_(e),this.remotetexttracks().removetrack(t),this.autoremotetexttracks_.removetrack(t)},e.prototype.getvideoplaybackquality=function(){return{}},e.prototype.setposter=function(){},e.prototype.playsinline=function(){},e.prototype.setplaysinline=function(){},e.prototype.canplaytype=function(){return""},e.canplaytype=function(){return""},e.canplaysource=function(t,n){return e.canplaytype(t.type)},e.istech=function(t){return t.prototype instanceof e||t instanceof e||t===e},e.registertech=function(t,n){if(e.techs_||(e.techs_={}),!e.istech(n))throw new error("tech "+t+" must be a tech");if(!e.canplaytype)throw new error("techs must have a static canplaytype method on them");if(!e.canplaysource)throw new error("techs must have a static canplaysource method on them");return t=$(t),e.techs_[t]=n,"tech"!==t&&e.defaulttechorder_.push(t),n},e.gettech=function(t){if(t)return t=$(t),e.techs_&&e.techs_[t]?e.techs_[t]:ie&&ie.videojs&&ie.videojs[t]?(ze.warn("the "+t+" tech was added to the videojs object when it should be registered using videojs.registertech(name, tech)"),ie.videojs[t]):void 0},e}(bn);tr.names.foreach(function(t){var e=tr[t];lr.prototype[e.gettername]=function(){return this[e.privatename]=this[e.privatename]||new e.listclass,this[e.privatename]}}),lr.prototype.featuresvolumecontrol=!0,lr.prototype.featuresfullscreenresize=!1,lr.prototype.featuresplaybackrate=!1,lr.prototype.featuresprogressevents=!1,lr.prototype.featurestimeupdateevents=!1,lr.prototype.featuresnativetexttracks=!1,lr.withsourcehandlers=function(t){t.registersourcehandler=function(e,n){var r=t.sourcehandlers;r||(r=t.sourcehandlers=[]),void 0===n&&(n=r.length),r.splice(n,0,e)},t.canplaytype=function(e){for(var n=t.sourcehandlers||[],r=void 0,i=0;i0&&void 0!==arguments[0]?arguments[0]:"div",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=r({innerhtml:'',classname:this.buildcssclass(),tabindex:0},n),"button"===e&&ze.error("creating a clickablecomponent with an html element of "+e+" is not supported; use a button instead."),i=r({role:"button","aria-live":"polite"},i),this.tabindex_=n.tabindex;var o=t.prototype.createel.call(this,e,n,i);return this.createcontroltextel(o),o},e.prototype.createcontroltextel=function(t){return this.controltextel_=f("span",{classname:"vjs-control-text"}),t&&t.appendchild(this.controltextel_),this.controltext(this.controltext_,t),this.controltextel_},e.prototype.controltext=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(!t)return this.controltext_||"need text";var n=this.localize(t);this.controltext_=t,v(this.controltextel_,n),this.noniconcontrol||e.setattribute("title",n)},e.prototype.buildcssclass=function(){return"vjs-control vjs-button "+t.prototype.buildcssclass.call(this)},e.prototype.enable=function(){this.enabled_||(this.enabled_=!0,this.removeclass("vjs-disabled"),this.el_.setattribute("aria-disabled","false"),void 0!==this.tabindex_&&this.el_.setattribute("tabindex",this.tabindex_),this.on(["tap","click"],this.handleclick),this.on("focus",this.handlefocus),this.on("blur",this.handleblur))},e.prototype.disable=function(){this.enabled_=!1,this.addclass("vjs-disabled"),this.el_.setattribute("aria-disabled","true"),void 0!==this.tabindex_&&this.el_.removeattribute("tabindex"),this.off(["tap","click"],this.handleclick),this.off("focus",this.handlefocus),this.off("blur",this.handleblur)},e.prototype.handleclick=function(t){},e.prototype.handlefocus=function(t){u(ce,"keydown",ln(this,this.handlekeypress))},e.prototype.handlekeypress=function(e){32===e.which||13===e.which?(e.preventdefault(),this.trigger("click")):t.prototype.handlekeypress&&t.prototype.handlekeypress.call(this,e)},e.prototype.handleblur=function(t){z(ce,"keydown",ln(this,this.handlekeypress))},e}(bn);bn.registercomponent("clickablecomponent",wr);var ur=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.update(),n.on("posterchange",ln(i,i.update)),i}return de(e,t),e.prototype.dispose=function(){this.player().off("posterchange",this.update),t.prototype.dispose.call(this)},e.prototype.createel=function(){var t=f("div",{classname:"vjs-poster",tabindex:-1});return ne||(this.fallbackimg_=f("img"),t.appendchild(this.fallbackimg_)),t},e.prototype.update=function(t){var e=this.player().poster();this.setsrc(e),e?this.show():this.hide()},e.prototype.setsrc=function(t){if(this.fallbackimg_)this.fallbackimg_.src=t;else{var e="";t&&(e='url("'+t+'")'),this.el_.style.backgroundimage=e}},e.prototype.handleclick=function(t){this.player_.controls()&&(this.player_.paused()?this.player_.play():this.player_.pause())},e}(wr);bn.registercomponent("posterimage",ur);var zr={monospace:"monospace",sansserif:"sans-serif",serif:"serif",monospacesansserif:'"andale mono", "lucida console", monospace',monospaceserif:'"courier new", monospace',proportionalsansserif:"sans-serif",proportionalserif:"serif",casual:'"comic sans ms", impact, fantasy',script:'"monotype corsiva", cursive',smallcaps:'"andale mono", "lucida console", monospace, sans-serif'},xr=function(t){function e(n,r,i){ie(this,e);var o=le(this,t.call(this,n,r,i));return n.on("loadstart",ln(o,o.toggledisplay)),n.on("texttrackchange",ln(o,o.updatedisplay)),n.on("loadstart",ln(o,o.preselecttrack)),n.ready(ln(o,function(){if(n.tech_&&n.tech_.featuresnativetexttracks)return void this.hide();n.on("fullscreenchange",ln(this,this.updatedisplay));for(var t=this.options_.playeroptions.tracks||[],e=0;e1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t="button",e=r({innerhtml:'',classname:this.buildcssclass()},e),n=r({type:"button","aria-live":"polite"},n);var i=bn.prototype.createel.call(this,t,e,n);return this.createcontroltextel(i),i},e.prototype.addchild=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.constructor.name;return ze.warn("adding an actionable (user controllable) child to a button ("+n+") is not supported; use a clickablecomponent instead."),bn.prototype.addchild.call(this,t,e)},e.prototype.enable=function(){t.prototype.enable.call(this),this.el_.removeattribute("disabled")},e.prototype.disable=function(){t.prototype.disable.call(this),this.el_.setattribute("disabled","disabled")},e.prototype.handlekeypress=function(e){32!==e.which&&13!==e.which&&t.prototype.handlekeypress.call(this,e)},e}(wr);bn.registercomponent("button",kr);var yr=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.mouseused_=!1,i.on("mousedown",i.handlemousedown),i}return de(e,t),e.prototype.buildcssclass=function(){return"vjs-big-play-button"},e.prototype.handleclick=function(t){var e=this.player_.play();if(!(this.mouseused_&&t.clientx&&t.clienty)){var n=this.player_.getchild("controlbar"),r=n&&n.getchild("playtoggle");if(!r)return void this.player_.focus();var i=function(){return r.focus()};if(e&&e.then){var o=function(){};e.then(i,o)}else this.settimeout(i,1)}},e.prototype.handlekeypress=function(e){this.mouseused_=!1,t.prototype.handlekeypress.call(this,e)},e.prototype.handlemousedown=function(t){this.mouseused_=!0},e}(kr);yr.prototype.controltext_="点击播放",bn.registercomponent("bigplaybutton",yr);var gr=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.controltext(r&&r.controltext||i.localize("close")),i}return de(e,t),e.prototype.buildcssclass=function(){return"vjs-close-button "+t.prototype.buildcssclass.call(this)},e.prototype.handleclick=function(t){this.trigger({type:"close",bubbles:!1})},e}(kr);bn.registercomponent("closebutton",gr);var $r=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.on(n,"play",i.handleplay),i.on(n,"pause",i.handlepause),i.on(n,"ended",i.handleended),i}return de(e,t),e.prototype.buildcssclass=function(){return"vjs-play-control "+t.prototype.buildcssclass.call(this)},e.prototype.handleclick=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.prototype.handleplay=function(t){this.removeclass("vjs-ended"),this.removeclass("vjs-paused"),this.addclass("vjs-playing"),this.controltext("暂停")},e.prototype.handlepause=function(t){this.removeclass("vjs-playing"),this.addclass("vjs-paused"),this.controltext("播放")},e.prototype.handleended=function(t){this.removeclass("vjs-playing"),this.addclass("vjs-ended"),this.controltext("重播")},e}(kr);$r.prototype.controltext_="play",bn.registercomponent("playtoggle",$r);var jr=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.throttledupdatecontent=cn(ln(i,i.updatecontent),25),i.on(n,"timeupdate",i.throttledupdatecontent),i}return de(e,t),e.prototype.createel=function(){var e=t.prototype.createel.call(this,"div",{classname:"vjs-current-time vjs-time-control vjs-control"});return this.contentel_=f("div",{classname:"vjs-current-time-display"},{"aria-live":"off"},f("span",{classname:"vjs-control-text",textcontent:this.localize("current time")})),this.updatetextnode_(),e.appendchild(this.contentel_),e},e.prototype.updatetextnode_=function(){this.textnode_&&this.contentel_.removechild(this.textnode_),this.textnode_=ce.createtextnode(" "+(this.formattedtime_||"0:00")),this.contentel_.appendchild(this.textnode_)},e.prototype.updatecontent=function(t){var e=this.player_.scrubbing()?this.player_.getcache().currenttime:this.player_.currenttime(),n=gt(e,this.player_.duration());n!==this.formattedtime_&&(this.formattedtime_=n,this.requestanimationframe(this.updatetextnode_))},e}(bn);bn.registercomponent("currenttimedisplay",jr);var qr=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.throttledupdatecontent=cn(ln(i,i.updatecontent),25),i.on(n,["durationchange","loadedmetadata","timeupdate"],i.throttledupdatecontent),i}return de(e,t),e.prototype.createel=function(){var e=t.prototype.createel.call(this,"div",{classname:"vjs-duration vjs-time-control vjs-control"});return this.contentel_=f("div",{classname:"vjs-duration-display"},{"aria-live":"off"},f("span",{classname:"vjs-control-text",textcontent:this.localize("duration time")})),this.updatetextnode_(), e.appendchild(this.contentel_),e},e.prototype.updatetextnode_=function(){this.textnode_&&this.contentel_.removechild(this.textnode_),this.textnode_=ce.createtextnode(" "+(this.formattedtime_||"0:00")),this.contentel_.appendchild(this.textnode_)},e.prototype.updatecontent=function(t){var e=this.player_.duration();e&&this.duration_!==e&&(this.duration_=e,this.formattedtime_=gt(e),this.requestanimationframe(this.updatetextnode_))},e}(bn);bn.registercomponent("durationdisplay",qr);var zr=function(t){function e(){return ie(this,e),le(this,t.apply(this,arguments))}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-time-control vjs-time-divider",innerhtml:"
/
"})},e}(bn);bn.registercomponent("timedivider",zr);var ti=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.throttledupdatecontent=cn(ln(i,i.updatecontent),25),i.on(n,["timeupdate","durationchange"],i.throttledupdatecontent),i}return de(e,t),e.prototype.createel=function(){var e=t.prototype.createel.call(this,"div",{classname:"vjs-remaining-time vjs-time-control vjs-control"});return this.contentel_=f("div",{classname:"vjs-remaining-time-display"},{"aria-live":"off"},f("span",{classname:"vjs-control-text",textcontent:this.localize("remaining time")})),this.updatetextnode_(),e.appendchild(this.contentel_),e},e.prototype.updatetextnode_=function(){this.textnode_&&this.contentel_.removechild(this.textnode_),this.textnode_=ce.createtextnode(" -"+(this.formattedtime_||"0:00")),this.contentel_.appendchild(this.textnode_)},e.prototype.updatecontent=function(t){if(this.player_.duration()){var e=gt(this.player_.remainingtime());e!==this.formattedtime_&&(this.formattedtime_=e,this.requestanimationframe(this.updatetextnode_))}},e}(bn);bn.registercomponent("remainingtimedisplay",ti);var ei=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.updateshowing(),i.on(i.player(),"durationchange",i.updateshowing),i}return de(e,t),e.prototype.createel=function(){var e=t.prototype.createel.call(this,"div",{classname:"vjs-live-control vjs-control"});return this.contentel_=f("div",{classname:"vjs-live-display",innerhtml:''+this.localize("stream type")+""+this.localize("live")},{"aria-live":"off"}),e.appendchild(this.contentel_),e},e.prototype.updateshowing=function(t){this.player().duration()===1/0?this.show():this.hide()},e}(bn);bn.registercomponent("livedisplay",ei);var ni=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.bar=i.getchild(i.options_.barname),i.vertical(!!i.options_.vertical),i.on("mousedown",i.handlemousedown),i.on("touchstart",i.handlemousedown),i.on("focus",i.handlefocus),i.on("blur",i.handleblur),i.on("click",i.handleclick),i.on(n,"controlsvisible",i.update),i.playerevent&&i.on(n,i.playerevent,i.update),i}return de(e,t),e.prototype.createel=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.classname=n.classname+" vjs-slider",n=r({tabindex:0},n),i=r({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabindex:0},i),t.prototype.createel.call(this,e,n,i)},e.prototype.handlemousedown=function(t){var e=this.bar.el_.ownerdocument;t.preventdefault(),s(),this.addclass("vjs-sliding"),this.trigger("slideractive"),this.on(e,"mousemove",this.handlemousemove),this.on(e,"mouseup",this.handlemouseup),this.on(e,"touchmove",this.handlemousemove),this.on(e,"touchend",this.handlemouseup),this.handlemousemove(t)},e.prototype.handlemousemove=function(t){},e.prototype.handlemouseup=function(){var t=this.bar.el_.ownerdocument;x(),this.removeclass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handlemousemove),this.off(t,"mouseup",this.handlemouseup),this.off(t,"touchmove",this.handlemousemove),this.off(t,"touchend",this.handlemouseup),this.update()},e.prototype.update=function(){if(this.el_){var t=this.getpercent(),e=this.bar;if(e){("number"!=typeof t||t!==t||t<0||t===1/0)&&(t=0);var n=(100*t).tofixed(2)+"%",r=e.el().style;return this.vertical()?r.height=n:r.width=n,t}}},e.prototype.calculatedistance=function(t){var e=p(this.el_,t);return this.vertical()?e.y:e.x},e.prototype.handlefocus=function(){this.on(this.bar.el_.ownerdocument,"keydown",this.handlekeypress)},e.prototype.handlekeypress=function(t){37===t.which||40===t.which?(t.preventdefault(),this.stepback()):38!==t.which&&39!==t.which||(t.preventdefault(),this.stepforward())},e.prototype.handleblur=function(){this.off(this.bar.el_.ownerdocument,"keydown",this.handlekeypress)},e.prototype.handleclick=function(t){t.stopimmediatepropagation(),t.preventdefault()},e.prototype.vertical=function(t){if(void 0===t)return this.vertical_||!1;this.vertical_=!!t,this.vertical_?this.addclass("vjs-slider-vertical"):this.addclass("vjs-slider-horizontal")},e}(bn);bn.registercomponent("slider",ni);var ri=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.partels_=[],i.on(n,"progress",i.update),i}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-load-progress",innerhtml:''+this.localize("loaded")+": 0%"})},e.prototype.update=function(t){var e=this.player_.buffered(),n=this.player_.duration(),r=this.player_.bufferedend(),i=this.partels_,o=function(t,e){var n=t/e||0;return 100*(n>=1?1:n)+"%"};this.el_.style.width=o(r,n);for(var s=0;se.length;u--)this.el_.removechild(i[u-1]);i.length=e.length},e}(bn);bn.registercomponent("loadprogressbar",ri);var ii=function(t){function e(){return ie(this,e),le(this,t.apply(this,arguments))}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-time-tooltip"})},e.prototype.update=function(t,e,n){var r=j(this.el_),i=j(this.player_.el()),o=t.width*e;if(i&&r){var s=t.left-i.left+o,a=t.width-o+(i.right-t.right),l=r.width/2;sr.width&&(l=r.width),this.el_.style.right="-"+l+"px",v(this.el_,n)}},e}(bn);bn.registercomponent("timetooltip",ii);var oi=function(t){function e(){return ie(this,e),le(this,t.apply(this,arguments))}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-play-progress vjs-slider-bar",innerhtml:''+this.localize("progress")+": 0%"})},e.prototype.update=function(t,e){var n=this;this.rafid_&&this.cancelanimationframe(this.rafid_),this.rafid_=this.requestanimationframe(function(){var r=n.player_.scrubbing()?n.player_.getcache().currenttime:n.player_.currenttime(),i=gt(r,n.player_.duration()),o=n.getchild("timetooltip");o&&o.update(t,e,i)})},e}(bn);oi.prototype.options_={children:[]},xe&&!(xe>8)||ye||me||oi.prototype.options_.children.push("timetooltip"),bn.registercomponent("playprogressbar",oi);var si=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.update=cn(ln(i,i.update),25),i}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-mouse-display"})},e.prototype.update=function(t,e){var n=this;this.rafid_&&this.cancelanimationframe(this.rafid_),this.rafid_=this.requestanimationframe(function(){var r=n.player_.duration(),i=gt(e*r,r);n.el_.style.left=t.width*e+"px",n.getchild("timetooltip").update(t,e,i)})},e}(bn);si.prototype.options_={children:["timetooltip"]},bn.registercomponent("mousetimedisplay",si);var ai=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.update=cn(ln(i,i.update),50),i.on(n,["timeupdate","ended"],i.update),i}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-progress-holder"},{"aria-label":this.localize("progress bar")})},e.prototype.update=function(){var e=t.prototype.update.call(this),n=this.player_.duration(),r=this.player_.scrubbing()?this.player_.getcache().currenttime:this.player_.currenttime();return this.el_.setattribute("aria-valuenow",(100*e).tofixed(2)),this.el_.setattribute("aria-valuetext",this.localize("progress bar timing: currenttime={1} duration={2}",[gt(r,n),gt(n,n)],"{1} of {2}")),this.bar.update(j(this.el_),e),e},e.prototype.getpercent=function(){var t=this.player_.scrubbing()?this.player_.getcache().currenttime:this.player_.currenttime(),e=t/this.player_.duration();return e>=1?1:e},e.prototype.handlemousedown=function(e){this.player_.scrubbing(!0),this.videowasplaying=!this.player_.paused(),this.player_.pause(),t.prototype.handlemousedown.call(this,e)},e.prototype.handlemousemove=function(t){var e=this.calculatedistance(t)*this.player_.duration();e===this.player_.duration()&&(e-=.1),this.player_.currenttime(e)},e.prototype.handlemouseup=function(e){t.prototype.handlemouseup.call(this,e),this.player_.scrubbing(!1),this.videowasplaying&&this.player_.play()},e.prototype.stepforward=function(){this.player_.currenttime(this.player_.currenttime()+5)},e.prototype.stepback=function(){this.player_.currenttime(this.player_.currenttime()-5)},e.prototype.handleaction=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.prototype.handlekeypress=function(e){32===e.which||13===e.which?(e.preventdefault(),this.handleaction(e)):t.prototype.handlekeypress&&t.prototype.handlekeypress.call(this,e)},e}(ni);ai.prototype.options_={children:["loadprogressbar","playprogressbar"],barname:"playprogressbar"},xe&&!(xe>8)||ye||me||ai.prototype.options_.children.splice(1,0,"mousetimedisplay"),ai.prototype.playerevent="timeupdate",bn.registercomponent("seekbar",ai);var li=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.handlemousemove=cn(ln(i,i.handlemousemove),25),i.on(i.el_,"mousemove",i.handlemousemove),i.throttledhandlemouseseek=cn(ln(i,i.handlemouseseek),25),i.on(["mousedown","touchstart"],i.handlemousedown),i}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-progress-control vjs-control"})},e.prototype.handlemousemove=function(t){var e=this.getchild("seekbar"),n=e.getchild("mousetimedisplay"),r=e.el(),i=j(r),o=p(r,t).x;o>1?o=1:o<0&&(o=0),n&&n.update(i,o)},e.prototype.handlemouseseek=function(t){this.getchild("seekbar").handlemousemove(t)},e.prototype.handlemousedown=function(t){var e=this.el_.ownerdocument;this.on(e,"mousemove",this.throttledhandlemouseseek),this.on(e,"touchmove",this.throttledhandlemouseseek),this.on(e,"mouseup",this.handlemouseup),this.on(e,"touchend",this.handlemouseup)},e.prototype.handlemouseup=function(t){var e=this.el_.ownerdocument;this.off(e,"mousemove",this.throttledhandlemouseseek),this.off(e,"touchmove",this.throttledhandlemouseseek),this.off(e,"mouseup",this.handlemouseup),this.off(e,"touchend",this.handlemouseup)},e}(bn);li.prototype.options_={children:["seekbar"]},bn.registercomponent("progresscontrol",li);var ci=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.on(n,"fullscreenchange",i.handlefullscreenchange),i}return de(e,t),e.prototype.buildcssclass=function(){return"vjs-fullscreen-control "+t.prototype.buildcssclass.call(this)},e.prototype.handlefullscreenchange=function(t){this.player_.isfullscreen()?this.controltext("non-fullscreen"):this.controltext("fullscreen")},e.prototype.handleclick=function(t){this.player_.isfullscreen()?this.player_.exitfullscreen():this.player_.requestfullscreen()},e}(kr);ci.prototype.controltext_="全屏",bn.registercomponent("fullscreentoggle",ci);var ui=function(t,e){e.tech_&&!e.tech_.featuresvolumecontrol&&t.addclass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresvolumecontrol?t.removeclass("vjs-hidden"):t.addclass("vjs-hidden")})},hi=function(t){function e(){return ie(this,e),le(this,t.apply(this,arguments))}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-volume-level",innerhtml:''})},e}(bn);bn.registercomponent("volumelevel",hi);var pi=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.on("slideractive",i.updatelastvolume_),i.on(n,"volumechange",i.updateariaattributes),n.ready(function(){return i.updateariaattributes()}),i}return de(e,t),e.prototype.createel=function(){return t.prototype.createel.call(this,"div",{classname:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("volume level"),"aria-live":"polite"})},e.prototype.handlemousemove=function(t){this.checkmuted(),this.player_.volume(this.calculatedistance(t))},e.prototype.checkmuted=function(){this.player_.muted()&&this.player_.muted(!1)},e.prototype.getpercent=function(){return this.player_.muted()?0:this.player_.volume()},e.prototype.stepforward=function(){this.checkmuted(),this.player_.volume(this.player_.volume()+.1)},e.prototype.stepback=function(){this.checkmuted(),this.player_.volume(this.player_.volume()-.1)},e.prototype.updateariaattributes=function(t){var e=this.player_.muted()?0:this.volumeaspercentage_();this.el_.setattribute("aria-valuenow",e),this.el_.setattribute("aria-valuetext",e+"%")},e.prototype.volumeaspercentage_=function(){return math.round(100*this.player_.volume())},e.prototype.updatelastvolume_=function(){var t=this,e=this.player_.volume();this.one("sliderinactive",function(){0===t.player_.volume()&&t.player_.lastvolume_(e)})},e}(ni);pi.prototype.options_={children:["volumelevel"],barname:"volumelevel"},pi.prototype.playerevent="volumechange",bn.registercomponent("volumebar",pi);var di=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ie(this,e),r.vertical=r.vertical||!1,(void 0===r.volumebar||o(r.volumebar))&&(r.volumebar=r.volumebar||{},r.volumebar.vertical=r.vertical);var i=le(this,t.call(this,n,r));return ui(i,n),i.throttledhandlemousemove=cn(ln(i,i.handlemousemove),25),i.on("mousedown",i.handlemousedown),i.on("touchstart",i.handlemousedown),i.on(i.volumebar,["focus","slideractive"],function(){i.volumebar.addclass("vjs-slider-active"),i.addclass("vjs-slider-active"),i.trigger("slideractive")}),i.on(i.volumebar,["blur","sliderinactive"],function(){i.volumebar.removeclass("vjs-slider-active"),i.removeclass("vjs-slider-active"),i.trigger("sliderinactive")}),i}return de(e,t),e.prototype.createel=function(){var e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),t.prototype.createel.call(this,"div",{classname:"vjs-volume-control vjs-control "+e})},e.prototype.handlemousedown=function(t){var e=this.el_.ownerdocument;this.on(e,"mousemove",this.throttledhandlemousemove),this.on(e,"touchmove",this.throttledhandlemousemove),this.on(e,"mouseup",this.handlemouseup),this.on(e,"touchend",this.handlemouseup)},e.prototype.handlemouseup=function(t){var e=this.el_.ownerdocument;this.off(e,"mousemove",this.throttledhandlemousemove),this.off(e,"touchmove",this.throttledhandlemousemove),this.off(e,"mouseup",this.handlemouseup),this.off(e,"touchend",this.handlemouseup)},e.prototype.handlemousemove=function(t){this.volumebar.handlemousemove(t)},e}(bn);di.prototype.options_={children:["volumebar"]},bn.registercomponent("volumecontrol",di);var fi=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return ui(i,n),i.on(n,["loadstart","volumechange"],i.update),i}return de(e,t),e.prototype.buildcssclass=function(){return"vjs-mute-control "+t.prototype.buildcssclass.call(this)},e.prototype.handleclick=function(t){var e=this.player_.volume(),n=this.player_.lastvolume_();if(0===e){var r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},e.prototype.update=function(t){this.updateicon_(),this.updatecontroltext_()},e.prototype.updateicon_=function(){var t=this.player_.volume(),e=3;0===t||this.player_.muted()?e=0:t<.33?e=1:t<.67&&(e=2);for(var n=0;n<4;n++)_(this.el_,"vjs-vol-"+n);m(this.el_,"vjs-vol-"+e)},e.prototype.updatecontroltext_=function(){var t=this.player_.muted()||0===this.player_.volume(),e=t?"取消静音":"静音";this.controltext()!==e&&this.controltext(e)},e}(kr);fi.prototype.controltext_="mute",bn.registercomponent("mutetoggle",fi);var vi=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ie(this,e),void 0!==r.inline?r.inline=r.inline:r.inline=!0,(void 0===r.volumecontrol||o(r.volumecontrol))&&(r.volumecontrol=r.volumecontrol||{},r.volumecontrol.vertical=!r.inline);var i=le(this,t.call(this,n,r));return ui(i,n),i.on(i.volumecontrol,["slideractive"],i.slideractive_),i.on(i.mutetoggle,"focus",i.slideractive_),i.on(i.volumecontrol,["sliderinactive"],i.sliderinactive_),i.on(i.mutetoggle,"blur",i.sliderinactive_),i}return de(e,t),e.prototype.slideractive_=function(){this.addclass("vjs-slider-active")},e.prototype.sliderinactive_=function(){this.removeclass("vjs-slider-active")},e.prototype.createel=function(){var e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),t.prototype.createel.call(this,"div",{classname:"vjs-volume-panel vjs-control "+e})},e}(bn);vi.prototype.options_={children:["mutetoggle","volumecontrol"]},bn.registercomponent("volumepanel",vi);var yi=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return r&&(i.menubutton_=r.menubutton),i.focusedchild_=-1,i.on("keydown",i.handlekeypress),i}return de(e,t),e.prototype.additem=function(t){this.addchild(t),t.on("click",ln(this,function(e){this.menubutton_&&(this.menubutton_.unpressbutton(),"captionsettingsmenuitem"!==t.name()&&this.menubutton_.focus())}))},e.prototype.createel=function(){var e=this.options_.contenteltype||"ul";this.contentel_=f(e,{classname:"vjs-menu-content"}),this.contentel_.setattribute("role","menu");var n=t.prototype.createel.call(this,"div",{append:this.contentel_,classname:"vjs-menu"});return n.appendchild(this.contentel_),u(n,"click",function(t){t.preventdefault(),t.stopimmediatepropagation()}),n},e.prototype.handlekeypress=function(t){37===t.which||40===t.which?(t.preventdefault(),this.stepforward()):38!==t.which&&39!==t.which||(t.preventdefault(),this.stepback())},e.prototype.stepforward=function(){var t=0;void 0!==this.focusedchild_&&(t=this.focusedchild_+1),this.focus(t)},e.prototype.stepback=function(){var t=0;void 0!==this.focusedchild_&&(t=this.focusedchild_-1),this.focus(t)},e.prototype.focus=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.children().slice();e.length&&e[0].classname&&/vjs-menu-title/.test(e[0].classname)&&e.shift(),e.length>0&&(t<0?t=0:t>=e.length&&(t=e.length-1),this.focusedchild_=t,e[t].el_.focus())},e}(bn);bn.registercomponent("menu",yi);var gi=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ie(this,e);var i=le(this,t.call(this,n,r));i.menubutton_=new kr(n,r),i.menubutton_.controltext(i.controltext_),i.menubutton_.el_.setattribute("aria-haspopup","true");var o=kr.prototype.buildcssclass();return i.menubutton_.el_.classname=i.buildcssclass()+" "+o,i.menubutton_.removeclass("vjs-control"),i.addchild(i.menubutton_),i.update(),i.enabled_=!0,i.on(i.menubutton_,"tap",i.handleclick),i.on(i.menubutton_,"click",i.handleclick),i.on(i.menubutton_,"focus",i.handlefocus),i.on(i.menubutton_,"blur",i.handleblur),i.on("keydown",i.handlesubmenukeypress),i}return de(e,t),e.prototype.update=function(){var t=this.createmenu();this.menu&&this.removechild(this.menu),this.menu=t,this.addchild(t),this.buttonpressed_=!1,this.menubutton_.el_.setattribute("aria-expanded","false"),this.items&&this.items.length<=this.hidethreshold_?this.hide():this.show()},e.prototype.createmenu=function(){var t=new yi(this.player_,{menubutton:this});if(this.hidethreshold_=0,this.options_.title){var e=f("li",{classname:"vjs-menu-title",innerhtml:$(this.options_.title),tabindex:-1});this.hidethreshold_+=1,t.children_.unshift(e),y(e,t.contentel())}if(this.items=this.createitems(),this.items)for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:this.menubutton_.el();return this.menubutton_.controltext(t,e)},e.prototype.handleclick=function(t){this.one(this.menu.contentel(),"mouseleave",ln(this,function(t){this.unpressbutton(),this.el_.blur()})),this.buttonpressed_?this.unpressbutton():this.pressbutton()},e.prototype.focus=function(){this.menubutton_.focus()},e.prototype.blur=function(){this.menubutton_.blur()},e.prototype.handlefocus=function(){u(ce,"keydown",ln(this,this.handlekeypress))},e.prototype.handleblur=function(){z(ce,"keydown",ln(this,this.handlekeypress))},e.prototype.handlekeypress=function(t){27===t.which||9===t.which?(this.buttonpressed_&&this.unpressbutton(),9!==t.which&&(t.preventdefault(),this.menubutton_.el_.focus())):38!==t.which&&40!==t.which||this.buttonpressed_||(this.pressbutton(),t.preventdefault())},e.prototype.handlesubmenukeypress=function(t){27!==t.which&&9!==t.which||(this.buttonpressed_&&this.unpressbutton(),9!==t.which&&(t.preventdefault(),this.menubutton_.el_.focus()))},e.prototype.pressbutton=function(){this.enabled_&&(this.buttonpressed_=!0,this.menu.lockshowing(),this.menubutton_.el_.setattribute("aria-expanded","true"),this.menu.focus())},e.prototype.unpressbutton=function(){this.enabled_&&(this.buttonpressed_=!1,this.menu.unlockshowing(),this.menubutton_.el_.setattribute("aria-expanded","false"))},e.prototype.disable=function(){this.unpressbutton(),this.enabled_=!1,this.addclass("vjs-disabled"),this.menubutton_.disable()},e.prototype.enable=function(){this.enabled_=!0,this.removeclass("vjs-disabled"),this.menubutton_.enable()},e}(bn);bn.registercomponent("menubutton",gi);var mi=function(t){function e(n,r){ie(this,e);var i=r.tracks,o=le(this,t.call(this,n,r));if(o.items.length<=1&&o.hide(),!i)return le(o);var s=ln(o,o.update);return i.addeventlistener("removetrack",s),i.addeventlistener("addtrack",s),o.player_.on("ready",s),o.player_.on("dispose",function(){i.removeeventlistener("removetrack",s),i.removeeventlistener("addtrack",s)}),o}return de(e,t),e}(gi);bn.registercomponent("trackbutton",mi);var _i=function(t){function e(n,r){ie(this,e);var i=le(this,t.call(this,n,r));return i.selectable=r.selectable,i.selected(r.selected),i.selectable?i.el_.setattribute("role","menuitemcheckbox"):i.el_.setattribute("role","menuitem"),i}return de(e,t),e.prototype.createel=function(e,n,i){return this.noniconcontrol=!0,t.prototype.createel.call(this,"li",r({classname:"vjs-menu-item",innerhtml:''+this.localize(this.options_.label)+"",tabindex:-1},n),i)},e.prototype.handleclick=function(t){this.selected(!0)},e.prototype.selected=function(t){this.selectable&&(t?(this.addclass("vjs-selected"),this.el_.setattribute("aria-checked","true"),this.controltext(", selected")):(this.removeclass("vjs-selected"),this.el_.setattribute("aria-checked","false"),this.controltext(" ")))},e}(wr);bn.registercomponent("menuitem",_i);var bi=function(t){function e(n,r){ie(this,e);var i=r.track,o=n.texttracks();r.label=i.label||i.language||"unknown",r.selected="showing"===i.mode;var s=le(this,t.call(this,n,r));s.track=i;var a=ln(s,s.handletrackschange),l=ln(s,s.handleselectedlanguagechange);if(n.on(["loadstart","texttrackchange"],a),o.addeventlistener("change",a),o.addeventlistener("selectedlanguagechange",l),s.on("dispose",function(){o.removeeventlistener("change",a),o.removeeventlistener("selectedlanguagechange",l)}),void 0===o.onchange){var c=void 0;s.on(["tap","click"],function(){if("object"!==me(ie.event))try{c=new ie.event("change")}catch(t){}c||(c=ce.createevent("event"),c.initevent("change",!0,!0)),o.dispatchevent(c)})}return s}return de(e,t),e.prototype.handleclick=function(e){var n=this.track.kind,r=this.track.kinds,i=this.player_.texttracks();if(r||(r=[n]),t.prototype.handleclick.call(this,e),i)for(var o=0;o-1?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled")}},e.prototype.handletrackschange=function(t){this.selected("showing"===this.track.mode)},e.prototype.handleselectedlanguagechange=function(t){if("showing"===this.track.mode){var e=this.player_.cache_.selectedlanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedlanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},e}(_i);bn.registercomponent("texttrackmenuitem",bi);var ti=function(t){function e(n,r){ie(this,e),r.track={player:n,kind:r.kind,kinds:r.kinds,default:!1,mode:"disabled"},r.kinds||(r.kinds=[r.kind]),r.label?r.track.label=r.label:r.track.label=r.kinds.join(" and ")+" off",r.selectable=!0;var i=le(this,t.call(this,n,r));return i.selected(!0),i}return de(e,t),e.prototype.handletrackschange=function(t){for(var e=this.player().texttracks(),n=!0,r=0,i=e.length;r-1&&"showing"===o.mode){n=!1;break}}this.selected(n)},e.prototype.handleselectedlanguagechange=function(t){for(var e=this.player().texttracks(),n=!0,r=0,i=e.length;r-1&&"showing"===o.mode){n=!1;break}}n&&(this.player_.cache_.selectedlanguage={enabled:!1})},e}(bi);bn.registercomponent("offtexttrackmenuitem",ti);var ci=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ie(this,e),r.tracks=n.texttracks(),le(this,t.call(this,n,r))}return de(e,t),e.prototype.createitems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bi,n=void 0;this.label_&&(n=this.label_+" off"),t.push(new ti(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hidethreshold_+=1;var r=this.player_.texttracks();array.isarray(this.kinds_)||(this.kinds_=[this.kind_]);for(var i=0;i-1){var s=new e(this.player_,{track:o,selectable:!0});s.addclass("vjs-"+o.kind+"-menu-item"),t.push(s)}}return t},e}(mi);bn.registercomponent("texttrackbutton",ci);var ki=function(t){function e(n,r){ie(this,e);var i=r.track,o=r.cue,s=n.currenttime();r.selectable=!0,r.label=o.text,r.selected=o.starttime<=s&&s=0;e--){var n=t[e];if(n.kind===this.kind_)return n}},e.prototype.getmenucaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize($(this.kind_))},e.prototype.createmenu=function(){return this.options_.title=this.getmenucaption(),t.prototype.createmenu.call(this)},e.prototype.createitems=function(){var t=[];if(!this.track_)return t;var e=this.track_.cues;if(!e)return t;for(var n=0,r=e.length;n