ok

Mini Shell

Direktori : /home2/selectio/www/assets/vendor/plyr/
Upload File :
Current File : /home2/selectio/www/assets/vendor/plyr/plyr.min.js.map

{"version":3,"sources":["plyr.js","node_modules/rangetouch/src/js/config.js","node_modules/rangetouch/src/js/utils/is.js","node_modules/rangetouch/src/js/utils/numbers.js","src/js/utils/animation.js","node_modules/rangetouch/src/js/rangetouch.js","node_modules/rangetouch/src/js/utils/events.js","node_modules/rangetouch/src/js/utils/css.js","src/js/utils/is.js","src/js/utils/browser.js","src/js/utils/events.js","src/js/utils/objects.js","src/js/utils/elements.js","src/js/support.js","src/js/utils/style.js","src/js/html5.js","src/js/utils/arrays.js","src/js/utils/strings.js","src/js/utils/i18n.js","src/js/storage.js","src/js/utils/fetch.js","src/js/utils/load-sprite.js","src/js/utils/time.js","src/js/controls.js","src/js/utils/urls.js","src/js/captions.js","src/js/config/defaults.js","src/js/config/states.js","src/js/config/types.js","src/js/console.js","src/js/fullscreen.js","src/js/utils/load-image.js","src/js/ui.js","src/js/listeners.js","node_modules/loadjs/dist/loadjs.umd.js","src/js/utils/load-script.js","src/js/plugins/vimeo.js","src/js/plugins/youtube.js","src/js/media.js","src/js/plugins/ads.js","src/js/plugins/preview-thumbnails.js","src/js/source.js","src/js/plyr.js","src/js/utils/numbers.js"],"names":["navigator","global","factory","exports","module","define","amd","self","Plyr","this","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","prototype","_defineProperty","obj","value","_slicedToArray","arr","Array","isArray","_arrayWithHoles","_arr","_n","_d","_e","undefined","_s","_i","Symbol","iterator","next","done","push","err","_iterableToArrayLimit","_nonIterableRest","_toConsumableArray","arr2","_arrayWithoutHoles","iter","toString","call","from","_iterableToArray","_nonIterableSpread","defaults","addCSS","thumbWidth","watch","getConstructor","input","constructor","instanceOf","Boolean","isNullOrUndefined","isObject","isString","String","isNodeList","NodeList","is","nullOrUndefined","object","number","Number","isNaN","string","boolean","function","Function","array","nodeList","element","Element","event","Event","empty","keys","round","step","places","match","concat","Math","max","parseFloat","toFixed","events","type","RangeTouch","options","document","querySelector","rangeTouch","config","assign","init","enabled","style","userSelect","webKitUserSelect","touchAction","listeners","toggle","_this","method","forEach","set","percent","touch","changedTouches","min","getAttribute","delta","clientRect","getBoundingClientRect","width","clientX","left","disabled","preventDefault","get","dispatchEvent","trigger","arguments","targets","querySelectorAll","filter","MutationObserver","mutations","mutation","addedNodes","node","selector","includes","observe","body","childList","subtree","map","t","documentElement","isEmpty","is$1","weakMap","WeakMap","textNode","Text","keyboardEvent","KeyboardEvent","cue","window","TextTrackCue","VTTCue","track","TextTrack","kind","promise","Promise","url","URL","startsWith","hostname","e","transitionEndEvent","createElement","WebkitTransition","MozTransition","OTransition","transition","find","repaint","delay","setTimeout","hidden","offsetHeight","browser","isIE","documentMode","isEdge","userAgent","isWebkit","test","isIPhone","platform","isIos","supportsPassiveListeners","supported","addEventListener","removeEventListener","toggleListener","callback","passive","capture","split","eventListeners","on","off","once","_this2","onceCallback","_len","args","_key","apply","triggerEvent","bubbles","detail","CustomEvent","plyr","getDeep","path","reduce","extend","sources","source","shift","wrap","elements","wrapper","reverse","index","child","cloneNode","parent","parentNode","sibling","nextSibling","appendChild","insertBefore","setAttributes","attributes","entries","_ref","_ref3","_ref4","setAttribute","text","innerText","insertElement","removeElement","removeChild","emptyElement","childNodes","lastChild","replaceElement","newChild","oldChild","replaceChild","getAttributesFromSelector","sel","existingAttributes","existing","s","trim","className","replace","parts","charAt","class","id","toggleHidden","hide","toggleClass","force","classList","contains","hasClass","matches","getElements","container","getElement","setFocus","tabFocus","focus","preventScroll","classNames","range","defaultCodecs","audio/ogg","audio/wav","video/webm","video/mp4","video/ogg","support","audio","video","check","provider","playsinline","canPlayInline","api","ui","rangeInput","pip","webkitSetPresentationMode","pictureInPictureEnabled","disablePictureInPicture","airplay","WebKitPlaybackTargetAvailabilityEvent","mime","mediaType","isHTML5","media","canPlayType","textTracks","transitions","reducedMotion","matchMedia","validateRatio","every","reduceAspectRatio","ratio","_ratio","height","divider","getDivider","w","h","getAspectRatio","parse","embed","_this$media","videoWidth","videoHeight","setAspectRatio","isVideo","_ref2","padding","paddingBottom","isVimeo","offset","transform","videoFixedRatio","html5","getSources","getQualityOptions","player","_player$media","currentTime","paused","preload","readyState","src","play","load","quality","cancelRequests","blankVideo","debug","log","dedupe","item","indexOf","format","replaceAll","RegExp","toTitleCase","toUpperCase","substr","toLowerCase","toCamelCase","toPascalCase","slice","getHTML","innerHTML","resources","vimeo","youtube","i18n","{seektime}","seekTime","{title}","title","k","v","Storage","storage","store","localStorage","getItem","json","JSON","setItem","stringify","removeItem","fetch","responseType","resolve","reject","request","XMLHttpRequest","responseText","response","Error","status","open","send","loadSprite","hasId","exists","getElementById","update","data","insertAdjacentElement","useStorage","cached","content","then","result","catch","getHours","trunc","getMinutes","getSeconds","formatTime","time","displayHours","inverted","hours","mins","secs","controls","getIconUrl","cors","iconUrl","location","host","svg4everybody","findElements","selectors","buttons","pause","restart","rewind","fastForward","mute","settings","captions","fullscreen","progress","inputs","seek","volume","display","buffer","duration","seekTooltip","tooltip","error","warn","toggleNativeControls","createIcon","iconPath","iconPrefix","icon","createElementNS","role","focusable","use","setAttributeNS","createLabel","attr","join","createBadge","badge","menu","createButton","buttonType","label","labelPressed","iconPressed","some","c","control","button","createRange","autocomplete","aria-label","aria-valuemin","aria-valuemax","aria-valuenow","updateRangeFill","setup","createProgress","aria-hidden","suffixKey","played","suffix","createTime","attrs","bindMenuItemShortcuts","menuItem","which","stopPropagation","isRadioButton","showMenuPanel","nextElementSibling","firstElementChild","previousElementSibling","lastElementChild","focusFirstMenuItem","createMenuItem","_this3","list","_ref$badge","_ref$checked","checked","aria-checked","flex","children","bind","currentTrack","speed","updateTimeDisplay","updateVolume","setRange","muted","pressed","updateProgress","_this4","current","val","getElementsByTagName","nodeValue","setProgress","buffered","setProperty","updateSeekTooltip","_this5","tooltips","visible","show","pageX","timeUpdate","invert","invertTime","seeking","durationUpdate","pow","hasDuration","displayDuration","toggleMenuButton","setting","updateSetting","pane","panels","default","getLabel","setQualityMenu","_this6","checkMenu","getBadge","sort","a","b","sorting","setCaptionsMenu","_this7","tracks","getTracks","toggled","language","unshift","setSpeedMenu","_this8","values","popup","p","firstItem","toggleMenu","composedPath","isMenuItem","getMenuSize","tab","clone","position","opacity","removeAttribute","scrollWidth","scrollHeight","_this9","size","restore","propertyName","setDownloadUrl","download","create","_this10","defaultAttributes","progressContainer","aria-haspopup","aria-controls","aria-expanded","inner","home","backButton","href","urls","isEmbed","inject","_this11","floor","random","seektime","addProperty","controlPressed","_this$config","labels","parseUrl","parser","buildUrlParams","params","URLSearchParams","isYouTube","insertAfter","protocol","blob","createObjectURL","languages","userLanguage","active","trackEvents","_this$captions","meta","currentTrackNode","languageExists","mode","updateCues","setLanguage","activeClass","findTrack","enableTextTrack","has","sortIsDefault","sorted","getCurrentTrack","cues","activeCues","getCueAsHTML","cueText","caption","autoplay","autopause","toggleInvert","clickToPlay","hideControls","resetOnEnd","disableContextMenu","loop","selected","keyboard","focused","fallback","iosNative","seekLabel","unmute","enableCaptions","disableCaptions","enterFullscreen","exitFullscreen","frameTitle","menuBack","normal","start","end","all","reset","advertisement","qualityBadge","2160","1440","1080","720","576","480","sdk","iframe","googleIMA","editable","embedContainer","poster","posterEnabled","ads","playing","stopped","loading","hover","isTouch","uiSupported","noTransition","previewThumbnails","thumbContainer","thumbContainerShown","imageContainer","timeContainer","scrubbingContainer","scrubbingContainerShown","publisherId","tagUrl","byline","portrait","transparent","noCookie","rel","showinfo","iv_load_policy","modestbranding","providers","types","noop","Console","console","onChange","first","last","keyCode","activeElement","shiftKey","toggleFallback","scrollPosition","x","scrollX","y","scrollY","scrollTo","overflow","viewport","head","property","hasProperty","cleanupViewport","part","Fullscreen","prefix","forceFallback","native","webkitEnterFullscreen","requestFullscreen","webkitExitFullscreen","action","cancelFullScreen","exit","enter","fullscreenElement","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","pre","loadImage","minWidth","image","Image","handler","onload","onerror","naturalWidth","addStyleHook","build","checkPlaying","ready","setTitle","setPoster","togglePoster","enable","backgroundImage","backgroundSize","toggleControls","checkLoading","clearTimeout","timers","controlsElement","recentTouchSeek","lastSeekTime","Date","now","Listeners","lastKey","focusTimer","lastKeyDown","handleKey","setTabFocus","firstTouch","code","repeat","altKey","ctrlKey","metaKey","togglePlay","increaseVolume","decreaseVolume","forward","toggleCaptions","usingNative","timeStamp","wasKeyDown","setPlayerSize","measure","rect","resized","_player$fullscreen","isEnter","_setPlayerSize","firstChild","_getAspectRatio$call2","videoX","videoY","maxWidth","margin","setGutter","hasAudio","isAudio","ended","proxy","proxyEvents","_event$detail","defaultHandler","customHandlerKey","customHandler","returned","hasCustomHandler","inputEvent","currentTarget","hasAttribute","seekTo","loaded","startMove","endMove","startScrubbing","endScrubbing","webkitDirectionInvertedFromDevice","_map2","deltaX","deltaY","direction","sign","abs","globalThis","loadjs_umd","fn","createCommonjsModule","devnull","bundleIdCache","bundleResultCache","bundleCallbackQueue","publish","bundleId","pathsNotFound","q","splice","executeCallbacks","depsNotFound","success","loadFile","callbackFn","numTries","isLegacyIECss","doc","async","maxTries","numRetries","beforeCallbackFn","before","pathStripped","relList","as","onbeforeload","ev","sheet","cssText","defaultPrevented","loadjs","paths","arg1","arg2","loadFn","numWaiting","loadFiles","returnPromise","deps","bundleIds","r","subscribe","isDefined","loadScript","assurePlaybackState","hasPlayed","Vimeo","gesture","$2","thumbnail_large","pathname","Player","disableTextTrack","stop","restorePause","setVolume","setCurrentTime","setPlaybackRate","name","currentSrc","setLoop","getVideoUrl","getVideoWidth","getVideoHeight","dimensions","_dimensions","setAutopause","state","getVideoTitle","getCurrentTime","getDuration","getTextTracks","_ref$cues","strippedCues","fragment","createDocumentFragment","stripHTML","getPaused","seconds","parseInt","getHost","YT","onYouTubeIframeAPIReady","getTitle","videoId","currentId","posterSrc","playerVars","hl","disablekb","cc_load_policy","cc_lang_pref","widget_referrer","onError","message","2","5","100","101","150","onPlaybackRateChange","playbackRate","getPlaybackRate","onReady","playVideo","pauseVideo","stopVideo","getAvailablePlaybackRates","clearInterval","buffering","setInterval","getVideoLoadedFraction","lastBuffered","onStateChange","unMute","Ads","initialized","displayContainer","manager","loader","cuePoints","safetyTimer","countdownTimer","managerPromise","google","ima","destroy","remove","startSafetyTimer","clearSafetyTimer","setupIMA","setVpaidMode","ImaSdkSettings","VpaidMode","ENABLED","setLocale","setDisableCustomPlaybackForIOS10Plus","AdDisplayContainer","requestAds","AdsLoader","AdsManagerLoadedEvent","Type","ADS_MANAGER_LOADED","onAdsManagerLoaded","AdErrorEvent","AD_ERROR","onAdError","AdsRequest","adTagUrl","linearAdSlotWidth","offsetWidth","linearAdSlotHeight","nonLinearAdSlotWidth","nonLinearAdSlotHeight","forceNonLinearFullSlot","setAdWillPlayMuted","getRemainingTime","AdsRenderingSettings","restoreCustomPlaybackStateOnAdBreakComplete","enablePreloading","getAdsManager","getCuePoints","AdEvent","onAdEvent","cuePoint","seekElement","cuePercentage","ad","getAd","adData","getAdData","LOADED","pollCountdown","isLinear","STARTED","ALL_ADS_COMPLETED","loadAds","CONTENT_PAUSE_REQUESTED","pauseContent","CONTENT_RESUME_REQUESTED","resumeContent","LOG","adError","getMessage","cancel","addCuePoints","contentComplete","seekedTime","discardAdBreak","resize","ViewMode","NORMAL","initialize","zIndex","_this12","handlers","_this13","AV_PUBLISHERID","AV_CHANNELID","AV_URL","cb","AV_WIDTH","AV_HEIGHT","AV_CDIM2","PreviewThumbnails","thumbnails","lastMouseMoveTime","mouseDown","loadedImages","thumb","scrubbing","getThumbnails","render","determineContainerAutoSizing","promises","u","getThumbnail","vttDataString","processedList","thumbnail","frames","frame","line","startTime","lineSplit","_lineSplit","_lineSplit$1$split2","matchTimes","endTime","urlPrefix","substring","lastIndexOf","tempImage","naturalHeight","percentage","mousePosX","showImageAtCurrentTime","toggleThumbContainer","toggleScrubbingContainer","ceil","lastTime","setScrubbingContainerSize","setThumbContainerSizeAndPos","thumbNum","findIndex","hasThumb","qualityIndex","showingThumb","thumbFilename","thumbUrl","currentImageElement","dataset","filename","showImage","removeOldImages","loadingImage","usingSprites","previewImage","showingThumbFilename","newImage","setImageSizeAndOffset","currentImageContainer","preloadNearby","getHigherQuality","currentImage","tagName","removeDelay","deleting","oldThumbFilename","thumbnailsClone","foundOne","newThumbFilename","thumbURL","currentQualityIndex","previewImageHeight","thumbContainerHeight","clearShowing","clientHeight","sizeSpecifiedInCSS","thumbAspectRatio","setThumbContainerPos","seekbarRect","plyrRect","minVal","maxVal","right","clientWidth","previewPos","multiplier","top","currentScrubbingImageElement","currentThumbnailImageElement","insertElements","attribute","change","_sources$","_sources$$provider","crossorigin","failed","jQuery","original","getProviderByUrl","search","truthy","searchParams","tabindex","webkitShowPlaybackTargetPicker","isHidden","hiding","eventName","soft","unload","inputIsValid","fauxDuration","realDuration","Infinity","mozHasAudio","webkitAudioDecodedByteCount","audioTracks","minimumSpeed","maximumSpeed","clamp","updateStorage","prev","curr","closest","requestPictureInPicture","exitPictureInPicture","webkitPresentationMode","pictureInPictureElement","inline"],"mappings":"AAAqB,iBAAdA,WAA2B,SAAUC,EAAQC,GAC/B,iBAAZC,SAA0C,oBAAXC,OAAyBA,OAAOD,QAAUD,IAC9D,mBAAXG,QAAyBA,OAAOC,IAAMD,OAAO,OAAQH,IAC3DD,EAASA,GAAUM,MAAaC,KAAON,IAHT,CAI/BO,KAAM,WAAc,aAEpB,SAASC,EAAgBC,EAAUC,GACjC,KAAMD,aAAoBC,GACxB,MAAM,IAAIC,UAAU,qCAIxB,SAASC,EAAkBC,EAAQC,GACjC,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EACtB,UAAWF,IAAYA,EAAWG,UAAW,GACjDC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iD,GACF,KAGJA,EAAQc,IAAI,SAAAC,GAAC,OAAI,IAAIrJ,EAAKqJ,EAAGlD,S1CssPjCnG,EA1uCT,GA+uCA,O0CvsPFA,GAAKsD,U/B1tCqBiB,G+B0tCAjB,G/BztCfiV,KAAK9D,MAAM8D,KAAKE,UAAUlU,MXg6R5BvE","file":"plyr.min.js","sourcesContent":["typeof navigator === \"object\" && (function (global, factory) {\n  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n  typeof define === 'function' && define.amd ? define('Plyr', factory) :\n  (global = global || self, global.Plyr = factory());\n}(this, function () { 'use strict';\n\n  function _classCallCheck(instance, Constructor) {\n    if (!(instance instanceof Constructor)) {\n      throw new TypeError(\"Cannot call a class as a function\");\n    }\n  }\n\n  function _defineProperties(target, props) {\n    for (var i = 0; i < props.length; i++) {\n      var descriptor = props[i];\n      descriptor.enumerable = descriptor.enumerable || false;\n      descriptor.configurable = true;\n      if (\"value\" in descriptor) descriptor.writable = true;\n      Object.defineProperty(target, descriptor.key, descriptor);\n    }\n  }\n\n  function _createClass(Constructor, protoProps, staticProps) {\n    if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n    if (staticProps) _defineProperties(Constructor, staticProps);\n    return Constructor;\n  }\n\n  function _defineProperty(obj, key, value) {\n    if (key in obj) {\n      Object.defineProperty(obj, key, {\n        value: value,\n        enumerable: true,\n        configurable: true,\n        writable: true\n      });\n    } else {\n      obj[key] = value;\n    }\n\n    return obj;\n  }\n\n  function _slicedToArray(arr, i) {\n    return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n  }\n\n  function _toConsumableArray(arr) {\n    return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n  }\n\n  function _arrayWithoutHoles(arr) {\n    if (Array.isArray(arr)) {\n      for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n      return arr2;\n    }\n  }\n\n  function _arrayWithHoles(arr) {\n    if (Array.isArray(arr)) return arr;\n  }\n\n  function _iterableToArray(iter) {\n    if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n  }\n\n  function _iterableToArrayLimit(arr, i) {\n    var _arr = [];\n    var _n = true;\n    var _d = false;\n    var _e = undefined;\n\n    try {\n      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n        _arr.push(_s.value);\n\n        if (i && _arr.length === i) break;\n      }\n    } catch (err) {\n      _d = true;\n      _e = err;\n    } finally {\n      try {\n        if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n      } finally {\n        if (_d) throw _e;\n      }\n    }\n\n    return _arr;\n  }\n\n  function _nonIterableSpread() {\n    throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n  }\n\n  function _nonIterableRest() {\n    throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n  }\n\n  var defaults = {\n    addCSS: true,\n    // Add CSS to the element to improve usability (required here or in your CSS!)\n    thumbWidth: 15,\n    // The width of the thumb handle\n    watch: true // Watch for new elements that match a string target\n\n  };\n\n  // Element matches a selector\n  function matches(element, selector) {\n\n    function match() {\n      return Array.from(document.querySelectorAll(selector)).includes(this);\n    }\n\n    var matches = match;\n    return matches.call(element, selector);\n  }\n\n  // Trigger event\n  function trigger(element, type) {\n    if (!element || !type) {\n      return;\n    } // Create and dispatch the event\n\n\n    var event = new Event(type); // Dispatch the event\n\n    element.dispatchEvent(event);\n  }\n\n  // ==========================================================================\n  // Type checking utils\n  // ==========================================================================\n  var getConstructor = function getConstructor(input) {\n    return input !== null && typeof input !== 'undefined' ? input.constructor : null;\n  };\n\n  var instanceOf = function instanceOf(input, constructor) {\n    return Boolean(input && constructor && input instanceof constructor);\n  };\n\n  var isNullOrUndefined = function isNullOrUndefined(input) {\n    return input === null || typeof input === 'undefined';\n  };\n\n  var isObject = function isObject(input) {\n    return getConstructor(input) === Object;\n  };\n\n  var isNumber = function isNumber(input) {\n    return getConstructor(input) === Number && !Number.isNaN(input);\n  };\n\n  var isString = function isString(input) {\n    return getConstructor(input) === String;\n  };\n\n  var isBoolean = function isBoolean(input) {\n    return getConstructor(input) === Boolean;\n  };\n\n  var isFunction = function isFunction(input) {\n    return getConstructor(input) === Function;\n  };\n\n  var isArray = function isArray(input) {\n    return Array.isArray(input);\n  };\n\n  var isNodeList = function isNodeList(input) {\n    return instanceOf(input, NodeList);\n  };\n\n  var isElement = function isElement(input) {\n    return instanceOf(input, Element);\n  };\n\n  var isEvent = function isEvent(input) {\n    return instanceOf(input, Event);\n  };\n\n  var isEmpty = function isEmpty(input) {\n    return isNullOrUndefined(input) || (isString(input) || isArray(input) || isNodeList(input)) && !input.length || isObject(input) && !Object.keys(input).length;\n  };\n\n  var is = {\n    nullOrUndefined: isNullOrUndefined,\n    object: isObject,\n    number: isNumber,\n    string: isString,\n    boolean: isBoolean,\n    function: isFunction,\n    array: isArray,\n    nodeList: isNodeList,\n    element: isElement,\n    event: isEvent,\n    empty: isEmpty\n  };\n\n  // Get the number of decimal places\n  function getDecimalPlaces(value) {\n    var match = \"\".concat(value).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\n    if (!match) {\n      return 0;\n    }\n\n    return Math.max(0, // Number of digits right of decimal point.\n    (match[1] ? match[1].length : 0) - ( // Adjust for scientific notation.\n    match[2] ? +match[2] : 0));\n  } // Round to the nearest step\n\n  function round(number, step) {\n    if (step < 1) {\n      var places = getDecimalPlaces(step);\n      return parseFloat(number.toFixed(places));\n    }\n\n    return Math.round(number / step) * step;\n  }\n\n  var RangeTouch =\n  /*#__PURE__*/\n  function () {\n    /**\n     * Setup a new instance\n     * @param {String|Element} target\n     * @param {Object} options\n     */\n    function RangeTouch(target, options) {\n      _classCallCheck(this, RangeTouch);\n\n      if (is.element(target)) {\n        // An Element is passed, use it directly\n        this.element = target;\n      } else if (is.string(target)) {\n        // A CSS Selector is passed, fetch it from the DOM\n        this.element = document.querySelector(target);\n      }\n\n      if (!is.element(this.element) || !is.empty(this.element.rangeTouch)) {\n        return;\n      }\n\n      this.config = Object.assign({}, defaults, options);\n      this.init();\n    }\n\n    _createClass(RangeTouch, [{\n      key: \"init\",\n      value: function init() {\n        // Bail if not a touch enabled device\n        if (!RangeTouch.enabled) {\n          return;\n        } // Add useful CSS\n\n\n        if (this.config.addCSS) {\n          // TODO: Restore original values on destroy\n          this.element.style.userSelect = 'none';\n          this.element.style.webKitUserSelect = 'none';\n          this.element.style.touchAction = 'manipulation';\n        }\n\n        this.listeners(true);\n        this.element.rangeTouch = this;\n      }\n    }, {\n      key: \"destroy\",\n      value: function destroy() {\n        // Bail if not a touch enabled device\n        if (!RangeTouch.enabled) {\n          return;\n        }\n\n        this.listeners(false);\n        this.element.rangeTouch = null;\n      }\n    }, {\n      key: \"listeners\",\n      value: function listeners(toggle) {\n        var _this = this;\n\n        var method = toggle ? 'addEventListener' : 'removeEventListener'; // Listen for events\n\n        ['touchstart', 'touchmove', 'touchend'].forEach(function (type) {\n          _this.element[method](type, function (event) {\n            return _this.set(event);\n          }, false);\n        });\n      }\n      /**\n       * Get the value based on touch position\n       * @param {Event} event\n       */\n\n    }, {\n      key: \"get\",\n      value: function get(event) {\n        if (!RangeTouch.enabled || !is.event(event)) {\n          return null;\n        }\n\n        var input = event.target;\n        var touch = event.changedTouches[0];\n        var min = parseFloat(input.getAttribute('min')) || 0;\n        var max = parseFloat(input.getAttribute('max')) || 100;\n        var step = parseFloat(input.getAttribute('step')) || 1;\n        var delta = max - min; // Calculate percentage\n\n        var percent;\n        var clientRect = input.getBoundingClientRect();\n        var thumbWidth = 100 / clientRect.width * (this.config.thumbWidth / 2) / 100; // Determine left percentage\n\n        percent = 100 / clientRect.width * (touch.clientX - clientRect.left); // Don't allow outside bounds\n\n        if (percent < 0) {\n          percent = 0;\n        } else if (percent > 100) {\n          percent = 100;\n        } // Factor in the thumb offset\n\n\n        if (percent < 50) {\n          percent -= (100 - percent * 2) * thumbWidth;\n        } else if (percent > 50) {\n          percent += (percent - 50) * 2 * thumbWidth;\n        } // Find the closest step to the mouse position\n\n\n        return min + round(delta * (percent / 100), step);\n      }\n      /**\n       * Update range value based on position\n       * @param {Event} event\n       */\n\n    }, {\n      key: \"set\",\n      value: function set(event) {\n        if (!RangeTouch.enabled || !is.event(event) || event.target.disabled) {\n          return;\n        } // Prevent text highlight on iOS\n\n\n        event.preventDefault(); // Set value\n\n        event.target.value = this.get(event); // Trigger event\n\n        trigger(event.target, event.type === 'touchend' ? 'change' : 'input');\n      }\n    }], [{\n      key: \"setup\",\n\n      /**\n       * Setup multiple instances\n       * @param {String|Element|NodeList|Array} target\n       * @param {Object} options\n       */\n      value: function setup(target) {\n        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n        var targets = null;\n\n        if (is.empty(target) || is.string(target)) {\n          targets = Array.from(document.querySelectorAll(is.string(target) ? target : 'input[type=\"range\"]'));\n        } else if (is.element(target)) {\n          targets = [target];\n        } else if (is.nodeList(target)) {\n          targets = Array.from(target);\n        } else if (is.array(target)) {\n          targets = target.filter(is.element);\n        }\n\n        if (is.empty(targets)) {\n          return null;\n        }\n\n        var config = Object.assign({}, defaults, options);\n\n        if (is.string(target) && config.watch) {\n          // Create an observer instance\n          var observer = new MutationObserver(function (mutations) {\n            Array.from(mutations).forEach(function (mutation) {\n              Array.from(mutation.addedNodes).forEach(function (node) {\n                if (!is.element(node) || !matches(node, target)) {\n                  return;\n                } // eslint-disable-next-line no-unused-vars\n\n\n                var range = new RangeTouch(node, config);\n              });\n            });\n          }); // Pass in the target node, as well as the observer options\n\n          observer.observe(document.body, {\n            childList: true,\n            subtree: true\n          });\n        }\n\n        return targets.map(function (t) {\n          return new RangeTouch(t, options);\n        });\n      }\n    }, {\n      key: \"enabled\",\n      get: function get() {\n        return 'ontouchstart' in document.documentElement;\n      }\n    }]);\n\n    return RangeTouch;\n  }();\n\n  // ==========================================================================\n  // Type checking utils\n  // ==========================================================================\n  var getConstructor$1 = function getConstructor(input) {\n    return input !== null && typeof input !== 'undefined' ? input.constructor : null;\n  };\n\n  var instanceOf$1 = function instanceOf(input, constructor) {\n    return Boolean(input && constructor && input instanceof constructor);\n  };\n\n  var isNullOrUndefined$1 = function isNullOrUndefined(input) {\n    return input === null || typeof input === 'undefined';\n  };\n\n  var isObject$1 = function isObject(input) {\n    return getConstructor$1(input) === Object;\n  };\n\n  var isNumber$1 = function isNumber(input) {\n    return getConstructor$1(input) === Number && !Number.isNaN(input);\n  };\n\n  var isString$1 = function isString(input) {\n    return getConstructor$1(input) === String;\n  };\n\n  var isBoolean$1 = function isBoolean(input) {\n    return getConstructor$1(input) === Boolean;\n  };\n\n  var isFunction$1 = function isFunction(input) {\n    return getConstructor$1(input) === Function;\n  };\n\n  var isArray$1 = function isArray(input) {\n    return Array.isArray(input);\n  };\n\n  var isWeakMap = function isWeakMap(input) {\n    return instanceOf$1(input, WeakMap);\n  };\n\n  var isNodeList$1 = function isNodeList(input) {\n    return instanceOf$1(input, NodeList);\n  };\n\n  var isElement$1 = function isElement(input) {\n    return instanceOf$1(input, Element);\n  };\n\n  var isTextNode = function isTextNode(input) {\n    return getConstructor$1(input) === Text;\n  };\n\n  var isEvent$1 = function isEvent(input) {\n    return instanceOf$1(input, Event);\n  };\n\n  var isKeyboardEvent = function isKeyboardEvent(input) {\n    return instanceOf$1(input, KeyboardEvent);\n  };\n\n  var isCue = function isCue(input) {\n    return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue);\n  };\n\n  var isTrack = function isTrack(input) {\n    return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind);\n  };\n\n  var isPromise = function isPromise(input) {\n    return instanceOf$1(input, Promise);\n  };\n\n  var isEmpty$1 = function isEmpty(input) {\n    return isNullOrUndefined$1(input) || (isString$1(input) || isArray$1(input) || isNodeList$1(input)) && !input.length || isObject$1(input) && !Object.keys(input).length;\n  };\n\n  var isUrl = function isUrl(input) {\n    // Accept a URL object\n    if (instanceOf$1(input, window.URL)) {\n      return true;\n    } // Must be string from here\n\n\n    if (!isString$1(input)) {\n      return false;\n    } // Add the protocol if required\n\n\n    var string = input;\n\n    if (!input.startsWith('http://') || !input.startsWith('https://')) {\n      string = \"http://\".concat(input);\n    }\n\n    try {\n      return !isEmpty$1(new URL(string).hostname);\n    } catch (e) {\n      return false;\n    }\n  };\n\n  var is$1 = {\n    nullOrUndefined: isNullOrUndefined$1,\n    object: isObject$1,\n    number: isNumber$1,\n    string: isString$1,\n    boolean: isBoolean$1,\n    function: isFunction$1,\n    array: isArray$1,\n    weakMap: isWeakMap,\n    nodeList: isNodeList$1,\n    element: isElement$1,\n    textNode: isTextNode,\n    event: isEvent$1,\n    keyboardEvent: isKeyboardEvent,\n    cue: isCue,\n    track: isTrack,\n    promise: isPromise,\n    url: isUrl,\n    empty: isEmpty$1\n  };\n\n  // ==========================================================================\n  var transitionEndEvent = function () {\n    var element = document.createElement('span');\n    var events = {\n      WebkitTransition: 'webkitTransitionEnd',\n      MozTransition: 'transitionend',\n      OTransition: 'oTransitionEnd otransitionend',\n      transition: 'transitionend'\n    };\n    var type = Object.keys(events).find(function (event) {\n      return element.style[event] !== undefined;\n    });\n    return is$1.string(type) ? events[type] : false;\n  }(); // Force repaint of element\n\n  function repaint(element, delay) {\n    setTimeout(function () {\n      try {\n        // eslint-disable-next-line no-param-reassign\n        element.hidden = true; // eslint-disable-next-line no-unused-expressions\n\n        element.offsetHeight; // eslint-disable-next-line no-param-reassign\n\n        element.hidden = false;\n      } catch (e) {// Do nothing\n      }\n    }, delay);\n  }\n\n  // ==========================================================================\n  // Browser sniffing\n  // Unfortunately, due to mixed support, UA sniffing is required\n  // ==========================================================================\n  var browser = {\n    isIE:\n    /* @cc_on!@ */\n    !!document.documentMode,\n    isEdge: window.navigator.userAgent.includes('Edge'),\n    isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),\n    isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),\n    isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)\n  };\n\n  // ==========================================================================\n  // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n  // https://www.youtube.com/watch?v=NPM6172J22g\n\n  var supportsPassiveListeners = function () {\n    // Test via a getter in the options object to see if the passive property is accessed\n    var supported = false;\n\n    try {\n      var options = Object.defineProperty({}, 'passive', {\n        get: function get() {\n          supported = true;\n          return null;\n        }\n      });\n      window.addEventListener('test', null, options);\n      window.removeEventListener('test', null, options);\n    } catch (e) {// Do nothing\n    }\n\n    return supported;\n  }(); // Toggle event listener\n\n\n  function toggleListener(element, event, callback) {\n    var _this = this;\n\n    var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n    var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n    var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;\n\n    // Bail if no element, event, or callback\n    if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {\n      return;\n    } // Allow multiple events\n\n\n    var events = event.split(' '); // Build options\n    // Default to just the capture boolean for browsers with no passive listener support\n\n    var options = capture; // If passive events listeners are supported\n\n    if (supportsPassiveListeners) {\n      options = {\n        // Whether the listener can be passive (i.e. default never prevented)\n        passive: passive,\n        // Whether the listener is a capturing listener or not\n        capture: capture\n      };\n    } // If a single node is passed, bind the event listener\n\n\n    events.forEach(function (type) {\n      if (_this && _this.eventListeners && toggle) {\n        // Cache event listener\n        _this.eventListeners.push({\n          element: element,\n          type: type,\n          callback: callback,\n          options: options\n        });\n      }\n\n      element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);\n    });\n  } // Bind event handler\n\n  function on(element) {\n    var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n    var callback = arguments.length > 2 ? arguments[2] : undefined;\n    var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n    var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n    toggleListener.call(this, element, events, callback, true, passive, capture);\n  } // Unbind event handler\n\n  function off(element) {\n    var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n    var callback = arguments.length > 2 ? arguments[2] : undefined;\n    var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n    var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n    toggleListener.call(this, element, events, callback, false, passive, capture);\n  } // Bind once-only event handler\n\n  function once(element) {\n    var _this2 = this;\n\n    var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n    var callback = arguments.length > 2 ? arguments[2] : undefined;\n    var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n    var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n    var onceCallback = function onceCallback() {\n      off(element, events, onceCallback, passive, capture);\n\n      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n        args[_key] = arguments[_key];\n      }\n\n      callback.apply(_this2, args);\n    };\n\n    toggleListener.call(this, element, events, onceCallback, true, passive, capture);\n  } // Trigger event\n\n  function triggerEvent(element) {\n    var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n    var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n    var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n\n    // Bail if no element\n    if (!is$1.element(element) || is$1.empty(type)) {\n      return;\n    } // Create and dispatch the event\n\n\n    var event = new CustomEvent(type, {\n      bubbles: bubbles,\n      detail: Object.assign({}, detail, {\n        plyr: this\n      })\n    }); // Dispatch the event\n\n    element.dispatchEvent(event);\n  } // Unbind all cached event listeners\n\n  function unbindListeners() {\n    if (this && this.eventListeners) {\n      this.eventListeners.forEach(function (item) {\n        var element = item.element,\n            type = item.type,\n            callback = item.callback,\n            options = item.options;\n        element.removeEventListener(type, callback, options);\n      });\n      this.eventListeners = [];\n    }\n  } // Run method when / if player is ready\n\n  function ready() {\n    var _this3 = this;\n\n    return new Promise(function (resolve) {\n      return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);\n    }).then(function () {});\n  }\n\n  function cloneDeep(object) {\n    return JSON.parse(JSON.stringify(object));\n  } // Get a nested value in an object\n\n  function getDeep(object, path) {\n    return path.split('.').reduce(function (obj, key) {\n      return obj && obj[key];\n    }, object);\n  } // Deep extend destination object with N more objects\n\n  function extend() {\n    var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n    for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n      sources[_key - 1] = arguments[_key];\n    }\n\n    if (!sources.length) {\n      return target;\n    }\n\n    var source = sources.shift();\n\n    if (!is$1.object(source)) {\n      return target;\n    }\n\n    Object.keys(source).forEach(function (key) {\n      if (is$1.object(source[key])) {\n        if (!Object.keys(target).includes(key)) {\n          Object.assign(target, _defineProperty({}, key, {}));\n        }\n\n        extend(target[key], source[key]);\n      } else {\n        Object.assign(target, _defineProperty({}, key, source[key]));\n      }\n    });\n    return extend.apply(void 0, [target].concat(sources));\n  }\n\n  function wrap(elements, wrapper) {\n    // Convert `elements` to an array, if necessary.\n    var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the\n    // first element (see `child` below).\n\n    Array.from(targets).reverse().forEach(function (element, index) {\n      var child = index > 0 ? wrapper.cloneNode(true) : wrapper; // Cache the current parent and sibling.\n\n      var parent = element.parentNode;\n      var sibling = element.nextSibling; // Wrap the element (is automatically removed from its current\n      // parent).\n\n      child.appendChild(element); // If the element had a sibling, insert the wrapper before\n      // the sibling to maintain the HTML structure; otherwise, just\n      // append it to the parent.\n\n      if (sibling) {\n        parent.insertBefore(child, sibling);\n      } else {\n        parent.appendChild(child);\n      }\n    });\n  } // Set attributes\n\n  function setAttributes(element, attributes) {\n    if (!is$1.element(element) || is$1.empty(attributes)) {\n      return;\n    } // Assume null and undefined attributes should be left out,\n    // Setting them would otherwise convert them to \"null\" and \"undefined\"\n\n\n    Object.entries(attributes).filter(function (_ref) {\n      var _ref2 = _slicedToArray(_ref, 2),\n          value = _ref2[1];\n\n      return !is$1.nullOrUndefined(value);\n    }).forEach(function (_ref3) {\n      var _ref4 = _slicedToArray(_ref3, 2),\n          key = _ref4[0],\n          value = _ref4[1];\n\n      return element.setAttribute(key, value);\n    });\n  } // Create a DocumentFragment\n\n  function createElement(type, attributes, text) {\n    // Create a new <element>\n    var element = document.createElement(type); // Set all passed attributes\n\n    if (is$1.object(attributes)) {\n      setAttributes(element, attributes);\n    } // Add text node\n\n\n    if (is$1.string(text)) {\n      element.innerText = text;\n    } // Return built element\n\n\n    return element;\n  } // Inaert an element after another\n\n  function insertAfter(element, target) {\n    if (!is$1.element(element) || !is$1.element(target)) {\n      return;\n    }\n\n    target.parentNode.insertBefore(element, target.nextSibling);\n  } // Insert a DocumentFragment\n\n  function insertElement(type, parent, attributes, text) {\n    if (!is$1.element(parent)) {\n      return;\n    }\n\n    parent.appendChild(createElement(type, attributes, text));\n  } // Remove element(s)\n\n  function removeElement(element) {\n    if (is$1.nodeList(element) || is$1.array(element)) {\n      Array.from(element).forEach(removeElement);\n      return;\n    }\n\n    if (!is$1.element(element) || !is$1.element(element.parentNode)) {\n      return;\n    }\n\n    element.parentNode.removeChild(element);\n  } // Remove all child elements\n\n  function emptyElement(element) {\n    if (!is$1.element(element)) {\n      return;\n    }\n\n    var length = element.childNodes.length;\n\n    while (length > 0) {\n      element.removeChild(element.lastChild);\n      length -= 1;\n    }\n  } // Replace element\n\n  function replaceElement(newChild, oldChild) {\n    if (!is$1.element(oldChild) || !is$1.element(oldChild.parentNode) || !is$1.element(newChild)) {\n      return null;\n    }\n\n    oldChild.parentNode.replaceChild(newChild, oldChild);\n    return newChild;\n  } // Get an attribute object from a string selector\n\n  function getAttributesFromSelector(sel, existingAttributes) {\n    // For example:\n    // '.test' to { class: 'test' }\n    // '#test' to { id: 'test' }\n    // '[data-test=\"test\"]' to { 'data-test': 'test' }\n    if (!is$1.string(sel) || is$1.empty(sel)) {\n      return {};\n    }\n\n    var attributes = {};\n    var existing = extend({}, existingAttributes);\n    sel.split(',').forEach(function (s) {\n      // Remove whitespace\n      var selector = s.trim();\n      var className = selector.replace('.', '');\n      var stripped = selector.replace(/[[\\]]/g, ''); // Get the parts and value\n\n      var parts = stripped.split('=');\n\n      var _parts = _slicedToArray(parts, 1),\n          key = _parts[0];\n\n      var value = parts.length > 1 ? parts[1].replace(/[\"']/g, '') : ''; // Get the first character\n\n      var start = selector.charAt(0);\n\n      switch (start) {\n        case '.':\n          // Add to existing classname\n          if (is$1.string(existing.class)) {\n            attributes.class = \"\".concat(existing.class, \" \").concat(className);\n          } else {\n            attributes.class = className;\n          }\n\n          break;\n\n        case '#':\n          // ID selector\n          attributes.id = selector.replace('#', '');\n          break;\n\n        case '[':\n          // Attribute selector\n          attributes[key] = value;\n          break;\n\n        default:\n          break;\n      }\n    });\n    return extend(existing, attributes);\n  } // Toggle hidden\n\n  function toggleHidden(element, hidden) {\n    if (!is$1.element(element)) {\n      return;\n    }\n\n    var hide = hidden;\n\n    if (!is$1.boolean(hide)) {\n      hide = !element.hidden;\n    } // eslint-disable-next-line no-param-reassign\n\n\n    element.hidden = hide;\n  } // Mirror Element.classList.toggle, with IE compatibility for \"force\" argument\n\n  function toggleClass(element, className, force) {\n    if (is$1.nodeList(element)) {\n      return Array.from(element).map(function (e) {\n        return toggleClass(e, className, force);\n      });\n    }\n\n    if (is$1.element(element)) {\n      var method = 'toggle';\n\n      if (typeof force !== 'undefined') {\n        method = force ? 'add' : 'remove';\n      }\n\n      element.classList[method](className);\n      return element.classList.contains(className);\n    }\n\n    return false;\n  } // Has class name\n\n  function hasClass(element, className) {\n    return is$1.element(element) && element.classList.contains(className);\n  } // Element matches selector\n\n  function matches$1(element, selector) {\n\n    function match() {\n      return Array.from(document.querySelectorAll(selector)).includes(this);\n    }\n\n    var method = match;\n    return method.call(element, selector);\n  } // Find all elements\n\n  function getElements(selector) {\n    return this.elements.container.querySelectorAll(selector);\n  } // Find a single element\n\n  function getElement(selector) {\n    return this.elements.container.querySelector(selector);\n  } // Trap focus inside container\n\n  function trapFocus() {\n    var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n    var toggle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n    if (!is$1.element(element)) {\n      return;\n    }\n\n    var focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]');\n    var first = focusable[0];\n    var last = focusable[focusable.length - 1];\n\n    var trap = function trap(event) {\n      // Bail if not tab key or not fullscreen\n      if (event.key !== 'Tab' || event.keyCode !== 9) {\n        return;\n      } // Get the current focused element\n\n\n      var focused = document.activeElement;\n\n      if (focused === last && !event.shiftKey) {\n        // Move focus to first element that can be tabbed if Shift isn't used\n        first.focus();\n        event.preventDefault();\n      } else if (focused === first && event.shiftKey) {\n        // Move focus to last element that can be tabbed if Shift is used\n        last.focus();\n        event.preventDefault();\n      }\n    };\n\n    toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false);\n  } // Set focus and tab focus class\n\n  function setFocus() {\n    var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n    var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n    if (!is$1.element(element)) {\n      return;\n    } // Set regular focus\n\n\n    element.focus({\n      preventScroll: true\n    }); // If we want to mimic keyboard focus via tab\n\n    if (tabFocus) {\n      toggleClass(element, this.config.classNames.tabFocus);\n    }\n  }\n\n  var defaultCodecs = {\n    'audio/ogg': 'vorbis',\n    'audio/wav': '1',\n    'video/webm': 'vp8, vorbis',\n    'video/mp4': 'avc1.42E01E, mp4a.40.2',\n    'video/ogg': 'theora'\n  }; // Check for feature support\n\n  var support = {\n    // Basic support\n    audio: 'canPlayType' in document.createElement('audio'),\n    video: 'canPlayType' in document.createElement('video'),\n    // Check for support\n    // Basic functionality vs full UI\n    check: function check(type, provider, playsinline) {\n      var canPlayInline = browser.isIPhone && playsinline && support.playsinline;\n      var api = support[type] || provider !== 'html5';\n      var ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);\n      return {\n        api: api,\n        ui: ui\n      };\n    },\n    // Picture-in-picture support\n    // Safari & Chrome only currently\n    pip: function () {\n      if (browser.isIPhone) {\n        return false;\n      } // Safari\n      // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls\n\n\n      if (is$1.function(createElement('video').webkitSetPresentationMode)) {\n        return true;\n      } // Chrome\n      // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture\n\n\n      if (document.pictureInPictureEnabled && !createElement('video').disablePictureInPicture) {\n        return true;\n      }\n\n      return false;\n    }(),\n    // Airplay support\n    // Safari only currently\n    airplay: is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),\n    // Inline playback support\n    // https://webkit.org/blog/6784/new-video-policies-for-ios/\n    playsinline: 'playsInline' in document.createElement('video'),\n    // Check for mime type support against a player instance\n    // Credits: http://diveintohtml5.info/everything.html\n    // Related: http://www.leanbackplayer.com/test/h5mt.html\n    mime: function mime(input) {\n      if (is$1.empty(input)) {\n        return false;\n      }\n\n      var _input$split = input.split('/'),\n          _input$split2 = _slicedToArray(_input$split, 1),\n          mediaType = _input$split2[0];\n\n      var type = input; // Verify we're using HTML5 and there's no media type mismatch\n\n      if (!this.isHTML5 || mediaType !== this.type) {\n        return false;\n      } // Add codec if required\n\n\n      if (Object.keys(defaultCodecs).includes(type)) {\n        type += \"; codecs=\\\"\".concat(defaultCodecs[input], \"\\\"\");\n      }\n\n      try {\n        return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));\n      } catch (e) {\n        return false;\n      }\n    },\n    // Check for textTracks support\n    textTracks: 'textTracks' in document.createElement('video'),\n    // <input type=\"range\"> Sliders\n    rangeInput: function () {\n      var range = document.createElement('input');\n      range.type = 'range';\n      return range.type === 'range';\n    }(),\n    // Touch\n    // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event\n    touch: 'ontouchstart' in document.documentElement,\n    // Detect transitions support\n    transitions: transitionEndEvent !== false,\n    // Reduced motion iOS & MacOS setting\n    // https://webkit.org/blog/7551/responsive-design-for-motion/\n    reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches\n  };\n\n  function validateRatio(input) {\n    if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {\n      return false;\n    }\n\n    var ratio = is$1.array(input) ? input : input.split(':');\n    return ratio.map(Number).every(is$1.number);\n  }\n  function reduceAspectRatio(ratio) {\n    if (!is$1.array(ratio) || !ratio.every(is$1.number)) {\n      return null;\n    }\n\n    var _ratio = _slicedToArray(ratio, 2),\n        width = _ratio[0],\n        height = _ratio[1];\n\n    var getDivider = function getDivider(w, h) {\n      return h === 0 ? w : getDivider(h, w % h);\n    };\n\n    var divider = getDivider(width, height);\n    return [width / divider, height / divider];\n  }\n  function getAspectRatio(input) {\n    var parse = function parse(ratio) {\n      return validateRatio(ratio) ? ratio.split(':').map(Number) : null;\n    }; // Try provided ratio\n\n\n    var ratio = parse(input); // Get from config\n\n    if (ratio === null) {\n      ratio = parse(this.config.ratio);\n    } // Get from embed\n\n\n    if (ratio === null && !is$1.empty(this.embed) && is$1.array(this.embed.ratio)) {\n      ratio = this.embed.ratio;\n    } // Get from HTML5 video\n\n\n    if (ratio === null && this.isHTML5) {\n      var _this$media = this.media,\n          videoWidth = _this$media.videoWidth,\n          videoHeight = _this$media.videoHeight;\n      ratio = reduceAspectRatio([videoWidth, videoHeight]);\n    }\n\n    return ratio;\n  } // Set aspect ratio for responsive container\n\n  function setAspectRatio(input) {\n    if (!this.isVideo) {\n      return {};\n    }\n\n    var ratio = getAspectRatio.call(this, input);\n\n    var _ref = is$1.array(ratio) ? ratio : [0, 0],\n        _ref2 = _slicedToArray(_ref, 2),\n        w = _ref2[0],\n        h = _ref2[1];\n\n    var padding = 100 / w * h;\n    this.elements.wrapper.style.paddingBottom = \"\".concat(padding, \"%\"); // For Vimeo we have an extra <div> to hide the standard controls and UI\n\n    if (this.isVimeo && this.supported.ui) {\n      var height = 240;\n      var offset = (height - padding) / (height / 50);\n      this.media.style.transform = \"translateY(-\".concat(offset, \"%)\");\n    } else if (this.isHTML5) {\n      this.elements.wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);\n    }\n\n    return {\n      padding: padding,\n      ratio: ratio\n    };\n  }\n\n  // ==========================================================================\n  var html5 = {\n    getSources: function getSources() {\n      var _this = this;\n\n      if (!this.isHTML5) {\n        return [];\n      }\n\n      var sources = Array.from(this.media.querySelectorAll('source')); // Filter out unsupported sources (if type is specified)\n\n      return sources.filter(function (source) {\n        var type = source.getAttribute('type');\n\n        if (is$1.empty(type)) {\n          return true;\n        }\n\n        return support.mime.call(_this, type);\n      });\n    },\n    // Get quality levels\n    getQualityOptions: function getQualityOptions() {\n      // Get sizes from <source> elements\n      return html5.getSources.call(this).map(function (source) {\n        return Number(source.getAttribute('size'));\n      }).filter(Boolean);\n    },\n    extend: function extend() {\n      if (!this.isHTML5) {\n        return;\n      }\n\n      var player = this; // Set aspect ratio if fixed\n\n      if (!is$1.empty(this.config.ratio)) {\n        setAspectRatio.call(player);\n      } // Quality\n\n\n      Object.defineProperty(player.media, 'quality', {\n        get: function get() {\n          // Get sources\n          var sources = html5.getSources.call(player);\n          var source = sources.find(function (s) {\n            return s.getAttribute('src') === player.source;\n          }); // Return size, if match is found\n\n          return source && Number(source.getAttribute('size'));\n        },\n        set: function set(input) {\n          // Get sources\n          var sources = html5.getSources.call(player); // Get first match for requested size\n\n          var source = sources.find(function (s) {\n            return Number(s.getAttribute('size')) === input;\n          }); // No matching source found\n\n          if (!source) {\n            return;\n          } // Get current state\n\n\n          var _player$media = player.media,\n              currentTime = _player$media.currentTime,\n              paused = _player$media.paused,\n              preload = _player$media.preload,\n              readyState = _player$media.readyState; // Set new source\n\n          player.media.src = source.getAttribute('src'); // Prevent loading if preload=\"none\" and the current source isn't loaded (#1044)\n\n          if (preload !== 'none' || readyState) {\n            // Restore time\n            player.once('loadedmetadata', function () {\n              player.currentTime = currentTime; // Resume playing\n\n              if (!paused) {\n                player.play();\n              }\n            }); // Load new source\n\n            player.media.load();\n          } // Trigger change event\n\n\n          triggerEvent.call(player, player.media, 'qualitychange', false, {\n            quality: input\n          });\n        }\n      });\n    },\n    // Cancel current network requests\n    // See https://github.com/sampotts/plyr/issues/174\n    cancelRequests: function cancelRequests() {\n      if (!this.isHTML5) {\n        return;\n      } // Remove child sources\n\n\n      removeElement(html5.getSources.call(this)); // Set blank video src attribute\n      // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error\n      // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection\n\n      this.media.setAttribute('src', this.config.blankVideo); // Load the new empty source\n      // This will cancel existing requests\n      // See https://github.com/sampotts/plyr/issues/174\n\n      this.media.load(); // Debugging\n\n      this.debug.log('Cancelled network requests');\n    }\n  };\n\n  // ==========================================================================\n\n  function dedupe(array) {\n    if (!is$1.array(array)) {\n      return array;\n    }\n\n    return array.filter(function (item, index) {\n      return array.indexOf(item) === index;\n    });\n  } // Get the closest value in an array\n\n  function closest(array, value) {\n    if (!is$1.array(array) || !array.length) {\n      return null;\n    }\n\n    return array.reduce(function (prev, curr) {\n      return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev;\n    });\n  }\n\n  // ==========================================================================\n\n  function generateId(prefix) {\n    return \"\".concat(prefix, \"-\").concat(Math.floor(Math.random() * 10000));\n  } // Format string\n\n  function format(input) {\n    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n      args[_key - 1] = arguments[_key];\n    }\n\n    if (is$1.empty(input)) {\n      return input;\n    }\n\n    return input.toString().replace(/{(\\d+)}/g, function (match, i) {\n      return args[i].toString();\n    });\n  } // Get percentage\n\n  function getPercentage(current, max) {\n    if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {\n      return 0;\n    }\n\n    return (current / max * 100).toFixed(2);\n  } // Replace all occurances of a string in a string\n\n  function replaceAll() {\n    var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n    var find = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n    var replace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n    return input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1'), 'g'), replace.toString());\n  } // Convert to title case\n\n  function toTitleCase() {\n    var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n    return input.toString().replace(/\\w\\S*/g, function (text) {\n      return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase();\n    });\n  } // Convert string to pascalCase\n\n  function toPascalCase() {\n    var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n    var string = input.toString(); // Convert kebab case\n\n    string = replaceAll(string, '-', ' '); // Convert snake case\n\n    string = replaceAll(string, '_', ' '); // Convert to title case\n\n    string = toTitleCase(string); // Convert to pascal case\n\n    return replaceAll(string, ' ', '');\n  } // Convert string to pascalCase\n\n  function toCamelCase() {\n    var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n    var string = input.toString(); // Convert to pascal case\n\n    string = toPascalCase(string); // Convert first character to lowercase\n\n    return string.charAt(0).toLowerCase() + string.slice(1);\n  } // Remove HTML from a string\n\n  function stripHTML(source) {\n    var fragment = document.createDocumentFragment();\n    var element = document.createElement('div');\n    fragment.appendChild(element);\n    element.innerHTML = source;\n    return fragment.firstChild.innerText;\n  } // Like outerHTML, but also works for DocumentFragment\n\n  function getHTML(element) {\n    var wrapper = document.createElement('div');\n    wrapper.appendChild(element);\n    return wrapper.innerHTML;\n  }\n\n  var resources = {\n    pip: 'PIP',\n    airplay: 'AirPlay',\n    html5: 'HTML5',\n    vimeo: 'Vimeo',\n    youtube: 'YouTube'\n  };\n  var i18n = {\n    get: function get() {\n      var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n      var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n      if (is$1.empty(key) || is$1.empty(config)) {\n        return '';\n      }\n\n      var string = getDeep(config.i18n, key);\n\n      if (is$1.empty(string)) {\n        if (Object.keys(resources).includes(key)) {\n          return resources[key];\n        }\n\n        return '';\n      }\n\n      var replace = {\n        '{seektime}': config.seekTime,\n        '{title}': config.title\n      };\n      Object.entries(replace).forEach(function (_ref) {\n        var _ref2 = _slicedToArray(_ref, 2),\n            k = _ref2[0],\n            v = _ref2[1];\n\n        string = replaceAll(string, k, v);\n      });\n      return string;\n    }\n  };\n\n  var Storage =\n  /*#__PURE__*/\n  function () {\n    function Storage(player) {\n      _classCallCheck(this, Storage);\n\n      this.enabled = player.config.storage.enabled;\n      this.key = player.config.storage.key;\n    } // Check for actual support (see if we can use it)\n\n\n    _createClass(Storage, [{\n      key: \"get\",\n      value: function get(key) {\n        if (!Storage.supported || !this.enabled) {\n          return null;\n        }\n\n        var store = window.localStorage.getItem(this.key);\n\n        if (is$1.empty(store)) {\n          return null;\n        }\n\n        var json = JSON.parse(store);\n        return is$1.string(key) && key.length ? json[key] : json;\n      }\n    }, {\n      key: \"set\",\n      value: function set(object) {\n        // Bail if we don't have localStorage support or it's disabled\n        if (!Storage.supported || !this.enabled) {\n          return;\n        } // Can only store objectst\n\n\n        if (!is$1.object(object)) {\n          return;\n        } // Get current storage\n\n\n        var storage = this.get(); // Default to empty object\n\n        if (is$1.empty(storage)) {\n          storage = {};\n        } // Update the working copy of the values\n\n\n        extend(storage, object); // Update storage\n\n        window.localStorage.setItem(this.key, JSON.stringify(storage));\n      }\n    }], [{\n      key: \"supported\",\n      get: function get() {\n        try {\n          if (!('localStorage' in window)) {\n            return false;\n          }\n\n          var test = '___test'; // Try to use it (it might be disabled, e.g. user is in private mode)\n          // see: https://github.com/sampotts/plyr/issues/131\n\n          window.localStorage.setItem(test, test);\n          window.localStorage.removeItem(test);\n          return true;\n        } catch (e) {\n          return false;\n        }\n      }\n    }]);\n\n    return Storage;\n  }();\n\n  // ==========================================================================\n  // Fetch wrapper\n  // Using XHR to avoid issues with older browsers\n  // ==========================================================================\n  function fetch(url) {\n    var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';\n    return new Promise(function (resolve, reject) {\n      try {\n        var request = new XMLHttpRequest(); // Check for CORS support\n\n        if (!('withCredentials' in request)) {\n          return;\n        }\n\n        request.addEventListener('load', function () {\n          if (responseType === 'text') {\n            try {\n              resolve(JSON.parse(request.responseText));\n            } catch (e) {\n              resolve(request.responseText);\n            }\n          } else {\n            resolve(request.response);\n          }\n        });\n        request.addEventListener('error', function () {\n          throw new Error(request.status);\n        });\n        request.open('GET', url, true); // Set the required response type\n\n        request.responseType = responseType;\n        request.send();\n      } catch (e) {\n        reject(e);\n      }\n    });\n  }\n\n  // ==========================================================================\n\n  function loadSprite(url, id) {\n    if (!is$1.string(url)) {\n      return;\n    }\n\n    var prefix = 'cache';\n    var hasId = is$1.string(id);\n    var isCached = false;\n\n    var exists = function exists() {\n      return document.getElementById(id) !== null;\n    };\n\n    var update = function update(container, data) {\n      // eslint-disable-next-line no-param-reassign\n      container.innerHTML = data; // Check again incase of race condition\n\n      if (hasId && exists()) {\n        return;\n      } // Inject the SVG to the body\n\n\n      document.body.insertAdjacentElement('afterbegin', container);\n    }; // Only load once if ID set\n\n\n    if (!hasId || !exists()) {\n      var useStorage = Storage.supported; // Create container\n\n      var container = document.createElement('div');\n      container.setAttribute('hidden', '');\n\n      if (hasId) {\n        container.setAttribute('id', id);\n      } // Check in cache\n\n\n      if (useStorage) {\n        var cached = window.localStorage.getItem(\"\".concat(prefix, \"-\").concat(id));\n        isCached = cached !== null;\n\n        if (isCached) {\n          var data = JSON.parse(cached);\n          update(container, data.content);\n        }\n      } // Get the sprite\n\n\n      fetch(url).then(function (result) {\n        if (is$1.empty(result)) {\n          return;\n        }\n\n        if (useStorage) {\n          window.localStorage.setItem(\"\".concat(prefix, \"-\").concat(id), JSON.stringify({\n            content: result\n          }));\n        }\n\n        update(container, result);\n      }).catch(function () {});\n    }\n  }\n\n  // ==========================================================================\n\n  var getHours = function getHours(value) {\n    return Math.trunc(value / 60 / 60 % 60, 10);\n  };\n  var getMinutes = function getMinutes(value) {\n    return Math.trunc(value / 60 % 60, 10);\n  };\n  var getSeconds = function getSeconds(value) {\n    return Math.trunc(value % 60, 10);\n  }; // Format time to UI friendly string\n\n  function formatTime() {\n    var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n    var displayHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n    var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n    // Bail if the value isn't a number\n    if (!is$1.number(time)) {\n      return formatTime(null, displayHours, inverted);\n    } // Format time component to add leading zero\n\n\n    var format = function format(value) {\n      return \"0\".concat(value).slice(-2);\n    }; // Breakdown to hours, mins, secs\n\n\n    var hours = getHours(time);\n    var mins = getMinutes(time);\n    var secs = getSeconds(time); // Do we need to display hours?\n\n    if (displayHours || hours > 0) {\n      hours = \"\".concat(hours, \":\");\n    } else {\n      hours = '';\n    } // Render\n\n\n    return \"\".concat(inverted && time > 0 ? '-' : '').concat(hours).concat(format(mins), \":\").concat(format(secs));\n  }\n\n  var controls = {\n    // Get icon URL\n    getIconUrl: function getIconUrl() {\n      var url = new URL(this.config.iconUrl, window.location);\n      var cors = url.host !== window.location.host || browser.isIE && !window.svg4everybody;\n      return {\n        url: this.config.iconUrl,\n        cors: cors\n      };\n    },\n    // Find the UI controls\n    findElements: function findElements() {\n      try {\n        this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper); // Buttons\n\n        this.elements.buttons = {\n          play: getElements.call(this, this.config.selectors.buttons.play),\n          pause: getElement.call(this, this.config.selectors.buttons.pause),\n          restart: getElement.call(this, this.config.selectors.buttons.restart),\n          rewind: getElement.call(this, this.config.selectors.buttons.rewind),\n          fastForward: getElement.call(this, this.config.selectors.buttons.fastForward),\n          mute: getElement.call(this, this.config.selectors.buttons.mute),\n          pip: getElement.call(this, this.config.selectors.buttons.pip),\n          airplay: getElement.call(this, this.config.selectors.buttons.airplay),\n          settings: getElement.call(this, this.config.selectors.buttons.settings),\n          captions: getElement.call(this, this.config.selectors.buttons.captions),\n          fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen)\n        }; // Progress\n\n        this.elements.progress = getElement.call(this, this.config.selectors.progress); // Inputs\n\n        this.elements.inputs = {\n          seek: getElement.call(this, this.config.selectors.inputs.seek),\n          volume: getElement.call(this, this.config.selectors.inputs.volume)\n        }; // Display\n\n        this.elements.display = {\n          buffer: getElement.call(this, this.config.selectors.display.buffer),\n          currentTime: getElement.call(this, this.config.selectors.display.currentTime),\n          duration: getElement.call(this, this.config.selectors.display.duration)\n        }; // Seek tooltip\n\n        if (is$1.element(this.elements.progress)) {\n          this.elements.display.seekTooltip = this.elements.progress.querySelector(\".\".concat(this.config.classNames.tooltip));\n        }\n\n        return true;\n      } catch (error) {\n        // Log it\n        this.debug.warn('It looks like there is a problem with your custom controls HTML', error); // Restore native video controls\n\n        this.toggleNativeControls(true);\n        return false;\n      }\n    },\n    // Create <svg> icon\n    createIcon: function createIcon(type, attributes) {\n      var namespace = 'http://www.w3.org/2000/svg';\n      var iconUrl = controls.getIconUrl.call(this);\n      var iconPath = \"\".concat(!iconUrl.cors ? iconUrl.url : '', \"#\").concat(this.config.iconPrefix); // Create <svg>\n\n      var icon = document.createElementNS(namespace, 'svg');\n      setAttributes(icon, extend(attributes, {\n        role: 'presentation',\n        focusable: 'false'\n      })); // Create the <use> to reference sprite\n\n      var use = document.createElementNS(namespace, 'use');\n      var path = \"\".concat(iconPath, \"-\").concat(type); // Set `href` attributes\n      // https://github.com/sampotts/plyr/issues/460\n      // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href\n\n      if ('href' in use) {\n        use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);\n      } // Always set the older attribute even though it's \"deprecated\" (it'll be around for ages)\n\n\n      use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); // Add <use> to <svg>\n\n      icon.appendChild(use);\n      return icon;\n    },\n    // Create hidden text label\n    createLabel: function createLabel(key) {\n      var attr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n      var text = i18n.get(key, this.config);\n      var attributes = Object.assign({}, attr, {\n        class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')\n      });\n      return createElement('span', attributes, text);\n    },\n    // Create a badge\n    createBadge: function createBadge(text) {\n      if (is$1.empty(text)) {\n        return null;\n      }\n\n      var badge = createElement('span', {\n        class: this.config.classNames.menu.value\n      });\n      badge.appendChild(createElement('span', {\n        class: this.config.classNames.menu.badge\n      }, text));\n      return badge;\n    },\n    // Create a <button>\n    createButton: function createButton(buttonType, attr) {\n      var _this = this;\n\n      var attributes = extend({}, attr);\n      var type = toCamelCase(buttonType);\n      var props = {\n        element: 'button',\n        toggle: false,\n        label: null,\n        icon: null,\n        labelPressed: null,\n        iconPressed: null\n      };\n      ['element', 'icon', 'label'].forEach(function (key) {\n        if (Object.keys(attributes).includes(key)) {\n          props[key] = attributes[key];\n          delete attributes[key];\n        }\n      }); // Default to 'button' type to prevent form submission\n\n      if (props.element === 'button' && !Object.keys(attributes).includes('type')) {\n        attributes.type = 'button';\n      } // Set class name\n\n\n      if (Object.keys(attributes).includes('class')) {\n        if (!attributes.class.split(' ').some(function (c) {\n          return c === _this.config.classNames.control;\n        })) {\n          extend(attributes, {\n            class: \"\".concat(attributes.class, \" \").concat(this.config.classNames.control)\n          });\n        }\n      } else {\n        attributes.class = this.config.classNames.control;\n      } // Large play button\n\n\n      switch (buttonType) {\n        case 'play':\n          props.toggle = true;\n          props.label = 'play';\n          props.labelPressed = 'pause';\n          props.icon = 'play';\n          props.iconPressed = 'pause';\n          break;\n\n        case 'mute':\n          props.toggle = true;\n          props.label = 'mute';\n          props.labelPressed = 'unmute';\n          props.icon = 'volume';\n          props.iconPressed = 'muted';\n          break;\n\n        case 'captions':\n          props.toggle = true;\n          props.label = 'enableCaptions';\n          props.labelPressed = 'disableCaptions';\n          props.icon = 'captions-off';\n          props.iconPressed = 'captions-on';\n          break;\n\n        case 'fullscreen':\n          props.toggle = true;\n          props.label = 'enterFullscreen';\n          props.labelPressed = 'exitFullscreen';\n          props.icon = 'enter-fullscreen';\n          props.iconPressed = 'exit-fullscreen';\n          break;\n\n        case 'play-large':\n          attributes.class += \" \".concat(this.config.classNames.control, \"--overlaid\");\n          type = 'play';\n          props.label = 'play';\n          props.icon = 'play';\n          break;\n\n        default:\n          if (is$1.empty(props.label)) {\n            props.label = type;\n          }\n\n          if (is$1.empty(props.icon)) {\n            props.icon = buttonType;\n          }\n\n      }\n\n      var button = createElement(props.element); // Setup toggle icon and labels\n\n      if (props.toggle) {\n        // Icon\n        button.appendChild(controls.createIcon.call(this, props.iconPressed, {\n          class: 'icon--pressed'\n        }));\n        button.appendChild(controls.createIcon.call(this, props.icon, {\n          class: 'icon--not-pressed'\n        })); // Label/Tooltip\n\n        button.appendChild(controls.createLabel.call(this, props.labelPressed, {\n          class: 'label--pressed'\n        }));\n        button.appendChild(controls.createLabel.call(this, props.label, {\n          class: 'label--not-pressed'\n        }));\n      } else {\n        button.appendChild(controls.createIcon.call(this, props.icon));\n        button.appendChild(controls.createLabel.call(this, props.label));\n      } // Merge and set attributes\n\n\n      extend(attributes, getAttributesFromSelector(this.config.selectors.buttons[type], attributes));\n      setAttributes(button, attributes); // We have multiple play buttons\n\n      if (type === 'play') {\n        if (!is$1.array(this.elements.buttons[type])) {\n          this.elements.buttons[type] = [];\n        }\n\n        this.elements.buttons[type].push(button);\n      } else {\n        this.elements.buttons[type] = button;\n      }\n\n      return button;\n    },\n    // Create an <input type='range'>\n    createRange: function createRange(type, attributes) {\n      // Seek input\n      var input = createElement('input', extend(getAttributesFromSelector(this.config.selectors.inputs[type]), {\n        type: 'range',\n        min: 0,\n        max: 100,\n        step: 0.01,\n        value: 0,\n        autocomplete: 'off',\n        // A11y fixes for https://github.com/sampotts/plyr/issues/905\n        role: 'slider',\n        'aria-label': i18n.get(type, this.config),\n        'aria-valuemin': 0,\n        'aria-valuemax': 100,\n        'aria-valuenow': 0\n      }, attributes));\n      this.elements.inputs[type] = input; // Set the fill for webkit now\n\n      controls.updateRangeFill.call(this, input); // Improve support on touch devices\n\n      RangeTouch.setup(input);\n      return input;\n    },\n    // Create a <progress>\n    createProgress: function createProgress(type, attributes) {\n      var progress = createElement('progress', extend(getAttributesFromSelector(this.config.selectors.display[type]), {\n        min: 0,\n        max: 100,\n        value: 0,\n        role: 'progressbar',\n        'aria-hidden': true\n      }, attributes)); // Create the label inside\n\n      if (type !== 'volume') {\n        progress.appendChild(createElement('span', null, '0'));\n        var suffixKey = {\n          played: 'played',\n          buffer: 'buffered'\n        }[type];\n        var suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';\n        progress.innerText = \"% \".concat(suffix.toLowerCase());\n      }\n\n      this.elements.display[type] = progress;\n      return progress;\n    },\n    // Create time display\n    createTime: function createTime(type, attrs) {\n      var attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);\n      var container = createElement('div', extend(attributes, {\n        class: \"\".concat(attributes.class ? attributes.class : '', \" \").concat(this.config.classNames.display.time, \" \").trim(),\n        'aria-label': i18n.get(type, this.config)\n      }), '00:00'); // Reference for updates\n\n      this.elements.display[type] = container;\n      return container;\n    },\n    // Bind keyboard shortcuts for a menu item\n    // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus\n    // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143\n    bindMenuItemShortcuts: function bindMenuItemShortcuts(menuItem, type) {\n      var _this2 = this;\n\n      // Navigate through menus via arrow keys and space\n      on(menuItem, 'keydown keyup', function (event) {\n        // We only care about space and ⬆️ ⬇️️ ➡️\n        if (![32, 38, 39, 40].includes(event.which)) {\n          return;\n        } // Prevent play / seek\n\n\n        event.preventDefault();\n        event.stopPropagation(); // We're just here to prevent the keydown bubbling\n\n        if (event.type === 'keydown') {\n          return;\n        }\n\n        var isRadioButton = matches$1(menuItem, '[role=\"menuitemradio\"]'); // Show the respective menu\n\n        if (!isRadioButton && [32, 39].includes(event.which)) {\n          controls.showMenuPanel.call(_this2, type, true);\n        } else {\n          var target;\n\n          if (event.which !== 32) {\n            if (event.which === 40 || isRadioButton && event.which === 39) {\n              target = menuItem.nextElementSibling;\n\n              if (!is$1.element(target)) {\n                target = menuItem.parentNode.firstElementChild;\n              }\n            } else {\n              target = menuItem.previousElementSibling;\n\n              if (!is$1.element(target)) {\n                target = menuItem.parentNode.lastElementChild;\n              }\n            }\n\n            setFocus.call(_this2, target, true);\n          }\n        }\n      }, false); // Enter will fire a `click` event but we still need to manage focus\n      // So we bind to keyup which fires after and set focus here\n\n      on(menuItem, 'keyup', function (event) {\n        if (event.which !== 13) {\n          return;\n        }\n\n        controls.focusFirstMenuItem.call(_this2, null, true);\n      });\n    },\n    // Create a settings menu item\n    createMenuItem: function createMenuItem(_ref) {\n      var _this3 = this;\n\n      var value = _ref.value,\n          list = _ref.list,\n          type = _ref.type,\n          title = _ref.title,\n          _ref$badge = _ref.badge,\n          badge = _ref$badge === void 0 ? null : _ref$badge,\n          _ref$checked = _ref.checked,\n          checked = _ref$checked === void 0 ? false : _ref$checked;\n      var attributes = getAttributesFromSelector(this.config.selectors.inputs[type]);\n      var menuItem = createElement('button', extend(attributes, {\n        type: 'button',\n        role: 'menuitemradio',\n        class: \"\".concat(this.config.classNames.control, \" \").concat(attributes.class ? attributes.class : '').trim(),\n        'aria-checked': checked,\n        value: value\n      }));\n      var flex = createElement('span'); // We have to set as HTML incase of special characters\n\n      flex.innerHTML = title;\n\n      if (is$1.element(badge)) {\n        flex.appendChild(badge);\n      }\n\n      menuItem.appendChild(flex); // Replicate radio button behaviour\n\n      Object.defineProperty(menuItem, 'checked', {\n        enumerable: true,\n        get: function get() {\n          return menuItem.getAttribute('aria-checked') === 'true';\n        },\n        set: function set(check) {\n          // Ensure exclusivity\n          if (check) {\n            Array.from(menuItem.parentNode.children).filter(function (node) {\n              return matches$1(node, '[role=\"menuitemradio\"]');\n            }).forEach(function (node) {\n              return node.setAttribute('aria-checked', 'false');\n            });\n          }\n\n          menuItem.setAttribute('aria-checked', check ? 'true' : 'false');\n        }\n      });\n      this.listeners.bind(menuItem, 'click keyup', function (event) {\n        if (is$1.keyboardEvent(event) && event.which !== 32) {\n          return;\n        }\n\n        event.preventDefault();\n        event.stopPropagation();\n        menuItem.checked = true;\n\n        switch (type) {\n          case 'language':\n            _this3.currentTrack = Number(value);\n            break;\n\n          case 'quality':\n            _this3.quality = value;\n            break;\n\n          case 'speed':\n            _this3.speed = parseFloat(value);\n            break;\n\n          default:\n            break;\n        }\n\n        controls.showMenuPanel.call(_this3, 'home', is$1.keyboardEvent(event));\n      }, type, false);\n      controls.bindMenuItemShortcuts.call(this, menuItem, type);\n      list.appendChild(menuItem);\n    },\n    // Format a time for display\n    formatTime: function formatTime$1() {\n      var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n      var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n      // Bail if the value isn't a number\n      if (!is$1.number(time)) {\n        return time;\n      } // Always display hours if duration is over an hour\n\n\n      var forceHours = getHours(this.duration) > 0;\n      return formatTime(time, forceHours, inverted);\n    },\n    // Update the displayed time\n    updateTimeDisplay: function updateTimeDisplay() {\n      var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n      var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n      var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n      // Bail if there's no element to display or the value isn't a number\n      if (!is$1.element(target) || !is$1.number(time)) {\n        return;\n      } // eslint-disable-next-line no-param-reassign\n\n\n      target.innerText = controls.formatTime(time, inverted);\n    },\n    // Update volume UI and storage\n    updateVolume: function updateVolume() {\n      if (!this.supported.ui) {\n        return;\n      } // Update range\n\n\n      if (is$1.element(this.elements.inputs.volume)) {\n        controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume);\n      } // Update mute state\n\n\n      if (is$1.element(this.elements.buttons.mute)) {\n        this.elements.buttons.mute.pressed = this.muted || this.volume === 0;\n      }\n    },\n    // Update seek value and lower fill\n    setRange: function setRange(target) {\n      var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n      if (!is$1.element(target)) {\n        return;\n      } // eslint-disable-next-line\n\n\n      target.value = value; // Webkit range fill\n\n      controls.updateRangeFill.call(this, target);\n    },\n    // Update <progress> elements\n    updateProgress: function updateProgress(event) {\n      var _this4 = this;\n\n      if (!this.supported.ui || !is$1.event(event)) {\n        return;\n      }\n\n      var value = 0;\n\n      var setProgress = function setProgress(target, input) {\n        var val = is$1.number(input) ? input : 0;\n        var progress = is$1.element(target) ? target : _this4.elements.display.buffer; // Update value and label\n\n        if (is$1.element(progress)) {\n          progress.value = val; // Update text label inside\n\n          var label = progress.getElementsByTagName('span')[0];\n\n          if (is$1.element(label)) {\n            label.childNodes[0].nodeValue = val;\n          }\n        }\n      };\n\n      if (event) {\n        switch (event.type) {\n          // Video playing\n          case 'timeupdate':\n          case 'seeking':\n          case 'seeked':\n            value = getPercentage(this.currentTime, this.duration); // Set seek range value only if it's a 'natural' time event\n\n            if (event.type === 'timeupdate') {\n              controls.setRange.call(this, this.elements.inputs.seek, value);\n            }\n\n            break;\n          // Check buffer status\n\n          case 'playing':\n          case 'progress':\n            setProgress(this.elements.display.buffer, this.buffered * 100);\n            break;\n\n          default:\n            break;\n        }\n      }\n    },\n    // Webkit polyfill for lower fill range\n    updateRangeFill: function updateRangeFill(target) {\n      // Get range from event if event passed\n      var range = is$1.event(target) ? target.target : target; // Needs to be a valid <input type='range'>\n\n      if (!is$1.element(range) || range.getAttribute('type') !== 'range') {\n        return;\n      } // Set aria values for https://github.com/sampotts/plyr/issues/905\n\n\n      if (matches$1(range, this.config.selectors.inputs.seek)) {\n        range.setAttribute('aria-valuenow', this.currentTime);\n        var currentTime = controls.formatTime(this.currentTime);\n        var duration = controls.formatTime(this.duration);\n        var format = i18n.get('seekLabel', this.config);\n        range.setAttribute('aria-valuetext', format.replace('{currentTime}', currentTime).replace('{duration}', duration));\n      } else if (matches$1(range, this.config.selectors.inputs.volume)) {\n        var percent = range.value * 100;\n        range.setAttribute('aria-valuenow', percent);\n        range.setAttribute('aria-valuetext', \"\".concat(percent.toFixed(1), \"%\"));\n      } else {\n        range.setAttribute('aria-valuenow', range.value);\n      } // WebKit only\n\n\n      if (!browser.isWebkit) {\n        return;\n      } // Set CSS custom property\n\n\n      range.style.setProperty('--value', \"\".concat(range.value / range.max * 100, \"%\"));\n    },\n    // Update hover tooltip for seeking\n    updateSeekTooltip: function updateSeekTooltip(event) {\n      var _this5 = this;\n\n      // Bail if setting not true\n      if (!this.config.tooltips.seek || !is$1.element(this.elements.inputs.seek) || !is$1.element(this.elements.display.seekTooltip) || this.duration === 0) {\n        return;\n      }\n\n      var visible = \"\".concat(this.config.classNames.tooltip, \"--visible\");\n\n      var toggle = function toggle(show) {\n        return toggleClass(_this5.elements.display.seekTooltip, visible, show);\n      }; // Hide on touch\n\n\n      if (this.touch) {\n        toggle(false);\n        return;\n      } // Determine percentage, if already visible\n\n\n      var percent = 0;\n      var clientRect = this.elements.progress.getBoundingClientRect();\n\n      if (is$1.event(event)) {\n        percent = 100 / clientRect.width * (event.pageX - clientRect.left);\n      } else if (hasClass(this.elements.display.seekTooltip, visible)) {\n        percent = parseFloat(this.elements.display.seekTooltip.style.left, 10);\n      } else {\n        return;\n      } // Set bounds\n\n\n      if (percent < 0) {\n        percent = 0;\n      } else if (percent > 100) {\n        percent = 100;\n      } // Display the time a click would seek to\n\n\n      controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * percent); // Set position\n\n      this.elements.display.seekTooltip.style.left = \"\".concat(percent, \"%\"); // Show/hide the tooltip\n      // If the event is a moues in/out and percentage is inside bounds\n\n      if (is$1.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) {\n        toggle(event.type === 'mouseenter');\n      }\n    },\n    // Handle time change event\n    timeUpdate: function timeUpdate(event) {\n      // Only invert if only one time element is displayed and used for both duration and currentTime\n      var invert = !is$1.element(this.elements.display.duration) && this.config.invertTime; // Duration\n\n      controls.updateTimeDisplay.call(this, this.elements.display.currentTime, invert ? this.duration - this.currentTime : this.currentTime, invert); // Ignore updates while seeking\n\n      if (event && event.type === 'timeupdate' && this.media.seeking) {\n        return;\n      } // Playing progress\n\n\n      controls.updateProgress.call(this, event);\n    },\n    // Show the duration on metadataloaded or durationchange events\n    durationUpdate: function durationUpdate() {\n      // Bail if no UI or durationchange event triggered after playing/seek when invertTime is false\n      if (!this.supported.ui || !this.config.invertTime && this.currentTime) {\n        return;\n      } // If duration is the 2**32 (shaka), Infinity (HLS), DASH-IF (Number.MAX_SAFE_INTEGER || Number.MAX_VALUE) indicating live we hide the currentTime and progressbar.\n      // https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415\n      // https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062\n      // https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338\n\n\n      if (this.duration >= Math.pow(2, 32)) {\n        toggleHidden(this.elements.display.currentTime, true);\n        toggleHidden(this.elements.progress, true);\n        return;\n      } // Update ARIA values\n\n\n      if (is$1.element(this.elements.inputs.seek)) {\n        this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);\n      } // If there's a spot to display duration\n\n\n      var hasDuration = is$1.element(this.elements.display.duration); // If there's only one time display, display duration there\n\n      if (!hasDuration && this.config.displayDuration && this.paused) {\n        controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration);\n      } // If there's a duration element, update content\n\n\n      if (hasDuration) {\n        controls.updateTimeDisplay.call(this, this.elements.display.duration, this.duration);\n      } // Update the tooltip (if visible)\n\n\n      controls.updateSeekTooltip.call(this);\n    },\n    // Hide/show a tab\n    toggleMenuButton: function toggleMenuButton(setting, toggle) {\n      toggleHidden(this.elements.settings.buttons[setting], !toggle);\n    },\n    // Update the selected setting\n    updateSetting: function updateSetting(setting, container, input) {\n      var pane = this.elements.settings.panels[setting];\n      var value = null;\n      var list = container;\n\n      if (setting === 'captions') {\n        value = this.currentTrack;\n      } else {\n        value = !is$1.empty(input) ? input : this[setting]; // Get default\n\n        if (is$1.empty(value)) {\n          value = this.config[setting].default;\n        } // Unsupported value\n\n\n        if (!is$1.empty(this.options[setting]) && !this.options[setting].includes(value)) {\n          this.debug.warn(\"Unsupported value of '\".concat(value, \"' for \").concat(setting));\n          return;\n        } // Disabled value\n\n\n        if (!this.config[setting].options.includes(value)) {\n          this.debug.warn(\"Disabled value of '\".concat(value, \"' for \").concat(setting));\n          return;\n        }\n      } // Get the list if we need to\n\n\n      if (!is$1.element(list)) {\n        list = pane && pane.querySelector('[role=\"menu\"]');\n      } // If there's no list it means it's not been rendered...\n\n\n      if (!is$1.element(list)) {\n        return;\n      } // Update the label\n\n\n      var label = this.elements.settings.buttons[setting].querySelector(\".\".concat(this.config.classNames.menu.value));\n      label.innerHTML = controls.getLabel.call(this, setting, value); // Find the radio option and check it\n\n      var target = list && list.querySelector(\"[value=\\\"\".concat(value, \"\\\"]\"));\n\n      if (is$1.element(target)) {\n        target.checked = true;\n      }\n    },\n    // Translate a value into a nice label\n    getLabel: function getLabel(setting, value) {\n      switch (setting) {\n        case 'speed':\n          return value === 1 ? i18n.get('normal', this.config) : \"\".concat(value, \"&times;\");\n\n        case 'quality':\n          if (is$1.number(value)) {\n            var label = i18n.get(\"qualityLabel.\".concat(value), this.config);\n\n            if (!label.length) {\n              return \"\".concat(value, \"p\");\n            }\n\n            return label;\n          }\n\n          return toTitleCase(value);\n\n        case 'captions':\n          return captions.getLabel.call(this);\n\n        default:\n          return null;\n      }\n    },\n    // Set the quality menu\n    setQualityMenu: function setQualityMenu(options) {\n      var _this6 = this;\n\n      // Menu required\n      if (!is$1.element(this.elements.settings.panels.quality)) {\n        return;\n      }\n\n      var type = 'quality';\n      var list = this.elements.settings.panels.quality.querySelector('[role=\"menu\"]'); // Set options if passed and filter based on uniqueness and config\n\n      if (is$1.array(options)) {\n        this.options.quality = dedupe(options).filter(function (quality) {\n          return _this6.config.quality.options.includes(quality);\n        });\n      } // Toggle the pane and tab\n\n\n      var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1;\n      controls.toggleMenuButton.call(this, type, toggle); // Empty the menu\n\n      emptyElement(list); // Check if we need to toggle the parent\n\n      controls.checkMenu.call(this); // If we're hiding, nothing more to do\n\n      if (!toggle) {\n        return;\n      } // Get the badge HTML for HD, 4K etc\n\n\n      var getBadge = function getBadge(quality) {\n        var label = i18n.get(\"qualityBadge.\".concat(quality), _this6.config);\n\n        if (!label.length) {\n          return null;\n        }\n\n        return controls.createBadge.call(_this6, label);\n      }; // Sort options by the config and then render options\n\n\n      this.options.quality.sort(function (a, b) {\n        var sorting = _this6.config.quality.options;\n        return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;\n      }).forEach(function (quality) {\n        controls.createMenuItem.call(_this6, {\n          value: quality,\n          list: list,\n          type: type,\n          title: controls.getLabel.call(_this6, 'quality', quality),\n          badge: getBadge(quality)\n        });\n      });\n      controls.updateSetting.call(this, type, list);\n    },\n    // Set the looping options\n\n    /* setLoopMenu() {\n        // Menu required\n        if (!is.element(this.elements.settings.panels.loop)) {\n            return;\n        }\n         const options = ['start', 'end', 'all', 'reset'];\n        const list = this.elements.settings.panels.loop.querySelector('[role=\"menu\"]');\n         // Show the pane and tab\n        toggleHidden(this.elements.settings.buttons.loop, false);\n        toggleHidden(this.elements.settings.panels.loop, false);\n         // Toggle the pane and tab\n        const toggle = !is.empty(this.loop.options);\n        controls.toggleMenuButton.call(this, 'loop', toggle);\n         // Empty the menu\n        emptyElement(list);\n         options.forEach(option => {\n            const item = createElement('li');\n             const button = createElement(\n                'button',\n                extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {\n                    type: 'button',\n                    class: this.config.classNames.control,\n                    'data-plyr-loop-action': option,\n                }),\n                i18n.get(option, this.config)\n            );\n             if (['start', 'end'].includes(option)) {\n                const badge = controls.createBadge.call(this, '00:00');\n                button.appendChild(badge);\n            }\n             item.appendChild(button);\n            list.appendChild(item);\n        });\n    }, */\n    // Get current selected caption language\n    // TODO: rework this to user the getter in the API?\n    // Set a list of available captions languages\n    setCaptionsMenu: function setCaptionsMenu() {\n      var _this7 = this;\n\n      // Menu required\n      if (!is$1.element(this.elements.settings.panels.captions)) {\n        return;\n      } // TODO: Captions or language? Currently it's mixed\n\n\n      var type = 'captions';\n      var list = this.elements.settings.panels.captions.querySelector('[role=\"menu\"]');\n      var tracks = captions.getTracks.call(this);\n      var toggle = Boolean(tracks.length); // Toggle the pane and tab\n\n      controls.toggleMenuButton.call(this, type, toggle); // Empty the menu\n\n      emptyElement(list); // Check if we need to toggle the parent\n\n      controls.checkMenu.call(this); // If there's no captions, bail\n\n      if (!toggle) {\n        return;\n      } // Generate options data\n\n\n      var options = tracks.map(function (track, value) {\n        return {\n          value: value,\n          checked: _this7.captions.toggled && _this7.currentTrack === value,\n          title: captions.getLabel.call(_this7, track),\n          badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),\n          list: list,\n          type: 'language'\n        };\n      }); // Add the \"Disabled\" option to turn off captions\n\n      options.unshift({\n        value: -1,\n        checked: !this.captions.toggled,\n        title: i18n.get('disabled', this.config),\n        list: list,\n        type: 'language'\n      }); // Generate options\n\n      options.forEach(controls.createMenuItem.bind(this));\n      controls.updateSetting.call(this, type, list);\n    },\n    // Set a list of available captions languages\n    setSpeedMenu: function setSpeedMenu(options) {\n      var _this8 = this;\n\n      // Menu required\n      if (!is$1.element(this.elements.settings.panels.speed)) {\n        return;\n      }\n\n      var type = 'speed';\n      var list = this.elements.settings.panels.speed.querySelector('[role=\"menu\"]'); // Set the speed options\n\n      if (is$1.array(options)) {\n        this.options.speed = options;\n      } else if (this.isHTML5 || this.isVimeo) {\n        this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];\n      } // Set options if passed and filter based on config\n\n\n      this.options.speed = this.options.speed.filter(function (speed) {\n        return _this8.config.speed.options.includes(speed);\n      }); // Toggle the pane and tab\n\n      var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1;\n      controls.toggleMenuButton.call(this, type, toggle); // Empty the menu\n\n      emptyElement(list); // Check if we need to toggle the parent\n\n      controls.checkMenu.call(this); // If we're hiding, nothing more to do\n\n      if (!toggle) {\n        return;\n      } // Create items\n\n\n      this.options.speed.forEach(function (speed) {\n        controls.createMenuItem.call(_this8, {\n          value: speed,\n          list: list,\n          type: type,\n          title: controls.getLabel.call(_this8, 'speed', speed)\n        });\n      });\n      controls.updateSetting.call(this, type, list);\n    },\n    // Check if we need to hide/show the settings menu\n    checkMenu: function checkMenu() {\n      var buttons = this.elements.settings.buttons;\n      var visible = !is$1.empty(buttons) && Object.values(buttons).some(function (button) {\n        return !button.hidden;\n      });\n      toggleHidden(this.elements.settings.menu, !visible);\n    },\n    // Focus the first menu item in a given (or visible) menu\n    focusFirstMenuItem: function focusFirstMenuItem(pane) {\n      var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n      if (this.elements.settings.popup.hidden) {\n        return;\n      }\n\n      var target = pane;\n\n      if (!is$1.element(target)) {\n        target = Object.values(this.elements.settings.panels).find(function (p) {\n          return !p.hidden;\n        });\n      }\n\n      var firstItem = target.querySelector('[role^=\"menuitem\"]');\n      setFocus.call(this, firstItem, tabFocus);\n    },\n    // Show/hide menu\n    toggleMenu: function toggleMenu(input) {\n      var popup = this.elements.settings.popup;\n      var button = this.elements.buttons.settings; // Menu and button are required\n\n      if (!is$1.element(popup) || !is$1.element(button)) {\n        return;\n      } // True toggle by default\n\n\n      var hidden = popup.hidden;\n      var show = hidden;\n\n      if (is$1.boolean(input)) {\n        show = input;\n      } else if (is$1.keyboardEvent(input) && input.which === 27) {\n        show = false;\n      } else if (is$1.event(input)) {\n        // If Plyr is in a shadowDOM, the event target is set to the component, instead of the\n        // Element in the shadowDOM. The path, if available, is complete.\n        var target = is$1.function(input.composedPath) ? input.composedPath()[0] : input.target;\n        var isMenuItem = popup.contains(target); // If the click was inside the menu or if the click\n        // wasn't the button or menu item and we're trying to\n        // show the menu (a doc click shouldn't show the menu)\n\n        if (isMenuItem || !isMenuItem && input.target !== button && show) {\n          return;\n        }\n      } // Set button attributes\n\n\n      button.setAttribute('aria-expanded', show); // Show the actual popup\n\n      toggleHidden(popup, !show); // Add class hook\n\n      toggleClass(this.elements.container, this.config.classNames.menu.open, show); // Focus the first item if key interaction\n\n      if (show && is$1.keyboardEvent(input)) {\n        controls.focusFirstMenuItem.call(this, null, true);\n      } else if (!show && !hidden) {\n        // If closing, re-focus the button\n        setFocus.call(this, button, is$1.keyboardEvent(input));\n      }\n    },\n    // Get the natural size of a menu panel\n    getMenuSize: function getMenuSize(tab) {\n      var clone = tab.cloneNode(true);\n      clone.style.position = 'absolute';\n      clone.style.opacity = 0;\n      clone.removeAttribute('hidden'); // Append to parent so we get the \"real\" size\n\n      tab.parentNode.appendChild(clone); // Get the sizes before we remove\n\n      var width = clone.scrollWidth;\n      var height = clone.scrollHeight; // Remove from the DOM\n\n      removeElement(clone);\n      return {\n        width: width,\n        height: height\n      };\n    },\n    // Show a panel in the menu\n    showMenuPanel: function showMenuPanel() {\n      var _this9 = this;\n\n      var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n      var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n      var target = this.elements.container.querySelector(\"#plyr-settings-\".concat(this.id, \"-\").concat(type)); // Nothing to show, bail\n\n      if (!is$1.element(target)) {\n        return;\n      } // Hide all other panels\n\n\n      var container = target.parentNode;\n      var current = Array.from(container.children).find(function (node) {\n        return !node.hidden;\n      }); // If we can do fancy animations, we'll animate the height/width\n\n      if (support.transitions && !support.reducedMotion) {\n        // Set the current width as a base\n        container.style.width = \"\".concat(current.scrollWidth, \"px\");\n        container.style.height = \"\".concat(current.scrollHeight, \"px\"); // Get potential sizes\n\n        var size = controls.getMenuSize.call(this, target); // Restore auto height/width\n\n        var restore = function restore(event) {\n          // We're only bothered about height and width on the container\n          if (event.target !== container || !['width', 'height'].includes(event.propertyName)) {\n            return;\n          } // Revert back to auto\n\n\n          container.style.width = '';\n          container.style.height = ''; // Only listen once\n\n          off.call(_this9, container, transitionEndEvent, restore);\n        }; // Listen for the transition finishing and restore auto height/width\n\n\n        on.call(this, container, transitionEndEvent, restore); // Set dimensions to target\n\n        container.style.width = \"\".concat(size.width, \"px\");\n        container.style.height = \"\".concat(size.height, \"px\");\n      } // Set attributes on current tab\n\n\n      toggleHidden(current, true); // Set attributes on target\n\n      toggleHidden(target, false); // Focus the first item\n\n      controls.focusFirstMenuItem.call(this, target, tabFocus);\n    },\n    // Set the download URL\n    setDownloadUrl: function setDownloadUrl() {\n      var button = this.elements.buttons.download; // Bail if no button\n\n      if (!is$1.element(button)) {\n        return;\n      } // Set attribute\n\n\n      button.setAttribute('href', this.download);\n    },\n    // Build the default HTML\n    create: function create(data) {\n      var _this10 = this;\n\n      var bindMenuItemShortcuts = controls.bindMenuItemShortcuts,\n          createButton = controls.createButton,\n          createProgress = controls.createProgress,\n          createRange = controls.createRange,\n          createTime = controls.createTime,\n          setQualityMenu = controls.setQualityMenu,\n          setSpeedMenu = controls.setSpeedMenu,\n          showMenuPanel = controls.showMenuPanel;\n      this.elements.controls = null; // Larger overlaid play button\n\n      if (this.config.controls.includes('play-large')) {\n        this.elements.container.appendChild(createButton.call(this, 'play-large'));\n      } // Create the container\n\n\n      var container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));\n      this.elements.controls = container; // Default item attributes\n\n      var defaultAttributes = {\n        class: 'plyr__controls__item'\n      }; // Loop through controls in order\n\n      dedupe(this.config.controls).forEach(function (control) {\n        // Restart button\n        if (control === 'restart') {\n          container.appendChild(createButton.call(_this10, 'restart', defaultAttributes));\n        } // Rewind button\n\n\n        if (control === 'rewind') {\n          container.appendChild(createButton.call(_this10, 'rewind', defaultAttributes));\n        } // Play/Pause button\n\n\n        if (control === 'play') {\n          container.appendChild(createButton.call(_this10, 'play', defaultAttributes));\n        } // Fast forward button\n\n\n        if (control === 'fast-forward') {\n          container.appendChild(createButton.call(_this10, 'fast-forward', defaultAttributes));\n        } // Progress\n\n\n        if (control === 'progress') {\n          var progressContainer = createElement('div', {\n            class: \"\".concat(defaultAttributes.class, \" plyr__progress__container\")\n          });\n          var progress = createElement('div', getAttributesFromSelector(_this10.config.selectors.progress)); // Seek range slider\n\n          progress.appendChild(createRange.call(_this10, 'seek', {\n            id: \"plyr-seek-\".concat(data.id)\n          })); // Buffer progress\n\n          progress.appendChild(createProgress.call(_this10, 'buffer')); // TODO: Add loop display indicator\n          // Seek tooltip\n\n          if (_this10.config.tooltips.seek) {\n            var tooltip = createElement('span', {\n              class: _this10.config.classNames.tooltip\n            }, '00:00');\n            progress.appendChild(tooltip);\n            _this10.elements.display.seekTooltip = tooltip;\n          }\n\n          _this10.elements.progress = progress;\n          progressContainer.appendChild(_this10.elements.progress);\n          container.appendChild(progressContainer);\n        } // Media current time display\n\n\n        if (control === 'current-time') {\n          container.appendChild(createTime.call(_this10, 'currentTime', defaultAttributes));\n        } // Media duration display\n\n\n        if (control === 'duration') {\n          container.appendChild(createTime.call(_this10, 'duration', defaultAttributes));\n        } // Volume controls\n\n\n        if (control === 'mute' || control === 'volume') {\n          var volume = _this10.elements.volume; // Create the volume container if needed\n\n          if (!is$1.element(volume) || !container.contains(volume)) {\n            volume = createElement('div', extend({}, defaultAttributes, {\n              class: \"\".concat(defaultAttributes.class, \" plyr__volume\").trim()\n            }));\n            _this10.elements.volume = volume;\n            container.appendChild(volume);\n          } // Toggle mute button\n\n\n          if (control === 'mute') {\n            volume.appendChild(createButton.call(_this10, 'mute'));\n          } // Volume range control\n\n\n          if (control === 'volume') {\n            // Set the attributes\n            var attributes = {\n              max: 1,\n              step: 0.05,\n              value: _this10.config.volume\n            }; // Create the volume range slider\n\n            volume.appendChild(createRange.call(_this10, 'volume', extend(attributes, {\n              id: \"plyr-volume-\".concat(data.id)\n            })));\n          }\n        } // Toggle captions button\n\n\n        if (control === 'captions') {\n          container.appendChild(createButton.call(_this10, 'captions', defaultAttributes));\n        } // Settings button / menu\n\n\n        if (control === 'settings' && !is$1.empty(_this10.config.settings)) {\n          var wrapper = createElement('div', extend({}, defaultAttributes, {\n            class: \"\".concat(defaultAttributes.class, \" plyr__menu\").trim(),\n            hidden: ''\n          }));\n          wrapper.appendChild(createButton.call(_this10, 'settings', {\n            'aria-haspopup': true,\n            'aria-controls': \"plyr-settings-\".concat(data.id),\n            'aria-expanded': false\n          }));\n          var popup = createElement('div', {\n            class: 'plyr__menu__container',\n            id: \"plyr-settings-\".concat(data.id),\n            hidden: ''\n          });\n          var inner = createElement('div');\n          var home = createElement('div', {\n            id: \"plyr-settings-\".concat(data.id, \"-home\")\n          }); // Create the menu\n\n          var menu = createElement('div', {\n            role: 'menu'\n          });\n          home.appendChild(menu);\n          inner.appendChild(home);\n          _this10.elements.settings.panels.home = home; // Build the menu items\n\n          _this10.config.settings.forEach(function (type) {\n            // TODO: bundle this with the createMenuItem helper and bindings\n            var menuItem = createElement('button', extend(getAttributesFromSelector(_this10.config.selectors.buttons.settings), {\n              type: 'button',\n              class: \"\".concat(_this10.config.classNames.control, \" \").concat(_this10.config.classNames.control, \"--forward\"),\n              role: 'menuitem',\n              'aria-haspopup': true,\n              hidden: ''\n            })); // Bind menu shortcuts for keyboard users\n\n            bindMenuItemShortcuts.call(_this10, menuItem, type); // Show menu on click\n\n            on(menuItem, 'click', function () {\n              showMenuPanel.call(_this10, type, false);\n            });\n            var flex = createElement('span', null, i18n.get(type, _this10.config));\n            var value = createElement('span', {\n              class: _this10.config.classNames.menu.value\n            }); // Speed contains HTML entities\n\n            value.innerHTML = data[type];\n            flex.appendChild(value);\n            menuItem.appendChild(flex);\n            menu.appendChild(menuItem); // Build the panes\n\n            var pane = createElement('div', {\n              id: \"plyr-settings-\".concat(data.id, \"-\").concat(type),\n              hidden: ''\n            }); // Back button\n\n            var backButton = createElement('button', {\n              type: 'button',\n              class: \"\".concat(_this10.config.classNames.control, \" \").concat(_this10.config.classNames.control, \"--back\")\n            }); // Visible label\n\n            backButton.appendChild(createElement('span', {\n              'aria-hidden': true\n            }, i18n.get(type, _this10.config))); // Screen reader label\n\n            backButton.appendChild(createElement('span', {\n              class: _this10.config.classNames.hidden\n            }, i18n.get('menuBack', _this10.config))); // Go back via keyboard\n\n            on(pane, 'keydown', function (event) {\n              // We only care about <-\n              if (event.which !== 37) {\n                return;\n              } // Prevent seek\n\n\n              event.preventDefault();\n              event.stopPropagation(); // Show the respective menu\n\n              showMenuPanel.call(_this10, 'home', true);\n            }, false); // Go back via button click\n\n            on(backButton, 'click', function () {\n              showMenuPanel.call(_this10, 'home', false);\n            }); // Add to pane\n\n            pane.appendChild(backButton); // Menu\n\n            pane.appendChild(createElement('div', {\n              role: 'menu'\n            }));\n            inner.appendChild(pane);\n            _this10.elements.settings.buttons[type] = menuItem;\n            _this10.elements.settings.panels[type] = pane;\n          });\n\n          popup.appendChild(inner);\n          wrapper.appendChild(popup);\n          container.appendChild(wrapper);\n          _this10.elements.settings.popup = popup;\n          _this10.elements.settings.menu = wrapper;\n        } // Picture in picture button\n\n\n        if (control === 'pip' && support.pip) {\n          container.appendChild(createButton.call(_this10, 'pip', defaultAttributes));\n        } // Airplay button\n\n\n        if (control === 'airplay' && support.airplay) {\n          container.appendChild(createButton.call(_this10, 'airplay', defaultAttributes));\n        } // Download button\n\n\n        if (control === 'download') {\n          var _attributes = extend({}, defaultAttributes, {\n            element: 'a',\n            href: _this10.download,\n            target: '_blank'\n          });\n\n          var download = _this10.config.urls.download;\n\n          if (!is$1.url(download) && _this10.isEmbed) {\n            extend(_attributes, {\n              icon: \"logo-\".concat(_this10.provider),\n              label: _this10.provider\n            });\n          }\n\n          container.appendChild(createButton.call(_this10, 'download', _attributes));\n        } // Toggle fullscreen button\n\n\n        if (control === 'fullscreen') {\n          container.appendChild(createButton.call(_this10, 'fullscreen', defaultAttributes));\n        }\n      }); // Set available quality levels\n\n      if (this.isHTML5) {\n        setQualityMenu.call(this, html5.getQualityOptions.call(this));\n      }\n\n      setSpeedMenu.call(this);\n      return container;\n    },\n    // Insert controls\n    inject: function inject() {\n      var _this11 = this;\n\n      // Sprite\n      if (this.config.loadSprite) {\n        var icon = controls.getIconUrl.call(this); // Only load external sprite using AJAX\n\n        if (icon.cors) {\n          loadSprite(icon.url, 'sprite-plyr');\n        }\n      } // Create a unique ID\n\n\n      this.id = Math.floor(Math.random() * 10000); // Null by default\n\n      var container = null;\n      this.elements.controls = null; // Set template properties\n\n      var props = {\n        id: this.id,\n        seektime: this.config.seekTime,\n        title: this.config.title\n      };\n      var update = true; // If function, run it and use output\n\n      if (is$1.function(this.config.controls)) {\n        this.config.controls = this.config.controls.call(this, props);\n      } // Convert falsy controls to empty array (primarily for empty strings)\n\n\n      if (!this.config.controls) {\n        this.config.controls = [];\n      }\n\n      if (is$1.element(this.config.controls) || is$1.string(this.config.controls)) {\n        // HTMLElement or Non-empty string passed as the option\n        container = this.config.controls;\n      } else {\n        // Create controls\n        container = controls.create.call(this, {\n          id: this.id,\n          seektime: this.config.seekTime,\n          speed: this.speed,\n          quality: this.quality,\n          captions: captions.getLabel.call(this) // TODO: Looping\n          // loop: 'None',\n\n        });\n        update = false;\n      } // Replace props with their value\n\n\n      var replace = function replace(input) {\n        var result = input;\n        Object.entries(props).forEach(function (_ref2) {\n          var _ref3 = _slicedToArray(_ref2, 2),\n              key = _ref3[0],\n              value = _ref3[1];\n\n          result = replaceAll(result, \"{\".concat(key, \"}\"), value);\n        });\n        return result;\n      }; // Update markup\n\n\n      if (update) {\n        if (is$1.string(this.config.controls)) {\n          container = replace(container);\n        } else if (is$1.element(container)) {\n          container.innerHTML = replace(container.innerHTML);\n        }\n      } // Controls container\n\n\n      var target; // Inject to custom location\n\n      if (is$1.string(this.config.selectors.controls.container)) {\n        target = document.querySelector(this.config.selectors.controls.container);\n      } // Inject into the container by default\n\n\n      if (!is$1.element(target)) {\n        target = this.elements.container;\n      } // Inject controls HTML (needs to be before captions, hence \"afterbegin\")\n\n\n      var insertMethod = is$1.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';\n      target[insertMethod]('afterbegin', container); // Find the elements if need be\n\n      if (!is$1.element(this.elements.controls)) {\n        controls.findElements.call(this);\n      } // Add pressed property to buttons\n\n\n      if (!is$1.empty(this.elements.buttons)) {\n        var addProperty = function addProperty(button) {\n          var className = _this11.config.classNames.controlPressed;\n          Object.defineProperty(button, 'pressed', {\n            enumerable: true,\n            get: function get() {\n              return hasClass(button, className);\n            },\n            set: function set() {\n              var pressed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n              toggleClass(button, className, pressed);\n            }\n          });\n        }; // Toggle classname when pressed property is set\n\n\n        Object.values(this.elements.buttons).filter(Boolean).forEach(function (button) {\n          if (is$1.array(button) || is$1.nodeList(button)) {\n            Array.from(button).filter(Boolean).forEach(addProperty);\n          } else {\n            addProperty(button);\n          }\n        });\n      } // Edge sometimes doesn't finish the paint so force a repaint\n\n\n      if (browser.isEdge) {\n        repaint(target);\n      } // Setup tooltips\n\n\n      if (this.config.tooltips.controls) {\n        var _this$config = this.config,\n            classNames = _this$config.classNames,\n            selectors = _this$config.selectors;\n        var selector = \"\".concat(selectors.controls.wrapper, \" \").concat(selectors.labels, \" .\").concat(classNames.hidden);\n        var labels = getElements.call(this, selector);\n        Array.from(labels).forEach(function (label) {\n          toggleClass(label, _this11.config.classNames.hidden, false);\n          toggleClass(label, _this11.config.classNames.tooltip, true);\n        });\n      }\n    }\n  };\n\n  /**\n   * Parse a string to a URL object\n   * @param {String} input - the URL to be parsed\n   * @param {Boolean} safe - failsafe parsing\n   */\n\n  function parseUrl(input) {\n    var safe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n    var url = input;\n\n    if (safe) {\n      var parser = document.createElement('a');\n      parser.href = url;\n      url = parser.href;\n    }\n\n    try {\n      return new URL(url);\n    } catch (e) {\n      return null;\n    }\n  } // Convert object to URLSearchParams\n\n  function buildUrlParams(input) {\n    var params = new URLSearchParams();\n\n    if (is$1.object(input)) {\n      Object.entries(input).forEach(function (_ref) {\n        var _ref2 = _slicedToArray(_ref, 2),\n            key = _ref2[0],\n            value = _ref2[1];\n\n        params.set(key, value);\n      });\n    }\n\n    return params;\n  }\n\n  var captions = {\n    // Setup captions\n    setup: function setup() {\n      // Requires UI support\n      if (!this.supported.ui) {\n        return;\n      } // Only Vimeo and HTML5 video supported at this point\n\n\n      if (!this.isVideo || this.isYouTube || this.isHTML5 && !support.textTracks) {\n        // Clear menu and hide\n        if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {\n          controls.setCaptionsMenu.call(this);\n        }\n\n        return;\n      } // Inject the container\n\n\n      if (!is$1.element(this.elements.captions)) {\n        this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions));\n        insertAfter(this.elements.captions, this.elements.wrapper);\n      } // Fix IE captions if CORS is used\n      // Fetch captions and inject as blobs instead (data URIs not supported!)\n\n\n      if (browser.isIE && window.URL) {\n        var elements = this.media.querySelectorAll('track');\n        Array.from(elements).forEach(function (track) {\n          var src = track.getAttribute('src');\n          var url = parseUrl(src);\n\n          if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {\n            fetch(src, 'blob').then(function (blob) {\n              track.setAttribute('src', window.URL.createObjectURL(blob));\n            }).catch(function () {\n              removeElement(track);\n            });\n          }\n        });\n      } // Get and set initial data\n      // The \"preferred\" options are not realized unless / until the wanted language has a match\n      // * languages: Array of user's browser languages.\n      // * language:  The language preferred by user settings or config\n      // * active:    The state preferred by user settings or config\n      // * toggled:   The real captions state\n\n\n      var browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en'];\n      var languages = dedupe(browserLanguages.map(function (language) {\n        return language.split('-')[0];\n      }));\n      var language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase(); // Use first browser language when language is 'auto'\n\n      if (language === 'auto') {\n        var _languages = _slicedToArray(languages, 1);\n\n        language = _languages[0];\n      }\n\n      var active = this.storage.get('captions');\n\n      if (!is$1.boolean(active)) {\n        active = this.config.captions.active;\n      }\n\n      Object.assign(this.captions, {\n        toggled: false,\n        active: active,\n        language: language,\n        languages: languages\n      }); // Watch changes to textTracks and update captions menu\n\n      if (this.isHTML5) {\n        var trackEvents = this.config.captions.update ? 'addtrack removetrack' : 'removetrack';\n        on.call(this, this.media.textTracks, trackEvents, captions.update.bind(this));\n      } // Update available languages in list next tick (the event must not be triggered before the listeners)\n\n\n      setTimeout(captions.update.bind(this), 0);\n    },\n    // Update available language options in settings based on tracks\n    update: function update() {\n      var _this = this;\n\n      var tracks = captions.getTracks.call(this, true); // Get the wanted language\n\n      var _this$captions = this.captions,\n          active = _this$captions.active,\n          language = _this$captions.language,\n          meta = _this$captions.meta,\n          currentTrackNode = _this$captions.currentTrackNode;\n      var languageExists = Boolean(tracks.find(function (track) {\n        return track.language === language;\n      })); // Handle tracks (add event listener and \"pseudo\"-default)\n\n      if (this.isHTML5 && this.isVideo) {\n        tracks.filter(function (track) {\n          return !meta.get(track);\n        }).forEach(function (track) {\n          _this.debug.log('Track added', track); // Attempt to store if the original dom element was \"default\"\n\n\n          meta.set(track, {\n            default: track.mode === 'showing'\n          }); // Turn off native caption rendering to avoid double captions\n          // eslint-disable-next-line no-param-reassign\n\n          track.mode = 'hidden'; // Add event listener for cue changes\n\n          on.call(_this, track, 'cuechange', function () {\n            return captions.updateCues.call(_this);\n          });\n        });\n      } // Update language first time it matches, or if the previous matching track was removed\n\n\n      if (languageExists && this.language !== language || !tracks.includes(currentTrackNode)) {\n        captions.setLanguage.call(this, language);\n        captions.toggle.call(this, active && languageExists);\n      } // Enable or disable captions based on track length\n\n\n      toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is$1.empty(tracks)); // Update available languages in list\n\n      if ((this.config.controls || []).includes('settings') && this.config.settings.includes('captions')) {\n        controls.setCaptionsMenu.call(this);\n      }\n    },\n    // Toggle captions display\n    // Used internally for the toggleCaptions method, with the passive option forced to false\n    toggle: function toggle(input) {\n      var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n      // If there's no full support\n      if (!this.supported.ui) {\n        return;\n      }\n\n      var toggled = this.captions.toggled; // Current state\n\n      var activeClass = this.config.classNames.captions.active; // Get the next state\n      // If the method is called without parameter, toggle based on current value\n\n      var active = is$1.nullOrUndefined(input) ? !toggled : input; // Update state and trigger event\n\n      if (active !== toggled) {\n        // When passive, don't override user preferences\n        if (!passive) {\n          this.captions.active = active;\n          this.storage.set({\n            captions: active\n          });\n        } // Force language if the call isn't passive and there is no matching language to toggle to\n\n\n        if (!this.language && active && !passive) {\n          var tracks = captions.getTracks.call(this);\n          var track = captions.findTrack.call(this, [this.captions.language].concat(_toConsumableArray(this.captions.languages)), true); // Override user preferences to avoid switching languages if a matching track is added\n\n          this.captions.language = track.language; // Set caption, but don't store in localStorage as user preference\n\n          captions.set.call(this, tracks.indexOf(track));\n          return;\n        } // Toggle button if it's enabled\n\n\n        if (this.elements.buttons.captions) {\n          this.elements.buttons.captions.pressed = active;\n        } // Add class hook\n\n\n        toggleClass(this.elements.container, activeClass, active);\n        this.captions.toggled = active; // Update settings menu\n\n        controls.updateSetting.call(this, 'captions'); // Trigger event (not used internally)\n\n        triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled');\n      }\n    },\n    // Set captions by track index\n    // Used internally for the currentTrack setter with the passive option forced to false\n    set: function set(index) {\n      var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n      var tracks = captions.getTracks.call(this); // Disable captions if setting to -1\n\n      if (index === -1) {\n        captions.toggle.call(this, false, passive);\n        return;\n      }\n\n      if (!is$1.number(index)) {\n        this.debug.warn('Invalid caption argument', index);\n        return;\n      }\n\n      if (!(index in tracks)) {\n        this.debug.warn('Track not found', index);\n        return;\n      }\n\n      if (this.captions.currentTrack !== index) {\n        this.captions.currentTrack = index;\n        var track = tracks[index];\n\n        var _ref = track || {},\n            language = _ref.language; // Store reference to node for invalidation on remove\n\n\n        this.captions.currentTrackNode = track; // Update settings menu\n\n        controls.updateSetting.call(this, 'captions'); // When passive, don't override user preferences\n\n        if (!passive) {\n          this.captions.language = language;\n          this.storage.set({\n            language: language\n          });\n        } // Handle Vimeo captions\n\n\n        if (this.isVimeo) {\n          this.embed.enableTextTrack(language);\n        } // Trigger event\n\n\n        triggerEvent.call(this, this.media, 'languagechange');\n      } // Show captions\n\n\n      captions.toggle.call(this, true, passive);\n\n      if (this.isHTML5 && this.isVideo) {\n        // If we change the active track while a cue is already displayed we need to update it\n        captions.updateCues.call(this);\n      }\n    },\n    // Set captions by language\n    // Used internally for the language setter with the passive option forced to false\n    setLanguage: function setLanguage(input) {\n      var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n      if (!is$1.string(input)) {\n        this.debug.warn('Invalid language argument', input);\n        return;\n      } // Normalize\n\n\n      var language = input.toLowerCase();\n      this.captions.language = language; // Set currentTrack\n\n      var tracks = captions.getTracks.call(this);\n      var track = captions.findTrack.call(this, [language]);\n      captions.set.call(this, tracks.indexOf(track), passive);\n    },\n    // Get current valid caption tracks\n    // If update is false it will also ignore tracks without metadata\n    // This is used to \"freeze\" the language options when captions.update is false\n    getTracks: function getTracks() {\n      var _this2 = this;\n\n      var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n      // Handle media or textTracks missing or null\n      var tracks = Array.from((this.media || {}).textTracks || []); // For HTML5, use cache instead of current tracks when it exists (if captions.update is false)\n      // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)\n\n      return tracks.filter(function (track) {\n        return !_this2.isHTML5 || update || _this2.captions.meta.has(track);\n      }).filter(function (track) {\n        return ['captions', 'subtitles'].includes(track.kind);\n      });\n    },\n    // Match tracks based on languages and get the first\n    findTrack: function findTrack(languages) {\n      var _this3 = this;\n\n      var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n      var tracks = captions.getTracks.call(this);\n\n      var sortIsDefault = function sortIsDefault(track) {\n        return Number((_this3.captions.meta.get(track) || {}).default);\n      };\n\n      var sorted = Array.from(tracks).sort(function (a, b) {\n        return sortIsDefault(b) - sortIsDefault(a);\n      });\n      var track;\n      languages.every(function (language) {\n        track = sorted.find(function (t) {\n          return t.language === language;\n        });\n        return !track; // Break iteration if there is a match\n      }); // If no match is found but is required, get first\n\n      return track || (force ? sorted[0] : undefined);\n    },\n    // Get the current track\n    getCurrentTrack: function getCurrentTrack() {\n      return captions.getTracks.call(this)[this.currentTrack];\n    },\n    // Get UI label for track\n    getLabel: function getLabel(track) {\n      var currentTrack = track;\n\n      if (!is$1.track(currentTrack) && support.textTracks && this.captions.toggled) {\n        currentTrack = captions.getCurrentTrack.call(this);\n      }\n\n      if (is$1.track(currentTrack)) {\n        if (!is$1.empty(currentTrack.label)) {\n          return currentTrack.label;\n        }\n\n        if (!is$1.empty(currentTrack.language)) {\n          return track.language.toUpperCase();\n        }\n\n        return i18n.get('enabled', this.config);\n      }\n\n      return i18n.get('disabled', this.config);\n    },\n    // Update captions using current track's active cues\n    // Also optional array argument in case there isn't any track (ex: vimeo)\n    updateCues: function updateCues(input) {\n      // Requires UI\n      if (!this.supported.ui) {\n        return;\n      }\n\n      if (!is$1.element(this.elements.captions)) {\n        this.debug.warn('No captions element to render to');\n        return;\n      } // Only accept array or empty input\n\n\n      if (!is$1.nullOrUndefined(input) && !Array.isArray(input)) {\n        this.debug.warn('updateCues: Invalid input', input);\n        return;\n      }\n\n      var cues = input; // Get cues from track\n\n      if (!cues) {\n        var track = captions.getCurrentTrack.call(this);\n        cues = Array.from((track || {}).activeCues || []).map(function (cue) {\n          return cue.getCueAsHTML();\n        }).map(getHTML);\n      } // Set new caption text\n\n\n      var content = cues.map(function (cueText) {\n        return cueText.trim();\n      }).join('\\n');\n      var changed = content !== this.elements.captions.innerHTML;\n\n      if (changed) {\n        // Empty the container and create a new child element\n        emptyElement(this.elements.captions);\n        var caption = createElement('span', getAttributesFromSelector(this.config.selectors.caption));\n        caption.innerHTML = content;\n        this.elements.captions.appendChild(caption); // Trigger event\n\n        triggerEvent.call(this, this.media, 'cuechange');\n      }\n    }\n  };\n\n  // ==========================================================================\n  // Plyr default config\n  // ==========================================================================\n  var defaults$1 = {\n    // Disable\n    enabled: true,\n    // Custom media title\n    title: '',\n    // Logging to console\n    debug: false,\n    // Auto play (if supported)\n    autoplay: false,\n    // Only allow one media playing at once (vimeo only)\n    autopause: true,\n    // Allow inline playback on iOS (this effects YouTube/Vimeo - HTML5 requires the attribute present)\n    // TODO: Remove iosNative fullscreen option in favour of this (logic needs work)\n    playsinline: true,\n    // Default time to skip when rewind/fast forward\n    seekTime: 10,\n    // Default volume\n    volume: 1,\n    muted: false,\n    // Pass a custom duration\n    duration: null,\n    // Display the media duration on load in the current time position\n    // If you have opted to display both duration and currentTime, this is ignored\n    displayDuration: true,\n    // Invert the current time to be a countdown\n    invertTime: true,\n    // Clicking the currentTime inverts it's value to show time left rather than elapsed\n    toggleInvert: true,\n    // Force an aspect ratio\n    // The format must be `'w:h'` (e.g. `'16:9'`)\n    ratio: null,\n    // Click video container to play/pause\n    clickToPlay: true,\n    // Auto hide the controls\n    hideControls: true,\n    // Reset to start when playback ended\n    resetOnEnd: false,\n    // Disable the standard context menu\n    disableContextMenu: true,\n    // Sprite (for icons)\n    loadSprite: true,\n    iconPrefix: 'plyr',\n    iconUrl: 'https://cdn.plyr.io/3.5.6/plyr.svg',\n    // Blank video (used to prevent errors on source change)\n    blankVideo: 'https://cdn.plyr.io/static/blank.mp4',\n    // Quality default\n    quality: {\n      default: 576,\n      options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240]\n    },\n    // Set loops\n    loop: {\n      active: false // start: null,\n      // end: null,\n\n    },\n    // Speed default and options to display\n    speed: {\n      selected: 1,\n      options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]\n    },\n    // Keyboard shortcut settings\n    keyboard: {\n      focused: true,\n      global: false\n    },\n    // Display tooltips\n    tooltips: {\n      controls: false,\n      seek: true\n    },\n    // Captions settings\n    captions: {\n      active: false,\n      language: 'auto',\n      // Listen to new tracks added after Plyr is initialized.\n      // This is needed for streaming captions, but may result in unselectable options\n      update: false\n    },\n    // Fullscreen settings\n    fullscreen: {\n      enabled: true,\n      // Allow fullscreen?\n      fallback: true,\n      // Fallback using full viewport/window\n      iosNative: false // Use the native fullscreen in iOS (disables custom controls)\n\n    },\n    // Local storage\n    storage: {\n      enabled: true,\n      key: 'plyr'\n    },\n    // Default controls\n    controls: ['play-large', // 'restart',\n    // 'rewind',\n    'play', // 'fast-forward',\n    'progress', 'current-time', // 'duration',\n    'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', // 'download',\n    'fullscreen'],\n    settings: ['captions', 'quality', 'speed'],\n    // Localisation\n    i18n: {\n      restart: 'Restart',\n      rewind: 'Rewind {seektime}s',\n      play: 'Play',\n      pause: 'Pause',\n      fastForward: 'Forward {seektime}s',\n      seek: 'Seek',\n      seekLabel: '{currentTime} of {duration}',\n      played: 'Played',\n      buffered: 'Buffered',\n      currentTime: 'Current time',\n      duration: 'Duration',\n      volume: 'Volume',\n      mute: 'Mute',\n      unmute: 'Unmute',\n      enableCaptions: 'Enable captions',\n      disableCaptions: 'Disable captions',\n      download: 'Download',\n      enterFullscreen: 'Enter fullscreen',\n      exitFullscreen: 'Exit fullscreen',\n      frameTitle: 'Player for {title}',\n      captions: 'Captions',\n      settings: 'Settings',\n      menuBack: 'Go back to previous menu',\n      speed: 'Speed',\n      normal: 'Normal',\n      quality: 'Quality',\n      loop: 'Loop',\n      start: 'Start',\n      end: 'End',\n      all: 'All',\n      reset: 'Reset',\n      disabled: 'Disabled',\n      enabled: 'Enabled',\n      advertisement: 'Ad',\n      qualityBadge: {\n        2160: '4K',\n        1440: 'HD',\n        1080: 'HD',\n        720: 'HD',\n        576: 'SD',\n        480: 'SD'\n      }\n    },\n    // URLs\n    urls: {\n      download: null,\n      vimeo: {\n        sdk: 'https://player.vimeo.com/api/player.js',\n        iframe: 'https://player.vimeo.com/video/{0}?{1}',\n        api: 'https://vimeo.com/api/v2/video/{0}.json'\n      },\n      youtube: {\n        sdk: 'https://www.youtube.com/iframe_api',\n        api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}'\n      },\n      googleIMA: {\n        sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'\n      }\n    },\n    // Custom control listeners\n    listeners: {\n      seek: null,\n      play: null,\n      pause: null,\n      restart: null,\n      rewind: null,\n      fastForward: null,\n      mute: null,\n      volume: null,\n      captions: null,\n      download: null,\n      fullscreen: null,\n      pip: null,\n      airplay: null,\n      speed: null,\n      quality: null,\n      loop: null,\n      language: null\n    },\n    // Events to watch and bubble\n    events: [// Events to watch on HTML5 media elements and bubble\n    // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events\n    'ended', 'progress', 'stalled', 'playing', 'waiting', 'canplay', 'canplaythrough', 'loadstart', 'loadeddata', 'loadedmetadata', 'timeupdate', 'volumechange', 'play', 'pause', 'error', 'seeking', 'seeked', 'emptied', 'ratechange', 'cuechange', // Custom events\n    'download', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled', 'languagechange', 'controlshidden', 'controlsshown', 'ready', // YouTube\n    'statechange', // Quality\n    'qualitychange', // Ads\n    'adsloaded', 'adscontentpause', 'adscontentresume', 'adstarted', 'adsmidpoint', 'adscomplete', 'adsallcomplete', 'adsimpression', 'adsclick'],\n    // Selectors\n    // Change these to match your template if using custom HTML\n    selectors: {\n      editable: 'input, textarea, select, [contenteditable]',\n      container: '.plyr',\n      controls: {\n        container: null,\n        wrapper: '.plyr__controls'\n      },\n      labels: '[data-plyr]',\n      buttons: {\n        play: '[data-plyr=\"play\"]',\n        pause: '[data-plyr=\"pause\"]',\n        restart: '[data-plyr=\"restart\"]',\n        rewind: '[data-plyr=\"rewind\"]',\n        fastForward: '[data-plyr=\"fast-forward\"]',\n        mute: '[data-plyr=\"mute\"]',\n        captions: '[data-plyr=\"captions\"]',\n        download: '[data-plyr=\"download\"]',\n        fullscreen: '[data-plyr=\"fullscreen\"]',\n        pip: '[data-plyr=\"pip\"]',\n        airplay: '[data-plyr=\"airplay\"]',\n        settings: '[data-plyr=\"settings\"]',\n        loop: '[data-plyr=\"loop\"]'\n      },\n      inputs: {\n        seek: '[data-plyr=\"seek\"]',\n        volume: '[data-plyr=\"volume\"]',\n        speed: '[data-plyr=\"speed\"]',\n        language: '[data-plyr=\"language\"]',\n        quality: '[data-plyr=\"quality\"]'\n      },\n      display: {\n        currentTime: '.plyr__time--current',\n        duration: '.plyr__time--duration',\n        buffer: '.plyr__progress__buffer',\n        loop: '.plyr__progress__loop',\n        // Used later\n        volume: '.plyr__volume--display'\n      },\n      progress: '.plyr__progress',\n      captions: '.plyr__captions',\n      caption: '.plyr__caption'\n    },\n    // Class hooks added to the player in different states\n    classNames: {\n      type: 'plyr--{0}',\n      provider: 'plyr--{0}',\n      video: 'plyr__video-wrapper',\n      embed: 'plyr__video-embed',\n      videoFixedRatio: 'plyr__video-wrapper--fixed-ratio',\n      embedContainer: 'plyr__video-embed__container',\n      poster: 'plyr__poster',\n      posterEnabled: 'plyr__poster-enabled',\n      ads: 'plyr__ads',\n      control: 'plyr__control',\n      controlPressed: 'plyr__control--pressed',\n      playing: 'plyr--playing',\n      paused: 'plyr--paused',\n      stopped: 'plyr--stopped',\n      loading: 'plyr--loading',\n      hover: 'plyr--hover',\n      tooltip: 'plyr__tooltip',\n      cues: 'plyr__cues',\n      hidden: 'plyr__sr-only',\n      hideControls: 'plyr--hide-controls',\n      isIos: 'plyr--is-ios',\n      isTouch: 'plyr--is-touch',\n      uiSupported: 'plyr--full-ui',\n      noTransition: 'plyr--no-transition',\n      display: {\n        time: 'plyr__time'\n      },\n      menu: {\n        value: 'plyr__menu__value',\n        badge: 'plyr__badge',\n        open: 'plyr--menu-open'\n      },\n      captions: {\n        enabled: 'plyr--captions-enabled',\n        active: 'plyr--captions-active'\n      },\n      fullscreen: {\n        enabled: 'plyr--fullscreen-enabled',\n        fallback: 'plyr--fullscreen-fallback'\n      },\n      pip: {\n        supported: 'plyr--pip-supported',\n        active: 'plyr--pip-active'\n      },\n      airplay: {\n        supported: 'plyr--airplay-supported',\n        active: 'plyr--airplay-active'\n      },\n      tabFocus: 'plyr__tab-focus',\n      previewThumbnails: {\n        // Tooltip thumbs\n        thumbContainer: 'plyr__preview-thumb',\n        thumbContainerShown: 'plyr__preview-thumb--is-shown',\n        imageContainer: 'plyr__preview-thumb__image-container',\n        timeContainer: 'plyr__preview-thumb__time-container',\n        // Scrubbing\n        scrubbingContainer: 'plyr__preview-scrubbing',\n        scrubbingContainerShown: 'plyr__preview-scrubbing--is-shown'\n      }\n    },\n    // Embed attributes\n    attributes: {\n      embed: {\n        provider: 'data-plyr-provider',\n        id: 'data-plyr-embed-id'\n      }\n    },\n    // Advertisements plugin\n    // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio\n    ads: {\n      enabled: false,\n      publisherId: '',\n      tagUrl: ''\n    },\n    // Preview Thumbnails plugin\n    previewThumbnails: {\n      enabled: false,\n      src: ''\n    },\n    // Vimeo plugin\n    vimeo: {\n      byline: false,\n      portrait: false,\n      title: false,\n      speed: true,\n      transparent: false\n    },\n    // YouTube plugin\n    youtube: {\n      noCookie: false,\n      // Whether to use an alternative version of YouTube without cookies\n      rel: 0,\n      // No related vids\n      showinfo: 0,\n      // Hide info\n      iv_load_policy: 3,\n      // Hide annotations\n      modestbranding: 1 // Hide logos as much as possible (they still show one in the corner when paused)\n\n    }\n  };\n\n  // ==========================================================================\n  // Plyr states\n  // ==========================================================================\n  var pip = {\n    active: 'picture-in-picture',\n    inactive: 'inline'\n  };\n\n  // ==========================================================================\n  // Plyr supported types and providers\n  // ==========================================================================\n  var providers = {\n    html5: 'html5',\n    youtube: 'youtube',\n    vimeo: 'vimeo'\n  };\n  var types = {\n    audio: 'audio',\n    video: 'video'\n  };\n  /**\n   * Get provider by URL\n   * @param {String} url\n   */\n\n  function getProviderByUrl(url) {\n    // YouTube\n    if (/^(https?:\\/\\/)?(www\\.)?(youtube\\.com|youtube-nocookie\\.com|youtu\\.?be)\\/.+$/.test(url)) {\n      return providers.youtube;\n    } // Vimeo\n\n\n    if (/^https?:\\/\\/player.vimeo.com\\/video\\/\\d{0,9}(?=\\b|\\/)/.test(url)) {\n      return providers.vimeo;\n    }\n\n    return null;\n  }\n\n  // ==========================================================================\n  // Console wrapper\n  // ==========================================================================\n  var noop = function noop() {};\n\n  var Console =\n  /*#__PURE__*/\n  function () {\n    function Console() {\n      var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n      _classCallCheck(this, Console);\n\n      this.enabled = window.console && enabled;\n\n      if (this.enabled) {\n        this.log('Debugging enabled');\n      }\n    }\n\n    _createClass(Console, [{\n      key: \"log\",\n      get: function get() {\n        // eslint-disable-next-line no-console\n        return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;\n      }\n    }, {\n      key: \"warn\",\n      get: function get() {\n        // eslint-disable-next-line no-console\n        return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;\n      }\n    }, {\n      key: \"error\",\n      get: function get() {\n        // eslint-disable-next-line no-console\n        return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;\n      }\n    }]);\n\n    return Console;\n  }();\n\n  function onChange() {\n    if (!this.enabled) {\n      return;\n    } // Update toggle button\n\n\n    var button = this.player.elements.buttons.fullscreen;\n\n    if (is$1.element(button)) {\n      button.pressed = this.active;\n    } // Trigger an event\n\n\n    triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true); // Trap focus in container\n\n    if (!browser.isIos) {\n      trapFocus.call(this.player, this.target, this.active);\n    }\n  }\n\n  function toggleFallback() {\n    var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n    // Store or restore scroll position\n    if (toggle) {\n      this.scrollPosition = {\n        x: window.scrollX || 0,\n        y: window.scrollY || 0\n      };\n    } else {\n      window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);\n    } // Toggle scroll\n\n\n    document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook\n\n    toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+\n\n    if (browser.isIos) {\n      var viewport = document.head.querySelector('meta[name=\"viewport\"]');\n      var property = 'viewport-fit=cover'; // Inject the viewport meta if required\n\n      if (!viewport) {\n        viewport = document.createElement('meta');\n        viewport.setAttribute('name', 'viewport');\n      } // Check if the property already exists\n\n\n      var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);\n\n      if (toggle) {\n        this.cleanupViewport = !hasProperty;\n\n        if (!hasProperty) {\n          viewport.content += \",\".concat(property);\n        }\n      } else if (this.cleanupViewport) {\n        viewport.content = viewport.content.split(',').filter(function (part) {\n          return part.trim() !== property;\n        }).join(',');\n      }\n    } // Toggle button and fire events\n\n\n    onChange.call(this);\n  }\n\n  var Fullscreen =\n  /*#__PURE__*/\n  function () {\n    function Fullscreen(player) {\n      var _this = this;\n\n      _classCallCheck(this, Fullscreen);\n\n      // Keep reference to parent\n      this.player = player; // Get prefix\n\n      this.prefix = Fullscreen.prefix;\n      this.property = Fullscreen.property; // Scroll position\n\n      this.scrollPosition = {\n        x: 0,\n        y: 0\n      }; // Force the use of 'full window/browser' rather than fullscreen\n\n      this.forceFallback = player.config.fullscreen.fallback === 'force'; // Register event listeners\n      // Handle event (incase user presses escape etc)\n\n      on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : \"\".concat(this.prefix, \"fullscreenchange\"), function () {\n        // TODO: Filter for target??\n        onChange.call(_this);\n      }); // Fullscreen toggle on double click\n\n      on.call(this.player, this.player.elements.container, 'dblclick', function (event) {\n        // Ignore double click in controls\n        if (is$1.element(_this.player.elements.controls) && _this.player.elements.controls.contains(event.target)) {\n          return;\n        }\n\n        _this.toggle();\n      }); // Update the UI\n\n      this.update();\n    } // Determine if native supported\n\n\n    _createClass(Fullscreen, [{\n      key: \"update\",\n      // Update UI\n      value: function update() {\n        if (this.enabled) {\n          var mode;\n\n          if (this.forceFallback) {\n            mode = 'Fallback (forced)';\n          } else if (Fullscreen.native) {\n            mode = 'Native';\n          } else {\n            mode = 'Fallback';\n          }\n\n          this.player.debug.log(\"\".concat(mode, \" fullscreen enabled\"));\n        } else {\n          this.player.debug.log('Fullscreen not supported and fallback disabled');\n        } // Add styling hook to show button\n\n\n        toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);\n      } // Make an element fullscreen\n\n    }, {\n      key: \"enter\",\n      value: function enter() {\n        if (!this.enabled) {\n          return;\n        } // iOS native fullscreen doesn't need the request step\n\n\n        if (browser.isIos && this.player.config.fullscreen.iosNative) {\n          this.target.webkitEnterFullscreen();\n        } else if (!Fullscreen.native || this.forceFallback) {\n          toggleFallback.call(this, true);\n        } else if (!this.prefix) {\n          this.target.requestFullscreen();\n        } else if (!is$1.empty(this.prefix)) {\n          this.target[\"\".concat(this.prefix, \"Request\").concat(this.property)]();\n        }\n      } // Bail from fullscreen\n\n    }, {\n      key: \"exit\",\n      value: function exit() {\n        if (!this.enabled) {\n          return;\n        } // iOS native fullscreen\n\n\n        if (browser.isIos && this.player.config.fullscreen.iosNative) {\n          this.target.webkitExitFullscreen();\n          this.player.play();\n        } else if (!Fullscreen.native || this.forceFallback) {\n          toggleFallback.call(this, false);\n        } else if (!this.prefix) {\n          (document.cancelFullScreen || document.exitFullscreen).call(document);\n        } else if (!is$1.empty(this.prefix)) {\n          var action = this.prefix === 'moz' ? 'Cancel' : 'Exit';\n          document[\"\".concat(this.prefix).concat(action).concat(this.property)]();\n        }\n      } // Toggle state\n\n    }, {\n      key: \"toggle\",\n      value: function toggle() {\n        if (!this.active) {\n          this.enter();\n        } else {\n          this.exit();\n        }\n      }\n    }, {\n      key: \"usingNative\",\n      // If we're actually using native\n      get: function get() {\n        return Fullscreen.native && !this.forceFallback;\n      } // Get the prefix for handlers\n\n    }, {\n      key: \"enabled\",\n      // Determine if fullscreen is enabled\n      get: function get() {\n        return (Fullscreen.native || this.player.config.fullscreen.fallback) && this.player.config.fullscreen.enabled && this.player.supported.ui && this.player.isVideo;\n      } // Get active state\n\n    }, {\n      key: \"active\",\n      get: function get() {\n        if (!this.enabled) {\n          return false;\n        } // Fallback using classname\n\n\n        if (!Fullscreen.native || this.forceFallback) {\n          return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);\n        }\n\n        var element = !this.prefix ? document.fullscreenElement : document[\"\".concat(this.prefix).concat(this.property, \"Element\")];\n        return element === this.target;\n      } // Get target element\n\n    }, {\n      key: \"target\",\n      get: function get() {\n        return browser.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.container;\n      }\n    }], [{\n      key: \"native\",\n      get: function get() {\n        return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);\n      }\n    }, {\n      key: \"prefix\",\n      get: function get() {\n        // No prefix\n        if (is$1.function(document.exitFullscreen)) {\n          return '';\n        } // Check for fullscreen support by vendor prefix\n\n\n        var value = '';\n        var prefixes = ['webkit', 'moz', 'ms'];\n        prefixes.some(function (pre) {\n          if (is$1.function(document[\"\".concat(pre, \"ExitFullscreen\")]) || is$1.function(document[\"\".concat(pre, \"CancelFullScreen\")])) {\n            value = pre;\n            return true;\n          }\n\n          return false;\n        });\n        return value;\n      }\n    }, {\n      key: \"property\",\n      get: function get() {\n        return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';\n      }\n    }]);\n\n    return Fullscreen;\n  }();\n\n  // ==========================================================================\n  // Load image avoiding xhr/fetch CORS issues\n  // Server status can't be obtained this way unfortunately, so this uses \"naturalWidth\" to determine if the image has loaded\n  // By default it checks if it is at least 1px, but you can add a second argument to change this\n  // ==========================================================================\n  function loadImage(src) {\n    var minWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n    return new Promise(function (resolve, reject) {\n      var image = new Image();\n\n      var handler = function handler() {\n        delete image.onload;\n        delete image.onerror;\n        (image.naturalWidth >= minWidth ? resolve : reject)(image);\n      };\n\n      Object.assign(image, {\n        onload: handler,\n        onerror: handler,\n        src: src\n      });\n    });\n  }\n\n  // ==========================================================================\n  var ui = {\n    addStyleHook: function addStyleHook() {\n      toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true);\n      toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);\n    },\n    // Toggle native HTML5 media controls\n    toggleNativeControls: function toggleNativeControls() {\n      var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n      if (toggle && this.isHTML5) {\n        this.media.setAttribute('controls', '');\n      } else {\n        this.media.removeAttribute('controls');\n      }\n    },\n    // Setup the UI\n    build: function build() {\n      var _this = this;\n\n      // Re-attach media element listeners\n      // TODO: Use event bubbling?\n      this.listeners.media(); // Don't setup interface if no support\n\n      if (!this.supported.ui) {\n        this.debug.warn(\"Basic support only for \".concat(this.provider, \" \").concat(this.type)); // Restore native controls\n\n        ui.toggleNativeControls.call(this, true); // Bail\n\n        return;\n      } // Inject custom controls if not present\n\n\n      if (!is$1.element(this.elements.controls)) {\n        // Inject custom controls\n        controls.inject.call(this); // Re-attach control listeners\n\n        this.listeners.controls();\n      } // Remove native controls\n\n\n      ui.toggleNativeControls.call(this); // Setup captions for HTML5\n\n      if (this.isHTML5) {\n        captions.setup.call(this);\n      } // Reset volume\n\n\n      this.volume = null; // Reset mute state\n\n      this.muted = null; // Reset loop state\n\n      this.loop = null; // Reset quality setting\n\n      this.quality = null; // Reset speed\n\n      this.speed = null; // Reset volume display\n\n      controls.updateVolume.call(this); // Reset time display\n\n      controls.timeUpdate.call(this); // Update the UI\n\n      ui.checkPlaying.call(this); // Check for picture-in-picture support\n\n      toggleClass(this.elements.container, this.config.classNames.pip.supported, support.pip && this.isHTML5 && this.isVideo); // Check for airplay support\n\n      toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5); // Add iOS class\n\n      toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos); // Add touch class\n\n      toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch); // Ready for API calls\n\n      this.ready = true; // Ready event at end of execution stack\n\n      setTimeout(function () {\n        triggerEvent.call(_this, _this.media, 'ready');\n      }, 0); // Set the title\n\n      ui.setTitle.call(this); // Assure the poster image is set, if the property was added before the element was created\n\n      if (this.poster) {\n        ui.setPoster.call(this, this.poster, false).catch(function () {});\n      } // Manually set the duration if user has overridden it.\n      // The event listeners for it doesn't get called if preload is disabled (#701)\n\n\n      if (this.config.duration) {\n        controls.durationUpdate.call(this);\n      }\n    },\n    // Setup aria attribute for play and iframe title\n    setTitle: function setTitle() {\n      // Find the current text\n      var label = i18n.get('play', this.config); // If there's a media title set, use that for the label\n\n      if (is$1.string(this.config.title) && !is$1.empty(this.config.title)) {\n        label += \", \".concat(this.config.title);\n      } // If there's a play button, set label\n\n\n      Array.from(this.elements.buttons.play || []).forEach(function (button) {\n        button.setAttribute('aria-label', label);\n      }); // Set iframe title\n      // https://github.com/sampotts/plyr/issues/124\n\n      if (this.isEmbed) {\n        var iframe = getElement.call(this, 'iframe');\n\n        if (!is$1.element(iframe)) {\n          return;\n        } // Default to media type\n\n\n        var title = !is$1.empty(this.config.title) ? this.config.title : 'video';\n        var format = i18n.get('frameTitle', this.config);\n        iframe.setAttribute('title', format.replace('{title}', title));\n      }\n    },\n    // Toggle poster\n    togglePoster: function togglePoster(enable) {\n      toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable);\n    },\n    // Set the poster image (async)\n    // Used internally for the poster setter, with the passive option forced to false\n    setPoster: function setPoster(poster) {\n      var _this2 = this;\n\n      var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n      // Don't override if call is passive\n      if (passive && this.poster) {\n        return Promise.reject(new Error('Poster already set'));\n      } // Set property synchronously to respect the call order\n\n\n      this.media.setAttribute('poster', poster); // Wait until ui is ready\n\n      return ready.call(this) // Load image\n      .then(function () {\n        return loadImage(poster);\n      }).catch(function (err) {\n        // Hide poster on error unless it's been set by another call\n        if (poster === _this2.poster) {\n          ui.togglePoster.call(_this2, false);\n        } // Rethrow\n\n\n        throw err;\n      }).then(function () {\n        // Prevent race conditions\n        if (poster !== _this2.poster) {\n          throw new Error('setPoster cancelled by later call to setPoster');\n        }\n      }).then(function () {\n        Object.assign(_this2.elements.poster.style, {\n          backgroundImage: \"url('\".concat(poster, \"')\"),\n          // Reset backgroundSize as well (since it can be set to \"cover\" for padded thumbnails for youtube)\n          backgroundSize: ''\n        });\n        ui.togglePoster.call(_this2, true);\n        return poster;\n      });\n    },\n    // Check playing state\n    checkPlaying: function checkPlaying(event) {\n      var _this3 = this;\n\n      // Class hooks\n      toggleClass(this.elements.container, this.config.classNames.playing, this.playing);\n      toggleClass(this.elements.container, this.config.classNames.paused, this.paused);\n      toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped); // Set state\n\n      Array.from(this.elements.buttons.play || []).forEach(function (target) {\n        Object.assign(target, {\n          pressed: _this3.playing\n        });\n      }); // Only update controls on non timeupdate events\n\n      if (is$1.event(event) && event.type === 'timeupdate') {\n        return;\n      } // Toggle controls\n\n\n      ui.toggleControls.call(this);\n    },\n    // Check if media is loading\n    checkLoading: function checkLoading(event) {\n      var _this4 = this;\n\n      this.loading = ['stalled', 'waiting'].includes(event.type); // Clear timer\n\n      clearTimeout(this.timers.loading); // Timer to prevent flicker when seeking\n\n      this.timers.loading = setTimeout(function () {\n        // Update progress bar loading class state\n        toggleClass(_this4.elements.container, _this4.config.classNames.loading, _this4.loading); // Update controls visibility\n\n        ui.toggleControls.call(_this4);\n      }, this.loading ? 250 : 0);\n    },\n    // Toggle controls based on state and `force` argument\n    toggleControls: function toggleControls(force) {\n      var controlsElement = this.elements.controls;\n\n      if (controlsElement && this.config.hideControls) {\n        // Don't hide controls if a touch-device user recently seeked. (Must be limited to touch devices, or it occasionally prevents desktop controls from hiding.)\n        var recentTouchSeek = this.touch && this.lastSeekTime + 2000 > Date.now(); // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide\n\n        this.toggleControls(Boolean(force || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek));\n      }\n    }\n  };\n\n  var Listeners =\n  /*#__PURE__*/\n  function () {\n    function Listeners(player) {\n      _classCallCheck(this, Listeners);\n\n      this.player = player;\n      this.lastKey = null;\n      this.focusTimer = null;\n      this.lastKeyDown = null;\n      this.handleKey = this.handleKey.bind(this);\n      this.toggleMenu = this.toggleMenu.bind(this);\n      this.setTabFocus = this.setTabFocus.bind(this);\n      this.firstTouch = this.firstTouch.bind(this);\n    } // Handle key presses\n\n\n    _createClass(Listeners, [{\n      key: \"handleKey\",\n      value: function handleKey(event) {\n        var player = this.player;\n        var elements = player.elements;\n        var code = event.keyCode ? event.keyCode : event.which;\n        var pressed = event.type === 'keydown';\n        var repeat = pressed && code === this.lastKey; // Bail if a modifier key is set\n\n        if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n          return;\n        } // If the event is bubbled from the media element\n        // Firefox doesn't get the keycode for whatever reason\n\n\n        if (!is$1.number(code)) {\n          return;\n        } // Seek by the number keys\n\n\n        var seekByKey = function seekByKey() {\n          // Divide the max duration into 10th's and times by the number value\n          player.currentTime = player.duration / 10 * (code - 48);\n        }; // Handle the key on keydown\n        // Reset on keyup\n\n\n        if (pressed) {\n          // Check focused element\n          // and if the focused element is not editable (e.g. text input)\n          // and any that accept key input http://webaim.org/techniques/keyboard/\n          var focused = document.activeElement;\n\n          if (is$1.element(focused)) {\n            var editable = player.config.selectors.editable;\n            var seek = elements.inputs.seek;\n\n            if (focused !== seek && matches$1(focused, editable)) {\n              return;\n            }\n\n            if (event.which === 32 && matches$1(focused, 'button, [role^=\"menuitem\"]')) {\n              return;\n            }\n          } // Which keycodes should we prevent default\n\n\n          var preventDefault = [32, 37, 38, 39, 40, 48, 49, 50, 51, 52, 53, 54, 56, 57, 67, 70, 73, 75, 76, 77, 79]; // If the code is found prevent default (e.g. prevent scrolling for arrows)\n\n          if (preventDefault.includes(code)) {\n            event.preventDefault();\n            event.stopPropagation();\n          }\n\n          switch (code) {\n            case 48:\n            case 49:\n            case 50:\n            case 51:\n            case 52:\n            case 53:\n            case 54:\n            case 55:\n            case 56:\n            case 57:\n              // 0-9\n              if (!repeat) {\n                seekByKey();\n              }\n\n              break;\n\n            case 32:\n            case 75:\n              // Space and K key\n              if (!repeat) {\n                player.togglePlay();\n              }\n\n              break;\n\n            case 38:\n              // Arrow up\n              player.increaseVolume(0.1);\n              break;\n\n            case 40:\n              // Arrow down\n              player.decreaseVolume(0.1);\n              break;\n\n            case 77:\n              // M key\n              if (!repeat) {\n                player.muted = !player.muted;\n              }\n\n              break;\n\n            case 39:\n              // Arrow forward\n              player.forward();\n              break;\n\n            case 37:\n              // Arrow back\n              player.rewind();\n              break;\n\n            case 70:\n              // F key\n              player.fullscreen.toggle();\n              break;\n\n            case 67:\n              // C key\n              if (!repeat) {\n                player.toggleCaptions();\n              }\n\n              break;\n\n            case 76:\n              // L key\n              player.loop = !player.loop;\n              break;\n\n            /* case 73:\n                this.setLoop('start');\n                break;\n             case 76:\n                this.setLoop();\n                break;\n             case 79:\n                this.setLoop('end');\n                break; */\n\n            default:\n              break;\n          } // Escape is handle natively when in full screen\n          // So we only need to worry about non native\n\n\n          if (code === 27 && !player.fullscreen.usingNative && player.fullscreen.active) {\n            player.fullscreen.toggle();\n          } // Store last code for next cycle\n\n\n          this.lastKey = code;\n        } else {\n          this.lastKey = null;\n        }\n      } // Toggle menu\n\n    }, {\n      key: \"toggleMenu\",\n      value: function toggleMenu(event) {\n        controls.toggleMenu.call(this.player, event);\n      } // Device is touch enabled\n\n    }, {\n      key: \"firstTouch\",\n      value: function firstTouch() {\n        var player = this.player;\n        var elements = player.elements;\n        player.touch = true; // Add touch class\n\n        toggleClass(elements.container, player.config.classNames.isTouch, true);\n      }\n    }, {\n      key: \"setTabFocus\",\n      value: function setTabFocus(event) {\n        var player = this.player;\n        var elements = player.elements;\n        clearTimeout(this.focusTimer); // Ignore any key other than tab\n\n        if (event.type === 'keydown' && event.which !== 9) {\n          return;\n        } // Store reference to event timeStamp\n\n\n        if (event.type === 'keydown') {\n          this.lastKeyDown = event.timeStamp;\n        } // Remove current classes\n\n\n        var removeCurrent = function removeCurrent() {\n          var className = player.config.classNames.tabFocus;\n          var current = getElements.call(player, \".\".concat(className));\n          toggleClass(current, className, false);\n        }; // Determine if a key was pressed to trigger this event\n\n\n        var wasKeyDown = event.timeStamp - this.lastKeyDown <= 20; // Ignore focus events if a key was pressed prior\n\n        if (event.type === 'focus' && !wasKeyDown) {\n          return;\n        } // Remove all current\n\n\n        removeCurrent(); // Delay the adding of classname until the focus has changed\n        // This event fires before the focusin event\n\n        this.focusTimer = setTimeout(function () {\n          var focused = document.activeElement; // Ignore if current focus element isn't inside the player\n\n          if (!elements.container.contains(focused)) {\n            return;\n          }\n\n          toggleClass(document.activeElement, player.config.classNames.tabFocus, true);\n        }, 10);\n      } // Global window & document listeners\n\n    }, {\n      key: \"global\",\n      value: function global() {\n        var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n        var player = this.player; // Keyboard shortcuts\n\n        if (player.config.keyboard.global) {\n          toggleListener.call(player, window, 'keydown keyup', this.handleKey, toggle, false);\n        } // Click anywhere closes menu\n\n\n        toggleListener.call(player, document.body, 'click', this.toggleMenu, toggle); // Detect touch by events\n\n        once.call(player, document.body, 'touchstart', this.firstTouch); // Tab focus detection\n\n        toggleListener.call(player, document.body, 'keydown focus blur', this.setTabFocus, toggle, false, true);\n      } // Container listeners\n\n    }, {\n      key: \"container\",\n      value: function container() {\n        var player = this.player;\n        var config = player.config,\n            elements = player.elements,\n            timers = player.timers; // Keyboard shortcuts\n\n        if (!config.keyboard.global && config.keyboard.focused) {\n          on.call(player, elements.container, 'keydown keyup', this.handleKey, false);\n        } // Toggle controls on mouse events and entering fullscreen\n\n\n        on.call(player, elements.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen', function (event) {\n          var controlsElement = elements.controls; // Remove button states for fullscreen\n\n          if (controlsElement && event.type === 'enterfullscreen') {\n            controlsElement.pressed = false;\n            controlsElement.hover = false;\n          } // Show, then hide after a timeout unless another control event occurs\n\n\n          var show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type);\n          var delay = 0;\n\n          if (show) {\n            ui.toggleControls.call(player, true); // Use longer timeout for touch devices\n\n            delay = player.touch ? 3000 : 2000;\n          } // Clear timer\n\n\n          clearTimeout(timers.controls); // Set new timer to prevent flicker when seeking\n\n          timers.controls = setTimeout(function () {\n            return ui.toggleControls.call(player, false);\n          }, delay);\n        }); // Set a gutter for Vimeo\n\n        var setGutter = function setGutter(ratio, padding, toggle) {\n          if (!player.isVimeo) {\n            return;\n          }\n\n          var target = player.elements.wrapper.firstChild;\n\n          var _ratio = _slicedToArray(ratio, 2),\n              y = _ratio[1];\n\n          var _getAspectRatio$call = getAspectRatio.call(player),\n              _getAspectRatio$call2 = _slicedToArray(_getAspectRatio$call, 2),\n              videoX = _getAspectRatio$call2[0],\n              videoY = _getAspectRatio$call2[1];\n\n          target.style.maxWidth = toggle ? \"\".concat(y / videoY * videoX, \"px\") : null;\n          target.style.margin = toggle ? '0 auto' : null;\n        }; // Resize on fullscreen change\n\n\n        var setPlayerSize = function setPlayerSize(measure) {\n          // If we don't need to measure the viewport\n          if (!measure) {\n            return setAspectRatio.call(player);\n          }\n\n          var rect = elements.container.getBoundingClientRect();\n          var width = rect.width,\n              height = rect.height;\n          return setAspectRatio.call(player, \"\".concat(width, \":\").concat(height));\n        };\n\n        var resized = function resized() {\n          clearTimeout(timers.resized);\n          timers.resized = setTimeout(setPlayerSize, 50);\n        };\n\n        on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {\n          var _player$fullscreen = player.fullscreen,\n              target = _player$fullscreen.target,\n              usingNative = _player$fullscreen.usingNative; // Ignore events not from target\n\n          if (target !== elements.container) {\n            return;\n          } // If it's not an embed and no ratio specified\n\n\n          if (!player.isEmbed && is$1.empty(player.config.ratio)) {\n            return;\n          }\n\n          var isEnter = event.type === 'enterfullscreen'; // Set the player size when entering fullscreen to viewport size\n\n          var _setPlayerSize = setPlayerSize(isEnter),\n              padding = _setPlayerSize.padding,\n              ratio = _setPlayerSize.ratio; // Set Vimeo gutter\n\n\n          setGutter(ratio, padding, isEnter); // If not using native fullscreen, we need to check for resizes of viewport\n\n          if (!usingNative) {\n            if (isEnter) {\n              on.call(player, window, 'resize', resized);\n            } else {\n              off.call(player, window, 'resize', resized);\n            }\n          }\n        });\n      } // Listen for media events\n\n    }, {\n      key: \"media\",\n      value: function media() {\n        var _this = this;\n\n        var player = this.player;\n        var elements = player.elements; // Time change on media\n\n        on.call(player, player.media, 'timeupdate seeking seeked', function (event) {\n          return controls.timeUpdate.call(player, event);\n        }); // Display duration\n\n        on.call(player, player.media, 'durationchange loadeddata loadedmetadata', function (event) {\n          return controls.durationUpdate.call(player, event);\n        }); // Check for audio tracks on load\n        // We can't use `loadedmetadata` as it doesn't seem to have audio tracks at that point\n\n        on.call(player, player.media, 'canplay loadeddata', function () {\n          toggleHidden(elements.volume, !player.hasAudio);\n          toggleHidden(elements.buttons.mute, !player.hasAudio);\n        }); // Handle the media finishing\n\n        on.call(player, player.media, 'ended', function () {\n          // Show poster on end\n          if (player.isHTML5 && player.isVideo && player.config.resetOnEnd) {\n            // Restart\n            player.restart();\n          }\n        }); // Check for buffer progress\n\n        on.call(player, player.media, 'progress playing seeking seeked', function (event) {\n          return controls.updateProgress.call(player, event);\n        }); // Handle volume changes\n\n        on.call(player, player.media, 'volumechange', function (event) {\n          return controls.updateVolume.call(player, event);\n        }); // Handle play/pause\n\n        on.call(player, player.media, 'playing play pause ended emptied timeupdate', function (event) {\n          return ui.checkPlaying.call(player, event);\n        }); // Loading state\n\n        on.call(player, player.media, 'waiting canplay seeked playing', function (event) {\n          return ui.checkLoading.call(player, event);\n        }); // Click video\n\n        if (player.supported.ui && player.config.clickToPlay && !player.isAudio) {\n          // Re-fetch the wrapper\n          var wrapper = getElement.call(player, \".\".concat(player.config.classNames.video)); // Bail if there's no wrapper (this should never happen)\n\n          if (!is$1.element(wrapper)) {\n            return;\n          } // On click play, pause or restart\n\n\n          on.call(player, elements.container, 'click', function (event) {\n            var targets = [elements.container, wrapper]; // Ignore if click if not container or in video wrapper\n\n            if (!targets.includes(event.target) && !wrapper.contains(event.target)) {\n              return;\n            } // Touch devices will just show controls (if hidden)\n\n\n            if (player.touch && player.config.hideControls) {\n              return;\n            }\n\n            if (player.ended) {\n              _this.proxy(event, player.restart, 'restart');\n\n              _this.proxy(event, player.play, 'play');\n            } else {\n              _this.proxy(event, player.togglePlay, 'play');\n            }\n          });\n        } // Disable right click\n\n\n        if (player.supported.ui && player.config.disableContextMenu) {\n          on.call(player, elements.wrapper, 'contextmenu', function (event) {\n            event.preventDefault();\n          }, false);\n        } // Volume change\n\n\n        on.call(player, player.media, 'volumechange', function () {\n          // Save to storage\n          player.storage.set({\n            volume: player.volume,\n            muted: player.muted\n          });\n        }); // Speed change\n\n        on.call(player, player.media, 'ratechange', function () {\n          // Update UI\n          controls.updateSetting.call(player, 'speed'); // Save to storage\n\n\n          player.storage.set({\n            speed: player.speed\n          });\n        }); // Quality change\n\n        on.call(player, player.media, 'qualitychange', function (event) {\n          // Update UI\n          controls.updateSetting.call(player, 'quality', null, event.detail.quality);\n        }); // Update download link when ready and if quality changes\n\n        on.call(player, player.media, 'ready qualitychange', function () {\n          controls.setDownloadUrl.call(player);\n        }); // Proxy events to container\n        // Bubble up key events for Edge\n\n        var proxyEvents = player.config.events.concat(['keyup', 'keydown']).join(' ');\n        on.call(player, player.media, proxyEvents, function (event) {\n          var _event$detail = event.detail,\n              detail = _event$detail === void 0 ? {} : _event$detail; // Get error details from media\n\n          if (event.type === 'error') {\n            detail = player.media.error;\n          }\n\n          triggerEvent.call(player, elements.container, event.type, true, detail);\n        });\n      } // Run default and custom handlers\n\n    }, {\n      key: \"proxy\",\n      value: function proxy(event, defaultHandler, customHandlerKey) {\n        var player = this.player;\n        var customHandler = player.config.listeners[customHandlerKey];\n        var hasCustomHandler = is$1.function(customHandler);\n        var returned = true; // Execute custom handler\n\n        if (hasCustomHandler) {\n          returned = customHandler.call(player, event);\n        } // Only call default handler if not prevented in custom handler\n\n\n        if (returned && is$1.function(defaultHandler)) {\n          defaultHandler.call(player, event);\n        }\n      } // Trigger custom and default handlers\n\n    }, {\n      key: \"bind\",\n      value: function bind(element, type, defaultHandler, customHandlerKey) {\n        var _this2 = this;\n\n        var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n        var player = this.player;\n        var customHandler = player.config.listeners[customHandlerKey];\n        var hasCustomHandler = is$1.function(customHandler);\n        on.call(player, element, type, function (event) {\n          return _this2.proxy(event, defaultHandler, customHandlerKey);\n        }, passive && !hasCustomHandler);\n      } // Listen for control events\n\n    }, {\n      key: \"controls\",\n      value: function controls$1() {\n        var _this3 = this;\n\n        var player = this.player;\n        var elements = player.elements; // IE doesn't support input event, so we fallback to change\n\n        var inputEvent = browser.isIE ? 'change' : 'input'; // Play/pause toggle\n\n        if (elements.buttons.play) {\n          Array.from(elements.buttons.play).forEach(function (button) {\n            _this3.bind(button, 'click', player.togglePlay, 'play');\n          });\n        } // Pause\n\n\n        this.bind(elements.buttons.restart, 'click', player.restart, 'restart'); // Rewind\n\n        this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind'); // Rewind\n\n        this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward'); // Mute toggle\n\n        this.bind(elements.buttons.mute, 'click', function () {\n          player.muted = !player.muted;\n        }, 'mute'); // Captions toggle\n\n        this.bind(elements.buttons.captions, 'click', function () {\n          return player.toggleCaptions();\n        }); // Download\n\n        this.bind(elements.buttons.download, 'click', function () {\n          triggerEvent.call(player, player.media, 'download');\n        }, 'download'); // Fullscreen toggle\n\n        this.bind(elements.buttons.fullscreen, 'click', function () {\n          player.fullscreen.toggle();\n        }, 'fullscreen'); // Picture-in-Picture\n\n        this.bind(elements.buttons.pip, 'click', function () {\n          player.pip = 'toggle';\n        }, 'pip'); // Airplay\n\n        this.bind(elements.buttons.airplay, 'click', player.airplay, 'airplay'); // Settings menu - click toggle\n\n        this.bind(elements.buttons.settings, 'click', function (event) {\n          // Prevent the document click listener closing the menu\n          event.stopPropagation();\n\n          controls.toggleMenu.call(player, event);\n        }); // Settings menu - keyboard toggle\n        // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus\n        // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143\n\n        this.bind(elements.buttons.settings, 'keyup', function (event) {\n          var code = event.which; // We only care about space and return\n\n          if (![13, 32].includes(code)) {\n            return;\n          } // Because return triggers a click anyway, all we need to do is set focus\n\n\n          if (code === 13) {\n            controls.focusFirstMenuItem.call(player, null, true);\n\n            return;\n          } // Prevent scroll\n\n\n          event.preventDefault(); // Prevent playing video (Firefox)\n\n          event.stopPropagation(); // Toggle menu\n\n          controls.toggleMenu.call(player, event);\n        }, null, false // Can't be passive as we're preventing default\n        ); // Escape closes menu\n\n        this.bind(elements.settings.menu, 'keydown', function (event) {\n          if (event.which === 27) {\n            controls.toggleMenu.call(player, event);\n          }\n        }); // Set range input alternative \"value\", which matches the tooltip time (#954)\n\n        this.bind(elements.inputs.seek, 'mousedown mousemove', function (event) {\n          var rect = elements.progress.getBoundingClientRect();\n          var percent = 100 / rect.width * (event.pageX - rect.left);\n          event.currentTarget.setAttribute('seek-value', percent);\n        }); // Pause while seeking\n\n        this.bind(elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', function (event) {\n          var seek = event.currentTarget;\n          var code = event.keyCode ? event.keyCode : event.which;\n          var attribute = 'play-on-seeked';\n\n          if (is$1.keyboardEvent(event) && code !== 39 && code !== 37) {\n            return;\n          } // Record seek time so we can prevent hiding controls for a few seconds after seek\n\n\n          player.lastSeekTime = Date.now(); // Was playing before?\n\n          var play = seek.hasAttribute(attribute); // Done seeking\n\n          var done = ['mouseup', 'touchend', 'keyup'].includes(event.type); // If we're done seeking and it was playing, resume playback\n\n          if (play && done) {\n            seek.removeAttribute(attribute);\n            player.play();\n          } else if (!done && player.playing) {\n            seek.setAttribute(attribute, '');\n            player.pause();\n          }\n        }); // Fix range inputs on iOS\n        // Super weird iOS bug where after you interact with an <input type=\"range\">,\n        // it takes over further interactions on the page. This is a hack\n\n        if (browser.isIos) {\n          var inputs = getElements.call(player, 'input[type=\"range\"]');\n          Array.from(inputs).forEach(function (input) {\n            return _this3.bind(input, inputEvent, function (event) {\n              return repaint(event.target);\n            });\n          });\n        } // Seek\n\n\n        this.bind(elements.inputs.seek, inputEvent, function (event) {\n          var seek = event.currentTarget; // If it exists, use seek-value instead of \"value\" for consistency with tooltip time (#954)\n\n          var seekTo = seek.getAttribute('seek-value');\n\n          if (is$1.empty(seekTo)) {\n            seekTo = seek.value;\n          }\n\n          seek.removeAttribute('seek-value');\n          player.currentTime = seekTo / seek.max * player.duration;\n        }, 'seek'); // Seek tooltip\n\n        this.bind(elements.progress, 'mouseenter mouseleave mousemove', function (event) {\n          return controls.updateSeekTooltip.call(player, event);\n        }); // Preview thumbnails plugin\n        // TODO: Really need to work on some sort of plug-in wide event bus or pub-sub for this\n\n        this.bind(elements.progress, 'mousemove touchmove', function (event) {\n          var previewThumbnails = player.previewThumbnails;\n\n          if (previewThumbnails && previewThumbnails.loaded) {\n            previewThumbnails.startMove(event);\n          }\n        }); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering\n\n        this.bind(elements.progress, 'mouseleave click', function () {\n          var previewThumbnails = player.previewThumbnails;\n\n          if (previewThumbnails && previewThumbnails.loaded) {\n            previewThumbnails.endMove(false, true);\n          }\n        }); // Show scrubbing preview\n\n        this.bind(elements.progress, 'mousedown touchstart', function (event) {\n          var previewThumbnails = player.previewThumbnails;\n\n          if (previewThumbnails && previewThumbnails.loaded) {\n            previewThumbnails.startScrubbing(event);\n          }\n        });\n        this.bind(elements.progress, 'mouseup touchend', function (event) {\n          var previewThumbnails = player.previewThumbnails;\n\n          if (previewThumbnails && previewThumbnails.loaded) {\n            previewThumbnails.endScrubbing(event);\n          }\n        }); // Polyfill for lower fill in <input type=\"range\"> for webkit\n\n        if (browser.isWebkit) {\n          Array.from(getElements.call(player, 'input[type=\"range\"]')).forEach(function (element) {\n            _this3.bind(element, 'input', function (event) {\n              return controls.updateRangeFill.call(player, event.target);\n            });\n          });\n        } // Current time invert\n        // Only if one time element is used for both currentTime and duration\n\n\n        if (player.config.toggleInvert && !is$1.element(elements.display.duration)) {\n          this.bind(elements.display.currentTime, 'click', function () {\n            // Do nothing if we're at the start\n            if (player.currentTime === 0) {\n              return;\n            }\n\n            player.config.invertTime = !player.config.invertTime;\n\n            controls.timeUpdate.call(player);\n          });\n        } // Volume\n\n\n        this.bind(elements.inputs.volume, inputEvent, function (event) {\n          player.volume = event.target.value;\n        }, 'volume'); // Update controls.hover state (used for ui.toggleControls to avoid hiding when interacting)\n\n        this.bind(elements.controls, 'mouseenter mouseleave', function (event) {\n          elements.controls.hover = !player.touch && event.type === 'mouseenter';\n        }); // Update controls.pressed state (used for ui.toggleControls to avoid hiding when interacting)\n\n        this.bind(elements.controls, 'mousedown mouseup touchstart touchend touchcancel', function (event) {\n          elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);\n        }); // Show controls when they receive focus (e.g., when using keyboard tab key)\n\n        this.bind(elements.controls, 'focusin', function () {\n          var config = player.config,\n              timers = player.timers; // Skip transition to prevent focus from scrolling the parent element\n\n          toggleClass(elements.controls, config.classNames.noTransition, true); // Toggle\n\n          ui.toggleControls.call(player, true); // Restore transition\n\n          setTimeout(function () {\n            toggleClass(elements.controls, config.classNames.noTransition, false);\n          }, 0); // Delay a little more for mouse users\n\n          var delay = _this3.touch ? 3000 : 4000; // Clear timer\n\n          clearTimeout(timers.controls); // Hide again after delay\n\n          timers.controls = setTimeout(function () {\n            return ui.toggleControls.call(player, false);\n          }, delay);\n        }); // Mouse wheel for volume\n\n        this.bind(elements.inputs.volume, 'wheel', function (event) {\n          // Detect \"natural\" scroll - suppored on OS X Safari only\n          // Other browsers on OS X will be inverted until support improves\n          var inverted = event.webkitDirectionInvertedFromDevice; // Get delta from event. Invert if `inverted` is true\n\n          var _map = [event.deltaX, -event.deltaY].map(function (value) {\n            return inverted ? -value : value;\n          }),\n              _map2 = _slicedToArray(_map, 2),\n              x = _map2[0],\n              y = _map2[1]; // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)\n\n\n          var direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y); // Change the volume by 2%\n\n          player.increaseVolume(direction / 50); // Don't break page scrolling at max and min\n\n          var volume = player.media.volume;\n\n          if (direction === 1 && volume < 1 || direction === -1 && volume > 0) {\n            event.preventDefault();\n          }\n        }, 'volume', false);\n      }\n    }]);\n\n    return Listeners;\n  }();\n\n  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n  function createCommonjsModule(fn, module) {\n  \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n  }\n\n  var loadjs_umd = createCommonjsModule(function (module, exports) {\n    (function (root, factory) {\n      {\n        module.exports = factory();\n      }\n    })(commonjsGlobal, function () {\n      /**\n       * Global dependencies.\n       * @global {Object} document - DOM\n       */\n      var devnull = function devnull() {},\n          bundleIdCache = {},\n          bundleResultCache = {},\n          bundleCallbackQueue = {};\n      /**\n       * Subscribe to bundle load event.\n       * @param {string[]} bundleIds - Bundle ids\n       * @param {Function} callbackFn - The callback function\n       */\n\n\n      function subscribe(bundleIds, callbackFn) {\n        // listify\n        bundleIds = bundleIds.push ? bundleIds : [bundleIds];\n        var depsNotFound = [],\n            i = bundleIds.length,\n            numWaiting = i,\n            fn,\n            bundleId,\n            r,\n            q; // define callback function\n\n        fn = function fn(bundleId, pathsNotFound) {\n          if (pathsNotFound.length) depsNotFound.push(bundleId);\n          numWaiting--;\n          if (!numWaiting) callbackFn(depsNotFound);\n        }; // register callback\n\n\n        while (i--) {\n          bundleId = bundleIds[i]; // execute callback if in result cache\n\n          r = bundleResultCache[bundleId];\n\n          if (r) {\n            fn(bundleId, r);\n            continue;\n          } // add to callback queue\n\n\n          q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];\n          q.push(fn);\n        }\n      }\n      /**\n       * Publish bundle load event.\n       * @param {string} bundleId - Bundle id\n       * @param {string[]} pathsNotFound - List of files not found\n       */\n\n\n      function publish(bundleId, pathsNotFound) {\n        // exit if id isn't defined\n        if (!bundleId) return;\n        var q = bundleCallbackQueue[bundleId]; // cache result\n\n        bundleResultCache[bundleId] = pathsNotFound; // exit if queue is empty\n\n        if (!q) return; // empty callback queue\n\n        while (q.length) {\n          q[0](bundleId, pathsNotFound);\n          q.splice(0, 1);\n        }\n      }\n      /**\n       * Execute callbacks.\n       * @param {Object or Function} args - The callback args\n       * @param {string[]} depsNotFound - List of dependencies not found\n       */\n\n\n      function executeCallbacks(args, depsNotFound) {\n        // accept function as argument\n        if (args.call) args = {\n          success: args\n        }; // success and error callbacks\n\n        if (depsNotFound.length) (args.error || devnull)(depsNotFound);else (args.success || devnull)(args);\n      }\n      /**\n       * Load individual file.\n       * @param {string} path - The file path\n       * @param {Function} callbackFn - The callback function\n       */\n\n\n      function loadFile(path, callbackFn, args, numTries) {\n        var doc = document,\n            async = args.async,\n            maxTries = (args.numRetries || 0) + 1,\n            beforeCallbackFn = args.before || devnull,\n            pathStripped = path.replace(/^(css|img)!/, ''),\n            isLegacyIECss,\n            e;\n        numTries = numTries || 0;\n\n        if (/(^css!|\\.css$)/.test(path)) {\n          // css\n          e = doc.createElement('link');\n          e.rel = 'stylesheet';\n          e.href = pathStripped; // tag IE9+\n\n          isLegacyIECss = 'hideFocus' in e; // use preload in IE Edge (to detect load errors)\n\n          if (isLegacyIECss && e.relList) {\n            isLegacyIECss = 0;\n            e.rel = 'preload';\n            e.as = 'style';\n          }\n        } else if (/(^img!|\\.(png|gif|jpg|svg)$)/.test(path)) {\n          // image\n          e = doc.createElement('img');\n          e.src = pathStripped;\n        } else {\n          // javascript\n          e = doc.createElement('script');\n          e.src = path;\n          e.async = async === undefined ? true : async;\n        }\n\n        e.onload = e.onerror = e.onbeforeload = function (ev) {\n          var result = ev.type[0]; // treat empty stylesheets as failures to get around lack of onerror\n          // support in IE9-11\n\n          if (isLegacyIECss) {\n            try {\n              if (!e.sheet.cssText.length) result = 'e';\n            } catch (x) {\n              // sheets objects created from load errors don't allow access to\n              // `cssText` (unless error is Code:18 SecurityError)\n              if (x.code != 18) result = 'e';\n            }\n          } // handle retries in case of load failure\n\n\n          if (result == 'e') {\n            // increment counter\n            numTries += 1; // exit function and try again\n\n            if (numTries < maxTries) {\n              return loadFile(path, callbackFn, args, numTries);\n            }\n          } else if (e.rel == 'preload' && e.as == 'style') {\n            // activate preloaded stylesheets\n            return e.rel = 'stylesheet'; // jshint ignore:line\n          } // execute callback\n\n\n          callbackFn(path, result, ev.defaultPrevented);\n        }; // add to document (unless callback returns `false`)\n\n\n        if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);\n      }\n      /**\n       * Load multiple files.\n       * @param {string[]} paths - The file paths\n       * @param {Function} callbackFn - The callback function\n       */\n\n\n      function loadFiles(paths, callbackFn, args) {\n        // listify paths\n        paths = paths.push ? paths : [paths];\n        var numWaiting = paths.length,\n            x = numWaiting,\n            pathsNotFound = [],\n            fn,\n            i; // define callback function\n\n        fn = function fn(path, result, defaultPrevented) {\n          // handle error\n          if (result == 'e') pathsNotFound.push(path); // handle beforeload event. If defaultPrevented then that means the load\n          // will be blocked (ex. Ghostery/ABP on Safari)\n\n          if (result == 'b') {\n            if (defaultPrevented) pathsNotFound.push(path);else return;\n          }\n\n          numWaiting--;\n          if (!numWaiting) callbackFn(pathsNotFound);\n        }; // load scripts\n\n\n        for (i = 0; i < x; i++) {\n          loadFile(paths[i], fn, args);\n        }\n      }\n      /**\n       * Initiate script load and register bundle.\n       * @param {(string|string[])} paths - The file paths\n       * @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success\n       *   callback or (3) object literal with success/error arguments, numRetries,\n       *   etc.\n       * @param {(Function|Object)} [arg2] - The (1) success callback or (2) object\n       *   literal with success/error arguments, numRetries, etc.\n       */\n\n\n      function loadjs(paths, arg1, arg2) {\n        var bundleId, args; // bundleId (if string)\n\n        if (arg1 && arg1.trim) bundleId = arg1; // args (default is {})\n\n        args = (bundleId ? arg2 : arg1) || {}; // throw error if bundle is already defined\n\n        if (bundleId) {\n          if (bundleId in bundleIdCache) {\n            throw \"LoadJS\";\n          } else {\n            bundleIdCache[bundleId] = true;\n          }\n        }\n\n        function loadFn(resolve, reject) {\n          loadFiles(paths, function (pathsNotFound) {\n            // execute callbacks\n            executeCallbacks(args, pathsNotFound); // resolve Promise\n\n            if (resolve) {\n              executeCallbacks({\n                success: resolve,\n                error: reject\n              }, pathsNotFound);\n            } // publish bundle load event\n\n\n            publish(bundleId, pathsNotFound);\n          }, args);\n        }\n\n        if (args.returnPromise) return new Promise(loadFn);else loadFn();\n      }\n      /**\n       * Execute callbacks when dependencies have been satisfied.\n       * @param {(string|string[])} deps - List of bundle ids\n       * @param {Object} args - success/error arguments\n       */\n\n\n      loadjs.ready = function ready(deps, args) {\n        // subscribe to bundle load event\n        subscribe(deps, function (depsNotFound) {\n          // execute callbacks\n          executeCallbacks(args, depsNotFound);\n        });\n        return loadjs;\n      };\n      /**\n       * Manually satisfy bundle dependencies.\n       * @param {string} bundleId - The bundle id\n       */\n\n\n      loadjs.done = function done(bundleId) {\n        publish(bundleId, []);\n      };\n      /**\n       * Reset loadjs dependencies statuses\n       */\n\n\n      loadjs.reset = function reset() {\n        bundleIdCache = {};\n        bundleResultCache = {};\n        bundleCallbackQueue = {};\n      };\n      /**\n       * Determine if bundle has already been defined\n       * @param String} bundleId - The bundle id\n       */\n\n\n      loadjs.isDefined = function isDefined(bundleId) {\n        return bundleId in bundleIdCache;\n      }; // export\n\n\n      return loadjs;\n    });\n  });\n\n  // ==========================================================================\n  function loadScript(url) {\n    return new Promise(function (resolve, reject) {\n      loadjs_umd(url, {\n        success: resolve,\n        error: reject\n      });\n    });\n  }\n\n  function parseId(url) {\n    if (is$1.empty(url)) {\n      return null;\n    }\n\n    if (is$1.number(Number(url))) {\n      return url;\n    }\n\n    var regex = /^.*(vimeo.com\\/|video\\/)(\\d+).*/;\n    return url.match(regex) ? RegExp.$2 : url;\n  } // Set playback state and trigger change (only on actual change)\n\n\n  function assurePlaybackState(play) {\n    if (play && !this.embed.hasPlayed) {\n      this.embed.hasPlayed = true;\n    }\n\n    if (this.media.paused === play) {\n      this.media.paused = !play;\n      triggerEvent.call(this, this.media, play ? 'play' : 'pause');\n    }\n  }\n\n  var vimeo = {\n    setup: function setup() {\n      var _this = this;\n\n      // Add embed class for responsive\n      toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Set intial ratio\n\n      setAspectRatio.call(this); // Load the SDK if not already\n\n      if (!is$1.object(window.Vimeo)) {\n        loadScript(this.config.urls.vimeo.sdk).then(function () {\n          vimeo.ready.call(_this);\n        }).catch(function (error) {\n          _this.debug.warn('Vimeo SDK (player.js) failed to load', error);\n        });\n      } else {\n        vimeo.ready.call(this);\n      }\n    },\n    // API Ready\n    ready: function ready() {\n      var _this2 = this;\n\n      var player = this;\n      var config = player.config.vimeo; // Get Vimeo params for the iframe\n\n      var params = buildUrlParams(extend({}, {\n        loop: player.config.loop.active,\n        autoplay: player.autoplay,\n        muted: player.muted,\n        gesture: 'media',\n        playsinline: !this.config.fullscreen.iosNative\n      }, config)); // Get the source URL or ID\n\n      var source = player.media.getAttribute('src'); // Get from <div> if needed\n\n      if (is$1.empty(source)) {\n        source = player.media.getAttribute(player.config.attributes.embed.id);\n      }\n\n      var id = parseId(source); // Build an iframe\n\n      var iframe = createElement('iframe');\n      var src = format(player.config.urls.vimeo.iframe, id, params);\n      iframe.setAttribute('src', src);\n      iframe.setAttribute('allowfullscreen', '');\n      iframe.setAttribute('allowtransparency', '');\n      iframe.setAttribute('allow', 'autoplay'); // Get poster, if already set\n\n      var poster = player.poster; // Inject the package\n\n      var wrapper = createElement('div', {\n        poster: poster,\n        class: player.config.classNames.embedContainer\n      });\n      wrapper.appendChild(iframe);\n      player.media = replaceElement(wrapper, player.media); // Get poster image\n\n      fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {\n        if (is$1.empty(response)) {\n          return;\n        } // Get the URL for thumbnail\n\n\n        var url = new URL(response[0].thumbnail_large); // Get original image\n\n        url.pathname = \"\".concat(url.pathname.split('_')[0], \".jpg\"); // Set and show poster\n\n        ui.setPoster.call(player, url.href).catch(function () {});\n      }); // Setup instance\n      // https://github.com/vimeo/player.js\n\n      player.embed = new window.Vimeo.Player(iframe, {\n        autopause: player.config.autopause,\n        muted: player.muted\n      });\n      player.media.paused = true;\n      player.media.currentTime = 0; // Disable native text track rendering\n\n      if (player.supported.ui) {\n        player.embed.disableTextTrack();\n      } // Create a faux HTML5 API using the Vimeo API\n\n\n      player.media.play = function () {\n        assurePlaybackState.call(player, true);\n        return player.embed.play();\n      };\n\n      player.media.pause = function () {\n        assurePlaybackState.call(player, false);\n        return player.embed.pause();\n      };\n\n      player.media.stop = function () {\n        player.pause();\n        player.currentTime = 0;\n      }; // Seeking\n\n\n      var currentTime = player.media.currentTime;\n      Object.defineProperty(player.media, 'currentTime', {\n        get: function get() {\n          return currentTime;\n        },\n        set: function set(time) {\n          // Vimeo will automatically play on seek if the video hasn't been played before\n          // Get current paused state and volume etc\n          var embed = player.embed,\n              media = player.media,\n              paused = player.paused,\n              volume = player.volume;\n          var restorePause = paused && !embed.hasPlayed; // Set seeking state and trigger event\n\n          media.seeking = true;\n          triggerEvent.call(player, media, 'seeking'); // If paused, mute until seek is complete\n\n          Promise.resolve(restorePause && embed.setVolume(0)) // Seek\n          .then(function () {\n            return embed.setCurrentTime(time);\n          }) // Restore paused\n          .then(function () {\n            return restorePause && embed.pause();\n          }) // Restore volume\n          .then(function () {\n            return restorePause && embed.setVolume(volume);\n          }).catch(function () {// Do nothing\n          });\n        }\n      }); // Playback speed\n\n      var speed = player.config.speed.selected;\n      Object.defineProperty(player.media, 'playbackRate', {\n        get: function get() {\n          return speed;\n        },\n        set: function set(input) {\n          player.embed.setPlaybackRate(input).then(function () {\n            speed = input;\n            triggerEvent.call(player, player.media, 'ratechange');\n          }).catch(function (error) {\n            // Hide menu item (and menu if empty)\n            if (error.name === 'Error') {\n              controls.setSpeedMenu.call(player, []);\n            }\n          });\n        }\n      }); // Volume\n\n      var volume = player.config.volume;\n      Object.defineProperty(player.media, 'volume', {\n        get: function get() {\n          return volume;\n        },\n        set: function set(input) {\n          player.embed.setVolume(input).then(function () {\n            volume = input;\n            triggerEvent.call(player, player.media, 'volumechange');\n          });\n        }\n      }); // Muted\n\n      var muted = player.config.muted;\n      Object.defineProperty(player.media, 'muted', {\n        get: function get() {\n          return muted;\n        },\n        set: function set(input) {\n          var toggle = is$1.boolean(input) ? input : false;\n          player.embed.setVolume(toggle ? 0 : player.config.volume).then(function () {\n            muted = toggle;\n            triggerEvent.call(player, player.media, 'volumechange');\n          });\n        }\n      }); // Loop\n\n      var loop = player.config.loop;\n      Object.defineProperty(player.media, 'loop', {\n        get: function get() {\n          return loop;\n        },\n        set: function set(input) {\n          var toggle = is$1.boolean(input) ? input : player.config.loop.active;\n          player.embed.setLoop(toggle).then(function () {\n            loop = toggle;\n          });\n        }\n      }); // Source\n\n      var currentSrc;\n      player.embed.getVideoUrl().then(function (value) {\n        currentSrc = value;\n        controls.setDownloadUrl.call(player);\n      }).catch(function (error) {\n        _this2.debug.warn(error);\n      });\n      Object.defineProperty(player.media, 'currentSrc', {\n        get: function get() {\n          return currentSrc;\n        }\n      }); // Ended\n\n      Object.defineProperty(player.media, 'ended', {\n        get: function get() {\n          return player.currentTime === player.duration;\n        }\n      }); // Set aspect ratio based on video size\n\n      Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(function (dimensions) {\n        var _dimensions = _slicedToArray(dimensions, 2),\n            width = _dimensions[0],\n            height = _dimensions[1];\n\n        player.embed.ratio = [width, height];\n        setAspectRatio.call(_this2);\n      }); // Set autopause\n\n      player.embed.setAutopause(player.config.autopause).then(function (state) {\n        player.config.autopause = state;\n      }); // Get title\n\n      player.embed.getVideoTitle().then(function (title) {\n        player.config.title = title;\n        ui.setTitle.call(_this2);\n      }); // Get current time\n\n      player.embed.getCurrentTime().then(function (value) {\n        currentTime = value;\n        triggerEvent.call(player, player.media, 'timeupdate');\n      }); // Get duration\n\n      player.embed.getDuration().then(function (value) {\n        player.media.duration = value;\n        triggerEvent.call(player, player.media, 'durationchange');\n      }); // Get captions\n\n      player.embed.getTextTracks().then(function (tracks) {\n        player.media.textTracks = tracks;\n        captions.setup.call(player);\n      });\n      player.embed.on('cuechange', function (_ref) {\n        var _ref$cues = _ref.cues,\n            cues = _ref$cues === void 0 ? [] : _ref$cues;\n        var strippedCues = cues.map(function (cue) {\n          return stripHTML(cue.text);\n        });\n        captions.updateCues.call(player, strippedCues);\n      });\n      player.embed.on('loaded', function () {\n        // Assure state and events are updated on autoplay\n        player.embed.getPaused().then(function (paused) {\n          assurePlaybackState.call(player, !paused);\n\n          if (!paused) {\n            triggerEvent.call(player, player.media, 'playing');\n          }\n        });\n\n        if (is$1.element(player.embed.element) && player.supported.ui) {\n          var frame = player.embed.element; // Fix keyboard focus issues\n          // https://github.com/sampotts/plyr/issues/317\n\n          frame.setAttribute('tabindex', -1);\n        }\n      });\n      player.embed.on('play', function () {\n        assurePlaybackState.call(player, true);\n        triggerEvent.call(player, player.media, 'playing');\n      });\n      player.embed.on('pause', function () {\n        assurePlaybackState.call(player, false);\n      });\n      player.embed.on('timeupdate', function (data) {\n        player.media.seeking = false;\n        currentTime = data.seconds;\n        triggerEvent.call(player, player.media, 'timeupdate');\n      });\n      player.embed.on('progress', function (data) {\n        player.media.buffered = data.percent;\n        triggerEvent.call(player, player.media, 'progress'); // Check all loaded\n\n        if (parseInt(data.percent, 10) === 1) {\n          triggerEvent.call(player, player.media, 'canplaythrough');\n        } // Get duration as if we do it before load, it gives an incorrect value\n        // https://github.com/sampotts/plyr/issues/891\n\n\n        player.embed.getDuration().then(function (value) {\n          if (value !== player.media.duration) {\n            player.media.duration = value;\n            triggerEvent.call(player, player.media, 'durationchange');\n          }\n        });\n      });\n      player.embed.on('seeked', function () {\n        player.media.seeking = false;\n        triggerEvent.call(player, player.media, 'seeked');\n      });\n      player.embed.on('ended', function () {\n        player.media.paused = true;\n        triggerEvent.call(player, player.media, 'ended');\n      });\n      player.embed.on('error', function (detail) {\n        player.media.error = detail;\n        triggerEvent.call(player, player.media, 'error');\n      }); // Rebuild UI\n\n      setTimeout(function () {\n        return ui.build.call(player);\n      }, 0);\n    }\n  };\n\n  // ==========================================================================\n\n  function parseId$1(url) {\n    if (is$1.empty(url)) {\n      return null;\n    }\n\n    var regex = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/;\n    return url.match(regex) ? RegExp.$2 : url;\n  } // Set playback state and trigger change (only on actual change)\n\n\n  function assurePlaybackState$1(play) {\n    if (play && !this.embed.hasPlayed) {\n      this.embed.hasPlayed = true;\n    }\n\n    if (this.media.paused === play) {\n      this.media.paused = !play;\n      triggerEvent.call(this, this.media, play ? 'play' : 'pause');\n    }\n  }\n\n  function getHost(config) {\n    if (config.noCookie) {\n      return 'https://www.youtube-nocookie.com';\n    }\n\n    if (window.location.protocol === 'http:') {\n      return 'http://www.youtube.com';\n    } // Use YouTube's default\n\n\n    return undefined;\n  }\n\n  var youtube = {\n    setup: function setup() {\n      var _this = this;\n\n      // Add embed class for responsive\n      toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Setup API\n\n      if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {\n        youtube.ready.call(this);\n      } else {\n        // Reference current global callback\n        var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue\n\n        window.onYouTubeIframeAPIReady = function () {\n          // Call global callback if set\n          if (is$1.function(callback)) {\n            callback();\n          }\n\n          youtube.ready.call(_this);\n        }; // Load the SDK\n\n\n        loadScript(this.config.urls.youtube.sdk).catch(function (error) {\n          _this.debug.warn('YouTube API failed to load', error);\n        });\n      }\n    },\n    // Get the media title\n    getTitle: function getTitle(videoId) {\n      var _this2 = this;\n\n      var url = format(this.config.urls.youtube.api, videoId);\n      fetch(url).then(function (data) {\n        if (is$1.object(data)) {\n          var title = data.title,\n              height = data.height,\n              width = data.width; // Set title\n\n          _this2.config.title = title;\n          ui.setTitle.call(_this2); // Set aspect ratio\n\n          _this2.embed.ratio = [width, height];\n        }\n\n        setAspectRatio.call(_this2);\n      }).catch(function () {\n        // Set aspect ratio\n        setAspectRatio.call(_this2);\n      });\n    },\n    // API ready\n    ready: function ready() {\n      var player = this; // Ignore already setup (race condition)\n\n      var currentId = player.media && player.media.getAttribute('id');\n\n      if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {\n        return;\n      } // Get the source URL or ID\n\n\n      var source = player.media.getAttribute('src'); // Get from <div> if needed\n\n      if (is$1.empty(source)) {\n        source = player.media.getAttribute(this.config.attributes.embed.id);\n      } // Replace the <iframe> with a <div> due to YouTube API issues\n\n\n      var videoId = parseId$1(source);\n      var id = generateId(player.provider); // Get poster, if already set\n\n      var poster = player.poster; // Replace media element\n\n      var container = createElement('div', {\n        id: id,\n        poster: poster\n      });\n      player.media = replaceElement(container, player.media); // Id to poster wrapper\n\n      var posterSrc = function posterSrc(s) {\n        return \"https://i.ytimg.com/vi/\".concat(videoId, \"/\").concat(s, \"default.jpg\");\n      }; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)\n\n\n      loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded\n      .catch(function () {\n        return loadImage(posterSrc('sd'), 121);\n      }) // 480p padded 4:3\n      .catch(function () {\n        return loadImage(posterSrc('hq'));\n      }) // 360p padded 4:3. Always exists\n      .then(function (image) {\n        return ui.setPoster.call(player, image.src);\n      }).then(function (src) {\n        // If the image is padded, use background-size \"cover\" instead (like youtube does too with their posters)\n        if (!src.includes('maxres')) {\n          player.elements.poster.style.backgroundSize = 'cover';\n        }\n      }).catch(function () {});\n      var config = player.config.youtube; // Setup instance\n      // https://developers.google.com/youtube/iframe_api_reference\n\n      player.embed = new window.YT.Player(id, {\n        videoId: videoId,\n        host: getHost(config),\n        playerVars: extend({}, {\n          autoplay: player.config.autoplay ? 1 : 0,\n          // Autoplay\n          hl: player.config.hl,\n          // iframe interface language\n          controls: player.supported.ui ? 0 : 1,\n          // Only show controls if not fully supported\n          disablekb: 1,\n          // Disable keyboard as we handle it\n          playsinline: !player.config.fullscreen.iosNative ? 1 : 0,\n          // Allow iOS inline playback\n          // Captions are flaky on YouTube\n          cc_load_policy: player.captions.active ? 1 : 0,\n          cc_lang_pref: player.config.captions.language,\n          // Tracking for stats\n          widget_referrer: window ? window.location.href : null\n        }, config),\n        events: {\n          onError: function onError(event) {\n            // YouTube may fire onError twice, so only handle it once\n            if (!player.media.error) {\n              var code = event.data; // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError\n\n              var message = {\n                2: 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.',\n                5: 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.',\n                100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',\n                101: 'The owner of the requested video does not allow it to be played in embedded players.',\n                150: 'The owner of the requested video does not allow it to be played in embedded players.'\n              }[code] || 'An unknown error occured';\n              player.media.error = {\n                code: code,\n                message: message\n              };\n              triggerEvent.call(player, player.media, 'error');\n            }\n          },\n          onPlaybackRateChange: function onPlaybackRateChange(event) {\n            // Get the instance\n            var instance = event.target; // Get current speed\n\n            player.media.playbackRate = instance.getPlaybackRate();\n            triggerEvent.call(player, player.media, 'ratechange');\n          },\n          onReady: function onReady(event) {\n            // Bail if onReady has already been called. See issue #1108\n            if (is$1.function(player.media.play)) {\n              return;\n            } // Get the instance\n\n\n            var instance = event.target; // Get the title\n\n            youtube.getTitle.call(player, videoId); // Create a faux HTML5 API using the YouTube API\n\n            player.media.play = function () {\n              assurePlaybackState$1.call(player, true);\n              instance.playVideo();\n            };\n\n            player.media.pause = function () {\n              assurePlaybackState$1.call(player, false);\n              instance.pauseVideo();\n            };\n\n            player.media.stop = function () {\n              instance.stopVideo();\n            };\n\n            player.media.duration = instance.getDuration();\n            player.media.paused = true; // Seeking\n\n            player.media.currentTime = 0;\n            Object.defineProperty(player.media, 'currentTime', {\n              get: function get() {\n                return Number(instance.getCurrentTime());\n              },\n              set: function set(time) {\n                // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).\n                if (player.paused && !player.embed.hasPlayed) {\n                  player.embed.mute();\n                } // Set seeking state and trigger event\n\n\n                player.media.seeking = true;\n                triggerEvent.call(player, player.media, 'seeking'); // Seek after events sent\n\n                instance.seekTo(time);\n              }\n            }); // Playback speed\n\n            Object.defineProperty(player.media, 'playbackRate', {\n              get: function get() {\n                return instance.getPlaybackRate();\n              },\n              set: function set(input) {\n                instance.setPlaybackRate(input);\n              }\n            }); // Volume\n\n            var volume = player.config.volume;\n            Object.defineProperty(player.media, 'volume', {\n              get: function get() {\n                return volume;\n              },\n              set: function set(input) {\n                volume = input;\n                instance.setVolume(volume * 100);\n                triggerEvent.call(player, player.media, 'volumechange');\n              }\n            }); // Muted\n\n            var muted = player.config.muted;\n            Object.defineProperty(player.media, 'muted', {\n              get: function get() {\n                return muted;\n              },\n              set: function set(input) {\n                var toggle = is$1.boolean(input) ? input : muted;\n                muted = toggle;\n                instance[toggle ? 'mute' : 'unMute']();\n                triggerEvent.call(player, player.media, 'volumechange');\n              }\n            }); // Source\n\n            Object.defineProperty(player.media, 'currentSrc', {\n              get: function get() {\n                return instance.getVideoUrl();\n              }\n            }); // Ended\n\n            Object.defineProperty(player.media, 'ended', {\n              get: function get() {\n                return player.currentTime === player.duration;\n              }\n            }); // Get available speeds\n\n            player.options.speed = instance.getAvailablePlaybackRates(); // Set the tabindex to avoid focus entering iframe\n\n            if (player.supported.ui) {\n              player.media.setAttribute('tabindex', -1);\n            }\n\n            triggerEvent.call(player, player.media, 'timeupdate');\n            triggerEvent.call(player, player.media, 'durationchange'); // Reset timer\n\n            clearInterval(player.timers.buffering); // Setup buffering\n\n            player.timers.buffering = setInterval(function () {\n              // Get loaded % from YouTube\n              player.media.buffered = instance.getVideoLoadedFraction(); // Trigger progress only when we actually buffer something\n\n              if (player.media.lastBuffered === null || player.media.lastBuffered < player.media.buffered) {\n                triggerEvent.call(player, player.media, 'progress');\n              } // Set last buffer point\n\n\n              player.media.lastBuffered = player.media.buffered; // Bail if we're at 100%\n\n              if (player.media.buffered === 1) {\n                clearInterval(player.timers.buffering); // Trigger event\n\n                triggerEvent.call(player, player.media, 'canplaythrough');\n              }\n            }, 200); // Rebuild UI\n\n            setTimeout(function () {\n              return ui.build.call(player);\n            }, 50);\n          },\n          onStateChange: function onStateChange(event) {\n            // Get the instance\n            var instance = event.target; // Reset timer\n\n            clearInterval(player.timers.playing);\n            var seeked = player.media.seeking && [1, 2].includes(event.data);\n\n            if (seeked) {\n              // Unset seeking and fire seeked event\n              player.media.seeking = false;\n              triggerEvent.call(player, player.media, 'seeked');\n            } // Handle events\n            // -1   Unstarted\n            // 0    Ended\n            // 1    Playing\n            // 2    Paused\n            // 3    Buffering\n            // 5    Video cued\n\n\n            switch (event.data) {\n              case -1:\n                // Update scrubber\n                triggerEvent.call(player, player.media, 'timeupdate'); // Get loaded % from YouTube\n\n                player.media.buffered = instance.getVideoLoadedFraction();\n                triggerEvent.call(player, player.media, 'progress');\n                break;\n\n              case 0:\n                assurePlaybackState$1.call(player, false); // YouTube doesn't support loop for a single video, so mimick it.\n\n                if (player.media.loop) {\n                  // YouTube needs a call to `stopVideo` before playing again\n                  instance.stopVideo();\n                  instance.playVideo();\n                } else {\n                  triggerEvent.call(player, player.media, 'ended');\n                }\n\n                break;\n\n              case 1:\n                // Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)\n                if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {\n                  player.media.pause();\n                } else {\n                  assurePlaybackState$1.call(player, true);\n                  triggerEvent.call(player, player.media, 'playing'); // Poll to get playback progress\n\n                  player.timers.playing = setInterval(function () {\n                    triggerEvent.call(player, player.media, 'timeupdate');\n                  }, 50); // Check duration again due to YouTube bug\n                  // https://github.com/sampotts/plyr/issues/374\n                  // https://code.google.com/p/gdata-issues/issues/detail?id=8690\n\n                  if (player.media.duration !== instance.getDuration()) {\n                    player.media.duration = instance.getDuration();\n                    triggerEvent.call(player, player.media, 'durationchange');\n                  }\n                }\n\n                break;\n\n              case 2:\n                // Restore audio (YouTube starts playing on seek if the video hasn't been played yet)\n                if (!player.muted) {\n                  player.embed.unMute();\n                }\n\n                assurePlaybackState$1.call(player, false);\n                break;\n\n              default:\n                break;\n            }\n\n            triggerEvent.call(player, player.elements.container, 'statechange', false, {\n              code: event.data\n            });\n          }\n        }\n      });\n    }\n  };\n\n  // ==========================================================================\n  var media = {\n    // Setup media\n    setup: function setup() {\n      // If there's no media, bail\n      if (!this.media) {\n        this.debug.warn('No media element found!');\n        return;\n      } // Add type class\n\n\n      toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', this.type), true); // Add provider class\n\n      toggleClass(this.elements.container, this.config.classNames.provider.replace('{0}', this.provider), true); // Add video class for embeds\n      // This will require changes if audio embeds are added\n\n      if (this.isEmbed) {\n        toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', 'video'), true);\n      } // Inject the player wrapper\n\n\n      if (this.isVideo) {\n        // Create the wrapper div\n        this.elements.wrapper = createElement('div', {\n          class: this.config.classNames.video\n        }); // Wrap the video in a container\n\n        wrap(this.media, this.elements.wrapper); // Faux poster container\n\n        this.elements.poster = createElement('div', {\n          class: this.config.classNames.poster\n        });\n        this.elements.wrapper.appendChild(this.elements.poster);\n      }\n\n      if (this.isHTML5) {\n        html5.extend.call(this);\n      } else if (this.isYouTube) {\n        youtube.setup.call(this);\n      } else if (this.isVimeo) {\n        vimeo.setup.call(this);\n      }\n    }\n  };\n\n  var destroy = function destroy(instance) {\n    // Destroy our adsManager\n    if (instance.manager) {\n      instance.manager.destroy();\n    } // Destroy our adsManager\n\n\n    if (instance.elements.displayContainer) {\n      instance.elements.displayContainer.destroy();\n    }\n\n    instance.elements.container.remove();\n  };\n\n  var Ads =\n  /*#__PURE__*/\n  function () {\n    /**\n     * Ads constructor.\n     * @param {Object} player\n     * @return {Ads}\n     */\n    function Ads(player) {\n      var _this = this;\n\n      _classCallCheck(this, Ads);\n\n      this.player = player;\n      this.config = player.config.ads;\n      this.playing = false;\n      this.initialized = false;\n      this.elements = {\n        container: null,\n        displayContainer: null\n      };\n      this.manager = null;\n      this.loader = null;\n      this.cuePoints = null;\n      this.events = {};\n      this.safetyTimer = null;\n      this.countdownTimer = null; // Setup a promise to resolve when the IMA manager is ready\n\n      this.managerPromise = new Promise(function (resolve, reject) {\n        // The ad is loaded and ready\n        _this.on('loaded', resolve); // Ads failed\n\n\n        _this.on('error', reject);\n      });\n      this.load();\n    }\n\n    _createClass(Ads, [{\n      key: \"load\",\n\n      /**\n       * Load the IMA SDK\n       */\n      value: function load() {\n        var _this2 = this;\n\n        if (!this.enabled) {\n          return;\n        } // Check if the Google IMA3 SDK is loaded or load it ourselves\n\n\n        if (!is$1.object(window.google) || !is$1.object(window.google.ima)) {\n          loadScript(this.player.config.urls.googleIMA.sdk).then(function () {\n            _this2.ready();\n          }).catch(function () {\n            // Script failed to load or is blocked\n            _this2.trigger('error', new Error('Google IMA SDK failed to load'));\n          });\n        } else {\n          this.ready();\n        }\n      }\n      /**\n       * Get the ads instance ready\n       */\n\n    }, {\n      key: \"ready\",\n      value: function ready() {\n        var _this3 = this;\n\n        // Double check we're enabled\n        if (!this.enabled) {\n          destroy(this);\n        } // Start ticking our safety timer. If the whole advertisement\n        // thing doesn't resolve within our set time; we bail\n\n\n        this.startSafetyTimer(12000, 'ready()'); // Clear the safety timer\n\n        this.managerPromise.then(function () {\n          _this3.clearSafetyTimer('onAdsManagerLoaded()');\n        }); // Set listeners on the Plyr instance\n\n        this.listeners(); // Setup the IMA SDK\n\n        this.setupIMA();\n      } // Build the tag URL\n\n    }, {\n      key: \"setupIMA\",\n\n      /**\n       * In order for the SDK to display ads for our video, we need to tell it where to put them,\n       * so here we define our ad container. This div is set up to render on top of the video player.\n       * Using the code below, we tell the SDK to render ads within that div. We also provide a\n       * handle to the content video player - the SDK will poll the current time of our player to\n       * properly place mid-rolls. After we create the ad display container, we initialize it. On\n       * mobile devices, this initialization is done as the result of a user action.\n       */\n      value: function setupIMA() {\n        // Create the container for our advertisements\n        this.elements.container = createElement('div', {\n          class: this.player.config.classNames.ads\n        });\n        this.player.elements.container.appendChild(this.elements.container); // So we can run VPAID2\n\n        google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED); // Set language\n\n        google.ima.settings.setLocale(this.player.config.ads.language); // Set playback for iOS10+\n\n        google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline); // We assume the adContainer is the video container of the plyr element that will house the ads\n\n        this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media); // Request video ads to be pre-loaded\n\n        this.requestAds();\n      }\n      /**\n       * Request advertisements\n       */\n\n    }, {\n      key: \"requestAds\",\n      value: function requestAds() {\n        var _this4 = this;\n\n        var container = this.player.elements.container;\n\n        try {\n          // Create ads loader\n          this.loader = new google.ima.AdsLoader(this.elements.displayContainer); // Listen and respond to ads loaded and error events\n\n          this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, function (event) {\n            return _this4.onAdsManagerLoaded(event);\n          }, false);\n          this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {\n            return _this4.onAdError(error);\n          }, false); // Request video ads\n\n          var request = new google.ima.AdsRequest();\n          request.adTagUrl = this.tagUrl; // Specify the linear and nonlinear slot sizes. This helps the SDK\n          // to select the correct creative if multiple are returned\n\n          request.linearAdSlotWidth = container.offsetWidth;\n          request.linearAdSlotHeight = container.offsetHeight;\n          request.nonLinearAdSlotWidth = container.offsetWidth;\n          request.nonLinearAdSlotHeight = container.offsetHeight; // We only overlay ads as we only support video.\n\n          request.forceNonLinearFullSlot = false; // Mute based on current state\n\n          request.setAdWillPlayMuted(!this.player.muted);\n          this.loader.requestAds(request);\n        } catch (e) {\n          this.onAdError(e);\n        }\n      }\n      /**\n       * Update the ad countdown\n       * @param {Boolean} start\n       */\n\n    }, {\n      key: \"pollCountdown\",\n      value: function pollCountdown() {\n        var _this5 = this;\n\n        var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n        if (!start) {\n          clearInterval(this.countdownTimer);\n          this.elements.container.removeAttribute('data-badge-text');\n          return;\n        }\n\n        var update = function update() {\n          var time = formatTime(Math.max(_this5.manager.getRemainingTime(), 0));\n          var label = \"\".concat(i18n.get('advertisement', _this5.player.config), \" - \").concat(time);\n\n          _this5.elements.container.setAttribute('data-badge-text', label);\n        };\n\n        this.countdownTimer = setInterval(update, 100);\n      }\n      /**\n       * This method is called whenever the ads are ready inside the AdDisplayContainer\n       * @param {Event} adsManagerLoadedEvent\n       */\n\n    }, {\n      key: \"onAdsManagerLoaded\",\n      value: function onAdsManagerLoaded(event) {\n        var _this6 = this;\n\n        // Load could occur after a source change (race condition)\n        if (!this.enabled) {\n          return;\n        } // Get the ads manager\n\n\n        var settings = new google.ima.AdsRenderingSettings(); // Tell the SDK to save and restore content video state on our behalf\n\n        settings.restoreCustomPlaybackStateOnAdBreakComplete = true;\n        settings.enablePreloading = true; // The SDK is polling currentTime on the contentPlayback. And needs a duration\n        // so it can determine when to start the mid- and post-roll\n\n        this.manager = event.getAdsManager(this.player, settings); // Get the cue points for any mid-rolls by filtering out the pre- and post-roll\n\n        this.cuePoints = this.manager.getCuePoints(); // Add listeners to the required events\n        // Advertisement error events\n\n        this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {\n          return _this6.onAdError(error);\n        }); // Advertisement regular events\n\n        Object.keys(google.ima.AdEvent.Type).forEach(function (type) {\n          _this6.manager.addEventListener(google.ima.AdEvent.Type[type], function (e) {\n            return _this6.onAdEvent(e);\n          });\n        }); // Resolve our adsManager\n\n        this.trigger('loaded');\n      }\n    }, {\n      key: \"addCuePoints\",\n      value: function addCuePoints() {\n        var _this7 = this;\n\n        // Add advertisement cue's within the time line if available\n        if (!is$1.empty(this.cuePoints)) {\n          this.cuePoints.forEach(function (cuePoint) {\n            if (cuePoint !== 0 && cuePoint !== -1 && cuePoint < _this7.player.duration) {\n              var seekElement = _this7.player.elements.progress;\n\n              if (is$1.element(seekElement)) {\n                var cuePercentage = 100 / _this7.player.duration * cuePoint;\n                var cue = createElement('span', {\n                  class: _this7.player.config.classNames.cues\n                });\n                cue.style.left = \"\".concat(cuePercentage.toString(), \"%\");\n                seekElement.appendChild(cue);\n              }\n            }\n          });\n        }\n      }\n      /**\n       * This is where all the event handling takes place. Retrieve the ad from the event. Some\n       * events (e.g. ALL_ADS_COMPLETED) don't have the ad object associated\n       * https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type\n       * @param {Event} event\n       */\n\n    }, {\n      key: \"onAdEvent\",\n      value: function onAdEvent(event) {\n        var _this8 = this;\n\n        var container = this.player.elements.container; // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)\n        // don't have ad object associated\n\n        var ad = event.getAd();\n        var adData = event.getAdData(); // Proxy event\n\n        var dispatchEvent = function dispatchEvent(type) {\n          triggerEvent.call(_this8.player, _this8.player.media, \"ads\".concat(type.replace(/_/g, '').toLowerCase()));\n        }; // Bubble the event\n\n\n        dispatchEvent(event.type);\n\n        switch (event.type) {\n          case google.ima.AdEvent.Type.LOADED:\n            // This is the first event sent for an ad - it is possible to determine whether the\n            // ad is a video ad or an overlay\n            this.trigger('loaded'); // Start countdown\n\n            this.pollCountdown(true);\n\n            if (!ad.isLinear()) {\n              // Position AdDisplayContainer correctly for overlay\n              ad.width = container.offsetWidth;\n              ad.height = container.offsetHeight;\n            } // console.info('Ad type: ' + event.getAd().getAdPodInfo().getPodIndex());\n            // console.info('Ad time: ' + event.getAd().getAdPodInfo().getTimeOffset());\n\n\n            break;\n\n          case google.ima.AdEvent.Type.STARTED:\n            // Set volume to match player\n            this.manager.setVolume(this.player.volume);\n            break;\n\n          case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:\n            // All ads for the current videos are done. We can now request new advertisements\n            // in case the video is re-played\n            // TODO: Example for what happens when a next video in a playlist would be loaded.\n            // So here we load a new video when all ads are done.\n            // Then we load new ads within a new adsManager. When the video\n            // Is started - after - the ads are loaded, then we get ads.\n            // You can also easily test cancelling and reloading by running\n            // player.ads.cancel() and player.ads.play from the console I guess.\n            // this.player.source = {\n            //     type: 'video',\n            //     title: 'View From A Blue Moon',\n            //     sources: [{\n            //         src:\n            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', type:\n            // 'video/mp4', }], poster:\n            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', tracks:\n            // [ { kind: 'captions', label: 'English', srclang: 'en', src:\n            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',\n            // default: true, }, { kind: 'captions', label: 'French', srclang: 'fr', src:\n            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt', }, ],\n            // };\n            // TODO: So there is still this thing where a video should only be allowed to start\n            // playing when the IMA SDK is ready or has failed\n            this.loadAds();\n            break;\n\n          case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:\n            // This event indicates the ad has started - the video player can adjust the UI,\n            // for example display a pause button and remaining time. Fired when content should\n            // be paused. This usually happens right before an ad is about to cover the content\n            this.pauseContent();\n            break;\n\n          case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:\n            // This event indicates the ad has finished - the video player can perform\n            // appropriate UI actions, such as removing the timer for remaining time detection.\n            // Fired when content should be resumed. This usually happens when an ad finishes\n            // or collapses\n            this.pollCountdown();\n            this.resumeContent();\n            break;\n\n          case google.ima.AdEvent.Type.LOG:\n            if (adData.adError) {\n              this.player.debug.warn(\"Non-fatal ad error: \".concat(adData.adError.getMessage()));\n            }\n\n            break;\n\n          default:\n            break;\n        }\n      }\n      /**\n       * Any ad error handling comes through here\n       * @param {Event} event\n       */\n\n    }, {\n      key: \"onAdError\",\n      value: function onAdError(event) {\n        this.cancel();\n        this.player.debug.warn('Ads error', event);\n      }\n      /**\n       * Setup hooks for Plyr and window events. This ensures\n       * the mid- and post-roll launch at the correct time. And\n       * resize the advertisement when the player resizes\n       */\n\n    }, {\n      key: \"listeners\",\n      value: function listeners() {\n        var _this9 = this;\n\n        var container = this.player.elements.container;\n        var time;\n        this.player.on('canplay', function () {\n          _this9.addCuePoints();\n        });\n        this.player.on('ended', function () {\n          _this9.loader.contentComplete();\n        });\n        this.player.on('timeupdate', function () {\n          time = _this9.player.currentTime;\n        });\n        this.player.on('seeked', function () {\n          var seekedTime = _this9.player.currentTime;\n\n          if (is$1.empty(_this9.cuePoints)) {\n            return;\n          }\n\n          _this9.cuePoints.forEach(function (cuePoint, index) {\n            if (time < cuePoint && cuePoint < seekedTime) {\n              _this9.manager.discardAdBreak();\n\n              _this9.cuePoints.splice(index, 1);\n            }\n          });\n        }); // Listen to the resizing of the window. And resize ad accordingly\n        // TODO: eventually implement ResizeObserver\n\n        window.addEventListener('resize', function () {\n          if (_this9.manager) {\n            _this9.manager.resize(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);\n          }\n        });\n      }\n      /**\n       * Initialize the adsManager and start playing advertisements\n       */\n\n    }, {\n      key: \"play\",\n      value: function play() {\n        var _this10 = this;\n\n        var container = this.player.elements.container;\n\n        if (!this.managerPromise) {\n          this.resumeContent();\n        } // Play the requested advertisement whenever the adsManager is ready\n\n\n        this.managerPromise.then(function () {\n          // Set volume to match player\n          _this10.manager.setVolume(_this10.player.volume); // Initialize the container. Must be done via a user action on mobile devices\n\n\n          _this10.elements.displayContainer.initialize();\n\n          try {\n            if (!_this10.initialized) {\n              // Initialize the ads manager. Ad rules playlist will start at this time\n              _this10.manager.init(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will\n              // start at this time; the call will be ignored for ad rules\n\n\n              _this10.manager.start();\n            }\n\n            _this10.initialized = true;\n          } catch (adError) {\n            // An error may be thrown if there was a problem with the\n            // VAST response\n            _this10.onAdError(adError);\n          }\n        }).catch(function () {});\n      }\n      /**\n       * Resume our video\n       */\n\n    }, {\n      key: \"resumeContent\",\n      value: function resumeContent() {\n        // Hide the advertisement container\n        this.elements.container.style.zIndex = ''; // Ad is stopped\n\n        this.playing = false; // Play video\n\n        this.player.media.play();\n      }\n      /**\n       * Pause our video\n       */\n\n    }, {\n      key: \"pauseContent\",\n      value: function pauseContent() {\n        // Show the advertisement container\n        this.elements.container.style.zIndex = 3; // Ad is playing\n\n        this.playing = true; // Pause our video.\n\n        this.player.media.pause();\n      }\n      /**\n       * Destroy the adsManager so we can grab new ads after this. If we don't then we're not\n       * allowed to call new ads based on google policies, as they interpret this as an accidental\n       * video requests. https://developers.google.com/interactive-\n       * media-ads/docs/sdks/android/faq#8\n       */\n\n    }, {\n      key: \"cancel\",\n      value: function cancel() {\n        // Pause our video\n        if (this.initialized) {\n          this.resumeContent();\n        } // Tell our instance that we're done for now\n\n\n        this.trigger('error'); // Re-create our adsManager\n\n        this.loadAds();\n      }\n      /**\n       * Re-create our adsManager\n       */\n\n    }, {\n      key: \"loadAds\",\n      value: function loadAds() {\n        var _this11 = this;\n\n        // Tell our adsManager to go bye bye\n        this.managerPromise.then(function () {\n          // Destroy our adsManager\n          if (_this11.manager) {\n            _this11.manager.destroy();\n          } // Re-set our adsManager promises\n\n\n          _this11.managerPromise = new Promise(function (resolve) {\n            _this11.on('loaded', resolve);\n\n            _this11.player.debug.log(_this11.manager);\n          }); // Now request some new advertisements\n\n          _this11.requestAds();\n        }).catch(function () {});\n      }\n      /**\n       * Handles callbacks after an ad event was invoked\n       * @param {String} event - Event type\n       */\n\n    }, {\n      key: \"trigger\",\n      value: function trigger(event) {\n        var _this12 = this;\n\n        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n          args[_key - 1] = arguments[_key];\n        }\n\n        var handlers = this.events[event];\n\n        if (is$1.array(handlers)) {\n          handlers.forEach(function (handler) {\n            if (is$1.function(handler)) {\n              handler.apply(_this12, args);\n            }\n          });\n        }\n      }\n      /**\n       * Add event listeners\n       * @param {String} event - Event type\n       * @param {Function} callback - Callback for when event occurs\n       * @return {Ads}\n       */\n\n    }, {\n      key: \"on\",\n      value: function on(event, callback) {\n        if (!is$1.array(this.events[event])) {\n          this.events[event] = [];\n        }\n\n        this.events[event].push(callback);\n        return this;\n      }\n      /**\n       * Setup a safety timer for when the ad network doesn't respond for whatever reason.\n       * The advertisement has 12 seconds to get its things together. We stop this timer when the\n       * advertisement is playing, or when a user action is required to start, then we clear the\n       * timer on ad ready\n       * @param {Number} time\n       * @param {String} from\n       */\n\n    }, {\n      key: \"startSafetyTimer\",\n      value: function startSafetyTimer(time, from) {\n        var _this13 = this;\n\n        this.player.debug.log(\"Safety timer invoked from: \".concat(from));\n        this.safetyTimer = setTimeout(function () {\n          _this13.cancel();\n\n          _this13.clearSafetyTimer('startSafetyTimer()');\n        }, time);\n      }\n      /**\n       * Clear our safety timer(s)\n       * @param {String} from\n       */\n\n    }, {\n      key: \"clearSafetyTimer\",\n      value: function clearSafetyTimer(from) {\n        if (!is$1.nullOrUndefined(this.safetyTimer)) {\n          this.player.debug.log(\"Safety timer cleared from: \".concat(from));\n          clearTimeout(this.safetyTimer);\n          this.safetyTimer = null;\n        }\n      }\n    }, {\n      key: \"enabled\",\n      get: function get() {\n        var config = this.config;\n        return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is$1.empty(config.publisherId) || is$1.url(config.tagUrl));\n      }\n    }, {\n      key: \"tagUrl\",\n      get: function get() {\n        var config = this.config;\n\n        if (is$1.url(config.tagUrl)) {\n          return config.tagUrl;\n        }\n\n        var params = {\n          AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',\n          AV_CHANNELID: '5a0458dc28a06145e4519d21',\n          AV_URL: window.location.hostname,\n          cb: Date.now(),\n          AV_WIDTH: 640,\n          AV_HEIGHT: 480,\n          AV_CDIM2: this.publisherId\n        };\n        var base = 'https://go.aniview.com/api/adserver6/vast/';\n        return \"\".concat(base, \"?\").concat(buildUrlParams(params));\n      }\n    }]);\n\n    return Ads;\n  }();\n\n  var parseVtt = function parseVtt(vttDataString) {\n    var processedList = [];\n    var frames = vttDataString.split(/\\r\\n\\r\\n|\\n\\n|\\r\\r/);\n    frames.forEach(function (frame) {\n      var result = {};\n      var lines = frame.split(/\\r\\n|\\n|\\r/);\n      lines.forEach(function (line) {\n        if (!is$1.number(result.startTime)) {\n          // The line with start and end times on it is the first line of interest\n          var matchTimes = line.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/); // Note that this currently ignores caption formatting directives that are optionally on the end of this line - fine for non-captions VTT\n\n          if (matchTimes) {\n            result.startTime = Number(matchTimes[1] || 0) * 60 * 60 + Number(matchTimes[2]) * 60 + Number(matchTimes[3]) + Number(\"0.\".concat(matchTimes[4]));\n            result.endTime = Number(matchTimes[6] || 0) * 60 * 60 + Number(matchTimes[7]) * 60 + Number(matchTimes[8]) + Number(\"0.\".concat(matchTimes[9]));\n          }\n        } else if (!is$1.empty(line.trim()) && is$1.empty(result.text)) {\n          // If we already have the startTime, then we're definitely up to the text line(s)\n          var lineSplit = line.trim().split('#xywh=');\n\n          var _lineSplit = _slicedToArray(lineSplit, 1);\n\n          result.text = _lineSplit[0];\n\n          // If there's content in lineSplit[1], then we have sprites. If not, then it's just one frame per image\n          if (lineSplit[1]) {\n            var _lineSplit$1$split = lineSplit[1].split(',');\n\n            var _lineSplit$1$split2 = _slicedToArray(_lineSplit$1$split, 4);\n\n            result.x = _lineSplit$1$split2[0];\n            result.y = _lineSplit$1$split2[1];\n            result.w = _lineSplit$1$split2[2];\n            result.h = _lineSplit$1$split2[3];\n          }\n        }\n      });\n\n      if (result.text) {\n        processedList.push(result);\n      }\n    });\n    return processedList;\n  };\n  /**\n   * Preview thumbnails for seek hover and scrubbing\n   * Seeking: Hover over the seek bar (desktop only): shows a small preview container above the seek bar\n   * Scrubbing: Click and drag the seek bar (desktop and mobile): shows the preview image over the entire video, as if the video is scrubbing at very high speed\n   *\n   * Notes:\n   * - Thumbs are set via JS settings on Plyr init, not HTML5 'track' property. Using the track property would be a bit gross, because it doesn't support custom 'kinds'. kind=metadata might be used for something else, and we want to allow multiple thumbnails tracks. Tracks must have a unique combination of 'kind' and 'label'. We would have to do something like kind=metadata,label=thumbnails1 / kind=metadata,label=thumbnails2. Square peg, round hole\n   * - VTT info: the image URL is relative to the VTT, not the current document. But if the url starts with a slash, it will naturally be relative to the current domain. https://support.jwplayer.com/articles/how-to-add-preview-thumbnails\n   * - This implementation uses multiple separate img elements. Other implementations use background-image on one element. This would be nice and simple, but Firefox and Safari have flickering issues with replacing backgrounds of larger images. It seems that YouTube perhaps only avoids this because they don't have the option for high-res previews (even the fullscreen ones, when mousedown/seeking). Images appear over the top of each other, and previous ones are discarded once the new ones have been rendered\n   */\n\n\n  var PreviewThumbnails =\n  /*#__PURE__*/\n  function () {\n    /**\n     * PreviewThumbnails constructor.\n     * @param {Plyr} player\n     * @return {PreviewThumbnails}\n     */\n    function PreviewThumbnails(player) {\n      _classCallCheck(this, PreviewThumbnails);\n\n      this.player = player;\n      this.thumbnails = [];\n      this.loaded = false;\n      this.lastMouseMoveTime = Date.now();\n      this.mouseDown = false;\n      this.loadedImages = [];\n      this.elements = {\n        thumb: {},\n        scrubbing: {}\n      };\n      this.load();\n    }\n\n    _createClass(PreviewThumbnails, [{\n      key: \"load\",\n      value: function load() {\n        var _this = this;\n\n        // Togglethe regular seek tooltip\n        if (this.player.elements.display.seekTooltip) {\n          this.player.elements.display.seekTooltip.hidden = this.enabled;\n        }\n\n        if (!this.enabled) {\n          return;\n        }\n\n        this.getThumbnails().then(function () {\n          if (!_this.enabled) {\n            return;\n          } // Render DOM elements\n\n\n          _this.render(); // Check to see if thumb container size was specified manually in CSS\n\n\n          _this.determineContainerAutoSizing();\n\n          _this.loaded = true;\n        });\n      } // Download VTT files and parse them\n\n    }, {\n      key: \"getThumbnails\",\n      value: function getThumbnails() {\n        var _this2 = this;\n\n        return new Promise(function (resolve) {\n          var src = _this2.player.config.previewThumbnails.src;\n\n          if (is$1.empty(src)) {\n            throw new Error('Missing previewThumbnails.src config attribute');\n          } // If string, convert into single-element list\n\n\n          var urls = is$1.string(src) ? [src] : src; // Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails\n\n          var promises = urls.map(function (u) {\n            return _this2.getThumbnail(u);\n          });\n          Promise.all(promises).then(function () {\n            // Sort smallest to biggest (e.g., [120p, 480p, 1080p])\n            _this2.thumbnails.sort(function (x, y) {\n              return x.height - y.height;\n            });\n\n            _this2.player.debug.log('Preview thumbnails', _this2.thumbnails);\n\n            resolve();\n          });\n        });\n      } // Process individual VTT file\n\n    }, {\n      key: \"getThumbnail\",\n      value: function getThumbnail(url) {\n        var _this3 = this;\n\n        return new Promise(function (resolve) {\n          fetch(url).then(function (response) {\n            var thumbnail = {\n              frames: parseVtt(response),\n              height: null,\n              urlPrefix: ''\n            }; // If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file\n            // If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank\n            // If the thumbnail URLs start with with none of '/', 'http://' or 'https://', then we need to set their relative path to be the location of the VTT file\n\n            if (!thumbnail.frames[0].text.startsWith('/') && !thumbnail.frames[0].text.startsWith('http://') && !thumbnail.frames[0].text.startsWith('https://')) {\n              thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);\n            } // Download the first frame, so that we can determine/set the height of this thumbnailsDef\n\n\n            var tempImage = new Image();\n\n            tempImage.onload = function () {\n              thumbnail.height = tempImage.naturalHeight;\n              thumbnail.width = tempImage.naturalWidth;\n\n              _this3.thumbnails.push(thumbnail);\n\n              resolve();\n            };\n\n            tempImage.src = thumbnail.urlPrefix + thumbnail.frames[0].text;\n          });\n        });\n      }\n    }, {\n      key: \"startMove\",\n      value: function startMove(event) {\n        if (!this.loaded) {\n          return;\n        }\n\n        if (!is$1.event(event) || !['touchmove', 'mousemove'].includes(event.type)) {\n          return;\n        } // Wait until media has a duration\n\n\n        if (!this.player.media.duration) {\n          return;\n        }\n\n        if (event.type === 'touchmove') {\n          // Calculate seek hover position as approx video seconds\n          this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);\n        } else {\n          // Calculate seek hover position as approx video seconds\n          var clientRect = this.player.elements.progress.getBoundingClientRect();\n          var percentage = 100 / clientRect.width * (event.pageX - clientRect.left);\n          this.seekTime = this.player.media.duration * (percentage / 100);\n\n          if (this.seekTime < 0) {\n            // The mousemove fires for 10+px out to the left\n            this.seekTime = 0;\n          }\n\n          if (this.seekTime > this.player.media.duration - 1) {\n            // Took 1 second off the duration for safety, because different players can disagree on the real duration of a video\n            this.seekTime = this.player.media.duration - 1;\n          }\n\n          this.mousePosX = event.pageX; // Set time text inside image container\n\n          this.elements.thumb.time.innerText = formatTime(this.seekTime);\n        } // Download and show image\n\n\n        this.showImageAtCurrentTime();\n      }\n    }, {\n      key: \"endMove\",\n      value: function endMove() {\n        this.toggleThumbContainer(false, true);\n      }\n    }, {\n      key: \"startScrubbing\",\n      value: function startScrubbing(event) {\n        // Only act on left mouse button (0), or touch device (event.button is false)\n        if (event.button === false || event.button === 0) {\n          this.mouseDown = true; // Wait until media has a duration\n\n          if (this.player.media.duration) {\n            this.toggleScrubbingContainer(true);\n            this.toggleThumbContainer(false, true); // Download and show image\n\n            this.showImageAtCurrentTime();\n          }\n        }\n      }\n    }, {\n      key: \"endScrubbing\",\n      value: function endScrubbing() {\n        var _this4 = this;\n\n        this.mouseDown = false; // Hide scrubbing preview. But wait until the video has successfully seeked before hiding the scrubbing preview\n\n        if (Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime)) {\n          // The video was already seeked/loaded at the chosen time - hide immediately\n          this.toggleScrubbingContainer(false);\n        } else {\n          // The video hasn't seeked yet. Wait for that\n          once.call(this.player, this.player.media, 'timeupdate', function () {\n            // Re-check mousedown - we might have already started scrubbing again\n            if (!_this4.mouseDown) {\n              _this4.toggleScrubbingContainer(false);\n            }\n          });\n        }\n      }\n      /**\n       * Setup hooks for Plyr and window events\n       */\n\n    }, {\n      key: \"listeners\",\n      value: function listeners() {\n        var _this5 = this;\n\n        // Hide thumbnail preview - on mouse click, mouse leave (in listeners.js for now), and video play/seek. All four are required, e.g., for buffering\n        this.player.on('play', function () {\n          _this5.toggleThumbContainer(false, true);\n        });\n        this.player.on('seeked', function () {\n          _this5.toggleThumbContainer(false);\n        });\n        this.player.on('timeupdate', function () {\n          _this5.lastTime = _this5.player.media.currentTime;\n        });\n      }\n      /**\n       * Create HTML elements for image containers\n       */\n\n    }, {\n      key: \"render\",\n      value: function render() {\n        // Create HTML element: plyr__preview-thumbnail-container\n        this.elements.thumb.container = createElement('div', {\n          class: this.player.config.classNames.previewThumbnails.thumbContainer\n        }); // Wrapper for the image for styling\n\n        this.elements.thumb.imageContainer = createElement('div', {\n          class: this.player.config.classNames.previewThumbnails.imageContainer\n        });\n        this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer); // Create HTML element, parent+span: time text (e.g., 01:32:00)\n\n        var timeContainer = createElement('div', {\n          class: this.player.config.classNames.previewThumbnails.timeContainer\n        });\n        this.elements.thumb.time = createElement('span', {}, '00:00');\n        timeContainer.appendChild(this.elements.thumb.time);\n        this.elements.thumb.container.appendChild(timeContainer); // Inject the whole thumb\n\n        if (is$1.element(this.player.elements.progress)) {\n          this.player.elements.progress.appendChild(this.elements.thumb.container);\n        } // Create HTML element: plyr__preview-scrubbing-container\n\n\n        this.elements.scrubbing.container = createElement('div', {\n          class: this.player.config.classNames.previewThumbnails.scrubbingContainer\n        });\n        this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);\n      }\n    }, {\n      key: \"showImageAtCurrentTime\",\n      value: function showImageAtCurrentTime() {\n        var _this6 = this;\n\n        if (this.mouseDown) {\n          this.setScrubbingContainerSize();\n        } else {\n          this.setThumbContainerSizeAndPos();\n        } // Find the desired thumbnail index\n        // TODO: Handle a video longer than the thumbs where thumbNum is null\n\n\n        var thumbNum = this.thumbnails[0].frames.findIndex(function (frame) {\n          return _this6.seekTime >= frame.startTime && _this6.seekTime <= frame.endTime;\n        });\n        var hasThumb = thumbNum >= 0;\n        var qualityIndex = 0; // Show the thumb container if we're not scrubbing\n\n        if (!this.mouseDown) {\n          this.toggleThumbContainer(hasThumb);\n        } // No matching thumb found\n\n\n        if (!hasThumb) {\n          return;\n        } // Check to see if we've already downloaded higher quality versions of this image\n\n\n        this.thumbnails.forEach(function (thumbnail, index) {\n          if (_this6.loadedImages.includes(thumbnail.frames[thumbNum].text)) {\n            qualityIndex = index;\n          }\n        }); // Only proceed if either thumbnum or thumbfilename has changed\n\n        if (thumbNum !== this.showingThumb) {\n          this.showingThumb = thumbNum;\n          this.loadImage(qualityIndex);\n        }\n      } // Show the image that's currently specified in this.showingThumb\n\n    }, {\n      key: \"loadImage\",\n      value: function loadImage() {\n        var _this7 = this;\n\n        var qualityIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n        var thumbNum = this.showingThumb;\n        var thumbnail = this.thumbnails[qualityIndex];\n        var urlPrefix = thumbnail.urlPrefix;\n        var frame = thumbnail.frames[thumbNum];\n        var thumbFilename = thumbnail.frames[thumbNum].text;\n        var thumbUrl = urlPrefix + thumbFilename;\n\n        if (!this.currentImageElement || this.currentImageElement.dataset.filename !== thumbFilename) {\n          // If we're already loading a previous image, remove its onload handler - we don't want it to load after this one\n          // Only do this if not using sprites. Without sprites we really want to show as many images as possible, as a best-effort\n          if (this.loadingImage && this.usingSprites) {\n            this.loadingImage.onload = null;\n          } // We're building and adding a new image. In other implementations of similar functionality (YouTube), background image\n          // is instead used. But this causes issues with larger images in Firefox and Safari - switching between background\n          // images causes a flicker. Putting a new image over the top does not\n\n\n          var previewImage = new Image();\n          previewImage.src = thumbUrl;\n          previewImage.dataset.index = thumbNum;\n          previewImage.dataset.filename = thumbFilename;\n          this.showingThumbFilename = thumbFilename;\n          this.player.debug.log(\"Loading image: \".concat(thumbUrl)); // For some reason, passing the named function directly causes it to execute immediately. So I've wrapped it in an anonymous function...\n\n          previewImage.onload = function () {\n            return _this7.showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, true);\n          };\n\n          this.loadingImage = previewImage;\n          this.removeOldImages(previewImage);\n        } else {\n          // Update the existing image\n          this.showImage(this.currentImageElement, frame, qualityIndex, thumbNum, thumbFilename, false);\n          this.currentImageElement.dataset.index = thumbNum;\n          this.removeOldImages(this.currentImageElement);\n        }\n      }\n    }, {\n      key: \"showImage\",\n      value: function showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename) {\n        var newImage = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;\n        this.player.debug.log(\"Showing thumb: \".concat(thumbFilename, \". num: \").concat(thumbNum, \". qual: \").concat(qualityIndex, \". newimg: \").concat(newImage));\n        this.setImageSizeAndOffset(previewImage, frame);\n\n        if (newImage) {\n          this.currentImageContainer.appendChild(previewImage);\n          this.currentImageElement = previewImage;\n\n          if (!this.loadedImages.includes(thumbFilename)) {\n            this.loadedImages.push(thumbFilename);\n          }\n        } // Preload images before and after the current one\n        // Show higher quality of the same frame\n        // Each step here has a short time delay, and only continues if still hovering/seeking the same spot. This is to protect slow connections from overloading\n\n\n        this.preloadNearby(thumbNum, true).then(this.preloadNearby(thumbNum, false)).then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));\n      } // Remove all preview images that aren't the designated current image\n\n    }, {\n      key: \"removeOldImages\",\n      value: function removeOldImages(currentImage) {\n        var _this8 = this;\n\n        // Get a list of all images, convert it from a DOM list to an array\n        Array.from(this.currentImageContainer.children).forEach(function (image) {\n          if (image.tagName.toLowerCase() !== 'img') {\n            return;\n          }\n\n          var removeDelay = _this8.usingSprites ? 500 : 1000;\n\n          if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {\n            // Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients\n            // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function\n            // eslint-disable-next-line no-param-reassign\n            image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub\n\n            var currentImageContainer = _this8.currentImageContainer;\n            setTimeout(function () {\n              currentImageContainer.removeChild(image);\n\n              _this8.player.debug.log(\"Removing thumb: \".concat(image.dataset.filename));\n            }, removeDelay);\n          }\n        });\n      } // Preload images before and after the current one. Only if the user is still hovering/seeking the same frame\n      // This will only preload the lowest quality\n\n    }, {\n      key: \"preloadNearby\",\n      value: function preloadNearby(thumbNum) {\n        var _this9 = this;\n\n        var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n        return new Promise(function (resolve) {\n          setTimeout(function () {\n            var oldThumbFilename = _this9.thumbnails[0].frames[thumbNum].text;\n\n            if (_this9.showingThumbFilename === oldThumbFilename) {\n              // Find the nearest thumbs with different filenames. Sometimes it'll be the next index, but in the case of sprites, it might be 100+ away\n              var thumbnailsClone;\n\n              if (forward) {\n                thumbnailsClone = _this9.thumbnails[0].frames.slice(thumbNum);\n              } else {\n                thumbnailsClone = _this9.thumbnails[0].frames.slice(0, thumbNum).reverse();\n              }\n\n              var foundOne = false;\n              thumbnailsClone.forEach(function (frame) {\n                var newThumbFilename = frame.text;\n\n                if (newThumbFilename !== oldThumbFilename) {\n                  // Found one with a different filename. Make sure it hasn't already been loaded on this page visit\n                  if (!_this9.loadedImages.includes(newThumbFilename)) {\n                    foundOne = true;\n\n                    _this9.player.debug.log(\"Preloading thumb filename: \".concat(newThumbFilename));\n\n                    var urlPrefix = _this9.thumbnails[0].urlPrefix;\n                    var thumbURL = urlPrefix + newThumbFilename;\n                    var previewImage = new Image();\n                    previewImage.src = thumbURL;\n\n                    previewImage.onload = function () {\n                      _this9.player.debug.log(\"Preloaded thumb filename: \".concat(newThumbFilename));\n\n                      if (!_this9.loadedImages.includes(newThumbFilename)) _this9.loadedImages.push(newThumbFilename); // We don't resolve until the thumb is loaded\n\n                      resolve();\n                    };\n                  }\n                }\n              }); // If there are none to preload then we want to resolve immediately\n\n              if (!foundOne) {\n                resolve();\n              }\n            }\n          }, 300);\n        });\n      } // If user has been hovering current image for half a second, look for a higher quality one\n\n    }, {\n      key: \"getHigherQuality\",\n      value: function getHigherQuality(currentQualityIndex, previewImage, frame, thumbFilename) {\n        var _this10 = this;\n\n        if (currentQualityIndex < this.thumbnails.length - 1) {\n          // Only use the higher quality version if it's going to look any better - if the current thumb is of a lower pixel density than the thumbnail container\n          var previewImageHeight = previewImage.naturalHeight;\n\n          if (this.usingSprites) {\n            previewImageHeight = frame.h;\n          }\n\n          if (previewImageHeight < this.thumbContainerHeight) {\n            // Recurse back to the loadImage function - show a higher quality one, but only if the viewer is on this frame for a while\n            setTimeout(function () {\n              // Make sure the mouse hasn't already moved on and started hovering at another image\n              if (_this10.showingThumbFilename === thumbFilename) {\n                _this10.player.debug.log(\"Showing higher quality thumb for: \".concat(thumbFilename));\n\n                _this10.loadImage(currentQualityIndex + 1);\n              }\n            }, 300);\n          }\n        }\n      }\n    }, {\n      key: \"toggleThumbContainer\",\n      value: function toggleThumbContainer() {\n        var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n        var clearShowing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n        var className = this.player.config.classNames.previewThumbnails.thumbContainerShown;\n        this.elements.thumb.container.classList.toggle(className, toggle);\n\n        if (!toggle && clearShowing) {\n          this.showingThumb = null;\n          this.showingThumbFilename = null;\n        }\n      }\n    }, {\n      key: \"toggleScrubbingContainer\",\n      value: function toggleScrubbingContainer() {\n        var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n        var className = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;\n        this.elements.scrubbing.container.classList.toggle(className, toggle);\n\n        if (!toggle) {\n          this.showingThumb = null;\n          this.showingThumbFilename = null;\n        }\n      }\n    }, {\n      key: \"determineContainerAutoSizing\",\n      value: function determineContainerAutoSizing() {\n        if (this.elements.thumb.imageContainer.clientHeight > 20) {\n          // This will prevent auto sizing in this.setThumbContainerSizeAndPos()\n          this.sizeSpecifiedInCSS = true;\n        }\n      } // Set the size to be about a quarter of the size of video. Unless option dynamicSize === false, in which case it needs to be set in CSS\n\n    }, {\n      key: \"setThumbContainerSizeAndPos\",\n      value: function setThumbContainerSizeAndPos() {\n        if (!this.sizeSpecifiedInCSS) {\n          var thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);\n          this.elements.thumb.imageContainer.style.height = \"\".concat(this.thumbContainerHeight, \"px\");\n          this.elements.thumb.imageContainer.style.width = \"\".concat(thumbWidth, \"px\");\n        }\n\n        this.setThumbContainerPos();\n      }\n    }, {\n      key: \"setThumbContainerPos\",\n      value: function setThumbContainerPos() {\n        var seekbarRect = this.player.elements.progress.getBoundingClientRect();\n        var plyrRect = this.player.elements.container.getBoundingClientRect();\n        var container = this.elements.thumb.container; // Find the lowest and highest desired left-position, so we don't slide out the side of the video container\n\n        var minVal = plyrRect.left - seekbarRect.left + 10;\n        var maxVal = plyrRect.right - seekbarRect.left - container.clientWidth - 10; // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth\n\n        var previewPos = this.mousePosX - seekbarRect.left - container.clientWidth / 2;\n\n        if (previewPos < minVal) {\n          previewPos = minVal;\n        }\n\n        if (previewPos > maxVal) {\n          previewPos = maxVal;\n        }\n\n        container.style.left = \"\".concat(previewPos, \"px\");\n      } // Can't use 100% width, in case the video is a different aspect ratio to the video container\n\n    }, {\n      key: \"setScrubbingContainerSize\",\n      value: function setScrubbingContainerSize() {\n        this.elements.scrubbing.container.style.width = \"\".concat(this.player.media.clientWidth, \"px\"); // Can't use media.clientHeight - html5 video goes big and does black bars above and below\n\n        this.elements.scrubbing.container.style.height = \"\".concat(this.player.media.clientWidth / this.thumbAspectRatio, \"px\");\n      } // Sprites need to be offset to the correct location\n\n    }, {\n      key: \"setImageSizeAndOffset\",\n      value: function setImageSizeAndOffset(previewImage, frame) {\n        if (!this.usingSprites) {\n          return;\n        } // Find difference between height and preview container height\n\n\n        var multiplier = this.thumbContainerHeight / frame.h; // eslint-disable-next-line no-param-reassign\n\n        previewImage.style.height = \"\".concat(Math.floor(previewImage.naturalHeight * multiplier), \"px\"); // eslint-disable-next-line no-param-reassign\n\n        previewImage.style.width = \"\".concat(Math.floor(previewImage.naturalWidth * multiplier), \"px\"); // eslint-disable-next-line no-param-reassign\n\n        previewImage.style.left = \"-\".concat(frame.x * multiplier, \"px\"); // eslint-disable-next-line no-param-reassign\n\n        previewImage.style.top = \"-\".concat(frame.y * multiplier, \"px\");\n      }\n    }, {\n      key: \"enabled\",\n      get: function get() {\n        return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;\n      }\n    }, {\n      key: \"currentImageContainer\",\n      get: function get() {\n        if (this.mouseDown) {\n          return this.elements.scrubbing.container;\n        }\n\n        return this.elements.thumb.imageContainer;\n      }\n    }, {\n      key: \"usingSprites\",\n      get: function get() {\n        return Object.keys(this.thumbnails[0].frames[0]).includes('w');\n      }\n    }, {\n      key: \"thumbAspectRatio\",\n      get: function get() {\n        if (this.usingSprites) {\n          return this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h;\n        }\n\n        return this.thumbnails[0].width / this.thumbnails[0].height;\n      }\n    }, {\n      key: \"thumbContainerHeight\",\n      get: function get() {\n        if (this.mouseDown) {\n          // Can't use media.clientHeight - HTML5 video goes big and does black bars above and below\n          return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio);\n        }\n\n        return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);\n      }\n    }, {\n      key: \"currentImageElement\",\n      get: function get() {\n        if (this.mouseDown) {\n          return this.currentScrubbingImageElement;\n        }\n\n        return this.currentThumbnailImageElement;\n      },\n      set: function set(element) {\n        if (this.mouseDown) {\n          this.currentScrubbingImageElement = element;\n        } else {\n          this.currentThumbnailImageElement = element;\n        }\n      }\n    }]);\n\n    return PreviewThumbnails;\n  }();\n\n  var source = {\n    // Add elements to HTML5 media (source, tracks, etc)\n    insertElements: function insertElements(type, attributes) {\n      var _this = this;\n\n      if (is$1.string(attributes)) {\n        insertElement(type, this.media, {\n          src: attributes\n        });\n      } else if (is$1.array(attributes)) {\n        attributes.forEach(function (attribute) {\n          insertElement(type, _this.media, attribute);\n        });\n      }\n    },\n    // Update source\n    // Sources are not checked for support so be careful\n    change: function change(input) {\n      var _this2 = this;\n\n      if (!getDeep(input, 'sources.length')) {\n        this.debug.warn('Invalid source format');\n        return;\n      } // Cancel current network requests\n\n\n      html5.cancelRequests.call(this); // Destroy instance and re-setup\n\n      this.destroy.call(this, function () {\n        // Reset quality options\n        _this2.options.quality = []; // Remove elements\n\n        removeElement(_this2.media);\n        _this2.media = null; // Reset class name\n\n        if (is$1.element(_this2.elements.container)) {\n          _this2.elements.container.removeAttribute('class');\n        } // Set the type and provider\n\n\n        var sources = input.sources,\n            type = input.type;\n\n        var _sources = _slicedToArray(sources, 1),\n            _sources$ = _sources[0],\n            _sources$$provider = _sources$.provider,\n            provider = _sources$$provider === void 0 ? providers.html5 : _sources$$provider,\n            src = _sources$.src;\n\n        var tagName = provider === 'html5' ? type : 'div';\n        var attributes = provider === 'html5' ? {} : {\n          src: src\n        };\n        Object.assign(_this2, {\n          provider: provider,\n          type: type,\n          // Check for support\n          supported: support.check(type, provider, _this2.config.playsinline),\n          // Create new element\n          media: createElement(tagName, attributes)\n        }); // Inject the new element\n\n        _this2.elements.container.appendChild(_this2.media); // Autoplay the new source?\n\n\n        if (is$1.boolean(input.autoplay)) {\n          _this2.config.autoplay = input.autoplay;\n        } // Set attributes for audio and video\n\n\n        if (_this2.isHTML5) {\n          if (_this2.config.crossorigin) {\n            _this2.media.setAttribute('crossorigin', '');\n          }\n\n          if (_this2.config.autoplay) {\n            _this2.media.setAttribute('autoplay', '');\n          }\n\n          if (!is$1.empty(input.poster)) {\n            _this2.poster = input.poster;\n          }\n\n          if (_this2.config.loop.active) {\n            _this2.media.setAttribute('loop', '');\n          }\n\n          if (_this2.config.muted) {\n            _this2.media.setAttribute('muted', '');\n          }\n\n          if (_this2.config.playsinline) {\n            _this2.media.setAttribute('playsinline', '');\n          }\n        } // Restore class hook\n\n\n        ui.addStyleHook.call(_this2); // Set new sources for html5\n\n        if (_this2.isHTML5) {\n          source.insertElements.call(_this2, 'source', sources);\n        } // Set video title\n\n\n        _this2.config.title = input.title; // Set up from scratch\n\n        media.setup.call(_this2); // HTML5 stuff\n\n        if (_this2.isHTML5) {\n          // Setup captions\n          if (Object.keys(input).includes('tracks')) {\n            source.insertElements.call(_this2, 'track', input.tracks);\n          }\n        } // If HTML5 or embed but not fully supported, setupInterface and call ready now\n\n\n        if (_this2.isHTML5 || _this2.isEmbed && !_this2.supported.ui) {\n          // Setup interface\n          ui.build.call(_this2);\n        } // Load HTML5 sources\n\n\n        if (_this2.isHTML5) {\n          _this2.media.load();\n        } // Reload thumbnails\n\n\n        if (_this2.previewThumbnails) {\n          _this2.previewThumbnails.load();\n        } // Update the fullscreen support\n\n\n        _this2.fullscreen.update();\n      }, true);\n    }\n  };\n\n  /**\n   * Returns a number whose value is limited to the given range.\n   *\n   * Example: limit the output of this computation to between 0 and 255\n   * (x * 255).clamp(0, 255)\n   *\n   * @param {Number} input\n   * @param {Number} min The lower boundary of the output range\n   * @param {Number} max The upper boundary of the output range\n   * @returns A number in the range [min, max]\n   * @type Number\n   */\n  function clamp() {\n    var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n    var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n    var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 255;\n    return Math.min(Math.max(input, min), max);\n  }\n\n  // TODO: Use a WeakMap for private globals\n  // const globals = new WeakMap();\n  // Plyr instance\n\n  var Plyr =\n  /*#__PURE__*/\n  function () {\n    function Plyr(target, options) {\n      var _this = this;\n\n      _classCallCheck(this, Plyr);\n\n      this.timers = {}; // State\n\n      this.ready = false;\n      this.loading = false;\n      this.failed = false; // Touch device\n\n      this.touch = support.touch; // Set the media element\n\n      this.media = target; // String selector passed\n\n      if (is$1.string(this.media)) {\n        this.media = document.querySelectorAll(this.media);\n      } // jQuery, NodeList or Array passed, use first element\n\n\n      if (window.jQuery && this.media instanceof jQuery || is$1.nodeList(this.media) || is$1.array(this.media)) {\n        // eslint-disable-next-line\n        this.media = this.media[0];\n      } // Set config\n\n\n      this.config = extend({}, defaults$1, Plyr.defaults, options || {}, function () {\n        try {\n          return JSON.parse(_this.media.getAttribute('data-plyr-config'));\n        } catch (e) {\n          return {};\n        }\n      }()); // Elements cache\n\n      this.elements = {\n        container: null,\n        captions: null,\n        buttons: {},\n        display: {},\n        progress: {},\n        inputs: {},\n        settings: {\n          popup: null,\n          menu: null,\n          panels: {},\n          buttons: {}\n        }\n      }; // Captions\n\n      this.captions = {\n        active: null,\n        currentTrack: -1,\n        meta: new WeakMap()\n      }; // Fullscreen\n\n      this.fullscreen = {\n        active: false\n      }; // Options\n\n      this.options = {\n        speed: [],\n        quality: []\n      }; // Debugging\n      // TODO: move to globals\n\n      this.debug = new Console(this.config.debug); // Log config options and support\n\n      this.debug.log('Config', this.config);\n      this.debug.log('Support', support); // We need an element to setup\n\n      if (is$1.nullOrUndefined(this.media) || !is$1.element(this.media)) {\n        this.debug.error('Setup failed: no suitable element passed');\n        return;\n      } // Bail if the element is initialized\n\n\n      if (this.media.plyr) {\n        this.debug.warn('Target already setup');\n        return;\n      } // Bail if not enabled\n\n\n      if (!this.config.enabled) {\n        this.debug.error('Setup failed: disabled by config');\n        return;\n      } // Bail if disabled or no basic support\n      // You may want to disable certain UAs etc\n\n\n      if (!support.check().api) {\n        this.debug.error('Setup failed: no support');\n        return;\n      } // Cache original element state for .destroy()\n\n\n      var clone = this.media.cloneNode(true);\n      clone.autoplay = false;\n      this.elements.original = clone; // Set media type based on tag or data attribute\n      // Supported: video, audio, vimeo, youtube\n\n      var type = this.media.tagName.toLowerCase(); // Embed properties\n\n      var iframe = null;\n      var url = null; // Different setup based on type\n\n      switch (type) {\n        case 'div':\n          // Find the frame\n          iframe = this.media.querySelector('iframe'); // <iframe> type\n\n          if (is$1.element(iframe)) {\n            // Detect provider\n            url = parseUrl(iframe.getAttribute('src'));\n            this.provider = getProviderByUrl(url.toString()); // Rework elements\n\n            this.elements.container = this.media;\n            this.media = iframe; // Reset classname\n\n            this.elements.container.className = ''; // Get attributes from URL and set config\n\n            if (url.search.length) {\n              var truthy = ['1', 'true'];\n\n              if (truthy.includes(url.searchParams.get('autoplay'))) {\n                this.config.autoplay = true;\n              }\n\n              if (truthy.includes(url.searchParams.get('loop'))) {\n                this.config.loop.active = true;\n              } // TODO: replace fullscreen.iosNative with this playsinline config option\n              // YouTube requires the playsinline in the URL\n\n\n              if (this.isYouTube) {\n                this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));\n                this.config.youtube.hl = url.searchParams.get('hl'); // TODO: Should this be setting language?\n              } else {\n                this.config.playsinline = true;\n              }\n            }\n          } else {\n            // <div> with attributes\n            this.provider = this.media.getAttribute(this.config.attributes.embed.provider); // Remove attribute\n\n            this.media.removeAttribute(this.config.attributes.embed.provider);\n          } // Unsupported or missing provider\n\n\n          if (is$1.empty(this.provider) || !Object.keys(providers).includes(this.provider)) {\n            this.debug.error('Setup failed: Invalid provider');\n            return;\n          } // Audio will come later for external providers\n\n\n          this.type = types.video;\n          break;\n\n        case 'video':\n        case 'audio':\n          this.type = type;\n          this.provider = providers.html5; // Get config from attributes\n\n          if (this.media.hasAttribute('crossorigin')) {\n            this.config.crossorigin = true;\n          }\n\n          if (this.media.hasAttribute('autoplay')) {\n            this.config.autoplay = true;\n          }\n\n          if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) {\n            this.config.playsinline = true;\n          }\n\n          if (this.media.hasAttribute('muted')) {\n            this.config.muted = true;\n          }\n\n          if (this.media.hasAttribute('loop')) {\n            this.config.loop.active = true;\n          }\n\n          break;\n\n        default:\n          this.debug.error('Setup failed: unsupported type');\n          return;\n      } // Check for support again but with type\n\n\n      this.supported = support.check(this.type, this.provider, this.config.playsinline); // If no support for even API, bail\n\n      if (!this.supported.api) {\n        this.debug.error('Setup failed: no support');\n        return;\n      }\n\n      this.eventListeners = []; // Create listeners\n\n      this.listeners = new Listeners(this); // Setup local storage for user settings\n\n      this.storage = new Storage(this); // Store reference\n\n      this.media.plyr = this; // Wrap media\n\n      if (!is$1.element(this.elements.container)) {\n        this.elements.container = createElement('div', {\n          tabindex: 0\n        });\n        wrap(this.media, this.elements.container);\n      } // Add style hook\n\n\n      ui.addStyleHook.call(this); // Setup media\n\n      media.setup.call(this); // Listen for events if debugging\n\n      if (this.config.debug) {\n        on.call(this, this.elements.container, this.config.events.join(' '), function (event) {\n          _this.debug.log(\"event: \".concat(event.type));\n        });\n      } // Setup interface\n      // If embed but not fully supported, build interface now to avoid flash of controls\n\n\n      if (this.isHTML5 || this.isEmbed && !this.supported.ui) {\n        ui.build.call(this);\n      } // Container listeners\n\n\n      this.listeners.container(); // Global listeners\n\n      this.listeners.global(); // Setup fullscreen\n\n      this.fullscreen = new Fullscreen(this); // Setup ads if provided\n\n      if (this.config.ads.enabled) {\n        this.ads = new Ads(this);\n      } // Autoplay if required\n\n\n      if (this.isHTML5 && this.config.autoplay) {\n        setTimeout(function () {\n          return _this.play();\n        }, 10);\n      } // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek\n\n\n      this.lastSeekTime = 0; // Setup preview thumbnails if enabled\n\n      if (this.config.previewThumbnails.enabled) {\n        this.previewThumbnails = new PreviewThumbnails(this);\n      }\n    } // ---------------------------------------\n    // API\n    // ---------------------------------------\n\n    /**\n     * Types and provider helpers\n     */\n\n\n    _createClass(Plyr, [{\n      key: \"play\",\n\n      /**\n       * Play the media, or play the advertisement (if they are not blocked)\n       */\n      value: function play() {\n        var _this2 = this;\n\n        if (!is$1.function(this.media.play)) {\n          return null;\n        } // Intecept play with ads\n\n\n        if (this.ads && this.ads.enabled) {\n          this.ads.managerPromise.then(function () {\n            return _this2.ads.play();\n          }).catch(function () {\n            return _this2.media.play();\n          });\n        } // Return the promise (for HTML5)\n\n\n        return this.media.play();\n      }\n      /**\n       * Pause the media\n       */\n\n    }, {\n      key: \"pause\",\n      value: function pause() {\n        if (!this.playing || !is$1.function(this.media.pause)) {\n          return;\n        }\n\n        this.media.pause();\n      }\n      /**\n       * Get playing state\n       */\n\n    }, {\n      key: \"togglePlay\",\n\n      /**\n       * Toggle playback based on current status\n       * @param {Boolean} input\n       */\n      value: function togglePlay(input) {\n        // Toggle based on current state if nothing passed\n        var toggle = is$1.boolean(input) ? input : !this.playing;\n\n        if (toggle) {\n          this.play();\n        } else {\n          this.pause();\n        }\n      }\n      /**\n       * Stop playback\n       */\n\n    }, {\n      key: \"stop\",\n      value: function stop() {\n        if (this.isHTML5) {\n          this.pause();\n          this.restart();\n        } else if (is$1.function(this.media.stop)) {\n          this.media.stop();\n        }\n      }\n      /**\n       * Restart playback\n       */\n\n    }, {\n      key: \"restart\",\n      value: function restart() {\n        this.currentTime = 0;\n      }\n      /**\n       * Rewind\n       * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime\n       */\n\n    }, {\n      key: \"rewind\",\n      value: function rewind(seekTime) {\n        this.currentTime = this.currentTime - (is$1.number(seekTime) ? seekTime : this.config.seekTime);\n      }\n      /**\n       * Fast forward\n       * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime\n       */\n\n    }, {\n      key: \"forward\",\n      value: function forward(seekTime) {\n        this.currentTime = this.currentTime + (is$1.number(seekTime) ? seekTime : this.config.seekTime);\n      }\n      /**\n       * Seek to a time\n       * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)\n       */\n\n    }, {\n      key: \"increaseVolume\",\n\n      /**\n       * Increase volume\n       * @param {Boolean} step - How much to decrease by (between 0 and 1)\n       */\n      value: function increaseVolume(step) {\n        var volume = this.media.muted ? 0 : this.volume;\n        this.volume = volume + (is$1.number(step) ? step : 0);\n      }\n      /**\n       * Decrease volume\n       * @param {Boolean} step - How much to decrease by (between 0 and 1)\n       */\n\n    }, {\n      key: \"decreaseVolume\",\n      value: function decreaseVolume(step) {\n        this.increaseVolume(-step);\n      }\n      /**\n       * Set muted state\n       * @param {Boolean} mute\n       */\n\n    }, {\n      key: \"toggleCaptions\",\n\n      /**\n       * Toggle captions\n       * @param {Boolean} input - Whether to enable captions\n       */\n      value: function toggleCaptions(input) {\n        captions.toggle.call(this, input, false);\n      }\n      /**\n       * Set the caption track by index\n       * @param {Number} - Caption index\n       */\n\n    }, {\n      key: \"airplay\",\n\n      /**\n       * Trigger the airplay dialog\n       * TODO: update player with state, support, enabled\n       */\n      value: function airplay() {\n        // Show dialog if supported\n        if (support.airplay) {\n          this.media.webkitShowPlaybackTargetPicker();\n        }\n      }\n      /**\n       * Toggle the player controls\n       * @param {Boolean} [toggle] - Whether to show the controls\n       */\n\n    }, {\n      key: \"toggleControls\",\n      value: function toggleControls(toggle) {\n        // Don't toggle if missing UI support or if it's audio\n        if (this.supported.ui && !this.isAudio) {\n          // Get state before change\n          var isHidden = hasClass(this.elements.container, this.config.classNames.hideControls); // Negate the argument if not undefined since adding the class to hides the controls\n\n          var force = typeof toggle === 'undefined' ? undefined : !toggle; // Apply and get updated state\n\n          var hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); // Close menu\n\n          if (hiding && this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) {\n            controls.toggleMenu.call(this, false);\n          } // Trigger event on change\n\n\n          if (hiding !== isHidden) {\n            var eventName = hiding ? 'controlshidden' : 'controlsshown';\n            triggerEvent.call(this, this.media, eventName);\n          }\n\n          return !hiding;\n        }\n\n        return false;\n      }\n      /**\n       * Add event listeners\n       * @param {String} event - Event type\n       * @param {Function} callback - Callback for when event occurs\n       */\n\n    }, {\n      key: \"on\",\n      value: function on$1(event, callback) {\n        on.call(this, this.elements.container, event, callback);\n      }\n      /**\n       * Add event listeners once\n       * @param {String} event - Event type\n       * @param {Function} callback - Callback for when event occurs\n       */\n\n    }, {\n      key: \"once\",\n      value: function once$1(event, callback) {\n        once.call(this, this.elements.container, event, callback);\n      }\n      /**\n       * Remove event listeners\n       * @param {String} event - Event type\n       * @param {Function} callback - Callback for when event occurs\n       */\n\n    }, {\n      key: \"off\",\n      value: function off$1(event, callback) {\n        off(this.elements.container, event, callback);\n      }\n      /**\n       * Destroy an instance\n       * Event listeners are removed when elements are removed\n       * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory\n       * @param {Function} callback - Callback for when destroy is complete\n       * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)\n       */\n\n    }, {\n      key: \"destroy\",\n      value: function destroy(callback) {\n        var _this3 = this;\n\n        var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n        if (!this.ready) {\n          return;\n        }\n\n        var done = function done() {\n          // Reset overflow (incase destroyed while in fullscreen)\n          document.body.style.overflow = ''; // GC for embed\n\n          _this3.embed = null; // If it's a soft destroy, make minimal changes\n\n          if (soft) {\n            if (Object.keys(_this3.elements).length) {\n              // Remove elements\n              removeElement(_this3.elements.buttons.play);\n              removeElement(_this3.elements.captions);\n              removeElement(_this3.elements.controls);\n              removeElement(_this3.elements.wrapper); // Clear for GC\n\n              _this3.elements.buttons.play = null;\n              _this3.elements.captions = null;\n              _this3.elements.controls = null;\n              _this3.elements.wrapper = null;\n            } // Callback\n\n\n            if (is$1.function(callback)) {\n              callback();\n            }\n          } else {\n            // Unbind listeners\n            unbindListeners.call(_this3); // Replace the container with the original element provided\n\n            replaceElement(_this3.elements.original, _this3.elements.container); // Event\n\n            triggerEvent.call(_this3, _this3.elements.original, 'destroyed', true); // Callback\n\n            if (is$1.function(callback)) {\n              callback.call(_this3.elements.original);\n            } // Reset state\n\n\n            _this3.ready = false; // Clear for garbage collection\n\n            setTimeout(function () {\n              _this3.elements = null;\n              _this3.media = null;\n            }, 200);\n          }\n        }; // Stop playback\n\n\n        this.stop(); // Clear timeouts\n\n        clearTimeout(this.timers.loading);\n        clearTimeout(this.timers.controls);\n        clearTimeout(this.timers.resized); // Provider specific stuff\n\n        if (this.isHTML5) {\n          // Restore native video controls\n          ui.toggleNativeControls.call(this, true); // Clean up\n\n          done();\n        } else if (this.isYouTube) {\n          // Clear timers\n          clearInterval(this.timers.buffering);\n          clearInterval(this.timers.playing); // Destroy YouTube API\n\n          if (this.embed !== null && is$1.function(this.embed.destroy)) {\n            this.embed.destroy();\n          } // Clean up\n\n\n          done();\n        } else if (this.isVimeo) {\n          // Destroy Vimeo API\n          // then clean up (wait, to prevent postmessage errors)\n          if (this.embed !== null) {\n            this.embed.unload().then(done);\n          } // Vimeo does not always return\n\n\n          setTimeout(done, 200);\n        }\n      }\n      /**\n       * Check for support for a mime type (HTML5 only)\n       * @param {String} type - Mime type\n       */\n\n    }, {\n      key: \"supports\",\n      value: function supports(type) {\n        return support.mime.call(this, type);\n      }\n      /**\n       * Check for support\n       * @param {String} type - Player type (audio/video)\n       * @param {String} provider - Provider (html5/youtube/vimeo)\n       * @param {Boolean} inline - Where player has `playsinline` sttribute\n       */\n\n    }, {\n      key: \"isHTML5\",\n      get: function get() {\n        return this.provider === providers.html5;\n      }\n    }, {\n      key: \"isEmbed\",\n      get: function get() {\n        return this.isYouTube || this.isVimeo;\n      }\n    }, {\n      key: \"isYouTube\",\n      get: function get() {\n        return this.provider === providers.youtube;\n      }\n    }, {\n      key: \"isVimeo\",\n      get: function get() {\n        return this.provider === providers.vimeo;\n      }\n    }, {\n      key: \"isVideo\",\n      get: function get() {\n        return this.type === types.video;\n      }\n    }, {\n      key: \"isAudio\",\n      get: function get() {\n        return this.type === types.audio;\n      }\n    }, {\n      key: \"playing\",\n      get: function get() {\n        return Boolean(this.ready && !this.paused && !this.ended);\n      }\n      /**\n       * Get paused state\n       */\n\n    }, {\n      key: \"paused\",\n      get: function get() {\n        return Boolean(this.media.paused);\n      }\n      /**\n       * Get stopped state\n       */\n\n    }, {\n      key: \"stopped\",\n      get: function get() {\n        return Boolean(this.paused && this.currentTime === 0);\n      }\n      /**\n       * Get ended state\n       */\n\n    }, {\n      key: \"ended\",\n      get: function get() {\n        return Boolean(this.media.ended);\n      }\n    }, {\n      key: \"currentTime\",\n      set: function set(input) {\n        // Bail if media duration isn't available yet\n        if (!this.duration) {\n          return;\n        } // Validate input\n\n\n        var inputIsValid = is$1.number(input) && input > 0; // Set\n\n        this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0; // Logging\n\n        this.debug.log(\"Seeking to \".concat(this.currentTime, \" seconds\"));\n      }\n      /**\n       * Get current time\n       */\n      ,\n      get: function get() {\n        return Number(this.media.currentTime);\n      }\n      /**\n       * Get buffered\n       */\n\n    }, {\n      key: \"buffered\",\n      get: function get() {\n        var buffered = this.media.buffered; // YouTube / Vimeo return a float between 0-1\n\n        if (is$1.number(buffered)) {\n          return buffered;\n        } // HTML5\n        // TODO: Handle buffered chunks of the media\n        // (i.e. seek to another section buffers only that section)\n\n\n        if (buffered && buffered.length && this.duration > 0) {\n          return buffered.end(0) / this.duration;\n        }\n\n        return 0;\n      }\n      /**\n       * Get seeking status\n       */\n\n    }, {\n      key: \"seeking\",\n      get: function get() {\n        return Boolean(this.media.seeking);\n      }\n      /**\n       * Get the duration of the current media\n       */\n\n    }, {\n      key: \"duration\",\n      get: function get() {\n        // Faux duration set via config\n        var fauxDuration = parseFloat(this.config.duration); // Media duration can be NaN or Infinity before the media has loaded\n\n        var realDuration = (this.media || {}).duration;\n        var duration = !is$1.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration\n\n        return fauxDuration || duration;\n      }\n      /**\n       * Set the player volume\n       * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage\n       */\n\n    }, {\n      key: \"volume\",\n      set: function set(value) {\n        var volume = value;\n        var max = 1;\n        var min = 0;\n\n        if (is$1.string(volume)) {\n          volume = Number(volume);\n        } // Load volume from storage if no value specified\n\n\n        if (!is$1.number(volume)) {\n          volume = this.storage.get('volume');\n        } // Use config if all else fails\n\n\n        if (!is$1.number(volume)) {\n          volume = this.config.volume;\n        } // Maximum is volumeMax\n\n\n        if (volume > max) {\n          volume = max;\n        } // Minimum is volumeMin\n\n\n        if (volume < min) {\n          volume = min;\n        } // Update config\n\n\n        this.config.volume = volume; // Set the player volume\n\n        this.media.volume = volume; // If muted, and we're increasing volume manually, reset muted state\n\n        if (!is$1.empty(value) && this.muted && volume > 0) {\n          this.muted = false;\n        }\n      }\n      /**\n       * Get the current player volume\n       */\n      ,\n      get: function get() {\n        return Number(this.media.volume);\n      }\n    }, {\n      key: \"muted\",\n      set: function set(mute) {\n        var toggle = mute; // Load muted state from storage\n\n        if (!is$1.boolean(toggle)) {\n          toggle = this.storage.get('muted');\n        } // Use config if all else fails\n\n\n        if (!is$1.boolean(toggle)) {\n          toggle = this.config.muted;\n        } // Update config\n\n\n        this.config.muted = toggle; // Set mute on the player\n\n        this.media.muted = toggle;\n      }\n      /**\n       * Get current muted state\n       */\n      ,\n      get: function get() {\n        return Boolean(this.media.muted);\n      }\n      /**\n       * Check if the media has audio\n       */\n\n    }, {\n      key: \"hasAudio\",\n      get: function get() {\n        // Assume yes for all non HTML5 (as we can't tell...)\n        if (!this.isHTML5) {\n          return true;\n        }\n\n        if (this.isAudio) {\n          return true;\n        } // Get audio tracks\n\n\n        return Boolean(this.media.mozHasAudio) || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks && this.media.audioTracks.length);\n      }\n      /**\n       * Set playback speed\n       * @param {Number} speed - the speed of playback (0.5-2.0)\n       */\n\n    }, {\n      key: \"speed\",\n      set: function set(input) {\n        var _this4 = this;\n\n        var speed = null;\n\n        if (is$1.number(input)) {\n          speed = input;\n        }\n\n        if (!is$1.number(speed)) {\n          speed = this.storage.get('speed');\n        }\n\n        if (!is$1.number(speed)) {\n          speed = this.config.speed.selected;\n        } // Clamp to min/max\n\n\n        var min = this.minimumSpeed,\n            max = this.maximumSpeed;\n        speed = clamp(speed, min, max); // Update config\n\n        this.config.speed.selected = speed; // Set media speed\n\n        setTimeout(function () {\n          _this4.media.playbackRate = speed;\n        }, 0);\n      }\n      /**\n       * Get current playback speed\n       */\n      ,\n      get: function get() {\n        return Number(this.media.playbackRate);\n      }\n      /**\n       * Get the minimum allowed speed\n       */\n\n    }, {\n      key: \"minimumSpeed\",\n      get: function get() {\n        if (this.isYouTube) {\n          // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate\n          return Math.min.apply(Math, _toConsumableArray(this.options.speed));\n        }\n\n        if (this.isVimeo) {\n          // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror\n          return 0.5;\n        } // https://stackoverflow.com/a/32320020/1191319\n\n\n        return 0.0625;\n      }\n      /**\n       * Get the maximum allowed speed\n       */\n\n    }, {\n      key: \"maximumSpeed\",\n      get: function get() {\n        if (this.isYouTube) {\n          // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate\n          return Math.max.apply(Math, _toConsumableArray(this.options.speed));\n        }\n\n        if (this.isVimeo) {\n          // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror\n          return 2;\n        } // https://stackoverflow.com/a/32320020/1191319\n\n\n        return 16;\n      }\n      /**\n       * Set playback quality\n       * Currently HTML5 & YouTube only\n       * @param {Number} input - Quality level\n       */\n\n    }, {\n      key: \"quality\",\n      set: function set(input) {\n        var config = this.config.quality;\n        var options = this.options.quality;\n\n        if (!options.length) {\n          return;\n        }\n\n        var quality = [!is$1.empty(input) && Number(input), this.storage.get('quality'), config.selected, config.default].find(is$1.number);\n        var updateStorage = true;\n\n        if (!options.includes(quality)) {\n          var value = closest(options, quality);\n          this.debug.warn(\"Unsupported quality option: \".concat(quality, \", using \").concat(value, \" instead\"));\n          quality = value; // Don't update storage if quality is not supported\n\n          updateStorage = false;\n        } // Update config\n\n\n        config.selected = quality; // Set quality\n\n        this.media.quality = quality; // Save to storage\n\n        if (updateStorage) {\n          this.storage.set({\n            quality: quality\n          });\n        }\n      }\n      /**\n       * Get current quality level\n       */\n      ,\n      get: function get() {\n        return this.media.quality;\n      }\n      /**\n       * Toggle loop\n       * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config\n       * @param {Boolean} input - Whether to loop or not\n       */\n\n    }, {\n      key: \"loop\",\n      set: function set(input) {\n        var toggle = is$1.boolean(input) ? input : this.config.loop.active;\n        this.config.loop.active = toggle;\n        this.media.loop = toggle; // Set default to be a true toggle\n\n        /* const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';\n         switch (type) {\n            case 'start':\n                if (this.config.loop.end && this.config.loop.end <= this.currentTime) {\n                    this.config.loop.end = null;\n                }\n                this.config.loop.start = this.currentTime;\n                // this.config.loop.indicator.start = this.elements.display.played.value;\n                break;\n             case 'end':\n                if (this.config.loop.start >= this.currentTime) {\n                    return this;\n                }\n                this.config.loop.end = this.currentTime;\n                // this.config.loop.indicator.end = this.elements.display.played.value;\n                break;\n             case 'all':\n                this.config.loop.start = 0;\n                this.config.loop.end = this.duration - 2;\n                this.config.loop.indicator.start = 0;\n                this.config.loop.indicator.end = 100;\n                break;\n             case 'toggle':\n                if (this.config.loop.active) {\n                    this.config.loop.start = 0;\n                    this.config.loop.end = null;\n                } else {\n                    this.config.loop.start = 0;\n                    this.config.loop.end = this.duration - 2;\n                }\n                break;\n             default:\n                this.config.loop.start = 0;\n                this.config.loop.end = null;\n                break;\n        } */\n      }\n      /**\n       * Get current loop state\n       */\n      ,\n      get: function get() {\n        return Boolean(this.media.loop);\n      }\n      /**\n       * Set new media source\n       * @param {Object} input - The new source object (see docs)\n       */\n\n    }, {\n      key: \"source\",\n      set: function set(input) {\n        source.change.call(this, input);\n      }\n      /**\n       * Get current source\n       */\n      ,\n      get: function get() {\n        return this.media.currentSrc;\n      }\n      /**\n       * Get a download URL (either source or custom)\n       */\n\n    }, {\n      key: \"download\",\n      get: function get() {\n        var download = this.config.urls.download;\n        return is$1.url(download) ? download : this.source;\n      }\n      /**\n       * Set the download URL\n       */\n      ,\n      set: function set(input) {\n        if (!is$1.url(input)) {\n          return;\n        }\n\n        this.config.urls.download = input;\n        controls.setDownloadUrl.call(this);\n      }\n      /**\n       * Set the poster image for a video\n       * @param {String} input - the URL for the new poster image\n       */\n\n    }, {\n      key: \"poster\",\n      set: function set(input) {\n        if (!this.isVideo) {\n          this.debug.warn('Poster can only be set for video');\n          return;\n        }\n\n        ui.setPoster.call(this, input, false).catch(function () {});\n      }\n      /**\n       * Get the current poster image\n       */\n      ,\n      get: function get() {\n        if (!this.isVideo) {\n          return null;\n        }\n\n        return this.media.getAttribute('poster');\n      }\n      /**\n       * Get the current aspect ratio in use\n       */\n\n    }, {\n      key: \"ratio\",\n      get: function get() {\n        if (!this.isVideo) {\n          return null;\n        }\n\n        var ratio = reduceAspectRatio(getAspectRatio.call(this));\n        return is$1.array(ratio) ? ratio.join(':') : ratio;\n      }\n      /**\n       * Set video aspect ratio\n       */\n      ,\n      set: function set(input) {\n        if (!this.isVideo) {\n          this.debug.warn('Aspect ratio can only be set for video');\n          return;\n        }\n\n        if (!is$1.string(input) || !validateRatio(input)) {\n          this.debug.error(\"Invalid aspect ratio specified (\".concat(input, \")\"));\n          return;\n        }\n\n        this.config.ratio = input;\n        setAspectRatio.call(this);\n      }\n      /**\n       * Set the autoplay state\n       * @param {Boolean} input - Whether to autoplay or not\n       */\n\n    }, {\n      key: \"autoplay\",\n      set: function set(input) {\n        var toggle = is$1.boolean(input) ? input : this.config.autoplay;\n        this.config.autoplay = toggle;\n      }\n      /**\n       * Get the current autoplay state\n       */\n      ,\n      get: function get() {\n        return Boolean(this.config.autoplay);\n      }\n    }, {\n      key: \"currentTrack\",\n      set: function set(input) {\n        captions.set.call(this, input, false);\n      }\n      /**\n       * Get the current caption track index (-1 if disabled)\n       */\n      ,\n      get: function get() {\n        var _this$captions = this.captions,\n            toggled = _this$captions.toggled,\n            currentTrack = _this$captions.currentTrack;\n        return toggled ? currentTrack : -1;\n      }\n      /**\n       * Set the wanted language for captions\n       * Since tracks can be added later it won't update the actual caption track until there is a matching track\n       * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)\n       */\n\n    }, {\n      key: \"language\",\n      set: function set(input) {\n        captions.setLanguage.call(this, input, false);\n      }\n      /**\n       * Get the current track's language\n       */\n      ,\n      get: function get() {\n        return (captions.getCurrentTrack.call(this) || {}).language;\n      }\n      /**\n       * Toggle picture-in-picture playback on WebKit/MacOS\n       * TODO: update player with state, support, enabled\n       * TODO: detect outside changes\n       */\n\n    }, {\n      key: \"pip\",\n      set: function set(input) {\n        // Bail if no support\n        if (!support.pip) {\n          return;\n        } // Toggle based on current state if not passed\n\n\n        var toggle = is$1.boolean(input) ? input : !this.pip; // Toggle based on current state\n        // Safari\n\n        if (is$1.function(this.media.webkitSetPresentationMode)) {\n          this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);\n        } // Chrome\n\n\n        if (is$1.function(this.media.requestPictureInPicture)) {\n          if (!this.pip && toggle) {\n            this.media.requestPictureInPicture();\n          } else if (this.pip && !toggle) {\n            document.exitPictureInPicture();\n          }\n        }\n      }\n      /**\n       * Get the current picture-in-picture state\n       */\n      ,\n      get: function get() {\n        if (!support.pip) {\n          return null;\n        } // Safari\n\n\n        if (!is$1.empty(this.media.webkitPresentationMode)) {\n          return this.media.webkitPresentationMode === pip.active;\n        } // Chrome\n\n\n        return this.media === document.pictureInPictureElement;\n      }\n    }], [{\n      key: \"supported\",\n      value: function supported(type, provider, inline) {\n        return support.check(type, provider, inline);\n      }\n      /**\n       * Load an SVG sprite into the page\n       * @param {String} url - URL for the SVG sprite\n       * @param {String} [id] - Unique ID\n       */\n\n    }, {\n      key: \"loadSprite\",\n      value: function loadSprite$1(url, id) {\n        return loadSprite(url, id);\n      }\n      /**\n       * Setup multiple instances\n       * @param {*} selector\n       * @param {Object} options\n       */\n\n    }, {\n      key: \"setup\",\n      value: function setup(selector) {\n        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n        var targets = null;\n\n        if (is$1.string(selector)) {\n          targets = Array.from(document.querySelectorAll(selector));\n        } else if (is$1.nodeList(selector)) {\n          targets = Array.from(selector);\n        } else if (is$1.array(selector)) {\n          targets = selector.filter(is$1.element);\n        }\n\n        if (is$1.empty(targets)) {\n          return null;\n        }\n\n        return targets.map(function (t) {\n          return new Plyr(t, options);\n        });\n      }\n    }]);\n\n    return Plyr;\n  }();\n\n  Plyr.defaults = cloneDeep(defaults$1);\n\n  return Plyr;\n\n}));\n","const defaults = {\n    addCSS: true, // Add CSS to the element to improve usability (required here or in your CSS!)\n    thumbWidth: 15, // The width of the thumb handle\n    watch: true, // Watch for new elements that match a string target\n};\n\nexport default defaults;","// ==========================================================================\n// Type checking utils\n// ==========================================================================\n\nconst getConstructor = input => (input !== null && typeof input !== 'undefined' ? input.constructor : null);\nconst instanceOf = (input, constructor) => Boolean(input && constructor && input instanceof constructor);\n\nconst isNullOrUndefined = input => input === null || typeof input === 'undefined';\nconst isObject = input => getConstructor(input) === Object;\nconst isNumber = input => getConstructor(input) === Number && !Number.isNaN(input);\nconst isString = input => getConstructor(input) === String;\nconst isBoolean = input => getConstructor(input) === Boolean;\nconst isFunction = input => getConstructor(input) === Function;\nconst isArray = input => Array.isArray(input);\nconst isNodeList = input => instanceOf(input, NodeList);\nconst isElement = input => instanceOf(input, Element);\nconst isEvent = input => instanceOf(input, Event);\nconst isEmpty = input =>\n    isNullOrUndefined(input) ||\n    ((isString(input) || isArray(input) || isNodeList(input)) && !input.length) ||\n    (isObject(input) && !Object.keys(input).length);\n\nexport default {\n    nullOrUndefined: isNullOrUndefined,\n    object: isObject,\n    number: isNumber,\n    string: isString,\n    boolean: isBoolean,\n    function: isFunction,\n    array: isArray,\n    nodeList: isNodeList,\n    element: isElement,\n    event: isEvent,\n    empty: isEmpty,\n};\n","// Get the number of decimal places\nexport function getDecimalPlaces(value) {\n    const match = `${value}`.match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\n    if (!match) {\n        return 0;\n    }\n\n    return Math.max(\n        0,\n        // Number of digits right of decimal point.\n        (match[1] ? match[1].length : 0) -\n            // Adjust for scientific notation.\n            (match[2] ? +match[2] : 0),\n    );\n}\n\n// Round to the nearest step\nexport function round(number, step) {\n    if (step < 1) {\n        const places = getDecimalPlaces(step);\n        return parseFloat(number.toFixed(places));\n    }\n    return Math.round(number / step) * step;\n}\n\nexport default {};\n","// ==========================================================================\n// Animation utils\n// ==========================================================================\n\nimport is from './is';\n\nexport const transitionEndEvent = (() => {\n    const element = document.createElement('span');\n\n    const events = {\n        WebkitTransition: 'webkitTransitionEnd',\n        MozTransition: 'transitionend',\n        OTransition: 'oTransitionEnd otransitionend',\n        transition: 'transitionend',\n    };\n\n    const type = Object.keys(events).find(event => element.style[event] !== undefined);\n\n    return is.string(type) ? events[type] : false;\n})();\n\n// Force repaint of element\nexport function repaint(element, delay) {\n    setTimeout(() => {\n        try {\n            // eslint-disable-next-line no-param-reassign\n            element.hidden = true;\n\n            // eslint-disable-next-line no-unused-expressions\n            element.offsetHeight;\n\n            // eslint-disable-next-line no-param-reassign\n            element.hidden = false;\n        } catch (e) {\n            // Do nothing\n        }\n    }, delay);\n}\n","// ==========================================================================\n// rangetouch.js v2.0.0\n// Making <input type=\"range\"> work on touch devices\n// https://github.com/sampotts/rangetouch\n// License: The MIT License (MIT)\n// ==========================================================================\n\nimport defaults from './config';\nimport { matches } from './utils/css';\nimport { trigger } from './utils/events';\nimport is from './utils/is';\nimport { round } from './utils/numbers';\n\nclass RangeTouch {\n    /**\n     * Setup a new instance\n     * @param {String|Element} target\n     * @param {Object} options\n     */\n    constructor(target, options) {\n        if (is.element(target)) {\n            // An Element is passed, use it directly\n            this.element = target;\n        } else if (is.string(target)) {\n            // A CSS Selector is passed, fetch it from the DOM\n            this.element = document.querySelector(target);\n        }\n\n        if (!is.element(this.element) || !is.empty(this.element.rangeTouch)) {\n            return;\n        }\n\n        this.config = Object.assign({}, defaults, options);\n\n        this.init();\n    }\n\n    static get enabled() {\n        return 'ontouchstart' in document.documentElement;\n    }\n\n    /**\n     * Setup multiple instances\n     * @param {String|Element|NodeList|Array} target\n     * @param {Object} options\n     */\n    static setup(target, options = {}) {\n        let targets = null;\n\n        if (is.empty(target) || is.string(target)) {\n            targets = Array.from(document.querySelectorAll(is.string(target) ? target : 'input[type=\"range\"]'));\n        } else if (is.element(target)) {\n            targets = [target];\n        } else if (is.nodeList(target)) {\n            targets = Array.from(target);\n        } else if (is.array(target)) {\n            targets = target.filter(is.element);\n        }\n\n        if (is.empty(targets)) {\n            return null;\n        }\n\n        const config = Object.assign({}, defaults, options);\n\n        if (is.string(target) && config.watch) {\n            // Create an observer instance\n            const observer = new MutationObserver(mutations => {\n                Array.from(mutations).forEach(mutation => {\n                    Array.from(mutation.addedNodes).forEach(node => {\n                        if (!is.element(node) || !matches(node, target)) {\n                            return;\n                        }\n\n                        // eslint-disable-next-line no-unused-vars\n                        const range = new RangeTouch(node, config);\n                    });\n                });\n            });\n\n            // Pass in the target node, as well as the observer options\n            observer.observe(document.body, {\n                childList: true,\n                subtree: true,\n            });\n        }\n\n        return targets.map(t => new RangeTouch(t, options));\n    }\n\n    init() {\n        // Bail if not a touch enabled device\n        if (!RangeTouch.enabled) {\n            return;\n        }\n\n        // Add useful CSS\n        if (this.config.addCSS) {\n            // TODO: Restore original values on destroy\n            this.element.style.userSelect = 'none';\n            this.element.style.webKitUserSelect = 'none';\n            this.element.style.touchAction = 'manipulation';\n        }\n\n        this.listeners(true);\n\n        this.element.rangeTouch = this;\n    }\n\n    destroy() {\n        // Bail if not a touch enabled device\n        if (!RangeTouch.enabled) {\n            return;\n        }\n\n        this.listeners(false);\n\n        this.element.rangeTouch = null;\n    }\n\n    listeners(toggle) {\n        const method = toggle ? 'addEventListener' : 'removeEventListener';\n\n        // Listen for events\n        ['touchstart', 'touchmove', 'touchend'].forEach(type => {\n            this.element[method](type, event => this.set(event), false);\n        });\n    }\n\n    /**\n     * Get the value based on touch position\n     * @param {Event} event\n     */\n    get(event) {\n        if (!RangeTouch.enabled || !is.event(event)) {\n            return null;\n        }\n\n        const input = event.target;\n        const touch = event.changedTouches[0];\n        const min = parseFloat(input.getAttribute('min')) || 0;\n        const max = parseFloat(input.getAttribute('max')) || 100;\n        const step = parseFloat(input.getAttribute('step')) || 1;\n        const delta = max - min;\n\n        // Calculate percentage\n        let percent;\n        const clientRect = input.getBoundingClientRect();\n        const thumbWidth = ((100 / clientRect.width) * (this.config.thumbWidth / 2)) / 100;\n\n        // Determine left percentage\n        percent = (100 / clientRect.width) * (touch.clientX - clientRect.left);\n\n        // Don't allow outside bounds\n        if (percent < 0) {\n            percent = 0;\n        } else if (percent > 100) {\n            percent = 100;\n        }\n\n        // Factor in the thumb offset\n        if (percent < 50) {\n            percent -= (100 - percent * 2) * thumbWidth;\n        } else if (percent > 50) {\n            percent += (percent - 50) * 2 * thumbWidth;\n        }\n\n        // Find the closest step to the mouse position\n        return min + round(delta * (percent / 100), step);\n    }\n\n    /**\n     * Update range value based on position\n     * @param {Event} event\n     */\n    set(event) {\n        if (!RangeTouch.enabled || !is.event(event) || event.target.disabled) {\n            return;\n        }\n\n        // Prevent text highlight on iOS\n        event.preventDefault();\n\n        // Set value\n        event.target.value = this.get(event);\n\n        // Trigger event\n        trigger(event.target, event.type === 'touchend' ? 'change' : 'input');\n    }\n}\n\nexport default RangeTouch;\n","// Trigger event\nexport function trigger(element, type) {\n    if (!element || !type) {\n        return;\n    }\n\n    // Create and dispatch the event\n    const event = new Event(type);\n\n    // Dispatch the event\n    element.dispatchEvent(event);\n}\n\nexport default {};\n","// Element matches a selector\nexport function matches(element, selector) {\n    const prototype = { Element };\n\n    function match() {\n        return Array.from(document.querySelectorAll(selector)).includes(this);\n    }\n\n    const matches =\n        prototype.matches ||\n        prototype.webkitMatchesSelector ||\n        prototype.mozMatchesSelector ||\n        prototype.msMatchesSelector ||\n        match;\n\n    return matches.call(element, selector);\n}\n\nexport default {};\n","// ==========================================================================\n// Type checking utils\n// ==========================================================================\n\nconst getConstructor = input => (input !== null && typeof input !== 'undefined' ? input.constructor : null);\nconst instanceOf = (input, constructor) => Boolean(input && constructor && input instanceof constructor);\nconst isNullOrUndefined = input => input === null || typeof input === 'undefined';\nconst isObject = input => getConstructor(input) === Object;\nconst isNumber = input => getConstructor(input) === Number && !Number.isNaN(input);\nconst isString = input => getConstructor(input) === String;\nconst isBoolean = input => getConstructor(input) === Boolean;\nconst isFunction = input => getConstructor(input) === Function;\nconst isArray = input => Array.isArray(input);\nconst isWeakMap = input => instanceOf(input, WeakMap);\nconst isNodeList = input => instanceOf(input, NodeList);\nconst isElement = input => instanceOf(input, Element);\nconst isTextNode = input => getConstructor(input) === Text;\nconst isEvent = input => instanceOf(input, Event);\nconst isKeyboardEvent = input => instanceOf(input, KeyboardEvent);\nconst isCue = input => instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);\nconst isTrack = input => instanceOf(input, TextTrack) || (!isNullOrUndefined(input) && isString(input.kind));\nconst isPromise = input => instanceOf(input, Promise);\n\nconst isEmpty = input =>\n    isNullOrUndefined(input) ||\n    ((isString(input) || isArray(input) || isNodeList(input)) && !input.length) ||\n    (isObject(input) && !Object.keys(input).length);\n\nconst isUrl = input => {\n    // Accept a URL object\n    if (instanceOf(input, window.URL)) {\n        return true;\n    }\n\n    // Must be string from here\n    if (!isString(input)) {\n        return false;\n    }\n\n    // Add the protocol if required\n    let string = input;\n    if (!input.startsWith('http://') || !input.startsWith('https://')) {\n        string = `http://${input}`;\n    }\n\n    try {\n        return !isEmpty(new URL(string).hostname);\n    } catch (e) {\n        return false;\n    }\n};\n\nexport default {\n    nullOrUndefined: isNullOrUndefined,\n    object: isObject,\n    number: isNumber,\n    string: isString,\n    boolean: isBoolean,\n    function: isFunction,\n    array: isArray,\n    weakMap: isWeakMap,\n    nodeList: isNodeList,\n    element: isElement,\n    textNode: isTextNode,\n    event: isEvent,\n    keyboardEvent: isKeyboardEvent,\n    cue: isCue,\n    track: isTrack,\n    promise: isPromise,\n    url: isUrl,\n    empty: isEmpty,\n};\n","// ==========================================================================\n// Browser sniffing\n// Unfortunately, due to mixed support, UA sniffing is required\n// ==========================================================================\n\nconst browser = {\n    isIE: /* @cc_on!@ */ false || !!document.documentMode,\n    isEdge: window.navigator.userAgent.includes('Edge'),\n    isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),\n    isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),\n    isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform),\n};\n\nexport default browser;\n","// ==========================================================================\n// Event utils\n// ==========================================================================\n\nimport is from './is';\n\n// Check for passive event listener support\n// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n// https://www.youtube.com/watch?v=NPM6172J22g\nconst supportsPassiveListeners = (() => {\n    // Test via a getter in the options object to see if the passive property is accessed\n    let supported = false;\n    try {\n        const options = Object.defineProperty({}, 'passive', {\n            get() {\n                supported = true;\n                return null;\n            },\n        });\n        window.addEventListener('test', null, options);\n        window.removeEventListener('test', null, options);\n    } catch (e) {\n        // Do nothing\n    }\n\n    return supported;\n})();\n\n// Toggle event listener\nexport function toggleListener(element, event, callback, toggle = false, passive = true, capture = false) {\n    // Bail if no element, event, or callback\n    if (!element || !('addEventListener' in element) || is.empty(event) || !is.function(callback)) {\n        return;\n    }\n\n    // Allow multiple events\n    const events = event.split(' ');\n    // Build options\n    // Default to just the capture boolean for browsers with no passive listener support\n    let options = capture;\n\n    // If passive events listeners are supported\n    if (supportsPassiveListeners) {\n        options = {\n            // Whether the listener can be passive (i.e. default never prevented)\n            passive,\n            // Whether the listener is a capturing listener or not\n            capture,\n        };\n    }\n\n    // If a single node is passed, bind the event listener\n    events.forEach(type => {\n        if (this && this.eventListeners && toggle) {\n            // Cache event listener\n            this.eventListeners.push({ element, type, callback, options });\n        }\n\n        element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);\n    });\n}\n\n// Bind event handler\nexport function on(element, events = '', callback, passive = true, capture = false) {\n    toggleListener.call(this, element, events, callback, true, passive, capture);\n}\n\n// Unbind event handler\nexport function off(element, events = '', callback, passive = true, capture = false) {\n    toggleListener.call(this, element, events, callback, false, passive, capture);\n}\n\n// Bind once-only event handler\nexport function once(element, events = '', callback, passive = true, capture = false) {\n    const onceCallback = (...args) => {\n        off(element, events, onceCallback, passive, capture);\n        callback.apply(this, args);\n    };\n\n    toggleListener.call(this, element, events, onceCallback, true, passive, capture);\n}\n\n// Trigger event\nexport function triggerEvent(element, type = '', bubbles = false, detail = {}) {\n    // Bail if no element\n    if (!is.element(element) || is.empty(type)) {\n        return;\n    }\n\n    // Create and dispatch the event\n    const event = new CustomEvent(type, {\n        bubbles,\n        detail: Object.assign({}, detail, {\n            plyr: this,\n        }),\n    });\n\n    // Dispatch the event\n    element.dispatchEvent(event);\n}\n\n// Unbind all cached event listeners\nexport function unbindListeners() {\n    if (this && this.eventListeners) {\n        this.eventListeners.forEach(item => {\n            const { element, type, callback, options } = item;\n            element.removeEventListener(type, callback, options);\n        });\n\n        this.eventListeners = [];\n    }\n}\n\n// Run method when / if player is ready\nexport function ready() {\n    return new Promise(resolve =>\n        this.ready ? setTimeout(resolve, 0) : on.call(this, this.elements.container, 'ready', resolve),\n    ).then(() => {});\n}\n","// ==========================================================================\n// Object utils\n// ==========================================================================\n\nimport is from './is';\n\n// Clone nested objects\nexport function cloneDeep(object) {\n    return JSON.parse(JSON.stringify(object));\n}\n\n// Get a nested value in an object\nexport function getDeep(object, path) {\n    return path.split('.').reduce((obj, key) => obj && obj[key], object);\n}\n\n// Deep extend destination object with N more objects\nexport function extend(target = {}, ...sources) {\n    if (!sources.length) {\n        return target;\n    }\n\n    const source = sources.shift();\n\n    if (!is.object(source)) {\n        return target;\n    }\n\n    Object.keys(source).forEach(key => {\n        if (is.object(source[key])) {\n            if (!Object.keys(target).includes(key)) {\n                Object.assign(target, { [key]: {} });\n            }\n\n            extend(target[key], source[key]);\n        } else {\n            Object.assign(target, { [key]: source[key] });\n        }\n    });\n\n    return extend(target, ...sources);\n}\n","// ==========================================================================\n// Element utils\n// ==========================================================================\n\nimport { toggleListener } from './events';\nimport is from './is';\nimport { extend } from './objects';\n\n// Wrap an element\nexport function wrap(elements, wrapper) {\n    // Convert `elements` to an array, if necessary.\n    const targets = elements.length ? elements : [elements];\n\n    // Loops backwards to prevent having to clone the wrapper on the\n    // first element (see `child` below).\n    Array.from(targets)\n        .reverse()\n        .forEach((element, index) => {\n            const child = index > 0 ? wrapper.cloneNode(true) : wrapper;\n            // Cache the current parent and sibling.\n            const parent = element.parentNode;\n            const sibling = element.nextSibling;\n\n            // Wrap the element (is automatically removed from its current\n            // parent).\n            child.appendChild(element);\n\n            // If the element had a sibling, insert the wrapper before\n            // the sibling to maintain the HTML structure; otherwise, just\n            // append it to the parent.\n            if (sibling) {\n                parent.insertBefore(child, sibling);\n            } else {\n                parent.appendChild(child);\n            }\n        });\n}\n\n// Set attributes\nexport function setAttributes(element, attributes) {\n    if (!is.element(element) || is.empty(attributes)) {\n        return;\n    }\n\n    // Assume null and undefined attributes should be left out,\n    // Setting them would otherwise convert them to \"null\" and \"undefined\"\n    Object.entries(attributes)\n        .filter(([, value]) => !is.nullOrUndefined(value))\n        .forEach(([key, value]) => element.setAttribute(key, value));\n}\n\n// Create a DocumentFragment\nexport function createElement(type, attributes, text) {\n    // Create a new <element>\n    const element = document.createElement(type);\n\n    // Set all passed attributes\n    if (is.object(attributes)) {\n        setAttributes(element, attributes);\n    }\n\n    // Add text node\n    if (is.string(text)) {\n        element.innerText = text;\n    }\n\n    // Return built element\n    return element;\n}\n\n// Inaert an element after another\nexport function insertAfter(element, target) {\n    if (!is.element(element) || !is.element(target)) {\n        return;\n    }\n\n    target.parentNode.insertBefore(element, target.nextSibling);\n}\n\n// Insert a DocumentFragment\nexport function insertElement(type, parent, attributes, text) {\n    if (!is.element(parent)) {\n        return;\n    }\n\n    parent.appendChild(createElement(type, attributes, text));\n}\n\n// Remove element(s)\nexport function removeElement(element) {\n    if (is.nodeList(element) || is.array(element)) {\n        Array.from(element).forEach(removeElement);\n        return;\n    }\n\n    if (!is.element(element) || !is.element(element.parentNode)) {\n        return;\n    }\n\n    element.parentNode.removeChild(element);\n}\n\n// Remove all child elements\nexport function emptyElement(element) {\n    if (!is.element(element)) {\n        return;\n    }\n\n    let { length } = element.childNodes;\n\n    while (length > 0) {\n        element.removeChild(element.lastChild);\n        length -= 1;\n    }\n}\n\n// Replace element\nexport function replaceElement(newChild, oldChild) {\n    if (!is.element(oldChild) || !is.element(oldChild.parentNode) || !is.element(newChild)) {\n        return null;\n    }\n\n    oldChild.parentNode.replaceChild(newChild, oldChild);\n\n    return newChild;\n}\n\n// Get an attribute object from a string selector\nexport function getAttributesFromSelector(sel, existingAttributes) {\n    // For example:\n    // '.test' to { class: 'test' }\n    // '#test' to { id: 'test' }\n    // '[data-test=\"test\"]' to { 'data-test': 'test' }\n\n    if (!is.string(sel) || is.empty(sel)) {\n        return {};\n    }\n\n    const attributes = {};\n    const existing = extend({}, existingAttributes);\n\n    sel.split(',').forEach(s => {\n        // Remove whitespace\n        const selector = s.trim();\n        const className = selector.replace('.', '');\n        const stripped = selector.replace(/[[\\]]/g, '');\n        // Get the parts and value\n        const parts = stripped.split('=');\n        const [key] = parts;\n        const value = parts.length > 1 ? parts[1].replace(/[\"']/g, '') : '';\n        // Get the first character\n        const start = selector.charAt(0);\n\n        switch (start) {\n            case '.':\n                // Add to existing classname\n                if (is.string(existing.class)) {\n                    attributes.class = `${existing.class} ${className}`;\n                } else {\n                    attributes.class = className;\n                }\n                break;\n\n            case '#':\n                // ID selector\n                attributes.id = selector.replace('#', '');\n                break;\n\n            case '[':\n                // Attribute selector\n                attributes[key] = value;\n\n                break;\n\n            default:\n                break;\n        }\n    });\n\n    return extend(existing, attributes);\n}\n\n// Toggle hidden\nexport function toggleHidden(element, hidden) {\n    if (!is.element(element)) {\n        return;\n    }\n\n    let hide = hidden;\n\n    if (!is.boolean(hide)) {\n        hide = !element.hidden;\n    }\n\n    // eslint-disable-next-line no-param-reassign\n    element.hidden = hide;\n}\n\n// Mirror Element.classList.toggle, with IE compatibility for \"force\" argument\nexport function toggleClass(element, className, force) {\n    if (is.nodeList(element)) {\n        return Array.from(element).map(e => toggleClass(e, className, force));\n    }\n\n    if (is.element(element)) {\n        let method = 'toggle';\n        if (typeof force !== 'undefined') {\n            method = force ? 'add' : 'remove';\n        }\n\n        element.classList[method](className);\n        return element.classList.contains(className);\n    }\n\n    return false;\n}\n\n// Has class name\nexport function hasClass(element, className) {\n    return is.element(element) && element.classList.contains(className);\n}\n\n// Element matches selector\nexport function matches(element, selector) {\n    const prototype = { Element };\n\n    function match() {\n        return Array.from(document.querySelectorAll(selector)).includes(this);\n    }\n\n    const method =\n        prototype.matches ||\n        prototype.webkitMatchesSelector ||\n        prototype.mozMatchesSelector ||\n        prototype.msMatchesSelector ||\n        match;\n\n    return method.call(element, selector);\n}\n\n// Find all elements\nexport function getElements(selector) {\n    return this.elements.container.querySelectorAll(selector);\n}\n\n// Find a single element\nexport function getElement(selector) {\n    return this.elements.container.querySelector(selector);\n}\n\n// Trap focus inside container\nexport function trapFocus(element = null, toggle = false) {\n    if (!is.element(element)) {\n        return;\n    }\n\n    const focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]');\n    const first = focusable[0];\n    const last = focusable[focusable.length - 1];\n\n    const trap = event => {\n        // Bail if not tab key or not fullscreen\n        if (event.key !== 'Tab' || event.keyCode !== 9) {\n            return;\n        }\n\n        // Get the current focused element\n        const focused = document.activeElement;\n\n        if (focused === last && !event.shiftKey) {\n            // Move focus to first element that can be tabbed if Shift isn't used\n            first.focus();\n            event.preventDefault();\n        } else if (focused === first && event.shiftKey) {\n            // Move focus to last element that can be tabbed if Shift is used\n            last.focus();\n            event.preventDefault();\n        }\n    };\n\n    toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false);\n}\n\n// Set focus and tab focus class\nexport function setFocus(element = null, tabFocus = false) {\n    if (!is.element(element)) {\n        return;\n    }\n\n    // Set regular focus\n    element.focus({ preventScroll: true });\n\n    // If we want to mimic keyboard focus via tab\n    if (tabFocus) {\n        toggleClass(element, this.config.classNames.tabFocus);\n    }\n}\n","// ==========================================================================\n// Plyr support checks\n// ==========================================================================\n\nimport { transitionEndEvent } from './utils/animation';\nimport browser from './utils/browser';\nimport { createElement } from './utils/elements';\nimport is from './utils/is';\n\n// Default codecs for checking mimetype support\nconst defaultCodecs = {\n    'audio/ogg': 'vorbis',\n    'audio/wav': '1',\n    'video/webm': 'vp8, vorbis',\n    'video/mp4': 'avc1.42E01E, mp4a.40.2',\n    'video/ogg': 'theora',\n};\n\n// Check for feature support\nconst support = {\n    // Basic support\n    audio: 'canPlayType' in document.createElement('audio'),\n    video: 'canPlayType' in document.createElement('video'),\n\n    // Check for support\n    // Basic functionality vs full UI\n    check(type, provider, playsinline) {\n        const canPlayInline = browser.isIPhone && playsinline && support.playsinline;\n        const api = support[type] || provider !== 'html5';\n        const ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);\n\n        return {\n            api,\n            ui,\n        };\n    },\n\n    // Picture-in-picture support\n    // Safari & Chrome only currently\n    pip: (() => {\n        if (browser.isIPhone) {\n            return false;\n        }\n\n        // Safari\n        // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls\n        if (is.function(createElement('video').webkitSetPresentationMode)) {\n            return true;\n        }\n\n        // Chrome\n        // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture\n        if (document.pictureInPictureEnabled && !createElement('video').disablePictureInPicture) {\n            return true;\n        }\n\n        return false;\n    })(),\n\n    // Airplay support\n    // Safari only currently\n    airplay: is.function(window.WebKitPlaybackTargetAvailabilityEvent),\n\n    // Inline playback support\n    // https://webkit.org/blog/6784/new-video-policies-for-ios/\n    playsinline: 'playsInline' in document.createElement('video'),\n\n    // Check for mime type support against a player instance\n    // Credits: http://diveintohtml5.info/everything.html\n    // Related: http://www.leanbackplayer.com/test/h5mt.html\n    mime(input) {\n        if (is.empty(input)) {\n            return false;\n        }\n\n        const [mediaType] = input.split('/');\n        let type = input;\n\n        // Verify we're using HTML5 and there's no media type mismatch\n        if (!this.isHTML5 || mediaType !== this.type) {\n            return false;\n        }\n\n        // Add codec if required\n        if (Object.keys(defaultCodecs).includes(type)) {\n            type += `; codecs=\"${defaultCodecs[input]}\"`;\n        }\n\n        try {\n            return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));\n        } catch (e) {\n            return false;\n        }\n    },\n\n    // Check for textTracks support\n    textTracks: 'textTracks' in document.createElement('video'),\n\n    // <input type=\"range\"> Sliders\n    rangeInput: (() => {\n        const range = document.createElement('input');\n        range.type = 'range';\n        return range.type === 'range';\n    })(),\n\n    // Touch\n    // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event\n    touch: 'ontouchstart' in document.documentElement,\n\n    // Detect transitions support\n    transitions: transitionEndEvent !== false,\n\n    // Reduced motion iOS & MacOS setting\n    // https://webkit.org/blog/7551/responsive-design-for-motion/\n    reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches,\n};\n\nexport default support;\n","// ==========================================================================\n// Style utils\n// ==========================================================================\n\nimport is from './is';\n\nexport function validateRatio(input) {\n    if (!is.array(input) && (!is.string(input) || !input.includes(':'))) {\n        return false;\n    }\n\n    const ratio = is.array(input) ? input : input.split(':');\n\n    return ratio.map(Number).every(is.number);\n}\n\nexport function reduceAspectRatio(ratio) {\n    if (!is.array(ratio) || !ratio.every(is.number)) {\n        return null;\n    }\n\n    const [width, height] = ratio;\n    const getDivider = (w, h) => (h === 0 ? w : getDivider(h, w % h));\n    const divider = getDivider(width, height);\n\n    return [width / divider, height / divider];\n}\n\nexport function getAspectRatio(input) {\n    const parse = ratio => (validateRatio(ratio) ? ratio.split(':').map(Number) : null);\n    // Try provided ratio\n    let ratio = parse(input);\n\n    // Get from config\n    if (ratio === null) {\n        ratio = parse(this.config.ratio);\n    }\n\n    // Get from embed\n    if (ratio === null && !is.empty(this.embed) && is.array(this.embed.ratio)) {\n        ({ ratio } = this.embed);\n    }\n\n    // Get from HTML5 video\n    if (ratio === null && this.isHTML5) {\n        const { videoWidth, videoHeight } = this.media;\n        ratio = reduceAspectRatio([videoWidth, videoHeight]);\n    }\n\n    return ratio;\n}\n\n// Set aspect ratio for responsive container\nexport function setAspectRatio(input) {\n    if (!this.isVideo) {\n        return {};\n    }\n\n    const ratio = getAspectRatio.call(this, input);\n    const [w, h] = is.array(ratio) ? ratio : [0, 0];\n    const padding = (100 / w) * h;\n\n    this.elements.wrapper.style.paddingBottom = `${padding}%`;\n\n    // For Vimeo we have an extra <div> to hide the standard controls and UI\n    if (this.isVimeo && this.supported.ui) {\n        const height = 240;\n        const offset = (height - padding) / (height / 50);\n        this.media.style.transform = `translateY(-${offset}%)`;\n    } else if (this.isHTML5) {\n        this.elements.wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);\n    }\n\n    return { padding, ratio };\n}\n\nexport default { setAspectRatio };\n","// ==========================================================================\n// Plyr HTML5 helpers\n// ==========================================================================\n\nimport support from './support';\nimport { removeElement } from './utils/elements';\nimport { triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { setAspectRatio } from './utils/style';\n\nconst html5 = {\n    getSources() {\n        if (!this.isHTML5) {\n            return [];\n        }\n\n        const sources = Array.from(this.media.querySelectorAll('source'));\n\n        // Filter out unsupported sources (if type is specified)\n        return sources.filter(source => {\n            const type = source.getAttribute('type');\n\n            if (is.empty(type)) {\n                return true;\n            }\n\n            return support.mime.call(this, type);\n        });\n    },\n\n    // Get quality levels\n    getQualityOptions() {\n        // Get sizes from <source> elements\n        return html5.getSources\n            .call(this)\n            .map(source => Number(source.getAttribute('size')))\n            .filter(Boolean);\n    },\n\n    extend() {\n        if (!this.isHTML5) {\n            return;\n        }\n\n        const player = this;\n\n        // Set aspect ratio if fixed\n        if (!is.empty(this.config.ratio)) {\n            setAspectRatio.call(player);\n        }\n\n        // Quality\n        Object.defineProperty(player.media, 'quality', {\n            get() {\n                // Get sources\n                const sources = html5.getSources.call(player);\n                const source = sources.find(s => s.getAttribute('src') === player.source);\n\n                // Return size, if match is found\n                return source && Number(source.getAttribute('size'));\n            },\n            set(input) {\n                // Get sources\n                const sources = html5.getSources.call(player);\n                // Get first match for requested size\n                const source = sources.find(s => Number(s.getAttribute('size')) === input);\n\n                // No matching source found\n                if (!source) {\n                    return;\n                }\n\n                // Get current state\n                const { currentTime, paused, preload, readyState } = player.media;\n\n                // Set new source\n                player.media.src = source.getAttribute('src');\n\n                // Prevent loading if preload=\"none\" and the current source isn't loaded (#1044)\n                if (preload !== 'none' || readyState) {\n                    // Restore time\n                    player.once('loadedmetadata', () => {\n                        player.currentTime = currentTime;\n\n                        // Resume playing\n                        if (!paused) {\n                            player.play();\n                        }\n                    });\n\n                    // Load new source\n                    player.media.load();\n                }\n\n                // Trigger change event\n                triggerEvent.call(player, player.media, 'qualitychange', false, {\n                    quality: input,\n                });\n            },\n        });\n    },\n\n    // Cancel current network requests\n    // See https://github.com/sampotts/plyr/issues/174\n    cancelRequests() {\n        if (!this.isHTML5) {\n            return;\n        }\n\n        // Remove child sources\n        removeElement(html5.getSources.call(this));\n\n        // Set blank video src attribute\n        // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error\n        // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection\n        this.media.setAttribute('src', this.config.blankVideo);\n\n        // Load the new empty source\n        // This will cancel existing requests\n        // See https://github.com/sampotts/plyr/issues/174\n        this.media.load();\n\n        // Debugging\n        this.debug.log('Cancelled network requests');\n    },\n};\n\nexport default html5;\n","// ==========================================================================\n// Array utils\n// ==========================================================================\n\nimport is from './is';\n\n// Remove duplicates in an array\nexport function dedupe(array) {\n    if (!is.array(array)) {\n        return array;\n    }\n\n    return array.filter((item, index) => array.indexOf(item) === index);\n}\n\n// Get the closest value in an array\nexport function closest(array, value) {\n    if (!is.array(array) || !array.length) {\n        return null;\n    }\n\n    return array.reduce((prev, curr) => (Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev));\n}\n","// ==========================================================================\n// String utils\n// ==========================================================================\n\nimport is from './is';\n\n// Generate a random ID\nexport function generateId(prefix) {\n    return `${prefix}-${Math.floor(Math.random() * 10000)}`;\n}\n\n// Format string\nexport function format(input, ...args) {\n    if (is.empty(input)) {\n        return input;\n    }\n\n    return input.toString().replace(/{(\\d+)}/g, (match, i) => args[i].toString());\n}\n\n// Get percentage\nexport function getPercentage(current, max) {\n    if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {\n        return 0;\n    }\n\n    return ((current / max) * 100).toFixed(2);\n}\n\n// Replace all occurances of a string in a string\nexport function replaceAll(input = '', find = '', replace = '') {\n    return input.replace(\n        new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1'), 'g'),\n        replace.toString(),\n    );\n}\n\n// Convert to title case\nexport function toTitleCase(input = '') {\n    return input.toString().replace(/\\w\\S*/g, text => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase());\n}\n\n// Convert string to pascalCase\nexport function toPascalCase(input = '') {\n    let string = input.toString();\n\n    // Convert kebab case\n    string = replaceAll(string, '-', ' ');\n\n    // Convert snake case\n    string = replaceAll(string, '_', ' ');\n\n    // Convert to title case\n    string = toTitleCase(string);\n\n    // Convert to pascal case\n    return replaceAll(string, ' ', '');\n}\n\n// Convert string to pascalCase\nexport function toCamelCase(input = '') {\n    let string = input.toString();\n\n    // Convert to pascal case\n    string = toPascalCase(string);\n\n    // Convert first character to lowercase\n    return string.charAt(0).toLowerCase() + string.slice(1);\n}\n\n// Remove HTML from a string\nexport function stripHTML(source) {\n    const fragment = document.createDocumentFragment();\n    const element = document.createElement('div');\n    fragment.appendChild(element);\n    element.innerHTML = source;\n    return fragment.firstChild.innerText;\n}\n\n// Like outerHTML, but also works for DocumentFragment\nexport function getHTML(element) {\n    const wrapper = document.createElement('div');\n    wrapper.appendChild(element);\n    return wrapper.innerHTML;\n}\n","// ==========================================================================\n// Plyr internationalization\n// ==========================================================================\n\nimport is from './is';\nimport { getDeep } from './objects';\nimport { replaceAll } from './strings';\n\n// Skip i18n for abbreviations and brand names\nconst resources = {\n    pip: 'PIP',\n    airplay: 'AirPlay',\n    html5: 'HTML5',\n    vimeo: 'Vimeo',\n    youtube: 'YouTube',\n};\n\nconst i18n = {\n    get(key = '', config = {}) {\n        if (is.empty(key) || is.empty(config)) {\n            return '';\n        }\n\n        let string = getDeep(config.i18n, key);\n\n        if (is.empty(string)) {\n            if (Object.keys(resources).includes(key)) {\n                return resources[key];\n            }\n\n            return '';\n        }\n\n        const replace = {\n            '{seektime}': config.seekTime,\n            '{title}': config.title,\n        };\n\n        Object.entries(replace).forEach(([k, v]) => {\n            string = replaceAll(string, k, v);\n        });\n\n        return string;\n    },\n};\n\nexport default i18n;\n","// ==========================================================================\n// Plyr storage\n// ==========================================================================\n\nimport is from './utils/is';\nimport { extend } from './utils/objects';\n\nclass Storage {\n    constructor(player) {\n        this.enabled = player.config.storage.enabled;\n        this.key = player.config.storage.key;\n    }\n\n    // Check for actual support (see if we can use it)\n    static get supported() {\n        try {\n            if (!('localStorage' in window)) {\n                return false;\n            }\n\n            const test = '___test';\n\n            // Try to use it (it might be disabled, e.g. user is in private mode)\n            // see: https://github.com/sampotts/plyr/issues/131\n            window.localStorage.setItem(test, test);\n            window.localStorage.removeItem(test);\n\n            return true;\n        } catch (e) {\n            return false;\n        }\n    }\n\n    get(key) {\n        if (!Storage.supported || !this.enabled) {\n            return null;\n        }\n\n        const store = window.localStorage.getItem(this.key);\n\n        if (is.empty(store)) {\n            return null;\n        }\n\n        const json = JSON.parse(store);\n\n        return is.string(key) && key.length ? json[key] : json;\n    }\n\n    set(object) {\n        // Bail if we don't have localStorage support or it's disabled\n        if (!Storage.supported || !this.enabled) {\n            return;\n        }\n\n        // Can only store objectst\n        if (!is.object(object)) {\n            return;\n        }\n\n        // Get current storage\n        let storage = this.get();\n\n        // Default to empty object\n        if (is.empty(storage)) {\n            storage = {};\n        }\n\n        // Update the working copy of the values\n        extend(storage, object);\n\n        // Update storage\n        window.localStorage.setItem(this.key, JSON.stringify(storage));\n    }\n}\n\nexport default Storage;\n","// ==========================================================================\n// Fetch wrapper\n// Using XHR to avoid issues with older browsers\n// ==========================================================================\n\nexport default function fetch(url, responseType = 'text') {\n    return new Promise((resolve, reject) => {\n        try {\n            const request = new XMLHttpRequest();\n\n            // Check for CORS support\n            if (!('withCredentials' in request)) {\n                return;\n            }\n\n            request.addEventListener('load', () => {\n                if (responseType === 'text') {\n                    try {\n                        resolve(JSON.parse(request.responseText));\n                    } catch (e) {\n                        resolve(request.responseText);\n                    }\n                } else {\n                    resolve(request.response);\n                }\n            });\n\n            request.addEventListener('error', () => {\n                throw new Error(request.status);\n            });\n\n            request.open('GET', url, true);\n\n            // Set the required response type\n            request.responseType = responseType;\n\n            request.send();\n        } catch (e) {\n            reject(e);\n        }\n    });\n}\n","// ==========================================================================\n// Sprite loader\n// ==========================================================================\n\nimport Storage from '../storage';\nimport fetch from './fetch';\nimport is from './is';\n\n// Load an external SVG sprite\nexport default function loadSprite(url, id) {\n    if (!is.string(url)) {\n        return;\n    }\n\n    const prefix = 'cache';\n    const hasId = is.string(id);\n    let isCached = false;\n    const exists = () => document.getElementById(id) !== null;\n\n    const update = (container, data) => {\n        // eslint-disable-next-line no-param-reassign\n        container.innerHTML = data;\n\n        // Check again incase of race condition\n        if (hasId && exists()) {\n            return;\n        }\n\n        // Inject the SVG to the body\n        document.body.insertAdjacentElement('afterbegin', container);\n    };\n\n    // Only load once if ID set\n    if (!hasId || !exists()) {\n        const useStorage = Storage.supported;\n        // Create container\n        const container = document.createElement('div');\n        container.setAttribute('hidden', '');\n\n        if (hasId) {\n            container.setAttribute('id', id);\n        }\n\n        // Check in cache\n        if (useStorage) {\n            const cached = window.localStorage.getItem(`${prefix}-${id}`);\n            isCached = cached !== null;\n\n            if (isCached) {\n                const data = JSON.parse(cached);\n                update(container, data.content);\n            }\n        }\n\n        // Get the sprite\n        fetch(url)\n            .then(result => {\n                if (is.empty(result)) {\n                    return;\n                }\n\n                if (useStorage) {\n                    window.localStorage.setItem(\n                        `${prefix}-${id}`,\n                        JSON.stringify({\n                            content: result,\n                        }),\n                    );\n                }\n\n                update(container, result);\n            })\n            .catch(() => {});\n    }\n}\n","// ==========================================================================\n// Time utils\n// ==========================================================================\n\nimport is from './is';\n\n// Time helpers\nexport const getHours = value => Math.trunc((value / 60 / 60) % 60, 10);\nexport const getMinutes = value => Math.trunc((value / 60) % 60, 10);\nexport const getSeconds = value => Math.trunc(value % 60, 10);\n\n// Format time to UI friendly string\nexport function formatTime(time = 0, displayHours = false, inverted = false) {\n    // Bail if the value isn't a number\n    if (!is.number(time)) {\n        return formatTime(null, displayHours, inverted);\n    }\n\n    // Format time component to add leading zero\n    const format = value => `0${value}`.slice(-2);\n    // Breakdown to hours, mins, secs\n    let hours = getHours(time);\n    const mins = getMinutes(time);\n    const secs = getSeconds(time);\n\n    // Do we need to display hours?\n    if (displayHours || hours > 0) {\n        hours = `${hours}:`;\n    } else {\n        hours = '';\n    }\n\n    // Render\n    return `${inverted && time > 0 ? '-' : ''}${hours}${format(mins)}:${format(secs)}`;\n}\n","// ==========================================================================\n// Plyr controls\n// TODO: This needs to be split into smaller files and cleaned up\n// ==========================================================================\n\nimport RangeTouch from 'rangetouch';\n\nimport captions from './captions';\nimport html5 from './html5';\nimport support from './support';\nimport { repaint, transitionEndEvent } from './utils/animation';\nimport { dedupe } from './utils/arrays';\nimport browser from './utils/browser';\nimport {\n    createElement,\n    emptyElement,\n    getAttributesFromSelector,\n    getElement,\n    getElements,\n    hasClass,\n    matches,\n    removeElement,\n    setAttributes,\n    setFocus,\n    toggleClass,\n    toggleHidden,\n} from './utils/elements';\nimport { off, on } from './utils/events';\nimport i18n from './utils/i18n';\nimport is from './utils/is';\nimport loadSprite from './utils/load-sprite';\nimport { extend } from './utils/objects';\nimport { getPercentage, replaceAll, toCamelCase, toTitleCase } from './utils/strings';\nimport { formatTime, getHours } from './utils/time';\n\n// TODO: Don't export a massive object - break down and create class\nconst controls = {\n    // Get icon URL\n    getIconUrl() {\n        const url = new URL(this.config.iconUrl, window.location);\n        const cors = url.host !== window.location.host || (browser.isIE && !window.svg4everybody);\n\n        return {\n            url: this.config.iconUrl,\n            cors,\n        };\n    },\n\n    // Find the UI controls\n    findElements() {\n        try {\n            this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper);\n\n            // Buttons\n            this.elements.buttons = {\n                play: getElements.call(this, this.config.selectors.buttons.play),\n                pause: getElement.call(this, this.config.selectors.buttons.pause),\n                restart: getElement.call(this, this.config.selectors.buttons.restart),\n                rewind: getElement.call(this, this.config.selectors.buttons.rewind),\n                fastForward: getElement.call(this, this.config.selectors.buttons.fastForward),\n                mute: getElement.call(this, this.config.selectors.buttons.mute),\n                pip: getElement.call(this, this.config.selectors.buttons.pip),\n                airplay: getElement.call(this, this.config.selectors.buttons.airplay),\n                settings: getElement.call(this, this.config.selectors.buttons.settings),\n                captions: getElement.call(this, this.config.selectors.buttons.captions),\n                fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen),\n            };\n\n            // Progress\n            this.elements.progress = getElement.call(this, this.config.selectors.progress);\n\n            // Inputs\n            this.elements.inputs = {\n                seek: getElement.call(this, this.config.selectors.inputs.seek),\n                volume: getElement.call(this, this.config.selectors.inputs.volume),\n            };\n\n            // Display\n            this.elements.display = {\n                buffer: getElement.call(this, this.config.selectors.display.buffer),\n                currentTime: getElement.call(this, this.config.selectors.display.currentTime),\n                duration: getElement.call(this, this.config.selectors.display.duration),\n            };\n\n            // Seek tooltip\n            if (is.element(this.elements.progress)) {\n                this.elements.display.seekTooltip = this.elements.progress.querySelector(\n                    `.${this.config.classNames.tooltip}`,\n                );\n            }\n\n            return true;\n        } catch (error) {\n            // Log it\n            this.debug.warn('It looks like there is a problem with your custom controls HTML', error);\n\n            // Restore native video controls\n            this.toggleNativeControls(true);\n\n            return false;\n        }\n    },\n\n    // Create <svg> icon\n    createIcon(type, attributes) {\n        const namespace = 'http://www.w3.org/2000/svg';\n        const iconUrl = controls.getIconUrl.call(this);\n        const iconPath = `${!iconUrl.cors ? iconUrl.url : ''}#${this.config.iconPrefix}`;\n        // Create <svg>\n        const icon = document.createElementNS(namespace, 'svg');\n        setAttributes(\n            icon,\n            extend(attributes, {\n                role: 'presentation',\n                focusable: 'false',\n            }),\n        );\n\n        // Create the <use> to reference sprite\n        const use = document.createElementNS(namespace, 'use');\n        const path = `${iconPath}-${type}`;\n\n        // Set `href` attributes\n        // https://github.com/sampotts/plyr/issues/460\n        // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href\n        if ('href' in use) {\n            use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);\n        }\n\n        // Always set the older attribute even though it's \"deprecated\" (it'll be around for ages)\n        use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path);\n\n        // Add <use> to <svg>\n        icon.appendChild(use);\n\n        return icon;\n    },\n\n    // Create hidden text label\n    createLabel(key, attr = {}) {\n        const text = i18n.get(key, this.config);\n\n        const attributes = Object.assign({}, attr, {\n            class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' '),\n        });\n\n        return createElement('span', attributes, text);\n    },\n\n    // Create a badge\n    createBadge(text) {\n        if (is.empty(text)) {\n            return null;\n        }\n\n        const badge = createElement('span', {\n            class: this.config.classNames.menu.value,\n        });\n\n        badge.appendChild(\n            createElement(\n                'span',\n                {\n                    class: this.config.classNames.menu.badge,\n                },\n                text,\n            ),\n        );\n\n        return badge;\n    },\n\n    // Create a <button>\n    createButton(buttonType, attr) {\n        const attributes = extend({}, attr);\n        let type = toCamelCase(buttonType);\n\n        const props = {\n            element: 'button',\n            toggle: false,\n            label: null,\n            icon: null,\n            labelPressed: null,\n            iconPressed: null,\n        };\n\n        ['element', 'icon', 'label'].forEach(key => {\n            if (Object.keys(attributes).includes(key)) {\n                props[key] = attributes[key];\n                delete attributes[key];\n            }\n        });\n\n        // Default to 'button' type to prevent form submission\n        if (props.element === 'button' && !Object.keys(attributes).includes('type')) {\n            attributes.type = 'button';\n        }\n\n        // Set class name\n        if (Object.keys(attributes).includes('class')) {\n            if (!attributes.class.split(' ').some(c => c === this.config.classNames.control)) {\n                extend(attributes, {\n                    class: `${attributes.class} ${this.config.classNames.control}`,\n                });\n            }\n        } else {\n            attributes.class = this.config.classNames.control;\n        }\n\n        // Large play button\n        switch (buttonType) {\n            case 'play':\n                props.toggle = true;\n                props.label = 'play';\n                props.labelPressed = 'pause';\n                props.icon = 'play';\n                props.iconPressed = 'pause';\n                break;\n\n            case 'mute':\n                props.toggle = true;\n                props.label = 'mute';\n                props.labelPressed = 'unmute';\n                props.icon = 'volume';\n                props.iconPressed = 'muted';\n                break;\n\n            case 'captions':\n                props.toggle = true;\n                props.label = 'enableCaptions';\n                props.labelPressed = 'disableCaptions';\n                props.icon = 'captions-off';\n                props.iconPressed = 'captions-on';\n                break;\n\n            case 'fullscreen':\n                props.toggle = true;\n                props.label = 'enterFullscreen';\n                props.labelPressed = 'exitFullscreen';\n                props.icon = 'enter-fullscreen';\n                props.iconPressed = 'exit-fullscreen';\n                break;\n\n            case 'play-large':\n                attributes.class += ` ${this.config.classNames.control}--overlaid`;\n                type = 'play';\n                props.label = 'play';\n                props.icon = 'play';\n                break;\n\n            default:\n                if (is.empty(props.label)) {\n                    props.label = type;\n                }\n                if (is.empty(props.icon)) {\n                    props.icon = buttonType;\n                }\n        }\n\n        const button = createElement(props.element);\n\n        // Setup toggle icon and labels\n        if (props.toggle) {\n            // Icon\n            button.appendChild(\n                controls.createIcon.call(this, props.iconPressed, {\n                    class: 'icon--pressed',\n                }),\n            );\n            button.appendChild(\n                controls.createIcon.call(this, props.icon, {\n                    class: 'icon--not-pressed',\n                }),\n            );\n\n            // Label/Tooltip\n            button.appendChild(\n                controls.createLabel.call(this, props.labelPressed, {\n                    class: 'label--pressed',\n                }),\n            );\n            button.appendChild(\n                controls.createLabel.call(this, props.label, {\n                    class: 'label--not-pressed',\n                }),\n            );\n        } else {\n            button.appendChild(controls.createIcon.call(this, props.icon));\n            button.appendChild(controls.createLabel.call(this, props.label));\n        }\n\n        // Merge and set attributes\n        extend(attributes, getAttributesFromSelector(this.config.selectors.buttons[type], attributes));\n        setAttributes(button, attributes);\n\n        // We have multiple play buttons\n        if (type === 'play') {\n            if (!is.array(this.elements.buttons[type])) {\n                this.elements.buttons[type] = [];\n            }\n\n            this.elements.buttons[type].push(button);\n        } else {\n            this.elements.buttons[type] = button;\n        }\n\n        return button;\n    },\n\n    // Create an <input type='range'>\n    createRange(type, attributes) {\n        // Seek input\n        const input = createElement(\n            'input',\n            extend(\n                getAttributesFromSelector(this.config.selectors.inputs[type]),\n                {\n                    type: 'range',\n                    min: 0,\n                    max: 100,\n                    step: 0.01,\n                    value: 0,\n                    autocomplete: 'off',\n                    // A11y fixes for https://github.com/sampotts/plyr/issues/905\n                    role: 'slider',\n                    'aria-label': i18n.get(type, this.config),\n                    'aria-valuemin': 0,\n                    'aria-valuemax': 100,\n                    'aria-valuenow': 0,\n                },\n                attributes,\n            ),\n        );\n\n        this.elements.inputs[type] = input;\n\n        // Set the fill for webkit now\n        controls.updateRangeFill.call(this, input);\n\n        // Improve support on touch devices\n        RangeTouch.setup(input);\n\n        return input;\n    },\n\n    // Create a <progress>\n    createProgress(type, attributes) {\n        const progress = createElement(\n            'progress',\n            extend(\n                getAttributesFromSelector(this.config.selectors.display[type]),\n                {\n                    min: 0,\n                    max: 100,\n                    value: 0,\n                    role: 'progressbar',\n                    'aria-hidden': true,\n                },\n                attributes,\n            ),\n        );\n\n        // Create the label inside\n        if (type !== 'volume') {\n            progress.appendChild(createElement('span', null, '0'));\n\n            const suffixKey = {\n                played: 'played',\n                buffer: 'buffered',\n            }[type];\n            const suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';\n\n            progress.innerText = `% ${suffix.toLowerCase()}`;\n        }\n\n        this.elements.display[type] = progress;\n\n        return progress;\n    },\n\n    // Create time display\n    createTime(type, attrs) {\n        const attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);\n\n        const container = createElement(\n            'div',\n            extend(attributes, {\n                class: `${attributes.class ? attributes.class : ''} ${this.config.classNames.display.time} `.trim(),\n                'aria-label': i18n.get(type, this.config),\n            }),\n            '00:00',\n        );\n\n        // Reference for updates\n        this.elements.display[type] = container;\n\n        return container;\n    },\n\n    // Bind keyboard shortcuts for a menu item\n    // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus\n    // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143\n    bindMenuItemShortcuts(menuItem, type) {\n        // Navigate through menus via arrow keys and space\n        on(\n            menuItem,\n            'keydown keyup',\n            event => {\n                // We only care about space and ⬆️ ⬇️️ ➡️\n                if (![32, 38, 39, 40].includes(event.which)) {\n                    return;\n                }\n\n                // Prevent play / seek\n                event.preventDefault();\n                event.stopPropagation();\n\n                // We're just here to prevent the keydown bubbling\n                if (event.type === 'keydown') {\n                    return;\n                }\n\n                const isRadioButton = matches(menuItem, '[role=\"menuitemradio\"]');\n\n                // Show the respective menu\n                if (!isRadioButton && [32, 39].includes(event.which)) {\n                    controls.showMenuPanel.call(this, type, true);\n                } else {\n                    let target;\n\n                    if (event.which !== 32) {\n                        if (event.which === 40 || (isRadioButton && event.which === 39)) {\n                            target = menuItem.nextElementSibling;\n\n                            if (!is.element(target)) {\n                                target = menuItem.parentNode.firstElementChild;\n                            }\n                        } else {\n                            target = menuItem.previousElementSibling;\n\n                            if (!is.element(target)) {\n                                target = menuItem.parentNode.lastElementChild;\n                            }\n                        }\n\n                        setFocus.call(this, target, true);\n                    }\n                }\n            },\n            false,\n        );\n\n        // Enter will fire a `click` event but we still need to manage focus\n        // So we bind to keyup which fires after and set focus here\n        on(menuItem, 'keyup', event => {\n            if (event.which !== 13) {\n                return;\n            }\n\n            controls.focusFirstMenuItem.call(this, null, true);\n        });\n    },\n\n    // Create a settings menu item\n    createMenuItem({ value, list, type, title, badge = null, checked = false }) {\n        const attributes = getAttributesFromSelector(this.config.selectors.inputs[type]);\n\n        const menuItem = createElement(\n            'button',\n            extend(attributes, {\n                type: 'button',\n                role: 'menuitemradio',\n                class: `${this.config.classNames.control} ${attributes.class ? attributes.class : ''}`.trim(),\n                'aria-checked': checked,\n                value,\n            }),\n        );\n\n        const flex = createElement('span');\n\n        // We have to set as HTML incase of special characters\n        flex.innerHTML = title;\n\n        if (is.element(badge)) {\n            flex.appendChild(badge);\n        }\n\n        menuItem.appendChild(flex);\n\n        // Replicate radio button behaviour\n        Object.defineProperty(menuItem, 'checked', {\n            enumerable: true,\n            get() {\n                return menuItem.getAttribute('aria-checked') === 'true';\n            },\n            set(check) {\n                // Ensure exclusivity\n                if (check) {\n                    Array.from(menuItem.parentNode.children)\n                        .filter(node => matches(node, '[role=\"menuitemradio\"]'))\n                        .forEach(node => node.setAttribute('aria-checked', 'false'));\n                }\n\n                menuItem.setAttribute('aria-checked', check ? 'true' : 'false');\n            },\n        });\n\n        this.listeners.bind(\n            menuItem,\n            'click keyup',\n            event => {\n                if (is.keyboardEvent(event) && event.which !== 32) {\n                    return;\n                }\n\n                event.preventDefault();\n                event.stopPropagation();\n\n                menuItem.checked = true;\n\n                switch (type) {\n                    case 'language':\n                        this.currentTrack = Number(value);\n                        break;\n\n                    case 'quality':\n                        this.quality = value;\n                        break;\n\n                    case 'speed':\n                        this.speed = parseFloat(value);\n                        break;\n\n                    default:\n                        break;\n                }\n\n                controls.showMenuPanel.call(this, 'home', is.keyboardEvent(event));\n            },\n            type,\n            false,\n        );\n\n        controls.bindMenuItemShortcuts.call(this, menuItem, type);\n\n        list.appendChild(menuItem);\n    },\n\n    // Format a time for display\n    formatTime(time = 0, inverted = false) {\n        // Bail if the value isn't a number\n        if (!is.number(time)) {\n            return time;\n        }\n\n        // Always display hours if duration is over an hour\n        const forceHours = getHours(this.duration) > 0;\n\n        return formatTime(time, forceHours, inverted);\n    },\n\n    // Update the displayed time\n    updateTimeDisplay(target = null, time = 0, inverted = false) {\n        // Bail if there's no element to display or the value isn't a number\n        if (!is.element(target) || !is.number(time)) {\n            return;\n        }\n\n        // eslint-disable-next-line no-param-reassign\n        target.innerText = controls.formatTime(time, inverted);\n    },\n\n    // Update volume UI and storage\n    updateVolume() {\n        if (!this.supported.ui) {\n            return;\n        }\n\n        // Update range\n        if (is.element(this.elements.inputs.volume)) {\n            controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume);\n        }\n\n        // Update mute state\n        if (is.element(this.elements.buttons.mute)) {\n            this.elements.buttons.mute.pressed = this.muted || this.volume === 0;\n        }\n    },\n\n    // Update seek value and lower fill\n    setRange(target, value = 0) {\n        if (!is.element(target)) {\n            return;\n        }\n\n        // eslint-disable-next-line\n        target.value = value;\n\n        // Webkit range fill\n        controls.updateRangeFill.call(this, target);\n    },\n\n    // Update <progress> elements\n    updateProgress(event) {\n        if (!this.supported.ui || !is.event(event)) {\n            return;\n        }\n\n        let value = 0;\n\n        const setProgress = (target, input) => {\n            const val = is.number(input) ? input : 0;\n            const progress = is.element(target) ? target : this.elements.display.buffer;\n\n            // Update value and label\n            if (is.element(progress)) {\n                progress.value = val;\n\n                // Update text label inside\n                const label = progress.getElementsByTagName('span')[0];\n                if (is.element(label)) {\n                    label.childNodes[0].nodeValue = val;\n                }\n            }\n        };\n\n        if (event) {\n            switch (event.type) {\n                // Video playing\n                case 'timeupdate':\n                case 'seeking':\n                case 'seeked':\n                    value = getPercentage(this.currentTime, this.duration);\n\n                    // Set seek range value only if it's a 'natural' time event\n                    if (event.type === 'timeupdate') {\n                        controls.setRange.call(this, this.elements.inputs.seek, value);\n                    }\n\n                    break;\n\n                // Check buffer status\n                case 'playing':\n                case 'progress':\n                    setProgress(this.elements.display.buffer, this.buffered * 100);\n\n                    break;\n\n                default:\n                    break;\n            }\n        }\n    },\n\n    // Webkit polyfill for lower fill range\n    updateRangeFill(target) {\n        // Get range from event if event passed\n        const range = is.event(target) ? target.target : target;\n\n        // Needs to be a valid <input type='range'>\n        if (!is.element(range) || range.getAttribute('type') !== 'range') {\n            return;\n        }\n\n        // Set aria values for https://github.com/sampotts/plyr/issues/905\n        if (matches(range, this.config.selectors.inputs.seek)) {\n            range.setAttribute('aria-valuenow', this.currentTime);\n            const currentTime = controls.formatTime(this.currentTime);\n            const duration = controls.formatTime(this.duration);\n            const format = i18n.get('seekLabel', this.config);\n            range.setAttribute(\n                'aria-valuetext',\n                format.replace('{currentTime}', currentTime).replace('{duration}', duration),\n            );\n        } else if (matches(range, this.config.selectors.inputs.volume)) {\n            const percent = range.value * 100;\n            range.setAttribute('aria-valuenow', percent);\n            range.setAttribute('aria-valuetext', `${percent.toFixed(1)}%`);\n        } else {\n            range.setAttribute('aria-valuenow', range.value);\n        }\n\n        // WebKit only\n        if (!browser.isWebkit) {\n            return;\n        }\n\n        // Set CSS custom property\n        range.style.setProperty('--value', `${(range.value / range.max) * 100}%`);\n    },\n\n    // Update hover tooltip for seeking\n    updateSeekTooltip(event) {\n        // Bail if setting not true\n        if (\n            !this.config.tooltips.seek ||\n            !is.element(this.elements.inputs.seek) ||\n            !is.element(this.elements.display.seekTooltip) ||\n            this.duration === 0\n        ) {\n            return;\n        }\n\n        const visible = `${this.config.classNames.tooltip}--visible`;\n        const toggle = show => toggleClass(this.elements.display.seekTooltip, visible, show);\n\n        // Hide on touch\n        if (this.touch) {\n            toggle(false);\n            return;\n        }\n\n        // Determine percentage, if already visible\n        let percent = 0;\n        const clientRect = this.elements.progress.getBoundingClientRect();\n\n        if (is.event(event)) {\n            percent = (100 / clientRect.width) * (event.pageX - clientRect.left);\n        } else if (hasClass(this.elements.display.seekTooltip, visible)) {\n            percent = parseFloat(this.elements.display.seekTooltip.style.left, 10);\n        } else {\n            return;\n        }\n\n        // Set bounds\n        if (percent < 0) {\n            percent = 0;\n        } else if (percent > 100) {\n            percent = 100;\n        }\n\n        // Display the time a click would seek to\n        controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, (this.duration / 100) * percent);\n\n        // Set position\n        this.elements.display.seekTooltip.style.left = `${percent}%`;\n\n        // Show/hide the tooltip\n        // If the event is a moues in/out and percentage is inside bounds\n        if (is.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) {\n            toggle(event.type === 'mouseenter');\n        }\n    },\n\n    // Handle time change event\n    timeUpdate(event) {\n        // Only invert if only one time element is displayed and used for both duration and currentTime\n        const invert = !is.element(this.elements.display.duration) && this.config.invertTime;\n\n        // Duration\n        controls.updateTimeDisplay.call(\n            this,\n            this.elements.display.currentTime,\n            invert ? this.duration - this.currentTime : this.currentTime,\n            invert,\n        );\n\n        // Ignore updates while seeking\n        if (event && event.type === 'timeupdate' && this.media.seeking) {\n            return;\n        }\n\n        // Playing progress\n        controls.updateProgress.call(this, event);\n    },\n\n    // Show the duration on metadataloaded or durationchange events\n    durationUpdate() {\n        // Bail if no UI or durationchange event triggered after playing/seek when invertTime is false\n        if (!this.supported.ui || (!this.config.invertTime && this.currentTime)) {\n            return;\n        }\n\n        // If duration is the 2**32 (shaka), Infinity (HLS), DASH-IF (Number.MAX_SAFE_INTEGER || Number.MAX_VALUE) indicating live we hide the currentTime and progressbar.\n        // https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415\n        // https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062\n        // https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338\n        if (this.duration >= 2 ** 32) {\n            toggleHidden(this.elements.display.currentTime, true);\n            toggleHidden(this.elements.progress, true);\n            return;\n        }\n\n        // Update ARIA values\n        if (is.element(this.elements.inputs.seek)) {\n            this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);\n        }\n\n        // If there's a spot to display duration\n        const hasDuration = is.element(this.elements.display.duration);\n\n        // If there's only one time display, display duration there\n        if (!hasDuration && this.config.displayDuration && this.paused) {\n            controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration);\n        }\n\n        // If there's a duration element, update content\n        if (hasDuration) {\n            controls.updateTimeDisplay.call(this, this.elements.display.duration, this.duration);\n        }\n\n        // Update the tooltip (if visible)\n        controls.updateSeekTooltip.call(this);\n    },\n\n    // Hide/show a tab\n    toggleMenuButton(setting, toggle) {\n        toggleHidden(this.elements.settings.buttons[setting], !toggle);\n    },\n\n    // Update the selected setting\n    updateSetting(setting, container, input) {\n        const pane = this.elements.settings.panels[setting];\n        let value = null;\n        let list = container;\n\n        if (setting === 'captions') {\n            value = this.currentTrack;\n        } else {\n            value = !is.empty(input) ? input : this[setting];\n\n            // Get default\n            if (is.empty(value)) {\n                value = this.config[setting].default;\n            }\n\n            // Unsupported value\n            if (!is.empty(this.options[setting]) && !this.options[setting].includes(value)) {\n                this.debug.warn(`Unsupported value of '${value}' for ${setting}`);\n                return;\n            }\n\n            // Disabled value\n            if (!this.config[setting].options.includes(value)) {\n                this.debug.warn(`Disabled value of '${value}' for ${setting}`);\n                return;\n            }\n        }\n\n        // Get the list if we need to\n        if (!is.element(list)) {\n            list = pane && pane.querySelector('[role=\"menu\"]');\n        }\n\n        // If there's no list it means it's not been rendered...\n        if (!is.element(list)) {\n            return;\n        }\n\n        // Update the label\n        const label = this.elements.settings.buttons[setting].querySelector(`.${this.config.classNames.menu.value}`);\n        label.innerHTML = controls.getLabel.call(this, setting, value);\n\n        // Find the radio option and check it\n        const target = list && list.querySelector(`[value=\"${value}\"]`);\n\n        if (is.element(target)) {\n            target.checked = true;\n        }\n    },\n\n    // Translate a value into a nice label\n    getLabel(setting, value) {\n        switch (setting) {\n            case 'speed':\n                return value === 1 ? i18n.get('normal', this.config) : `${value}&times;`;\n\n            case 'quality':\n                if (is.number(value)) {\n                    const label = i18n.get(`qualityLabel.${value}`, this.config);\n\n                    if (!label.length) {\n                        return `${value}p`;\n                    }\n\n                    return label;\n                }\n\n                return toTitleCase(value);\n\n            case 'captions':\n                return captions.getLabel.call(this);\n\n            default:\n                return null;\n        }\n    },\n\n    // Set the quality menu\n    setQualityMenu(options) {\n        // Menu required\n        if (!is.element(this.elements.settings.panels.quality)) {\n            return;\n        }\n\n        const type = 'quality';\n        const list = this.elements.settings.panels.quality.querySelector('[role=\"menu\"]');\n\n        // Set options if passed and filter based on uniqueness and config\n        if (is.array(options)) {\n            this.options.quality = dedupe(options).filter(quality => this.config.quality.options.includes(quality));\n        }\n\n        // Toggle the pane and tab\n        const toggle = !is.empty(this.options.quality) && this.options.quality.length > 1;\n        controls.toggleMenuButton.call(this, type, toggle);\n\n        // Empty the menu\n        emptyElement(list);\n\n        // Check if we need to toggle the parent\n        controls.checkMenu.call(this);\n\n        // If we're hiding, nothing more to do\n        if (!toggle) {\n            return;\n        }\n\n        // Get the badge HTML for HD, 4K etc\n        const getBadge = quality => {\n            const label = i18n.get(`qualityBadge.${quality}`, this.config);\n\n            if (!label.length) {\n                return null;\n            }\n\n            return controls.createBadge.call(this, label);\n        };\n\n        // Sort options by the config and then render options\n        this.options.quality\n            .sort((a, b) => {\n                const sorting = this.config.quality.options;\n                return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;\n            })\n            .forEach(quality => {\n                controls.createMenuItem.call(this, {\n                    value: quality,\n                    list,\n                    type,\n                    title: controls.getLabel.call(this, 'quality', quality),\n                    badge: getBadge(quality),\n                });\n            });\n\n        controls.updateSetting.call(this, type, list);\n    },\n\n    // Set the looping options\n    /* setLoopMenu() {\n        // Menu required\n        if (!is.element(this.elements.settings.panels.loop)) {\n            return;\n        }\n\n        const options = ['start', 'end', 'all', 'reset'];\n        const list = this.elements.settings.panels.loop.querySelector('[role=\"menu\"]');\n\n        // Show the pane and tab\n        toggleHidden(this.elements.settings.buttons.loop, false);\n        toggleHidden(this.elements.settings.panels.loop, false);\n\n        // Toggle the pane and tab\n        const toggle = !is.empty(this.loop.options);\n        controls.toggleMenuButton.call(this, 'loop', toggle);\n\n        // Empty the menu\n        emptyElement(list);\n\n        options.forEach(option => {\n            const item = createElement('li');\n\n            const button = createElement(\n                'button',\n                extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {\n                    type: 'button',\n                    class: this.config.classNames.control,\n                    'data-plyr-loop-action': option,\n                }),\n                i18n.get(option, this.config)\n            );\n\n            if (['start', 'end'].includes(option)) {\n                const badge = controls.createBadge.call(this, '00:00');\n                button.appendChild(badge);\n            }\n\n            item.appendChild(button);\n            list.appendChild(item);\n        });\n    }, */\n\n    // Get current selected caption language\n    // TODO: rework this to user the getter in the API?\n\n    // Set a list of available captions languages\n    setCaptionsMenu() {\n        // Menu required\n        if (!is.element(this.elements.settings.panels.captions)) {\n            return;\n        }\n\n        // TODO: Captions or language? Currently it's mixed\n        const type = 'captions';\n        const list = this.elements.settings.panels.captions.querySelector('[role=\"menu\"]');\n        const tracks = captions.getTracks.call(this);\n        const toggle = Boolean(tracks.length);\n\n        // Toggle the pane and tab\n        controls.toggleMenuButton.call(this, type, toggle);\n\n        // Empty the menu\n        emptyElement(list);\n\n        // Check if we need to toggle the parent\n        controls.checkMenu.call(this);\n\n        // If there's no captions, bail\n        if (!toggle) {\n            return;\n        }\n\n        // Generate options data\n        const options = tracks.map((track, value) => ({\n            value,\n            checked: this.captions.toggled && this.currentTrack === value,\n            title: captions.getLabel.call(this, track),\n            badge: track.language && controls.createBadge.call(this, track.language.toUpperCase()),\n            list,\n            type: 'language',\n        }));\n\n        // Add the \"Disabled\" option to turn off captions\n        options.unshift({\n            value: -1,\n            checked: !this.captions.toggled,\n            title: i18n.get('disabled', this.config),\n            list,\n            type: 'language',\n        });\n\n        // Generate options\n        options.forEach(controls.createMenuItem.bind(this));\n\n        controls.updateSetting.call(this, type, list);\n    },\n\n    // Set a list of available captions languages\n    setSpeedMenu(options) {\n        // Menu required\n        if (!is.element(this.elements.settings.panels.speed)) {\n            return;\n        }\n\n        const type = 'speed';\n        const list = this.elements.settings.panels.speed.querySelector('[role=\"menu\"]');\n\n        // Set the speed options\n        if (is.array(options)) {\n            this.options.speed = options;\n        } else if (this.isHTML5 || this.isVimeo) {\n            this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];\n        }\n\n        // Set options if passed and filter based on config\n        this.options.speed = this.options.speed.filter(speed => this.config.speed.options.includes(speed));\n\n        // Toggle the pane and tab\n        const toggle = !is.empty(this.options.speed) && this.options.speed.length > 1;\n        controls.toggleMenuButton.call(this, type, toggle);\n\n        // Empty the menu\n        emptyElement(list);\n\n        // Check if we need to toggle the parent\n        controls.checkMenu.call(this);\n\n        // If we're hiding, nothing more to do\n        if (!toggle) {\n            return;\n        }\n\n        // Create items\n        this.options.speed.forEach(speed => {\n            controls.createMenuItem.call(this, {\n                value: speed,\n                list,\n                type,\n                title: controls.getLabel.call(this, 'speed', speed),\n            });\n        });\n\n        controls.updateSetting.call(this, type, list);\n    },\n\n    // Check if we need to hide/show the settings menu\n    checkMenu() {\n        const { buttons } = this.elements.settings;\n        const visible = !is.empty(buttons) && Object.values(buttons).some(button => !button.hidden);\n\n        toggleHidden(this.elements.settings.menu, !visible);\n    },\n\n    // Focus the first menu item in a given (or visible) menu\n    focusFirstMenuItem(pane, tabFocus = false) {\n        if (this.elements.settings.popup.hidden) {\n            return;\n        }\n\n        let target = pane;\n\n        if (!is.element(target)) {\n            target = Object.values(this.elements.settings.panels).find(p => !p.hidden);\n        }\n\n        const firstItem = target.querySelector('[role^=\"menuitem\"]');\n\n        setFocus.call(this, firstItem, tabFocus);\n    },\n\n    // Show/hide menu\n    toggleMenu(input) {\n        const { popup } = this.elements.settings;\n        const button = this.elements.buttons.settings;\n\n        // Menu and button are required\n        if (!is.element(popup) || !is.element(button)) {\n            return;\n        }\n\n        // True toggle by default\n        const { hidden } = popup;\n        let show = hidden;\n\n        if (is.boolean(input)) {\n            show = input;\n        } else if (is.keyboardEvent(input) && input.which === 27) {\n            show = false;\n        } else if (is.event(input)) {\n            // If Plyr is in a shadowDOM, the event target is set to the component, instead of the\n            // Element in the shadowDOM. The path, if available, is complete.\n            const target = is.function(input.composedPath) ? input.composedPath()[0] : input.target;\n            const isMenuItem = popup.contains(target);\n\n            // If the click was inside the menu or if the click\n            // wasn't the button or menu item and we're trying to\n            // show the menu (a doc click shouldn't show the menu)\n            if (isMenuItem || (!isMenuItem && input.target !== button && show)) {\n                return;\n            }\n        }\n\n        // Set button attributes\n        button.setAttribute('aria-expanded', show);\n\n        // Show the actual popup\n        toggleHidden(popup, !show);\n\n        // Add class hook\n        toggleClass(this.elements.container, this.config.classNames.menu.open, show);\n\n        // Focus the first item if key interaction\n        if (show && is.keyboardEvent(input)) {\n            controls.focusFirstMenuItem.call(this, null, true);\n        } else if (!show && !hidden) {\n            // If closing, re-focus the button\n            setFocus.call(this, button, is.keyboardEvent(input));\n        }\n    },\n\n    // Get the natural size of a menu panel\n    getMenuSize(tab) {\n        const clone = tab.cloneNode(true);\n        clone.style.position = 'absolute';\n        clone.style.opacity = 0;\n        clone.removeAttribute('hidden');\n\n        // Append to parent so we get the \"real\" size\n        tab.parentNode.appendChild(clone);\n\n        // Get the sizes before we remove\n        const width = clone.scrollWidth;\n        const height = clone.scrollHeight;\n\n        // Remove from the DOM\n        removeElement(clone);\n\n        return {\n            width,\n            height,\n        };\n    },\n\n    // Show a panel in the menu\n    showMenuPanel(type = '', tabFocus = false) {\n        const target = this.elements.container.querySelector(`#plyr-settings-${this.id}-${type}`);\n\n        // Nothing to show, bail\n        if (!is.element(target)) {\n            return;\n        }\n\n        // Hide all other panels\n        const container = target.parentNode;\n        const current = Array.from(container.children).find(node => !node.hidden);\n\n        // If we can do fancy animations, we'll animate the height/width\n        if (support.transitions && !support.reducedMotion) {\n            // Set the current width as a base\n            container.style.width = `${current.scrollWidth}px`;\n            container.style.height = `${current.scrollHeight}px`;\n\n            // Get potential sizes\n            const size = controls.getMenuSize.call(this, target);\n\n            // Restore auto height/width\n            const restore = event => {\n                // We're only bothered about height and width on the container\n                if (event.target !== container || !['width', 'height'].includes(event.propertyName)) {\n                    return;\n                }\n\n                // Revert back to auto\n                container.style.width = '';\n                container.style.height = '';\n\n                // Only listen once\n                off.call(this, container, transitionEndEvent, restore);\n            };\n\n            // Listen for the transition finishing and restore auto height/width\n            on.call(this, container, transitionEndEvent, restore);\n\n            // Set dimensions to target\n            container.style.width = `${size.width}px`;\n            container.style.height = `${size.height}px`;\n        }\n\n        // Set attributes on current tab\n        toggleHidden(current, true);\n\n        // Set attributes on target\n        toggleHidden(target, false);\n\n        // Focus the first item\n        controls.focusFirstMenuItem.call(this, target, tabFocus);\n    },\n\n    // Set the download URL\n    setDownloadUrl() {\n        const button = this.elements.buttons.download;\n\n        // Bail if no button\n        if (!is.element(button)) {\n            return;\n        }\n\n        // Set attribute\n        button.setAttribute('href', this.download);\n    },\n\n    // Build the default HTML\n    create(data) {\n        const {\n            bindMenuItemShortcuts,\n            createButton,\n            createProgress,\n            createRange,\n            createTime,\n            setQualityMenu,\n            setSpeedMenu,\n            showMenuPanel,\n        } = controls;\n        this.elements.controls = null;\n\n        // Larger overlaid play button\n        if (this.config.controls.includes('play-large')) {\n            this.elements.container.appendChild(createButton.call(this, 'play-large'));\n        }\n\n        // Create the container\n        const container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));\n        this.elements.controls = container;\n\n        // Default item attributes\n        const defaultAttributes = { class: 'plyr__controls__item' };\n\n        // Loop through controls in order\n        dedupe(this.config.controls).forEach(control => {\n            // Restart button\n            if (control === 'restart') {\n                container.appendChild(createButton.call(this, 'restart', defaultAttributes));\n            }\n\n            // Rewind button\n            if (control === 'rewind') {\n                container.appendChild(createButton.call(this, 'rewind', defaultAttributes));\n            }\n\n            // Play/Pause button\n            if (control === 'play') {\n                container.appendChild(createButton.call(this, 'play', defaultAttributes));\n            }\n\n            // Fast forward button\n            if (control === 'fast-forward') {\n                container.appendChild(createButton.call(this, 'fast-forward', defaultAttributes));\n            }\n\n            // Progress\n            if (control === 'progress') {\n                const progressContainer = createElement('div', {\n                    class: `${defaultAttributes.class} plyr__progress__container`,\n                });\n\n                const progress = createElement('div', getAttributesFromSelector(this.config.selectors.progress));\n\n                // Seek range slider\n                progress.appendChild(\n                    createRange.call(this, 'seek', {\n                        id: `plyr-seek-${data.id}`,\n                    }),\n                );\n\n                // Buffer progress\n                progress.appendChild(createProgress.call(this, 'buffer'));\n\n                // TODO: Add loop display indicator\n\n                // Seek tooltip\n                if (this.config.tooltips.seek) {\n                    const tooltip = createElement(\n                        'span',\n                        {\n                            class: this.config.classNames.tooltip,\n                        },\n                        '00:00',\n                    );\n\n                    progress.appendChild(tooltip);\n                    this.elements.display.seekTooltip = tooltip;\n                }\n\n                this.elements.progress = progress;\n                progressContainer.appendChild(this.elements.progress);\n                container.appendChild(progressContainer);\n            }\n\n            // Media current time display\n            if (control === 'current-time') {\n                container.appendChild(createTime.call(this, 'currentTime', defaultAttributes));\n            }\n\n            // Media duration display\n            if (control === 'duration') {\n                container.appendChild(createTime.call(this, 'duration', defaultAttributes));\n            }\n\n            // Volume controls\n            if (control === 'mute' || control === 'volume') {\n                let { volume } = this.elements;\n\n                // Create the volume container if needed\n                if (!is.element(volume) || !container.contains(volume)) {\n                    volume = createElement(\n                        'div',\n                        extend({}, defaultAttributes, {\n                            class: `${defaultAttributes.class} plyr__volume`.trim(),\n                        }),\n                    );\n\n                    this.elements.volume = volume;\n\n                    container.appendChild(volume);\n                }\n\n                // Toggle mute button\n                if (control === 'mute') {\n                    volume.appendChild(createButton.call(this, 'mute'));\n                }\n\n                // Volume range control\n                if (control === 'volume') {\n                    // Set the attributes\n                    const attributes = {\n                        max: 1,\n                        step: 0.05,\n                        value: this.config.volume,\n                    };\n\n                    // Create the volume range slider\n                    volume.appendChild(\n                        createRange.call(\n                            this,\n                            'volume',\n                            extend(attributes, {\n                                id: `plyr-volume-${data.id}`,\n                            }),\n                        ),\n                    );\n                }\n            }\n\n            // Toggle captions button\n            if (control === 'captions') {\n                container.appendChild(createButton.call(this, 'captions', defaultAttributes));\n            }\n\n            // Settings button / menu\n            if (control === 'settings' && !is.empty(this.config.settings)) {\n                const wrapper = createElement(\n                    'div',\n                    extend({}, defaultAttributes, {\n                        class: `${defaultAttributes.class} plyr__menu`.trim(),\n                        hidden: '',\n                    }),\n                );\n\n                wrapper.appendChild(\n                    createButton.call(this, 'settings', {\n                        'aria-haspopup': true,\n                        'aria-controls': `plyr-settings-${data.id}`,\n                        'aria-expanded': false,\n                    }),\n                );\n\n                const popup = createElement('div', {\n                    class: 'plyr__menu__container',\n                    id: `plyr-settings-${data.id}`,\n                    hidden: '',\n                });\n\n                const inner = createElement('div');\n\n                const home = createElement('div', {\n                    id: `plyr-settings-${data.id}-home`,\n                });\n\n                // Create the menu\n                const menu = createElement('div', {\n                    role: 'menu',\n                });\n\n                home.appendChild(menu);\n                inner.appendChild(home);\n                this.elements.settings.panels.home = home;\n\n                // Build the menu items\n                this.config.settings.forEach(type => {\n                    // TODO: bundle this with the createMenuItem helper and bindings\n                    const menuItem = createElement(\n                        'button',\n                        extend(getAttributesFromSelector(this.config.selectors.buttons.settings), {\n                            type: 'button',\n                            class: `${this.config.classNames.control} ${this.config.classNames.control}--forward`,\n                            role: 'menuitem',\n                            'aria-haspopup': true,\n                            hidden: '',\n                        }),\n                    );\n\n                    // Bind menu shortcuts for keyboard users\n                    bindMenuItemShortcuts.call(this, menuItem, type);\n\n                    // Show menu on click\n                    on(menuItem, 'click', () => {\n                        showMenuPanel.call(this, type, false);\n                    });\n\n                    const flex = createElement('span', null, i18n.get(type, this.config));\n\n                    const value = createElement('span', {\n                        class: this.config.classNames.menu.value,\n                    });\n\n                    // Speed contains HTML entities\n                    value.innerHTML = data[type];\n\n                    flex.appendChild(value);\n                    menuItem.appendChild(flex);\n                    menu.appendChild(menuItem);\n\n                    // Build the panes\n                    const pane = createElement('div', {\n                        id: `plyr-settings-${data.id}-${type}`,\n                        hidden: '',\n                    });\n\n                    // Back button\n                    const backButton = createElement('button', {\n                        type: 'button',\n                        class: `${this.config.classNames.control} ${this.config.classNames.control}--back`,\n                    });\n\n                    // Visible label\n                    backButton.appendChild(\n                        createElement(\n                            'span',\n                            {\n                                'aria-hidden': true,\n                            },\n                            i18n.get(type, this.config),\n                        ),\n                    );\n\n                    // Screen reader label\n                    backButton.appendChild(\n                        createElement(\n                            'span',\n                            {\n                                class: this.config.classNames.hidden,\n                            },\n                            i18n.get('menuBack', this.config),\n                        ),\n                    );\n\n                    // Go back via keyboard\n                    on(\n                        pane,\n                        'keydown',\n                        event => {\n                            // We only care about <-\n                            if (event.which !== 37) {\n                                return;\n                            }\n\n                            // Prevent seek\n                            event.preventDefault();\n                            event.stopPropagation();\n\n                            // Show the respective menu\n                            showMenuPanel.call(this, 'home', true);\n                        },\n                        false,\n                    );\n\n                    // Go back via button click\n                    on(backButton, 'click', () => {\n                        showMenuPanel.call(this, 'home', false);\n                    });\n\n                    // Add to pane\n                    pane.appendChild(backButton);\n\n                    // Menu\n                    pane.appendChild(\n                        createElement('div', {\n                            role: 'menu',\n                        }),\n                    );\n\n                    inner.appendChild(pane);\n\n                    this.elements.settings.buttons[type] = menuItem;\n                    this.elements.settings.panels[type] = pane;\n                });\n\n                popup.appendChild(inner);\n                wrapper.appendChild(popup);\n                container.appendChild(wrapper);\n\n                this.elements.settings.popup = popup;\n                this.elements.settings.menu = wrapper;\n            }\n\n            // Picture in picture button\n            if (control === 'pip' && support.pip) {\n                container.appendChild(createButton.call(this, 'pip', defaultAttributes));\n            }\n\n            // Airplay button\n            if (control === 'airplay' && support.airplay) {\n                container.appendChild(createButton.call(this, 'airplay', defaultAttributes));\n            }\n\n            // Download button\n            if (control === 'download') {\n                const attributes = extend({}, defaultAttributes, {\n                    element: 'a',\n                    href: this.download,\n                    target: '_blank',\n                });\n\n                const { download } = this.config.urls;\n\n                if (!is.url(download) && this.isEmbed) {\n                    extend(attributes, {\n                        icon: `logo-${this.provider}`,\n                        label: this.provider,\n                    });\n                }\n\n                container.appendChild(createButton.call(this, 'download', attributes));\n            }\n\n            // Toggle fullscreen button\n            if (control === 'fullscreen') {\n                container.appendChild(createButton.call(this, 'fullscreen', defaultAttributes));\n            }\n        });\n\n        // Set available quality levels\n        if (this.isHTML5) {\n            setQualityMenu.call(this, html5.getQualityOptions.call(this));\n        }\n\n        setSpeedMenu.call(this);\n\n        return container;\n    },\n\n    // Insert controls\n    inject() {\n        // Sprite\n        if (this.config.loadSprite) {\n            const icon = controls.getIconUrl.call(this);\n\n            // Only load external sprite using AJAX\n            if (icon.cors) {\n                loadSprite(icon.url, 'sprite-plyr');\n            }\n        }\n\n        // Create a unique ID\n        this.id = Math.floor(Math.random() * 10000);\n\n        // Null by default\n        let container = null;\n        this.elements.controls = null;\n\n        // Set template properties\n        const props = {\n            id: this.id,\n            seektime: this.config.seekTime,\n            title: this.config.title,\n        };\n        let update = true;\n\n        // If function, run it and use output\n        if (is.function(this.config.controls)) {\n            this.config.controls = this.config.controls.call(this, props);\n        }\n\n        // Convert falsy controls to empty array (primarily for empty strings)\n        if (!this.config.controls) {\n            this.config.controls = [];\n        }\n\n        if (is.element(this.config.controls) || is.string(this.config.controls)) {\n            // HTMLElement or Non-empty string passed as the option\n            container = this.config.controls;\n        } else {\n            // Create controls\n            container = controls.create.call(this, {\n                id: this.id,\n                seektime: this.config.seekTime,\n                speed: this.speed,\n                quality: this.quality,\n                captions: captions.getLabel.call(this),\n                // TODO: Looping\n                // loop: 'None',\n            });\n            update = false;\n        }\n\n        // Replace props with their value\n        const replace = input => {\n            let result = input;\n\n            Object.entries(props).forEach(([key, value]) => {\n                result = replaceAll(result, `{${key}}`, value);\n            });\n\n            return result;\n        };\n\n        // Update markup\n        if (update) {\n            if (is.string(this.config.controls)) {\n                container = replace(container);\n            } else if (is.element(container)) {\n                container.innerHTML = replace(container.innerHTML);\n            }\n        }\n\n        // Controls container\n        let target;\n\n        // Inject to custom location\n        if (is.string(this.config.selectors.controls.container)) {\n            target = document.querySelector(this.config.selectors.controls.container);\n        }\n\n        // Inject into the container by default\n        if (!is.element(target)) {\n            target = this.elements.container;\n        }\n\n        // Inject controls HTML (needs to be before captions, hence \"afterbegin\")\n        const insertMethod = is.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';\n        target[insertMethod]('afterbegin', container);\n\n        // Find the elements if need be\n        if (!is.element(this.elements.controls)) {\n            controls.findElements.call(this);\n        }\n\n        // Add pressed property to buttons\n        if (!is.empty(this.elements.buttons)) {\n            const addProperty = button => {\n                const className = this.config.classNames.controlPressed;\n                Object.defineProperty(button, 'pressed', {\n                    enumerable: true,\n                    get() {\n                        return hasClass(button, className);\n                    },\n                    set(pressed = false) {\n                        toggleClass(button, className, pressed);\n                    },\n                });\n            };\n\n            // Toggle classname when pressed property is set\n            Object.values(this.elements.buttons)\n                .filter(Boolean)\n                .forEach(button => {\n                    if (is.array(button) || is.nodeList(button)) {\n                        Array.from(button)\n                            .filter(Boolean)\n                            .forEach(addProperty);\n                    } else {\n                        addProperty(button);\n                    }\n                });\n        }\n\n        // Edge sometimes doesn't finish the paint so force a repaint\n        if (browser.isEdge) {\n            repaint(target);\n        }\n\n        // Setup tooltips\n        if (this.config.tooltips.controls) {\n            const { classNames, selectors } = this.config;\n            const selector = `${selectors.controls.wrapper} ${selectors.labels} .${classNames.hidden}`;\n            const labels = getElements.call(this, selector);\n\n            Array.from(labels).forEach(label => {\n                toggleClass(label, this.config.classNames.hidden, false);\n                toggleClass(label, this.config.classNames.tooltip, true);\n            });\n        }\n    },\n};\n\nexport default controls;\n","// ==========================================================================\n// URL utils\n// ==========================================================================\n\nimport is from './is';\n\n/**\n * Parse a string to a URL object\n * @param {String} input - the URL to be parsed\n * @param {Boolean} safe - failsafe parsing\n */\nexport function parseUrl(input, safe = true) {\n    let url = input;\n\n    if (safe) {\n        const parser = document.createElement('a');\n        parser.href = url;\n        url = parser.href;\n    }\n\n    try {\n        return new URL(url);\n    } catch (e) {\n        return null;\n    }\n}\n\n// Convert object to URLSearchParams\nexport function buildUrlParams(input) {\n    const params = new URLSearchParams();\n\n    if (is.object(input)) {\n        Object.entries(input).forEach(([key, value]) => {\n            params.set(key, value);\n        });\n    }\n\n    return params;\n}\n","// ==========================================================================\n// Plyr Captions\n// TODO: Create as class\n// ==========================================================================\n\nimport controls from './controls';\nimport support from './support';\nimport { dedupe } from './utils/arrays';\nimport browser from './utils/browser';\nimport {\n    createElement,\n    emptyElement,\n    getAttributesFromSelector,\n    insertAfter,\n    removeElement,\n    toggleClass,\n} from './utils/elements';\nimport { on, triggerEvent } from './utils/events';\nimport fetch from './utils/fetch';\nimport i18n from './utils/i18n';\nimport is from './utils/is';\nimport { getHTML } from './utils/strings';\nimport { parseUrl } from './utils/urls';\n\nconst captions = {\n    // Setup captions\n    setup() {\n        // Requires UI support\n        if (!this.supported.ui) {\n            return;\n        }\n\n        // Only Vimeo and HTML5 video supported at this point\n        if (!this.isVideo || this.isYouTube || (this.isHTML5 && !support.textTracks)) {\n            // Clear menu and hide\n            if (\n                is.array(this.config.controls) &&\n                this.config.controls.includes('settings') &&\n                this.config.settings.includes('captions')\n            ) {\n                controls.setCaptionsMenu.call(this);\n            }\n\n            return;\n        }\n\n        // Inject the container\n        if (!is.element(this.elements.captions)) {\n            this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions));\n\n            insertAfter(this.elements.captions, this.elements.wrapper);\n        }\n\n        // Fix IE captions if CORS is used\n        // Fetch captions and inject as blobs instead (data URIs not supported!)\n        if (browser.isIE && window.URL) {\n            const elements = this.media.querySelectorAll('track');\n\n            Array.from(elements).forEach(track => {\n                const src = track.getAttribute('src');\n                const url = parseUrl(src);\n\n                if (\n                    url !== null &&\n                    url.hostname !== window.location.href.hostname &&\n                    ['http:', 'https:'].includes(url.protocol)\n                ) {\n                    fetch(src, 'blob')\n                        .then(blob => {\n                            track.setAttribute('src', window.URL.createObjectURL(blob));\n                        })\n                        .catch(() => {\n                            removeElement(track);\n                        });\n                }\n            });\n        }\n\n        // Get and set initial data\n        // The \"preferred\" options are not realized unless / until the wanted language has a match\n        // * languages: Array of user's browser languages.\n        // * language:  The language preferred by user settings or config\n        // * active:    The state preferred by user settings or config\n        // * toggled:   The real captions state\n\n        const browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en'];\n        const languages = dedupe(browserLanguages.map(language => language.split('-')[0]));\n        let language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase();\n\n        // Use first browser language when language is 'auto'\n        if (language === 'auto') {\n            [language] = languages;\n        }\n\n        let active = this.storage.get('captions');\n        if (!is.boolean(active)) {\n            ({ active } = this.config.captions);\n        }\n\n        Object.assign(this.captions, {\n            toggled: false,\n            active,\n            language,\n            languages,\n        });\n\n        // Watch changes to textTracks and update captions menu\n        if (this.isHTML5) {\n            const trackEvents = this.config.captions.update ? 'addtrack removetrack' : 'removetrack';\n            on.call(this, this.media.textTracks, trackEvents, captions.update.bind(this));\n        }\n\n        // Update available languages in list next tick (the event must not be triggered before the listeners)\n        setTimeout(captions.update.bind(this), 0);\n    },\n\n    // Update available language options in settings based on tracks\n    update() {\n        const tracks = captions.getTracks.call(this, true);\n        // Get the wanted language\n        const { active, language, meta, currentTrackNode } = this.captions;\n        const languageExists = Boolean(tracks.find(track => track.language === language));\n\n        // Handle tracks (add event listener and \"pseudo\"-default)\n        if (this.isHTML5 && this.isVideo) {\n            tracks\n                .filter(track => !meta.get(track))\n                .forEach(track => {\n                    this.debug.log('Track added', track);\n                    // Attempt to store if the original dom element was \"default\"\n                    meta.set(track, {\n                        default: track.mode === 'showing',\n                    });\n\n                    // Turn off native caption rendering to avoid double captions\n                    // eslint-disable-next-line no-param-reassign\n                    track.mode = 'hidden';\n\n                    // Add event listener for cue changes\n                    on.call(this, track, 'cuechange', () => captions.updateCues.call(this));\n                });\n        }\n\n        // Update language first time it matches, or if the previous matching track was removed\n        if ((languageExists && this.language !== language) || !tracks.includes(currentTrackNode)) {\n            captions.setLanguage.call(this, language);\n            captions.toggle.call(this, active && languageExists);\n        }\n\n        // Enable or disable captions based on track length\n        toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is.empty(tracks));\n\n        // Update available languages in list\n        if ((this.config.controls || []).includes('settings') && this.config.settings.includes('captions')) {\n            controls.setCaptionsMenu.call(this);\n        }\n    },\n\n    // Toggle captions display\n    // Used internally for the toggleCaptions method, with the passive option forced to false\n    toggle(input, passive = true) {\n        // If there's no full support\n        if (!this.supported.ui) {\n            return;\n        }\n\n        const { toggled } = this.captions; // Current state\n        const activeClass = this.config.classNames.captions.active;\n        // Get the next state\n        // If the method is called without parameter, toggle based on current value\n        const active = is.nullOrUndefined(input) ? !toggled : input;\n\n        // Update state and trigger event\n        if (active !== toggled) {\n            // When passive, don't override user preferences\n            if (!passive) {\n                this.captions.active = active;\n                this.storage.set({ captions: active });\n            }\n\n            // Force language if the call isn't passive and there is no matching language to toggle to\n            if (!this.language && active && !passive) {\n                const tracks = captions.getTracks.call(this);\n                const track = captions.findTrack.call(this, [this.captions.language, ...this.captions.languages], true);\n\n                // Override user preferences to avoid switching languages if a matching track is added\n                this.captions.language = track.language;\n\n                // Set caption, but don't store in localStorage as user preference\n                captions.set.call(this, tracks.indexOf(track));\n                return;\n            }\n\n            // Toggle button if it's enabled\n            if (this.elements.buttons.captions) {\n                this.elements.buttons.captions.pressed = active;\n            }\n\n            // Add class hook\n            toggleClass(this.elements.container, activeClass, active);\n\n            this.captions.toggled = active;\n\n            // Update settings menu\n            controls.updateSetting.call(this, 'captions');\n\n            // Trigger event (not used internally)\n            triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled');\n        }\n    },\n\n    // Set captions by track index\n    // Used internally for the currentTrack setter with the passive option forced to false\n    set(index, passive = true) {\n        const tracks = captions.getTracks.call(this);\n\n        // Disable captions if setting to -1\n        if (index === -1) {\n            captions.toggle.call(this, false, passive);\n            return;\n        }\n\n        if (!is.number(index)) {\n            this.debug.warn('Invalid caption argument', index);\n            return;\n        }\n\n        if (!(index in tracks)) {\n            this.debug.warn('Track not found', index);\n            return;\n        }\n\n        if (this.captions.currentTrack !== index) {\n            this.captions.currentTrack = index;\n            const track = tracks[index];\n            const { language } = track || {};\n\n            // Store reference to node for invalidation on remove\n            this.captions.currentTrackNode = track;\n\n            // Update settings menu\n            controls.updateSetting.call(this, 'captions');\n\n            // When passive, don't override user preferences\n            if (!passive) {\n                this.captions.language = language;\n                this.storage.set({ language });\n            }\n\n            // Handle Vimeo captions\n            if (this.isVimeo) {\n                this.embed.enableTextTrack(language);\n            }\n\n            // Trigger event\n            triggerEvent.call(this, this.media, 'languagechange');\n        }\n\n        // Show captions\n        captions.toggle.call(this, true, passive);\n\n        if (this.isHTML5 && this.isVideo) {\n            // If we change the active track while a cue is already displayed we need to update it\n            captions.updateCues.call(this);\n        }\n    },\n\n    // Set captions by language\n    // Used internally for the language setter with the passive option forced to false\n    setLanguage(input, passive = true) {\n        if (!is.string(input)) {\n            this.debug.warn('Invalid language argument', input);\n            return;\n        }\n        // Normalize\n        const language = input.toLowerCase();\n        this.captions.language = language;\n\n        // Set currentTrack\n        const tracks = captions.getTracks.call(this);\n        const track = captions.findTrack.call(this, [language]);\n        captions.set.call(this, tracks.indexOf(track), passive);\n    },\n\n    // Get current valid caption tracks\n    // If update is false it will also ignore tracks without metadata\n    // This is used to \"freeze\" the language options when captions.update is false\n    getTracks(update = false) {\n        // Handle media or textTracks missing or null\n        const tracks = Array.from((this.media || {}).textTracks || []);\n        // For HTML5, use cache instead of current tracks when it exists (if captions.update is false)\n        // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)\n        return tracks\n            .filter(track => !this.isHTML5 || update || this.captions.meta.has(track))\n            .filter(track => ['captions', 'subtitles'].includes(track.kind));\n    },\n\n    // Match tracks based on languages and get the first\n    findTrack(languages, force = false) {\n        const tracks = captions.getTracks.call(this);\n        const sortIsDefault = track => Number((this.captions.meta.get(track) || {}).default);\n        const sorted = Array.from(tracks).sort((a, b) => sortIsDefault(b) - sortIsDefault(a));\n        let track;\n\n        languages.every(language => {\n            track = sorted.find(t => t.language === language);\n            return !track; // Break iteration if there is a match\n        });\n\n        // If no match is found but is required, get first\n        return track || (force ? sorted[0] : undefined);\n    },\n\n    // Get the current track\n    getCurrentTrack() {\n        return captions.getTracks.call(this)[this.currentTrack];\n    },\n\n    // Get UI label for track\n    getLabel(track) {\n        let currentTrack = track;\n\n        if (!is.track(currentTrack) && support.textTracks && this.captions.toggled) {\n            currentTrack = captions.getCurrentTrack.call(this);\n        }\n\n        if (is.track(currentTrack)) {\n            if (!is.empty(currentTrack.label)) {\n                return currentTrack.label;\n            }\n\n            if (!is.empty(currentTrack.language)) {\n                return track.language.toUpperCase();\n            }\n\n            return i18n.get('enabled', this.config);\n        }\n\n        return i18n.get('disabled', this.config);\n    },\n\n    // Update captions using current track's active cues\n    // Also optional array argument in case there isn't any track (ex: vimeo)\n    updateCues(input) {\n        // Requires UI\n        if (!this.supported.ui) {\n            return;\n        }\n\n        if (!is.element(this.elements.captions)) {\n            this.debug.warn('No captions element to render to');\n            return;\n        }\n\n        // Only accept array or empty input\n        if (!is.nullOrUndefined(input) && !Array.isArray(input)) {\n            this.debug.warn('updateCues: Invalid input', input);\n            return;\n        }\n\n        let cues = input;\n\n        // Get cues from track\n        if (!cues) {\n            const track = captions.getCurrentTrack.call(this);\n\n            cues = Array.from((track || {}).activeCues || [])\n                .map(cue => cue.getCueAsHTML())\n                .map(getHTML);\n        }\n\n        // Set new caption text\n        const content = cues.map(cueText => cueText.trim()).join('\\n');\n        const changed = content !== this.elements.captions.innerHTML;\n\n        if (changed) {\n            // Empty the container and create a new child element\n            emptyElement(this.elements.captions);\n            const caption = createElement('span', getAttributesFromSelector(this.config.selectors.caption));\n            caption.innerHTML = content;\n            this.elements.captions.appendChild(caption);\n\n            // Trigger event\n            triggerEvent.call(this, this.media, 'cuechange');\n        }\n    },\n};\n\nexport default captions;\n","// ==========================================================================\n// Plyr default config\n// ==========================================================================\n\nconst defaults = {\n    // Disable\n    enabled: true,\n\n    // Custom media title\n    title: '',\n\n    // Logging to console\n    debug: false,\n\n    // Auto play (if supported)\n    autoplay: false,\n\n    // Only allow one media playing at once (vimeo only)\n    autopause: true,\n\n    // Allow inline playback on iOS (this effects YouTube/Vimeo - HTML5 requires the attribute present)\n    // TODO: Remove iosNative fullscreen option in favour of this (logic needs work)\n    playsinline: true,\n\n    // Default time to skip when rewind/fast forward\n    seekTime: 10,\n\n    // Default volume\n    volume: 1,\n    muted: false,\n\n    // Pass a custom duration\n    duration: null,\n\n    // Display the media duration on load in the current time position\n    // If you have opted to display both duration and currentTime, this is ignored\n    displayDuration: true,\n\n    // Invert the current time to be a countdown\n    invertTime: true,\n\n    // Clicking the currentTime inverts it's value to show time left rather than elapsed\n    toggleInvert: true,\n\n    // Force an aspect ratio\n    // The format must be `'w:h'` (e.g. `'16:9'`)\n    ratio: null,\n\n    // Click video container to play/pause\n    clickToPlay: true,\n\n    // Auto hide the controls\n    hideControls: true,\n\n    // Reset to start when playback ended\n    resetOnEnd: false,\n\n    // Disable the standard context menu\n    disableContextMenu: true,\n\n    // Sprite (for icons)\n    loadSprite: true,\n    iconPrefix: 'plyr',\n    iconUrl: 'https://cdn.plyr.io/3.5.6/plyr.svg',\n\n    // Blank video (used to prevent errors on source change)\n    blankVideo: 'https://cdn.plyr.io/static/blank.mp4',\n\n    // Quality default\n    quality: {\n        default: 576,\n        options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n    },\n\n    // Set loops\n    loop: {\n        active: false,\n        // start: null,\n        // end: null,\n    },\n\n    // Speed default and options to display\n    speed: {\n        selected: 1,\n        options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],\n    },\n\n    // Keyboard shortcut settings\n    keyboard: {\n        focused: true,\n        global: false,\n    },\n\n    // Display tooltips\n    tooltips: {\n        controls: false,\n        seek: true,\n    },\n\n    // Captions settings\n    captions: {\n        active: false,\n        language: 'auto',\n        // Listen to new tracks added after Plyr is initialized.\n        // This is needed for streaming captions, but may result in unselectable options\n        update: false,\n    },\n\n    // Fullscreen settings\n    fullscreen: {\n        enabled: true, // Allow fullscreen?\n        fallback: true, // Fallback using full viewport/window\n        iosNative: false, // Use the native fullscreen in iOS (disables custom controls)\n    },\n\n    // Local storage\n    storage: {\n        enabled: true,\n        key: 'plyr',\n    },\n\n    // Default controls\n    controls: [\n        'play-large',\n        // 'restart',\n        // 'rewind',\n        'play',\n        // 'fast-forward',\n        'progress',\n        'current-time',\n        // 'duration',\n        'mute',\n        'volume',\n        'captions',\n        'settings',\n        'pip',\n        'airplay',\n        // 'download',\n        'fullscreen',\n    ],\n    settings: ['captions', 'quality', 'speed'],\n\n    // Localisation\n    i18n: {\n        restart: 'Restart',\n        rewind: 'Rewind {seektime}s',\n        play: 'Play',\n        pause: 'Pause',\n        fastForward: 'Forward {seektime}s',\n        seek: 'Seek',\n        seekLabel: '{currentTime} of {duration}',\n        played: 'Played',\n        buffered: 'Buffered',\n        currentTime: 'Current time',\n        duration: 'Duration',\n        volume: 'Volume',\n        mute: 'Mute',\n        unmute: 'Unmute',\n        enableCaptions: 'Enable captions',\n        disableCaptions: 'Disable captions',\n        download: 'Download',\n        enterFullscreen: 'Enter fullscreen',\n        exitFullscreen: 'Exit fullscreen',\n        frameTitle: 'Player for {title}',\n        captions: 'Captions',\n        settings: 'Settings',\n        menuBack: 'Go back to previous menu',\n        speed: 'Speed',\n        normal: 'Normal',\n        quality: 'Quality',\n        loop: 'Loop',\n        start: 'Start',\n        end: 'End',\n        all: 'All',\n        reset: 'Reset',\n        disabled: 'Disabled',\n        enabled: 'Enabled',\n        advertisement: 'Ad',\n        qualityBadge: {\n            2160: '4K',\n            1440: 'HD',\n            1080: 'HD',\n            720: 'HD',\n            576: 'SD',\n            480: 'SD',\n        },\n    },\n\n    // URLs\n    urls: {\n        download: null,\n        vimeo: {\n            sdk: 'https://player.vimeo.com/api/player.js',\n            iframe: 'https://player.vimeo.com/video/{0}?{1}',\n            api: 'https://vimeo.com/api/v2/video/{0}.json',\n        },\n        youtube: {\n            sdk: 'https://www.youtube.com/iframe_api',\n            api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}',\n        },\n        googleIMA: {\n            sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js',\n        },\n    },\n\n    // Custom control listeners\n    listeners: {\n        seek: null,\n        play: null,\n        pause: null,\n        restart: null,\n        rewind: null,\n        fastForward: null,\n        mute: null,\n        volume: null,\n        captions: null,\n        download: null,\n        fullscreen: null,\n        pip: null,\n        airplay: null,\n        speed: null,\n        quality: null,\n        loop: null,\n        language: null,\n    },\n\n    // Events to watch and bubble\n    events: [\n        // Events to watch on HTML5 media elements and bubble\n        // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events\n        'ended',\n        'progress',\n        'stalled',\n        'playing',\n        'waiting',\n        'canplay',\n        'canplaythrough',\n        'loadstart',\n        'loadeddata',\n        'loadedmetadata',\n        'timeupdate',\n        'volumechange',\n        'play',\n        'pause',\n        'error',\n        'seeking',\n        'seeked',\n        'emptied',\n        'ratechange',\n        'cuechange',\n\n        // Custom events\n        'download',\n        'enterfullscreen',\n        'exitfullscreen',\n        'captionsenabled',\n        'captionsdisabled',\n        'languagechange',\n        'controlshidden',\n        'controlsshown',\n        'ready',\n\n        // YouTube\n        'statechange',\n\n        // Quality\n        'qualitychange',\n\n        // Ads\n        'adsloaded',\n        'adscontentpause',\n        'adscontentresume',\n        'adstarted',\n        'adsmidpoint',\n        'adscomplete',\n        'adsallcomplete',\n        'adsimpression',\n        'adsclick',\n    ],\n\n    // Selectors\n    // Change these to match your template if using custom HTML\n    selectors: {\n        editable: 'input, textarea, select, [contenteditable]',\n        container: '.plyr',\n        controls: {\n            container: null,\n            wrapper: '.plyr__controls',\n        },\n        labels: '[data-plyr]',\n        buttons: {\n            play: '[data-plyr=\"play\"]',\n            pause: '[data-plyr=\"pause\"]',\n            restart: '[data-plyr=\"restart\"]',\n            rewind: '[data-plyr=\"rewind\"]',\n            fastForward: '[data-plyr=\"fast-forward\"]',\n            mute: '[data-plyr=\"mute\"]',\n            captions: '[data-plyr=\"captions\"]',\n            download: '[data-plyr=\"download\"]',\n            fullscreen: '[data-plyr=\"fullscreen\"]',\n            pip: '[data-plyr=\"pip\"]',\n            airplay: '[data-plyr=\"airplay\"]',\n            settings: '[data-plyr=\"settings\"]',\n            loop: '[data-plyr=\"loop\"]',\n        },\n        inputs: {\n            seek: '[data-plyr=\"seek\"]',\n            volume: '[data-plyr=\"volume\"]',\n            speed: '[data-plyr=\"speed\"]',\n            language: '[data-plyr=\"language\"]',\n            quality: '[data-plyr=\"quality\"]',\n        },\n        display: {\n            currentTime: '.plyr__time--current',\n            duration: '.plyr__time--duration',\n            buffer: '.plyr__progress__buffer',\n            loop: '.plyr__progress__loop', // Used later\n            volume: '.plyr__volume--display',\n        },\n        progress: '.plyr__progress',\n        captions: '.plyr__captions',\n        caption: '.plyr__caption',\n    },\n\n    // Class hooks added to the player in different states\n    classNames: {\n        type: 'plyr--{0}',\n        provider: 'plyr--{0}',\n        video: 'plyr__video-wrapper',\n        embed: 'plyr__video-embed',\n        videoFixedRatio: 'plyr__video-wrapper--fixed-ratio',\n        embedContainer: 'plyr__video-embed__container',\n        poster: 'plyr__poster',\n        posterEnabled: 'plyr__poster-enabled',\n        ads: 'plyr__ads',\n        control: 'plyr__control',\n        controlPressed: 'plyr__control--pressed',\n        playing: 'plyr--playing',\n        paused: 'plyr--paused',\n        stopped: 'plyr--stopped',\n        loading: 'plyr--loading',\n        hover: 'plyr--hover',\n        tooltip: 'plyr__tooltip',\n        cues: 'plyr__cues',\n        hidden: 'plyr__sr-only',\n        hideControls: 'plyr--hide-controls',\n        isIos: 'plyr--is-ios',\n        isTouch: 'plyr--is-touch',\n        uiSupported: 'plyr--full-ui',\n        noTransition: 'plyr--no-transition',\n        display: {\n            time: 'plyr__time',\n        },\n        menu: {\n            value: 'plyr__menu__value',\n            badge: 'plyr__badge',\n            open: 'plyr--menu-open',\n        },\n        captions: {\n            enabled: 'plyr--captions-enabled',\n            active: 'plyr--captions-active',\n        },\n        fullscreen: {\n            enabled: 'plyr--fullscreen-enabled',\n            fallback: 'plyr--fullscreen-fallback',\n        },\n        pip: {\n            supported: 'plyr--pip-supported',\n            active: 'plyr--pip-active',\n        },\n        airplay: {\n            supported: 'plyr--airplay-supported',\n            active: 'plyr--airplay-active',\n        },\n        tabFocus: 'plyr__tab-focus',\n        previewThumbnails: {\n            // Tooltip thumbs\n            thumbContainer: 'plyr__preview-thumb',\n            thumbContainerShown: 'plyr__preview-thumb--is-shown',\n            imageContainer: 'plyr__preview-thumb__image-container',\n            timeContainer: 'plyr__preview-thumb__time-container',\n            // Scrubbing\n            scrubbingContainer: 'plyr__preview-scrubbing',\n            scrubbingContainerShown: 'plyr__preview-scrubbing--is-shown',\n        },\n    },\n\n    // Embed attributes\n    attributes: {\n        embed: {\n            provider: 'data-plyr-provider',\n            id: 'data-plyr-embed-id',\n        },\n    },\n\n    // Advertisements plugin\n    // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio\n    ads: {\n        enabled: false,\n        publisherId: '',\n        tagUrl: '',\n    },\n\n    // Preview Thumbnails plugin\n    previewThumbnails: {\n        enabled: false,\n        src: '',\n    },\n\n    // Vimeo plugin\n    vimeo: {\n        byline: false,\n        portrait: false,\n        title: false,\n        speed: true,\n        transparent: false,\n    },\n\n    // YouTube plugin\n    youtube: {\n        noCookie: false, // Whether to use an alternative version of YouTube without cookies\n        rel: 0, // No related vids\n        showinfo: 0, // Hide info\n        iv_load_policy: 3, // Hide annotations\n        modestbranding: 1, // Hide logos as much as possible (they still show one in the corner when paused)\n    },\n};\n\nexport default defaults;\n","// ==========================================================================\n// Plyr states\n// ==========================================================================\n\nexport const pip = {\n    active: 'picture-in-picture',\n    inactive: 'inline',\n};\n\nexport default { pip };\n","// ==========================================================================\n// Plyr supported types and providers\n// ==========================================================================\n\nexport const providers = {\n    html5: 'html5',\n    youtube: 'youtube',\n    vimeo: 'vimeo',\n};\n\nexport const types = {\n    audio: 'audio',\n    video: 'video',\n};\n\n/**\n * Get provider by URL\n * @param {String} url\n */\nexport function getProviderByUrl(url) {\n    // YouTube\n    if (/^(https?:\\/\\/)?(www\\.)?(youtube\\.com|youtube-nocookie\\.com|youtu\\.?be)\\/.+$/.test(url)) {\n        return providers.youtube;\n    }\n\n    // Vimeo\n    if (/^https?:\\/\\/player.vimeo.com\\/video\\/\\d{0,9}(?=\\b|\\/)/.test(url)) {\n        return providers.vimeo;\n    }\n\n    return null;\n}\n\nexport default { providers, types };\n","// ==========================================================================\n// Console wrapper\n// ==========================================================================\n\nconst noop = () => {};\n\nexport default class Console {\n    constructor(enabled = false) {\n        this.enabled = window.console && enabled;\n\n        if (this.enabled) {\n            this.log('Debugging enabled');\n        }\n    }\n\n    get log() {\n        // eslint-disable-next-line no-console\n        return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;\n    }\n\n    get warn() {\n        // eslint-disable-next-line no-console\n        return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;\n    }\n\n    get error() {\n        // eslint-disable-next-line no-console\n        return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;\n    }\n}\n","// ==========================================================================\n// Fullscreen wrapper\n// https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API#prefixing\n// https://webkit.org/blog/7929/designing-websites-for-iphone-x/\n// ==========================================================================\n\nimport browser from './utils/browser';\nimport { hasClass, toggleClass, trapFocus } from './utils/elements';\nimport { on, triggerEvent } from './utils/events';\nimport is from './utils/is';\n\nfunction onChange() {\n    if (!this.enabled) {\n        return;\n    }\n\n    // Update toggle button\n    const button = this.player.elements.buttons.fullscreen;\n    if (is.element(button)) {\n        button.pressed = this.active;\n    }\n\n    // Trigger an event\n    triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);\n\n    // Trap focus in container\n    if (!browser.isIos) {\n        trapFocus.call(this.player, this.target, this.active);\n    }\n}\n\nfunction toggleFallback(toggle = false) {\n    // Store or restore scroll position\n    if (toggle) {\n        this.scrollPosition = {\n            x: window.scrollX || 0,\n            y: window.scrollY || 0,\n        };\n    } else {\n        window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);\n    }\n\n    // Toggle scroll\n    document.body.style.overflow = toggle ? 'hidden' : '';\n\n    // Toggle class hook\n    toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle);\n\n    // Force full viewport on iPhone X+\n    if (browser.isIos) {\n        let viewport = document.head.querySelector('meta[name=\"viewport\"]');\n        const property = 'viewport-fit=cover';\n\n        // Inject the viewport meta if required\n        if (!viewport) {\n            viewport = document.createElement('meta');\n            viewport.setAttribute('name', 'viewport');\n        }\n\n        // Check if the property already exists\n        const hasProperty = is.string(viewport.content) && viewport.content.includes(property);\n\n        if (toggle) {\n            this.cleanupViewport = !hasProperty;\n\n            if (!hasProperty) {\n                viewport.content += `,${property}`;\n            }\n        } else if (this.cleanupViewport) {\n            viewport.content = viewport.content\n                .split(',')\n                .filter(part => part.trim() !== property)\n                .join(',');\n        }\n    }\n\n    // Toggle button and fire events\n    onChange.call(this);\n}\n\nclass Fullscreen {\n    constructor(player) {\n        // Keep reference to parent\n        this.player = player;\n\n        // Get prefix\n        this.prefix = Fullscreen.prefix;\n        this.property = Fullscreen.property;\n\n        // Scroll position\n        this.scrollPosition = { x: 0, y: 0 };\n\n        // Force the use of 'full window/browser' rather than fullscreen\n        this.forceFallback = player.config.fullscreen.fallback === 'force';\n\n        // Register event listeners\n        // Handle event (incase user presses escape etc)\n        on.call(\n            this.player,\n            document,\n            this.prefix === 'ms' ? 'MSFullscreenChange' : `${this.prefix}fullscreenchange`,\n            () => {\n                // TODO: Filter for target??\n                onChange.call(this);\n            },\n        );\n\n        // Fullscreen toggle on double click\n        on.call(this.player, this.player.elements.container, 'dblclick', event => {\n            // Ignore double click in controls\n            if (is.element(this.player.elements.controls) && this.player.elements.controls.contains(event.target)) {\n                return;\n            }\n\n            this.toggle();\n        });\n\n        // Update the UI\n        this.update();\n    }\n\n    // Determine if native supported\n    static get native() {\n        return !!(\n            document.fullscreenEnabled ||\n            document.webkitFullscreenEnabled ||\n            document.mozFullScreenEnabled ||\n            document.msFullscreenEnabled\n        );\n    }\n\n    // If we're actually using native\n    get usingNative() {\n        return Fullscreen.native && !this.forceFallback;\n    }\n\n    // Get the prefix for handlers\n    static get prefix() {\n        // No prefix\n        if (is.function(document.exitFullscreen)) {\n            return '';\n        }\n\n        // Check for fullscreen support by vendor prefix\n        let value = '';\n        const prefixes = ['webkit', 'moz', 'ms'];\n\n        prefixes.some(pre => {\n            if (is.function(document[`${pre}ExitFullscreen`]) || is.function(document[`${pre}CancelFullScreen`])) {\n                value = pre;\n                return true;\n            }\n\n            return false;\n        });\n\n        return value;\n    }\n\n    static get property() {\n        return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';\n    }\n\n    // Determine if fullscreen is enabled\n    get enabled() {\n        return (\n            (Fullscreen.native || this.player.config.fullscreen.fallback) &&\n            this.player.config.fullscreen.enabled &&\n            this.player.supported.ui &&\n            this.player.isVideo\n        );\n    }\n\n    // Get active state\n    get active() {\n        if (!this.enabled) {\n            return false;\n        }\n\n        // Fallback using classname\n        if (!Fullscreen.native || this.forceFallback) {\n            return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);\n        }\n\n        const element = !this.prefix ? document.fullscreenElement : document[`${this.prefix}${this.property}Element`];\n\n        return element === this.target;\n    }\n\n    // Get target element\n    get target() {\n        return browser.isIos && this.player.config.fullscreen.iosNative\n            ? this.player.media\n            : this.player.elements.container;\n    }\n\n    // Update UI\n    update() {\n        if (this.enabled) {\n            let mode;\n\n            if (this.forceFallback) {\n                mode = 'Fallback (forced)';\n            } else if (Fullscreen.native) {\n                mode = 'Native';\n            } else {\n                mode = 'Fallback';\n            }\n\n            this.player.debug.log(`${mode} fullscreen enabled`);\n        } else {\n            this.player.debug.log('Fullscreen not supported and fallback disabled');\n        }\n\n        // Add styling hook to show button\n        toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);\n    }\n\n    // Make an element fullscreen\n    enter() {\n        if (!this.enabled) {\n            return;\n        }\n\n        // iOS native fullscreen doesn't need the request step\n        if (browser.isIos && this.player.config.fullscreen.iosNative) {\n            this.target.webkitEnterFullscreen();\n        } else if (!Fullscreen.native || this.forceFallback) {\n            toggleFallback.call(this, true);\n        } else if (!this.prefix) {\n            this.target.requestFullscreen();\n        } else if (!is.empty(this.prefix)) {\n            this.target[`${this.prefix}Request${this.property}`]();\n        }\n    }\n\n    // Bail from fullscreen\n    exit() {\n        if (!this.enabled) {\n            return;\n        }\n\n        // iOS native fullscreen\n        if (browser.isIos && this.player.config.fullscreen.iosNative) {\n            this.target.webkitExitFullscreen();\n            this.player.play();\n        } else if (!Fullscreen.native || this.forceFallback) {\n            toggleFallback.call(this, false);\n        } else if (!this.prefix) {\n            (document.cancelFullScreen || document.exitFullscreen).call(document);\n        } else if (!is.empty(this.prefix)) {\n            const action = this.prefix === 'moz' ? 'Cancel' : 'Exit';\n            document[`${this.prefix}${action}${this.property}`]();\n        }\n    }\n\n    // Toggle state\n    toggle() {\n        if (!this.active) {\n            this.enter();\n        } else {\n            this.exit();\n        }\n    }\n}\n\nexport default Fullscreen;\n","// ==========================================================================\n// Load image avoiding xhr/fetch CORS issues\n// Server status can't be obtained this way unfortunately, so this uses \"naturalWidth\" to determine if the image has loaded\n// By default it checks if it is at least 1px, but you can add a second argument to change this\n// ==========================================================================\n\nexport default function loadImage(src, minWidth = 1) {\n    return new Promise((resolve, reject) => {\n        const image = new Image();\n\n        const handler = () => {\n            delete image.onload;\n            delete image.onerror;\n            (image.naturalWidth >= minWidth ? resolve : reject)(image);\n        };\n\n        Object.assign(image, { onload: handler, onerror: handler, src });\n    });\n}\n","// ==========================================================================\n// Plyr UI\n// ==========================================================================\n\nimport captions from './captions';\nimport controls from './controls';\nimport support from './support';\nimport browser from './utils/browser';\nimport { getElement, toggleClass } from './utils/elements';\nimport { ready, triggerEvent } from './utils/events';\nimport i18n from './utils/i18n';\nimport is from './utils/is';\nimport loadImage from './utils/load-image';\n\nconst ui = {\n    addStyleHook() {\n        toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true);\n        toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);\n    },\n\n    // Toggle native HTML5 media controls\n    toggleNativeControls(toggle = false) {\n        if (toggle && this.isHTML5) {\n            this.media.setAttribute('controls', '');\n        } else {\n            this.media.removeAttribute('controls');\n        }\n    },\n\n    // Setup the UI\n    build() {\n        // Re-attach media element listeners\n        // TODO: Use event bubbling?\n        this.listeners.media();\n\n        // Don't setup interface if no support\n        if (!this.supported.ui) {\n            this.debug.warn(`Basic support only for ${this.provider} ${this.type}`);\n\n            // Restore native controls\n            ui.toggleNativeControls.call(this, true);\n\n            // Bail\n            return;\n        }\n\n        // Inject custom controls if not present\n        if (!is.element(this.elements.controls)) {\n            // Inject custom controls\n            controls.inject.call(this);\n\n            // Re-attach control listeners\n            this.listeners.controls();\n        }\n\n        // Remove native controls\n        ui.toggleNativeControls.call(this);\n\n        // Setup captions for HTML5\n        if (this.isHTML5) {\n            captions.setup.call(this);\n        }\n\n        // Reset volume\n        this.volume = null;\n\n        // Reset mute state\n        this.muted = null;\n\n        // Reset loop state\n        this.loop = null;\n\n        // Reset quality setting\n        this.quality = null;\n\n        // Reset speed\n        this.speed = null;\n\n        // Reset volume display\n        controls.updateVolume.call(this);\n\n        // Reset time display\n        controls.timeUpdate.call(this);\n\n        // Update the UI\n        ui.checkPlaying.call(this);\n\n        // Check for picture-in-picture support\n        toggleClass(\n            this.elements.container,\n            this.config.classNames.pip.supported,\n            support.pip && this.isHTML5 && this.isVideo,\n        );\n\n        // Check for airplay support\n        toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5);\n\n        // Add iOS class\n        toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos);\n\n        // Add touch class\n        toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch);\n\n        // Ready for API calls\n        this.ready = true;\n\n        // Ready event at end of execution stack\n        setTimeout(() => {\n            triggerEvent.call(this, this.media, 'ready');\n        }, 0);\n\n        // Set the title\n        ui.setTitle.call(this);\n\n        // Assure the poster image is set, if the property was added before the element was created\n        if (this.poster) {\n            ui.setPoster.call(this, this.poster, false).catch(() => {});\n        }\n\n        // Manually set the duration if user has overridden it.\n        // The event listeners for it doesn't get called if preload is disabled (#701)\n        if (this.config.duration) {\n            controls.durationUpdate.call(this);\n        }\n    },\n\n    // Setup aria attribute for play and iframe title\n    setTitle() {\n        // Find the current text\n        let label = i18n.get('play', this.config);\n\n        // If there's a media title set, use that for the label\n        if (is.string(this.config.title) && !is.empty(this.config.title)) {\n            label += `, ${this.config.title}`;\n        }\n\n        // If there's a play button, set label\n        Array.from(this.elements.buttons.play || []).forEach(button => {\n            button.setAttribute('aria-label', label);\n        });\n\n        // Set iframe title\n        // https://github.com/sampotts/plyr/issues/124\n        if (this.isEmbed) {\n            const iframe = getElement.call(this, 'iframe');\n\n            if (!is.element(iframe)) {\n                return;\n            }\n\n            // Default to media type\n            const title = !is.empty(this.config.title) ? this.config.title : 'video';\n            const format = i18n.get('frameTitle', this.config);\n\n            iframe.setAttribute('title', format.replace('{title}', title));\n        }\n    },\n\n    // Toggle poster\n    togglePoster(enable) {\n        toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable);\n    },\n\n    // Set the poster image (async)\n    // Used internally for the poster setter, with the passive option forced to false\n    setPoster(poster, passive = true) {\n        // Don't override if call is passive\n        if (passive && this.poster) {\n            return Promise.reject(new Error('Poster already set'));\n        }\n\n        // Set property synchronously to respect the call order\n        this.media.setAttribute('poster', poster);\n\n        // Wait until ui is ready\n        return (\n            ready\n                .call(this)\n                // Load image\n                .then(() => loadImage(poster))\n                .catch(err => {\n                    // Hide poster on error unless it's been set by another call\n                    if (poster === this.poster) {\n                        ui.togglePoster.call(this, false);\n                    }\n                    // Rethrow\n                    throw err;\n                })\n                .then(() => {\n                    // Prevent race conditions\n                    if (poster !== this.poster) {\n                        throw new Error('setPoster cancelled by later call to setPoster');\n                    }\n                })\n                .then(() => {\n                    Object.assign(this.elements.poster.style, {\n                        backgroundImage: `url('${poster}')`,\n                        // Reset backgroundSize as well (since it can be set to \"cover\" for padded thumbnails for youtube)\n                        backgroundSize: '',\n                    });\n                    ui.togglePoster.call(this, true);\n                    return poster;\n                })\n        );\n    },\n\n    // Check playing state\n    checkPlaying(event) {\n        // Class hooks\n        toggleClass(this.elements.container, this.config.classNames.playing, this.playing);\n        toggleClass(this.elements.container, this.config.classNames.paused, this.paused);\n        toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped);\n\n        // Set state\n        Array.from(this.elements.buttons.play || []).forEach(target => {\n            Object.assign(target, { pressed: this.playing });\n        });\n\n        // Only update controls on non timeupdate events\n        if (is.event(event) && event.type === 'timeupdate') {\n            return;\n        }\n\n        // Toggle controls\n        ui.toggleControls.call(this);\n    },\n\n    // Check if media is loading\n    checkLoading(event) {\n        this.loading = ['stalled', 'waiting'].includes(event.type);\n\n        // Clear timer\n        clearTimeout(this.timers.loading);\n\n        // Timer to prevent flicker when seeking\n        this.timers.loading = setTimeout(\n            () => {\n                // Update progress bar loading class state\n                toggleClass(this.elements.container, this.config.classNames.loading, this.loading);\n\n                // Update controls visibility\n                ui.toggleControls.call(this);\n            },\n            this.loading ? 250 : 0,\n        );\n    },\n\n    // Toggle controls based on state and `force` argument\n    toggleControls(force) {\n        const { controls: controlsElement } = this.elements;\n\n        if (controlsElement && this.config.hideControls) {\n            // Don't hide controls if a touch-device user recently seeked. (Must be limited to touch devices, or it occasionally prevents desktop controls from hiding.)\n            const recentTouchSeek = this.touch && this.lastSeekTime + 2000 > Date.now();\n\n            // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide\n            this.toggleControls(\n                Boolean(\n                    force ||\n                        this.loading ||\n                        this.paused ||\n                        controlsElement.pressed ||\n                        controlsElement.hover ||\n                        recentTouchSeek,\n                ),\n            );\n        }\n    },\n};\n\nexport default ui;\n","// ==========================================================================\n// Plyr Event Listeners\n// ==========================================================================\n\nimport controls from './controls';\nimport ui from './ui';\nimport { repaint } from './utils/animation';\nimport browser from './utils/browser';\nimport { getElement, getElements, matches, toggleClass, toggleHidden } from './utils/elements';\nimport { off, on, once, toggleListener, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { getAspectRatio, setAspectRatio } from './utils/style';\n\nclass Listeners {\n    constructor(player) {\n        this.player = player;\n        this.lastKey = null;\n        this.focusTimer = null;\n        this.lastKeyDown = null;\n\n        this.handleKey = this.handleKey.bind(this);\n        this.toggleMenu = this.toggleMenu.bind(this);\n        this.setTabFocus = this.setTabFocus.bind(this);\n        this.firstTouch = this.firstTouch.bind(this);\n    }\n\n    // Handle key presses\n    handleKey(event) {\n        const { player } = this;\n        const { elements } = player;\n        const code = event.keyCode ? event.keyCode : event.which;\n        const pressed = event.type === 'keydown';\n        const repeat = pressed && code === this.lastKey;\n\n        // Bail if a modifier key is set\n        if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n            return;\n        }\n\n        // If the event is bubbled from the media element\n        // Firefox doesn't get the keycode for whatever reason\n        if (!is.number(code)) {\n            return;\n        }\n\n        // Seek by the number keys\n        const seekByKey = () => {\n            // Divide the max duration into 10th's and times by the number value\n            player.currentTime = (player.duration / 10) * (code - 48);\n        };\n\n        // Handle the key on keydown\n        // Reset on keyup\n        if (pressed) {\n            // Check focused element\n            // and if the focused element is not editable (e.g. text input)\n            // and any that accept key input http://webaim.org/techniques/keyboard/\n            const focused = document.activeElement;\n            if (is.element(focused)) {\n                const { editable } = player.config.selectors;\n                const { seek } = elements.inputs;\n\n                if (focused !== seek && matches(focused, editable)) {\n                    return;\n                }\n\n                if (event.which === 32 && matches(focused, 'button, [role^=\"menuitem\"]')) {\n                    return;\n                }\n            }\n\n            // Which keycodes should we prevent default\n            const preventDefault = [32, 37, 38, 39, 40, 48, 49, 50, 51, 52, 53, 54, 56, 57, 67, 70, 73, 75, 76, 77, 79];\n\n            // If the code is found prevent default (e.g. prevent scrolling for arrows)\n            if (preventDefault.includes(code)) {\n                event.preventDefault();\n                event.stopPropagation();\n            }\n\n            switch (code) {\n                case 48:\n                case 49:\n                case 50:\n                case 51:\n                case 52:\n                case 53:\n                case 54:\n                case 55:\n                case 56:\n                case 57:\n                    // 0-9\n                    if (!repeat) {\n                        seekByKey();\n                    }\n                    break;\n\n                case 32:\n                case 75:\n                    // Space and K key\n                    if (!repeat) {\n                        player.togglePlay();\n                    }\n                    break;\n\n                case 38:\n                    // Arrow up\n                    player.increaseVolume(0.1);\n                    break;\n\n                case 40:\n                    // Arrow down\n                    player.decreaseVolume(0.1);\n                    break;\n\n                case 77:\n                    // M key\n                    if (!repeat) {\n                        player.muted = !player.muted;\n                    }\n                    break;\n\n                case 39:\n                    // Arrow forward\n                    player.forward();\n                    break;\n\n                case 37:\n                    // Arrow back\n                    player.rewind();\n                    break;\n\n                case 70:\n                    // F key\n                    player.fullscreen.toggle();\n                    break;\n\n                case 67:\n                    // C key\n                    if (!repeat) {\n                        player.toggleCaptions();\n                    }\n                    break;\n\n                case 76:\n                    // L key\n                    player.loop = !player.loop;\n                    break;\n\n                /* case 73:\n                    this.setLoop('start');\n                    break;\n\n                case 76:\n                    this.setLoop();\n                    break;\n\n                case 79:\n                    this.setLoop('end');\n                    break; */\n\n                default:\n                    break;\n            }\n\n            // Escape is handle natively when in full screen\n            // So we only need to worry about non native\n            if (code === 27 && !player.fullscreen.usingNative && player.fullscreen.active) {\n                player.fullscreen.toggle();\n            }\n\n            // Store last code for next cycle\n            this.lastKey = code;\n        } else {\n            this.lastKey = null;\n        }\n    }\n\n    // Toggle menu\n    toggleMenu(event) {\n        controls.toggleMenu.call(this.player, event);\n    }\n\n    // Device is touch enabled\n    firstTouch() {\n        const { player } = this;\n        const { elements } = player;\n\n        player.touch = true;\n\n        // Add touch class\n        toggleClass(elements.container, player.config.classNames.isTouch, true);\n    }\n\n    setTabFocus(event) {\n        const { player } = this;\n        const { elements } = player;\n\n        clearTimeout(this.focusTimer);\n\n        // Ignore any key other than tab\n        if (event.type === 'keydown' && event.which !== 9) {\n            return;\n        }\n\n        // Store reference to event timeStamp\n        if (event.type === 'keydown') {\n            this.lastKeyDown = event.timeStamp;\n        }\n\n        // Remove current classes\n        const removeCurrent = () => {\n            const className = player.config.classNames.tabFocus;\n            const current = getElements.call(player, `.${className}`);\n            toggleClass(current, className, false);\n        };\n\n        // Determine if a key was pressed to trigger this event\n        const wasKeyDown = event.timeStamp - this.lastKeyDown <= 20;\n\n        // Ignore focus events if a key was pressed prior\n        if (event.type === 'focus' && !wasKeyDown) {\n            return;\n        }\n\n        // Remove all current\n        removeCurrent();\n\n        // Delay the adding of classname until the focus has changed\n        // This event fires before the focusin event\n        this.focusTimer = setTimeout(() => {\n            const focused = document.activeElement;\n\n            // Ignore if current focus element isn't inside the player\n            if (!elements.container.contains(focused)) {\n                return;\n            }\n\n            toggleClass(document.activeElement, player.config.classNames.tabFocus, true);\n        }, 10);\n    }\n\n    // Global window & document listeners\n    global(toggle = true) {\n        const { player } = this;\n\n        // Keyboard shortcuts\n        if (player.config.keyboard.global) {\n            toggleListener.call(player, window, 'keydown keyup', this.handleKey, toggle, false);\n        }\n\n        // Click anywhere closes menu\n        toggleListener.call(player, document.body, 'click', this.toggleMenu, toggle);\n\n        // Detect touch by events\n        once.call(player, document.body, 'touchstart', this.firstTouch);\n\n        // Tab focus detection\n        toggleListener.call(player, document.body, 'keydown focus blur', this.setTabFocus, toggle, false, true);\n    }\n\n    // Container listeners\n    container() {\n        const { player } = this;\n        const { config, elements, timers } = player;\n\n        // Keyboard shortcuts\n        if (!config.keyboard.global && config.keyboard.focused) {\n            on.call(player, elements.container, 'keydown keyup', this.handleKey, false);\n        }\n\n        // Toggle controls on mouse events and entering fullscreen\n        on.call(\n            player,\n            elements.container,\n            'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen',\n            event => {\n                const { controls: controlsElement } = elements;\n\n                // Remove button states for fullscreen\n                if (controlsElement && event.type === 'enterfullscreen') {\n                    controlsElement.pressed = false;\n                    controlsElement.hover = false;\n                }\n\n                // Show, then hide after a timeout unless another control event occurs\n                const show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type);\n                let delay = 0;\n\n                if (show) {\n                    ui.toggleControls.call(player, true);\n                    // Use longer timeout for touch devices\n                    delay = player.touch ? 3000 : 2000;\n                }\n\n                // Clear timer\n                clearTimeout(timers.controls);\n\n                // Set new timer to prevent flicker when seeking\n                timers.controls = setTimeout(() => ui.toggleControls.call(player, false), delay);\n            },\n        );\n\n        // Set a gutter for Vimeo\n        const setGutter = (ratio, padding, toggle) => {\n            if (!player.isVimeo) {\n                return;\n            }\n\n            const target = player.elements.wrapper.firstChild;\n            const [, y] = ratio;\n            const [videoX, videoY] = getAspectRatio.call(player);\n\n            target.style.maxWidth = toggle ? `${(y / videoY) * videoX}px` : null;\n            target.style.margin = toggle ? '0 auto' : null;\n        };\n\n        // Resize on fullscreen change\n        const setPlayerSize = measure => {\n            // If we don't need to measure the viewport\n            if (!measure) {\n                return setAspectRatio.call(player);\n            }\n\n            const rect = elements.container.getBoundingClientRect();\n            const { width, height } = rect;\n\n            return setAspectRatio.call(player, `${width}:${height}`);\n        };\n\n        const resized = () => {\n            clearTimeout(timers.resized);\n            timers.resized = setTimeout(setPlayerSize, 50);\n        };\n\n        on.call(player, elements.container, 'enterfullscreen exitfullscreen', event => {\n            const { target, usingNative } = player.fullscreen;\n\n            // Ignore events not from target\n            if (target !== elements.container) {\n                return;\n            }\n\n            // If it's not an embed and no ratio specified\n            if (!player.isEmbed && is.empty(player.config.ratio)) {\n                return;\n            }\n\n            const isEnter = event.type === 'enterfullscreen';\n            // Set the player size when entering fullscreen to viewport size\n            const { padding, ratio } = setPlayerSize(isEnter);\n\n            // Set Vimeo gutter\n            setGutter(ratio, padding, isEnter);\n\n            // If not using native fullscreen, we need to check for resizes of viewport\n            if (!usingNative) {\n                if (isEnter) {\n                    on.call(player, window, 'resize', resized);\n                } else {\n                    off.call(player, window, 'resize', resized);\n                }\n            }\n        });\n    }\n\n    // Listen for media events\n    media() {\n        const { player } = this;\n        const { elements } = player;\n\n        // Time change on media\n        on.call(player, player.media, 'timeupdate seeking seeked', event => controls.timeUpdate.call(player, event));\n\n        // Display duration\n        on.call(player, player.media, 'durationchange loadeddata loadedmetadata', event =>\n            controls.durationUpdate.call(player, event),\n        );\n\n        // Check for audio tracks on load\n        // We can't use `loadedmetadata` as it doesn't seem to have audio tracks at that point\n        on.call(player, player.media, 'canplay loadeddata', () => {\n            toggleHidden(elements.volume, !player.hasAudio);\n            toggleHidden(elements.buttons.mute, !player.hasAudio);\n        });\n\n        // Handle the media finishing\n        on.call(player, player.media, 'ended', () => {\n            // Show poster on end\n            if (player.isHTML5 && player.isVideo && player.config.resetOnEnd) {\n                // Restart\n                player.restart();\n            }\n        });\n\n        // Check for buffer progress\n        on.call(player, player.media, 'progress playing seeking seeked', event =>\n            controls.updateProgress.call(player, event),\n        );\n\n        // Handle volume changes\n        on.call(player, player.media, 'volumechange', event => controls.updateVolume.call(player, event));\n\n        // Handle play/pause\n        on.call(player, player.media, 'playing play pause ended emptied timeupdate', event =>\n            ui.checkPlaying.call(player, event),\n        );\n\n        // Loading state\n        on.call(player, player.media, 'waiting canplay seeked playing', event => ui.checkLoading.call(player, event));\n\n        // Click video\n        if (player.supported.ui && player.config.clickToPlay && !player.isAudio) {\n            // Re-fetch the wrapper\n            const wrapper = getElement.call(player, `.${player.config.classNames.video}`);\n\n            // Bail if there's no wrapper (this should never happen)\n            if (!is.element(wrapper)) {\n                return;\n            }\n\n            // On click play, pause or restart\n            on.call(player, elements.container, 'click', event => {\n                const targets = [elements.container, wrapper];\n\n                // Ignore if click if not container or in video wrapper\n                if (!targets.includes(event.target) && !wrapper.contains(event.target)) {\n                    return;\n                }\n\n                // Touch devices will just show controls (if hidden)\n                if (player.touch && player.config.hideControls) {\n                    return;\n                }\n\n                if (player.ended) {\n                    this.proxy(event, player.restart, 'restart');\n                    this.proxy(event, player.play, 'play');\n                } else {\n                    this.proxy(event, player.togglePlay, 'play');\n                }\n            });\n        }\n\n        // Disable right click\n        if (player.supported.ui && player.config.disableContextMenu) {\n            on.call(\n                player,\n                elements.wrapper,\n                'contextmenu',\n                event => {\n                    event.preventDefault();\n                },\n                false,\n            );\n        }\n\n        // Volume change\n        on.call(player, player.media, 'volumechange', () => {\n            // Save to storage\n            player.storage.set({\n                volume: player.volume,\n                muted: player.muted,\n            });\n        });\n\n        // Speed change\n        on.call(player, player.media, 'ratechange', () => {\n            // Update UI\n            controls.updateSetting.call(player, 'speed');\n\n            // Save to storage\n            player.storage.set({ speed: player.speed });\n        });\n\n        // Quality change\n        on.call(player, player.media, 'qualitychange', event => {\n            // Update UI\n            controls.updateSetting.call(player, 'quality', null, event.detail.quality);\n        });\n\n        // Update download link when ready and if quality changes\n        on.call(player, player.media, 'ready qualitychange', () => {\n            controls.setDownloadUrl.call(player);\n        });\n\n        // Proxy events to container\n        // Bubble up key events for Edge\n        const proxyEvents = player.config.events.concat(['keyup', 'keydown']).join(' ');\n\n        on.call(player, player.media, proxyEvents, event => {\n            let { detail = {} } = event;\n\n            // Get error details from media\n            if (event.type === 'error') {\n                detail = player.media.error;\n            }\n\n            triggerEvent.call(player, elements.container, event.type, true, detail);\n        });\n    }\n\n    // Run default and custom handlers\n    proxy(event, defaultHandler, customHandlerKey) {\n        const { player } = this;\n        const customHandler = player.config.listeners[customHandlerKey];\n        const hasCustomHandler = is.function(customHandler);\n        let returned = true;\n\n        // Execute custom handler\n        if (hasCustomHandler) {\n            returned = customHandler.call(player, event);\n        }\n\n        // Only call default handler if not prevented in custom handler\n        if (returned && is.function(defaultHandler)) {\n            defaultHandler.call(player, event);\n        }\n    }\n\n    // Trigger custom and default handlers\n    bind(element, type, defaultHandler, customHandlerKey, passive = true) {\n        const { player } = this;\n        const customHandler = player.config.listeners[customHandlerKey];\n        const hasCustomHandler = is.function(customHandler);\n\n        on.call(\n            player,\n            element,\n            type,\n            event => this.proxy(event, defaultHandler, customHandlerKey),\n            passive && !hasCustomHandler,\n        );\n    }\n\n    // Listen for control events\n    controls() {\n        const { player } = this;\n        const { elements } = player;\n        // IE doesn't support input event, so we fallback to change\n        const inputEvent = browser.isIE ? 'change' : 'input';\n\n        // Play/pause toggle\n        if (elements.buttons.play) {\n            Array.from(elements.buttons.play).forEach(button => {\n                this.bind(button, 'click', player.togglePlay, 'play');\n            });\n        }\n\n        // Pause\n        this.bind(elements.buttons.restart, 'click', player.restart, 'restart');\n\n        // Rewind\n        this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind');\n\n        // Rewind\n        this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward');\n\n        // Mute toggle\n        this.bind(\n            elements.buttons.mute,\n            'click',\n            () => {\n                player.muted = !player.muted;\n            },\n            'mute',\n        );\n\n        // Captions toggle\n        this.bind(elements.buttons.captions, 'click', () => player.toggleCaptions());\n\n        // Download\n        this.bind(\n            elements.buttons.download,\n            'click',\n            () => {\n                triggerEvent.call(player, player.media, 'download');\n            },\n            'download',\n        );\n\n        // Fullscreen toggle\n        this.bind(\n            elements.buttons.fullscreen,\n            'click',\n            () => {\n                player.fullscreen.toggle();\n            },\n            'fullscreen',\n        );\n\n        // Picture-in-Picture\n        this.bind(\n            elements.buttons.pip,\n            'click',\n            () => {\n                player.pip = 'toggle';\n            },\n            'pip',\n        );\n\n        // Airplay\n        this.bind(elements.buttons.airplay, 'click', player.airplay, 'airplay');\n\n        // Settings menu - click toggle\n        this.bind(elements.buttons.settings, 'click', event => {\n            // Prevent the document click listener closing the menu\n            event.stopPropagation();\n\n            controls.toggleMenu.call(player, event);\n        });\n\n        // Settings menu - keyboard toggle\n        // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus\n        // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143\n        this.bind(\n            elements.buttons.settings,\n            'keyup',\n            event => {\n                const code = event.which;\n\n                // We only care about space and return\n                if (![13, 32].includes(code)) {\n                    return;\n                }\n\n                // Because return triggers a click anyway, all we need to do is set focus\n                if (code === 13) {\n                    controls.focusFirstMenuItem.call(player, null, true);\n                    return;\n                }\n\n                // Prevent scroll\n                event.preventDefault();\n\n                // Prevent playing video (Firefox)\n                event.stopPropagation();\n\n                // Toggle menu\n                controls.toggleMenu.call(player, event);\n            },\n            null,\n            false, // Can't be passive as we're preventing default\n        );\n\n        // Escape closes menu\n        this.bind(elements.settings.menu, 'keydown', event => {\n            if (event.which === 27) {\n                controls.toggleMenu.call(player, event);\n            }\n        });\n\n        // Set range input alternative \"value\", which matches the tooltip time (#954)\n        this.bind(elements.inputs.seek, 'mousedown mousemove', event => {\n            const rect = elements.progress.getBoundingClientRect();\n            const percent = (100 / rect.width) * (event.pageX - rect.left);\n            event.currentTarget.setAttribute('seek-value', percent);\n        });\n\n        // Pause while seeking\n        this.bind(elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', event => {\n            const seek = event.currentTarget;\n            const code = event.keyCode ? event.keyCode : event.which;\n            const attribute = 'play-on-seeked';\n\n            if (is.keyboardEvent(event) && (code !== 39 && code !== 37)) {\n                return;\n            }\n\n            // Record seek time so we can prevent hiding controls for a few seconds after seek\n            player.lastSeekTime = Date.now();\n\n            // Was playing before?\n            const play = seek.hasAttribute(attribute);\n            // Done seeking\n            const done = ['mouseup', 'touchend', 'keyup'].includes(event.type);\n\n            // If we're done seeking and it was playing, resume playback\n            if (play && done) {\n                seek.removeAttribute(attribute);\n                player.play();\n            } else if (!done && player.playing) {\n                seek.setAttribute(attribute, '');\n                player.pause();\n            }\n        });\n\n        // Fix range inputs on iOS\n        // Super weird iOS bug where after you interact with an <input type=\"range\">,\n        // it takes over further interactions on the page. This is a hack\n        if (browser.isIos) {\n            const inputs = getElements.call(player, 'input[type=\"range\"]');\n            Array.from(inputs).forEach(input => this.bind(input, inputEvent, event => repaint(event.target)));\n        }\n\n        // Seek\n        this.bind(\n            elements.inputs.seek,\n            inputEvent,\n            event => {\n                const seek = event.currentTarget;\n                // If it exists, use seek-value instead of \"value\" for consistency with tooltip time (#954)\n                let seekTo = seek.getAttribute('seek-value');\n\n                if (is.empty(seekTo)) {\n                    seekTo = seek.value;\n                }\n\n                seek.removeAttribute('seek-value');\n\n                player.currentTime = (seekTo / seek.max) * player.duration;\n            },\n            'seek',\n        );\n\n        // Seek tooltip\n        this.bind(elements.progress, 'mouseenter mouseleave mousemove', event =>\n            controls.updateSeekTooltip.call(player, event),\n        );\n\n        // Preview thumbnails plugin\n        // TODO: Really need to work on some sort of plug-in wide event bus or pub-sub for this\n        this.bind(elements.progress, 'mousemove touchmove', event => {\n            const { previewThumbnails } = player;\n\n            if (previewThumbnails && previewThumbnails.loaded) {\n                previewThumbnails.startMove(event);\n            }\n        });\n\n        // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering\n        this.bind(elements.progress, 'mouseleave click', () => {\n            const { previewThumbnails } = player;\n\n            if (previewThumbnails && previewThumbnails.loaded) {\n                previewThumbnails.endMove(false, true);\n            }\n        });\n\n        // Show scrubbing preview\n        this.bind(elements.progress, 'mousedown touchstart', event => {\n            const { previewThumbnails } = player;\n\n            if (previewThumbnails && previewThumbnails.loaded) {\n                previewThumbnails.startScrubbing(event);\n            }\n        });\n\n        this.bind(elements.progress, 'mouseup touchend', event => {\n            const { previewThumbnails } = player;\n\n            if (previewThumbnails && previewThumbnails.loaded) {\n                previewThumbnails.endScrubbing(event);\n            }\n        });\n\n        // Polyfill for lower fill in <input type=\"range\"> for webkit\n        if (browser.isWebkit) {\n            Array.from(getElements.call(player, 'input[type=\"range\"]')).forEach(element => {\n                this.bind(element, 'input', event => controls.updateRangeFill.call(player, event.target));\n            });\n        }\n\n        // Current time invert\n        // Only if one time element is used for both currentTime and duration\n        if (player.config.toggleInvert && !is.element(elements.display.duration)) {\n            this.bind(elements.display.currentTime, 'click', () => {\n                // Do nothing if we're at the start\n                if (player.currentTime === 0) {\n                    return;\n                }\n\n                player.config.invertTime = !player.config.invertTime;\n\n                controls.timeUpdate.call(player);\n            });\n        }\n\n        // Volume\n        this.bind(\n            elements.inputs.volume,\n            inputEvent,\n            event => {\n                player.volume = event.target.value;\n            },\n            'volume',\n        );\n\n        // Update controls.hover state (used for ui.toggleControls to avoid hiding when interacting)\n        this.bind(elements.controls, 'mouseenter mouseleave', event => {\n            elements.controls.hover = !player.touch && event.type === 'mouseenter';\n        });\n\n        // Update controls.pressed state (used for ui.toggleControls to avoid hiding when interacting)\n        this.bind(elements.controls, 'mousedown mouseup touchstart touchend touchcancel', event => {\n            elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);\n        });\n\n        // Show controls when they receive focus (e.g., when using keyboard tab key)\n        this.bind(elements.controls, 'focusin', () => {\n            const { config, timers } = player;\n\n            // Skip transition to prevent focus from scrolling the parent element\n            toggleClass(elements.controls, config.classNames.noTransition, true);\n\n            // Toggle\n            ui.toggleControls.call(player, true);\n\n            // Restore transition\n            setTimeout(() => {\n                toggleClass(elements.controls, config.classNames.noTransition, false);\n            }, 0);\n\n            // Delay a little more for mouse users\n            const delay = this.touch ? 3000 : 4000;\n\n            // Clear timer\n            clearTimeout(timers.controls);\n\n            // Hide again after delay\n            timers.controls = setTimeout(() => ui.toggleControls.call(player, false), delay);\n        });\n\n        // Mouse wheel for volume\n        this.bind(\n            elements.inputs.volume,\n            'wheel',\n            event => {\n                // Detect \"natural\" scroll - suppored on OS X Safari only\n                // Other browsers on OS X will be inverted until support improves\n                const inverted = event.webkitDirectionInvertedFromDevice;\n                // Get delta from event. Invert if `inverted` is true\n                const [x, y] = [event.deltaX, -event.deltaY].map(value => (inverted ? -value : value));\n                // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)\n                const direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y);\n\n                // Change the volume by 2%\n                player.increaseVolume(direction / 50);\n\n                // Don't break page scrolling at max and min\n                const { volume } = player.media;\n                if ((direction === 1 && volume < 1) || (direction === -1 && volume > 0)) {\n                    event.preventDefault();\n                }\n            },\n            'volume',\n            false,\n        );\n    }\n}\n\nexport default Listeners;\n","(function(root, factory) {\n  if (typeof define === 'function' && define.amd) {\n    define([], factory);\n  } else if (typeof exports === 'object') {\n    module.exports = factory();\n  } else {\n    root.loadjs = factory();\n  }\n}(this, function() {\n/**\n * Global dependencies.\n * @global {Object} document - DOM\n */\n\nvar devnull = function() {},\n    bundleIdCache = {},\n    bundleResultCache = {},\n    bundleCallbackQueue = {};\n\n\n/**\n * Subscribe to bundle load event.\n * @param {string[]} bundleIds - Bundle ids\n * @param {Function} callbackFn - The callback function\n */\nfunction subscribe(bundleIds, callbackFn) {\n  // listify\n  bundleIds = bundleIds.push ? bundleIds : [bundleIds];\n\n  var depsNotFound = [],\n      i = bundleIds.length,\n      numWaiting = i,\n      fn,\n      bundleId,\n      r,\n      q;\n\n  // define callback function\n  fn = function (bundleId, pathsNotFound) {\n    if (pathsNotFound.length) depsNotFound.push(bundleId);\n\n    numWaiting--;\n    if (!numWaiting) callbackFn(depsNotFound);\n  };\n\n  // register callback\n  while (i--) {\n    bundleId = bundleIds[i];\n\n    // execute callback if in result cache\n    r = bundleResultCache[bundleId];\n    if (r) {\n      fn(bundleId, r);\n      continue;\n    }\n\n    // add to callback queue\n    q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];\n    q.push(fn);\n  }\n}\n\n\n/**\n * Publish bundle load event.\n * @param {string} bundleId - Bundle id\n * @param {string[]} pathsNotFound - List of files not found\n */\nfunction publish(bundleId, pathsNotFound) {\n  // exit if id isn't defined\n  if (!bundleId) return;\n\n  var q = bundleCallbackQueue[bundleId];\n\n  // cache result\n  bundleResultCache[bundleId] = pathsNotFound;\n\n  // exit if queue is empty\n  if (!q) return;\n\n  // empty callback queue\n  while (q.length) {\n    q[0](bundleId, pathsNotFound);\n    q.splice(0, 1);\n  }\n}\n\n\n/**\n * Execute callbacks.\n * @param {Object or Function} args - The callback args\n * @param {string[]} depsNotFound - List of dependencies not found\n */\nfunction executeCallbacks(args, depsNotFound) {\n  // accept function as argument\n  if (args.call) args = {success: args};\n\n  // success and error callbacks\n  if (depsNotFound.length) (args.error || devnull)(depsNotFound);\n  else (args.success || devnull)(args);\n}\n\n\n/**\n * Load individual file.\n * @param {string} path - The file path\n * @param {Function} callbackFn - The callback function\n */\nfunction loadFile(path, callbackFn, args, numTries) {\n  var doc = document,\n      async = args.async,\n      maxTries = (args.numRetries || 0) + 1,\n      beforeCallbackFn = args.before || devnull,\n      pathStripped = path.replace(/^(css|img)!/, ''),\n      isLegacyIECss,\n      e;\n\n  numTries = numTries || 0;\n\n  if (/(^css!|\\.css$)/.test(path)) {\n    // css\n    e = doc.createElement('link');\n    e.rel = 'stylesheet';\n    e.href = pathStripped;\n\n    // tag IE9+\n    isLegacyIECss = 'hideFocus' in e;\n\n    // use preload in IE Edge (to detect load errors)\n    if (isLegacyIECss && e.relList) {\n      isLegacyIECss = 0;\n      e.rel = 'preload';\n      e.as = 'style';\n    }\n  } else if (/(^img!|\\.(png|gif|jpg|svg)$)/.test(path)) {\n    // image\n    e = doc.createElement('img');\n    e.src = pathStripped;    \n  } else {\n    // javascript\n    e = doc.createElement('script');\n    e.src = path;\n    e.async = async === undefined ? true : async;\n  }\n\n  e.onload = e.onerror = e.onbeforeload = function (ev) {\n    var result = ev.type[0];\n\n    // treat empty stylesheets as failures to get around lack of onerror\n    // support in IE9-11\n    if (isLegacyIECss) {\n      try {\n        if (!e.sheet.cssText.length) result = 'e';\n      } catch (x) {\n        // sheets objects created from load errors don't allow access to\n        // `cssText` (unless error is Code:18 SecurityError)\n        if (x.code != 18) result = 'e';\n      }\n    }\n\n    // handle retries in case of load failure\n    if (result == 'e') {\n      // increment counter\n      numTries += 1;\n\n      // exit function and try again\n      if (numTries < maxTries) {\n        return loadFile(path, callbackFn, args, numTries);\n      }\n    } else if (e.rel == 'preload' && e.as == 'style') {\n      // activate preloaded stylesheets\n      return e.rel = 'stylesheet'; // jshint ignore:line\n    }\n    \n    // execute callback\n    callbackFn(path, result, ev.defaultPrevented);\n  };\n\n  // add to document (unless callback returns `false`)\n  if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);\n}\n\n\n/**\n * Load multiple files.\n * @param {string[]} paths - The file paths\n * @param {Function} callbackFn - The callback function\n */\nfunction loadFiles(paths, callbackFn, args) {\n  // listify paths\n  paths = paths.push ? paths : [paths];\n\n  var numWaiting = paths.length,\n      x = numWaiting,\n      pathsNotFound = [],\n      fn,\n      i;\n\n  // define callback function\n  fn = function(path, result, defaultPrevented) {\n    // handle error\n    if (result == 'e') pathsNotFound.push(path);\n\n    // handle beforeload event. If defaultPrevented then that means the load\n    // will be blocked (ex. Ghostery/ABP on Safari)\n    if (result == 'b') {\n      if (defaultPrevented) pathsNotFound.push(path);\n      else return;\n    }\n\n    numWaiting--;\n    if (!numWaiting) callbackFn(pathsNotFound);\n  };\n\n  // load scripts\n  for (i=0; i < x; i++) loadFile(paths[i], fn, args);\n}\n\n\n/**\n * Initiate script load and register bundle.\n * @param {(string|string[])} paths - The file paths\n * @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success\n *   callback or (3) object literal with success/error arguments, numRetries,\n *   etc.\n * @param {(Function|Object)} [arg2] - The (1) success callback or (2) object\n *   literal with success/error arguments, numRetries, etc.\n */\nfunction loadjs(paths, arg1, arg2) {\n  var bundleId,\n      args;\n\n  // bundleId (if string)\n  if (arg1 && arg1.trim) bundleId = arg1;\n\n  // args (default is {})\n  args = (bundleId ? arg2 : arg1) || {};\n\n  // throw error if bundle is already defined\n  if (bundleId) {\n    if (bundleId in bundleIdCache) {\n      throw \"LoadJS\";\n    } else {\n      bundleIdCache[bundleId] = true;\n    }\n  }\n\n  function loadFn(resolve, reject) {\n    loadFiles(paths, function (pathsNotFound) {\n      // execute callbacks\n      executeCallbacks(args, pathsNotFound);\n      \n      // resolve Promise\n      if (resolve) {\n        executeCallbacks({success: resolve, error: reject}, pathsNotFound);\n      }\n\n      // publish bundle load event\n      publish(bundleId, pathsNotFound);\n    }, args);\n  }\n  \n  if (args.returnPromise) return new Promise(loadFn);\n  else loadFn();\n}\n\n\n/**\n * Execute callbacks when dependencies have been satisfied.\n * @param {(string|string[])} deps - List of bundle ids\n * @param {Object} args - success/error arguments\n */\nloadjs.ready = function ready(deps, args) {\n  // subscribe to bundle load event\n  subscribe(deps, function (depsNotFound) {\n    // execute callbacks\n    executeCallbacks(args, depsNotFound);\n  });\n\n  return loadjs;\n};\n\n\n/**\n * Manually satisfy bundle dependencies.\n * @param {string} bundleId - The bundle id\n */\nloadjs.done = function done(bundleId) {\n  publish(bundleId, []);\n};\n\n\n/**\n * Reset loadjs dependencies statuses\n */\nloadjs.reset = function reset() {\n  bundleIdCache = {};\n  bundleResultCache = {};\n  bundleCallbackQueue = {};\n};\n\n\n/**\n * Determine if bundle has already been defined\n * @param String} bundleId - The bundle id\n */\nloadjs.isDefined = function isDefined(bundleId) {\n  return bundleId in bundleIdCache;\n};\n\n\n// export\nreturn loadjs;\n\n}));\n","// ==========================================================================\n// Load an external script\n// ==========================================================================\n\nimport loadjs from 'loadjs';\n\nexport default function loadScript(url) {\n    return new Promise((resolve, reject) => {\n        loadjs(url, {\n            success: resolve,\n            error: reject,\n        });\n    });\n}\n","// ==========================================================================\n// Vimeo plugin\n// ==========================================================================\n\nimport captions from '../captions';\nimport controls from '../controls';\nimport ui from '../ui';\nimport { createElement, replaceElement, toggleClass } from '../utils/elements';\nimport { triggerEvent } from '../utils/events';\nimport fetch from '../utils/fetch';\nimport is from '../utils/is';\nimport loadScript from '../utils/load-script';\nimport { extend } from '../utils/objects';\nimport { format, stripHTML } from '../utils/strings';\nimport { setAspectRatio } from '../utils/style';\nimport { buildUrlParams } from '../utils/urls';\n\n// Parse Vimeo ID from URL\nfunction parseId(url) {\n    if (is.empty(url)) {\n        return null;\n    }\n\n    if (is.number(Number(url))) {\n        return url;\n    }\n\n    const regex = /^.*(vimeo.com\\/|video\\/)(\\d+).*/;\n    return url.match(regex) ? RegExp.$2 : url;\n}\n\n// Set playback state and trigger change (only on actual change)\nfunction assurePlaybackState(play) {\n    if (play && !this.embed.hasPlayed) {\n        this.embed.hasPlayed = true;\n    }\n    if (this.media.paused === play) {\n        this.media.paused = !play;\n        triggerEvent.call(this, this.media, play ? 'play' : 'pause');\n    }\n}\n\nconst vimeo = {\n    setup() {\n        // Add embed class for responsive\n        toggleClass(this.elements.wrapper, this.config.classNames.embed, true);\n\n        // Set intial ratio\n        setAspectRatio.call(this);\n\n        // Load the SDK if not already\n        if (!is.object(window.Vimeo)) {\n            loadScript(this.config.urls.vimeo.sdk)\n                .then(() => {\n                    vimeo.ready.call(this);\n                })\n                .catch(error => {\n                    this.debug.warn('Vimeo SDK (player.js) failed to load', error);\n                });\n        } else {\n            vimeo.ready.call(this);\n        }\n    },\n\n    // API Ready\n    ready() {\n        const player = this;\n        const config = player.config.vimeo;\n\n        // Get Vimeo params for the iframe\n        const params = buildUrlParams(\n            extend(\n                {},\n                {\n                    loop: player.config.loop.active,\n                    autoplay: player.autoplay,\n                    muted: player.muted,\n                    gesture: 'media',\n                    playsinline: !this.config.fullscreen.iosNative,\n                },\n                config,\n            ),\n        );\n\n        // Get the source URL or ID\n        let source = player.media.getAttribute('src');\n\n        // Get from <div> if needed\n        if (is.empty(source)) {\n            source = player.media.getAttribute(player.config.attributes.embed.id);\n        }\n\n        const id = parseId(source);\n        // Build an iframe\n        const iframe = createElement('iframe');\n        const src = format(player.config.urls.vimeo.iframe, id, params);\n        iframe.setAttribute('src', src);\n        iframe.setAttribute('allowfullscreen', '');\n        iframe.setAttribute('allowtransparency', '');\n        iframe.setAttribute('allow', 'autoplay');\n\n        // Get poster, if already set\n        const { poster } = player;\n        // Inject the package\n        const wrapper = createElement('div', { poster, class: player.config.classNames.embedContainer });\n        wrapper.appendChild(iframe);\n        player.media = replaceElement(wrapper, player.media);\n\n        // Get poster image\n        fetch(format(player.config.urls.vimeo.api, id), 'json').then(response => {\n            if (is.empty(response)) {\n                return;\n            }\n\n            // Get the URL for thumbnail\n            const url = new URL(response[0].thumbnail_large);\n\n            // Get original image\n            url.pathname = `${url.pathname.split('_')[0]}.jpg`;\n\n            // Set and show poster\n            ui.setPoster.call(player, url.href).catch(() => {});\n        });\n\n        // Setup instance\n        // https://github.com/vimeo/player.js\n        player.embed = new window.Vimeo.Player(iframe, {\n            autopause: player.config.autopause,\n            muted: player.muted,\n        });\n\n        player.media.paused = true;\n        player.media.currentTime = 0;\n\n        // Disable native text track rendering\n        if (player.supported.ui) {\n            player.embed.disableTextTrack();\n        }\n\n        // Create a faux HTML5 API using the Vimeo API\n        player.media.play = () => {\n            assurePlaybackState.call(player, true);\n            return player.embed.play();\n        };\n\n        player.media.pause = () => {\n            assurePlaybackState.call(player, false);\n            return player.embed.pause();\n        };\n\n        player.media.stop = () => {\n            player.pause();\n            player.currentTime = 0;\n        };\n\n        // Seeking\n        let { currentTime } = player.media;\n        Object.defineProperty(player.media, 'currentTime', {\n            get() {\n                return currentTime;\n            },\n            set(time) {\n                // Vimeo will automatically play on seek if the video hasn't been played before\n\n                // Get current paused state and volume etc\n                const { embed, media, paused, volume } = player;\n                const restorePause = paused && !embed.hasPlayed;\n\n                // Set seeking state and trigger event\n                media.seeking = true;\n                triggerEvent.call(player, media, 'seeking');\n\n                // If paused, mute until seek is complete\n                Promise.resolve(restorePause && embed.setVolume(0))\n                    // Seek\n                    .then(() => embed.setCurrentTime(time))\n                    // Restore paused\n                    .then(() => restorePause && embed.pause())\n                    // Restore volume\n                    .then(() => restorePause && embed.setVolume(volume))\n                    .catch(() => {\n                        // Do nothing\n                    });\n            },\n        });\n\n        // Playback speed\n        let speed = player.config.speed.selected;\n        Object.defineProperty(player.media, 'playbackRate', {\n            get() {\n                return speed;\n            },\n            set(input) {\n                player.embed\n                    .setPlaybackRate(input)\n                    .then(() => {\n                        speed = input;\n                        triggerEvent.call(player, player.media, 'ratechange');\n                    })\n                    .catch(error => {\n                        // Hide menu item (and menu if empty)\n                        if (error.name === 'Error') {\n                            controls.setSpeedMenu.call(player, []);\n                        }\n                    });\n            },\n        });\n\n        // Volume\n        let { volume } = player.config;\n        Object.defineProperty(player.media, 'volume', {\n            get() {\n                return volume;\n            },\n            set(input) {\n                player.embed.setVolume(input).then(() => {\n                    volume = input;\n                    triggerEvent.call(player, player.media, 'volumechange');\n                });\n            },\n        });\n\n        // Muted\n        let { muted } = player.config;\n        Object.defineProperty(player.media, 'muted', {\n            get() {\n                return muted;\n            },\n            set(input) {\n                const toggle = is.boolean(input) ? input : false;\n\n                player.embed.setVolume(toggle ? 0 : player.config.volume).then(() => {\n                    muted = toggle;\n                    triggerEvent.call(player, player.media, 'volumechange');\n                });\n            },\n        });\n\n        // Loop\n        let { loop } = player.config;\n        Object.defineProperty(player.media, 'loop', {\n            get() {\n                return loop;\n            },\n            set(input) {\n                const toggle = is.boolean(input) ? input : player.config.loop.active;\n\n                player.embed.setLoop(toggle).then(() => {\n                    loop = toggle;\n                });\n            },\n        });\n\n        // Source\n        let currentSrc;\n        player.embed\n            .getVideoUrl()\n            .then(value => {\n                currentSrc = value;\n                controls.setDownloadUrl.call(player);\n            })\n            .catch(error => {\n                this.debug.warn(error);\n            });\n\n        Object.defineProperty(player.media, 'currentSrc', {\n            get() {\n                return currentSrc;\n            },\n        });\n\n        // Ended\n        Object.defineProperty(player.media, 'ended', {\n            get() {\n                return player.currentTime === player.duration;\n            },\n        });\n\n        // Set aspect ratio based on video size\n        Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(dimensions => {\n            const [width, height] = dimensions;\n            player.embed.ratio = [width, height];\n            setAspectRatio.call(this);\n        });\n\n        // Set autopause\n        player.embed.setAutopause(player.config.autopause).then(state => {\n            player.config.autopause = state;\n        });\n\n        // Get title\n        player.embed.getVideoTitle().then(title => {\n            player.config.title = title;\n            ui.setTitle.call(this);\n        });\n\n        // Get current time\n        player.embed.getCurrentTime().then(value => {\n            currentTime = value;\n            triggerEvent.call(player, player.media, 'timeupdate');\n        });\n\n        // Get duration\n        player.embed.getDuration().then(value => {\n            player.media.duration = value;\n            triggerEvent.call(player, player.media, 'durationchange');\n        });\n\n        // Get captions\n        player.embed.getTextTracks().then(tracks => {\n            player.media.textTracks = tracks;\n            captions.setup.call(player);\n        });\n\n        player.embed.on('cuechange', ({ cues = [] }) => {\n            const strippedCues = cues.map(cue => stripHTML(cue.text));\n            captions.updateCues.call(player, strippedCues);\n        });\n\n        player.embed.on('loaded', () => {\n            // Assure state and events are updated on autoplay\n            player.embed.getPaused().then(paused => {\n                assurePlaybackState.call(player, !paused);\n                if (!paused) {\n                    triggerEvent.call(player, player.media, 'playing');\n                }\n            });\n\n            if (is.element(player.embed.element) && player.supported.ui) {\n                const frame = player.embed.element;\n\n                // Fix keyboard focus issues\n                // https://github.com/sampotts/plyr/issues/317\n                frame.setAttribute('tabindex', -1);\n            }\n        });\n\n        player.embed.on('play', () => {\n            assurePlaybackState.call(player, true);\n            triggerEvent.call(player, player.media, 'playing');\n        });\n\n        player.embed.on('pause', () => {\n            assurePlaybackState.call(player, false);\n        });\n\n        player.embed.on('timeupdate', data => {\n            player.media.seeking = false;\n            currentTime = data.seconds;\n            triggerEvent.call(player, player.media, 'timeupdate');\n        });\n\n        player.embed.on('progress', data => {\n            player.media.buffered = data.percent;\n            triggerEvent.call(player, player.media, 'progress');\n\n            // Check all loaded\n            if (parseInt(data.percent, 10) === 1) {\n                triggerEvent.call(player, player.media, 'canplaythrough');\n            }\n\n            // Get duration as if we do it before load, it gives an incorrect value\n            // https://github.com/sampotts/plyr/issues/891\n            player.embed.getDuration().then(value => {\n                if (value !== player.media.duration) {\n                    player.media.duration = value;\n                    triggerEvent.call(player, player.media, 'durationchange');\n                }\n            });\n        });\n\n        player.embed.on('seeked', () => {\n            player.media.seeking = false;\n            triggerEvent.call(player, player.media, 'seeked');\n        });\n\n        player.embed.on('ended', () => {\n            player.media.paused = true;\n            triggerEvent.call(player, player.media, 'ended');\n        });\n\n        player.embed.on('error', detail => {\n            player.media.error = detail;\n            triggerEvent.call(player, player.media, 'error');\n        });\n\n        // Rebuild UI\n        setTimeout(() => ui.build.call(player), 0);\n    },\n};\n\nexport default vimeo;\n","// ==========================================================================\n// YouTube plugin\n// ==========================================================================\n\nimport ui from '../ui';\nimport { createElement, replaceElement, toggleClass } from '../utils/elements';\nimport { triggerEvent } from '../utils/events';\nimport fetch from '../utils/fetch';\nimport is from '../utils/is';\nimport loadImage from '../utils/load-image';\nimport loadScript from '../utils/load-script';\nimport { extend } from '../utils/objects';\nimport { format, generateId } from '../utils/strings';\nimport { setAspectRatio } from '../utils/style';\n\n// Parse YouTube ID from URL\nfunction parseId(url) {\n    if (is.empty(url)) {\n        return null;\n    }\n\n    const regex = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/;\n    return url.match(regex) ? RegExp.$2 : url;\n}\n\n// Set playback state and trigger change (only on actual change)\nfunction assurePlaybackState(play) {\n    if (play && !this.embed.hasPlayed) {\n        this.embed.hasPlayed = true;\n    }\n    if (this.media.paused === play) {\n        this.media.paused = !play;\n        triggerEvent.call(this, this.media, play ? 'play' : 'pause');\n    }\n}\n\nfunction getHost(config) {\n    if (config.noCookie) {\n        return 'https://www.youtube-nocookie.com';\n    }\n\n    if (window.location.protocol === 'http:') {\n        return 'http://www.youtube.com';\n    }\n\n    // Use YouTube's default\n    return undefined;\n}\n\nconst youtube = {\n    setup() {\n        // Add embed class for responsive\n        toggleClass(this.elements.wrapper, this.config.classNames.embed, true);\n\n        // Setup API\n        if (is.object(window.YT) && is.function(window.YT.Player)) {\n            youtube.ready.call(this);\n        } else {\n            // Reference current global callback\n            const callback = window.onYouTubeIframeAPIReady;\n\n            // Set callback to process queue\n            window.onYouTubeIframeAPIReady = () => {\n                // Call global callback if set\n                if (is.function(callback)) {\n                    callback();\n                }\n\n                youtube.ready.call(this);\n            };\n\n            // Load the SDK\n            loadScript(this.config.urls.youtube.sdk).catch(error => {\n                this.debug.warn('YouTube API failed to load', error);\n            });\n        }\n    },\n\n    // Get the media title\n    getTitle(videoId) {\n        const url = format(this.config.urls.youtube.api, videoId);\n\n        fetch(url)\n            .then(data => {\n                if (is.object(data)) {\n                    const { title, height, width } = data;\n\n                    // Set title\n                    this.config.title = title;\n                    ui.setTitle.call(this);\n\n                    // Set aspect ratio\n                    this.embed.ratio = [width, height];\n                }\n\n                setAspectRatio.call(this);\n            })\n            .catch(() => {\n                // Set aspect ratio\n                setAspectRatio.call(this);\n            });\n    },\n\n    // API ready\n    ready() {\n        const player = this;\n        // Ignore already setup (race condition)\n        const currentId = player.media && player.media.getAttribute('id');\n        if (!is.empty(currentId) && currentId.startsWith('youtube-')) {\n            return;\n        }\n\n        // Get the source URL or ID\n        let source = player.media.getAttribute('src');\n\n        // Get from <div> if needed\n        if (is.empty(source)) {\n            source = player.media.getAttribute(this.config.attributes.embed.id);\n        }\n\n        // Replace the <iframe> with a <div> due to YouTube API issues\n        const videoId = parseId(source);\n        const id = generateId(player.provider);\n        // Get poster, if already set\n        const { poster } = player;\n        // Replace media element\n        const container = createElement('div', { id, poster });\n        player.media = replaceElement(container, player.media);\n\n        // Id to poster wrapper\n        const posterSrc = s => `https://i.ytimg.com/vi/${videoId}/${s}default.jpg`;\n\n        // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)\n        loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded\n            .catch(() => loadImage(posterSrc('sd'), 121)) // 480p padded 4:3\n            .catch(() => loadImage(posterSrc('hq'))) // 360p padded 4:3. Always exists\n            .then(image => ui.setPoster.call(player, image.src))\n            .then(src => {\n                // If the image is padded, use background-size \"cover\" instead (like youtube does too with their posters)\n                if (!src.includes('maxres')) {\n                    player.elements.poster.style.backgroundSize = 'cover';\n                }\n            })\n            .catch(() => {});\n\n        const config = player.config.youtube;\n\n        // Setup instance\n        // https://developers.google.com/youtube/iframe_api_reference\n        player.embed = new window.YT.Player(id, {\n            videoId,\n            host: getHost(config),\n            playerVars: extend(\n                {},\n                {\n                    autoplay: player.config.autoplay ? 1 : 0, // Autoplay\n                    hl: player.config.hl, // iframe interface language\n                    controls: player.supported.ui ? 0 : 1, // Only show controls if not fully supported\n                    disablekb: 1, // Disable keyboard as we handle it\n                    playsinline: !player.config.fullscreen.iosNative ? 1 : 0, // Allow iOS inline playback\n                    // Captions are flaky on YouTube\n                    cc_load_policy: player.captions.active ? 1 : 0,\n                    cc_lang_pref: player.config.captions.language,\n                    // Tracking for stats\n                    widget_referrer: window ? window.location.href : null,\n                },\n                config,\n            ),\n            events: {\n                onError(event) {\n                    // YouTube may fire onError twice, so only handle it once\n                    if (!player.media.error) {\n                        const code = event.data;\n                        // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError\n                        const message =\n                            {\n                                2: 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.',\n                                5: 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.',\n                                100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',\n                                101: 'The owner of the requested video does not allow it to be played in embedded players.',\n                                150: 'The owner of the requested video does not allow it to be played in embedded players.',\n                            }[code] || 'An unknown error occured';\n\n                        player.media.error = { code, message };\n\n                        triggerEvent.call(player, player.media, 'error');\n                    }\n                },\n                onPlaybackRateChange(event) {\n                    // Get the instance\n                    const instance = event.target;\n\n                    // Get current speed\n                    player.media.playbackRate = instance.getPlaybackRate();\n\n                    triggerEvent.call(player, player.media, 'ratechange');\n                },\n                onReady(event) {\n                    // Bail if onReady has already been called. See issue #1108\n                    if (is.function(player.media.play)) {\n                        return;\n                    }\n                    // Get the instance\n                    const instance = event.target;\n\n                    // Get the title\n                    youtube.getTitle.call(player, videoId);\n\n                    // Create a faux HTML5 API using the YouTube API\n                    player.media.play = () => {\n                        assurePlaybackState.call(player, true);\n                        instance.playVideo();\n                    };\n\n                    player.media.pause = () => {\n                        assurePlaybackState.call(player, false);\n                        instance.pauseVideo();\n                    };\n\n                    player.media.stop = () => {\n                        instance.stopVideo();\n                    };\n\n                    player.media.duration = instance.getDuration();\n                    player.media.paused = true;\n\n                    // Seeking\n                    player.media.currentTime = 0;\n                    Object.defineProperty(player.media, 'currentTime', {\n                        get() {\n                            return Number(instance.getCurrentTime());\n                        },\n                        set(time) {\n                            // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).\n                            if (player.paused && !player.embed.hasPlayed) {\n                                player.embed.mute();\n                            }\n\n                            // Set seeking state and trigger event\n                            player.media.seeking = true;\n                            triggerEvent.call(player, player.media, 'seeking');\n\n                            // Seek after events sent\n                            instance.seekTo(time);\n                        },\n                    });\n\n                    // Playback speed\n                    Object.defineProperty(player.media, 'playbackRate', {\n                        get() {\n                            return instance.getPlaybackRate();\n                        },\n                        set(input) {\n                            instance.setPlaybackRate(input);\n                        },\n                    });\n\n                    // Volume\n                    let { volume } = player.config;\n                    Object.defineProperty(player.media, 'volume', {\n                        get() {\n                            return volume;\n                        },\n                        set(input) {\n                            volume = input;\n                            instance.setVolume(volume * 100);\n                            triggerEvent.call(player, player.media, 'volumechange');\n                        },\n                    });\n\n                    // Muted\n                    let { muted } = player.config;\n                    Object.defineProperty(player.media, 'muted', {\n                        get() {\n                            return muted;\n                        },\n                        set(input) {\n                            const toggle = is.boolean(input) ? input : muted;\n                            muted = toggle;\n                            instance[toggle ? 'mute' : 'unMute']();\n                            triggerEvent.call(player, player.media, 'volumechange');\n                        },\n                    });\n\n                    // Source\n                    Object.defineProperty(player.media, 'currentSrc', {\n                        get() {\n                            return instance.getVideoUrl();\n                        },\n                    });\n\n                    // Ended\n                    Object.defineProperty(player.media, 'ended', {\n                        get() {\n                            return player.currentTime === player.duration;\n                        },\n                    });\n\n                    // Get available speeds\n                    player.options.speed = instance.getAvailablePlaybackRates();\n\n                    // Set the tabindex to avoid focus entering iframe\n                    if (player.supported.ui) {\n                        player.media.setAttribute('tabindex', -1);\n                    }\n\n                    triggerEvent.call(player, player.media, 'timeupdate');\n                    triggerEvent.call(player, player.media, 'durationchange');\n\n                    // Reset timer\n                    clearInterval(player.timers.buffering);\n\n                    // Setup buffering\n                    player.timers.buffering = setInterval(() => {\n                        // Get loaded % from YouTube\n                        player.media.buffered = instance.getVideoLoadedFraction();\n\n                        // Trigger progress only when we actually buffer something\n                        if (player.media.lastBuffered === null || player.media.lastBuffered < player.media.buffered) {\n                            triggerEvent.call(player, player.media, 'progress');\n                        }\n\n                        // Set last buffer point\n                        player.media.lastBuffered = player.media.buffered;\n\n                        // Bail if we're at 100%\n                        if (player.media.buffered === 1) {\n                            clearInterval(player.timers.buffering);\n\n                            // Trigger event\n                            triggerEvent.call(player, player.media, 'canplaythrough');\n                        }\n                    }, 200);\n\n                    // Rebuild UI\n                    setTimeout(() => ui.build.call(player), 50);\n                },\n                onStateChange(event) {\n                    // Get the instance\n                    const instance = event.target;\n\n                    // Reset timer\n                    clearInterval(player.timers.playing);\n\n                    const seeked = player.media.seeking && [1, 2].includes(event.data);\n\n                    if (seeked) {\n                        // Unset seeking and fire seeked event\n                        player.media.seeking = false;\n                        triggerEvent.call(player, player.media, 'seeked');\n                    }\n\n                    // Handle events\n                    // -1   Unstarted\n                    // 0    Ended\n                    // 1    Playing\n                    // 2    Paused\n                    // 3    Buffering\n                    // 5    Video cued\n                    switch (event.data) {\n                        case -1:\n                            // Update scrubber\n                            triggerEvent.call(player, player.media, 'timeupdate');\n\n                            // Get loaded % from YouTube\n                            player.media.buffered = instance.getVideoLoadedFraction();\n                            triggerEvent.call(player, player.media, 'progress');\n\n                            break;\n\n                        case 0:\n                            assurePlaybackState.call(player, false);\n\n                            // YouTube doesn't support loop for a single video, so mimick it.\n                            if (player.media.loop) {\n                                // YouTube needs a call to `stopVideo` before playing again\n                                instance.stopVideo();\n                                instance.playVideo();\n                            } else {\n                                triggerEvent.call(player, player.media, 'ended');\n                            }\n\n                            break;\n\n                        case 1:\n                            // Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)\n                            if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {\n                                player.media.pause();\n                            } else {\n                                assurePlaybackState.call(player, true);\n\n                                triggerEvent.call(player, player.media, 'playing');\n\n                                // Poll to get playback progress\n                                player.timers.playing = setInterval(() => {\n                                    triggerEvent.call(player, player.media, 'timeupdate');\n                                }, 50);\n\n                                // Check duration again due to YouTube bug\n                                // https://github.com/sampotts/plyr/issues/374\n                                // https://code.google.com/p/gdata-issues/issues/detail?id=8690\n                                if (player.media.duration !== instance.getDuration()) {\n                                    player.media.duration = instance.getDuration();\n                                    triggerEvent.call(player, player.media, 'durationchange');\n                                }\n                            }\n\n                            break;\n\n                        case 2:\n                            // Restore audio (YouTube starts playing on seek if the video hasn't been played yet)\n                            if (!player.muted) {\n                                player.embed.unMute();\n                            }\n                            assurePlaybackState.call(player, false);\n\n                            break;\n\n                        default:\n                            break;\n                    }\n\n                    triggerEvent.call(player, player.elements.container, 'statechange', false, {\n                        code: event.data,\n                    });\n                },\n            },\n        });\n    },\n};\n\nexport default youtube;\n","// ==========================================================================\n// Plyr Media\n// ==========================================================================\n\nimport html5 from './html5';\nimport vimeo from './plugins/vimeo';\nimport youtube from './plugins/youtube';\nimport { createElement, toggleClass, wrap } from './utils/elements';\n\nconst media = {\n    // Setup media\n    setup() {\n        // If there's no media, bail\n        if (!this.media) {\n            this.debug.warn('No media element found!');\n            return;\n        }\n\n        // Add type class\n        toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', this.type), true);\n\n        // Add provider class\n        toggleClass(this.elements.container, this.config.classNames.provider.replace('{0}', this.provider), true);\n\n        // Add video class for embeds\n        // This will require changes if audio embeds are added\n        if (this.isEmbed) {\n            toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', 'video'), true);\n        }\n\n        // Inject the player wrapper\n        if (this.isVideo) {\n            // Create the wrapper div\n            this.elements.wrapper = createElement('div', {\n                class: this.config.classNames.video,\n            });\n\n            // Wrap the video in a container\n            wrap(this.media, this.elements.wrapper);\n\n            // Faux poster container\n            this.elements.poster = createElement('div', {\n                class: this.config.classNames.poster,\n            });\n\n            this.elements.wrapper.appendChild(this.elements.poster);\n        }\n\n        if (this.isHTML5) {\n            html5.extend.call(this);\n        } else if (this.isYouTube) {\n            youtube.setup.call(this);\n        } else if (this.isVimeo) {\n            vimeo.setup.call(this);\n        }\n    },\n};\n\nexport default media;\n","// ==========================================================================\n// Advertisement plugin using Google IMA HTML5 SDK\n// Create an account with our ad partner, vi here:\n// https://www.vi.ai/publisher-video-monetization/\n// ==========================================================================\n\n/* global google */\n\nimport { createElement } from '../utils/elements';\nimport { triggerEvent } from '../utils/events';\nimport i18n from '../utils/i18n';\nimport is from '../utils/is';\nimport loadScript from '../utils/load-script';\nimport { formatTime } from '../utils/time';\nimport { buildUrlParams } from '../utils/urls';\n\nconst destroy = instance => {\n    // Destroy our adsManager\n    if (instance.manager) {\n        instance.manager.destroy();\n    }\n\n    // Destroy our adsManager\n    if (instance.elements.displayContainer) {\n        instance.elements.displayContainer.destroy();\n    }\n\n    instance.elements.container.remove();\n};\n\nclass Ads {\n    /**\n     * Ads constructor.\n     * @param {Object} player\n     * @return {Ads}\n     */\n    constructor(player) {\n        this.player = player;\n        this.config = player.config.ads;\n        this.playing = false;\n        this.initialized = false;\n        this.elements = {\n            container: null,\n            displayContainer: null,\n        };\n        this.manager = null;\n        this.loader = null;\n        this.cuePoints = null;\n        this.events = {};\n        this.safetyTimer = null;\n        this.countdownTimer = null;\n\n        // Setup a promise to resolve when the IMA manager is ready\n        this.managerPromise = new Promise((resolve, reject) => {\n            // The ad is loaded and ready\n            this.on('loaded', resolve);\n\n            // Ads failed\n            this.on('error', reject);\n        });\n\n        this.load();\n    }\n\n    get enabled() {\n        const { config } = this;\n\n        return (\n            this.player.isHTML5 &&\n            this.player.isVideo &&\n            config.enabled &&\n            (!is.empty(config.publisherId) || is.url(config.tagUrl))\n        );\n    }\n\n    /**\n     * Load the IMA SDK\n     */\n    load() {\n        if (!this.enabled) {\n            return;\n        }\n\n        // Check if the Google IMA3 SDK is loaded or load it ourselves\n        if (!is.object(window.google) || !is.object(window.google.ima)) {\n            loadScript(this.player.config.urls.googleIMA.sdk)\n                .then(() => {\n                    this.ready();\n                })\n                .catch(() => {\n                    // Script failed to load or is blocked\n                    this.trigger('error', new Error('Google IMA SDK failed to load'));\n                });\n        } else {\n            this.ready();\n        }\n    }\n\n    /**\n     * Get the ads instance ready\n     */\n    ready() {\n        // Double check we're enabled\n        if (!this.enabled) {\n            destroy(this);\n        }\n\n        // Start ticking our safety timer. If the whole advertisement\n        // thing doesn't resolve within our set time; we bail\n        this.startSafetyTimer(12000, 'ready()');\n\n        // Clear the safety timer\n        this.managerPromise.then(() => {\n            this.clearSafetyTimer('onAdsManagerLoaded()');\n        });\n\n        // Set listeners on the Plyr instance\n        this.listeners();\n\n        // Setup the IMA SDK\n        this.setupIMA();\n    }\n\n    // Build the tag URL\n    get tagUrl() {\n        const { config } = this;\n\n        if (is.url(config.tagUrl)) {\n            return config.tagUrl;\n        }\n\n        const params = {\n            AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',\n            AV_CHANNELID: '5a0458dc28a06145e4519d21',\n            AV_URL: window.location.hostname,\n            cb: Date.now(),\n            AV_WIDTH: 640,\n            AV_HEIGHT: 480,\n            AV_CDIM2: this.publisherId,\n        };\n\n        const base = 'https://go.aniview.com/api/adserver6/vast/';\n\n        return `${base}?${buildUrlParams(params)}`;\n    }\n\n    /**\n     * In order for the SDK to display ads for our video, we need to tell it where to put them,\n     * so here we define our ad container. This div is set up to render on top of the video player.\n     * Using the code below, we tell the SDK to render ads within that div. We also provide a\n     * handle to the content video player - the SDK will poll the current time of our player to\n     * properly place mid-rolls. After we create the ad display container, we initialize it. On\n     * mobile devices, this initialization is done as the result of a user action.\n     */\n    setupIMA() {\n        // Create the container for our advertisements\n        this.elements.container = createElement('div', {\n            class: this.player.config.classNames.ads,\n        });\n\n        this.player.elements.container.appendChild(this.elements.container);\n\n        // So we can run VPAID2\n        google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED);\n\n        // Set language\n        google.ima.settings.setLocale(this.player.config.ads.language);\n\n        // Set playback for iOS10+\n        google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline);\n\n        // We assume the adContainer is the video container of the plyr element that will house the ads\n        this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media);\n\n        // Request video ads to be pre-loaded\n        this.requestAds();\n    }\n\n    /**\n     * Request advertisements\n     */\n    requestAds() {\n        const { container } = this.player.elements;\n\n        try {\n            // Create ads loader\n            this.loader = new google.ima.AdsLoader(this.elements.displayContainer);\n\n            // Listen and respond to ads loaded and error events\n            this.loader.addEventListener(\n                google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,\n                event => this.onAdsManagerLoaded(event),\n                false,\n            );\n            this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, error => this.onAdError(error), false);\n\n            // Request video ads\n            const request = new google.ima.AdsRequest();\n            request.adTagUrl = this.tagUrl;\n\n            // Specify the linear and nonlinear slot sizes. This helps the SDK\n            // to select the correct creative if multiple are returned\n            request.linearAdSlotWidth = container.offsetWidth;\n            request.linearAdSlotHeight = container.offsetHeight;\n            request.nonLinearAdSlotWidth = container.offsetWidth;\n            request.nonLinearAdSlotHeight = container.offsetHeight;\n\n            // We only overlay ads as we only support video.\n            request.forceNonLinearFullSlot = false;\n\n            // Mute based on current state\n            request.setAdWillPlayMuted(!this.player.muted);\n\n            this.loader.requestAds(request);\n        } catch (e) {\n            this.onAdError(e);\n        }\n    }\n\n    /**\n     * Update the ad countdown\n     * @param {Boolean} start\n     */\n    pollCountdown(start = false) {\n        if (!start) {\n            clearInterval(this.countdownTimer);\n            this.elements.container.removeAttribute('data-badge-text');\n            return;\n        }\n\n        const update = () => {\n            const time = formatTime(Math.max(this.manager.getRemainingTime(), 0));\n            const label = `${i18n.get('advertisement', this.player.config)} - ${time}`;\n            this.elements.container.setAttribute('data-badge-text', label);\n        };\n\n        this.countdownTimer = setInterval(update, 100);\n    }\n\n    /**\n     * This method is called whenever the ads are ready inside the AdDisplayContainer\n     * @param {Event} adsManagerLoadedEvent\n     */\n    onAdsManagerLoaded(event) {\n        // Load could occur after a source change (race condition)\n        if (!this.enabled) {\n            return;\n        }\n\n        // Get the ads manager\n        const settings = new google.ima.AdsRenderingSettings();\n\n        // Tell the SDK to save and restore content video state on our behalf\n        settings.restoreCustomPlaybackStateOnAdBreakComplete = true;\n        settings.enablePreloading = true;\n\n        // The SDK is polling currentTime on the contentPlayback. And needs a duration\n        // so it can determine when to start the mid- and post-roll\n        this.manager = event.getAdsManager(this.player, settings);\n\n        // Get the cue points for any mid-rolls by filtering out the pre- and post-roll\n        this.cuePoints = this.manager.getCuePoints();\n\n        // Add listeners to the required events\n        // Advertisement error events\n        this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, error => this.onAdError(error));\n\n        // Advertisement regular events\n        Object.keys(google.ima.AdEvent.Type).forEach(type => {\n            this.manager.addEventListener(google.ima.AdEvent.Type[type], e => this.onAdEvent(e));\n        });\n\n        // Resolve our adsManager\n        this.trigger('loaded');\n    }\n\n    addCuePoints() {\n        // Add advertisement cue's within the time line if available\n        if (!is.empty(this.cuePoints)) {\n            this.cuePoints.forEach(cuePoint => {\n                if (cuePoint !== 0 && cuePoint !== -1 && cuePoint < this.player.duration) {\n                    const seekElement = this.player.elements.progress;\n\n                    if (is.element(seekElement)) {\n                        const cuePercentage = (100 / this.player.duration) * cuePoint;\n                        const cue = createElement('span', {\n                            class: this.player.config.classNames.cues,\n                        });\n\n                        cue.style.left = `${cuePercentage.toString()}%`;\n                        seekElement.appendChild(cue);\n                    }\n                }\n            });\n        }\n    }\n\n    /**\n     * This is where all the event handling takes place. Retrieve the ad from the event. Some\n     * events (e.g. ALL_ADS_COMPLETED) don't have the ad object associated\n     * https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type\n     * @param {Event} event\n     */\n    onAdEvent(event) {\n        const { container } = this.player.elements;\n        // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)\n        // don't have ad object associated\n        const ad = event.getAd();\n        const adData = event.getAdData();\n\n        // Proxy event\n        const dispatchEvent = type => {\n            triggerEvent.call(this.player, this.player.media, `ads${type.replace(/_/g, '').toLowerCase()}`);\n        };\n\n        // Bubble the event\n        dispatchEvent(event.type);\n\n        switch (event.type) {\n            case google.ima.AdEvent.Type.LOADED:\n                // This is the first event sent for an ad - it is possible to determine whether the\n                // ad is a video ad or an overlay\n                this.trigger('loaded');\n\n                // Start countdown\n                this.pollCountdown(true);\n\n                if (!ad.isLinear()) {\n                    // Position AdDisplayContainer correctly for overlay\n                    ad.width = container.offsetWidth;\n                    ad.height = container.offsetHeight;\n                }\n\n                // console.info('Ad type: ' + event.getAd().getAdPodInfo().getPodIndex());\n                // console.info('Ad time: ' + event.getAd().getAdPodInfo().getTimeOffset());\n\n                break;\n\n            case google.ima.AdEvent.Type.STARTED:\n                // Set volume to match player\n                this.manager.setVolume(this.player.volume);\n\n                break;\n\n            case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:\n                // All ads for the current videos are done. We can now request new advertisements\n                // in case the video is re-played\n\n                // TODO: Example for what happens when a next video in a playlist would be loaded.\n                // So here we load a new video when all ads are done.\n                // Then we load new ads within a new adsManager. When the video\n                // Is started - after - the ads are loaded, then we get ads.\n                // You can also easily test cancelling and reloading by running\n                // player.ads.cancel() and player.ads.play from the console I guess.\n                // this.player.source = {\n                //     type: 'video',\n                //     title: 'View From A Blue Moon',\n                //     sources: [{\n                //         src:\n                // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', type:\n                // 'video/mp4', }], poster:\n                // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', tracks:\n                // [ { kind: 'captions', label: 'English', srclang: 'en', src:\n                // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',\n                // default: true, }, { kind: 'captions', label: 'French', srclang: 'fr', src:\n                // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt', }, ],\n                // };\n\n                // TODO: So there is still this thing where a video should only be allowed to start\n                // playing when the IMA SDK is ready or has failed\n\n                this.loadAds();\n\n                break;\n\n            case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:\n                // This event indicates the ad has started - the video player can adjust the UI,\n                // for example display a pause button and remaining time. Fired when content should\n                // be paused. This usually happens right before an ad is about to cover the content\n\n                this.pauseContent();\n\n                break;\n\n            case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:\n                // This event indicates the ad has finished - the video player can perform\n                // appropriate UI actions, such as removing the timer for remaining time detection.\n                // Fired when content should be resumed. This usually happens when an ad finishes\n                // or collapses\n\n                this.pollCountdown();\n\n                this.resumeContent();\n\n                break;\n\n            case google.ima.AdEvent.Type.LOG:\n                if (adData.adError) {\n                    this.player.debug.warn(`Non-fatal ad error: ${adData.adError.getMessage()}`);\n                }\n\n                break;\n\n            default:\n                break;\n        }\n    }\n\n    /**\n     * Any ad error handling comes through here\n     * @param {Event} event\n     */\n    onAdError(event) {\n        this.cancel();\n        this.player.debug.warn('Ads error', event);\n    }\n\n    /**\n     * Setup hooks for Plyr and window events. This ensures\n     * the mid- and post-roll launch at the correct time. And\n     * resize the advertisement when the player resizes\n     */\n    listeners() {\n        const { container } = this.player.elements;\n        let time;\n\n        this.player.on('canplay', () => {\n            this.addCuePoints();\n        });\n\n        this.player.on('ended', () => {\n            this.loader.contentComplete();\n        });\n\n        this.player.on('timeupdate', () => {\n            time = this.player.currentTime;\n        });\n\n        this.player.on('seeked', () => {\n            const seekedTime = this.player.currentTime;\n\n            if (is.empty(this.cuePoints)) {\n                return;\n            }\n\n            this.cuePoints.forEach((cuePoint, index) => {\n                if (time < cuePoint && cuePoint < seekedTime) {\n                    this.manager.discardAdBreak();\n                    this.cuePoints.splice(index, 1);\n                }\n            });\n        });\n\n        // Listen to the resizing of the window. And resize ad accordingly\n        // TODO: eventually implement ResizeObserver\n        window.addEventListener('resize', () => {\n            if (this.manager) {\n                this.manager.resize(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);\n            }\n        });\n    }\n\n    /**\n     * Initialize the adsManager and start playing advertisements\n     */\n    play() {\n        const { container } = this.player.elements;\n\n        if (!this.managerPromise) {\n            this.resumeContent();\n        }\n\n        // Play the requested advertisement whenever the adsManager is ready\n        this.managerPromise\n            .then(() => {\n                // Set volume to match player\n                this.manager.setVolume(this.player.volume);\n\n                // Initialize the container. Must be done via a user action on mobile devices\n                this.elements.displayContainer.initialize();\n\n                try {\n                    if (!this.initialized) {\n                        // Initialize the ads manager. Ad rules playlist will start at this time\n                        this.manager.init(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);\n\n                        // Call play to start showing the ad. Single video and overlay ads will\n                        // start at this time; the call will be ignored for ad rules\n                        this.manager.start();\n                    }\n\n                    this.initialized = true;\n                } catch (adError) {\n                    // An error may be thrown if there was a problem with the\n                    // VAST response\n                    this.onAdError(adError);\n                }\n            })\n            .catch(() => {});\n    }\n\n    /**\n     * Resume our video\n     */\n    resumeContent() {\n        // Hide the advertisement container\n        this.elements.container.style.zIndex = '';\n\n        // Ad is stopped\n        this.playing = false;\n\n        // Play video\n        this.player.media.play();\n    }\n\n    /**\n     * Pause our video\n     */\n    pauseContent() {\n        // Show the advertisement container\n        this.elements.container.style.zIndex = 3;\n\n        // Ad is playing\n        this.playing = true;\n\n        // Pause our video.\n        this.player.media.pause();\n    }\n\n    /**\n     * Destroy the adsManager so we can grab new ads after this. If we don't then we're not\n     * allowed to call new ads based on google policies, as they interpret this as an accidental\n     * video requests. https://developers.google.com/interactive-\n     * media-ads/docs/sdks/android/faq#8\n     */\n    cancel() {\n        // Pause our video\n        if (this.initialized) {\n            this.resumeContent();\n        }\n\n        // Tell our instance that we're done for now\n        this.trigger('error');\n\n        // Re-create our adsManager\n        this.loadAds();\n    }\n\n    /**\n     * Re-create our adsManager\n     */\n    loadAds() {\n        // Tell our adsManager to go bye bye\n        this.managerPromise\n            .then(() => {\n                // Destroy our adsManager\n                if (this.manager) {\n                    this.manager.destroy();\n                }\n\n                // Re-set our adsManager promises\n                this.managerPromise = new Promise(resolve => {\n                    this.on('loaded', resolve);\n                    this.player.debug.log(this.manager);\n                });\n\n                // Now request some new advertisements\n                this.requestAds();\n            })\n            .catch(() => {});\n    }\n\n    /**\n     * Handles callbacks after an ad event was invoked\n     * @param {String} event - Event type\n     */\n    trigger(event, ...args) {\n        const handlers = this.events[event];\n\n        if (is.array(handlers)) {\n            handlers.forEach(handler => {\n                if (is.function(handler)) {\n                    handler.apply(this, args);\n                }\n            });\n        }\n    }\n\n    /**\n     * Add event listeners\n     * @param {String} event - Event type\n     * @param {Function} callback - Callback for when event occurs\n     * @return {Ads}\n     */\n    on(event, callback) {\n        if (!is.array(this.events[event])) {\n            this.events[event] = [];\n        }\n\n        this.events[event].push(callback);\n\n        return this;\n    }\n\n    /**\n     * Setup a safety timer for when the ad network doesn't respond for whatever reason.\n     * The advertisement has 12 seconds to get its things together. We stop this timer when the\n     * advertisement is playing, or when a user action is required to start, then we clear the\n     * timer on ad ready\n     * @param {Number} time\n     * @param {String} from\n     */\n    startSafetyTimer(time, from) {\n        this.player.debug.log(`Safety timer invoked from: ${from}`);\n\n        this.safetyTimer = setTimeout(() => {\n            this.cancel();\n            this.clearSafetyTimer('startSafetyTimer()');\n        }, time);\n    }\n\n    /**\n     * Clear our safety timer(s)\n     * @param {String} from\n     */\n    clearSafetyTimer(from) {\n        if (!is.nullOrUndefined(this.safetyTimer)) {\n            this.player.debug.log(`Safety timer cleared from: ${from}`);\n\n            clearTimeout(this.safetyTimer);\n            this.safetyTimer = null;\n        }\n    }\n}\n\nexport default Ads;\n","import { createElement } from '../utils/elements';\nimport { once } from '../utils/events';\nimport fetch from '../utils/fetch';\nimport is from '../utils/is';\nimport { formatTime } from '../utils/time';\n\n// Arg: vttDataString example: \"WEBVTT\\n\\n1\\n00:00:05.000 --> 00:00:10.000\\n1080p-00001.jpg\"\nconst parseVtt = vttDataString => {\n    const processedList = [];\n    const frames = vttDataString.split(/\\r\\n\\r\\n|\\n\\n|\\r\\r/);\n\n    frames.forEach(frame => {\n        const result = {};\n        const lines = frame.split(/\\r\\n|\\n|\\r/);\n\n        lines.forEach(line => {\n            if (!is.number(result.startTime)) {\n                // The line with start and end times on it is the first line of interest\n                const matchTimes = line.match(\n                    /([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/,\n                ); // Note that this currently ignores caption formatting directives that are optionally on the end of this line - fine for non-captions VTT\n\n                if (matchTimes) {\n                    result.startTime =\n                        Number(matchTimes[1] || 0) * 60 * 60 +\n                        Number(matchTimes[2]) * 60 +\n                        Number(matchTimes[3]) +\n                        Number(`0.${matchTimes[4]}`);\n                    result.endTime =\n                        Number(matchTimes[6] || 0) * 60 * 60 +\n                        Number(matchTimes[7]) * 60 +\n                        Number(matchTimes[8]) +\n                        Number(`0.${matchTimes[9]}`);\n                }\n            } else if (!is.empty(line.trim()) && is.empty(result.text)) {\n                // If we already have the startTime, then we're definitely up to the text line(s)\n                const lineSplit = line.trim().split('#xywh=');\n                [result.text] = lineSplit;\n\n                // If there's content in lineSplit[1], then we have sprites. If not, then it's just one frame per image\n                if (lineSplit[1]) {\n                    [result.x, result.y, result.w, result.h] = lineSplit[1].split(',');\n                }\n            }\n        });\n\n        if (result.text) {\n            processedList.push(result);\n        }\n    });\n\n    return processedList;\n};\n\n/**\n * Preview thumbnails for seek hover and scrubbing\n * Seeking: Hover over the seek bar (desktop only): shows a small preview container above the seek bar\n * Scrubbing: Click and drag the seek bar (desktop and mobile): shows the preview image over the entire video, as if the video is scrubbing at very high speed\n *\n * Notes:\n * - Thumbs are set via JS settings on Plyr init, not HTML5 'track' property. Using the track property would be a bit gross, because it doesn't support custom 'kinds'. kind=metadata might be used for something else, and we want to allow multiple thumbnails tracks. Tracks must have a unique combination of 'kind' and 'label'. We would have to do something like kind=metadata,label=thumbnails1 / kind=metadata,label=thumbnails2. Square peg, round hole\n * - VTT info: the image URL is relative to the VTT, not the current document. But if the url starts with a slash, it will naturally be relative to the current domain. https://support.jwplayer.com/articles/how-to-add-preview-thumbnails\n * - This implementation uses multiple separate img elements. Other implementations use background-image on one element. This would be nice and simple, but Firefox and Safari have flickering issues with replacing backgrounds of larger images. It seems that YouTube perhaps only avoids this because they don't have the option for high-res previews (even the fullscreen ones, when mousedown/seeking). Images appear over the top of each other, and previous ones are discarded once the new ones have been rendered\n */\n\nclass PreviewThumbnails {\n    /**\n     * PreviewThumbnails constructor.\n     * @param {Plyr} player\n     * @return {PreviewThumbnails}\n     */\n    constructor(player) {\n        this.player = player;\n        this.thumbnails = [];\n        this.loaded = false;\n        this.lastMouseMoveTime = Date.now();\n        this.mouseDown = false;\n        this.loadedImages = [];\n\n        this.elements = {\n            thumb: {},\n            scrubbing: {},\n        };\n\n        this.load();\n    }\n\n    get enabled() {\n        return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;\n    }\n\n    load() {\n        // Togglethe regular seek tooltip\n        if (this.player.elements.display.seekTooltip) {\n            this.player.elements.display.seekTooltip.hidden = this.enabled;\n        }\n\n        if (!this.enabled) {\n            return;\n        }\n\n        this.getThumbnails().then(() => {\n            if (!this.enabled) {\n                return;\n            }\n\n            // Render DOM elements\n            this.render();\n\n            // Check to see if thumb container size was specified manually in CSS\n            this.determineContainerAutoSizing();\n\n            this.loaded = true;\n        });\n    }\n\n    // Download VTT files and parse them\n    getThumbnails() {\n        return new Promise(resolve => {\n            const { src } = this.player.config.previewThumbnails;\n\n            if (is.empty(src)) {\n                throw new Error('Missing previewThumbnails.src config attribute');\n            }\n\n            // If string, convert into single-element list\n            const urls = is.string(src) ? [src] : src;\n            // Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails\n            const promises = urls.map(u => this.getThumbnail(u));\n\n            Promise.all(promises).then(() => {\n                // Sort smallest to biggest (e.g., [120p, 480p, 1080p])\n                this.thumbnails.sort((x, y) => x.height - y.height);\n\n                this.player.debug.log('Preview thumbnails', this.thumbnails);\n\n                resolve();\n            });\n        });\n    }\n\n    // Process individual VTT file\n    getThumbnail(url) {\n        return new Promise(resolve => {\n            fetch(url).then(response => {\n                const thumbnail = {\n                    frames: parseVtt(response),\n                    height: null,\n                    urlPrefix: '',\n                };\n\n                // If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file\n                // If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank\n                // If the thumbnail URLs start with with none of '/', 'http://' or 'https://', then we need to set their relative path to be the location of the VTT file\n                if (\n                    !thumbnail.frames[0].text.startsWith('/') &&\n                    !thumbnail.frames[0].text.startsWith('http://') &&\n                    !thumbnail.frames[0].text.startsWith('https://')\n                ) {\n                    thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);\n                }\n\n                // Download the first frame, so that we can determine/set the height of this thumbnailsDef\n                const tempImage = new Image();\n\n                tempImage.onload = () => {\n                    thumbnail.height = tempImage.naturalHeight;\n                    thumbnail.width = tempImage.naturalWidth;\n\n                    this.thumbnails.push(thumbnail);\n\n                    resolve();\n                };\n\n                tempImage.src = thumbnail.urlPrefix + thumbnail.frames[0].text;\n            });\n        });\n    }\n\n    startMove(event) {\n        if (!this.loaded) {\n            return;\n        }\n\n        if (!is.event(event) || !['touchmove', 'mousemove'].includes(event.type)) {\n            return;\n        }\n\n        // Wait until media has a duration\n        if (!this.player.media.duration) {\n            return;\n        }\n\n        if (event.type === 'touchmove') {\n            // Calculate seek hover position as approx video seconds\n            this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);\n        } else {\n            // Calculate seek hover position as approx video seconds\n            const clientRect = this.player.elements.progress.getBoundingClientRect();\n            const percentage = (100 / clientRect.width) * (event.pageX - clientRect.left);\n            this.seekTime = this.player.media.duration * (percentage / 100);\n\n            if (this.seekTime < 0) {\n                // The mousemove fires for 10+px out to the left\n                this.seekTime = 0;\n            }\n\n            if (this.seekTime > this.player.media.duration - 1) {\n                // Took 1 second off the duration for safety, because different players can disagree on the real duration of a video\n                this.seekTime = this.player.media.duration - 1;\n            }\n\n            this.mousePosX = event.pageX;\n\n            // Set time text inside image container\n            this.elements.thumb.time.innerText = formatTime(this.seekTime);\n        }\n\n        // Download and show image\n        this.showImageAtCurrentTime();\n    }\n\n    endMove() {\n        this.toggleThumbContainer(false, true);\n    }\n\n    startScrubbing(event) {\n        // Only act on left mouse button (0), or touch device (event.button is false)\n        if (event.button === false || event.button === 0) {\n            this.mouseDown = true;\n\n            // Wait until media has a duration\n            if (this.player.media.duration) {\n                this.toggleScrubbingContainer(true);\n                this.toggleThumbContainer(false, true);\n\n                // Download and show image\n                this.showImageAtCurrentTime();\n            }\n        }\n    }\n\n    endScrubbing() {\n        this.mouseDown = false;\n\n        // Hide scrubbing preview. But wait until the video has successfully seeked before hiding the scrubbing preview\n        if (Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime)) {\n            // The video was already seeked/loaded at the chosen time - hide immediately\n            this.toggleScrubbingContainer(false);\n        } else {\n            // The video hasn't seeked yet. Wait for that\n            once.call(this.player, this.player.media, 'timeupdate', () => {\n                // Re-check mousedown - we might have already started scrubbing again\n                if (!this.mouseDown) {\n                    this.toggleScrubbingContainer(false);\n                }\n            });\n        }\n    }\n\n    /**\n     * Setup hooks for Plyr and window events\n     */\n    listeners() {\n        // Hide thumbnail preview - on mouse click, mouse leave (in listeners.js for now), and video play/seek. All four are required, e.g., for buffering\n        this.player.on('play', () => {\n            this.toggleThumbContainer(false, true);\n        });\n\n        this.player.on('seeked', () => {\n            this.toggleThumbContainer(false);\n        });\n\n        this.player.on('timeupdate', () => {\n            this.lastTime = this.player.media.currentTime;\n        });\n    }\n\n    /**\n     * Create HTML elements for image containers\n     */\n    render() {\n        // Create HTML element: plyr__preview-thumbnail-container\n        this.elements.thumb.container = createElement('div', {\n            class: this.player.config.classNames.previewThumbnails.thumbContainer,\n        });\n\n        // Wrapper for the image for styling\n        this.elements.thumb.imageContainer = createElement('div', {\n            class: this.player.config.classNames.previewThumbnails.imageContainer,\n        });\n        this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);\n\n        // Create HTML element, parent+span: time text (e.g., 01:32:00)\n        const timeContainer = createElement('div', {\n            class: this.player.config.classNames.previewThumbnails.timeContainer,\n        });\n\n        this.elements.thumb.time = createElement('span', {}, '00:00');\n        timeContainer.appendChild(this.elements.thumb.time);\n\n        this.elements.thumb.container.appendChild(timeContainer);\n\n        // Inject the whole thumb\n        if (is.element(this.player.elements.progress)) {\n            this.player.elements.progress.appendChild(this.elements.thumb.container);\n        }\n\n        // Create HTML element: plyr__preview-scrubbing-container\n        this.elements.scrubbing.container = createElement('div', {\n            class: this.player.config.classNames.previewThumbnails.scrubbingContainer,\n        });\n\n        this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);\n    }\n\n    showImageAtCurrentTime() {\n        if (this.mouseDown) {\n            this.setScrubbingContainerSize();\n        } else {\n            this.setThumbContainerSizeAndPos();\n        }\n\n        // Find the desired thumbnail index\n        // TODO: Handle a video longer than the thumbs where thumbNum is null\n        const thumbNum = this.thumbnails[0].frames.findIndex(\n            frame => this.seekTime >= frame.startTime && this.seekTime <= frame.endTime,\n        );\n        const hasThumb = thumbNum >= 0;\n        let qualityIndex = 0;\n\n        // Show the thumb container if we're not scrubbing\n        if (!this.mouseDown) {\n            this.toggleThumbContainer(hasThumb);\n        }\n\n        // No matching thumb found\n        if (!hasThumb) {\n            return;\n        }\n\n        // Check to see if we've already downloaded higher quality versions of this image\n        this.thumbnails.forEach((thumbnail, index) => {\n            if (this.loadedImages.includes(thumbnail.frames[thumbNum].text)) {\n                qualityIndex = index;\n            }\n        });\n\n        // Only proceed if either thumbnum or thumbfilename has changed\n        if (thumbNum !== this.showingThumb) {\n            this.showingThumb = thumbNum;\n            this.loadImage(qualityIndex);\n        }\n    }\n\n    // Show the image that's currently specified in this.showingThumb\n    loadImage(qualityIndex = 0) {\n        const thumbNum = this.showingThumb;\n        const thumbnail = this.thumbnails[qualityIndex];\n        const { urlPrefix } = thumbnail;\n        const frame = thumbnail.frames[thumbNum];\n        const thumbFilename = thumbnail.frames[thumbNum].text;\n        const thumbUrl = urlPrefix + thumbFilename;\n\n        if (!this.currentImageElement || this.currentImageElement.dataset.filename !== thumbFilename) {\n            // If we're already loading a previous image, remove its onload handler - we don't want it to load after this one\n            // Only do this if not using sprites. Without sprites we really want to show as many images as possible, as a best-effort\n            if (this.loadingImage && this.usingSprites) {\n                this.loadingImage.onload = null;\n            }\n\n            // We're building and adding a new image. In other implementations of similar functionality (YouTube), background image\n            // is instead used. But this causes issues with larger images in Firefox and Safari - switching between background\n            // images causes a flicker. Putting a new image over the top does not\n            const previewImage = new Image();\n            previewImage.src = thumbUrl;\n            previewImage.dataset.index = thumbNum;\n            previewImage.dataset.filename = thumbFilename;\n            this.showingThumbFilename = thumbFilename;\n\n            this.player.debug.log(`Loading image: ${thumbUrl}`);\n\n            // For some reason, passing the named function directly causes it to execute immediately. So I've wrapped it in an anonymous function...\n            previewImage.onload = () =>\n                this.showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, true);\n            this.loadingImage = previewImage;\n            this.removeOldImages(previewImage);\n        } else {\n            // Update the existing image\n            this.showImage(this.currentImageElement, frame, qualityIndex, thumbNum, thumbFilename, false);\n            this.currentImageElement.dataset.index = thumbNum;\n            this.removeOldImages(this.currentImageElement);\n        }\n    }\n\n    showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, newImage = true) {\n        this.player.debug.log(\n            `Showing thumb: ${thumbFilename}. num: ${thumbNum}. qual: ${qualityIndex}. newimg: ${newImage}`,\n        );\n        this.setImageSizeAndOffset(previewImage, frame);\n\n        if (newImage) {\n            this.currentImageContainer.appendChild(previewImage);\n            this.currentImageElement = previewImage;\n\n            if (!this.loadedImages.includes(thumbFilename)) {\n                this.loadedImages.push(thumbFilename);\n            }\n        }\n\n        // Preload images before and after the current one\n        // Show higher quality of the same frame\n        // Each step here has a short time delay, and only continues if still hovering/seeking the same spot. This is to protect slow connections from overloading\n        this.preloadNearby(thumbNum, true)\n            .then(this.preloadNearby(thumbNum, false))\n            .then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));\n    }\n\n    // Remove all preview images that aren't the designated current image\n    removeOldImages(currentImage) {\n        // Get a list of all images, convert it from a DOM list to an array\n        Array.from(this.currentImageContainer.children).forEach(image => {\n            if (image.tagName.toLowerCase() !== 'img') {\n                return;\n            }\n\n            const removeDelay = this.usingSprites ? 500 : 1000;\n\n            if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {\n                // Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients\n                // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function\n                // eslint-disable-next-line no-param-reassign\n                image.dataset.deleting = true;\n\n                // This has to be set before the timeout - to prevent issues switching between hover and scrub\n                const { currentImageContainer } = this;\n\n                setTimeout(() => {\n                    currentImageContainer.removeChild(image);\n                    this.player.debug.log(`Removing thumb: ${image.dataset.filename}`);\n                }, removeDelay);\n            }\n        });\n    }\n\n    // Preload images before and after the current one. Only if the user is still hovering/seeking the same frame\n    // This will only preload the lowest quality\n    preloadNearby(thumbNum, forward = true) {\n        return new Promise(resolve => {\n            setTimeout(() => {\n                const oldThumbFilename = this.thumbnails[0].frames[thumbNum].text;\n\n                if (this.showingThumbFilename === oldThumbFilename) {\n                    // Find the nearest thumbs with different filenames. Sometimes it'll be the next index, but in the case of sprites, it might be 100+ away\n                    let thumbnailsClone;\n                    if (forward) {\n                        thumbnailsClone = this.thumbnails[0].frames.slice(thumbNum);\n                    } else {\n                        thumbnailsClone = this.thumbnails[0].frames.slice(0, thumbNum).reverse();\n                    }\n\n                    let foundOne = false;\n\n                    thumbnailsClone.forEach(frame => {\n                        const newThumbFilename = frame.text;\n\n                        if (newThumbFilename !== oldThumbFilename) {\n                            // Found one with a different filename. Make sure it hasn't already been loaded on this page visit\n                            if (!this.loadedImages.includes(newThumbFilename)) {\n                                foundOne = true;\n                                this.player.debug.log(`Preloading thumb filename: ${newThumbFilename}`);\n\n                                const { urlPrefix } = this.thumbnails[0];\n                                const thumbURL = urlPrefix + newThumbFilename;\n                                const previewImage = new Image();\n                                previewImage.src = thumbURL;\n                                previewImage.onload = () => {\n                                    this.player.debug.log(`Preloaded thumb filename: ${newThumbFilename}`);\n                                    if (!this.loadedImages.includes(newThumbFilename))\n                                        this.loadedImages.push(newThumbFilename);\n\n                                    // We don't resolve until the thumb is loaded\n                                    resolve();\n                                };\n                            }\n                        }\n                    });\n\n                    // If there are none to preload then we want to resolve immediately\n                    if (!foundOne) {\n                        resolve();\n                    }\n                }\n            }, 300);\n        });\n    }\n\n    // If user has been hovering current image for half a second, look for a higher quality one\n    getHigherQuality(currentQualityIndex, previewImage, frame, thumbFilename) {\n        if (currentQualityIndex < this.thumbnails.length - 1) {\n            // Only use the higher quality version if it's going to look any better - if the current thumb is of a lower pixel density than the thumbnail container\n            let previewImageHeight = previewImage.naturalHeight;\n\n            if (this.usingSprites) {\n                previewImageHeight = frame.h;\n            }\n\n            if (previewImageHeight < this.thumbContainerHeight) {\n                // Recurse back to the loadImage function - show a higher quality one, but only if the viewer is on this frame for a while\n                setTimeout(() => {\n                    // Make sure the mouse hasn't already moved on and started hovering at another image\n                    if (this.showingThumbFilename === thumbFilename) {\n                        this.player.debug.log(`Showing higher quality thumb for: ${thumbFilename}`);\n                        this.loadImage(currentQualityIndex + 1);\n                    }\n                }, 300);\n            }\n        }\n    }\n\n    get currentImageContainer() {\n        if (this.mouseDown) {\n            return this.elements.scrubbing.container;\n        }\n\n        return this.elements.thumb.imageContainer;\n    }\n\n    get usingSprites() {\n        return Object.keys(this.thumbnails[0].frames[0]).includes('w');\n    }\n\n    get thumbAspectRatio() {\n        if (this.usingSprites) {\n            return this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h;\n        }\n\n        return this.thumbnails[0].width / this.thumbnails[0].height;\n    }\n\n    get thumbContainerHeight() {\n        if (this.mouseDown) {\n            // Can't use media.clientHeight - HTML5 video goes big and does black bars above and below\n            return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio);\n        }\n\n        return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);\n    }\n\n    get currentImageElement() {\n        if (this.mouseDown) {\n            return this.currentScrubbingImageElement;\n        }\n\n        return this.currentThumbnailImageElement;\n    }\n\n    set currentImageElement(element) {\n        if (this.mouseDown) {\n            this.currentScrubbingImageElement = element;\n        } else {\n            this.currentThumbnailImageElement = element;\n        }\n    }\n\n    toggleThumbContainer(toggle = false, clearShowing = false) {\n        const className = this.player.config.classNames.previewThumbnails.thumbContainerShown;\n        this.elements.thumb.container.classList.toggle(className, toggle);\n\n        if (!toggle && clearShowing) {\n            this.showingThumb = null;\n            this.showingThumbFilename = null;\n        }\n    }\n\n    toggleScrubbingContainer(toggle = false) {\n        const className = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;\n        this.elements.scrubbing.container.classList.toggle(className, toggle);\n\n        if (!toggle) {\n            this.showingThumb = null;\n            this.showingThumbFilename = null;\n        }\n    }\n\n    determineContainerAutoSizing() {\n        if (this.elements.thumb.imageContainer.clientHeight > 20) {\n            // This will prevent auto sizing in this.setThumbContainerSizeAndPos()\n            this.sizeSpecifiedInCSS = true;\n        }\n    }\n\n    // Set the size to be about a quarter of the size of video. Unless option dynamicSize === false, in which case it needs to be set in CSS\n    setThumbContainerSizeAndPos() {\n        if (!this.sizeSpecifiedInCSS) {\n            const thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);\n            this.elements.thumb.imageContainer.style.height = `${this.thumbContainerHeight}px`;\n            this.elements.thumb.imageContainer.style.width = `${thumbWidth}px`;\n        }\n\n        this.setThumbContainerPos();\n    }\n\n    setThumbContainerPos() {\n        const seekbarRect = this.player.elements.progress.getBoundingClientRect();\n        const plyrRect = this.player.elements.container.getBoundingClientRect();\n        const { container } = this.elements.thumb;\n        // Find the lowest and highest desired left-position, so we don't slide out the side of the video container\n        const minVal = plyrRect.left - seekbarRect.left + 10;\n        const maxVal = plyrRect.right - seekbarRect.left - container.clientWidth - 10;\n        // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth\n        let previewPos = this.mousePosX - seekbarRect.left - container.clientWidth / 2;\n\n        if (previewPos < minVal) {\n            previewPos = minVal;\n        }\n\n        if (previewPos > maxVal) {\n            previewPos = maxVal;\n        }\n\n        container.style.left = `${previewPos}px`;\n    }\n\n    // Can't use 100% width, in case the video is a different aspect ratio to the video container\n    setScrubbingContainerSize() {\n        this.elements.scrubbing.container.style.width = `${this.player.media.clientWidth}px`;\n        // Can't use media.clientHeight - html5 video goes big and does black bars above and below\n        this.elements.scrubbing.container.style.height = `${this.player.media.clientWidth / this.thumbAspectRatio}px`;\n    }\n\n    // Sprites need to be offset to the correct location\n    setImageSizeAndOffset(previewImage, frame) {\n        if (!this.usingSprites) {\n            return;\n        }\n\n        // Find difference between height and preview container height\n        const multiplier = this.thumbContainerHeight / frame.h;\n\n        // eslint-disable-next-line no-param-reassign\n        previewImage.style.height = `${Math.floor(previewImage.naturalHeight * multiplier)}px`;\n        // eslint-disable-next-line no-param-reassign\n        previewImage.style.width = `${Math.floor(previewImage.naturalWidth * multiplier)}px`;\n        // eslint-disable-next-line no-param-reassign\n        previewImage.style.left = `-${frame.x * multiplier}px`;\n        // eslint-disable-next-line no-param-reassign\n        previewImage.style.top = `-${frame.y * multiplier}px`;\n    }\n}\n\nexport default PreviewThumbnails;\n","// ==========================================================================\n// Plyr source update\n// ==========================================================================\n\nimport { providers } from './config/types';\nimport html5 from './html5';\nimport media from './media';\nimport support from './support';\nimport ui from './ui';\nimport { createElement, insertElement, removeElement } from './utils/elements';\nimport is from './utils/is';\nimport { getDeep } from './utils/objects';\n\nconst source = {\n    // Add elements to HTML5 media (source, tracks, etc)\n    insertElements(type, attributes) {\n        if (is.string(attributes)) {\n            insertElement(type, this.media, {\n                src: attributes,\n            });\n        } else if (is.array(attributes)) {\n            attributes.forEach(attribute => {\n                insertElement(type, this.media, attribute);\n            });\n        }\n    },\n\n    // Update source\n    // Sources are not checked for support so be careful\n    change(input) {\n        if (!getDeep(input, 'sources.length')) {\n            this.debug.warn('Invalid source format');\n            return;\n        }\n\n        // Cancel current network requests\n        html5.cancelRequests.call(this);\n\n        // Destroy instance and re-setup\n        this.destroy.call(\n            this,\n            () => {\n                // Reset quality options\n                this.options.quality = [];\n\n                // Remove elements\n                removeElement(this.media);\n                this.media = null;\n\n                // Reset class name\n                if (is.element(this.elements.container)) {\n                    this.elements.container.removeAttribute('class');\n                }\n\n                // Set the type and provider\n                const { sources, type } = input;\n                const [{ provider = providers.html5, src }] = sources;\n                const tagName = provider === 'html5' ? type : 'div';\n                const attributes = provider === 'html5' ? {} : { src };\n\n                Object.assign(this, {\n                    provider,\n                    type,\n                    // Check for support\n                    supported: support.check(type, provider, this.config.playsinline),\n                    // Create new element\n                    media: createElement(tagName, attributes),\n                });\n\n                // Inject the new element\n                this.elements.container.appendChild(this.media);\n\n                // Autoplay the new source?\n                if (is.boolean(input.autoplay)) {\n                    this.config.autoplay = input.autoplay;\n                }\n\n                // Set attributes for audio and video\n                if (this.isHTML5) {\n                    if (this.config.crossorigin) {\n                        this.media.setAttribute('crossorigin', '');\n                    }\n                    if (this.config.autoplay) {\n                        this.media.setAttribute('autoplay', '');\n                    }\n                    if (!is.empty(input.poster)) {\n                        this.poster = input.poster;\n                    }\n                    if (this.config.loop.active) {\n                        this.media.setAttribute('loop', '');\n                    }\n                    if (this.config.muted) {\n                        this.media.setAttribute('muted', '');\n                    }\n                    if (this.config.playsinline) {\n                        this.media.setAttribute('playsinline', '');\n                    }\n                }\n\n                // Restore class hook\n                ui.addStyleHook.call(this);\n\n                // Set new sources for html5\n                if (this.isHTML5) {\n                    source.insertElements.call(this, 'source', sources);\n                }\n\n                // Set video title\n                this.config.title = input.title;\n\n                // Set up from scratch\n                media.setup.call(this);\n\n                // HTML5 stuff\n                if (this.isHTML5) {\n                    // Setup captions\n                    if (Object.keys(input).includes('tracks')) {\n                        source.insertElements.call(this, 'track', input.tracks);\n                    }\n                }\n\n                // If HTML5 or embed but not fully supported, setupInterface and call ready now\n                if (this.isHTML5 || (this.isEmbed && !this.supported.ui)) {\n                    // Setup interface\n                    ui.build.call(this);\n                }\n\n                // Load HTML5 sources\n                if (this.isHTML5) {\n                    this.media.load();\n                }\n\n                // Reload thumbnails\n                if (this.previewThumbnails) {\n                    this.previewThumbnails.load();\n                }\n\n                // Update the fullscreen support\n                this.fullscreen.update();\n            },\n            true,\n        );\n    },\n};\n\nexport default source;\n","// ==========================================================================\n// Plyr\n// plyr.js v3.5.6\n// https://github.com/sampotts/plyr\n// License: The MIT License (MIT)\n// ==========================================================================\n\nimport captions from './captions';\nimport defaults from './config/defaults';\nimport { pip } from './config/states';\nimport { getProviderByUrl, providers, types } from './config/types';\nimport Console from './console';\nimport controls from './controls';\nimport Fullscreen from './fullscreen';\nimport Listeners from './listeners';\nimport media from './media';\nimport Ads from './plugins/ads';\nimport PreviewThumbnails from './plugins/preview-thumbnails';\nimport source from './source';\nimport Storage from './storage';\nimport support from './support';\nimport ui from './ui';\nimport { closest } from './utils/arrays';\nimport { createElement, hasClass, removeElement, replaceElement, toggleClass, wrap } from './utils/elements';\nimport { off, on, once, triggerEvent, unbindListeners } from './utils/events';\nimport is from './utils/is';\nimport loadSprite from './utils/load-sprite';\nimport { clamp } from './utils/numbers';\nimport { cloneDeep, extend } from './utils/objects';\nimport { getAspectRatio, reduceAspectRatio, setAspectRatio, validateRatio } from './utils/style';\nimport { parseUrl } from './utils/urls';\n\n// Private properties\n// TODO: Use a WeakMap for private globals\n// const globals = new WeakMap();\n\n// Plyr instance\nclass Plyr {\n    constructor(target, options) {\n        this.timers = {};\n\n        // State\n        this.ready = false;\n        this.loading = false;\n        this.failed = false;\n\n        // Touch device\n        this.touch = support.touch;\n\n        // Set the media element\n        this.media = target;\n\n        // String selector passed\n        if (is.string(this.media)) {\n            this.media = document.querySelectorAll(this.media);\n        }\n\n        // jQuery, NodeList or Array passed, use first element\n        if ((window.jQuery && this.media instanceof jQuery) || is.nodeList(this.media) || is.array(this.media)) {\n            // eslint-disable-next-line\n            this.media = this.media[0];\n        }\n\n        // Set config\n        this.config = extend(\n            {},\n            defaults,\n            Plyr.defaults,\n            options || {},\n            (() => {\n                try {\n                    return JSON.parse(this.media.getAttribute('data-plyr-config'));\n                } catch (e) {\n                    return {};\n                }\n            })(),\n        );\n\n        // Elements cache\n        this.elements = {\n            container: null,\n            captions: null,\n            buttons: {},\n            display: {},\n            progress: {},\n            inputs: {},\n            settings: {\n                popup: null,\n                menu: null,\n                panels: {},\n                buttons: {},\n            },\n        };\n\n        // Captions\n        this.captions = {\n            active: null,\n            currentTrack: -1,\n            meta: new WeakMap(),\n        };\n\n        // Fullscreen\n        this.fullscreen = {\n            active: false,\n        };\n\n        // Options\n        this.options = {\n            speed: [],\n            quality: [],\n        };\n\n        // Debugging\n        // TODO: move to globals\n        this.debug = new Console(this.config.debug);\n\n        // Log config options and support\n        this.debug.log('Config', this.config);\n        this.debug.log('Support', support);\n\n        // We need an element to setup\n        if (is.nullOrUndefined(this.media) || !is.element(this.media)) {\n            this.debug.error('Setup failed: no suitable element passed');\n            return;\n        }\n\n        // Bail if the element is initialized\n        if (this.media.plyr) {\n            this.debug.warn('Target already setup');\n            return;\n        }\n\n        // Bail if not enabled\n        if (!this.config.enabled) {\n            this.debug.error('Setup failed: disabled by config');\n            return;\n        }\n\n        // Bail if disabled or no basic support\n        // You may want to disable certain UAs etc\n        if (!support.check().api) {\n            this.debug.error('Setup failed: no support');\n            return;\n        }\n\n        // Cache original element state for .destroy()\n        const clone = this.media.cloneNode(true);\n        clone.autoplay = false;\n        this.elements.original = clone;\n\n        // Set media type based on tag or data attribute\n        // Supported: video, audio, vimeo, youtube\n        const type = this.media.tagName.toLowerCase();\n        // Embed properties\n        let iframe = null;\n        let url = null;\n\n        // Different setup based on type\n        switch (type) {\n            case 'div':\n                // Find the frame\n                iframe = this.media.querySelector('iframe');\n\n                // <iframe> type\n                if (is.element(iframe)) {\n                    // Detect provider\n                    url = parseUrl(iframe.getAttribute('src'));\n                    this.provider = getProviderByUrl(url.toString());\n\n                    // Rework elements\n                    this.elements.container = this.media;\n                    this.media = iframe;\n\n                    // Reset classname\n                    this.elements.container.className = '';\n\n                    // Get attributes from URL and set config\n                    if (url.search.length) {\n                        const truthy = ['1', 'true'];\n\n                        if (truthy.includes(url.searchParams.get('autoplay'))) {\n                            this.config.autoplay = true;\n                        }\n                        if (truthy.includes(url.searchParams.get('loop'))) {\n                            this.config.loop.active = true;\n                        }\n\n                        // TODO: replace fullscreen.iosNative with this playsinline config option\n                        // YouTube requires the playsinline in the URL\n                        if (this.isYouTube) {\n                            this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));\n                            this.config.youtube.hl = url.searchParams.get('hl'); // TODO: Should this be setting language?\n                        } else {\n                            this.config.playsinline = true;\n                        }\n                    }\n                } else {\n                    // <div> with attributes\n                    this.provider = this.media.getAttribute(this.config.attributes.embed.provider);\n\n                    // Remove attribute\n                    this.media.removeAttribute(this.config.attributes.embed.provider);\n                }\n\n                // Unsupported or missing provider\n                if (is.empty(this.provider) || !Object.keys(providers).includes(this.provider)) {\n                    this.debug.error('Setup failed: Invalid provider');\n                    return;\n                }\n\n                // Audio will come later for external providers\n                this.type = types.video;\n\n                break;\n\n            case 'video':\n            case 'audio':\n                this.type = type;\n                this.provider = providers.html5;\n\n                // Get config from attributes\n                if (this.media.hasAttribute('crossorigin')) {\n                    this.config.crossorigin = true;\n                }\n                if (this.media.hasAttribute('autoplay')) {\n                    this.config.autoplay = true;\n                }\n                if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) {\n                    this.config.playsinline = true;\n                }\n                if (this.media.hasAttribute('muted')) {\n                    this.config.muted = true;\n                }\n                if (this.media.hasAttribute('loop')) {\n                    this.config.loop.active = true;\n                }\n\n                break;\n\n            default:\n                this.debug.error('Setup failed: unsupported type');\n                return;\n        }\n\n        // Check for support again but with type\n        this.supported = support.check(this.type, this.provider, this.config.playsinline);\n\n        // If no support for even API, bail\n        if (!this.supported.api) {\n            this.debug.error('Setup failed: no support');\n            return;\n        }\n\n        this.eventListeners = [];\n\n        // Create listeners\n        this.listeners = new Listeners(this);\n\n        // Setup local storage for user settings\n        this.storage = new Storage(this);\n\n        // Store reference\n        this.media.plyr = this;\n\n        // Wrap media\n        if (!is.element(this.elements.container)) {\n            this.elements.container = createElement('div', { tabindex: 0 });\n            wrap(this.media, this.elements.container);\n        }\n\n        // Add style hook\n        ui.addStyleHook.call(this);\n\n        // Setup media\n        media.setup.call(this);\n\n        // Listen for events if debugging\n        if (this.config.debug) {\n            on.call(this, this.elements.container, this.config.events.join(' '), event => {\n                this.debug.log(`event: ${event.type}`);\n            });\n        }\n\n        // Setup interface\n        // If embed but not fully supported, build interface now to avoid flash of controls\n        if (this.isHTML5 || (this.isEmbed && !this.supported.ui)) {\n            ui.build.call(this);\n        }\n\n        // Container listeners\n        this.listeners.container();\n\n        // Global listeners\n        this.listeners.global();\n\n        // Setup fullscreen\n        this.fullscreen = new Fullscreen(this);\n\n        // Setup ads if provided\n        if (this.config.ads.enabled) {\n            this.ads = new Ads(this);\n        }\n\n        // Autoplay if required\n        if (this.isHTML5 && this.config.autoplay) {\n            setTimeout(() => this.play(), 10);\n        }\n\n        // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek\n        this.lastSeekTime = 0;\n\n        // Setup preview thumbnails if enabled\n        if (this.config.previewThumbnails.enabled) {\n            this.previewThumbnails = new PreviewThumbnails(this);\n        }\n    }\n\n    // ---------------------------------------\n    // API\n    // ---------------------------------------\n\n    /**\n     * Types and provider helpers\n     */\n    get isHTML5() {\n        return this.provider === providers.html5;\n    }\n\n    get isEmbed() {\n        return this.isYouTube || this.isVimeo;\n    }\n\n    get isYouTube() {\n        return this.provider === providers.youtube;\n    }\n\n    get isVimeo() {\n        return this.provider === providers.vimeo;\n    }\n\n    get isVideo() {\n        return this.type === types.video;\n    }\n\n    get isAudio() {\n        return this.type === types.audio;\n    }\n\n    /**\n     * Play the media, or play the advertisement (if they are not blocked)\n     */\n    play() {\n        if (!is.function(this.media.play)) {\n            return null;\n        }\n\n        // Intecept play with ads\n        if (this.ads && this.ads.enabled) {\n            this.ads.managerPromise.then(() => this.ads.play()).catch(() => this.media.play());\n        }\n\n        // Return the promise (for HTML5)\n        return this.media.play();\n    }\n\n    /**\n     * Pause the media\n     */\n    pause() {\n        if (!this.playing || !is.function(this.media.pause)) {\n            return;\n        }\n\n        this.media.pause();\n    }\n\n    /**\n     * Get playing state\n     */\n    get playing() {\n        return Boolean(this.ready && !this.paused && !this.ended);\n    }\n\n    /**\n     * Get paused state\n     */\n    get paused() {\n        return Boolean(this.media.paused);\n    }\n\n    /**\n     * Get stopped state\n     */\n    get stopped() {\n        return Boolean(this.paused && this.currentTime === 0);\n    }\n\n    /**\n     * Get ended state\n     */\n    get ended() {\n        return Boolean(this.media.ended);\n    }\n\n    /**\n     * Toggle playback based on current status\n     * @param {Boolean} input\n     */\n    togglePlay(input) {\n        // Toggle based on current state if nothing passed\n        const toggle = is.boolean(input) ? input : !this.playing;\n\n        if (toggle) {\n            this.play();\n        } else {\n            this.pause();\n        }\n    }\n\n    /**\n     * Stop playback\n     */\n    stop() {\n        if (this.isHTML5) {\n            this.pause();\n            this.restart();\n        } else if (is.function(this.media.stop)) {\n            this.media.stop();\n        }\n    }\n\n    /**\n     * Restart playback\n     */\n    restart() {\n        this.currentTime = 0;\n    }\n\n    /**\n     * Rewind\n     * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime\n     */\n    rewind(seekTime) {\n        this.currentTime = this.currentTime - (is.number(seekTime) ? seekTime : this.config.seekTime);\n    }\n\n    /**\n     * Fast forward\n     * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime\n     */\n    forward(seekTime) {\n        this.currentTime = this.currentTime + (is.number(seekTime) ? seekTime : this.config.seekTime);\n    }\n\n    /**\n     * Seek to a time\n     * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)\n     */\n    set currentTime(input) {\n        // Bail if media duration isn't available yet\n        if (!this.duration) {\n            return;\n        }\n\n        // Validate input\n        const inputIsValid = is.number(input) && input > 0;\n\n        // Set\n        this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0;\n\n        // Logging\n        this.debug.log(`Seeking to ${this.currentTime} seconds`);\n    }\n\n    /**\n     * Get current time\n     */\n    get currentTime() {\n        return Number(this.media.currentTime);\n    }\n\n    /**\n     * Get buffered\n     */\n    get buffered() {\n        const { buffered } = this.media;\n\n        // YouTube / Vimeo return a float between 0-1\n        if (is.number(buffered)) {\n            return buffered;\n        }\n\n        // HTML5\n        // TODO: Handle buffered chunks of the media\n        // (i.e. seek to another section buffers only that section)\n        if (buffered && buffered.length && this.duration > 0) {\n            return buffered.end(0) / this.duration;\n        }\n\n        return 0;\n    }\n\n    /**\n     * Get seeking status\n     */\n    get seeking() {\n        return Boolean(this.media.seeking);\n    }\n\n    /**\n     * Get the duration of the current media\n     */\n    get duration() {\n        // Faux duration set via config\n        const fauxDuration = parseFloat(this.config.duration);\n        // Media duration can be NaN or Infinity before the media has loaded\n        const realDuration = (this.media || {}).duration;\n        const duration = !is.number(realDuration) || realDuration === Infinity ? 0 : realDuration;\n\n        // If config duration is funky, use regular duration\n        return fauxDuration || duration;\n    }\n\n    /**\n     * Set the player volume\n     * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage\n     */\n    set volume(value) {\n        let volume = value;\n        const max = 1;\n        const min = 0;\n\n        if (is.string(volume)) {\n            volume = Number(volume);\n        }\n\n        // Load volume from storage if no value specified\n        if (!is.number(volume)) {\n            volume = this.storage.get('volume');\n        }\n\n        // Use config if all else fails\n        if (!is.number(volume)) {\n            ({ volume } = this.config);\n        }\n\n        // Maximum is volumeMax\n        if (volume > max) {\n            volume = max;\n        }\n        // Minimum is volumeMin\n        if (volume < min) {\n            volume = min;\n        }\n\n        // Update config\n        this.config.volume = volume;\n\n        // Set the player volume\n        this.media.volume = volume;\n\n        // If muted, and we're increasing volume manually, reset muted state\n        if (!is.empty(value) && this.muted && volume > 0) {\n            this.muted = false;\n        }\n    }\n\n    /**\n     * Get the current player volume\n     */\n    get volume() {\n        return Number(this.media.volume);\n    }\n\n    /**\n     * Increase volume\n     * @param {Boolean} step - How much to decrease by (between 0 and 1)\n     */\n    increaseVolume(step) {\n        const volume = this.media.muted ? 0 : this.volume;\n        this.volume = volume + (is.number(step) ? step : 0);\n    }\n\n    /**\n     * Decrease volume\n     * @param {Boolean} step - How much to decrease by (between 0 and 1)\n     */\n    decreaseVolume(step) {\n        this.increaseVolume(-step);\n    }\n\n    /**\n     * Set muted state\n     * @param {Boolean} mute\n     */\n    set muted(mute) {\n        let toggle = mute;\n\n        // Load muted state from storage\n        if (!is.boolean(toggle)) {\n            toggle = this.storage.get('muted');\n        }\n\n        // Use config if all else fails\n        if (!is.boolean(toggle)) {\n            toggle = this.config.muted;\n        }\n\n        // Update config\n        this.config.muted = toggle;\n\n        // Set mute on the player\n        this.media.muted = toggle;\n    }\n\n    /**\n     * Get current muted state\n     */\n    get muted() {\n        return Boolean(this.media.muted);\n    }\n\n    /**\n     * Check if the media has audio\n     */\n    get hasAudio() {\n        // Assume yes for all non HTML5 (as we can't tell...)\n        if (!this.isHTML5) {\n            return true;\n        }\n\n        if (this.isAudio) {\n            return true;\n        }\n\n        // Get audio tracks\n        return (\n            Boolean(this.media.mozHasAudio) ||\n            Boolean(this.media.webkitAudioDecodedByteCount) ||\n            Boolean(this.media.audioTracks && this.media.audioTracks.length)\n        );\n    }\n\n    /**\n     * Set playback speed\n     * @param {Number} speed - the speed of playback (0.5-2.0)\n     */\n    set speed(input) {\n        let speed = null;\n\n        if (is.number(input)) {\n            speed = input;\n        }\n\n        if (!is.number(speed)) {\n            speed = this.storage.get('speed');\n        }\n\n        if (!is.number(speed)) {\n            speed = this.config.speed.selected;\n        }\n\n        // Clamp to min/max\n        const { minimumSpeed: min, maximumSpeed: max } = this;\n        speed = clamp(speed, min, max);\n\n        // Update config\n        this.config.speed.selected = speed;\n\n        // Set media speed\n        setTimeout(() => {\n            this.media.playbackRate = speed;\n        }, 0);\n    }\n\n    /**\n     * Get current playback speed\n     */\n    get speed() {\n        return Number(this.media.playbackRate);\n    }\n\n    /**\n     * Get the minimum allowed speed\n     */\n    get minimumSpeed() {\n        if (this.isYouTube) {\n            // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate\n            return Math.min(...this.options.speed);\n        }\n\n        if (this.isVimeo) {\n            // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror\n            return 0.5;\n        }\n\n        // https://stackoverflow.com/a/32320020/1191319\n        return 0.0625;\n    }\n\n    /**\n     * Get the maximum allowed speed\n     */\n    get maximumSpeed() {\n        if (this.isYouTube) {\n            // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate\n            return Math.max(...this.options.speed);\n        }\n\n        if (this.isVimeo) {\n            // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror\n            return 2;\n        }\n\n        // https://stackoverflow.com/a/32320020/1191319\n        return 16;\n    }\n\n    /**\n     * Set playback quality\n     * Currently HTML5 & YouTube only\n     * @param {Number} input - Quality level\n     */\n    set quality(input) {\n        const config = this.config.quality;\n        const options = this.options.quality;\n\n        if (!options.length) {\n            return;\n        }\n\n        let quality = [\n            !is.empty(input) && Number(input),\n            this.storage.get('quality'),\n            config.selected,\n            config.default,\n        ].find(is.number);\n\n        let updateStorage = true;\n\n        if (!options.includes(quality)) {\n            const value = closest(options, quality);\n            this.debug.warn(`Unsupported quality option: ${quality}, using ${value} instead`);\n            quality = value;\n\n            // Don't update storage if quality is not supported\n            updateStorage = false;\n        }\n\n        // Update config\n        config.selected = quality;\n\n        // Set quality\n        this.media.quality = quality;\n\n        // Save to storage\n        if (updateStorage) {\n            this.storage.set({ quality });\n        }\n    }\n\n    /**\n     * Get current quality level\n     */\n    get quality() {\n        return this.media.quality;\n    }\n\n    /**\n     * Toggle loop\n     * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config\n     * @param {Boolean} input - Whether to loop or not\n     */\n    set loop(input) {\n        const toggle = is.boolean(input) ? input : this.config.loop.active;\n        this.config.loop.active = toggle;\n        this.media.loop = toggle;\n\n        // Set default to be a true toggle\n        /* const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';\n\n        switch (type) {\n            case 'start':\n                if (this.config.loop.end && this.config.loop.end <= this.currentTime) {\n                    this.config.loop.end = null;\n                }\n                this.config.loop.start = this.currentTime;\n                // this.config.loop.indicator.start = this.elements.display.played.value;\n                break;\n\n            case 'end':\n                if (this.config.loop.start >= this.currentTime) {\n                    return this;\n                }\n                this.config.loop.end = this.currentTime;\n                // this.config.loop.indicator.end = this.elements.display.played.value;\n                break;\n\n            case 'all':\n                this.config.loop.start = 0;\n                this.config.loop.end = this.duration - 2;\n                this.config.loop.indicator.start = 0;\n                this.config.loop.indicator.end = 100;\n                break;\n\n            case 'toggle':\n                if (this.config.loop.active) {\n                    this.config.loop.start = 0;\n                    this.config.loop.end = null;\n                } else {\n                    this.config.loop.start = 0;\n                    this.config.loop.end = this.duration - 2;\n                }\n                break;\n\n            default:\n                this.config.loop.start = 0;\n                this.config.loop.end = null;\n                break;\n        } */\n    }\n\n    /**\n     * Get current loop state\n     */\n    get loop() {\n        return Boolean(this.media.loop);\n    }\n\n    /**\n     * Set new media source\n     * @param {Object} input - The new source object (see docs)\n     */\n    set source(input) {\n        source.change.call(this, input);\n    }\n\n    /**\n     * Get current source\n     */\n    get source() {\n        return this.media.currentSrc;\n    }\n\n    /**\n     * Get a download URL (either source or custom)\n     */\n    get download() {\n        const { download } = this.config.urls;\n\n        return is.url(download) ? download : this.source;\n    }\n\n    /**\n     * Set the download URL\n     */\n    set download(input) {\n        if (!is.url(input)) {\n            return;\n        }\n\n        this.config.urls.download = input;\n\n        controls.setDownloadUrl.call(this);\n    }\n\n    /**\n     * Set the poster image for a video\n     * @param {String} input - the URL for the new poster image\n     */\n    set poster(input) {\n        if (!this.isVideo) {\n            this.debug.warn('Poster can only be set for video');\n            return;\n        }\n\n        ui.setPoster.call(this, input, false).catch(() => {});\n    }\n\n    /**\n     * Get the current poster image\n     */\n    get poster() {\n        if (!this.isVideo) {\n            return null;\n        }\n\n        return this.media.getAttribute('poster');\n    }\n\n    /**\n     * Get the current aspect ratio in use\n     */\n    get ratio() {\n        if (!this.isVideo) {\n            return null;\n        }\n\n        const ratio = reduceAspectRatio(getAspectRatio.call(this));\n\n        return is.array(ratio) ? ratio.join(':') : ratio;\n    }\n\n    /**\n     * Set video aspect ratio\n     */\n    set ratio(input) {\n        if (!this.isVideo) {\n            this.debug.warn('Aspect ratio can only be set for video');\n            return;\n        }\n\n        if (!is.string(input) || !validateRatio(input)) {\n            this.debug.error(`Invalid aspect ratio specified (${input})`);\n            return;\n        }\n\n        this.config.ratio = input;\n\n        setAspectRatio.call(this);\n    }\n\n    /**\n     * Set the autoplay state\n     * @param {Boolean} input - Whether to autoplay or not\n     */\n    set autoplay(input) {\n        const toggle = is.boolean(input) ? input : this.config.autoplay;\n        this.config.autoplay = toggle;\n    }\n\n    /**\n     * Get the current autoplay state\n     */\n    get autoplay() {\n        return Boolean(this.config.autoplay);\n    }\n\n    /**\n     * Toggle captions\n     * @param {Boolean} input - Whether to enable captions\n     */\n    toggleCaptions(input) {\n        captions.toggle.call(this, input, false);\n    }\n\n    /**\n     * Set the caption track by index\n     * @param {Number} - Caption index\n     */\n    set currentTrack(input) {\n        captions.set.call(this, input, false);\n    }\n\n    /**\n     * Get the current caption track index (-1 if disabled)\n     */\n    get currentTrack() {\n        const { toggled, currentTrack } = this.captions;\n        return toggled ? currentTrack : -1;\n    }\n\n    /**\n     * Set the wanted language for captions\n     * Since tracks can be added later it won't update the actual caption track until there is a matching track\n     * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)\n     */\n    set language(input) {\n        captions.setLanguage.call(this, input, false);\n    }\n\n    /**\n     * Get the current track's language\n     */\n    get language() {\n        return (captions.getCurrentTrack.call(this) || {}).language;\n    }\n\n    /**\n     * Toggle picture-in-picture playback on WebKit/MacOS\n     * TODO: update player with state, support, enabled\n     * TODO: detect outside changes\n     */\n    set pip(input) {\n        // Bail if no support\n        if (!support.pip) {\n            return;\n        }\n\n        // Toggle based on current state if not passed\n        const toggle = is.boolean(input) ? input : !this.pip;\n\n        // Toggle based on current state\n        // Safari\n        if (is.function(this.media.webkitSetPresentationMode)) {\n            this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);\n        }\n\n        // Chrome\n        if (is.function(this.media.requestPictureInPicture)) {\n            if (!this.pip && toggle) {\n                this.media.requestPictureInPicture();\n            } else if (this.pip && !toggle) {\n                document.exitPictureInPicture();\n            }\n        }\n    }\n\n    /**\n     * Get the current picture-in-picture state\n     */\n    get pip() {\n        if (!support.pip) {\n            return null;\n        }\n\n        // Safari\n        if (!is.empty(this.media.webkitPresentationMode)) {\n            return this.media.webkitPresentationMode === pip.active;\n        }\n\n        // Chrome\n        return this.media === document.pictureInPictureElement;\n    }\n\n    /**\n     * Trigger the airplay dialog\n     * TODO: update player with state, support, enabled\n     */\n    airplay() {\n        // Show dialog if supported\n        if (support.airplay) {\n            this.media.webkitShowPlaybackTargetPicker();\n        }\n    }\n\n    /**\n     * Toggle the player controls\n     * @param {Boolean} [toggle] - Whether to show the controls\n     */\n    toggleControls(toggle) {\n        // Don't toggle if missing UI support or if it's audio\n        if (this.supported.ui && !this.isAudio) {\n            // Get state before change\n            const isHidden = hasClass(this.elements.container, this.config.classNames.hideControls);\n            // Negate the argument if not undefined since adding the class to hides the controls\n            const force = typeof toggle === 'undefined' ? undefined : !toggle;\n            // Apply and get updated state\n            const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force);\n\n            // Close menu\n            if (hiding && this.config.controls.includes('settings') && !is.empty(this.config.settings)) {\n                controls.toggleMenu.call(this, false);\n            }\n\n            // Trigger event on change\n            if (hiding !== isHidden) {\n                const eventName = hiding ? 'controlshidden' : 'controlsshown';\n                triggerEvent.call(this, this.media, eventName);\n            }\n\n            return !hiding;\n        }\n\n        return false;\n    }\n\n    /**\n     * Add event listeners\n     * @param {String} event - Event type\n     * @param {Function} callback - Callback for when event occurs\n     */\n    on(event, callback) {\n        on.call(this, this.elements.container, event, callback);\n    }\n\n    /**\n     * Add event listeners once\n     * @param {String} event - Event type\n     * @param {Function} callback - Callback for when event occurs\n     */\n    once(event, callback) {\n        once.call(this, this.elements.container, event, callback);\n    }\n\n    /**\n     * Remove event listeners\n     * @param {String} event - Event type\n     * @param {Function} callback - Callback for when event occurs\n     */\n    off(event, callback) {\n        off(this.elements.container, event, callback);\n    }\n\n    /**\n     * Destroy an instance\n     * Event listeners are removed when elements are removed\n     * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory\n     * @param {Function} callback - Callback for when destroy is complete\n     * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)\n     */\n    destroy(callback, soft = false) {\n        if (!this.ready) {\n            return;\n        }\n\n        const done = () => {\n            // Reset overflow (incase destroyed while in fullscreen)\n            document.body.style.overflow = '';\n\n            // GC for embed\n            this.embed = null;\n\n            // If it's a soft destroy, make minimal changes\n            if (soft) {\n                if (Object.keys(this.elements).length) {\n                    // Remove elements\n                    removeElement(this.elements.buttons.play);\n                    removeElement(this.elements.captions);\n                    removeElement(this.elements.controls);\n                    removeElement(this.elements.wrapper);\n\n                    // Clear for GC\n                    this.elements.buttons.play = null;\n                    this.elements.captions = null;\n                    this.elements.controls = null;\n                    this.elements.wrapper = null;\n                }\n\n                // Callback\n                if (is.function(callback)) {\n                    callback();\n                }\n            } else {\n                // Unbind listeners\n                unbindListeners.call(this);\n\n                // Replace the container with the original element provided\n                replaceElement(this.elements.original, this.elements.container);\n\n                // Event\n                triggerEvent.call(this, this.elements.original, 'destroyed', true);\n\n                // Callback\n                if (is.function(callback)) {\n                    callback.call(this.elements.original);\n                }\n\n                // Reset state\n                this.ready = false;\n\n                // Clear for garbage collection\n                setTimeout(() => {\n                    this.elements = null;\n                    this.media = null;\n                }, 200);\n            }\n        };\n\n        // Stop playback\n        this.stop();\n\n        // Clear timeouts\n        clearTimeout(this.timers.loading);\n        clearTimeout(this.timers.controls);\n        clearTimeout(this.timers.resized);\n\n        // Provider specific stuff\n        if (this.isHTML5) {\n            // Restore native video controls\n            ui.toggleNativeControls.call(this, true);\n\n            // Clean up\n            done();\n        } else if (this.isYouTube) {\n            // Clear timers\n            clearInterval(this.timers.buffering);\n            clearInterval(this.timers.playing);\n\n            // Destroy YouTube API\n            if (this.embed !== null && is.function(this.embed.destroy)) {\n                this.embed.destroy();\n            }\n\n            // Clean up\n            done();\n        } else if (this.isVimeo) {\n            // Destroy Vimeo API\n            // then clean up (wait, to prevent postmessage errors)\n            if (this.embed !== null) {\n                this.embed.unload().then(done);\n            }\n\n            // Vimeo does not always return\n            setTimeout(done, 200);\n        }\n    }\n\n    /**\n     * Check for support for a mime type (HTML5 only)\n     * @param {String} type - Mime type\n     */\n    supports(type) {\n        return support.mime.call(this, type);\n    }\n\n    /**\n     * Check for support\n     * @param {String} type - Player type (audio/video)\n     * @param {String} provider - Provider (html5/youtube/vimeo)\n     * @param {Boolean} inline - Where player has `playsinline` sttribute\n     */\n    static supported(type, provider, inline) {\n        return support.check(type, provider, inline);\n    }\n\n    /**\n     * Load an SVG sprite into the page\n     * @param {String} url - URL for the SVG sprite\n     * @param {String} [id] - Unique ID\n     */\n    static loadSprite(url, id) {\n        return loadSprite(url, id);\n    }\n\n    /**\n     * Setup multiple instances\n     * @param {*} selector\n     * @param {Object} options\n     */\n    static setup(selector, options = {}) {\n        let targets = null;\n\n        if (is.string(selector)) {\n            targets = Array.from(document.querySelectorAll(selector));\n        } else if (is.nodeList(selector)) {\n            targets = Array.from(selector);\n        } else if (is.array(selector)) {\n            targets = selector.filter(is.element);\n        }\n\n        if (is.empty(targets)) {\n            return null;\n        }\n\n        return targets.map(t => new Plyr(t, options));\n    }\n}\n\nPlyr.defaults = cloneDeep(defaults);\n\nexport default Plyr;\n","/**\n * Returns a number whose value is limited to the given range.\n *\n * Example: limit the output of this computation to between 0 and 255\n * (x * 255).clamp(0, 255)\n *\n * @param {Number} input\n * @param {Number} min The lower boundary of the output range\n * @param {Number} max The upper boundary of the output range\n * @returns A number in the range [min, max]\n * @type Number\n */\nexport function clamp(input = 0, min = 0, max = 255) {\n    return Math.min(Math.max(input, min), max);\n}\n\nexport default { clamp };\n"]}

Zerion Mini Shell 1.0