UNPKG

@screwtopmedia/cdf-ng-media

Version:

Angular module for displaying media assets (images, videos)

95 lines (62 loc) 132 kB
/*! JW Player version 8.3.2 Copyright (c) 2018, JW Player, All Rights Reserved https://github.com/jwplayer/jwplayer/blob/v8.3.2/README.md This source code and its use and distribution is subject to the terms and conditions of the applicable license agreement. https://www.jwplayer.com/tos/ This product includes portions of other software. For the full text of licenses, see below: JW Player Third Party Software Notices and/or Additional Terms and Conditions ************************************************************************************************** The following software is used under Apache License 2.0 ************************************************************************************************** vtt.js v0.13.0 Copyright (c) 2018 Mozilla (http://mozilla.org) https://github.com/mozilla/vtt.js/blob/v0.13.0/LICENSE * * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ************************************************************************************************** The following software is used under MIT license ************************************************************************************************** Underscore.js v1.6.0 Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative https://github.com/jashkenas/underscore/blob/1.6.0/LICENSE Backbone backbone.events.js v1.1.2 Copyright (c) 2010-2014 Jeremy Ashkenas, DocumentCloud https://github.com/jashkenas/backbone/blob/1.1.2/LICENSE Promise Polyfill v7.1.1 Copyright (c) 2014 Taylor Hakes and Forbes Lindesay https://github.com/taylorhakes/promise-polyfill/blob/v7.1.1/LICENSE can-autoplay.js v3.0.0 Copyright (c) 2017 video-dev https://github.com/video-dev/can-autoplay/blob/v3.0.0/LICENSE * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ************************************************************************************************** The following software is used under W3C license ************************************************************************************************** Intersection Observer v0.5.0 Copyright (c) 2016 Google Inc. (http://google.com) https://github.com/w3c/IntersectionObserver/blob/v0.5.0/LICENSE.md * * * W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE Status: This license takes effect 13 May, 2015. This work is being provided by the copyright holders under the following license. License By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications: The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included. Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)." Disclaimers THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders. */ (window.webpackJsonpjwplayer=window.webpackJsonpjwplayer||[]).push([[0],[,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var i=n(0),o=n(18),a=n(4),r=n(5),l=n(8),s=n(29),c=n(47),u=void 0;function w(e){return u||(u=new DOMParser),u.parseFromString(e,"image/svg+xml").documentElement}var p=function(e,t,n,i){var o=document.createElement("div");return o.className="jw-icon jw-icon-inline jw-button-color jw-reset "+e,o.setAttribute("role","button"),o.setAttribute("tabindex","0"),n&&o.setAttribute("aria-label",n),o.style.display="none",t&&new c.a(o).on("click tap enter",function(e){t(e)}),o.addEventListener("mousedown",function(e){e.preventDefault()}),i&&Array.prototype.forEach.call(i,function(e){"string"==typeof e?o.appendChild(w(e)):o.appendChild(e)}),{element:function(){return o},toggle:function(e){e?this.show():this.hide()},show:function(){o.style.display=""},hide:function(){o.style.display="none"}}},d=n(83),j=n.n(d),h=n(82),f=n.n(h),g=n(81),v=n.n(g),m=n(80),y=n.n(m),b=n(79),x=n.n(b),k=n(78),C=n.n(k),E=n(77),L=n.n(E),T=n(76),O=n.n(T),S=n(75),M=n.n(S),z=n(74),B=n.n(z),_=n(73),H=n.n(_),A=n(72),I=n.n(A),P=n(71),V=n.n(P),N=n(70),U=n.n(N),D=n(69),R=n.n(D),q=n(68),F=n.n(q),W=n(67),J=n.n(W),Z=n(66),X=n.n(Z),K=n(65),Y=n.n(K),Q=n(64),G=n.n(Q),$=n(63),ee=n.n($),te=n(62),ne=n.n(te),ie=n(61),oe=n.n(ie),ae=null;function re(e){var t=ue().querySelector(se(e));return t?ce(t):null}function le(e){var t=ue().querySelectorAll(e.split(",").map(se).join(","));return Array.prototype.map.call(t,function(e){return ce(e)})}function se(e){return".jw-svg-icon-"+e}function ce(e){return e.cloneNode(!0)}function ue(){return ae||(ae=w("<xml>"+j.a+f.a+v.a+y.a+x.a+C.a+L.a+O.a+M.a+B.a+H.a+I.a+V.a+U.a+R.a+F.a+J.a+X.a+Y.a+G.a+ee.a+ne.a+oe.a+"</xml>")),ae}var we=n(19),pe=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var de={};var je=function(){function e(t,n,i,o,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var r=document.createElement("div");r.className="jw-icon jw-icon-inline jw-button-color jw-reset "+(a||""),r.setAttribute("button",o),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),n&&r.setAttribute("aria-label",n);var l=void 0;t&&"<svg"===t.substring(0,4)?l=function(e){if(!de[e]){var t=Object.keys(de);t.length>10&&delete de[t[0]];var n=w(e);de[e]=n}return de[e].cloneNode(!0)}(t):((l=document.createElement("div")).className="jw-icon jw-button-image jw-button-color jw-reset",t&&Object(we.d)(l,{backgroundImage:"url("+t+")"})),r.appendChild(l),new c.a(r).on("click tap enter",i,this),r.addEventListener("mousedown",function(e){e.preventDefault()}),this.id=o,this.buttonElement=r}return pe(e,[{key:"element",value:function(){return this.buttonElement}},{key:"toggle",value:function(e){e?this.show():this.hide()}},{key:"show",value:function(){this.buttonElement.style.display=""}},{key:"hide",value:function(){this.buttonElement.style.display="none"}}]),e}(),he=function(e,t){e&&t&&(e.setAttribute("aria-label",t),e.setAttribute("role","button"),e.setAttribute("tabindex","0"))},fe=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var ge=function(e){var t=l.a.bounds(e),n=window.pageXOffset;return n&&o.OS.android&&document.body.parentElement.getBoundingClientRect().left>=0&&(t.left-=n,t.right-=n),t},ve=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this.className=t+" jw-background-color jw-reset",this.orientation=n,this.dragStartListener=this.dragStart.bind(this),this.dragMoveListener=this.dragMove.bind(this),this.dragEndListener=this.dragEnd.bind(this),this.tapListener=this.tap.bind(this)}return fe(e,[{key:"setup",value:function(){this.el=l.a.createElement(function(){return'<div class="'+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")+" "+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+' jw-reset" aria-hidden="true"><div class="jw-slider-container jw-reset"><div class="jw-rail jw-reset"></div><div class="jw-buffer jw-reset"></div><div class="jw-progress jw-reset"></div><div class="jw-knob jw-reset"></div></div></div>'}(this.className,"jw-slider-"+this.orientation)),this.elementRail=this.el.getElementsByClassName("jw-slider-container")[0],this.elementBuffer=this.el.getElementsByClassName("jw-buffer")[0],this.elementProgress=this.el.getElementsByClassName("jw-progress")[0],this.elementThumb=this.el.getElementsByClassName("jw-knob")[0],this.userInteract=new c.a(this.element(),{preventScrolling:!0}),this.userInteract.on("dragStart",this.dragStartListener),this.userInteract.on("drag",this.dragMoveListener),this.userInteract.on("dragEnd",this.dragEndListener),this.userInteract.on("tap click",this.tapListener)}},{key:"dragStart",value:function(){this.trigger("dragStart"),this.railBounds=ge(this.elementRail)}},{key:"dragEnd",value:function(e){this.dragMove(e),this.trigger("dragEnd")}},{key:"dragMove",value:function(e){var t=this.railBounds=this.railBounds?this.railBounds:ge(this.elementRail),n=void 0,i=void 0;return i="horizontal"===this.orientation?(n=e.pageX)<t.left?0:n>t.right?100:100*l.a.between((n-t.left)/t.width,0,1):(n=e.pageY)>=t.bottom?0:n<=t.top?100:100*l.a.between((t.height-(n-t.top))/t.height,0,1),this.render(i),this.update(i),!1}},{key:"tap",value:function(e){this.railBounds=ge(this.elementRail),this.dragMove(e)}},{key:"limit",value:function(e){return e}},{key:"update",value:function(e){this.trigger("update",{percentage:e})}},{key:"render",value:function(e){e=Math.max(0,Math.min(e,100)),"horizontal"===this.orientation?(this.elementThumb.style.left=e+"%",this.elementProgress.style.width=e+"%"):(this.elementThumb.style.bottom=e+"%",this.elementProgress.style.height=e+"%")}},{key:"updateBuffer",value:function(e){this.elementBuffer.style.width=e+"%"}},{key:"element",value:function(){return this.el}}]),e}(),me=n(7),ye=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var be=function(){function e(t,n,o,a){var l=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this.el=document.createElement("div");var s="jw-icon jw-icon-tooltip "+t+" jw-button-color jw-reset";o||(s+=" jw-hidden"),he(this.el,n),this.el.className=s,this.container=document.createElement("div"),this.container.className="jw-overlay jw-reset",this.openClass="jw-open",this.componentType="tooltip",this.el.appendChild(this.container),a&&a.length>0&&Array.prototype.forEach.call(a,function(e){"string"==typeof e?l.el.appendChild(w(e)):l.el.appendChild(e)})}return ye(e,[{key:"addContent",value:function(e){this.content&&this.removeContent(),this.content=e,this.container.appendChild(e)}},{key:"removeContent",value:function(){this.content&&(this.container.removeChild(this.content),this.content=null)}},{key:"hasContent",value:function(){return!!this.content}},{key:"element",value:function(){return this.el}},{key:"openTooltip",value:function(e){this.trigger("open-"+this.componentType,e,{isOpen:!0}),this.isOpen=!0,Object(me.m)(this.el,this.openClass,this.isOpen)}},{key:"closeTooltip",value:function(e){this.trigger("close-"+this.componentType,e,{isOpen:!1}),this.isOpen=!1,Object(me.m)(this.el,this.openClass,this.isOpen)}},{key:"toggleOpenState",value:function(e){this.isOpen?this.closeTooltip(e):this.openTooltip(e)}}]),e}(),xe=n(48),ke=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Ce=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.time=t,this.text=n,this.el=document.createElement("div"),this.el.className="jw-cue jw-reset"}return ke(e,[{key:"align",value:function(e){if("%"===this.time.toString().slice(-1))this.pct=this.time;else{var t=this.time/e*100;this.pct=t+"%"}this.el.style.left=this.pct}}]),e}(),Ee={loadChapters:function(e){l.a.ajax(e,this.chaptersLoaded.bind(this),this.chaptersFailed,{plainText:!0})},chaptersLoaded:function(e){var t=this,n=Object(xe.a)(e.responseText);Array.isArray(n)&&(n.forEach(function(e){return t.addCue(e)}),this.drawCues())},chaptersFailed:function(){},addCue:function(e){this.cues.push(new Ce(e.begin,e.text))},drawCues:function(){var e=this,t=this._model.get("duration");!t||t<=0||this.cues.forEach(function(n){n.align(t),n.el.addEventListener("mouseover",function(){e.activeCue=n}),n.el.addEventListener("mouseout",function(){e.activeCue=null}),e.elementRail.appendChild(n.el)})},resetChapters:function(){this.cues.forEach(function(e){e.el.parentNode&&e.el.parentNode.removeChild(e.el)}),this.cues=[]}};var Le={loadThumbnails:function(e){e&&(this.vttPath=e.split("?")[0].split("/").slice(0,-1).join("/"),this.individualImage=null,l.a.ajax(e,this.thumbnailsLoaded.bind(this),this.thumbnailsFailed.bind(this),{plainText:!0}))},thumbnailsLoaded:function(e){var t=Object(xe.a)(e.responseText);Array.isArray(t)&&(t.forEach(function(e){this.thumbnails.push(new function(e){this.begin=e.begin,this.end=e.end,this.img=e.text}(e))},this),this.drawCues())},thumbnailsFailed:function(){},chooseThumbnail:function(e){var t=Object(i.B)(this.thumbnails,{end:e},Object(i.z)("end"));t>=this.thumbnails.length&&(t=this.thumbnails.length-1);var n=this.thumbnails[t].img;return n.indexOf("://")<0&&(n=this.vttPath?this.vttPath+"/"+n:n),n},loadThumbnail:function(e){var t=this.chooseThumbnail(e),n={margin:"0 auto",backgroundPosition:"0 0"};if(t.indexOf("#xywh")>0)try{var o=/(.+)#xywh=(\d+),(\d+),(\d+),(\d+)/.exec(t);t=o[1],n.backgroundPosition=-1*o[2]+"px "+-1*o[3]+"px",n.width=o[4],this.timeTip.setWidth(+n.width),n.height=o[5]}catch(e){return}else this.individualImage||(this.individualImage=new Image,this.individualImage.onload=Object(i.b)(function(){this.individualImage.onload=null,this.timeTip.image({width:this.individualImage.width,height:this.individualImage.height}),this.timeTip.setWidth(this.individualImage.width)},this),this.individualImage.src=t);return n.backgroundImage='url("'+t+'")',n},showThumbnail:function(e){this._model.get("containerWidth")<=420||this.thumbnails.length<1||this.timeTip.image(this.loadThumbnail(e))},resetThumbnails:function(){this.timeTip.image({backgroundImage:"",width:0,height:0}),this.thumbnails=[]}},Te=function e(t,n,i){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(i):void 0},Oe=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function Se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Me(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function ze(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Be=function(e){function t(){return Se(this,t),Me(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return ze(t,be),Oe(t,[{key:"setup",value:function(){this.text=document.createElement("span"),this.text.className="jw-text jw-reset",this.img=document.createElement("div"),this.img.className="jw-time-thumb jw-reset",this.containerWidth=0,this.textLength=0,this.dragJustReleased=!1;var e=document.createElement("div");e.className="jw-time-tip jw-reset",e.appendChild(this.img),e.appendChild(this.text),this.addContent(e)}},{key:"image",value:function(e){l.a.style(this.img,e)}},{key:"update",value:function(e){this.text.textContent=e}},{key:"getWidth",value:function(){return this.containerWidth||this.setWidth(),this.containerWidth}},{key:"setWidth",value:function(e){e?this.containerWidth=e+16:this.container&&(this.containerWidth=l.a.bounds(this.container).width+16)}},{key:"resetWidth",value:function(){this.containerWidth=0}}]),t}();var _e=function(e){function t(e,n){Se(this,t);var o=Me(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"jw-slider-time","horizontal"));return o._model=e,o._api=n,o.timeTip=new Be("jw-tooltip-time",null,!0),o.timeTip.setup(),o.cues=[],o.seekThrottled=Object(i.C)(o.performSeek,400),o.mobileHoverDistance=5,o.setup(),o}return ze(t,ve),Oe(t,[{key:"setup",value:function(){Te(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setup",this).apply(this,arguments),this._model.on("change:duration",this.onDuration,this).on("change:cues",this.addCues,this).change("playlistItem",this.onPlaylistItem,this).change("position",this.onPosition,this).change("buffer",this.onBuffer,this).change("streamType",this.onStreamType,this),this.elementRail.appendChild(this.timeTip.element()),this.elementUI=new c.a(this.el,{useHover:!0,useMove:!0}).on("drag move over",this.showTimeTooltip.bind(this),this).on("dragEnd out",this.hideTimeTooltip.bind(this),this)}},{key:"update",value:function(e){this.seekTo=e,this.seekThrottled(),Te(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"update",this).apply(this,arguments)}},{key:"dragStart",value:function(){this._model.set("scrubbing",!0),Te(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dragStart",this).apply(this,arguments)}},{key:"dragEnd",value:function(){Te(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dragEnd",this).apply(this,arguments),this._model.set("scrubbing",!1)}},{key:"onBuffer",value:function(e,t){this.updateBuffer(t)}},{key:"onPosition",value:function(e,t){this.updateTime(t,e.get("duration"))}},{key:"onDuration",value:function(e,t){this.updateTime(e.get("position"),t),this.drawCues()}},{key:"onStreamType",value:function(e,t){this.streamType=t}},{key:"updateTime",value:function(e,t){var n=0;if(t)if("DVR"===this.streamType){var i=this._model.get("dvrSeekLimit"),o=t+i;n=(o-(e+i))/o*100}else"VOD"!==this.streamType&&this.streamType||(n=e/t*100);this.render(n)}},{key:"onPlaylistItem",value:function(e,t){if(t){this.reset(),this.addCues(e,e.get("cues"));var n=t.tracks;Object(i.g)(n,function(e){e&&e.kind&&"thumbnails"===e.kind.toLowerCase()?this.loadThumbnails(e.file):e&&e.kind&&"chapters"===e.kind.toLowerCase()&&this.loadChapters(e.file)},this)}}},{key:"performSeek",value:function(){var e=this.seekTo,t=this._model.get("duration"),n=void 0;if(0===t)this._api.play({reason:"interaction"});else if("DVR"===this.streamType){var i=this._model.get("seekRange"),o=this._model.get("dvrSeekLimit");n=i.start+(-t-o)*e/100,this._api.seek(n,{reason:"interaction"})}else n=e/100*t,this._api.seek(Math.min(n,t-.25),{reason:"interaction"})}},{key:"showTimeTooltip",value:function(e){var t=this,n=this._model.get("duration");if(0!==n){var i=this._model.get("containerWidth"),o=l.a.bounds(this.elementRail),a=e.pageX?e.pageX-o.left:e.x,r=(a=l.a.between(a,0,o.width))/o.width,s=n*r;if(n<0)s=(n+=this._model.get("dvrSeekLimit"))-(s=n*r);var u=void 0;if("touch"===Object(c.b)(e.sourceEvent)&&(this.activeCue=this.cues.reduce(function(e,n){return Math.abs(a-parseInt(n.pct)/100*o.width)<t.mobileHoverDistance?n:e},void 0)),this.activeCue)u=this.activeCue.text;else{u=l.a.timeFormat(s,!0),n<0&&s>-1&&(u="Live")}var w=this.timeTip;w.update(u),this.textLength!==u.length&&(this.textLength=u.length,w.resetWidth()),this.showThumbnail(s),l.a.addClass(w.el,"jw-open");var p=w.getWidth(),d=o.width/100,j=i-o.width,h=0;p>j&&(h=(p-j)/(200*d));var f=100*Math.min(1-h,Math.max(h,r)).toFixed(3);l.a.style(w.el,{left:f+"%"})}}},{key:"hideTimeTooltip",value:function(){l.a.removeClass(this.timeTip.el,"jw-open")}},{key:"addCues",value:function(e,t){var n=this;this.resetChapters(),t&&t.length&&(t.forEach(function(e){n.addCue(e)}),this.drawCues())}},{key:"reset",value:function(){this.resetThumbnails(),this.timeTip.resetWidth(),this.textLength=0}}]),t}();Object(i.h)(_e.prototype,Ee,Le);var He=_e,Ae=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Ie=function(e){function t(e,n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n,i,!0,o));return a._model=e,a.volumeSlider=new ve("jw-slider-volume jw-volume-tip","vertical"),a.volumeSlider.setup(),a.volumeSlider.element().classList.remove("jw-background-color"),a.addContent(a.volumeSlider.element()),a.volumeSlider.on("update",function(e){this.trigger("update",e)},a),new c.a(a.el,{useHover:!0,directSelect:!0,useFocus:!0}).on("click enter",a.toggleValue,a).on("tap",a.toggleOpenState,a).on("over",a.openTooltip,a).on("out",a.closeTooltip,a),a._model.on("change:volume",a.onVolume,a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,be),Ae(t,[{key:"toggleValue",value:function(){this.trigger("toggleValue")}}]),t}();function Pe(e,t,n,i){var o=document.createElement("div");o.className="jw-reset jw-tooltip jw-tooltip-"+t;var a=document.createElement("div");a.className="jw-text",a.textContent=n,o.appendChild(a),e.appendChild(o);var r={open:function(){r.touchEvent||(o.setAttribute("aria-expanded","true"),Object(me.a)(o,"jw-open"),i&&i())},close:function(){r.touchEvent||(o.setAttribute("aria-expanded","false"),Object(me.j)(o,"jw-open"))},setText:function(e){o.querySelector(".jw-text").textContent=e}};return e.addEventListener("mouseover",r.open),e.addEventListener("focus",r.open),e.addEventListener("blur",r.close),e.addEventListener("mouseout",r.close),e.addEventListener("touchstart",function(){r.touchEvent=!0},{passive:!0}),r}var Ve=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function Ne(e,t){var n=document.createElement("div");return n.className="jw-icon jw-icon-inline jw-text jw-reset "+e,t&&n.setAttribute("role",t),n}function Ue(e){var t=document.createElement("div");return t.className="jw-reset "+e,t}function De(e,t){return e.filter(function(e){return!t.some(function(t){return t.id+t.btnClass===e.id+e.btnClass&&e.callback===t.callback})})}var Re=function(e,t){t.forEach(function(t){t.element&&(t=t.element()),e.appendChild(t)})},qe=function(){function e(t,n){var s=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this._api=t,this._model=n,this._isMobile=o.OS.mobile;var u=n.get("localization"),w=new He(n,t),d=void 0,j=void 0,h=u.volume;if(!(n.get("sdkplatform")||o.OS.iOS&&o.OS.version.major<10)){var f=le("volume-0,volume-100");j=p("jw-icon-volume",function(){t.setMute()},h,f)}this._isMobile||(d=new Ie(n,"jw-icon-volume",h,le("volume-0,volume-50,volume-100")));var g=p("jw-icon-next",function(){t.next()},u.next,le("next")),v=p("jw-icon-settings jw-settings-submenu-button",function(e){s.trigger("settingsInteraction","quality",!0,e)},u.settings,le("settings"));v.element().setAttribute("aria-haspopup","true");var m=p("jw-icon-cc jw-settings-submenu-button",function(e){s.trigger("settingsInteraction","captions",!1,e)},u.cc,le("cc-off,cc-on"));m.element().setAttribute("aria-haspopup","true");var y=p("jw-text-live",function(){s.goToLiveEdge()},u.liveBroadcast);y.element().textContent=u.liveBroadcast;var b,x,k,C=this.elements={alt:(b="jw-text-alt",x="status",k=document.createElement("span"),k.className="jw-text jw-reset "+b,x&&k.setAttribute("role",x),k),play:p("jw-icon-playback",function(){t.playToggle({reason:"interaction"})},u.play,le("play,pause,stop")),rewind:p("jw-icon-rewind",function(){s.rewind()},u.rewind,le("rewind")),live:y,next:g,elapsed:Ne("jw-text-elapsed","timer"),countdown:Ne("jw-text-countdown","timer"),time:w,duration:Ne("jw-text-duration","timer"),mute:j,volumetooltip:d,cast:function(e,t){if(o.Browser.safari){var n=p("jw-icon-airplay jw-off",e,t.airplay,le("airplay-off,airplay-on"));return Pe(n.element(),"airplay",t.airplay),n}if(o.Browser.chrome&&!o.OS.iOS){var i=document.createElement("button","google-cast-button");i.setAttribute("type","button"),i.setAttribute("tabindex","-1");var a=document.createElement("div");return a.className="jw-reset jw-icon jw-icon-inline jw-icon-cast jw-button-color",a.style.display="none",a.style.cursor="pointer",a.appendChild(i),he(a,t.cast),Pe(a,"chromecast",t.cast),{element:function(){return a},toggle:function(e){e?this.show():this.hide()},show:function(){a.style.display=""},hide:function(){a.style.display="none"},button:i}}}(function(){t.castToggle()},u),fullscreen:p("jw-icon-fullscreen",function(){t.setFullscreen()},u.fullscreen,le("fullscreen-off,fullscreen-on")),spacer:Ue("jw-spacer"),buttonContainer:Ue("jw-button-container"),settingsButton:v,captionsButton:m},E=Pe(m.element(),"captions",u.cc),L=function(e){var t=e.get("captionsList")[e.get("captionsIndex")],n=u.cc;t&&"Off"!==t.label&&(n=t.label),E.setText(n)},T=Pe(C.next.element(),"next",u.nextUp,function(){var e=n.get("nextUp");s.trigger("nextShown",{mode:e.mode,ui:"nextup",itemsShown:[e],feedData:e.feedData,reason:"hover"})});Pe(C.rewind.element(),"rewind",u.rewind),Pe(C.settingsButton.element(),"settings",u.settings),Pe(C.fullscreen.element(),"fullscreen",u.fullscreen);var O=[C.play,C.rewind,C.next,C.volumetooltip,C.mute,C.alt,C.live,C.elapsed,C.countdown,C.duration,C.spacer,C.cast,C.captionsButton,C.settingsButton,C.fullscreen].filter(function(e){return e}),S=[C.time,C.buttonContainer].filter(function(e){return e}),M=this.menus=[C.volumetooltip].filter(function(e){return e});this.el=document.createElement("div"),this.el.className="jw-controlbar jw-reset",Re(C.buttonContainer,O),Re(this.el,S);var z=n.get("logo");z&&"control-bar"===z.position&&this.addLogo(z),C.play.show(),C.fullscreen.show(),C.mute&&C.mute.show(),n.change("volume",this.onVolume,this),n.change("mute",this.onMute,this),n.change("state",this.onState,this),n.change("duration",this.onDuration,this),n.change("position",this.onElapsed,this),n.change("fullscreen",this.onFullscreen,this),n.change("streamType",this.onStreamTypeChange,this),n.change("dvrLive",function(e,t){l.a.toggleClass(s.elements.live.element(),"jw-dvr-live",!1===t)},this),n.change("altText",this.setAltText,this),n.change("customButtons",this.updateButtons,this),n.on("change:captionsIndex",L,this),n.on("change:captionsList",L,this),n.change("nextUp",function(e,t){var n=u.nextUp;t&&t.title&&(n+=": "+t.title),T.setText(n),C.next.toggle(!!t)}),n.change("audioMode",this.onAudioMode,this),C.cast&&(n.change("castAvailable",this.onCastAvailable,this),n.change("castActive",this.onCastActive,this)),C.volumetooltip&&(C.volumetooltip.on("update",function(e){var t=e.percentage;this._api.setVolume(t)},this),C.volumetooltip.on("toggleValue",function(){this._api.setMute()},this)),C.cast&&C.cast.button&&new c.a(C.cast.element()).on("click tap enter",function(e){"click"!==e.type&&C.cast.button.click(),this._model.set("castClicked",!0)},this),new c.a(C.duration).on("click tap enter",function(){if("DVR"===this._model.get("streamType")){var e=this._model.get("position"),t=this._model.get("dvrSeekLimit");this._api.seek(Math.max(-t,e),{reason:"interaction"})}},this),new c.a(this.el).on("click tap drag",function(){this.trigger(a.Ma)},this),Object(i.g)(M,function(e){e.on("open-tooltip",this.closeMenus,this)},this)}return Ve(e,[{key:"onVolume",value:function(e,t){this.renderVolume(e.get("mute"),t)}},{key:"onMute",value:function(e,t){this.renderVolume(t,e.get("volume"))}},{key:"renderVolume",value:function(e,t){this.elements.mute&&(l.a.toggleClass(this.elements.mute.element(),"jw-off",e),l.a.toggleClass(this.elements.mute.element(),"jw-full",!e)),this.elements.volumetooltip&&(this.elements.volumetooltip.volumeSlider.render(e?0:t),l.a.toggleClass(this.elements.volumetooltip.element(),"jw-off",e),l.a.toggleClass(this.elements.volumetooltip.element(),"jw-full",t>=75&&!e))}},{key:"onCastAvailable",value:function(e,t){this.elements.cast.toggle(t)}},{key:"onCastActive",value:function(e,t){this.elements.fullscreen.toggle(!t),this.elements.cast.button&&l.a.toggleClass(this.elements.cast.button,"jw-off",!t)}},{key:"onElapsed",value:function(e,t){var n=void 0,i=void 0,o=e.get("duration");if("DVR"===e.get("streamType")){var a=Math.ceil(t),r=this._model.get("dvrSeekLimit");n=i=a>=-r?"":"-"+l.a.timeFormat(-(t+r)),e.set("dvrLive",a>=-r)}else n=l.a.timeFormat(t),i=l.a.timeFormat(o-t);this.elements.elapsed.textContent=n,this.elements.countdown.textContent=i}},{key:"onDuration",value:function(e,t){this.elements.duration.textContent=l.a.timeFormat(Math.abs(t))}},{key:"onFullscreen",value:function(e,t){l.a.toggleClass(this.elements.fullscreen.element(),"jw-off",t),this.elements.play.element().focus()}},{key:"onAudioMode",value:function(e,t){var n=this.elements.time.element();t?this.elements.buttonContainer.insertBefore(n,this.elements.elapsed):Object(me.i)(this.el,n)}},{key:"element",value:function(){return this.el}},{key:"setAltText",value:function(e,t){this.elements.alt.textContent=t}},{key:"closeMenus",value:function(e){Object(i.g)(this.menus,function(t){e&&e.target===t.el||t.closeTooltip(e)})}},{key:"rewind",value:function(){var e=this._model.get("position"),t=this._model.get("duration"),n=e-10,i=0;"DVR"===this._model.get("streamType")&&(i=t),this._api.seek(Math.max(n,i),{reason:"interaction"})}},{key:"onState",value:function(e,t){var n=e.get("localization"),i=n.play;t===a.Ja&&(i="LIVE"!==e.get("streamType")?n.pause:n.stop),this.elements.play.element().setAttribute("aria-label",i)}},{key:"onStreamTypeChange",value:function(e,t){var n="LIVE"===t,i="DVR"===t;this.elements.rewind.toggle(!n),this.elements.live.toggle(n||i),this.elements.live.element().setAttribute("tabindex",n?"-1":"0"),this.elements.duration.style.display=i?"none":"",this.onDuration(e,e.get("duration")),this.onState(e,e.get("state"))}},{key:"addLogo",value:function(e){var t=this.elements.buttonContainer,n=new je(e.file,"Logo",function(){e.link&&window.open(e.link,"_blank")},"logo","jw-logo-button");e.link||n.element().setAttribute("tabindex","-1"),t.insertBefore(n.element(),t.querySelector(".jw-spacer").nextSibling)}},{key:"goToLiveEdge",value:function(){if("DVR"===this._model.get("streamType")){var e=this._model.get("position"),t=this._model.get("dvrSeekLimit");this._api.seek(Math.max(-t,e),{reason:"interaction"})}}},{key:"updateButtons",value:function(e,t,n){if(t){var i=this.elements.buttonContainer,o=void 0,a=void 0;t!==n&&n?(o=De(t,n),a=De(n,t),this.removeButtons(i,a)):o=t;for(var r=o.length-1;r>=0;r--){var l=o[r],s=new je(l.img,l.tooltip,l.callback,l.id,l.btnClass);l.tooltip&&Pe(s.element(),l.id,l.tooltip);var c=void 0;"related"===s.id?c=this.elements.settingsButton.element():"share"===s.id?c=i.querySelector('[button="related"]')||this.elements.settingsButton.element():(c=this.elements.spacer.nextSibling)&&"logo"===c.getAttribute("button")&&(c=c.nextSibling),i.insertBefore(s.element(),c)}}}},{key:"removeButtons",value:function(e,t){for(var n=t.length;n--;){var i=e.querySelector('[button="'+t[n].id+'"]');i&&e.removeChild(i)}}},{key:"toggleCaptionsButtonState",value:function(e){var t=this.elements.captionsButton;t&&l.a.toggleClass(t.element(),"jw-off",!e)}}]),e}(),Fe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return'<div class="jw-display-icon-container jw-display-icon-'+e+' jw-reset"><div class="jw-icon jw-icon-'+e+' jw-button-color jw-reset" role="button" tabindex="0" aria-label="'+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+'"></div></div>'},We=function(e){return'<div class="jw-display jw-reset"><div class="jw-display-container jw-reset"><div class="jw-display-controls jw-reset">'+Fe("rewind",e.rewind)+Fe("display",e.playback)+Fe("next",e.next)+"</div></div></div>"},Je=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Ze=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=i,new c.a(this.el).on("click tap enter",function(){var e=t.get("position"),i=t.get("duration"),o=e-10,a=0;"DVR"===t.get("streamType")&&(a=i),n.seek(Math.max(o,a))})}return Je(e,[{key:"element",value:function(){return this.el}}]),e}(),Xe=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Ke=function(){function e(t,n,o){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a);var l=t.get("localization"),s=o.getElementsByClassName("jw-icon-display")[0],u=t.get("idleButton");o.style.cursor="pointer",this.icon=s,this.el=o,new c.a(this.el).on("click tap enter",function(e){a.trigger(e.type)}),t.on("change:state",function(e,t,n){var i=void 0;switch(t){case"buffering":i=l.buffer;break;case"playing":i=l.pause;break;case"idle":case"paused":i=l.playback;break;case"complete":i=l.replay;break;default:i=""}""!==i?s.setAttribute("aria-label",i):s.removeAttribute("aria-label"),a.toggleIdleClass(n,t,u)}),this.toggleIdleClass("","idle",u)}return Xe(e,[{key:"element",value:function(){return this.el}},{key:"toggleIdleClass",value:function(e,t,n){"stroke"!==n&&"fill"!==n&&"label"!==n||("idle"===e?Object(me.j)(this.icon,"jw-ab-idle-"+n):"idle"===t&&Object(me.a)(this.icon,"jw-ab-idle-"+n))}}]),e}(),Ye=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Qe=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new c.a(i).on("click tap enter",function(){n.next()}),t.change("nextUp",function(e,t){i.style.visibility=t?"":"hidden"}),this.el=i}return Ye(e,[{key:"element",value:function(){return this.el}}]),e}(),Ge=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var $e=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=l.a.createElement(We(t.get("localization")));var i=this.el.querySelector(".jw-display-controls"),o={};et("rewind",le("rewind"),Ze,i,o,t,n),et("display",le("play,pause,buffer,replay"),Ke,i,o,t,n),et("next",le("next"),Qe,i,o,t,n),this.container=i,this.buttons=o}return Ge(e,[{key:"element",value:function(){return this.el}}]),e}();function et(e,t,n,i,o,a,r){var l=i.querySelector(".jw-display-icon-"+e),s=i.querySelector(".jw-icon-"+e);t.forEach(function(e){s.appendChild(e)}),o[e]=new n(a,r,l)}var tt=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var nt=function(){function e(t,n,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this._model=t,this._api=n,this._playerElement=o,this.nextUpText=t.get("localization").nextUp,this.nextUpClose=t.get("localization").nextUpClose,this.state="tooltip",this.enabled=!1,this.shown=!1,this.reset()}return tt(e,[{key:"setup",value:function(e){this.container=e.createElement("div"),this.container.className="jw-nextup-container jw-reset";var t=l.a.createElement(function(){return'<div class="jw-nextup jw-background-color jw-reset"><div class="jw-nextup-tooltip jw-reset"><div class="jw-nextup-thumbnail jw-reset"></div><div class="jw-nextup-body jw-reset"><div class="jw-nextup-header jw-reset">'+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")+'</div><div class="jw-nextup-title jw-reset">'+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+'</div><div class="jw-nextup-duration jw-reset">'+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")+'</div></div></div><button type="button" class="jw-icon jw-nextup-close jw-reset" aria-label="'+(arguments.length>3&&void 0!==arguments[3]?arguments[3]:"")+'"></button></div>'}());t.querySelector(".jw-nextup-close").appendChild(re("close")),this.addContent(t),this.closeButton=this.content.querySelector(".jw-nextup-close"),this.closeButton.setAttribute("aria-label",this.nextUpClose),this.tooltip=this.content.querySelector(".jw-nextup-tooltip");var n=this._model,i=n.player;this.enabled=!1,n.on("change:nextUp",this.onNextUp,this),i.change("duration",this.onDuration,this),i.change("position",this.onElapsed,this),i.change("streamType",this.onStreamType,this),i.change("state",function(e,t){"complete"===t&&this.toggle(!1)},this),new c.a(this.closeButton,{directSelect:!0}).on("click tap enter",function(){this.nextUpSticky=!1,this.toggle(!1)},this),new c.a(this.tooltip).on("click tap",this.click,this)}},{key:"loadThumbnail",value:function(e){return this.nextUpImage=new Image,this.nextUpImage.onload=function(){this.nextUpImage.onload=null}.bind(this),this.nextUpImage.src=e,{backgroundImage:'url("'+e+'")'}}},{key:"click",value:function(){this.reset(),this._api.next()}},{key:"toggle",value:function(e,t){if(this.enabled&&(Object(me.m)(this.container,"jw-nextup-sticky",!!this.nextUpSticky),this.shown!==e)){this.shown=e,Object(me.m)(this.container,"jw-nextup-container-visible",e),Object(me.m)(this._playerElement,"jw-flag-nextup",e);var n=this._model.get("nextUp");e&&n&&this.trigger("nextShown",{mode:n.mode,ui:"nextup",itemsShown:[n],feedData:n.feedData,reason:t})}}},{key:"setNextUpItem",value:function(e){var t=this;setTimeout(function(){if(t.thumbnail=t.content.querySelector(".jw-nextup-thumbnail"),Object(me.m)(t.content,"jw-nextup-thumbnail-visible",!!e.image),e.image){var n=t.loadThumbnail(e.image);l.a.style(t.thumbnail,n)}t.header=t.content.querySelector(".jw-nextup-header"),t.header.innerText=t.nextUpText,t.title=t.content.querySelector(".jw-nextup-title");var i=e.title;if(t.title.innerText=i?l.a.createElement(i).textContent:"",e.duration){t.duration=t.content.querySelector(".jw-nextup-duration");var o=e.duration;t.duration.innerText=o?l.a.createElement(o).textContent:""}},500)}},{key:"onNextUp",value:function(e,t){this.reset(),t&&(this.enabled=!(!t.title&&!t.image),this.enabled&&(t.showNextUp||(this.nextUpSticky=!1,this.toggle(!1)),this.setNextUpItem(t)))}},{key:"onDuration",value:function(e,t){if(t){var n=l.a.seconds(e.get("nextupoffset")||-10);n<0&&(n+=t),this.offset=n}}},{key:"onElapsed",value:function(e,t){var n=this.nextUpSticky;if(this.enabled&&!1!==n){var i=t>=this.offset;i&&void 0===n?(this.nextUpSticky=i,this.toggle(i,"time")):!i&&n&&this.reset()}}},{key:"onStreamType",value:function(e,t){"VOD"!==t&&(this.nextUpSticky=!1,this.toggle(!1))}},{key:"element",value:function(){return this.container}},{key:"addContent",value:function(e){this.content&&this.removeContent(),this.content=e,this.container.appendChild(e)}},{key:"removeContent",value:function(){this.content&&(this.container.removeChild(this.content),this.content=null)}},{key:"reset",value:function(){this.nextUpSticky=void 0,this.toggle(!1)}},{key:"destroy",value:function(){this.off(),this._model.off(null,null,this)}}]),e}(),it=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments[2],i=arguments[3];return'<li class="jw-reset jw-rightclick-item '+(n?"jw-featured":"")+'"><a href="'+e+'" class="jw-rightclick-link jw-reset" target="_blank">'+(i?'<span class="jw-rightclick-logo jw-reset"></span>':"")+t+"</a></li>"},ot=function(e){return'<li class="jw-reset jw-rightclick-item"><button type="button" class="jw-reset jw-rightclick-link jw-info-overlay-item">'+e+"</button></li>"},at=n(24),rt=n(6),lt=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function st(e){var t=Object(me.e)(e),n=t.querySelector(".jw-rightclick-logo");return n&&n.appendChild(re("jwplayer-logo")),t}var ct=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.infoOverlay=t}return lt(e,[{key:"buildArray",value:function(){var e={items:[{title:'Powered by <span class="jw-reset">JW Player '+at.a.split("+")[0]+"</span>",featured:!0,showLogo:!0,link:"https://jwplayer.com/learn-more"}]},t=this.model.get("provider");if(t&&t.name.indexOf("flash")>=0){var n="Flash Version "+Object(rt.a)();e.items.push({title:n,link:"http://www.adobe.com/software/flash/about/"})}return e}},{key:"rightClick",value:function(e){return this.lazySetup(),!this.mouseOverContext&&(this.hideMenu(),this.showMenu(e),this.addHideMenuHandlers(),!1)}},{key:"getOffset",value:function(e){var t=Object(me.c)(this.playerElement),n=e.pageX-t.left,i=e.pageY-t.top;return this.model.get("touchMode")&&(i-=100),{x:n,y:i}}},{key:"showMenu",value:function(e){var t=this,n=this.getOffset(e);return this.el.style.left=n.x+"px",this.el.style.top=n.y+"px",this.outCount=0,Object(me.a)(this.playerElement,"jw-flag-rightclick-open"),Object(me.a)(this.el,"jw-open"),clearTimeout(this._menuTimeout),this._menuTimeout=setTimeout(function(){return t.hideMenu()},3e3),!1}},{key:"hideMenu",value:function(e){e&&this.el.contains(e.target)||(Object(me.j)(this.playerElement,"jw-flag-rightclick-open"),Object(me.j)(this.el,"jw-open"))}},{key:"lazySetup",value:function(){var e,t,n,i,o=this,a=(e=this.buildArray(),t=this.model.get("localization"),n=e.items,(i=(void 0===n?[]:n).map(function(e){return it(e.link,e.title,e.featured,e.showLogo)})).unshift(ot(t.videoInfo)),'<div class="jw-rightclick jw-reset"><ul class="jw-rightclick-list jw-reset">'+i.join("")+"</ul></div>");if(this.el){if(this.html!==a){this.html=a;var r=st(a);Object(me.g)(this.el);for(var l=r.childNodes.length;l--;)this.el.appendChild(r.firstChild)}}else this.html=a,this.el=st(this.html),this.layer.appendChild(this.el),this.hideMenuHandler=function(e){return o.hideMenu(e)},this.overHandler=function(){o.mouseOverContext=!0},this.outHandler=function(e){o.mouseOverContext=!1,e.relatedTarget&&!o.el.contains(e.relatedTarget)&&++o.outCount>1&&o.hideMenu()},this.infoOverlayHandler=function(){o.mouseOverContext=!1,o.hideMenu(),o.infoOverlay.open()}}},{key:"setup",value:function(e,t,n){this.playerElement=t,this.model=e,this.mouseOverContext=!1,this.layer=n,o.OS.iOS?(this.startLongPressHandler=this.startLongPress.bind(this),this.cancelLongPressHandler=this.cancelLongPress.bind(this),t.addEventListener("touchstart",this.startLongPressHandler),t.addEventListener("touchmove",this.cancelLongPressHandler),t.addEventListener("touchend",this.cancelLongPressHandler),t.addEventListener("touchcancel",this.cancelLongPressHandler)):t.oncontextmenu=this.rightClick.bind(this)}},{key:"startLongPress",value:function(e){var t=this;this.cancelLongPress(),this.longPressTimeout=setTimeout(function(){t.rightClick(e),t.longPressTimeout=null},500)}},{key:"cancelLongPress",value:function(){clearTimeout(this.longPressTimeout)}},{key:"addHideMenuHandlers",value:function(){this.removeHideMenuHandlers(),this.playerElement.addEventListener("touchstart",this.hideMenuHandler),document.addEventListener("touchstart",this.hideMenuHandler),o.OS.mobile||(this.playerElement.addEventListener("click",this.hideMenuHandler),document.addEventListener("click",this.hideMenuHandler),this.el.addEventListener("mouseover",this.overHandler),this.el.addEventListener("mouseout",this.outHandler)),this.el.querySelector(".jw-info-overlay-item").addEventListener("click",this.infoOverlayHandler)}},{key:"removeHideMenuHandlers",value:function(){this.playerElement&&this.playerElement.removeEventListener("click",this.hideMenuHandler),this.el&&(this.el.querySelector(".jw-info-overlay-item").removeEventListener("click",this.infoOverlayHandler),this.el.removeEventListener("mouseover",this.overHandler),this.el.removeEventListener("mouseout",this.outHandler)),document.removeEventListener("click",this.hideMenuHandler),document.removeEventListener("touchstart",this.hideMenuHandler)}},{key:"destroy",value:function(){clearTimeout(this._menuTimeout),this.removeHideMenuHandlers(),this.el&&(this.hideMenu(),this.hideMenuHandler=null,this.el=null),this.playerElement&&(this.playerElement.removeEventListener("touchstart",this.startLongPressHandler),this.playerElement.removeEventListener("touchmove",this.cancelLongPressHandler),this.playerElement.removeEventListener("touchend",this.cancelLongPressHandler),this.playerElement.removeEventListener("touchcancel",this.cancelLongPressHandler),this.playerElement.oncontextmenu=null,this.playerElement=null),this.model&&(this.model=null)}}]),e}(),ut=function(){return'<div class="jw-reset jw-settings-menu" role="menu" aria-expanded="false"><div class="jw-reset jw-settings-topbar" role="menubar"></div></div>'};var wt=function(e){Object.keys(e).forEach(function(t){e[t].deactivate()})},pt=function(){return'<div class="jw-reset jw-settings-submenu" role="menu" aria-expanded="false"></div>'};var dt=function(e){e.forEach(function(e){e.deactivate()})},jt=function(e){return'<button type="button" class="jw-reset jw-settings-content-item" role="menuitemradio" aria-checked="false">'+e+"</button>"};function ht(e,t,n){var i=void 0,o=Object(me.e)(jt(t)),a=new c.a(o);a.on("click tap enter",function(e){n(e)});var r={activate:function(){Object(me.m)(o,"jw-settings-item-active",!0),o.setAttribute("aria-checked","true"),i=!0},deactivate:function(){Object(me.m)(o,"jw-settings-item-active",!1),o.setAttribute("aria-checked","false"),i=!1},element:function(){return o},uiElement:function(){return a},destroy:function(){this.deactivate(),a.destroy()}};return Object.defineProperty(r,"active",{enumerable:!0,get:function(){return i}}),r}var ft="audioTracks",gt="captions",vt="quality",mt="playbackRates",yt=vt,bt=function(e,t,n,i,o){var a=e.getSubmenu(t);if(a)a.replaceContent(n);else{var r=p("jw-settings-"+t,function(){e.activateSubmenu(t),a